/* =====================================================================
   SandipCare student grievance portal - design system
   Mobile-first, light/dark aware, no framework dependency.
   ===================================================================== */
:root {
  --brand: #d71920;          /* Sandip red */
  --brand-600: #b8141a;
  --brand-50: #fff1f1;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ok: #15803d;   --ok-bg: #ecfdf3;
  --warn: #b45309; --warn-bg: #fff7ed;
  --info: #1d4ed8; --info-bg: #eff6ff;
  --danger: #b91c1c; --danger-bg: #fef2f2;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .12);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e5e7eb; --ink-2: #cbd5e1; --muted: #94a3b8; --line: #263043;
    --bg: #0b1020; --surface: #121a2b; --surface-2: #0f1626;
    --brand-50: rgba(215, 25, 32, .14);
    --ok-bg: rgba(21, 128, 61, .15); --warn-bg: rgba(180, 83, 9, .16);
    --info-bg: rgba(29, 78, 216, .16); --danger-bg: rgba(185, 28, 28, .16);
    --ok: #4ade80; --warn: #fbbf24; --info: #93c5fd; --danger: #fca5a5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid rgba(215, 25, 32, .35); outline-offset: 2px; border-radius: 6px; }

/* ---------------------------------------------------------------- shell */
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.topbar {
  position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.brand img { height: 34px; width: auto; }
/* Logo lockup: lion emblem + live-text wordmark (crisp at any size) */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 42px; height: 42px; border-radius: 50%; background: #fff; padding: 1px; flex: none; box-shadow: 0 0 0 1px rgba(15, 23, 42, .06); }
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-text b {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif; font-weight: 800;
  font-size: 22px; letter-spacing: .06em; color: var(--brand);
}
.logo-text span { font-size: 10.5px; font-weight: 700; letter-spacing: .42em; color: var(--ink); margin-top: 3px; padding-left: 2px; }
.logo-lg .logo-mark { width: 64px; height: 64px; }
.logo-lg .logo-text b { font-size: 32px; }
.logo-lg .logo-text span { font-size: 13px; }
.logo-light .logo-text b, .logo-light .logo-text span { color: #fff; }
.brand:hover { text-decoration: none; }
.nav { display: none; gap: 4px; margin-left: 12px; }
.nav a {
  color: var(--ink-2); padding: 8px 12px; border-radius: 999px; font-weight: 500; font-size: 14px;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--brand-50); color: var(--brand); }
.spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 14px; flex: none;
}
.user-meta { display: none; line-height: 1.2; }
.user-meta b { display: block; font-size: 14px; }
.user-meta span { font-size: 12px; color: var(--muted); }
.menu { position: relative; }
.menu > button { background: none; border: 0; padding: 0; cursor: pointer; }
.menu-panel {
  position: absolute; right: 0; top: 46px; min-width: 200px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 6px; display: none;
}
.menu.open .menu-panel { display: block; }
.menu-panel a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink); font-size: 14px; }
.menu-panel a:hover { background: var(--surface-2); text-decoration: none; }
.page { padding: 24px 0 96px; }

/* mobile bottom navigation */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px 0;
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav a:hover { text-decoration: none; }

@media (min-width: 860px) {
  .nav { display: flex; }
  .user-meta { display: block; }
  .bottom-nav { display: none; }
  .page { padding-bottom: 48px; }
}

/* ------------------------------------------------------------ components */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head p { margin: 0; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-body { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 2fr 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: 10px; border: 1px solid transparent; font: 600 15px var(--font); cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .05s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(215, 25, 32, .25); }
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 12px; font-size: 14px; }
.btn[disabled], .btn.is-loading { opacity: .65; pointer-events: none; }
.btn .spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: none; }
.btn.is-loading .spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { margin-bottom: 16px; }
.label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--ink-2); }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 400 15px var(--font); transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(215, 25, 32, .12); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.counter { float: right; font-weight: 400; color: var(--muted); font-size: 12px; }
.file-drop {
  display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px dashed var(--line); border-radius: 10px;
  background: var(--surface-2); cursor: pointer; color: var(--muted); font-size: 14px;
}
.file-drop:hover { border-color: var(--brand); }
.file-drop input { display: none; }

