/* LMS Student Portal — styles (light & dark) */
:root {
  color-scheme: light;
  --brand: #1d3fb8; --brand-2: #2f6fe0; --brand-soft: #e7edfc; --brand-ink: #15308c; --on-brand: #fff;
  --page: #f5f6f9; --surface: #ffffff; --surface-2: #f0f2f7; --border: rgba(15, 23, 42, .10); --line: #e4e7ee;
  --text: #0f172a; --text-2: #475569; --muted: #64748b;
  --good: #0f7b3f; --good-bg: #e3f6ea; --warn: #8a5a00; --warn-bg: #fff3d6; --bad: #b42318; --bad-bg: #fde8e6; --info: #1d4ed8; --info-bg: #e5edff;
  --c-class: #2a78d6; --c-present: #18a058; --c-absent: #e34948; --c-late: #eda100; --c-leave: #8b5cf6; --c-due: #eb6834; --c-exam: #d55181; --c-holiday: #64748b; --c-event: #0e9aa7;
  --radius: 14px; --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #5b7cf0; --brand-2: #7b98ff; --brand-soft: #1b2447; --brand-ink: #b8c7ff; --on-brand: #0b1020;
  --page: #0c0f17; --surface: #151a25; --surface-2: #1d2331; --border: rgba(255, 255, 255, .10); --line: #262d3d;
  --text: #eef2fb; --text-2: #c2c9d8; --muted: #95a0b5;
  --good: #4ad286; --good-bg: #12311f; --warn: #ffc94d; --warn-bg: #332a10; --bad: #ff8a80; --bad-bg: #3a1716; --info: #8fb1ff; --info-bg: #182446;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand: #5b7cf0; --brand-2: #7b98ff; --brand-soft: #1b2447; --brand-ink: #b8c7ff; --on-brand: #0b1020;
    --page: #0c0f17; --surface: #151a25; --surface-2: #1d2331; --border: rgba(255, 255, 255, .10); --line: #262d3d;
    --text: #eef2fb; --text-2: #c2c9d8; --muted: #95a0b5;
    --good: #4ad286; --good-bg: #12311f; --warn: #ffc94d; --warn-bg: #332a10; --bad: #ff8a80; --bad-bg: #3a1716; --info: #8fb1ff; --info-bg: #182446;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--page); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .35em; line-height: 1.25; }
h1 { font-size: 24px; } h2 { font-size: 17px; } h3 { font-size: 15.5px; }
p { margin: 0 0 .7em; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.txt-bad { color: var(--bad); }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
pre.code { background: var(--surface-2); padding: 10px; border-radius: 10px; overflow-x: auto; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; }
.ic { width: 20px; height: 20px; flex-shrink: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; cursor: pointer; background: var(--brand); color: var(--on-brand); font: inherit; font-weight: 650; padding: 10px 16px; border-radius: 11px; text-decoration: none !important; white-space: nowrap; }
.btn:hover { filter: brightness(1.07); } .btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); } .btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: #c62828; color: #fff; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; } .btn.lg { padding: 13px 22px; font-size: 16px; } .btn.block { width: 100%; }
.install-btn { border: 0; background: #fff; color: var(--brand-ink); font: inherit; font-weight: 700; font-size: 13px; padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.install-btn.big { background: var(--brand-soft); color: var(--brand-ink); padding: 11px 18px; font-size: 15px; margin-top: 14px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .15); color: #fff; display: inline-grid; place-items: center; cursor: pointer; }
.icon-x { border: 0; background: transparent; font-size: 18px; cursor: pointer; color: var(--muted); padding: 4px 8px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 650; color: var(--text-2); }
.field small { color: var(--muted); font-size: 12px; }
.field.inline { margin: 0; }
input, select, textarea { font: inherit; font-size: 15px; color: var(--text); background: var(--surface); border: 1px solid #c9cfdb; border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { border-color: #39425a; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
input[type=checkbox], input[type=radio] { width: auto; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0 10px; cursor: pointer; }
.check.inline { display: inline-flex; margin: 0 12px 6px 0; }
.pw { position: relative; display: block; } .pw input { padding-right: 64px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--brand); font-weight: 650; font-size: 13px; cursor: pointer; padding: 6px; }
.form-error { color: var(--bad); font-size: 14px; min-height: 18px; margin: 4px 0 10px; } .form-ok { color: var(--good); font-size: 14px; margin: 4px 0 10px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; } .grid-form .span2, .grid-form .photo-pick { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid-form, .two-col { grid-template-columns: 1fr; } }
.photo-pick { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; } .photo-pick small { color: var(--muted); }
.days { display: flex; flex-wrap: wrap; }
.search { max-width: 380px; }

/* landing */
.lp-nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 12px 22px; padding-top: max(12px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.lp-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); font-size: 17px; text-decoration: none !important; }
.lp-brand img { border-radius: 9px; }
.lp-links { display: flex; gap: 18px; margin-left: auto; } .lp-links a { color: var(--text-2); font-weight: 600; font-size: 14px; }
.lp-cta { display: flex; gap: 8px; }
@media (max-width: 760px) { .lp-links { display: none; } .lp-cta { margin-left: auto; } .lp-nav { padding: 10px 14px; } .lp-brand span { font-size: 15px; } }
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 30px; align-items: center; max-width: 1150px; margin: 0 auto; padding: 56px 22px 40px; }
.eyebrow { color: var(--brand); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 13px; margin-bottom: 6px; }
.hero h1 { font-size: clamp(34px, 6vw, 54px); letter-spacing: -.02em; margin-bottom: 12px; }
.lead { font-size: 18px; color: var(--text-2); max-width: 560px; }
.hero-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.hero-art { display: grid; place-items: center; }
.mock { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: 0 20px 60px rgba(29, 63, 184, .18); padding: 18px; }
.mock-top { height: 54px; border-radius: 14px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); margin-bottom: 16px; }
.mock-row { display: flex; justify-content: space-between; font-size: 14px; margin-top: 10px; }
.mock-bar { height: 8px; background: var(--surface-2); border-radius: 99px; margin-top: 6px; } .mock-bar i { display: block; height: 100%; border-radius: 99px; background: var(--brand-2); }
.mock-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; } .mock-chips em { font-style: normal; font-size: 12.5px; background: var(--brand-soft); color: var(--brand-ink); padding: 5px 10px; border-radius: 99px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; padding-top: 30px; } .hero-art { display: none; } }
.lp-section { max-width: 1150px; margin: 0 auto; padding: 40px 22px; }
.lp-section.alt { background: var(--surface); max-width: none; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.lp-section.alt > * { max-width: 1106px; margin-left: auto; margin-right: auto; }
.lp-section h2 { font-size: 26px; margin-bottom: 18px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.feature-grid article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.feature-grid article span { font-size: 26px; } .feature-grid article p { color: var(--text-2); font-size: 14px; margin: 0; }
.steps-row { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.steps-row li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: grid; gap: 4px; } .steps-row span { color: var(--text-2); font-size: 14px; }
details { background: var(--page); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; } summary { cursor: pointer; font-weight: 650; } details p { margin: 8px 0 0; color: var(--text-2); }
.lp-footer { text-align: center; padding: 30px 20px calc(30px + env(safe-area-inset-bottom)); color: var(--text-2); }
.course-card .meta, ul.meta { list-style: none; padding: 0; margin: 8px 0 12px; font-size: 13.5px; color: var(--text-2); display: grid; gap: 3px; }

/* auth */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: max(20px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom)); background: radial-gradient(900px 500px at 0% -10%, var(--brand-soft), transparent 60%), var(--page); }
.auth-card { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 26px 22px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 720px; }
.auth-card h1 { font-size: 22px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; color: var(--text); text-decoration: none !important; }
.auth-brand img { width: 44px; height: 44px; border-radius: 12px; } .auth-brand b { display: block; } .auth-brand span { font-size: 13px; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 16px 0 10px; } .divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.demo-box { margin-top: 16px; background: var(--warn-bg); color: var(--text); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.7; }
.gate-ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; margin: 0 auto 10px; }
.gate-ico.warn { background: var(--warn-bg); } .gate-ico.bad { background: var(--bad-bg); color: var(--bad); }
.card.soft { background: var(--surface-2); box-shadow: none; margin: 12px 0; }

