:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e6ec;
  --text: #14181f;
  --muted: #6b7380;
  --primary: #0f3d7a;
  --primary-2: #1a5bb0;
  --accent: #ffc72c;
  --danger: #d23f3f;
  --success: #2c8a4a;
  --radius: 10px;
  --shadow: 0 4px 16px rgba(15, 32, 60, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--primary-2);
}

code {
  background: #eef2f7;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.center {
  text-align: center;
}

/* ---------- Auth views ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(
    1200px 600px at 50% -200px,
    rgba(15, 61, 122, 0.18),
    transparent 60%
  );
}
.auth-card {
  width: 100%;
  max-width: 380px;
  display: grid;
  gap: 14px;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 4px;
}
.brand h1 {
  margin: 0;
  font-size: 18px;
}
.brand p {
  margin: 0;
}
.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.brand-logo.small {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 13px;
}

/* ---------- Forms / cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
label {
  display: grid;
  gap: 4px;
  font-size: 13px;
}
label > span {
  font-weight: 600;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="datetime-local"],
input[type="url"],
input[type="color"],
input:not([type]),
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
}
textarea {
  min-height: 90px;
  resize: vertical;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px rgba(26, 91, 176, 0.18);
}
button {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  font: inherit;
  transition: background 0.12s ease, border-color 0.12s ease;
}
button:hover {
  background: var(--surface-2);
}
button.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
button.primary:hover {
  background: var(--primary-2);
  border-color: var(--primary-2);
}
button.ghost {
  background: transparent;
}
button.danger {
  color: var(--danger);
  border-color: #f1c8c8;
  background: #fdf3f3;
}
button.danger:hover {
  background: #fae3e3;
}

.error {
  color: var(--danger);
  font-size: 13px;
}

/* ---------- Topbar / layout ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-row strong {
  display: block;
  line-height: 1.1;
}
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  font-weight: 600;
}
.tab:hover {
  background: var(--surface-2);
  color: var(--text);
}
.tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  max-width: 1280px;
  margin: 24px auto;
  padding: 0 20px;
  align-items: start;
}
.panel {
  display: grid;
  gap: 16px;
}

/* ---------- Phone preview ---------- */
.preview {
  position: sticky;
  top: 76px;
  display: grid;
  gap: 10px;
  justify-items: center;
}
.phone {
  width: 300px;
  height: 600px;
  background: #111;
  border-radius: 38px;
  padding: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18),
    inset 0 0 0 2px rgba(255, 255, 255, 0.05);
  position: relative;
}
.phone-notch {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 22px;
  background: #111;
  border-radius: 0 0 16px 16px;
  z-index: 2;
}
.phone-home {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 4px;
  background: #444;
  border-radius: 4px;
}
.phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 28px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}

/* iOS-style preview internals */
.ios {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-size: 12px;
}
.ios-status {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  font-weight: 700;
  font-size: 11px;
}
.ios-header {
  padding: 12px 16px 8px;
  display: grid;
  gap: 2px;
}
.ios-header .school {
  font-weight: 800;
  font-size: 16px;
}
.ios-header .tag {
  font-size: 11px;
  opacity: 0.85;
}
.ios-banner {
  height: 70px;
  background-size: cover;
  background-position: center;
}
.ios-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 12px;
  display: grid;
  gap: 8px;
}
.ios-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  opacity: 0.6;
  margin-top: 6px;
}
.ios-card {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 10px;
  padding: 9px 10px;
  display: grid;
  gap: 2px;
}
.ios-card .title {
  font-weight: 700;
  font-size: 12px;
}
.ios-card .meta {
  font-size: 10px;
  opacity: 0.7;
}
.ios-card.pinned {
  outline: 2px solid var(--accent);
}
.ios-tabbar {
  height: 46px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
}
.ios-tabbar div {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
}
.ios.dark {
  background: #111;
  color: #f1f1f1;
}
.ios.dark .ios-card {
  background: rgba(255, 255, 255, 0.06);
}
.ios.dark .ios-tabbar {
  background: rgba(20, 20, 20, 0.6);
  border-top-color: rgba(255, 255, 255, 0.08);
}

/* ---------- Lists / tables ---------- */
.list {
  display: grid;
  gap: 10px;
}
.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.list-row h3 {
  margin: 0 0 2px;
  font-size: 14px;
}
.list-actions {
  display: flex;
  gap: 6px;
}
.kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 12px;
}
.kv span:first-child {
  font-weight: 600;
  color: var(--muted);
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.row.three {
  grid-template-columns: 1fr 1fr 1fr;
}
.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

h2 {
  margin: 0 0 6px;
  font-size: 18px;
}
h2 + p.muted {
  margin: 0 0 6px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.badge.success {
  background: #e9f6ee;
  border-color: #bfe1cb;
  color: var(--success);
}
.badge.warn {
  background: #fff5e0;
  border-color: #f1d99a;
  color: #8a5a00;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #111;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 50;
}
.toast.success {
  background: var(--success);
}
.toast.error {
  background: var(--danger);
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .preview {
    position: static;
    justify-items: start;
  }
  .topbar {
    flex-wrap: wrap;
  }
}