.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-info { background: var(--info-bg); color: var(--info); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-open { background: var(--info-bg); color: var(--info); }
.badge-closed { background: var(--ok-bg); color: var(--ok); }
.badge-overdue { background: var(--warn-bg); color: var(--warn); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
@media (min-width: 860px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 16px; display: block; color: var(--ink); }
.stat:hover { text-decoration: none; border-color: var(--brand); }
.stat.active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(215, 25, 32, .12); }
.stat small { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat strong { display: block; font-size: 28px; line-height: 1.1; margin-top: 4px; }

/* ticket list */
.toolbar { display: flex; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .input { min-height: 40px; }
.tlist { list-style: none; margin: 0; padding: 0; }
.titem { border-bottom: 1px solid var(--line); }
.titem:last-child { border-bottom: 0; }
.titem a { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 16px; color: var(--ink); }
.titem a:hover { background: var(--surface-2); text-decoration: none; }
.titem .t-no { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .03em; }
.titem .t-title { font-weight: 600; grid-column: 1; }
.titem .t-meta { font-size: 13px; color: var(--muted); grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.titem .badge { grid-row: 1 / 3; grid-column: 2; align-self: center; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty svg { width: 56px; height: 56px; color: var(--line); margin-bottom: 8px; }

/* ticket thread */
.ticket-head h1 { font-size: 1.35rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.thread { list-style: none; margin: 0; padding: 0; position: relative; }
.thread::before { content: ""; position: absolute; left: 17px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.msg { position: relative; display: grid; grid-template-columns: 36px 1fr; gap: 12px; margin-bottom: 18px; }
.msg .avatar { width: 36px; height: 36px; font-size: 13px; z-index: 1; }
.msg.agent .avatar { background: var(--ink); }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.msg.agent .bubble { background: var(--surface-2); }
.bubble-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13px; margin-bottom: 6px; }
.bubble-head b { font-size: 14px; }
.bubble-body { overflow-wrap: anywhere; white-space: normal; }
.event { display: grid; grid-template-columns: 36px 1fr; gap: 12px; margin-bottom: 18px; font-size: 13px; color: var(--muted); align-items: center; }
.event .dot { width: 36px; height: 36px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); display: grid; place-items: center; z-index: 1; }
.event .dot svg { width: 16px; height: 16px; }
.feedback { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 14px; }
.feedback summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 13px; }
.attach { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; margin-top: 10px; }

/* ------------------------------------------------------------------ auth */
/* clip (not hidden) so the page is not turned into a separate scroll container; keeps sticky/fixed bars working */
body { max-width: 100%; overflow-x: clip; }
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; background: var(--bg); }
@media (min-width: 1000px) { .auth { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-content: stretch; } }

/* Hero: campus photo under a brand gradient */
.auth-hero {
  position: relative; overflow: hidden; color: #fff; isolation: isolate;
  padding: 20px 16px 76px; display: flex; flex-direction: column; gap: 14px;
  background: #7f1d1d url("../img/logo1.jpg") center / cover no-repeat;
}
.auth-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 500px at 0% 0%, rgba(255, 77, 79, .55), transparent 60%),
    linear-gradient(160deg, rgba(185, 20, 26, .93) 0%, rgba(127, 17, 22, .9) 55%, rgba(60, 8, 12, .92) 100%);
}
.auth-hero::after {
  content: ""; position: absolute; z-index: -1; right: -120px; bottom: -120px; width: 460px; height: 460px;
  background: url("../su-watermark-logo.png") center / contain no-repeat; opacity: .08; filter: brightness(3);
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); white-space: nowrap;
}
.hero-pill svg { width: 14px; height: 14px; }
.auth-hero h2 { font-size: clamp(1.3rem, 5vw, 2.6rem); line-height: 1.15; letter-spacing: -.02em; margin: 4px 0 0; max-width: 560px; }
.auth-hero .lead { color: rgba(255, 255, 255, .88); max-width: 520px; font-size: 15px; margin: 0; display: none; }
.features, .hero-foot { display: none; }
.hero-logo .logo-mark { width: 48px; height: 48px; }
.hero-logo .logo-text b { font-size: 24px; }
@media (min-width: 600px) { .auth-hero .lead { display: block; } .auth-hero { padding: 32px 32px 84px; } }

