/* ═══════════════════════════════════════════════════════════════════════
   GHSS PORTAL DESIGN SYSTEM — "Evergreen & Brass"
   Gifted Hands Senior School · portal-wide look and feel
   Layout language: left rail navigation, drawer workspaces, pill toasts.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --bg:      #04100C;
  --bg2:     #071811;
  --panel:   #0E2A1F;
  --panel2:  #102B21;
  --raise:   #143528;
  --line:    rgba(201, 169, 97, .16);
  --line2:   rgba(236, 231, 218, .08);
  --gold:    #C9A961;
  --gold2:   #E4C983;
  --mint:    #58BE93;
  --ink:     #ECE7DA;
  --t2:      #A8B5AA;
  --t3:      #6E7F73;
  --red:     #E0654F;
  --blue:    #6BA3E8;
  --r:       14px;
  --r2:      10px;
  --shadow:  0 18px 50px rgba(0, 0, 0, .45);
  --font-h:  'Epilogue', 'Inter', system-ui, sans-serif;
  --font-b:  'Inter', system-ui, -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-b);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.drawer-lock { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--font-h); letter-spacing: .2px; }
a { color: var(--gold); text-decoration: none; }
img { max-width: 100%; }
::selection { background: rgba(88, 190, 147, .35); }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #1B3A2C; border-radius: 8px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: #27513D; }

/* ═══ APP SHELL — sidebar + stage ═══ */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 242px; flex-shrink: 0;
  background: linear-gradient(180deg, #05170F 0%, #0A231A 100%);
  border-right: 1px solid var(--line2);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
}
.side-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--line2);
}
.side-brand img { width: 42px; height: 42px; border-radius: 11px; }
.side-brand .sb-name { font-family: var(--font-h); font-weight: 800; font-size: .92rem; line-height: 1.2; }
.side-brand .sb-sub  { font-size: .64rem; color: var(--gold); letter-spacing: 2.2px; text-transform: uppercase; }

.side-nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.nav-group { margin: 14px 8px 6px; font-size: .62rem; letter-spacing: 2px; text-transform: uppercase; color: var(--t3); }
.navlink {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin: 2px 0;
  border-radius: var(--r2);
  color: var(--t2); font-size: .84rem; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all .16s ease;
  user-select: none;
}
.navlink i { width: 17px; text-align: center; font-size: .86rem; color: var(--t3); transition: color .16s; }
.navlink:hover { background: rgba(201, 169, 97, .07); color: var(--ink); }
.navlink:hover i { color: var(--gold); }
.navlink.on {
  background: linear-gradient(90deg, rgba(201,169,97,.16), rgba(201,169,97,.04));
  border-color: var(--line);
  color: var(--gold2); font-weight: 600;
}
.navlink.on i { color: var(--gold); }

.side-foot { padding: 12px 14px 16px; border-top: 1px solid var(--line2); }
.side-user { display: flex; align-items: center; gap: 10px; }
.side-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--mint), #1E5C45);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #04100C; font-size: .8rem;
}
.side-user .su-name { font-size: .78rem; font-weight: 600; line-height: 1.2; }
.side-user .su-role { font-size: .64rem; color: var(--t3); text-transform: capitalize; }
.btn-exit {
  margin-left: auto; background: none; border: 1px solid var(--line2);
  color: var(--t3); border-radius: 8px; padding: 6px 9px; cursor: pointer;
  transition: all .15s;
}
.btn-exit:hover { color: var(--red); border-color: rgba(224, 101, 79, .4); }

.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px;
  background: rgba(4, 16, 12, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line2);
}
.topbar .crumb { font-size: .72rem; color: var(--t3); letter-spacing: 1.5px; text-transform: uppercase; }
.topbar .crumb b { color: var(--gold); font-weight: 600; }
.topbar .spacer { flex: 1; }
.term-chip {
  font-size: .7rem; color: var(--gold2);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 13px; background: rgba(201, 169, 97, .06);
  white-space: nowrap;
}

