/* Raalhu · Teacher's Studio — lagoon theme */
:root {
  --sea-950: #041a22;
  --sea-900: #072530;
  --sea-800: #0b3442;
  --sea-700: #0e4a5c;
  --lagoon: #19b3a6;
  --lagoon-600: #0f8f85;
  --lagoon-soft: #d9f4f0;
  --coral: #ff6f59;
  --coral-600: #e8533d;
  --coral-soft: #ffe5df;
  --sun: #f5b83d;
  --sun-soft: #fdf0d2;
  --sand: #f6f0e6;
  --sand-2: #efe6d8;
  --paper: #fffdf9;
  --ink: #13232b;
  --ink-2: #33464f;
  --muted: #687a82;
  --line: #e7ddcf;
  --line-2: #d9cdbc;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --l1: #f87171;
  --l2: #fbbf24;
  --l3: #34d399;
  --l4: #38bdf8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(7, 37, 48, .06), 0 8px 24px -12px rgba(7, 37, 48, .18);
  --shadow-lg: 0 24px 60px -20px rgba(7, 37, 48, .35);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', 'Plus Jakarta Sans', system-ui, sans-serif;
  --thaana: 'Noto Sans Thaana', 'MV Faseyha', 'Faruma', sans-serif;
  --side-w: 264px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font), var(--thaana);
  color: var(--ink);
  background: var(--sand);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(26px, 3.2vw, 38px); font-weight: 800; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
a { color: var(--lagoon-600); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0 0 .8em; }
.thaana, [dir="rtl"] { font-family: var(--thaana); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 14px; }