@media (min-width: 1000px) {
  .auth-hero { padding: 48px 56px; justify-content: space-between; gap: 32px; min-height: 100vh; }
  .hero-logo .logo-mark { width: 64px; height: 64px; }
  .hero-logo .logo-text b { font-size: 32px; }
  .hero-logo .logo-text span { font-size: 13px; }
  .auth-hero .lead { display: block; font-size: 17px; margin-top: 14px; }
  .features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 640px; margin-top: 32px; }
  .feature {
    display: flex; gap: 12px; padding: 16px; border-radius: 16px;
    background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); backdrop-filter: blur(8px);
  }
  .feature i { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .18); }
  .feature i svg { width: 20px; height: 20px; }
  .feature b { display: block; font-size: 14.5px; margin-bottom: 2px; }
  .feature span { font-size: 13px; color: rgba(255, 255, 255, .82); line-height: 1.4; }
  .hero-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: rgba(255, 255, 255, .75); }
}

/* Form side */
.auth-main {
  position: relative; display: flex; align-items: flex-start; justify-content: center; min-width: 0;
  padding: 0 16px 32px; margin-top: -56px;
}
@media (min-width: 1000px) {
  .auth-main {
    align-items: center; margin-top: 0; padding: 48px 32px;
    background:
      radial-gradient(600px 300px at 100% 0%, rgba(215, 25, 32, .08), transparent 70%),
      radial-gradient(500px 300px at 0% 100%, rgba(15, 23, 42, .05), transparent 70%);
  }
}
.auth-card {
  position: relative; width: 100%; max-width: 440px; min-width: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow-lg); padding: 24px 18px;
}
@media (min-width: 480px) { .auth-card { padding: 32px; } }
.auth-card h1 { font-size: 1.45rem; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin: 0; }
.secure-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ok);
  background: var(--ok-bg); padding: 4px 10px; border-radius: 999px; margin-bottom: 14px;
}
.secure-chip svg { width: 13px; height: 13px; }

.tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin: 20px 0; }
.tabs button { height: 42px; border: 0; background: none; border-radius: 9px; font: 600 14px var(--font); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.tabs button svg { width: 16px; height: 16px; flex: none; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }

/* OTP boxes. minmax(0,1fr) + min-width:0 stop the inputs forcing their default width (the horizontal-scroll bug). */
.otp-boxes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.otp-boxes input {
  width: 100%; min-width: 0; height: 54px; padding: 0; text-align: center; font: 700 22px var(--font);
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink);
  caret-color: var(--brand); transition: border-color .15s, box-shadow .15s, background .15s;
}
.otp-boxes input.filled { background: var(--surface); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.otp-boxes input:focus { outline: 0; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px rgba(215, 25, 32, .12); }
.otp-boxes.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (max-width: 360px) { .otp-boxes { gap: 5px; } .otp-boxes input { height: 46px; font-size: 19px; border-radius: 10px; } }
.otp-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 0 18px; }
.sent-to { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 16px; font-size: 14px; }
.sent-to i { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.sent-to i svg { width: 18px; height: 18px; }

.link-btn { background: none; border: 0; color: var(--brand); font: 600 14px var(--font); cursor: pointer; padding: 0; }
.link-btn[disabled] { color: var(--muted); cursor: default; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.foot-note { text-align: center; font-size: 13px; color: var(--muted); margin: 14px 0 0; }
.erp-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--info-bg); color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.erp-note svg { flex: none; width: 18px; height: 18px; color: var(--info); margin-top: 1px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); font: 600 13px var(--font); cursor: pointer; padding: 6px; }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 42px; }

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 0 110px; }
@media (min-width: 860px) { .footer { padding-bottom: 32px; } }

/* Formatted text from older tickets (sanitised HTML) */
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich p { margin: 0 0 .7em; }
.rich ul, .rich ol { margin: 0 0 .7em; padding-left: 1.3em; }
.rich h1, .rich h2, .rich h3, .rich h4 { font-size: 1rem; margin: .6em 0 .3em; }
.rich blockquote { margin: 0 0 .7em; padding-left: 12px; border-left: 3px solid var(--line); color: var(--ink-2); }
.rich table { border-collapse: collapse; margin-bottom: .7em; }
.rich td, .rich th { border: 1px solid var(--line); padding: 4px 8px; }

/* ---------------------------------------------------------- mobile drawer */
.hamburger {
  display: inline-grid; place-items: center; width: 42px; height: 42px; margin-left: -6px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; flex: none;
}
.hamburger svg { width: 22px; height: 22px; }
@media (min-width: 860px) { .hamburger { display: none; } }

