:root {
  --ink: #101b22;
  --paper: #edefea;
  --card: #f7f8f5;
  --line: #cfd5cd;
  --muted: #6b7a75;
  --paid: #16796a;
  --unpaid: #d4a017;
  color: var(--ink);
  background: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: var(--ink); }
body { min-width: 320px; overscroll-behavior-y: none; }
button { color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.shell { min-height: 100vh; display: flex; justify-content: center; background: var(--ink); }
.app { width: 100%; max-width: 420px; min-height: 100vh; background: var(--paper); }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-variant-numeric: tabular-nums; }
.navbar { position: sticky; top: 0; z-index: 10; padding: calc(12px + env(safe-area-inset-top)) 16px 8px; background: var(--paper); border-bottom: 1px solid var(--line); }
.topline, .summary, .detail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.eyebrow, .section-title { margin: 0; color: var(--muted); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; }
.controls { display: flex; align-items: center; gap: 7px; }
.small-button, .toggle button { min-height: 25px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 3px; background: transparent; color: var(--muted); font-size: 9px; letter-spacing: .08em; }
.small-button.install { border-color: var(--paid); color: var(--paid); }
.toggle { display: flex; }
.toggle button { border-radius: 0; border-right: 0; }
.toggle button:first-child { border-radius: 3px 0 0 3px; }
.toggle button:last-child { border-right: 1px solid var(--line); border-radius: 0 3px 3px 0; }
.toggle button.active { color: var(--paper); background: var(--ink); border-color: var(--ink); }

.status-rail { display: flex; width: 100%; height: 32px; margin-top: 8px; overflow: hidden; border-radius: 3px; }
.status-segment { min-width: 4px; padding: 0 8px; border: 0; color: white; font-weight: 700; transition: width .25s ease, opacity .2s ease; }
.status-segment.paid { text-align: left; background: var(--paid); }
.status-segment.unpaid { text-align: right; background: var(--unpaid); color: var(--ink); }
.levels { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; margin-top: 5px; }
.level-cell { min-width: 0; padding: 2px; border: 0; border-radius: 3px; background: transparent; }
.level-cell.active { color: var(--paper); background: var(--ink); }
.level-label, .level-value { display: block; font-size: 10px; line-height: 1; }
.level-bar { display: flex; align-items: end; height: 30px; margin: 4px 0; overflow: hidden; border-radius: 2px; background: var(--line); }
.level-fill { display: block; width: 100%; min-height: 3%; transition: height .25s ease; }
.summary { margin-top: 5px; font-size: 11px; }
.summary button { padding: 0; border: 0; background: transparent; }
.summary .paid-label { color: var(--paid); }
.summary .unpaid-label { color: #9a7410; }
.muted { color: var(--muted); }
.position { height: 3px; margin-top: 8px; background: var(--line); }
.position span { display: block; height: 100%; transition: all .25s ease; }
.crumbs { display: flex; align-items: center; gap: 5px; margin-top: 7px; overflow-x: auto; font-size: 11px; }
.crumbs button { padding: 0 1px; border: 0; white-space: nowrap; background: transparent; color: var(--muted); }
.crumbs button:last-child { color: var(--ink); font-weight: 700; }

.pane { padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
.hint { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.stack { display: grid; gap: 10px; }
.card, .level-row, .student-card, .back { width: 100%; border: 1px solid var(--line); background: var(--card); text-align: left; transition: transform .15s ease, background .15s ease; }
.card:active, .level-row:active, .student-card:active, .back:active { transform: scale(.985); }
.card { padding: 16px; border-left-width: 5px; }
.card-kicker { color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.card-value { margin-top: 4px; font-size: 38px; font-weight: 700; line-height: 1; }
.card-meta { margin-left: 7px; color: var(--muted); font-size: 13px; }
.section-title { margin-bottom: 12px; }
.level-row { display: grid; grid-template-columns: 32px 1fr 70px; align-items: center; gap: 12px; padding: 12px; }
.level-number { font-size: 22px; font-weight: 700; }
.mini-track { height: 8px; background: var(--line); }
.mini-track span { display: block; height: 100%; }
.row-value { text-align: right; font-size: 15px; font-weight: 700; }
.student-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.student-card { min-width: 0; padding: 9px 12px; }
.nickname { overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.student-meta { margin-top: 3px; color: var(--muted); font-size: 10px; }
.detail { padding: 16px; border: 1px solid var(--line); border-top-width: 5px; background: var(--card); }
.detail-name { overflow: hidden; font-size: 34px; font-weight: 800; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.detail-id { flex: none; color: var(--muted); font-size: 15px; font-weight: 700; }
.full-name { margin-top: 5px; color: var(--muted); font-size: 15px; }
.detail dl { margin: 20px 0 0; }
.detail-line { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }
.detail dt { color: var(--muted); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.detail dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.back { margin-top: 12px; padding: 9px 12px; text-align: center; font-size: 12px; }
.enter { animation: enter .22s cubic-bezier(.2,.7,.3,1) both; }
.offline { position: fixed; right: 12px; bottom: 12px; z-index: 20; padding: 7px 10px; border-radius: 4px; background: var(--ink); color: white; font-size: 11px; box-shadow: 0 4px 18px #0004; }
.hidden { display: none !important; }

@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@supports (min-height: 100dvh) { .shell, .app { min-height: 100dvh; } }
