/* =========================================================
   Tuition Centre — design tokens
   ========================================================= */
:root {
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --surface-3: #eef0f7;
  --border: #e5e7f0;
  --border-strong: #d5d9e6;
  --text: #0f172a;
  --text-2: #5a6378;
  --muted: #8b93a7;

  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-ink: #ffffff;
  --primary-soft: #eef0ff;
  --primary-soft-ink: #4338ca;
  --hero: linear-gradient(135deg, #4338ca 0%, #6d28d9 55%, #9333ea 100%);

  --good: #047857;
  --good-soft: #e6f6ee;
  --bad: #c81e1e;
  --bad-soft: #fdeeee;
  --warn: #b45309;
  --warn-soft: #fff4e2;
  --info: #0369a1;
  --info-soft: #e5f3fb;

  --side-bg: #0f1430;
  --side-text: #a6aecb;
  --side-active: rgba(255, 255, 255, .08);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px -6px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px -12px rgba(67, 56, 202, .45);
  --ring: 0 0 0 4px rgba(79, 70, 229, .16);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0e1a;
    --surface: #121828;
    --surface-2: #171e31;
    --surface-3: #1d2540;
    --border: #232b44;
    --border-strong: #2f3956;
    --text: #e8ebf4;
    --text-2: #a3abc2;
    --muted: #747e98;
    --primary: #818cf8;
    --primary-600: #6366f1;
    --primary-ink: #0b0f1d;
    --primary-soft: #1f2452;
    --primary-soft-ink: #b4bbff;
    --hero: linear-gradient(135deg, #3730a3 0%, #5b21b6 55%, #7e22ce 100%);
    --good: #34d399;
    --good-soft: #0f2c22;
    --bad: #f87171;
    --bad-soft: #3a1717;
    --warn: #fbbf24;
    --warn-soft: #36280c;
    --info: #38bdf8;
    --info-soft: #0c2a3b;
    --side-bg: #070a14;
    --shadow: none;
    --shadow-sm: none;
    --shadow-lg: none;
    color-scheme: dark;
  }
}

/* =========================================================
   Base
   ========================================================= */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0; letter-spacing: -.02em; font-weight: 800; }
h2 { font-size: 1rem; margin: 0 0 14px; letter-spacing: -.01em; font-weight: 700; }
h3 { font-size: .9rem; margin: 0 0 8px; font-weight: 700; }
small, .muted { color: var(--text-2); }
.num, td.r { font-variant-numeric: tabular-nums; }
.ic { flex: none; display: block; }
::selection { background: var(--primary-soft); }

/* =========================================================
   App shell: sidebar (desktop), top bar + bottom nav (mobile)
   ========================================================= */
.sidebar { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: -.01em; min-width: 0; flex: 1; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: var(--hero); color: #fff; display: grid; place-items: center;
  box-shadow: 0 4px 12px -4px rgba(79, 70, 229, .6);
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer;
}

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 24px; }

.bottom-nav {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, .25);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: .68rem; font-weight: 600; color: var(--muted); padding: 6px 0; border-radius: 14px;
}
.bottom-nav a.on { color: var(--primary); }
.bottom-nav a.on .ic { stroke-width: 2.3; }
.bottom-nav .fab {
  width: 50px; height: 50px; margin: -22px auto 0; border-radius: 16px;
  background: var(--hero); color: #fff; display: grid; place-items: center;
  box-shadow: var(--shadow-lg); border: 3px solid var(--bg);
}
.bottom-nav .collect-tab { color: var(--primary); }