.drawer-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(15, 23, 42, .45);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.drawer {
  position: fixed; z-index: 100; top: 0; bottom: 0; left: 0; width: min(86vw, 320px);
  background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform .25s ease; visibility: hidden;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}
body.drawer-open { overflow: hidden; }
body.drawer-open .drawer { transform: none; visibility: visible; }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.drawer-close { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.drawer-close svg { width: 20px; height: 20px; }
.drawer-user { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; background: var(--brand-50); margin-bottom: 14px; }
.drawer-user b { display: block; font-size: 15px; line-height: 1.25; }
.drawer-user span { font-size: 12.5px; color: var(--muted); }
.drawer nav { display: flex; flex-direction: column; gap: 2px; }
.drawer nav a {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; color: var(--ink); font-weight: 500;
}
.drawer nav a svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.drawer nav a:hover { background: var(--surface-2); text-decoration: none; }
.drawer nav a.active { background: var(--brand-50); color: var(--brand); }
.drawer nav a.active svg { color: var(--brand); }
.drawer-sep { height: 1px; background: var(--line); margin: 10px 4px; }
.drawer-foot { margin-top: auto; }
.drawer-foot a { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 10px; border: 1px solid var(--line); color: var(--danger); font-weight: 600; }
.drawer-foot a:hover { text-decoration: none; background: var(--danger-bg); }
.drawer-foot svg { width: 18px; height: 18px; }

/* =====================================================================
   Agent console (staff) - shares the student design system
   ===================================================================== */
.container-wide { max-width: 1320px; }
.nav-more { position: relative; }
.badge-role { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); background: var(--brand-50); padding: 2px 8px; border-radius: 999px; }