.content { padding: 26px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* View headers */
.view-head { margin-bottom: 22px; }
.view-head h1 { font-size: 1.45rem; font-weight: 800; }
.view-head p  { color: var(--t2); font-size: .86rem; margin-top: 3px; }

/* ═══ KPI STRIP ═══ */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 13px; margin-bottom: 22px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line2);
  border-radius: var(--r); padding: 16px 17px;
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ''; position: absolute; right: -22px; top: -22px;
  width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201,169,97,.14), transparent 70%);
}
.kpi .kpi-i { font-size: .95rem; color: var(--gold); margin-bottom: 8px; }
.kpi .kpi-v { font-family: var(--font-h); font-size: 1.5rem; font-weight: 800; line-height: 1; }
.kpi .kpi-l { font-size: .7rem; color: var(--t2); margin-top: 5px; letter-spacing: .4px; }
.kpi.mint .kpi-i { color: var(--mint); }

/* ═══ PANELS ═══ */
.panel {
  background: var(--panel); border: 1px solid var(--line2);
  border-radius: var(--r); margin-bottom: 20px;
  overflow: hidden;
}
.panel-h {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line2);
}
.panel-h .ph-title { font-family: var(--font-h); font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: 9px; }
.panel-h .ph-title i { color: var(--gold); font-size: .85rem; }
.panel-h .ph-sub { font-size: .72rem; color: var(--t3); }
.panel-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-b { padding: 18px; }
.panel-b.tight { padding: 0; }

/* ═══ TABLES ═══ */
.tw { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .82rem; }
.tbl th {
  text-align: left; font-weight: 600; font-size: .66rem;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--t3);
  padding: 11px 14px; border-bottom: 1px solid var(--line2);
  white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid rgba(236,231,218,.05); vertical-align: middle; }