@media (min-width: 1000px) {
  body { padding-bottom: 0; padding-left: 256px; }
  .topbar, .bottom-nav { display: none; }
  main { padding: 32px 36px 48px; }
  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; inset: 0 auto 0 0; width: 256px; z-index: 30;
    background: var(--side-bg); color: var(--side-text);
    padding: 22px 16px;
    background-image: radial-gradient(600px 300px at -20% -10%, rgba(99, 102, 241, .25), transparent 60%);
  }
  .sidebar .brand { color: #fff; padding: 0 8px 22px; flex: none; }
  .sidebar .brand small { display: block; color: var(--side-text); font-weight: 500; font-size: .74rem; }
  .side-cta { margin: 0 4px 18px; }
  .side-label { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #6c7598; padding: 14px 12px 6px; }
  .side-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin: 2px 0; border-radius: 12px;
    color: var(--side-text); font-weight: 600; font-size: .92rem;
    transition: background .15s, color .15s;
  }
  .side-nav a:hover { background: var(--side-active); color: #fff; }
  .side-nav a.on { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 #818cf8; }
  .side-nav a.on .ic { color: #a5b4fc; }
  .side-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 14px; display: flex; align-items: center; gap: 10px; }
  .side-foot .who { flex: 1; min-width: 0; color: #fff; font-weight: 600; font-size: .9rem; }
  .side-foot .who small { display: block; color: var(--side-text); font-weight: 500; font-size: .74rem; }
  .side-foot button { background: none; border: 0; color: var(--side-text); cursor: pointer; padding: 8px; border-radius: 10px; }
  .side-foot button:hover { background: var(--side-active); color: #fff; }
}

/* =========================================================
   Page header
   ========================================================= */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: .8rem; font-weight: 600; color: var(--text-2); margin-bottom: 2px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: .9rem; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: .85rem; font-weight: 600; margin-bottom: 10px; }
.back:hover { color: var(--primary); }

/* =========================================================
   Cards, stats, layout grids
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; }
.card-head h2 { margin: 0; }
.card-head a { font-size: .85rem; font-weight: 600; }
.card.flush > h2 { padding: 18px 20px 0; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); font-size: .88rem; font-weight: 600; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-2 > * { min-width: 0; }
@media (min-width: 760px) {
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .cols-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .cols-2.even { grid-template-columns: 1fr 1fr; }
}

.stat {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  color: inherit; display: block; transition: transform .15s, box-shadow .15s, border-color .15s;
}
a.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat .label { font-size: .78rem; color: var(--text-2); font-weight: 600; }
.stat .value { font-size: 1.5rem; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .sub { font-size: .76rem; color: var(--muted); margin-top: 4px; font-weight: 500; }
.stat-icon {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  margin-bottom: 12px;
}
.tone-primary { background: var(--primary-soft); color: var(--primary-soft-ink); }
.tone-good { background: var(--good-soft); color: var(--good); }
.tone-bad { background: var(--bad-soft); color: var(--bad); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-info { background: var(--info-soft); color: var(--info); }

/* Hero (gradient) card */
.hero-card {
  position: relative; overflow: hidden;
  background: var(--hero); color: #fff;
  border-radius: var(--radius-lg); padding: 22px;
  box-shadow: var(--shadow-lg); margin-bottom: 16px;
}
.hero-card::before, .hero-card::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%);
}
.hero-card::before { width: 320px; height: 320px; right: -110px; top: -150px; }
.hero-card::after { width: 220px; height: 220px; left: -80px; bottom: -140px; opacity: .6; }
.hero-card > * { position: relative; }
.hero-card .hero-label { font-size: .82rem; font-weight: 600; opacity: .85; }
.hero-card .hero-value { font-size: 2.3rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.hero-card .hero-sub { font-size: .85rem; opacity: .85; }
.hero-progress { height: 8px; background: rgba(255, 255, 255, .22); border-radius: 99px; overflow: hidden; margin: 16px 0 8px; }
.hero-progress > span { display: block; height: 100%; background: #fff; border-radius: 99px; }
.hero-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hero-pill { background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .2); padding: 6px 12px; border-radius: 99px; font-size: .8rem; font-weight: 600; }
.hero-pill b { font-weight: 800; }
.hero-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.hero-card .btn.light { background: #fff; color: #3730a3; border-color: #fff; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .35); }

.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress > span { display: block; height: 100%; background: var(--good); border-radius: 99px; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; text-align: center;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary {
  background: var(--primary); border-color: transparent; color: var(--primary-ink);
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .55), inset 0 1px 0 rgba(255, 255, 255, .15);
}
.btn.primary:hover { background: var(--primary-600); }
.btn.gradient { background: var(--hero); color: #fff; border-color: transparent; box-shadow: var(--shadow-lg); }
.btn.good { background: var(--good); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -6px rgba(4, 120, 87, .55); }
.btn.soft { background: var(--primary-soft); color: var(--primary-soft-ink); border-color: transparent; box-shadow: none; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: transparent; box-shadow: none; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: .82rem; border-radius: 10px; gap: 6px; }
.btn.block { width: 100%; }
.btn.big { min-height: 54px; font-size: 1.02rem; border-radius: 14px; }
.btn[disabled] { opacity: .6; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; }
.side-cta .btn { width: 100%; }

/* =========================================================
   Forms
   ========================================================= */
label { display: block; font-size: .8rem; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.field { margin-bottom: 16px; }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=month],
input[type=tel], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; /* stops iOS zoom */
  transition: border-color .15s, box-shadow .15s;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238b93a7' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--muted); }
.search-box { position: relative; }
.search-box .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 44px; background: var(--surface); box-shadow: var(--shadow-sm); }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; color: var(--text); font-size: .88rem; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.amount-wrap { position: relative; }
.amount-wrap .cur { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-size: 1.6rem; font-weight: 800; color: var(--muted); }
.amount-input {
  font-size: 2rem !important; font-weight: 800; min-height: 72px !important; text-align: center;
  letter-spacing: -.02em; border-radius: 16px !important; background: var(--surface-2) !important;
}
.form-section { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 6px 0 12px; }

/* segmented choice (payment mode) */
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 520px) { .choices { grid-template-columns: repeat(4, 1fr); } }
.choices input { position: absolute; opacity: 0; pointer-events: none; }
.choices label {
  margin: 0; min-height: 48px; display: grid; place-items: center;
  border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface);
  color: var(--text); font-size: .9rem; font-weight: 700; cursor: pointer; transition: all .15s;
}
.choices input:checked + label { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-soft-ink); }
.choices input:focus-visible + label { box-shadow: var(--ring); }

