/* =====================================================================
   SRM AP SafeCampus — UI v3 (light theme)
   One design system: tokens → base → components → shells → pages.
   Brand colours: SRM AP navy + gold. Change tokens here, everything follows.
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --navy: #0B2A5B;
  --navy-2: #163E7E;
  --navy-soft: #EAF0F9;
  --navy-line: #C9D5EA;
  --gold: #F2A900;
  --gold-ink: #7A5000;
  --gold-soft: #FFF6DE;
  --ink: #0F1B32;
  --text: #2B3A55;
  --muted: #627189;
  --line: #E0E6EF;
  --line-2: #EEF2F7;
  --paper: #F5F7FB;
  --card: #FFFFFF;
  --red: #D92D20;
  --red-2: #B42318;
  --red-soft: #FDEDEB;
  --rose: #A3195B;
  --rose-soft: #FCEBF3;
  --green: #12805C;
  --green-soft: #E6F5EE;
  --blue: #1D5FD1;
  --blue-soft: #EAF1FD;

  --r-lg: 18px;
  --r: 14px;
  --r-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 50, .05);
  --shadow: 0 1px 2px rgba(15, 27, 50, .04), 0 8px 24px rgba(15, 27, 50, .06);
  --shadow-lg: 0 24px 60px rgba(15, 27, 50, .22);

  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --side-w: 272px;
  --top-h: 64px;
  color-scheme: light;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--text); background: var(--paper); -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }

/* scroll everywhere, scrollbars hidden */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0 0 .85em; }
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
small { font-size: 14px; }
.muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
code { font-size: 13px; background: var(--line-2); padding: 2px 6px; border-radius: 6px; }
pre { white-space: pre-wrap; word-break: break-all; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; font-size: 13px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* every inline svg icon sits on the text centre line */
.ico { flex: none; display: inline-block; vertical-align: middle; }

/* ---------- 3. Icon chip ---------- */
.ic { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--navy-soft); color: var(--navy); line-height: 0; }
.ic .ico { display: block; }
.ic.sm { width: 32px; height: 32px; border-radius: 10px; }
.ic.lg { width: 48px; height: 48px; border-radius: 14px; }
.ic.red { background: var(--red-soft); color: var(--red); }
.ic.gold { background: var(--gold-soft); color: var(--gold-ink); }
.ic.rose { background: var(--rose-soft); color: var(--rose); }
.ic.green { background: var(--green-soft); color: var(--green); }
.ic.blue { background: var(--blue-soft); color: var(--blue); }
.ic.white { background: rgba(255,255,255,.16); color: #fff; }
.ic.solid { background: var(--navy); color: #fff; }
.ic.solid.red { background: var(--red); color: #fff; }

/* ---------- 4. Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border: 1px solid transparent; border-radius: var(--r-sm); background: var(--navy); color: #fff; font: 600 15px/1.2 var(--font); text-decoration: none !important; white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; }
.btn .ico { margin: 0 -2px; }
.btn:hover { background: var(--navy-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: #E09D00; }
.btn-outline { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-outline:hover { background: var(--navy-soft); border-color: var(--navy-line); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: var(--red-2); }
.btn-rose { background: var(--rose); }
.btn-rose:hover { background: #87124A; }
.btn-ok { background: var(--green); }
.btn-ok:hover { background: #0D6849; }
.btn-text { background: transparent; color: var(--navy-2); min-height: 36px; padding: 6px 10px; }
.btn-text:hover { background: var(--navy-soft); }
.btn-sm { min-height: 36px; padding: 7px 12px; font-size: 14px; border-radius: 9px; }
.btn-xl { min-height: 54px; padding: 14px 22px; font-size: 17px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-white, .btn-light { background: #fff; color: var(--red-2); }
.btn-white:hover, .btn-light:hover { background: #FFF1F0; }
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn-ghost-light:hover { background: rgba(255,255,255,.12); }
.icon-btn { position: relative; display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--ink); cursor: pointer; }
.icon-btn:hover { background: var(--navy-soft); text-decoration: none; }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }
.bell em, .nav-badge { position: absolute; top: 3px; right: 2px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font: 700 12px/20px var(--font); font-style: normal; text-align: center; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- 5. Forms ---------- */
label { display: block; margin-bottom: 7px; font-size: 15px; font-weight: 600; color: var(--ink); }
.field { margin-bottom: 16px; }
.field small { display: block; margin-top: 6px; color: var(--muted); font-weight: 400; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]):not([type=hidden]), select, textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: #fff; color: var(--ink); font: 16px/1.4 var(--font); -webkit-appearance: none; appearance: none; transition: border-color .15s, box-shadow .15s;
}
select { padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23627189' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 15px center; }
select:disabled { background-color: var(--line-2); color: var(--muted); }
textarea { min-height: 110px; resize: vertical; }
input[type=file] { width: 100%; padding: 12px; border: 1.5px dashed var(--navy-line); border-radius: var(--r-sm); background: #FAFBFE; font: 15px var(--font); }
input[type=color] { width: 100%; height: 50px; padding: 4px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy-2) !important; box-shadow: 0 0 0 4px rgba(22, 62, 126, .12); }
::placeholder { color: #9AA5B8; }
.check { display: flex; align-items: flex-start; gap: 12px; margin: 0; font-size: 15px; font-weight: 500; color: var(--text); cursor: pointer; }
.check input { flex: none; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--navy); }
.check.field { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
@media (max-width: 680px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form > input, .inline-form > select { flex: 1; min-width: 0; }
@media (max-width: 520px) { .inline-form { flex-direction: column; } }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 70px !important; }
.input-wrap .reveal { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: 600 13px var(--font); cursor: pointer; }
.input-wrap .reveal:hover { background: var(--line-2); }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 10px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: #fff; color: var(--ink); font-size: 16px; font-weight: 600; cursor: pointer; transition: all .15s; }
.seg span em { font-style: normal; font-size: 22px; line-height: 1; }
.seg input:checked + span { border-color: var(--navy); background: var(--navy-soft); box-shadow: inset 0 0 0 1px var(--navy); }
.seg label.female input:checked + span { border-color: var(--rose); background: var(--rose-soft); box-shadow: inset 0 0 0 1px var(--rose); }
.seg input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }

.form-section { margin-bottom: 20px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.form-section:last-of-type { border-bottom: 0; }
.form-section h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 16px; }
.form-section h3 .step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 13px; }
.pw-meter { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.pw-meter i { display: block; width: 0; height: 100%; background: var(--red); transition: width .2s, background .2s; }

/* ---------- 6. Notes, pills, counts ---------- */
.note { display: block; margin-bottom: 16px; padding: 13px 16px; border: 1px solid; border-radius: var(--r-sm); font-size: 15px; }
.note-err { background: var(--red-soft); border-color: #F6C3BE; color: #8F1D14; }
.note-ok { background: var(--green-soft); border-color: #B7E1CD; color: #0A5A40; }
.note-warn { background: var(--gold-soft); border-color: #F5DA94; color: var(--gold-ink); }
.note-info { background: var(--blue-soft); border-color: #C6D7F6; color: #183F8A; }
.note-rose { background: var(--rose-soft); border-color: #F0C2D7; color: #7C1145; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.4; white-space: nowrap; vertical-align: middle; }
.pill-danger { background: var(--red-soft); color: var(--red-2); }
.pill-warn { background: var(--gold-soft); color: var(--gold-ink); }
.pill-info { background: var(--blue-soft); color: #1A4BA6; }
.pill-ok { background: var(--green-soft); color: #0A5A40; }
.pill-muted { background: var(--line-2); color: var(--muted); }
.pill-rose { background: var(--rose-soft); color: var(--rose); }
.pill-navy { background: var(--navy-soft); color: var(--navy); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--gold); color: var(--ink); font-size: 12px; font-weight: 700; line-height: 1; vertical-align: middle; }

/* ---------- 7. Cards, lists, tables ---------- */
.card { margin-bottom: 20px; padding: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); box-shadow: var(--shadow); }
.card > h2, .card-head h2, .section-title h2 { display: flex; align-items: center; gap: 12px; }
.card > h2 { margin-bottom: 16px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { margin: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-head, .card-flush > h2 { padding: 18px 22px 0; margin-bottom: 14px; }
.card-sub { margin: -8px 0 16px; color: var(--muted); font-size: 15px; }

.list { overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; box-shadow: var(--shadow); }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); color: inherit; text-decoration: none !important; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: #FAFBFE; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .body b { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--ink); font-size: 16px; }
.list-item .body p, .list-item .body small { display: block; margin: 2px 0 0; overflow: hidden; color: var(--muted); font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
.list-item .meta { display: grid; flex: none; justify-items: end; gap: 4px; color: var(--muted); font-size: 13px; text-align: right; }
.list-item > .ico:last-child { color: #A9B3C4; }

.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; }
.t th { padding: 12px 16px; border-bottom: 1px solid var(--line); background: #FAFBFD; color: var(--muted); font-size: 13px; font-weight: 700; text-align: left; white-space: nowrap; }
.t td { padding: 14px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: #FBFCFE; }
.t tr.is-hot td { background: #FFF6F5; }
.t .who { display: flex; align-items: center; gap: 12px; }
.t .who b { display: block; color: var(--ink); }
.t small { color: var(--muted); font-size: 13px; }
/* Phones: table rows become stacked cards */
@media (max-width: 760px) {
  .t thead { display: none; }
  .t, .t tbody, .t tr, .t td { display: block; width: 100%; }
  .t tr { padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
  .t tr:last-child { border-bottom: 0; }
  .t td { padding: 3px 0; border: 0 !important; background: transparent !important; }
  .t td:empty { display: none; }
  .t td[colspan] form { display: grid !important; grid-template-columns: 1fr !important; padding: 0 !important; }
  .t tr.is-hot { background: #FFF6F5; }
}

.empty { padding: 40px 18px; color: var(--muted); text-align: center; }
.empty .ic { margin: 0 auto 12px; }
.empty b { display: block; margin-bottom: 4px; color: var(--ink); font-size: 17px; }

.avatar { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--navy-soft); color: var(--navy); font-size: 14px; font-weight: 700; object-fit: cover; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.avatar.xl { width: 104px; height: 104px; font-size: 36px; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 14px; margin: 0; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); word-break: break-word; }
@media (max-width: 480px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; } }

.tabs { display: flex; gap: 4px; margin-bottom: 20px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 3px solid transparent; color: var(--muted); font-size: 15px; font-weight: 600; white-space: nowrap; }
.tabs a.on { color: var(--navy); border-color: var(--gold); }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.filters a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--text); font-size: 14.5px; font-weight: 600; text-decoration: none; }
.filters a:hover { border-color: var(--navy-line); }
.filters a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.filters a.on .count { background: #fff; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; max-width: 360px; }
.toolbar select { width: auto; min-width: 160px; }
.toolbar .grow { flex: 1; }
@media (max-width: 600px) { .toolbar > * { flex: 1 1 100%; max-width: none !important; } }

.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; margin-left: 6px; padding: 0 0 18px 24px; border-left: 2px solid var(--line); font-size: 15px; }
.timeline li::before { content: ""; position: absolute; top: 6px; left: -7px; width: 12px; height: 12px; border-radius: 50%; background: var(--navy); }
.timeline li.private::before { background: var(--gold); }
.timeline li:last-child { border-color: transparent; }
.timeline b { color: var(--ink); }

/* ---------- 8. Toasts, modals, sheets ---------- */
.toasts { position: fixed; z-index: 900; left: 50%; bottom: calc(100px + var(--safe-b)); display: grid; gap: 8px; width: min(92vw, 440px); transform: translateX(-50%); }
.toast { padding: 14px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: tIn .2s ease-out; }
.toast.err { background: var(--red-2); }
.toast.ok { background: var(--green); }
@keyframes tIn { from { opacity: 0; transform: translateY(8px); } }

.modal { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 16px; background: rgba(15, 27, 50, .5); }
.modal-box { width: min(620px, 100%); max-height: 90vh; overflow: auto; padding: 0 24px 24px; border-radius: var(--r-lg); background: #fff; box-shadow: var(--shadow-lg); }
.modal-box > h2 { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; margin: 0 -24px 18px; padding: 18px 24px; border-bottom: 1px solid var(--line); background: #fff; }
@media (max-width: 760px) {
  .modal { padding: 0; place-items: stretch; background: #fff; }
  .modal-box { width: 100%; max-height: none; height: 100%; border-radius: 0; box-shadow: none; padding: 0 18px calc(24px + var(--safe-b)); }
  .modal-box > h2 { margin: 0 -18px 18px; padding: calc(14px + var(--safe-t)) 18px 14px; }
}

/* full-page menu popup (mobile) */
.sheet { position: fixed; inset: 0; z-index: 450; display: flex; flex-direction: column; overflow-y: auto; padding: calc(10px + var(--safe-t)) 16px calc(20px + var(--safe-b)); background: #fff; animation: sheetIn .18s ease-out; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(12px); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 12px; }
.sheet-user { display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; padding: 14px; border-radius: var(--r); background: var(--navy); color: #fff; text-decoration: none !important; }
.sheet-user > span:not(.avatar) { flex: 1; min-width: 0; }
.sheet-user b { display: block; font-size: 17px; }
.sheet-user small { display: block; color: #C8D3E8; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sheet-user .avatar { background: rgba(255,255,255,.16); color: #fff; }
.sheet-nav { display: grid; gap: 4px; }
.sheet-nav a { position: relative; display: flex; align-items: center; gap: 14px; padding: 10px 8px; border-radius: 12px; color: var(--ink); font-size: 17px; font-weight: 600; text-decoration: none !important; }
.sheet-nav a > span:not(.ic) { flex: 1; }
.sheet-nav a > .ico { color: #A9B3C4; }
.sheet-nav a.on { background: var(--navy-soft); }
.sheet-nav a .nav-badge { position: static; }
.sheet-sep { height: 1px; margin: 8px 4px; background: var(--line); }
.sheet-out { margin-top: auto; }
.sheet .sheet-nav + .sheet-out { margin-top: 20px; }
@media (min-width: 1024px) { .sheet { display: none !important; } }

/* ---------- 9. Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--ink); text-decoration: none !important; }
.brand > span { min-width: 0; }
.brand b { display: block; font-size: 18px; line-height: 1.2; }
.brand small { display: block; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
.brand-logo { flex: none; width: auto; height: 40px; max-width: 150px; object-fit: contain; }
.logo-fallback { display: inline-block; width: 34px; height: 38px; color: var(--navy); }
.side .logo-fallback, .auth-side .logo-fallback, .auth-mobile-head .logo-fallback { color: #fff; }

/* ---------- 10. Auth pages ---------- */
.auth { display: grid; grid-template-columns: minmax(380px, .9fr) 1.1fr; min-height: 100vh; }
.auth-side { position: sticky; top: 0; display: flex; flex-direction: column; justify-content: space-between; height: 100vh; padding: 48px; overflow: hidden; background: var(--navy); color: #fff; }
.auth-side::after { content: ""; position: absolute; right: -130px; bottom: -130px; width: 400px; height: 400px; border: 60px solid rgba(242, 169, 0, .16); border-radius: 50%; }
.auth-side .brand { color: #fff; }
.auth-side .brand small { color: #C8D3E8; }
.auth-side h1 { max-width: 13ch; margin: 0 0 18px; color: #fff; font-family: var(--serif); font-size: clamp(34px, 3.4vw, 48px); line-height: 1.1; }
.auth-side p { max-width: 42ch; color: #C8D3E8; font-size: 17px; }
.auth-points { position: relative; z-index: 1; display: grid; gap: 14px; max-width: 440px; margin: 28px 0 0; padding: 0; list-style: none; font-size: 16px; }
.auth-points li { display: flex; align-items: center; gap: 14px; color: #E6ECF6; }
.auth-points .ic { background: rgba(242,169,0,.16); color: var(--gold); }
.auth-side-foot { position: relative; z-index: 1; color: #9FB0CF; font-size: 14px; }
.auth-main { display: flex; justify-content: center; padding: 56px 24px; }
.auth-card { width: min(520px, 100%); margin: auto 0; }
.auth-card.wide { width: min(640px, 100%); }
.auth-card > h2 { margin-bottom: 6px; font-family: var(--serif); font-size: 32px; }
.auth-card .sub { margin-bottom: 22px; color: var(--muted); font-size: 16px; }
.auth-card .card { padding: 26px; }
.auth-foot { margin-top: 20px; color: var(--muted); font-size: 15px; text-align: center; }
.auth-emergency { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding: 12px 14px; border-radius: 12px; background: var(--red-soft); color: #8F1D14; font-size: 15px; }
.auth-mobile-head { display: none; }
.done-mark { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; background: var(--green-soft); color: var(--green); }
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-mobile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + var(--safe-t)) 18px 14px; border-bottom: 4px solid var(--gold); background: var(--navy); }
  .auth-mobile-head .brand { color: #fff; }
  .auth-mobile-head .brand small { color: #C8D3E8; }
  .auth-mobile-head .sos-call { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid rgba(255,255,255,.5); border-radius: 999px; color: #fff; font-size: 14px; font-weight: 700; white-space: nowrap; text-decoration: none; }
  .auth-main { padding: 24px 16px 40px; }
  .auth-card > h2 { font-size: 28px; }
  .auth-card .card { padding: 20px 18px; }
}

/* ---------- 11. Admin shell ---------- */
.admin-shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; background: linear-gradient(to right, var(--navy) var(--side-w), var(--paper) 0); }
.side { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; background: var(--navy); color: #C8D3E8; }
.side .brand { padding: 20px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); color: #fff; }
.side .brand small { color: #9FB0CF; }
.side nav, .s-side nav { display: grid; flex: 1; align-content: start; gap: 4px; padding: 14px 12px; overflow-y: auto; }
.side nav a, .s-side nav a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px 6px 8px; border-radius: 12px; font-size: 15.5px; font-weight: 500; text-decoration: none !important; }
.nav-ic { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; }
.nav-l { flex: 1; min-width: 0; }
.side nav a .nav-badge, .s-side nav a .nav-badge { position: static; }
.side nav a { color: #C8D3E8; }
.side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side nav a.on { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.side nav a.on .nav-ic { background: var(--gold); color: var(--navy); }
.side .nav-badge.soft { background: var(--gold); color: var(--ink); }
.side-foot { display: flex; align-items: center; gap: 6px; padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.side-foot .me { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; color: #fff; text-decoration: none !important; }
.side-foot .me span { min-width: 0; }
.side-foot .me b { display: block; overflow: hidden; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
.side-foot .me small { display: block; overflow: hidden; color: #9FB0CF; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.side-foot .icon-btn { color: #C8D3E8; }
.side-foot .icon-btn:hover { background: rgba(255,255,255,.08); }
.side .avatar { background: rgba(255,255,255,.14); color: #fff; }

.admin-main { display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; min-height: var(--top-h); padding: 10px 32px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(10px); }
.topbar-title { display: flex; flex: 1; align-items: center; gap: 12px; min-width: 0; }
.topbar-title h1 { margin: 0; overflow: hidden; font-size: 22px; white-space: nowrap; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.content { width: 100%; max-width: 1320px; padding: 28px 32px 64px; }
.only-mobile { display: none !important; }
@media (max-width: 1023px) {
  .admin-shell { grid-template-columns: 1fr; background: var(--paper); }
  .side { display: none; }
  .only-mobile { display: inline-grid !important; }
  .only-desktop { display: none !important; }
  .topbar { padding: calc(8px + var(--safe-t)) 10px 8px; }
  .topbar-title h1 { font-size: 19px; }
  .topbar-title .ic { width: 34px; height: 34px; border-radius: 10px; }
  .content { padding: 16px 14px 64px; }
}
.sos-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 32px; background: var(--red); color: #fff; font-size: 16px; }
.sos-strip b { flex: 1; min-width: 160px; }
@media (max-width: 1023px) { .sos-strip { padding: 10px 14px; } }
.pulse-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.8); } 100% { box-shadow: 0 0 0 14px rgba(255,255,255,0); } }

/* ---------- 12. Dashboard ---------- */
.dash-hero { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; padding: 26px 28px; overflow: hidden; border-radius: var(--r-lg); background: var(--navy); color: #fff; }
.dash-hero::after { content: ""; position: absolute; top: -90px; right: -90px; width: 260px; height: 260px; border: 40px solid rgba(242,169,0,.14); border-radius: 50%; pointer-events: none; }
.dash-hero > div { position: relative; z-index: 1; }
.dash-hero h2 { margin: 0 0 6px; color: #fff; font-family: var(--serif); font-size: 28px; }
.dash-hero p { margin: 0; color: #C8D3E8; }
.dash-hero.alert { background: var(--red); }
.dash-hero.alert p { color: #FFE1DE; }
.dash-hero.alert::after { border-color: rgba(255,255,255,.14); }
@media (max-width: 760px) { .dash-hero { padding: 20px; } .dash-hero h2 { font-size: 23px; } .dash-hero .row-actions, .dash-hero .row-actions .btn { width: 100%; } }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; box-shadow: var(--shadow-sm); color: inherit; text-decoration: none !important; }
a.stat:hover { border-color: var(--navy-line); box-shadow: var(--shadow); }
.stat .sv { display: flex; flex-direction: column-reverse; min-width: 0; }
.stat .sv span { color: var(--muted); font-size: 14px; font-weight: 600; line-height: 1.3; }
.stat .sv strong { color: var(--ink); font-size: 28px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat.hot { border-color: var(--red); background: var(--red); }
.stat.hot .sv span, .stat.hot .sv strong { color: #fff; }
.stat.hot .ic { background: rgba(255,255,255,.18); color: #fff; }
@media (max-width: 600px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .stat .ic { width: 36px; height: 36px; }
  .stat .sv strong { font-size: 24px; }
  .stat .sv span { font-size: 13px; }
}
.split { display: grid; grid-template-columns: 1.45fr 1fr; align-items: start; gap: 20px; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.mini-list { display: grid; }
.mini-list .mi { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); color: inherit; text-decoration: none !important; }
.mini-list .mi:last-child { border-bottom: 0; }
.mini-list .mi .body { flex: 1; min-width: 0; }
.mini-list .mi b { display: block; color: var(--ink); }
.mini-list .mi small { display: block; overflow: hidden; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-grid a { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none !important; }
.action-grid a:hover { border-color: var(--navy-line); background: var(--navy-soft); }
@media (max-width: 420px) { .action-grid { grid-template-columns: 1fr; } }

/* ---------- 13. SOS command ---------- */
.sos-board { display: grid; grid-template-columns: 370px 1fr; align-items: start; gap: 20px; }
@media (max-width: 1100px) { .sos-board { grid-template-columns: 1fr; } .sos-board .no-select { display: none; } }
.sos-list { display: grid; gap: 10px; }
.sos-item { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--r); background: #fff; color: inherit; text-decoration: none !important; }
.sos-item:hover { border-color: var(--navy-line); }
.sos-item .body { flex: 1; min-width: 0; }
.sos-item.on { border-color: var(--navy); box-shadow: var(--shadow); }
.sos-item.live { border-left-color: var(--red); background: #FFF8F7; }
.sos-item.ack { border-left-color: var(--gold); }
.sos-item.done { border-left-color: var(--green); }
.sos-item .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sos-item b { color: var(--ink); font-size: 16px; }
.sos-item small { display: block; margin-top: 2px; color: var(--muted); }
.map-frame { width: 100%; height: 340px; border: 0; border-radius: var(--r); background: var(--line-2); }
@media (max-width: 600px) { .map-frame { height: 260px; } }
.evidence { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.evidence video, .evidence audio { width: 100%; border-radius: var(--r-sm); background: #000; }
.status-steps { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 600px) { .status-steps .btn { flex: 1 1 45%; } }

/* ---------- 14. Chats (admin inbox) ---------- */
.inbox { display: grid; grid-template-columns: 310px 1fr; min-height: 62vh; }
.inbox-ch { padding: 12px; border-right: 1px solid var(--line); }
.inbox-ch a { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; color: var(--ink); text-decoration: none !important; }
.inbox-ch a.on { background: var(--navy-soft); }
.inbox-ch a:hover { background: var(--line-2); }
.ch-ico { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; color: #fff; font-size: 19px; line-height: 1; }
.thread-list { padding: 4px 0; }
.thread { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); color: inherit; text-decoration: none !important; }
.thread:hover { background: #FAFBFE; }
.thread .body { flex: 1; min-width: 0; }
.thread .body b { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--ink); }
.thread .body p { margin: 2px 0 0; overflow: hidden; color: var(--muted); font-size: 15px; white-space: nowrap; text-overflow: ellipsis; }
.thread .meta { display: grid; justify-items: end; gap: 4px; color: var(--muted); font-size: 13px; text-align: right; }
@media (max-width: 820px) { .inbox { grid-template-columns: 1fr; } .inbox-ch { display: flex; gap: 6px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); } .inbox-ch a { flex: none; white-space: nowrap; } .thread { padding: 12px 16px; } }

.channel-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ch-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; box-shadow: var(--shadow); }
.ch-card header { display: flex; align-items: center; gap: 12px; }
.ch-card header b { display: block; color: var(--ink); font-size: 16px; }
.ch-card header small { color: var(--muted); }
.ch-card p { margin: 0; color: var(--muted); font-size: 15px; }
.ch-card footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
@media (max-width: 640px) { .perm-grid { grid-template-columns: 1fr; } }
.person-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.person-row:last-child { border-bottom: 0; }
.person-row .body { flex: 1; min-width: 0; }
.person-row b { display: block; color: var(--ink); font-size: 15px; }
.person-row small { color: var(--muted); }

/* ---------- 15. Student shell ---------- */
.student-shell { min-height: 100vh; }
.s-col { min-width: 0; }
.s-side { display: none; }
.s-top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 6px; min-height: var(--top-h); padding: calc(8px + var(--safe-t)) 10px 8px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95); backdrop-filter: blur(10px); }
.s-top .brand b { font-size: 18px; }
.s-top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.women-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--rose-soft); color: var(--rose); font-size: 13px; font-weight: 700; }
.women-chip.only-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; }
.s-main { max-width: 820px; margin: 0 auto; padding: 20px 16px 120px; }
.page-title { display: flex; align-items: center; gap: 14px; margin: 4px 0 20px; }
.page-title h1 { margin: 0; font-family: var(--serif); font-size: 28px; }
.page-sub { margin: -10px 0 18px; color: var(--muted); }

/* floating SOS button (mobile) */
.sos-fab { position: fixed; z-index: 60; right: 16px; bottom: calc(18px + var(--safe-b)); display: inline-flex; align-items: center; gap: 8px; height: 60px; padding: 0 22px 0 18px; border: 0; border-radius: 30px; background: var(--red); color: #fff; font: 800 18px var(--font); letter-spacing: .04em; box-shadow: 0 10px 26px rgba(217, 45, 32, .45); cursor: pointer; }
.sos-fab:active { transform: scale(.97); }

@media (min-width: 1024px) {
  .student-shell { display: grid; grid-template-columns: var(--side-w) 1fr; background: linear-gradient(to right, #fff var(--side-w), var(--paper) 0); }
  .s-top, .sos-fab { display: none; }
  .s-side { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; border-right: 1px solid var(--line); background: #fff; }
  .s-side .brand { padding: 20px 20px 18px; border-bottom: 1px solid var(--line-2); }
  .s-side nav a { color: var(--text); }
  .s-side nav a .nav-ic { color: var(--muted); }
  .s-side nav a:hover { background: var(--line-2); }
  .s-side nav a.on { background: var(--navy-soft); color: var(--navy); font-weight: 600; }
  .s-side nav a.on .nav-ic { background: var(--navy); color: #fff; }
  .s-side nav .sep { height: 1px; margin: 8px 6px; background: var(--line-2); }
  .side-chip { margin: 0 14px 12px; }
  .side-sos { margin: 0 14px 14px; padding: 14px; border-radius: var(--r); background: var(--red-soft); text-align: center; }
  .side-sos button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; border: 0; border-radius: 12px; background: var(--red); color: #fff; font: 800 18px var(--font); letter-spacing: .05em; box-shadow: 0 8px 20px rgba(217,45,32,.3); cursor: pointer; }
  .side-sos button:hover { background: var(--red-2); }
  .side-sos small { display: block; margin-top: 8px; color: #8F1D14; font-size: 13px; }
  .s-side .side-foot { border-top: 1px solid var(--line-2); }
  .s-side .side-foot .me { color: var(--ink); }
  .s-side .side-foot .me small { color: var(--muted); }
  .s-side .side-foot .icon-btn { color: var(--muted); }
  .s-main { max-width: 940px; padding: 36px 40px 64px; }
  .page-title h1 { font-size: 32px; }
  .toasts { bottom: 28px; }
}

/* ---------- 16. Student pages ---------- */
.hello { margin: 4px 0 20px; }
.hello h1 { margin: 0; font-family: var(--serif); font-size: 30px; }
.hello p { margin: 4px 0 0; color: var(--muted); }
.sos-hero { margin-bottom: 20px; padding: 28px 20px 24px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.sos-hold { --p: 0; position: relative; display: block; width: 200px; height: 200px; margin: 4px auto 16px; padding: 12px; border: 0; border-radius: 50%; background: conic-gradient(#fff calc(var(--p) * 1%), transparent 0), var(--red); box-shadow: 0 14px 34px rgba(217, 45, 32, .35); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform .1s; }
.sos-hold .core { display: grid; place-content: center; justify-items: center; width: 100%; height: 100%; border-radius: 50%; background: var(--red); color: #fff; }
.sos-hold .core b { font: 800 46px/1 var(--font); letter-spacing: .04em; }
.sos-hold .core small { margin-top: 6px; color: #FFE1DE; font-size: 14px; }
.sos-hold.holding { transform: scale(.97); }
.sos-hero p { margin: 0; color: var(--muted); font-size: 15px; }
.sos-hero .alt { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.active-banner { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 14px 16px; border-radius: var(--r); font-size: 16px; }
.active-banner.red { background: var(--red); color: #fff; }
.active-banner.gold { border: 1px solid #F5DA94; background: var(--gold-soft); color: var(--gold-ink); }
.active-banner b { flex: 1; }
@media (max-width: 480px) { .active-banner { flex-wrap: wrap; } .active-banner .btn { width: 100%; } }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.quick > a, .quick > button { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; box-shadow: var(--shadow-sm); color: var(--ink); font: inherit; text-align: left; cursor: pointer; text-decoration: none !important; }
.quick > a:hover, .quick > button:hover { border-color: var(--navy-line); box-shadow: var(--shadow); }
.quick .qt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.quick .qt b { display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 700; }
.quick .qt small { color: var(--muted); font-size: 13.5px; line-height: 1.4; }
@media (max-width: 640px) {
  .quick { grid-template-columns: 1fr; gap: 8px; }
  .quick > a, .quick > button { flex-direction: row; align-items: center; padding: 12px 14px; }
  .quick .qt { flex: 1; }
}
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { margin: 0; font-size: 18px; }
.helpline .num { color: var(--ink); font: 700 18px var(--font); font-variant-numeric: tabular-nums; }
.women-hero { margin-bottom: 18px; padding: 20px; border-radius: var(--r-lg); background: var(--rose); color: #fff; }
.women-hero .wh-top { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.women-hero h2 { margin: 0 0 2px; color: #fff; }
.women-hero p { margin: 0; color: #FBDDE9; font-size: 15px; }
.tips { margin: 0; padding: 0; list-style: none; }
.tips li { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.tips li .ico { margin-top: 3px; color: var(--green); }

/* ---------- 17. SOS overlay + fake call ---------- */
.sos-overlay { position: fixed; inset: 0; z-index: 800; display: grid; place-items: center; padding: calc(20px + var(--safe-t)) 20px calc(20px + var(--safe-b)); overflow-y: auto; background: var(--red); color: #fff; }
.sos-panel { width: min(460px, 100%); text-align: center; }
.sos-stage { display: none; }
.sos-panel[data-stage=countdown] [data-for=countdown], .sos-panel[data-stage=sending] [data-for=sending], .sos-panel[data-stage=live] [data-for=live], .sos-panel[data-stage=error] [data-for=error] { display: block; }
.sos-kicker { margin: 0 0 8px; font-size: 22px; font-weight: 700; }
.sos-count { margin: 10px 0; font: 800 128px/1 var(--font); font-variant-numeric: tabular-nums; }
.sos-sub { color: #FFE1DE; font-size: 16px; }
.sos-status { padding: 14px; border-radius: 12px; background: rgba(0,0,0,.14); font-size: 17px; }
.sos-actions { display: grid; gap: 10px; margin-top: 22px; }
.sos-checks { display: grid; gap: 8px; margin: 16px 0; padding: 0; list-style: none; text-align: left; }
.sos-checks li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.1); font-size: 16px; }
.sos-checks span { flex: none; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.6); border-radius: 50%; }
.sos-checks li.on span { border-color: #fff; background: #fff; box-shadow: inset 0 0 0 3px var(--red); }
.sos-checks li.off { opacity: .55; }
.sos-preview { display: block; width: 130px; margin: 0 auto; border-radius: 12px; }
.sos-foot { margin-top: 14px; color: #FFE1DE; font-size: 14px; }
.sos-spinner { width: 56px; height: 56px; margin: 0 auto 16px; border: 5px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fake-call { position: fixed; inset: 0; z-index: 850; display: flex; flex-direction: column; justify-content: space-between; padding: calc(64px + var(--safe-t)) 20px calc(64px + var(--safe-b)); background: #1B2433; color: #fff; text-align: center; }
.fake-call h2 { margin: 18px 0 4px; color: #fff; font-size: 34px; font-weight: 500; }
.fake-call p { color: #AEB8C8; font-size: 17px; }
.fake-call .avatar { margin: 0 auto; background: #3A4A63; color: #fff; }
.fc-actions { display: flex; justify-content: space-around; }
.fc-btn { display: grid; place-items: center; width: 76px; height: 76px; border: 0; border-radius: 50%; color: #fff; cursor: pointer; }
.fc-btn.decline { background: #E5484D; }
.fc-btn.accept { background: #30A46C; }

/* ---------- 18. Chat page ---------- */
.chat-page { display: flex; flex-direction: column; height: 100dvh; background: var(--paper); }
.chat-head { display: flex; align-items: center; gap: 10px; min-height: var(--top-h); padding: calc(8px + var(--safe-t)) 12px 8px; border-bottom: 1px solid var(--line); background: #fff; }
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .who b { display: block; overflow: hidden; color: var(--ink); font-size: 17px; white-space: nowrap; text-overflow: ellipsis; }
.chat-head .who small { display: block; overflow: hidden; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.chat-body { display: flex; flex: 1; flex-direction: column; gap: 4px; padding: 18px 14px; overflow-y: auto; }
.chat-inner { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 840px; margin: 0 auto; }
.day-sep { align-self: center; margin: 12px 0 6px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-size: 13px; }
.msg { display: flex; flex-direction: column; max-width: min(80%, 580px); }
.msg .bubble { padding: 10px 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink); font-size: 16px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.msg .meta { display: flex; align-items: center; gap: 6px; margin: 3px 6px 6px; color: var(--muted); font-size: 12px; }
.msg .sender { margin: 0 6px 3px; color: var(--navy-2); font-size: 13px; font-weight: 700; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.me .bubble { border-color: var(--navy); border-bottom-right-radius: 5px; background: var(--navy); color: #fff; }
.msg.them .bubble { border-bottom-left-radius: 5px; }
.msg.system { align-self: center; max-width: 92%; }
.msg.system .bubble { border-color: #F5DA94; background: var(--gold-soft); color: var(--gold-ink); font-size: 14px; text-align: center; white-space: normal; }
.msg.pinned .bubble { box-shadow: inset 3px 0 0 var(--gold); }
.msg .att img { display: block; min-width: 40px; min-height: 40px; max-width: 270px; max-height: 270px; margin-top: 4px; border-radius: 12px; background: var(--line-2); }
.msg .att a.doc { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; padding: 9px 12px; border-radius: 10px; background: rgba(0,0,0,.05); color: inherit; }
.msg.me .att a.doc { background: rgba(255,255,255,.14); color: #fff; }
.ticks { color: var(--muted); }
.ticks.read { color: var(--blue); }
.chat-foot { padding: 10px 12px calc(10px + var(--safe-b)); border-top: 1px solid var(--line); background: #fff; }
.chat-foot .inner { max-width: 840px; margin: 0 auto; }
.composer { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { min-height: 48px !important; max-height: 150px; padding: 12px 18px !important; border-radius: 24px !important; resize: none; }
.composer .icon-btn { width: 48px; height: 48px; border-radius: 50%; }
.composer .send { background: var(--navy); color: #fff; }
.composer .send:hover { background: var(--navy-2); }
.quick-replies { display: flex; gap: 6px; padding-bottom: 8px; overflow-x: auto; }
.quick-replies button { flex: none; max-width: 280px; padding: 8px 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--navy); font: 14px var(--font); white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.quick-replies button:hover { background: var(--navy-soft); }
.attach-preview { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 8px 12px; border-radius: 10px; background: var(--navy-soft); font-size: 14px; }
.chat-readonly { padding: 6px; color: var(--muted); font-size: 15px; text-align: center; }
.chat-wrap { display: flex; flex: 1; min-height: 0; }
.chat-col { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.chat-side { width: 330px; padding: 18px; overflow-y: auto; border-left: 1px solid var(--line); background: #fff; }
.chat-side-head { display: none; }
@media (max-width: 980px) {
  .chat-side { display: none; }
  .chat-side.open { position: fixed; inset: 0; z-index: 70; display: block; width: 100%; padding: calc(10px + var(--safe-t)) 18px calc(24px + var(--safe-b)); border: 0; }
  .chat-side.open .chat-side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
}

.modal-box > h2 .icon-btn, .chat-side-head .icon-btn { margin-left: auto; }
