/* The 108 Schools design system: the landing page, the dashboards, the admin console and the policy pages.
   Ink on warm paper, one highlighter. (The classroom is the same brand at night: its own styles are in index.html.) */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap');
:root {
  --bg: #f5f4ef; --surface: #fff; --surface-2: #faf9f5; --hover: #efede6;
  --border: #e6e3da; --border-strong: #d3cfc3;
  --text: #121317; --text-2: #3c3e46; --muted: #6e707a; --subtle: #9d9fa8;
  --brand: #121317; --brand-600: #000; --brand-soft: #eef8c4; --brand-line: #cfe57a; --brand-ring: rgb(170 205 40 / .4);
  --accent: #d4f55a; --accent-ink: #161a05; --link: #4a5e00; --on-brand: #fff; --grid: rgb(18 19 23 / .035);
  --ok: #047857; --ok-soft: #ecfdf5; --warn: #b45309; --warn-soft: #fffbeb; --bad: #b91c1c; --bad-soft: #fef2f2;
  --radius: 10px; --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgb(18 19 23 / .04);
  --shadow: 0 1px 3px rgb(18 19 23 / .06), 0 14px 36px rgb(18 19 23 / .08);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
}
/* The same brand at night (the sun/moon button; remembered on the device, and shared with the classroom): graphite, with the
   highlighter doing the work the ink does by day. */