.quick-amounts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.quick-amounts .btn { flex: 1 1 auto; background: var(--surface-2); box-shadow: none; border-color: var(--border); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; margin-bottom: 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font: inherit; font-size: .82rem; font-weight: 700; white-space: nowrap; cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--text); border-color: var(--text); color: var(--surface); }

/* =========================================================
   Lists & tables
   ========================================================= */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
.list .row { display: flex; align-items: center; gap: 12px; padding: 13px 20px; color: var(--text); transition: background .12s; }
.list a.row:hover, .list .row:has(> a.main:hover) { background: var(--surface-2); }
.list .row .main { flex: 1; min-width: 0; color: inherit; }
.list .row .title { font-weight: 700; font-size: .93rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .row .meta { font-size: .78rem; color: var(--text-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .row .end { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .93rem; }
.list .row .end small { font-size: .72rem; }
.list .chev { color: var(--muted); }

.avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: .82rem; letter-spacing: .02em;
  background: var(--primary-soft); color: var(--primary-soft-ink);
}
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.3rem; }
.av-0 { background: #e9e7ff; color: #4c3fd1; }
.av-1 { background: #dff4ec; color: #0b7a55; }
.av-2 { background: #fdebd9; color: #b5530a; }
.av-3 { background: #fbe4ee; color: #b5245f; }
.av-4 { background: #dcf0fb; color: #07699c; }
.av-5 { background: #f0e7fb; color: #7a33c2; }
@media (prefers-color-scheme: dark) {
  .av-0 { background: #25235a; color: #b8b2ff; }
  .av-1 { background: #11352a; color: #6ee7b7; }
  .av-2 { background: #3b2512; color: #fdba74; }
  .av-3 { background: #3c1a2a; color: #f9a8d4; }
  .av-4 { background: #0f2e40; color: #7dd3fc; }
  .av-5 { background: #2e1a45; color: #d8b4fe; }
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 12px 16px; text-align: left; border-top: 1px solid var(--border); white-space: nowrap; }
thead th {
  border-top: 0; font-size: .7rem; color: var(--muted); font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  background: var(--surface-2); padding-top: 10px; padding-bottom: 10px;
}
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
td.r, th.r { text-align: right; }
tfoot td { font-weight: 800; }
.cls-tag {
  display: inline-grid; place-items: center; min-width: 38px; height: 26px; padding: 0 8px; border-radius: 8px;
  background: var(--surface-3); color: var(--text); font-weight: 800; font-size: .8rem;
}

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .72rem; font-weight: 800; letter-spacing: .01em; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.due { background: var(--bad-soft); color: var(--bad); }
.badge.paid { background: var(--good-soft); color: var(--good); }
.badge.partial { background: var(--warn-soft); color: var(--warn); }
.badge.waived, .badge.neutral { background: var(--surface-3); color: var(--text-2); }
.amt-due { color: var(--bad); font-weight: 800; }
.amt-ok { color: var(--good); font-weight: 800; }

.flash, .error {
  display: flex; align-items: center; gap: 10px;
  border-radius: 14px; padding: 12px 16px; margin-bottom: 18px; font-weight: 600; font-size: .9rem;
  animation: drop .25s ease-out;
}
.flash { background: var(--good-soft); color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 25%, transparent); }
.error { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.empty { padding: 36px 20px; text-align: center; color: var(--text-2); }
.empty .empty-icon { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 1rem; margin-bottom: 4px; }

/* =========================================================
   Chart (single series bars)
   ========================================================= */
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; align-items: end; height: 170px; padding-top: 26px; border-bottom: 1px solid var(--border); position: relative; }
.bars::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed var(--border); }
.bar-col { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; outline: none; cursor: default; }
.bar { width: 100%; max-width: 40px; background: color-mix(in srgb, var(--primary) 32%, var(--surface)); border-radius: 6px 6px 0 0; min-height: 3px; transition: background .15s; position: relative; z-index: 1; }
.bar-col.current .bar { background: var(--primary); }
.bar-col:hover .bar, .bar-col:focus-visible .bar { background: var(--primary-600); }
.bar-col .tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%) translateY(4px);
  background: var(--text); color: var(--surface); font-size: .72rem; font-weight: 700; padding: 5px 9px; border-radius: 8px;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s, transform .15s; z-index: 2;
}
.bar-col:hover .tip, .bar-col:focus-visible .tip { opacity: 1; transform: translateX(-50%); }
.bar-labels { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; text-align: center; font-size: .72rem; font-weight: 600; color: var(--muted); padding-top: 8px; }
.bar-labels .current { color: var(--text); }
details.data-table summary { cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--text-2); margin-top: 12px; }

.mode-split { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; margin: 12px 0 10px; background: var(--surface-3); }
.mode-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; }
.mode-legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.mode-legend b { color: var(--text); }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
/* Payment mode colours: fixed per mode (validated categorical slots 1-4) */
:root { --mode-0: #2a78d6; --mode-1: #eb6834; --mode-2: #1baf7a; --mode-3: #eda100; }
@media (prefers-color-scheme: dark) { :root { --mode-0: #3987e5; --mode-1: #d95926; --mode-2: #199e70; --mode-3: #c98500; } }
.mode-0 { background: var(--mode-0); } .mode-1 { background: var(--mode-1); }
.mode-2 { background: var(--mode-2); } .mode-3 { background: var(--mode-3); }

/* =========================================================
   Attendance
   ========================================================= */
.att-list .row { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; margin: 0; font-size: .95rem; color: var(--text); font-weight: 600; }
.att-list input[type=checkbox] { display: none; }
.att-toggle {
  min-width: 92px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px; border-radius: 10px; font-weight: 800; font-size: .8rem;
  background: var(--good-soft); color: var(--good); transition: all .15s;
}
.att-list input[type=checkbox]:checked ~ .att-toggle { background: var(--bad); color: #fff; box-shadow: 0 6px 14px -6px rgba(200, 30, 30, .6); }
.att-list input[type=checkbox]:checked ~ .att-toggle .p { display: none; }
.att-list input[type=checkbox]:not(:checked) ~ .att-toggle .a { display: none; }
.att-list li:has(input[type=checkbox]:checked) { background: color-mix(in srgb, var(--bad-soft) 70%, transparent); }
.sticky-save { position: sticky; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 5; padding: 10px 0; }
@media (min-width: 1000px) { .sticky-save { bottom: 0; background: linear-gradient(transparent, var(--bg) 40%); padding-top: 24px; } }
.att-summary { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.class-tile { display: flex; align-items: center; gap: 14px; }
.class-badge {
  width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: .95rem; background: var(--surface-3); color: var(--text);
}
.class-badge.done { background: var(--good-soft); color: var(--good); }
.att-grid td.mark { text-align: center; padding: 8px 4px; font-weight: 800; font-size: .74rem; }
.att-grid td.mark.A { color: var(--bad); background: var(--bad-soft); }
.att-grid td.mark.P { color: var(--good); }
.att-grid th.day { text-align: center; padding: 8px 4px; }

/* =========================================================
   Receipt / profile / misc
   ========================================================= */
.receipt-ok { text-align: center; padding: 6px 0 8px; }
.receipt-ok .tick {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px;
  background: var(--good-soft); color: var(--good); display: grid; place-items: center;
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--good-soft) 50%, transparent);
  animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.receipt-paper {
  background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 14px; padding: 16px 18px; margin: 14px 0 18px;
}
.receipt-amount { text-align: center; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px dashed var(--border-strong); }
.receipt-amount .v { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; color: var(--good); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: .9rem; margin: 0; }
.kv dt { color: var(--text-2); font-weight: 500; }
.kv dd { margin: 0; font-weight: 700; text-align: right; }

.profile-card { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.profile-card .info { flex: 1; min-width: 180px; }
.profile-card h1 { font-size: 1.35rem; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.balance-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.balance-card .amt { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mini-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mini-stat { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.mini-stat .label { font-size: .74rem; font-weight: 700; color: var(--text-2); }
.mini-stat .value { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.mini-stat .sub { font-size: .74rem; color: var(--muted); }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--surface-3) 0);
  display: grid; place-items: center; }
.ring > span { width: 50px; height: 50px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 800; font-size: .82rem; }

.menu-list .row .stat-icon { margin: 0; }

/* =========================================================
   Auth pages
   ========================================================= */
.auth-body { padding: 0 !important; min-height: 100vh; display: grid; }
@media (min-width: 900px) { .auth-body { grid-template-columns: 1.1fr 1fr; } }
.auth-art {
  display: none; position: relative; overflow: hidden; color: #fff; padding: 48px;
  background: var(--hero);
  flex-direction: column; justify-content: space-between;
}
@media (min-width: 900px) { .auth-art { display: flex; } }
.auth-art::before, .auth-art::after {
  content: ""; position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .2), transparent 70%);
}
.auth-art::before { width: 520px; height: 520px; right: -200px; top: -180px; }
.auth-art::after { width: 380px; height: 380px; left: -140px; bottom: -160px; }
.auth-art > * { position: relative; }
.auth-art h2 { font-size: 2.2rem; line-height: 1.15; letter-spacing: -.03em; font-weight: 800; margin: 0 0 12px; max-width: 420px; }
.auth-art p { opacity: .85; max-width: 400px; margin: 0; }
.auth-feats { display: grid; gap: 12px; margin-top: 28px; }
.auth-feats div { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.auth-feats .stat-icon { margin: 0; background: rgba(255, 255, 255, .16); color: #fff; }
.auth-wrap { display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { justify-content: center; margin-bottom: 26px; flex: none; }
.auth-card .brand-mark { width: 46px; height: 46px; border-radius: 14px; }
.auth-card h1 { text-align: center; margin-bottom: 6px; }
.auth-card p.muted { text-align: center; margin: 0 0 24px; }
@media (max-width: 480px) { .hide-sm { display: none; } }
@media (min-width: 1000px) { .hide-desk { display: none; } }
.auth-art { gap: 32px; }
.bar-col:first-child .tip { left: 0; transform: translateY(4px); }
.bar-col:last-child .tip { left: auto; right: 0; transform: translateY(4px); }
.bar-col:first-child:hover .tip, .bar-col:first-child:focus-visible .tip, .bar-col:last-child:hover .tip, .bar-col:last-child:focus-visible .tip { transform: none; }