/* segmented status filter */
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button, .seg a {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 13.5px var(--font); cursor: pointer;
}
.seg button:hover, .seg a:hover { background: var(--surface-2); text-decoration: none; }
.seg .on { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg .count { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.seg .on .count { background: rgba(255, 255, 255, .2); color: #fff; }

/* toolbar above tables */
.tbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.tbar .search { position: relative; flex: 1 1 260px; max-width: 420px; }
.tbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.tbar .search .input { min-height: 40px; padding-left: 38px; }
.tbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* data table: real table on desktop, stacked cards on phones */
.dtable-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.dtable th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.dtable td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dtable tbody tr:hover td { background: var(--surface-2); }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable .num { text-align: right; font-variant-numeric: tabular-nums; }
.dtable .nowrap { white-space: nowrap; }
.dtable .sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.dtable a.tno { font-weight: 700; }
.dtable tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
@media (max-width: 760px) {
  .dtable.stack thead { display: none; }
  .dtable.stack, .dtable.stack tbody, .dtable.stack tr, .dtable.stack td { display: block; width: 100%; }
  .dtable.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .dtable.stack td { border: 0; padding: 3px 0; }
  /* label | value grid so wrapped values and sub-lines stay in the value column */
  .dtable.stack td[data-label] { display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: 10px; align-items: baseline; }
  .dtable.stack td[data-label] > * { grid-column: 2; }
  .dtable.stack td[data-label]::before { content: attr(data-label); grid-column: 1; color: var(--muted); font-size: 12px; font-weight: 600; }
  .dtable.stack td.hide-sm { display: none; }
}
.tfoot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.pager { display: flex; gap: 6px; align-items: center; }
.pager button { min-width: 36px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 13px var(--font); cursor: pointer; padding: 0 10px; }
.pager button[disabled] { opacity: .45; cursor: default; }
.pager button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.loading-row td { text-align: center; color: var(--muted); padding: 32px; }
.skeleton { display: inline-block; height: 12px; width: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* forms */
.form-grid { display: grid; gap: 0 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.form-grid .span-all { grid-column: 1 / -1; }
.select[multiple] { min-height: 140px; padding: 6px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* reply composer + status pills */
.composer { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.composer .textarea { border: 0; border-radius: 0; min-height: 150px; box-shadow: none; }
.composer .textarea:focus { box-shadow: none; }
.composer-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--surface-2); border-top: 1px solid var(--line); }
.radio-pill { display: inline-flex; gap: 6px; }
.radio-pill label { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.radio-pill input { accent-color: var(--brand); }
.radio-pill input:checked + span { color: var(--brand); }

/* chart (single series column chart) */
.viz-root { --series-1: #2a78d6; --grid: var(--line); position: relative; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .viz-root { --series-1: #3987e5; } }
:root[data-theme="dark"] .viz-root { --series-1: #3987e5; }
.viz-root svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz-root .axis text { fill: var(--muted); font: 500 11px var(--font); }
.viz-root .grid line { stroke: var(--grid); stroke-width: 1; }
.viz-root .bar { fill: var(--series-1); pointer-events: none; }
.viz-root .hit { fill: transparent; cursor: default; }
.viz-root .hit:hover + .bar, .viz-root .bar.hover { filter: brightness(1.12); }
.viz-tip {
  position: absolute; pointer-events: none; background: var(--ink); color: var(--surface); font-size: 12.5px; line-height: 1.35;
  padding: 7px 10px; border-radius: 8px; box-shadow: var(--shadow-lg); transform: translate(-50%, -100%); white-space: nowrap; display: none;
}
.viz-tip b { font-size: 14px; }
details.table-view summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 13px; margin-top: 10px; }

/* Agent console has more menu items: keep the drawer until there is room for one row */
.nav a, .nav-more-btn { white-space: nowrap; }
@media (min-width: 860px) and (max-width: 1199px) {
  .agent-shell .nav { display: none; }
  .agent-shell .hamburger { display: inline-grid; }
}

/* [hidden] must win over display rules set by layouts (e.g. stacked table rows) */
[hidden] { display: none !important; }
/* stacked phone tables: badges/links keep their natural width instead of stretching */
@media (max-width: 760px) { .dtable.stack td[data-label] > * { justify-self: start; } }
/* radio pills wrap on narrow screens instead of squeezing their text */
.radio-pill { flex-wrap: wrap; }
.radio-pill label { height: auto; min-height: 34px; padding: 6px 12px; }

/* ---------------------------------------------------------- searchable dropdown (assets/js/combo.js) */
.combo { position: relative; }
.combo-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; bottom: 0; left: 12px; }
.combo-btn {
  display: block; width: 100%; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-right: 38px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 14px center no-repeat;
}
.combo-btn.is-placeholder { color: var(--muted); }
.combo-btn:disabled { background-color: var(--surface-2); color: var(--muted); cursor: default; }
.combo-btn.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(185, 28, 28, .12); }
.combo.open .combo-btn { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(215, 25, 32, .12); }
.combo-panel {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.combo-search { position: relative; padding: 8px; border-bottom: 1px solid var(--line); }
.combo-search svg { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.combo-search .input { min-height: 38px; padding-left: 36px; }
.combo-list { list-style: none; margin: 0; padding: 6px; max-height: 260px; overflow-y: auto; }
.combo-list li { padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14.5px; overflow-wrap: anywhere; }
.combo-list li.active { background: var(--surface-2); }
.combo-list li[aria-selected="true"] { color: var(--brand); font-weight: 600; }
.combo-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------- period filter bar */
.period-bar { padding: 12px 16px; }
.period-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.period-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.period-pickers { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.select-sm { min-height: 36px; height: 36px; padding: 0 32px 0 12px; font-size: 13.5px; width: auto; }
.period-custom { position: relative; }
.period-custom summary { list-style: none; }
.period-custom summary::-webkit-details-marker { display: none; }
.period-form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px; width: max-content; max-width: min(92vw, 460px);
}
.period-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.period-form .input { min-height: 36px; padding: 6px 10px; }
.period-now { margin-top: 8px; font-size: 13px; color: var(--muted); }
@media (max-width: 760px) {
  .period-pickers { margin-left: 0; width: 100%; }
  .period-form { left: 0; right: auto; }
}

/* ---------------------------------------------------------- confidential (harassment) cases */
.nav-sensitive { color: #9f1239 !important; }
.nav a.nav-sensitive.active { background: #fff1f2; color: #9f1239 !important; }
.nav-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #be123c; color: #fff; font-size: 11.5px; font-weight: 700; margin-left: 4px; }
.conf-banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; margin-bottom: 16px;
  background: linear-gradient(135deg, #fff1f2, #ffe4e6); border: 1px solid #fecdd3; color: #881337;
}
.conf-banner svg { flex: none; width: 24px; height: 24px; margin-top: 1px; }
.conf-banner b { color: #881337; }
.badge-conf { background: #fff1f2; color: #be123c; }
.flag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.flag-red { background: #fef2f2; color: #b91c1c; }
.flag-amber { background: #fff7ed; color: #b45309; }
.flag-green { background: #f0fdf4; color: #15803d; }
.safety-card {
  display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 16px 18px; border-radius: 14px; margin-bottom: 20px;
  background: linear-gradient(135deg, #881337, #be123c); color: #fff; box-shadow: 0 8px 24px rgba(190, 18, 60, .25);
}
.safety-card p { margin: 2px 0 0; color: rgba(255, 255, 255, .88); font-size: 14px; }
.safety-card .btn { background: #fff; color: #9f1239; }
.safety-card .btn:hover { background: #fff1f2; }
.helplines { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.helplines a { display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border-radius: 999px; background: var(--surface); border: 1px solid #fecdd3; color: #9f1239; font-size: 13px; font-weight: 600; }
.helplines a:hover { text-decoration: none; background: #fff1f2; }

/* ---------------------------------------------------------- user guide */
.guide-hero {
  border-radius: 20px; padding: 28px 24px; margin-bottom: 20px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(700px 300px at 0% 0%, rgba(255,77,79,.5), transparent 60%), linear-gradient(135deg, #b8141a, #6b0f12);
}
.guide-hero h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); margin: 0 0 6px; }
.guide-hero p { color: rgba(255,255,255,.88); margin: 0 0 16px; max-width: 640px; }
.guide-search { position: relative; max-width: 520px; }
.guide-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.guide-search .input { padding-left: 42px; border: 0; box-shadow: var(--shadow-lg); }
.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 1000px) { .guide-layout { grid-template-columns: 230px minmax(0, 1fr); } }
.guide-toc { display: none; }
@media (min-width: 1000px) {
  .guide-toc { display: block; position: sticky; top: 84px; align-self: start; }
  .guide-toc a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--ink-2); font-size: 14px; font-weight: 500; }
  .guide-toc a:hover { background: var(--surface); text-decoration: none; }
  .guide-toc a.on { background: var(--brand-50); color: var(--brand); }
}
.guide-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
@media (min-width: 1000px) { .guide-chips { display: none; } }
.guide-chips a { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.guide-sec { scroll-margin-top: 84px; margin-bottom: 18px; }
.guide-sec > .card-body > h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.guide-sec .ico { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.guide-sec .ico svg { width: 20px; height: 20px; }
.guide-sec .lede { color: var(--muted); margin: 0 0 16px; }
.steps { list-style: none; counter-reset: s; margin: 0 0 12px; padding: 0; display: grid; gap: 12px; }
.steps > li { counter-increment: s; position: relative; padding-left: 44px; min-height: 30px; }
.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; font-size: 14px;
}
.steps b { color: var(--ink); }
.options { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); margin-bottom: 12px; }
@media (min-width: 760px) { .options { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.option { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--surface-2); }
.option h3 { font-size: 15px; display: flex; gap: 8px; align-items: center; }
.option .tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); }
.option p, .option ol { font-size: 14px; color: var(--ink-2); margin: 0; }
.option ol { padding-left: 18px; }
.tip { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 14px; margin: 10px 0 0; background: var(--info-bg); color: var(--ink-2); }
.tip svg { flex: none; width: 18px; height: 18px; color: var(--info); margin-top: 1px; }
.tip.warn { background: var(--warn-bg); } .tip.warn svg { color: var(--warn); }
.status-grid { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.status-grid > div { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--ink-2); }
.status-grid .badge { margin-bottom: 6px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13.5px; margin: 6px 0 4px; }
.flow span { padding: 6px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; }
.flow i { color: var(--muted); font-style: normal; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-weight: 700; font-size: 18px; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 0 14px; color: var(--ink-2); font-size: 14.5px; }
.guide-empty { display: none; text-align: center; color: var(--muted); padding: 24px; }
mark.hit { background: #fef08a; color: inherit; padding: 0 1px; border-radius: 3px; }
.kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; font-size: 12.5px; background: var(--surface); }
.mock { border: 1px dashed var(--line); border-radius: 12px; padding: 12px; background: var(--surface); margin: 8px 0 4px; font-size: 13.5px; }