/* app shell */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: linear-gradient(90deg, #1d3fb8, #2a5bd7); color: #fff; }
:root[data-theme="dark"] .topbar { background: linear-gradient(90deg, #14286f, #1b3a91); }
.tb-logo { width: 34px; height: 34px; border-radius: 9px; background: #fff; }
.tb-title { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; } .tb-title b { font-size: 15.5px; } .tb-title span { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-pill { background: #ffd34d; color: #3a2a00; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; letter-spacing: .05em; }
.spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 8px; } .me-name { display: flex; flex-direction: column; font-size: 13px; font-weight: 650; line-height: 1.2; } .me-name small { font-weight: 500; opacity: .85; }
.menu-btn { display: none; }
.shell { display: flex; min-height: calc(100vh - 58px); }
.sidenav { width: 240px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); padding: 12px 10px; position: sticky; top: 58px; height: calc(100vh - 58px); overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font: inherit; font-weight: 600; font-size: 14.5px; background: transparent; border: 0; cursor: pointer; text-decoration: none !important; position: relative; }
.nav-item:hover { background: var(--surface-2); color: var(--text); } .nav-item.active { background: var(--brand-soft); color: var(--brand-ink); }
.nav-badge { margin-left: auto; font-style: normal; background: #e34948; color: #fff; font-size: 11.5px; font-weight: 800; min-width: 20px; height: 20px; border-radius: 99px; display: inline-grid; place-items: center; padding: 0 6px; }
.nav-badge:empty { display: none; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 6px; }
main { flex: 1; min-width: 0; padding: 22px 24px 50px; max-width: 1240px; }
main:focus { outline: none; }
.bottomnav { display: none; } .scrim { display: none; }
@media (max-width: 900px) {
  .menu-btn { display: inline-grid; } .me-name, .install-btn:not(.big) { display: none; }
  .tb-title b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .tb-logo { width: 30px; height: 30px; } .topbar { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .sidenav { position: fixed; left: 0; top: 0; bottom: 0; height: 100%; z-index: 60; transform: translateX(-105%); transition: transform .2s ease; width: 275px; padding-top: max(16px, env(safe-area-inset-top)); box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  .sidenav.open { transform: none; } .scrim.open { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 50; }
  main { padding: 14px 12px calc(90px + env(safe-area-inset-bottom)); }
  .bottomnav { display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav button { position: relative; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 11px; font-weight: 650; padding: 8px 2px 7px; display: grid; justify-items: center; gap: 2px; cursor: pointer; }
  .bottomnav button .ic { width: 22px; height: 22px; } .bottomnav button.active { color: var(--brand); }
  .bottomnav .nav-badge { position: absolute; top: 3px; left: 55%; margin: 0; min-width: 17px; height: 17px; font-size: 10px; }
}

/* page content */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { margin: 2px 0 0; color: var(--text-2); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { margin: 22px 0 12px; }
.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid.small-stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
@media (max-width: 420px) { .grid.two { grid-template-columns: 1fr; } .grid.stats { grid-template-columns: 1fr 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; margin-bottom: 14px; }
.grid > .card { margin-bottom: 0; }
.card.highlight { outline: 2px solid var(--brand); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.stat .stat-label { font-size: 13px; color: var(--text-2); font-weight: 650; }
.stat .stat-value { font-size: 28px; font-weight: 750; letter-spacing: -.01em; margin: 2px 0; }
.stat .stat-sub { font-size: 12.5px; color: var(--muted); }
.stat.warn { border-color: #f3c35a; } .stat.warn .stat-value { color: var(--warn); }
.stat.bad { border-color: #f0a7a1; } .stat.bad .stat-value { color: var(--bad); }
.note { border-radius: 12px; padding: 11px 14px; margin-bottom: 14px; font-size: 14px; } .note.warn { background: var(--warn-bg); }
.welcome { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: linear-gradient(120deg, var(--brand-soft), var(--surface)); }
.welcome-l { display: flex; align-items: center; gap: 14px; } .welcome h1 { font-size: 21px; margin: 0; } .welcome p { margin: 2px 0 0; }
.avatar { border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; flex-shrink: 0; background: var(--brand-soft); color: var(--brand-ink); font-weight: 800; }
.who { display: flex; align-items: center; gap: 10px; }
.profile-top { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; } .kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); } .kv b { font-weight: 650; text-align: right; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; margin: 10px 0; } @media (max-width: 560px) { .kv-grid { grid-template-columns: 1fr; } }
.progress { height: 9px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; } .progress > div { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 99px; }
.progress-label { font-size: 12.5px; color: var(--muted); }
.cprog { margin-bottom: 12px; }
ul.list { list-style: none; margin: 0; padding: 0; } ul.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); } ul.list li:last-child { border-bottom: 0; }
ul.list li.col { flex-direction: column; align-items: stretch; gap: 2px; } ul.list li.col p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
ul.list.act li { justify-content: flex-start; } ul.list.act li > div { flex: 1; min-width: 0; font-size: 14px; }
.act-ico { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; flex-shrink: 0; }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: 5px 0; display: flex; align-items: center; gap: 8px; }
.date-pill { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 12px; padding: 3px 8px; border-radius: 8px; white-space: nowrap; }
ul.list li .date-pill + span { flex: 1; }
.empty { text-align: center; padding: 22px 10px; color: var(--muted); } .empty-ico { font-size: 30px; } .empty p { margin: 6px 0 0; }
.loading { padding: 40px; text-align: center; color: var(--muted); } .spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -3px; margin-right: 6px; } @keyframes sp { to { transform: rotate(360deg); } }
.error-card { border-color: var(--bad); }
.feedback { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.assess.missed { border-left: 4px solid var(--bad); } .assess.pending { border-left: 4px solid var(--warn); } .assess.graded { border-left: 4px solid var(--good); } .assess.submitted { border-left: 4px solid var(--info); }
.toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .field.inline > span { font-size: 12px; } .toolbar select, .toolbar input[type=date] { width: auto; min-width: 180px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.badge.good { background: var(--good-bg); color: var(--good); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }

/* tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; }
.tab { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-weight: 650; font-size: 13.5px; padding: 7px 13px; border-radius: 99px; cursor: pointer; white-space: nowrap; }
.tab.active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.tab .count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: rgba(127, 127, 127, .18); font-size: 12px; margin-left: 4px; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; } .table-wrap.scroll-y { max-height: 420px; overflow-y: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.actions { white-space: nowrap; text-align: right; } table.data td.actions .btn + .btn { margin-left: 6px; }
table.data tr:last-child td { border-bottom: 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg label { cursor: pointer; } .seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 6px 11px; font-size: 13px; font-weight: 650; color: var(--text-2); border-right: 1px solid var(--border); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { color: #fff; } .seg-present input:checked + span { background: var(--c-present); } .seg-late input:checked + span { background: var(--c-late); color: #2a1d00; } .seg-absent input:checked + span { background: var(--c-absent); } .seg-leave input:checked + span { background: var(--c-leave); }
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: -2px; }

/* modal */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(10, 15, 30, .45); display: grid; place-items: center; padding: 14px; overflow-y: auto; }
.modal { width: 100%; max-width: 480px; background: var(--surface); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); max-height: calc(100dvh - 28px); display: flex; flex-direction: column; }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 6px; } .modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 8px 18px 18px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
body.modal-open { overflow: hidden; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(10px); background: #1e293b; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; z-index: 300; opacity: 0; transition: .2s; pointer-events: none; max-width: 92vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%); } .toast.good { background: #0f6a37; } .toast.bad { background: #a1261c; } .toast.warn { background: #7a5200; }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; } .cal-head h3 { margin: 0 auto 0 4px; font-size: 18px; order: -1; flex: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-cell { min-height: 84px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 5px; text-align: left; font: inherit; color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-cell.out { border: 0; background: transparent; cursor: default; }
.cal-cell.today { border-color: var(--brand); } .cal-cell.today .cal-num { background: var(--brand); color: var(--on-brand); }
.cal-cell.sel { box-shadow: inset 0 0 0 2px var(--brand-2); }
.cal-num { font-size: 12.5px; font-weight: 700; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal-items { display: flex; flex-direction: column; gap: 2px; }
.cal-items i { font-style: normal; font-size: 10.5px; font-weight: 650; color: #fff; padding: 1px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-class { background: var(--c-class); } .chip-present { background: var(--c-present); } .chip-absent { background: var(--c-absent); } .chip-late { background: var(--c-late); color: #2a1d00 !important; } .chip-leave { background: var(--c-leave); } .chip-due { background: var(--c-due); } .chip-exam { background: var(--c-exam); } .chip-holiday { background: var(--c-holiday); } .chip-event { background: var(--c-event); } .chip-more { background: var(--surface-2); color: var(--text-2) !important; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; font-size: 12.5px; color: var(--text-2); } .cal-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.cal-day { margin: 0; } .cal-day h4 { margin-bottom: 6px; }
i.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
@media (max-width: 640px) {
  .cal-cell { min-height: 54px; padding: 3px; } .cal-items { flex-direction: row; flex-wrap: wrap; gap: 2px; }
  .cal-items i { width: 7px; height: 7px; padding: 0; border-radius: 50%; font-size: 0; } .cal-items i.chip-more { display: none; }
}

/* ID card */
.id-wrap { display: grid; place-items: center; background: var(--surface-2); }
.id-canvas { width: 100%; max-width: 560px; height: auto; border-radius: 18px; box-shadow: 0 10px 30px rgba(15, 23, 42, .18); }
#printImg { display: none; }
@media print {
  body * { visibility: hidden !important; }
  #printImg { display: block !important; visibility: visible !important; position: fixed; left: 10mm; top: 10mm; width: 86mm; }
}

/* ---------- security ---------- */
.alert-bad { border-left: 4px solid var(--bad); background: var(--bad-bg); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.alert-bad .btn { margin-left: auto; }
.pin-input { letter-spacing: 12px; font-size: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.pin-input.big { display: block; width: 100%; max-width: 220px; margin: 8px auto 6px; font-size: 30px; padding: 12px; }
.sec-ok { color: var(--good); font-weight: 650; }
.auth-card p.center.small { margin-top: 14px; }

/* ---------- student dashboard polish ---------- */
.welcome-date { margin: 0 0 2px !important; text-transform: none; letter-spacing: .01em; }
.welcome-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px !important; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 0 16px; }
.quick-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 10px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 650; font-size: 14px; cursor: pointer; transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
.quick-btn span { font-size: 18px; line-height: 1; }
.quick-btn:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(29, 63, 184, .12); transform: translateY(-1px); }
.quick-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.next-class { border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 12px; display: grid; gap: 6px; text-align: center; }
@media (max-width: 700px) {
  .quick { grid-template-columns: 1fr 1fr; gap: 8px; }
  .quick-btn { flex-direction: column; gap: 4px; padding: 12px 6px; font-size: 13px; }
  .quick-btn span { font-size: 20px; }
}
@media (max-width: 420px) {
  /* odd last stat card fills the row instead of sitting alone */
  .grid.stats > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .welcome .btn { width: 100%; }
}

/* ---------- chat with management ---------- */
.bottomnav button { min-width: 0; }
@media (max-width: 900px) { .bottomnav button { font-size: 10.5px; } .bottomnav button span { white-space: nowrap; } }
.quick { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) { .quick { grid-template-columns: 1fr 1fr; } }
.chat-card { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.chat-box { height: min(60vh, 560px); min-height: 280px; overflow-y: auto; padding: 14px 14px 6px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; scroll-behavior: smooth; }
.chat-box .loading, .chat-box .chat-empty { margin: auto; }
.chat-day { text-align: center; margin: 8px 0 2px; } .chat-day span { background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 650; padding: 2px 10px; border-radius: 99px; }
.bubble-row { display: flex; } .bubble-row.me { justify-content: flex-end; } .bubble-row.them { justify-content: flex-start; }
.bubble { max-width: min(78%, 520px); padding: 8px 12px 5px; border-radius: 16px; font-size: 14.5px; line-height: 1.4; word-break: break-word; box-shadow: 0 1px 1px rgba(15, 23, 42, .06); }
.bubble-row.me .bubble { background: var(--brand); color: var(--on-brand); border-bottom-right-radius: 5px; }
.bubble-row.them .bubble { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.b-meta { font-size: 11px; opacity: .72; text-align: right; margin-top: 2px; } .tick { margin-left: 5px; letter-spacing: -2px; } .tick.seen { opacity: 1; color: #9fe6bd; }
:root[data-theme="light"] .bubble-row.me .tick.seen { color: #c8f5da; }
.chat-quick { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px 0; scrollbar-width: none; } .chat-quick::-webkit-scrollbar { display: none; } .chat-quick .tab { flex-shrink: 0; font-size: 12.5px; padding: 5px 11px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(10px + env(safe-area-inset-bottom) * 0); }
.chat-form textarea { resize: none; max-height: 120px; border-radius: 18px; padding: 10px 14px; line-height: 1.35; }
.chat-form .btn { border-radius: 18px; padding: 10px 18px; }
.chat-layout { display: grid; grid-template-columns: 320px 1fr; gap: 14px; align-items: start; }
.chat-layout > .card { margin: 0; padding: 0; overflow: hidden; }
.chat-list-head { padding: 10px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); } .chat-list-head .search { max-width: none; }
.chat-list { max-height: min(66vh, 600px); overflow-y: auto; }
.chat-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.chat-item:hover { background: var(--surface-2); } .chat-item.active { background: var(--brand-soft); }
.ci-main { flex: 1; min-width: 0; display: flex; flex-direction: column; } .ci-top { display: flex; justify-content: space-between; gap: 6px; } .ci-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ci-last.strong { font-weight: 700; color: var(--text); }
.chat-item .nav-badge { margin-left: 0; }
.chat-thread-card { display: flex; flex-direction: column; min-height: 420px; }
.chat-thread-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; } .chat-thread-head .grow { flex: 1; min-width: 120px; }
.chat-back { display: none; }
.chat-placeholder { margin: auto; padding: 30px; }
@media (max-width: 800px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-layout.has-sel .chat-list-card { display: none; } .chat-layout:not(.has-sel) .chat-thread-card { display: none; }
  .chat-back { display: inline-flex; } .chat-box { height: 58vh; }
}

/* ---------- fees & challan ---------- */
.challan-card .amt { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.challan-card.unpaid { border-left: 4px solid var(--warn); } .challan-card.submitted { border-left: 4px solid var(--info); } .challan-card.paid { border-left: 4px solid var(--good); }
.note.info { background: var(--info-bg); }
.steps-list { padding-left: 18px; margin: 10px 0 0; color: var(--text-2); } .steps-list li { margin-bottom: 4px; }
.challan-canvas { width: 100%; max-width: 520px; height: auto; border-radius: 6px; box-shadow: 0 6px 24px rgba(15, 23, 42, .18); background: #fff; }
.receipt-img { max-width: 100%; max-height: 360px; border-radius: 10px; border: 1px solid var(--border); }
#printChallan { display: none; }
@media print {
  body.printing-challan #printImg { display: none !important; }
  body.printing-challan #printChallan { display: block !important; visibility: visible !important; position: fixed; left: 0; top: 0; width: 200mm; max-height: 285mm; margin: 5mm 5mm; object-fit: contain; }
  @page { margin: 0; }
}

.stat .stat-value .money { font-size: 22px; white-space: nowrap; }
@media (max-width: 800px) { .chat-card .chat-box { height: calc(100dvh - 400px); min-height: 220px; } }