.tbl tbody tr { transition: background .13s; }
.tbl tbody tr:hover { background: rgba(88, 190, 147, .05); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .mono { font-family: ui-monospace, 'Cascadia Mono', monospace; font-size: .76rem; color: var(--gold2); }
.tbl .actions { white-space: nowrap; text-align: right; }
.tbl .actions .btn { padding: 5px 10px; font-size: .7rem; }
.empty {
  text-align: center; color: var(--t3); padding: 38px 16px; font-size: .84rem;
}
.empty i { display: block; font-size: 1.7rem; margin-bottom: 10px; color: #27513D; }

/* ═══ TAGS ═══ */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .66rem; font-weight: 600; letter-spacing: .5px;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.tag-ok   { background: rgba(88,190,147,.14); color: #7DD8AF; border: 1px solid rgba(88,190,147,.3); }
.tag-mid  { background: rgba(107,163,232,.13); color: #9CC3F2; border: 1px solid rgba(107,163,232,.3); }
.tag-wait { background: rgba(201,169,97,.13);  color: var(--gold2); border: 1px solid rgba(201,169,97,.32); }
.tag-bad  { background: rgba(224,101,79,.13);  color: #EFA091; border: 1px solid rgba(224,101,79,.3); }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-b); font-size: .78rem; font-weight: 600;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer;
  transition: all .16s ease; white-space: nowrap;
  text-decoration: none; line-height: 1.2;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-p  { background: linear-gradient(135deg, var(--gold2), var(--gold)); color: #10261B; }
.btn-p:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(201,169,97,.25); }
.btn-m  { background: linear-gradient(135deg, #6FD8A6, var(--mint)); color: #06251A; }
.btn-m:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(88,190,147,.22); }
.btn-o  { background: transparent; border-color: var(--line); color: var(--gold2); }
.btn-o:hover:not(:disabled) { background: rgba(201,169,97,.1); }
.btn-g  { background: var(--raise); border-color: var(--line2); color: var(--ink); }
.btn-g:hover:not(:disabled) { border-color: var(--line); }
.btn-d  { background: transparent; border-color: rgba(224,101,79,.35); color: var(--red); }
.btn-d:hover:not(:disabled) { background: rgba(224,101,79,.1); }
.btn-sm { padding: 5px 12px; font-size: .7rem; }
.btn-blk { width: 100%; justify-content: center; }

/* ═══ FORMS ═══ */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .7rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--t2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; font-family: var(--font-b); font-size: .86rem;
  background: var(--bg2); color: var(--ink);
  border: 1px solid var(--line2); border-radius: var(--r2);
  padding: 10px 13px; outline: none; transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(201,169,97,.55);
  box-shadow: 0 0 0 3px rgba(201,169,97,.12);
}
.field textarea { resize: vertical; min-height: 84px; }
.field .hint { font-size: .68rem; color: var(--t3); margin-top: 4px; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.frow3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 13px; }
input[type="checkbox"] { accent-color: var(--gold); width: 15px; height: 15px; }

.chipset { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: .72rem; padding: 5px 13px; border-radius: 999px;
  border: 1px solid var(--line2); background: var(--bg2); color: var(--t2);
  cursor: pointer; transition: all .14s; user-select: none;
}
.chip:hover { border-color: var(--line); color: var(--ink); }
.chip.on { background: rgba(201,169,97,.16); border-color: var(--gold); color: var(--gold2); font-weight: 600; }

/* ═══ DRAWERS (workspace modals) ═══ */
.drawer-veil {
  position: fixed; inset: 0; z-index 90; z-index: 90;
  background: rgba(2, 8, 6, .66); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .22s;
}
.drawer-veil.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95;
  width: min(520px, 96vw);
  background: linear-gradient(180deg, #0B241B, #081B13);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(105%);
  transition: transform .26s cubic-bezier(.3, .9, .3, 1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-h {
  display: flex; align-items: center; gap: 10px;
  padding: 17px 20px; border-bottom: 1px solid var(--line2);
}
.drawer-h h3 { font-size: 1rem; font-weight: 700; flex: 1; }
.drawer-x {
  background: none; border: 1px solid var(--line2); color: var(--t2);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: .85rem;
}
.drawer-x:hover { color: var(--red); border-color: rgba(224,101,79,.4); }
.drawer-b { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-f { padding: 15px 20px; border-top: 1px solid var(--line2); display: flex; gap: 9px; justify-content: flex-end; }
@media (max-width: 640px) {
  .drawer { top: auto; height: 88vh; width: 100vw; border-radius: 18px 18px 0 0; border-left: none; border-top: 1px solid var(--line); transform: translateY(105%); }
  .drawer.open { transform: translateY(0); }
}

/* ═══ TOAST ═══ */
#ghs-toast {
  position: fixed; top: 18px; left: 50%; z-index: 999;
  transform: translate(-50%, -70px);
  background: #123326; color: var(--ink);
  border: 1px solid rgba(88,190,147,.4);
  border-radius: 999px; padding: 10px 22px;
  font-size: .8rem; box-shadow: var(--shadow);
  transition: transform .3s cubic-bezier(.3,.9,.3,1.2);
  max-width: min(480px, 92vw); text-align: center;
}
#ghs-toast.show { transform: translate(-50%, 0); }
#ghs-toast.err  { background: #331410; border-color: rgba(224,101,79,.5); color: #F4B4A6; }
#ghs-toast.ok   { background: #0E3325; border-color: rgba(88,190,147,.55); color: #A9E6C9; }
#ghs-toast.info { background: #10283C; border-color: rgba(107,163,232,.5); color: #B4D2F4; }

/* ═══ NOTICE / INFO BANNERS ═══ */
.note {
  display: flex; gap: 11px; align-items: flex-start;
  background: rgba(201,169,97,.07); border: 1px solid var(--line);
  border-radius: var(--r2); padding: 12px 15px;
  font-size: .8rem; color: var(--t2); margin-bottom: 16px;
}
.note i { color: var(--gold); margin-top: 2px; }
.note.mint { background: rgba(88,190,147,.07); border-color: rgba(88,190,147,.25); }
.note.mint i { color: var(--mint); }

/* ═══ REPORT CARD PREVIEW (print) ═══ */
.rc-stage { background: #F5F2E9; border-radius: var(--r); padding: 14px; overflow-x: auto; }
.rc-stage iframe, .rc-stage .rc-doc { background: #fff; margin: 0 auto; }
.rc-toolbar { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }

@media print {
  body.print-rc * { visibility: hidden; }
  body.print-rc #rc-print-zone, body.print-rc #rc-print-zone * { visibility: visible; }
  body.print-rc #rc-print-zone { position: absolute; inset: 0; width: 100%; }
  body.print-rc #rc-print-zone .rc-toolbar { display: none !important; }
}

/* ═══ AUTH PAGES ═══ */
.auth-wrap {
  min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 44%) 1fr;
}
.auth-brand {
  background:
    radial-gradient(1100px 500px at -10% 110%, rgba(88,190,147,.16), transparent 60%),
    radial-gradient(900px 480px at 110% -10%, rgba(201,169,97,.14), transparent 60%),
    #05170F;
  padding: 52px 48px; display: flex; flex-direction: column;
  border-right: 1px solid var(--line2);
}
.auth-brand .ab-logo { display: flex; align-items: center; gap: 13px; margin-bottom: auto; }
.auth-brand .ab-logo img { width: 52px; height: 52px; border-radius: 14px; }
.auth-brand .ab-logo .n { font-family: var(--font-h); font-weight: 800; font-size: 1.1rem; line-height: 1.15; }
.auth-brand .ab-logo .s { font-size: .62rem; letter-spacing: 2.6px; color: var(--gold); text-transform: uppercase; }
.auth-brand .ab-hero { margin: auto 0; padding: 40px 0; }
.auth-brand .ab-hero h2 { font-size: 1.9rem; font-weight: 800; line-height: 1.22; max-width: 380px; }
.auth-brand .ab-hero h2 em { font-style: normal; color: var(--gold); }
.auth-brand .ab-hero p { color: var(--t2); margin-top: 14px; max-width: 400px; font-size: .9rem; }
.auth-brand .ab-foot { font-size: .7rem; color: var(--t3); }
.auth-form {
  display: flex; align-items: center; justify-content: center; padding: 40px 24px;
  background:
    radial-gradient(800px 400px at 50% -10%, rgba(201,169,97,.05), transparent 60%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.5rem; font-weight: 800; }
.auth-card .sub { color: var(--t2); font-size: .86rem; margin: 6px 0 24px; }
.role-tabs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  background: var(--bg2); border: 1px solid var(--line2);
  padding: 5px; border-radius: 12px; margin-bottom: 20px;
}
.role-tabs button {
  font-family: var(--font-b); font-size: .72rem; font-weight: 600;
  padding: 8px 4px; border: none; border-radius: 8px;
  background: transparent; color: var(--t2); cursor: pointer; transition: all .15s;
}
.role-tabs button.on { background: linear-gradient(135deg, var(--gold2), var(--gold)); color: #10261B; }
.auth-alt { text-align: center; font-size: .78rem; color: var(--t3); margin-top: 18px; }
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}

/* ═══ RESPONSIVE SHELL ═══ */
.menu-btn { display: none; }
@media (max-width: 900px) {
  .side {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-105%);
    transition: transform .26s cubic-bezier(.3,.9,.3,1);
    box-shadow: var(--shadow);
  }
  .side.open { transform: translateX(0); }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--panel); border: 1px solid var(--line2); color: var(--gold);
    cursor: pointer; font-size: .9rem;
  }
  .content { padding: 18px 14px; }
  .frow, .frow3 { grid-template-columns: 1fr; }
  .topbar { padding: 12px 14px; }
}
.side-veil { position: fixed; inset: 0; background: rgba(2,8,6,.6); z-index: 39; opacity: 0; pointer-events: none; transition: opacity .2s; }
.side-veil.show { opacity: 1; pointer-events: auto; }