[data-theme="dark"] { color-scheme: dark;
  --bg: #0e1014; --surface: #15181e; --surface-2: #1a1d24; --hover: #21252d;
  --border: #272b34; --border-strong: #363b47;
  --text: #f2f1ed; --text-2: #c7c9d1; --muted: #9093a0; --subtle: #686c78;
  --brand: #d4f55a; --brand-600: #c6ea3f; --on-brand: #161a05; --brand-soft: rgb(212 245 90 / .12); --brand-line: rgb(212 245 90 / .3); --brand-ring: rgb(212 245 90 / .25);
  --link: #d4f55a; --grid: rgb(255 255 255 / .03);
  --ok: #4ade80; --ok-soft: rgb(74 222 128 / .12); --warn: #fbbf24; --warn-soft: rgb(251 191 36 / .12); --bad: #ff8a7a; --bad-soft: rgb(255 107 87 / .12);
  --shadow-sm: none; --shadow: 0 14px 36px rgb(0 0 0 / .45);
}
[data-theme="dark"] :is(h1, h2) em, [data-theme="dark"] .hl { background: none; color: var(--brand); padding: 0; }
[data-theme="dark"] .banner.warn { border-color: transparent; color: var(--warn); }
[data-theme="dark"] .banner.bad { border-color: transparent; color: var(--bad); }
[data-theme="dark"] .btn-danger:hover { border-color: transparent; }
html { background: var(--bg); }
body, .card, .sidebar, .input, .btn { transition: background-color .3s, border-color .3s, color .3s; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.015em; color: var(--text); }
h1 { font: 400 36px/1.08 var(--serif); letter-spacing: -.01em; }
/* a word run over with the highlighter */
h1 em, h2 em, .hl { font-style: italic; padding: 0 .1em; background: linear-gradient(transparent 56%, var(--accent) 56% 90%, transparent 90%); }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
img, svg { max-width: 100%; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); } .subtle { color: var(--subtle); } .small { font-size: 13px; } .nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
       border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
       font: 500 14px var(--font); white-space: nowrap; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn { border-radius: 999px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 1px 2px rgb(18 19 23 / .2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-accent:hover { background: #c6ea3f; border-color: #c6ea3f; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: #fecaca; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---- surfaces ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-body { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head p { margin-top: 2px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }

/* ---- layout helpers ---- */
.stack { display: grid; gap: 16px; } .stack-sm { display: grid; gap: 8px; } .stack-lg { display: grid; gap: 24px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }

/* ---- KPI tiles ---- */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); }
.kpi { padding: 16px 18px; }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .value { margin-top: 4px; font: 400 36px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.kpi .hint { margin-top: 2px; font-size: 12px; color: var(--subtle); }

/* ---- badges ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
         background: var(--hover); color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { position: sticky; top: 0; z-index: 1; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border);
            text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.wrap { max-width: 420px; }

/* ---- progress ---- */
.progress { height: 8px; border-radius: 999px; background: var(--hover); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .4s; }
.progress.ok > i { background: #10b981; }

/* ---- forms ---- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
         font: 14px var(--font); color: var(--text); transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 10px 12px; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { flex: none; width: 16px; height: 16px; margin-top: 3px; accent-color: var(--brand); }
.error { color: var(--bad); font-size: 14px; font-weight: 500; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: none; padding: 10px 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none;
               font: 500 14px var(--font); color: var(--muted); cursor: pointer; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }

/* ---- app shell: sidebar + content ---- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; padding: 18px 12px;
           background: var(--surface); border-right: 1px solid var(--border); }
.logo-link { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.logo-link:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; flex: none; border-radius: 9px; }
/* sidebar: the name with its Family/Admin tag underneath (the full name and the tag don't fit side by side) */
.sidebar .logo-link { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 2px; white-space: nowrap; }
.sidebar .logo-link .logo { grid-row: span 2; }
.sidebar .logo-link small { justify-self: start; margin-left: 0; }
.logo-link small { margin-left: auto; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 600; }
.nav { display: grid; gap: 2px; }
.nav a, .nav button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--text-2); font-size: 14px; font-weight: 500; }
.nav button { width: 100%; border: 0; background: none; font-family: var(--font); cursor: pointer; text-align: left; }
.nav button:hover { background: var(--hover); }
.nav a:hover { background: var(--hover); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav-label { padding: 14px 10px 6px; font-size: 11px; font-weight: 600; color: var(--subtle); letter-spacing: .06em; text-transform: uppercase; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px 0; border-top: 1px solid var(--border); min-width: 0; }
.sidebar-foot .who { min-width: 0; font-size: 13px; line-height: 1.3; }
.sidebar-foot .who b, .sidebar-foot .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .who span { color: var(--muted); }
.main { width: 100%; max-width: 1180px; padding: 28px 36px 56px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { margin-top: 4px; color: var(--muted); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.back svg { width: 16px; height: 16px; }

/* ---- avatars ---- */
.avatar { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; overflow: hidden;
          background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: 20px; }
.avatar img, .avatar svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 32px; height: 32px; font-size: 16px; }
.avatar.lg { width: 56px; height: 56px; font-size: 28px; }

/* ---- banners, empty states, lists ---- */
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border: 1px solid var(--brand-line);
          border-radius: var(--radius-lg); background: var(--brand-soft); color: var(--text); font-size: 14px; }
.banner svg { width: 18px; height: 18px; flex: none; }
.banner.warn { background: var(--warn-soft); border-color: #fde68a; color: #78350f; }
.banner.bad { background: var(--bad-soft); border-color: #fecaca; color: #7f1d1d; }
.banner .spacer { min-width: 8px; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 40px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 28px; height: 28px; color: var(--subtle); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .grow > * { display: block; overflow: hidden; text-overflow: ellipsis; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---- charts (no library) ---- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.bars > div { flex: 1; min-width: 4px; max-width: 44px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bars > div > i { display: block; width: 100%; min-height: 3px; border-radius: 5px 5px 2px 2px; background: var(--brand); opacity: .85; transition: opacity .15s; }
.bars > div:hover > i { opacity: 1; }
.bars > div > span { font-size: 11px; color: var(--subtle); white-space: nowrap; }

/* ---- modal, drawer, toast ---- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgb(11 12 15 / .55); animation: fade .15s; }
.modal-card { position: relative; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 24px;
              background: var(--surface); border-radius: 16px; box-shadow: 0 24px 64px rgb(11 12 15 / .3); animation: rise .2s ease-out; }
.modal-close { position: absolute; top: 12px; right: 12px; }
.drawer { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end; background: rgb(11 12 15 / .45); animation: fade .15s; }
.drawer-panel { width: min(760px, 100%); height: 100%; overflow: auto; padding: 24px 28px; background: var(--bg); box-shadow: var(--shadow); animation: slide .2s ease-out; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 70; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px;
         background: var(--text); color: var(--bg); font-size: 14px; box-shadow: var(--shadow); animation: toast .2s ease-out; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes slide { from { transform: translateX(24px); opacity: .6; } }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---- small screens: the sidebar becomes a top bar with a scrollable menu ---- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; gap: 4px; padding: 8px 12px;
             border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
  .logo-link { padding: 0 8px 0 0; }
  .logo-link > span:not(.logo), .logo-link small, .nav-label, .sidebar-foot { display: none; }
  .nav { display: flex; gap: 2px; }
  .nav a { flex: none; padding: 8px 10px; }
  .main { padding: 20px 16px 48px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .drawer-panel { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
