/* ============================================================
   SOMO — Design system
   Part 1: tokens, shell, typography, primitives
   ============================================================ */

:root{
  --navy-950:#05121F;
  --navy-900:#081C33;
  --navy-800:#0B2547;
  --blue-700:#175CD3;
  --blue-600:#1F6FEB;
  --blue-500:#3B82F6;
  --blue-50:#EFF5FF;
  --gold-500:#E9A23B;
  --gold-100:#FDF3E1;
  --canvas:#F4F7FB;
  --surface:#FFFFFF;
  --line:#E4E9F2;
  --line-soft:#EEF2F7;
  --ink:#0B1B33;
  --ink-2:#344054;
  --muted:#667085;
  --muted-2:#98A2B3;
  --success:#12B76A;
  --success-bg:#E7F8F0;
  --warn:#F79009;
  --warn-bg:#FFF6E5;
  --danger:#F04438;
  --danger-bg:#FEECEC;
  --violet:#7A5AF8;
  --r-lg:16px;
  --r-md:12px;
  --r-sm:9px;
  --shadow-1:0 1px 2px rgba(11,27,51,.06);
  --shadow-2:0 4px 16px rgba(11,27,51,.06),0 1px 2px rgba(11,27,51,.04);
  --shadow-3:0 18px 48px rgba(11,27,51,.14);
  --rail:76px;
  --panel:232px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;background:var(--canvas);color:var(--ink);
  font-family:"Inter",system-ui,"Segoe UI",sans-serif;
  font-size:14px;line-height:1.45;-webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{font-family:"Plus Jakarta Sans","Inter",system-ui,sans-serif;margin:0;letter-spacing:-.015em}
a{color:inherit;text-decoration:none}
button{font:inherit;cursor:pointer}
::selection{background:#CFE0FF}
svg{display:block}
.mono{font-variant-numeric:tabular-nums}

/* ---------------- layout ---------------- */
.app{display:flex;min-height:100vh}

.rail{
  width:var(--rail);flex:0 0 var(--rail);
  background:linear-gradient(180deg,var(--navy-900) 0%,var(--navy-950) 100%);
  display:flex;flex-direction:column;align-items:center;
  padding:16px 0 14px;position:sticky;top:0;height:100vh;z-index:30;
}
.brand{
  width:40px;height:40px;border-radius:12px;
  background:linear-gradient(135deg,#1F6FEB,#3B82F6);
  display:grid;place-items:center;color:#fff;font-weight:800;font-size:15px;
  font-family:"Plus Jakarta Sans",sans-serif;margin-bottom:18px;
  box-shadow:0 8px 22px rgba(31,111,235,.38);position:relative;
}
.brand::after{
  content:"";position:absolute;inset:auto 6px 5px 6px;height:2px;border-radius:2px;
  background:linear-gradient(90deg,transparent,var(--gold-500),transparent);opacity:.9;
}
.rail a.ic{
  width:44px;height:44px;border-radius:12px;display:grid;place-items:center;
  color:#8FA6C4;position:relative;margin-bottom:2px;transition:.15s;
}
.rail a.ic svg{width:20px;height:20px;stroke-width:1.7}
.rail a.ic:hover{background:rgba(255,255,255,.06);color:#fff}
.rail a.ic.active{background:rgba(31,111,235,.2);color:#fff}
.rail a.ic.active::before{
  content:"";position:absolute;left:-16px;top:11px;bottom:11px;width:3px;
  border-radius:0 3px 3px 0;background:var(--blue-500);
}
.rail .spacer{flex:1}
.rail .avatar{width:34px;height:34px;font-size:11px;margin-top:8px}

.panel{
  width:var(--panel);flex:0 0 var(--panel);background:#fff;
  border-right:1px solid var(--line);padding:18px 12px;
  position:sticky;top:0;height:100vh;display:flex;flex-direction:column;z-index:25;
}
.school-switch{
  display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:11px;
  border:1px solid var(--line);background:#FBFCFE;margin-bottom:6px;
}
.school-switch .crest{
  width:30px;height:30px;border-radius:8px;background:var(--navy-800);color:#fff;
  display:grid;place-items:center;font-size:10px;font-weight:700;flex:0 0 30px;
  font-family:"Plus Jakarta Sans",sans-serif;
}
.school-switch .nm{font-size:12px;font-weight:600;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.school-switch .sub{font-size:10.5px;color:var(--muted)}
.school-switch svg{width:14px;height:14px;color:var(--muted-2);flex:0 0 14px}

.nav-group{margin-top:16px}
.nav-label{
  font-size:10px;text-transform:uppercase;letter-spacing:.09em;color:var(--muted-2);
  padding:0 10px;margin-bottom:6px;font-weight:700;
}
.nav-item{
  display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:9px;
  color:var(--ink-2);font-weight:500;font-size:13.5px;margin-bottom:2px;transition:.13s;
}
.nav-item svg{width:17px;height:17px;color:#7B8CA6;stroke-width:1.8;flex:0 0 17px}
.nav-item:hover{background:#F5F8FC;color:var(--ink)}
.nav-item.active{background:var(--blue-50);color:var(--blue-700);font-weight:600}
.nav-item.active svg{color:var(--blue-600)}
.nav-item .count{
  margin-left:auto;font-size:10.5px;font-weight:700;background:#EEF2F7;color:var(--muted);
  border-radius:999px;padding:1px 7px;
}
.nav-item.active .count{background:#DCEAFF;color:var(--blue-700)}

.panel .foot{margin-top:auto;padding:10px}
.plan-card{
  background:linear-gradient(150deg,#0B2547,#071B33);border-radius:12px;padding:12px;color:#fff;
}
.plan-card .t{font-size:11px;color:#9FB4D0;font-weight:600;letter-spacing:.04em;text-transform:uppercase}
.plan-card .p{font-family:"Plus Jakarta Sans";font-weight:700;font-size:14px;margin:3px 0 8px}
.plan-card .bar{height:4px;border-radius:4px;background:rgba(255,255,255,.16);overflow:hidden}
.plan-card .bar i{display:block;height:100%;width:62%;background:var(--gold-500);border-radius:4px}
.plan-card .s{font-size:10.5px;color:#9FB4D0;margin-top:7px}

/* ---------------- main ---------------- */
.main{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{
  height:64px;display:flex;align-items:center;gap:14px;padding:0 26px;
  background:rgba(255,255,255,.86);backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);position:sticky;top:0;z-index:20;
}
.crumb{display:flex;align-items:center;gap:7px;font-size:12.5px;color:var(--muted);font-weight:500}
.crumb b{color:var(--ink);font-weight:600}
.crumb svg{width:13px;height:13px;color:var(--muted-2)}

.searchbox{
  margin-left:auto;display:flex;align-items:center;gap:9px;width:min(360px,32vw);
  height:38px;background:#F5F8FC;border:1px solid transparent;border-radius:10px;padding:0 12px;
  transition:.15s;
}
.searchbox:focus-within{background:#fff;border-color:#C7D7F5;box-shadow:0 0 0 3px rgba(31,111,235,.1)}
.searchbox svg{width:16px;height:16px;color:var(--muted-2);flex:0 0 16px}
.searchbox input{border:0;background:transparent;outline:0;width:100%;font-size:13px;color:var(--ink)}
.searchbox kbd{
  font-family:inherit;font-size:10.5px;color:var(--muted);background:#fff;border:1px solid var(--line);
  border-radius:5px;padding:1px 5px;
}
.term-pill{
  display:flex;align-items:center;gap:7px;height:34px;padding:0 11px;border-radius:9px;
  border:1px solid var(--line);background:#fff;font-size:12.5px;font-weight:600;color:var(--ink-2);
}
.term-pill .dot{width:6px;height:6px;border-radius:50%;background:var(--success)}
.term-pill svg{width:13px;height:13px;color:var(--muted-2)}
.icon-btn{
  width:36px;height:36px;border-radius:9px;border:1px solid var(--line);background:#fff;
  display:grid;place-items:center;color:var(--ink-2);position:relative;
}
.icon-btn svg{width:17px;height:17px}
.icon-btn .badge{position:absolute;top:-3px;right:-3px;width:8px;height:8px;border-radius:50%;background:var(--danger);border:2px solid #fff}
.avatar{
  width:34px;height:34px;border-radius:50%;background:linear-gradient(135deg,#1F6FEB,#0B2547);
  color:#fff;display:grid;place-items:center;font-size:11.5px;font-weight:700;
  font-family:"Plus Jakarta Sans";flex:0 0 34px;
}

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

/* ---------------- page header ---------------- */
.page-head{display:flex;align-items:flex-end;gap:20px;margin-bottom:22px}
.page-head h1{font-size:24px;font-weight:700}
.page-head .sub{font-size:13px;color:var(--muted);margin-top:4px}
.page-head .actions{margin-left:auto;display:flex;gap:9px;align-items:center}
.eyebrow{
  font-size:10.5px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;
  color:var(--blue-600);margin-bottom:6px;display:flex;align-items:center;gap:6px;
}
.eyebrow::before{content:"";width:14px;height:2px;background:var(--gold-500);border-radius:2px}

/* ---------------- buttons ---------------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;height:38px;
  padding:0 14px;border-radius:9px;border:1px solid var(--line);background:#fff;
  color:var(--ink-2);font-weight:600;font-size:13px;white-space:nowrap;transition:.13s;
}
.btn svg{width:15px;height:15px}
.btn:hover{background:#FAFCFF;border-color:#D3DCEA}
.btn.primary{
  background:linear-gradient(180deg,#2B7BF3,#1F6FEB);border-color:#1F6FEB;color:#fff;
  box-shadow:0 1px 2px rgba(31,111,235,.35),inset 0 1px 0 rgba(255,255,255,.18);
}
.btn.primary:hover{background:#175CD3;border-color:#175CD3}
.btn.dark{background:var(--navy-800);border-color:var(--navy-800);color:#fff}
.btn.ghost{border-color:transparent;background:transparent;color:var(--muted)}
.btn.ghost:hover{background:#F5F8FC;color:var(--ink)}
.btn.sm{height:32px;padding:0 11px;font-size:12px;border-radius:8px}
.btn.sm svg{width:13px;height:13px}
.link{color:var(--blue-600);font-weight:600;font-size:12.5px;display:inline-flex;align-items:center;gap:4px}
.link svg{width:13px;height:13px}

/* ---------------- cards ---------------- */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);box-shadow:var(--shadow-1)}
.card-h{display:flex;align-items:center;gap:12px;padding:15px 18px;border-bottom:1px solid var(--line-soft)}
.card-h h3{font-size:14.5px;font-weight:700}
.card-h .sub{font-size:11.5px;color:var(--muted);margin-top:1px}
.card-h .right{margin-left:auto;display:flex;align-items:center;gap:8px}
.card-b{padding:18px}
.card-b.tight{padding:0}
.grid{display:grid;gap:16px}
.g2{grid-template-columns:repeat(2,minmax(0,1fr))}
.g3{grid-template-columns:repeat(3,minmax(0,1fr))}
.g4{grid-template-columns:repeat(4,minmax(0,1fr))}
.span2{grid-column:span 2}
.mt16{margin-top:16px}
.mt20{margin-top:20px}
.row{display:flex;align-items:center;gap:10px}
.between{display:flex;align-items:center;justify-content:space-between;gap:12px}
.muted{color:var(--muted)}
.tiny{font-size:11.5px}
.small{font-size:12.5px}
.divider{height:1px;background:var(--line-soft);margin:14px 0}

/* ---------------- pills / badges ---------------- */
.pill{
  display:inline-flex;align-items:center;gap:5px;height:22px;padding:0 9px;
  border-radius:999px;font-size:11px;font-weight:600;white-space:nowrap;
  background:#F2F4F7;color:var(--ink-2);
}
.pill .d{width:5px;height:5px;border-radius:50%;background:currentColor}
.pill.ok{background:var(--success-bg);color:#067647}
.pill.warn{background:var(--warn-bg);color:#B54708}
.pill.bad{background:var(--danger-bg);color:#B42318}
.pill.info{background:var(--blue-50);color:var(--blue-700)}
.pill.gold{background:var(--gold-100);color:#946200}
.pill.violet{background:#F1EDFF;color:#5B34D6}
.pill.outline{background:#fff;border:1px solid var(--line);color:var(--muted)}

.grade{
  display:inline-grid;place-items:center;min-width:26px;height:24px;padding:0 7px;
  border-radius:7px;font-size:11.5px;font-weight:700;letter-spacing:.01em;
}
.grade.A{background:#E7F8F0;color:#067647}
.grade.B{background:#EAF2FF;color:#175CD3}
.grade.C{background:#FFF6E5;color:#B54708}
.grade.D{background:#FFF1EC;color:#C4320A}
.grade.E{background:#FEECEC;color:#B42318}
.grade.O{background:#EEF2F7;color:#344054}
.grade.F{background:#F2F4F7;color:#667085}

/* ---------------- forms ---------------- */
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:11.5px;font-weight:600;color:var(--ink-2)}
.field .hint{font-size:11px;color:var(--muted)}
.input,.select{
  height:38px;border:1px solid var(--line);border-radius:9px;background:#fff;
  padding:0 11px;font-size:13px;color:var(--ink);outline:0;width:100%;
  transition:.13s;font-family:inherit;
}
.input:focus,.select:focus{border-color:#8FB6F5;box-shadow:0 0 0 3px rgba(31,111,235,.11)}
.select{
  appearance:none;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat:no-repeat;background-position:right 11px center;padding-right:32px;
}
.seg{display:inline-flex;background:#F2F5F9;border-radius:9px;padding:3px;gap:2px}
.seg button{
  border:0;background:transparent;height:30px;padding:0 12px;border-radius:7px;
  font-size:12px;font-weight:600;color:var(--muted);
}
.seg button.on{background:#fff;color:var(--ink);box-shadow:var(--shadow-1)}

/* ---------------- table ---------------- */
.tbl-wrap{overflow-x:auto}
.tbl{width:100%;border-collapse:separate;border-spacing:0}
.tbl th{
  font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;color:var(--muted-2);
  font-weight:700;text-align:left;padding:10px 14px;background:#FAFBFD;
  border-bottom:1px solid var(--line-soft);white-space:nowrap;
}
.tbl td{padding:11px 14px;border-bottom:1px solid var(--line-soft);vertical-align:middle}
.tbl tbody tr:last-child td{border-bottom:0}
.tbl tbody tr:hover td{background:#FAFCFF}
.tbl .num{text-align:right;font-variant-numeric:tabular-nums}
.tbl .strong{font-weight:600;color:var(--ink)}
.tbl .who{display:flex;align-items:center;gap:10px}
.tbl .idx{font-size:11px;color:var(--muted-2);width:22px;flex:0 0 22px}

.avatar-sm{
  width:30px;height:30px;border-radius:50%;display:grid;place-items:center;
  background:#EDF3FE;color:var(--blue-700);font-size:10.5px;font-weight:700;
  font-family:"Plus Jakarta Sans";flex:0 0 30px;
}

/* ---------------- misc ---------------- */
.note{
  display:flex;gap:10px;padding:12px 14px;border-radius:10px;background:#F8FAFD;
  border:1px solid var(--line-soft);font-size:12px;color:var(--ink-2);line-height:1.5;
}
.note svg{width:15px;height:15px;flex:0 0 15px;margin-top:1px;color:var(--blue-600)}
.note.gold{background:var(--gold-100);border-color:#F7E3C0}
.note.gold svg{color:#B7791F}

.progress{height:6px;border-radius:999px;background:#EDF1F7;overflow:hidden}
.progress i{display:block;height:100%;border-radius:999px;background:var(--blue-600)}

.datebox{
  width:40px;height:42px;border-radius:9px;background:#F5F8FC;border:1px solid var(--line-soft);
  display:flex;flex-direction:column;align-items:center;justify-content:center;flex:0 0 40px;
  font-family:"Plus Jakarta Sans";font-weight:700;font-size:14px;line-height:1;color:var(--ink);
}
.datebox span{font-size:8.5px;letter-spacing:.08em;color:var(--muted-2);margin-top:3px;font-weight:700}

.empty{text-align:center;padding:40px 20px;color:var(--muted)}
.empty h4{font-size:14px;color:var(--ink);margin-bottom:4px}

/* inline icon host */
[data-ic]{display:inline-flex;align-items:center;justify-content:center;line-height:0}
[data-ic] svg{width:15px;height:15px}
.btn [data-ic] svg{width:15px;height:15px}
.tiny [data-ic] svg,[data-ic].sm svg{width:13px;height:13px}

/* scrollbars */
*::-webkit-scrollbar{width:9px;height:9px}
*::-webkit-scrollbar-thumb{background:#D8DFEA;border-radius:6px;border:2px solid var(--canvas)}
*::-webkit-scrollbar-track{background:transparent}

@media(max-width:1180px){
  .panel{display:none}
  .g4{grid-template-columns:repeat(2,minmax(0,1fr))}
  .g3{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:820px){
  .rail{display:none}
  .topbar{padding:0 14px;gap:9px}
  .crumb{display:none}
  .term-pill{font-size:11px;padding:6px 9px}
  .content{padding:20px 16px 40px}
  .page-head{flex-wrap:wrap}
  .page-head .actions{margin-left:0;width:100%}
  .g2,.g3,.g4{grid-template-columns:1fr}
  .span2{grid-column:span 1}
  .searchbox{display:none}
}