/* ---------- boot ---------- */
.boot { height: 100vh; display: grid; place-items: center; background: var(--sea-900); }
.boot-wave { width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--lagoon); border-top-color: transparent; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.shell > div { min-width: 0; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: radial-gradient(120% 60% at 0% 0%, var(--sea-700) 0%, var(--sea-900) 55%, var(--sea-950) 100%);
  color: #cfe4e8; padding: 22px 16px 120px; display: flex; flex-direction: column;
}
.side::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 110px; pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 264 110' preserveAspectRatio='none'%3E%3Cpath d='M0 50 C 44 30, 88 70, 132 50 S 220 30, 264 50 V110 H0Z' fill='%2319b3a6' fill-opacity='.18'/%3E%3Cpath d='M0 72 C 44 52, 88 92, 132 72 S 220 52, 264 72 V110 H0Z' fill='%2319b3a6' fill-opacity='.22'/%3E%3Cpath d='M0 92 C 44 78, 88 106, 132 92 S 220 78, 264 92 V110 H0Z' fill='%23ff6f59' fill-opacity='.25'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; color: #fff; }
.brand-mark { width: 42px; height: 42px; flex: none; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -0.03em; line-height: 1; }
.brand-sub { font-size: 11.5px; color: #8fb6bd; letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #6f98a0; padding: 16px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: #cfe4e8; font-weight: 500; text-decoration: none; transition: background .15s, color .15s;
}
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: linear-gradient(90deg, rgba(25,179,166,.28), rgba(25,179,166,.08)); color: #fff; box-shadow: inset 3px 0 0 var(--lagoon); }
.side-user { margin-top: auto; position: relative; z-index: 1; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.06); display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--sea-900); background: var(--sun); flex: none; font-size: 14px; }
.side-user .name { color: #fff; font-weight: 600; font-size: 14px; line-height: 1.2; }
.side-user button { margin-left: auto; background: none; border: 0; color: #8fb6bd; cursor: pointer; padding: 6px; border-radius: 8px; }
.side-user button:hover { color: #fff; background: rgba(255,255,255,.08); }

.main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 60px; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--coral-600); font-weight: 700; margin-bottom: 6px; }
.page-head p { color: var(--muted); margin: 0; }

/* ---------- cards ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 28px clamp(20px, 3vw, 36px); color: #fff; margin-bottom: 22px;
  background: linear-gradient(120deg, var(--sea-900) 0%, var(--sea-700) 55%, var(--lagoon-600) 120%);
}
.hero h1 { color: #fff; margin-bottom: 6px; }
.hero p { color: #bfe0e4; margin: 0; max-width: 560px; }
.hero .greet { font-family: var(--thaana); font-size: 15px; color: var(--sun); margin-bottom: 4px; }
.hero-waves { position: absolute; right: -40px; bottom: -10px; width: 460px; max-width: 70%; opacity: .9; pointer-events: none; }
.hero .row { position: relative; z-index: 1; margin-top: 18px; }

.stat { display: flex; gap: 14px; align-items: center; }
.stat-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.stat-icon svg { width: 22px; height: 22px; }
.stat .v { font-family: var(--display); font-size: 28px; font-weight: 800; line-height: 1; }
.stat .k { color: var(--muted); font-size: 13px; margin-top: 4px; }
.t-lagoon { background: var(--lagoon-soft); color: var(--lagoon-600); }
.t-coral { background: var(--coral-soft); color: var(--coral-600); }
.t-sun { background: var(--sun-soft); color: #b7791f; }
.t-sea { background: #dde9ee; color: var(--sea-700); }

.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.quick a {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.quick a:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.quick a b { font-family: var(--display); font-size: 16px; }
.quick a span { color: var(--muted); font-size: 13px; line-height: 1.35; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); font: 600 14px var(--font); cursor: pointer;
  text-decoration: none !important; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--sand); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--sea-900); border-color: var(--sea-900); color: #fff; }
.btn.primary:hover { background: var(--sea-700); }
.btn.accent { background: var(--coral); border-color: var(--coral); color: #fff; }
.btn.accent:hover { background: var(--coral-600); }
.btn.lagoon { background: var(--lagoon); border-color: var(--lagoon); color: #fff; }
.btn.lagoon:hover { background: var(--lagoon-600); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(7,37,48,.06); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 10px; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.hero .btn { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.1); color: #fff; }
.hero .btn:hover { background: rgba(255,255,255,.18); }
.hero .btn.accent { background: var(--coral); border-color: var(--coral); }

label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label.f > span.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input, select, textarea {
  font: 400 14.5px var(--font), var(--thaana); color: var(--ink); background: #fff; border: 1px solid var(--line-2);
  border-radius: 11px; padding: 9px 12px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { border-color: var(--lagoon); box-shadow: 0 0 0 4px rgba(25,179,166,.15); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--lagoon-600); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13px; cursor: pointer; background: #fff; }
.checks label:has(input:checked) { background: var(--lagoon-soft); border-color: var(--lagoon); color: var(--sea-800); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar select, .toolbar input { width: auto; min-width: 150px; }
.seg { display: inline-flex; background: var(--sand-2); border-radius: 12px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button, .seg a { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font: 600 13.5px var(--font); color: var(--ink-2); cursor: pointer; text-decoration: none; }
.seg .on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 11px 14px; background: var(--sand); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #fffaf2; }
table.t .actions { text-align: right; white-space: nowrap; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--sand-2); color: var(--ink-2); white-space: nowrap; }
.chip.dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.lagoon { background: var(--lagoon-soft); color: var(--lagoon-600); }
.chip.coral { background: var(--coral-soft); color: var(--coral-600); }
.chip.sun { background: var(--sun-soft); color: #a16207; }
.chip.sea { background: #dde9ee; color: var(--sea-700); }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 54px; height: 54px; color: var(--line-2); margin-bottom: 10px; }
.empty h3 { color: var(--ink); }

/* ---------- class cards ---------- */
.class-card { position: relative; overflow: hidden; display: block; color: var(--ink); text-decoration: none !important; transition: transform .15s, box-shadow .15s; }
.class-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.class-card .band { height: 74px; margin: -20px -20px 16px; position: relative; }
.class-card .band svg { position: absolute; bottom: -1px; left: 0; width: 100%; height: 30px; }
.class-card .grade { position: absolute; top: 14px; left: 18px; color: #fff; font-family: var(--display); font-weight: 800; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; opacity: .9; }
.class-card h3 { font-size: 20px; margin-bottom: 2px; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px dashed var(--line); color: var(--ink); text-decoration: none !important; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover .li-title { color: var(--lagoon-600); }
.li-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.li-icon svg { width: 18px; height: 18px; }
.li-title { font-weight: 600; line-height: 1.3; }
.li-sub { font-size: 12.5px; color: var(--muted); }

/* ---------- attendance ---------- */
.att-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.att-row:last-child { border-bottom: 0; }
.att-row .n { flex: 1; font-weight: 600; min-width: 0; }
.att-btns { display: flex; gap: 6px; }
.att-btns button { width: 40px; height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; font: 700 13px var(--font); cursor: pointer; color: var(--muted); }
.att-btns button.on[data-s="P"] { background: var(--good); border-color: var(--good); color: #fff; }
.att-btns button.on[data-s="A"] { background: var(--bad); border-color: var(--bad); color: #fff; }
.att-btns button.on[data-s="L"] { background: var(--warn); border-color: var(--warn); color: #fff; }
.att-btns button.on[data-s="E"] { background: var(--sea-700); border-color: var(--sea-700); color: #fff; }
.att-grid td, .att-grid th { text-align: center; padding: 6px 4px !important; font-size: 12px; }
.att-grid td:first-child, .att-grid th:first-child { text-align: left; padding-left: 14px !important; }
.s-P { color: var(--good); font-weight: 700; } .s-A { color: var(--bad); font-weight: 700; } .s-L { color: var(--warn); font-weight: 700; } .s-E { color: var(--sea-700); font-weight: 700; }

/* ---------- progress grid ---------- */
.pgrid th.oc { min-width: 110px; max-width: 160px; white-space: normal; text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; color: var(--ink-2); vertical-align: bottom; }
.pgrid td.lv { text-align: center; padding: 6px !important; }
.lvl {
  width: 40px; height: 34px; border-radius: 10px; border: 1px dashed var(--line-2); background: #fff; cursor: pointer;
  font: 700 13px var(--font); color: var(--muted); transition: transform .08s;
}
.lvl:hover { transform: scale(1.06); }
.lvl[data-l="1"] { background: var(--l1); border: 0; color: #fff; }
.lvl[data-l="2"] { background: var(--l2); border: 0; color: #5b3b00; }
.lvl[data-l="3"] { background: var(--l3); border: 0; color: #064e3b; }
.lvl[data-l="4"] { background: var(--l4); border: 0; color: #073b52; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

.bar { height: 10px; background: var(--sand-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; }
.dist { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--sand-2); }
.dist i { display: block; height: 100%; }

/* ---------- studio ---------- */
.type-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 22px; }
.type-card { position: relative; overflow: hidden; padding: 18px; border-radius: 18px; color: var(--ink); text-decoration: none !important; border: 1px solid var(--line); background: var(--paper); transition: transform .15s, box-shadow .15s; }
.type-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.type-card .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 12px; }
.type-card .ic svg { width: 22px; height: 22px; }
.type-card b { font-family: var(--display); font-size: 17px; display: block; }
.type-card span { font-size: 13px; color: var(--muted); }
.type-card .count { position: absolute; top: 16px; right: 16px; font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--line-2); }

.gen-layout { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 22px; align-items: start; }
.gen-preview { min-height: 420px; display: grid; place-items: center; text-align: center; color: var(--muted); border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 30px; background: repeating-linear-gradient(45deg, transparent 0 14px, rgba(231,221,207,.35) 14px 15px); }
.ai-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: linear-gradient(90deg, var(--lagoon-soft), var(--sun-soft)); color: var(--sea-800); }

.generating { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.generating .waves { display: flex; gap: 6px; }
.generating .waves i { width: 10px; height: 28px; border-radius: 6px; background: var(--lagoon); animation: wave 1s ease-in-out infinite; }
.generating .waves i:nth-child(2) { animation-delay: .1s; background: var(--sea-700); }
.generating .waves i:nth-child(3) { animation-delay: .2s; background: var(--coral); }
.generating .waves i:nth-child(4) { animation-delay: .3s; background: var(--sun); }
@keyframes wave { 0%, 100% { transform: scaleY(.4); } 50% { transform: scaleY(1); } }

/* ---------- document paper ---------- */
.doc-bar { position: sticky; top: 0; z-index: 20; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 0; margin: -12px 0 12px; background: linear-gradient(var(--sand) 75%, rgba(246,240,230,0)); }
.doc-bar .title-in { flex: 1; min-width: 200px; font: 700 18px var(--display); border: 1px solid transparent; background: transparent; padding: 6px 10px; }
.doc-bar .title-in:hover { border-color: var(--line-2); background: #fff; }
.edit-hint { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }

.paper {
  background: #fff; max-width: 860px; margin: 0 auto; padding: 44px 52px; border-radius: 6px;
  box-shadow: 0 1px 0 var(--line), 0 30px 60px -30px rgba(7,37,48,.35); color: #1b2a31; font-size: 14px; position: relative;
}
.paper + .paper { margin-top: 26px; }
.paper.landscape { max-width: 1100px; }
.paper h1 { font-size: 26px; margin-bottom: 4px; }
.paper h2 { font-size: 16px; text-transform: uppercase; letter-spacing: .08em; color: var(--sea-700); margin: 22px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--lagoon-soft); }
.paper h3 { font-size: 15px; margin: 14px 0 6px; }
.paper ul, .paper ol { margin: 4px 0 8px; padding-left: 22px; }
.paper li { margin: 3px 0; }
.paper-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; border-bottom: 3px solid var(--sea-900); padding-bottom: 14px; margin-bottom: 16px; }
.paper-head .school { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.paper-head .kind { font-family: var(--display); font-weight: 800; color: var(--coral-600); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.meta-grid > div { padding: 8px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.meta-grid > div:nth-child(4n) { border-right: 0; }
.meta-grid .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.meta-grid .v { font-weight: 600; min-height: 1.4em; }
.ptable { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 13.5px; }
.ptable th { background: var(--sea-900); color: #fff; text-align: left; padding: 8px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.ptable td { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
.ptable tr:nth-child(even) td { background: #fcfaf6; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: #fdfbf7; }
.box h3 { margin-top: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--sea-700); }
.signature { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 34px; }
.signature div { border-top: 1px solid #94a3b8; padding-top: 6px; font-size: 12px; color: var(--muted); text-align: center; }

[contenteditable="true"] { outline: none; border-radius: 4px; transition: background .12s, box-shadow .12s; min-width: 1em; }
.editing [contenteditable="true"]:hover { background: #fff8e6; box-shadow: 0 0 0 3px #fff8e6; }
.editing [contenteditable="true"]:focus { background: #eefaf8; box-shadow: 0 0 0 3px #eefaf8; }
[contenteditable="true"]:empty::before { content: attr(data-ph); color: #b8b0a3; font-style: italic; }
.li-ctrl { display: inline-flex; gap: 2px; margin-left: 6px; opacity: 0; transition: opacity .15s; vertical-align: middle; }
li:hover > .li-ctrl, tr:hover .li-ctrl, .ws-item:hover .li-ctrl { opacity: 1; }
.li-ctrl button, .add-item { border: 0; background: var(--sand-2); color: var(--ink-2); border-radius: 6px; font: 700 11px var(--font); cursor: pointer; padding: 2px 7px; }
.add-item { margin: 2px 0 6px 22px; background: transparent; color: var(--lagoon-600); padding: 2px 4px; }
.add-item:hover { text-decoration: underline; }

/* ---------- worksheet ---------- */
.ws-name { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; margin: 8px 0 18px; font-size: 14px; }
.ws-name div { border-bottom: 1.5px solid #64748b; padding: 4px 0; color: var(--muted); }
.ws-section { margin: 18px 0 8px; break-inside: avoid; }
.ws-prompt { display: flex; gap: 10px; align-items: baseline; font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.ws-prompt .num { width: 26px; height: 26px; border-radius: 50%; background: var(--sea-900); color: #fff; display: inline-grid; place-items: center; font-size: 13px; flex: none; }
.ws-trace { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.ws-trace .tr { font-family: 'Plus Jakarta Sans', var(--thaana), sans-serif; font-size: 64px; font-weight: 700; line-height: 1.15; color: transparent; -webkit-text-stroke: 2px #94a3b8; letter-spacing: 6px; padding: 0 8px; border-bottom: 2px solid #cbd5e1; background: linear-gradient(transparent 49%, #e2e8f0 49% 51%, transparent 51%); min-width: 70px; text-align: center; }
.ws-trace .tr.word { font-size: 46px; }
.ws-trace .tr[dir="rtl"] { font-family: var(--thaana); }
.ws-count { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ws-count .cell { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--line-2); border-radius: 14px; padding: 10px 14px; }
.ws-count .pics { flex: 1; font-size: 28px; line-height: 1.3; letter-spacing: 2px; word-break: break-all; }
.ws-count .ans { width: 54px; height: 54px; border: 2px solid #64748b; border-radius: 10px; flex: none; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: var(--lagoon-600); }
.ws-match { display: grid; grid-template-columns: 1fr 120px 1fr; row-gap: 14px; align-items: center; }
.ws-match .l, .ws-match .r { font-size: 22px; display: flex; align-items: center; gap: 10px; }
.ws-match .l { justify-content: flex-end; }
.ws-match .l::after, .ws-match .r::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: #1e293b; flex: none; }
.ws-match .l .e { font-size: 38px; }
.ws-circle { display: flex; flex-direction: column; gap: 12px; }
.ws-circle .q { font-weight: 600; }
.ws-circle .opts { display: flex; gap: 22px; flex-wrap: wrap; }
.ws-circle .opt { font-size: 30px; border: 1.5px dashed var(--line-2); border-radius: 16px; padding: 8px 16px; min-width: 80px; text-align: center; word-break: break-all; }
.ws-circle .opt.ans { border: 3px solid var(--coral); border-style: solid; }
.ws-mcq ol { padding-left: 22px; }
.ws-mcq li { margin-bottom: 12px; }
.ws-mcq .opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 20px; margin-top: 4px; }
.ws-mcq .opt::before { content: attr(data-letter) ')  '; font-weight: 700; color: var(--muted); }
.ws-mcq .opt.ans { color: var(--coral-600); font-weight: 700; }
.ws-lines li { margin-bottom: 8px; }
.ws-lines .line { border-bottom: 1.5px solid #cbd5e1; height: 30px; }
.ws-draw .box-draw { border: 2px solid #94a3b8; border-radius: 16px; height: 260px; }
.ws-item { position: relative; }

/* ---------- reports ---------- */
.rp-subject { margin-bottom: 12px; break-inside: avoid; }
.rp-subject .h { display: flex; align-items: center; gap: 10px; padding: 7px 12px; color: #fff; border-radius: 8px 8px 0 0; font-weight: 700; font-size: 13.5px; }
.rp-subject .h .avg { margin-left: auto; background: rgba(255,255,255,.2); padding: 2px 10px; border-radius: 99px; font-size: 12px; }
.rp-subject table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rp-subject td { border: 1px solid var(--line); padding: 6px 10px; }
.rp-subject td.lv { width: 82px; text-align: center; font-size: 12px; }
.rp-subject td.lv.on { font-weight: 800; }
.rp-subject td.lv.on.l1 { background: #fee2e2; color: #991b1b; }
.rp-subject td.lv.on.l2 { background: #fef3c7; color: #92400e; }
.rp-subject td.lv.on.l3 { background: #d1fae5; color: #065f46; }
.rp-subject td.lv.on.l4 { background: #e0f2fe; color: #075985; }
.rp-subject th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 5px; border: 1px solid var(--line); background: #faf7f1; }
.comment-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.comment-box .k { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--sea-700); font-weight: 700; margin-bottom: 4px; }
.comment-box .v { min-height: 2.6em; }
.att-strip { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; text-align: center; margin: 6px 0 12px; }
.att-strip div { padding: 8px; border-right: 1px solid var(--line); }
.att-strip div:last-child { border-right: 0; }
.att-strip b { display: block; font-family: var(--display); font-size: 20px; }
.att-strip span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* ---------- curriculum editor ---------- */
.subj { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; overflow: hidden; background: #fff; }
.subj-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--sand); }
.subj-h input[type="color"] { width: 30px; height: 30px; padding: 2px; border-radius: 8px; }
.subj-h .nm { font-weight: 700; flex: 1; }
.oc-row { display: flex; gap: 8px; align-items: center; padding: 6px 14px; border-top: 1px solid var(--line); }
.oc-row .code { width: 80px; flex: none; }
.oc-row input { border-color: transparent; }
.oc-row input:hover { border-color: var(--line-2); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(90% 70% at 20% 10%, var(--sea-700), var(--sea-900) 60%, var(--sea-950)); }
.auth-art h1 { font-size: clamp(34px, 4.4vw, 58px); color: #fff; max-width: 520px; }
.auth-art h1 em { font-style: normal; color: var(--lagoon); }
.auth-art p { color: #a9cdd3; max-width: 460px; font-size: 16px; }
.auth-art svg.sea { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 42%; }
.auth-art .sun { position: absolute; right: 14%; bottom: 36%; width: 64px; height: 64px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 60px rgba(245,184,61,.45); }
.auth-art .feat { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; }
.auth-art .feat span { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form form { width: 100%; max-width: 400px; }
.auth-form h2 { font-size: 30px; }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(4,26,34,.55); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: var(--paper); border-radius: 22px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal.wide { max-width: 760px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal-h h2 { margin: 0; }
.modal-b { padding: 18px 22px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--sea-900); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 500; font-size: 14px; animation: pop .2s; max-width: 360px; border-left: 4px solid var(--lagoon); }
.toast.err { border-left-color: var(--coral); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gen-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: var(--side-w); transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: var(--shadow-lg); }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(4,26,34,.4); z-index: 50; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: var(--sea-900); color: #fff; padding: 10px 16px; }
  .topbar .brand-name { font-size: 18px; }
  .topbar button { background: none; border: 0; color: #fff; padding: 6px; cursor: pointer; display: grid; }
  .topbar button svg { width: 24px; height: 24px; }
  .main { padding: 20px 16px 60px; }
  .grid.c2, .grid.c3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 300px; padding: 28px; }
  .paper { padding: 26px 20px; }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meta-grid > div:nth-child(4n) { border-right: 1px solid var(--line); }
  .meta-grid > div:nth-child(2n) { border-right: 0; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid.c4 { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .ws-count { grid-template-columns: 1fr; }
  .ws-match { grid-template-columns: 1fr 50px 1fr; }
  .att-btns button { width: 34px; }
  .toolbar select, .toolbar input { min-width: 0; flex: 1 1 150px; }
}

/* ---------- print ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 12.5px; }
  .side, .topbar, .doc-bar, .no-print, .edit-hint, .li-ctrl, .add-item, #toasts, .page-head, .toolbar { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .paper { box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
  .paper + .paper { margin-top: 0; break-before: page; }
  .card { box-shadow: none; }
  .ptable th, .rp-subject .h, .paper-head, .ws-prompt .num { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  [contenteditable] { background: none !important; box-shadow: none !important; }
  [contenteditable="true"]:empty::before { content: ''; }
  .hide-answers .ans { border-color: var(--line-2) !important; color: inherit !important; font-weight: inherit !important; }
  .hide-answers .ws-count .ans { color: transparent !important; }
}
.hide-answers .ws-count .ans { color: transparent; }
.hide-answers .ws-circle .opt.ans { border: 1.5px dashed var(--line-2); }
.hide-answers .ws-mcq .opt.ans { color: inherit; font-weight: inherit; }
