:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e4e7ec;
  --text: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-text: #4338ca;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 50px -12px rgba(16, 24, 40, .25);
  --radius: 12px;
  --sidebar: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12;
    --surface: #13161d;
    --surface-2: #1a1e27;
    --border: #252a35;
    --text: #e8eaef;
    --muted: #9aa1ae;
    --faint: #6b7280;
    --accent: #818cf8;
    --accent-soft: #1e1f3a;
    --accent-text: #a5b4fc;
    --danger: #f87171;
    --danger-soft: #2a1414;
    --success: #34d399;
    --success-soft: #0f261e;
    --warning: #fbbf24;
    --warning-soft: #2a2110;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 20px 50px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; font-weight: 700; font-size: 16px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--muted); font-weight: 500; cursor: pointer;
  border: 0; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--faint); font-weight: 500; }
.nav-label { display: flex; align-items: center; justify-content: space-between; padding: 18px 10px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.nav-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot { margin-top: auto; padding-top: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 32px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.search { position: relative; flex: 1; max-width: 420px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; }
.search input { width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); outline: none; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topbar .spacer { flex: 1; }
.btn.menu-btn { display: none; }
.content { padding: 28px 32px 60px; max-width: 1180px; width: 100%; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn svg.i { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0b0d12; } }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger-soft); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.btn:disabled { opacity: .55; cursor: default; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--faint); }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 70px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; outline-offset: 2px; }
.swatch.on { outline: 2px solid var(--text); }

.segmented { display: flex; gap: 4px; padding: 3px; background: var(--surface-2); border-radius: 10px; width: fit-content; flex-wrap: wrap; }
.segmented button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 500; color: var(--muted); font-size: 13px; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented button .n { color: var(--faint); margin-left: 4px; font-weight: 400; }

.drop {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border: 1.5px dashed var(--border); border-radius: 10px;
  cursor: pointer; background: var(--surface-2); transition: border-color .12s, background .12s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { display: none; }
.drop .ic { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--surface); color: var(--muted); border: 1px solid var(--border); flex: none; }
.drop.has .ic { color: var(--danger); }
.drop .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop .s { font-size: 12px; color: var(--faint); }
.drop > div:nth-child(3) { min-width: 0; flex: 1; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.card-b { padding: 14px 18px 18px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-h p { margin: 4px 0 0; color: var(--muted); }
.page-h .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid-dash { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; margin-bottom: 18px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.subject-card { padding: 16px 18px; cursor: pointer; position: relative; overflow: hidden; transition: transform .12s, box-shadow .12s; }
.subject-card:hover { transform: translateY(-1px); box-shadow: 0 6px 20px -8px rgba(16,24,40,.2); }
.subject-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.subject-card .n { font-weight: 600; font-size: 15px; }
.subject-card .m { color: var(--muted); font-size: 13px; margin-top: 2px; min-height: 20px; }
.subject-card .f { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 14px; color: var(--muted); font-size: 12.5px; }
.subject-card .f span { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.subject-card .f svg { width: 14px; height: 14px; }
.subject-card.add { display: grid; place-items: center; color: var(--muted); border-style: dashed; box-shadow: none; background: transparent; min-height: 108px; font-weight: 500; }
.subject-card.add::before { display: none; }

.section-h { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px; }

/* today timeline */
.timeline { display: flex; flex-direction: column; gap: 8px; }
.slot { display: grid; grid-template-columns: 62px 1fr; gap: 12px; align-items: stretch; }
.slot .time { font-size: 12.5px; color: var(--muted); padding-top: 9px; font-variant-numeric: tabular-nums; }
.slot .time b { display: block; color: var(--text); font-weight: 600; }
.slot .box { border-radius: 10px; padding: 9px 12px; background: color-mix(in srgb, var(--c) 10%, var(--surface)); border-left: 3px solid var(--c); cursor: pointer; }
.slot .box .n { font-weight: 600; }
.slot .box .d { font-size: 12.5px; color: var(--muted); }
.slot.past { opacity: .5; }
.slot.now .box { box-shadow: 0 0 0 2px var(--c); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.live { background: var(--success-soft); color: var(--success); }
.pill.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 10px; color: var(--faint); }
.empty b { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.empty .btn { margin-top: 14px; }

/* documents */
.docs { display: flex; flex-direction: column; }
.doc {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: 10px; cursor: pointer;
}
.doc + .doc { border-top: 1px solid var(--border); border-radius: 0; }
.doc:hover { background: var(--surface-2); border-radius: 10px; }
.doc:hover + .doc { border-top-color: transparent; }
.fi { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--k, var(--danger)) 13%, var(--surface)); color: var(--k, var(--danger)); font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.doc .body { flex: 1; min-width: 0; }
.doc .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .meta { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.doc .right { display: flex; align-items: center; gap: 6px; flex: none; }
.tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.tag.course { background: var(--accent-soft); color: var(--accent-text); }
.tag.td { background: #fef3c7; color: #92400e; }
.tag.tp { background: #e0f2fe; color: #075985; }
.tag.exam { background: #fce7f3; color: #9d174d; }
.tag.notes { background: #ede9fe; color: #5b21b6; }
@media (prefers-color-scheme: dark) {
  .tag.td { background: #2d2410; color: #fcd34d; }
  .tag.tp { background: #0c2433; color: #7dd3fc; }
  .tag.exam { background: #2d1022; color: #f9a8d4; }
  .tag.notes { background: #221a3d; color: #c4b5fd; }
}
.corr { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; white-space: nowrap; }
.corr svg { width: 14px; height: 14px; }
.corr.ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); background: var(--success-soft); }
.corr.add { color: var(--muted); border-style: dashed; }
.corr.add:hover { color: var(--accent-text); border-color: var(--accent); }

.subject-hero { display: flex; gap: 16px; align-items: center; }
.subject-hero .badge { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--c); font-weight: 700; font-size: 20px; flex: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.chip svg { width: 14px; height: 14px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; min-width: 170px; z-index: 30; }
.dropdown-menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; text-align: left; }
.dropdown-menu button:hover { background: var(--surface-2); }
.dropdown-menu button.danger { color: var(--danger); }
.dropdown-menu svg { width: 15px; height: 15px; }

/* ---------- timetable ---------- */
.tt { overflow: hidden; }
.tt-head, .tt-body { display: grid; grid-template-columns: 58px repeat(var(--days), 1fr); }
.tt-head { border-bottom: 1px solid var(--border); }
.tt-head div { padding: 12px 8px; text-align: center; font-weight: 600; font-size: 13px; }
.tt-head div.today { color: var(--accent-text); }
.tt-head div.today span { background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; }
.tt-times { position: relative; }
.tt-times div { height: var(--h); font-size: 11.5px; color: var(--faint); text-align: right; padding-right: 8px; transform: translateY(-8px); font-variant-numeric: tabular-nums; }
.tt-col { position: relative; border-left: 1px solid var(--border); cursor: copy; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--h) - 1px), var(--border) calc(var(--h) - 1px), var(--border) var(--h)); }
.tt-col.today { background-color: color-mix(in srgb, var(--accent) 3%, transparent); }
.tt-block {
  position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 6px 8px; overflow: hidden; cursor: pointer;
  background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-left: 3px solid var(--c);
  font-size: 12px; line-height: 1.35; transition: box-shadow .12s;
}
.tt-block:hover { box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--c) 50%, transparent); }
.tt-block { display: flex; flex-direction: column; gap: 1px; }
.tt-block .n { font-weight: 600; color: var(--text); line-height: 1.3; overflow-wrap: break-word; hyphens: auto; flex: none; }
.tt-block.pair { padding: 0; gap: 2px; background: none; border-left: 0; box-shadow: none; cursor: default; }
.tt-block.pair > div { flex: 1; min-height: 0; overflow: hidden; padding: 3px 7px; font-size: 11.5px; border-radius: 7px; cursor: pointer; background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-left: 3px solid var(--c); }
.tt-block.pair > div:hover { box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--c) 50%, transparent); }
.tt-block .d { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.tt-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.tt-mobile { display: none; }

/* ---------- viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; animation: fade .15s ease; }
.viewer-h { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.viewer-h .t { flex: 1; min-width: 160px; }
.viewer-h .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-h .t span { font-size: 12.5px; color: var(--muted); }
.viewer-split { flex: 1; display: grid; grid-template-columns: 1fr; min-height: 0; }
.viewer-split.two { grid-template-columns: 1fr 1fr; }
.viewer-split.two .vpane + .vpane { border-left: 1px solid var(--border); }
.viewer-tools { display: flex; gap: 6px; align-items: center; }
.vpane { min-height: 0; min-width: 0; display: flex; flex-direction: column; background: var(--surface-2); }
.vpane > * { flex: 1; min-height: 0; }
.pdf-pane { overflow: auto; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; -webkit-overflow-scrolling: touch; }
.pdf-page { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 4px 16px -6px rgba(0,0,0,.15); flex: none; max-width: none; }
.pdf-page canvas { width: 100%; height: 100%; display: block; }
.img-pane { overflow: auto; display: grid; place-items: center; padding: 16px; }
.img-pane img { max-width: 100%; height: auto; box-shadow: var(--shadow); border-radius: 6px; background: #fff; }
.text-pane { overflow: auto; padding: 16px; }
.text-pane pre { margin: 0 auto; max-width: 900px; white-space: pre-wrap; word-break: break-word; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.media-pane { display: grid; place-items: center; padding: 16px; }
.media-pane video { max-width: 100%; max-height: 100%; border-radius: 10px; background: #000; }
.pane-msg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; text-align: center; }
.pane-msg .empty { padding: 0; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; margin-bottom: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* multi-file upload */
.picked { display: flex; flex-direction: column; gap: 6px; margin: -4px 0 14px; }
.picked:empty { display: none; }
.picked-row { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 8px; border: 1px solid var(--border); border-radius: 10px; }
.picked-row .fi { width: 32px; height: 32px; font-size: 9px; border-radius: 8px; }
.picked-row .nm, .picked-row .input { flex: 1; min-width: 0; }
.picked-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.picked-row .input { padding: 6px 10px; }
.picked-row .sz { font-size: 12px; white-space: nowrap; }
.upload-status { font-size: 13px; min-height: 0; }
.upload-status:empty { display: none; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(15, 18, 25, .45); display: grid; place-items: center; padding: 16px; animation: fade .12s ease; }
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .16s ease; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 4px; }
.modal-h h2 { font-size: 17px; }
.modal-b { padding: 14px 20px 6px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 20px 18px; }
.modal-f .left { margin-right: auto; }
.progress { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 4px; display: none; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .1s; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-weight: 500; box-shadow: var(--shadow-lg); animation: pop .16s ease; }
.toast.err { background: var(--danger); color: #fff; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 360px; padding: 28px; }
.login .brand { padding: 0 0 20px; justify-content: center; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .grid-dash { grid-template-columns: 1fr; }
}
/* Below this the grid columns get too thin for full subject names — use the day-by-day list */
@media (max-width: 1100px) {
  .tt { display: none; }
  .tt-mobile { display: block; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; left: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .topbar .btn.primary .lbl { display: none; }
  .content { padding: 20px 16px 50px; }
  h1 { font-size: 21px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 12px; }
  .stat .v { font-size: 21px; }
  .stat .k { font-size: 12px; }
  .row, .row3 { grid-template-columns: 1fr; gap: 0; }
  .doc { padding: 12px 6px; gap: 10px; }
  .doc .fi { width: 34px; height: 34px; }
  .doc .corr .lbl { display: none; }
  .viewer-split.two { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .viewer-split.two .vpane + .vpane { border-left: 0; border-top: 1px solid var(--border); }
  .viewer-h { gap: 8px; padding: 8px 10px; }
  .viewer-h .t { order: -1; flex-basis: calc(100% - 50px); }
  .viewer-tools .lbl { display: none; }
  .pdf-pane { padding: 8px; gap: 8px; }
}

/* ---------- A/B weeks ---------- */
.wk { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); letter-spacing: .02em; vertical-align: 1px; line-height: 17px; }
.wk.lg { font-size: 12px; padding: 1px 8px; background: var(--accent-soft); color: var(--accent-text); }
.wk.unset { background: var(--warning-soft); color: var(--warning); }
.tt-block .wk { background: color-mix(in srgb, var(--c) 22%, var(--surface)); color: var(--text); }
.week-now { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.week-setup { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; margin-bottom: 14px; border-color: color-mix(in srgb, var(--warning) 35%, var(--border)); background: var(--warning-soft); flex-wrap: wrap; }
.week-setup b { display: block; }
.week-setup span { font-size: 13px; }
.week-setup .actions { display: flex; gap: 8px; }
.tt-head .date { color: var(--faint); font-weight: 500; }
.tt-head .today .date { color: inherit; }

/* ---------- whiteboard ---------- */
.board { position: fixed; inset: 0; z-index: 55; background: var(--surface-2); display: flex; flex-direction: column; animation: fade .15s ease; }
.board-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.board-bar .spacer { flex: 1; }
.board-bar .bstatus { font-size: 12.5px; }
.bgroup { display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 10px; }
.bgroup button { border: 0; background: none; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.bgroup button:hover { background: var(--surface); color: var(--text); }
.bgroup button.on { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow); }
.bgroup button:disabled { opacity: .35; cursor: default; }
.bgroup select { border: 0; background: none; height: 36px; padding: 0 6px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.colors button span, .colors .custom span { width: 20px; height: 20px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.colors button.on { box-shadow: none; background: none; }
.colors button.on span { outline: 2px solid var(--text); outline-offset: 2px; }
.colors .custom { width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; position: relative; }
.colors .custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sizes button span { background: currentColor; border-radius: 50%; display: block; }
.board-scroll { flex: 1; overflow: auto; touch-action: none; -webkit-user-select: none; user-select: none; }
.board-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 16px 16px 40px; }
.bpage { position: relative; flex: none; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 8px 24px -10px rgba(0,0,0,.2); border-radius: 2px; cursor: crosshair; }
.bpage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.bpage canvas.live { mix-blend-mode: multiply; }
.bpage-n { position: absolute; right: -2px; top: 100%; margin-top: 2px; font-size: 11.5px; color: var(--faint); display: flex; align-items: center; gap: 4px; }
.bpage-n button { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 2px; display: grid; }
.bpage-n button:hover { color: var(--danger); }
.bpage-n svg { width: 13px; height: 13px; }
.add-page { margin-top: 4px; }
@media (max-width: 760px) {
  .board-bar { gap: 6px; padding: 6px 8px; }
  .bgroup button { width: 32px; height: 32px; }
  .board-bar .lbl { display: none; }
  .board-pages { padding: 10px 8px 30px; }
}

/* ---------- multi-file documents ---------- */
.file-tabs { display: flex; gap: 6px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.file-tabs button { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; flex: none; max-width: 240px; color: var(--muted); }
.file-tabs button:hover { background: var(--surface-2); color: var(--text); }
.file-tabs button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.file-tabs .fi { width: 28px; height: 28px; font-size: 8.5px; border-radius: 7px; }
.file-tabs .nm { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-files { margin: 0 0 8px; }
.new-files { margin-top: -6px; }
.picked-row.new { border-style: dashed; }
@media (max-width: 760px) { .file-tabs { padding: 6px 10px; } }

/* ---------- tomorrow ---------- */
.card-h .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.pill.warn { background: var(--warning-soft); color: var(--warning); }
.tomorrow .card-h { align-items: flex-start; }
.tomorrow .card-h .pill { white-space: nowrap; flex: none; }
.tm-class { display: flex; flex-direction: column; gap: 6px; }
.tm-todo { margin-left: 74px; display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 10px; background: var(--warning-soft); }
.tm-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--warning); }
.tm-label svg { width: 14px; height: 14px; }
.tm-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: var(--surface); border-radius: 8px; padding: 6px 8px; cursor: pointer; text-align: left; }
.tm-item:hover { box-shadow: var(--shadow); }
.tm-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 13px; }
.tm-item .add { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--muted); }
.tm-item .add:hover { background: var(--accent-soft); color: var(--accent-text); }
.tm-item .add svg { width: 14px; height: 14px; }
@media (max-width: 760px) { .tm-todo { margin-left: 0; } }

/* ---------- sharing ---------- */
.member { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.member + .member { border-top: 1px solid var(--border); }
.member.off { opacity: .6; }
.member .avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 14px; }
.member .body { flex: 1; min-width: 0; }
.member .title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.member .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.member .right { display: flex; gap: 6px; align-items: center; flex: none; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; margin-bottom: 6px; }
.check-row:hover { background: var(--surface-2); }
.check-row input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.check-row span { display: flex; flex-direction: column; }
.check-row b { font-weight: 500; font-size: 13.5px; }
.check-row small { color: var(--muted); font-size: 12px; }
.check-row.on { cursor: default; background: var(--surface-2); }
.subject-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px; margin-top: 10px; max-height: 220px; overflow-y: auto; padding: 2px; }
.pick { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.pick:hover { background: var(--surface-2); }
.pick input { accent-color: var(--accent); }
.linkbox { display: flex; gap: 8px; }
.linkbox .input { font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.me-card { display: flex; flex-direction: column; gap: 2px; padding: 10px; margin-bottom: 6px; border-radius: 10px; background: var(--surface-2); font-size: 12.5px; }
.me-card b { font-size: 14px; }
.me-card .chips { margin-top: 4px; gap: 4px; }
.sidebar-copy { padding: 10px 10px 0; font-size: 11.5px; color: var(--faint); }
.copyright { text-align: center; color: var(--faint); font-size: 12.5px; margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--border); }
.login .copyright { margin-top: 18px; padding-top: 14px; font-size: 12px; }
.login-hint { font-size: 12.5px; color: var(--muted); text-align: center; margin: 14px 0 0; }
@media (max-width: 760px) {
  .member { padding: 12px 4px; gap: 10px; }
  .member .right .lbl { display: none; }
}

/* ---------- annotations ---------- */
.pdf-page { position: relative; }
.pdf-page canvas.annot, .pdf-page canvas.annot-live { position: absolute; inset: 0; width: 100%; height: 100%; mix-blend-mode: multiply; pointer-events: none; }
.viewer .annot-bar { border-bottom: 1px solid var(--border); }
.viewer.annotating .pdf-pane { touch-action: none; -webkit-user-select: none; user-select: none; }
.viewer.annotating .pdf-page { cursor: crosshair; }
.viewer.annotating[data-annot-tool="text"] .pdf-page { cursor: text; }
.annot-text { position: absolute; z-index: 3; margin: -3px 0 0 -3px; padding: 2px; min-width: 120px; background: rgba(255, 255, 255, .92); border: 1.5px dashed var(--accent); border-radius: 4px; font-family: Inter, system-ui, sans-serif; font-weight: 500; line-height: 1.25; resize: none; outline: none; overflow: hidden; white-space: pre; }

/* hand tool: native scrolling, no drawing */
.viewer.annotating[data-annot-tool="hand"] .pdf-pane,
.board[data-board-tool="hand"] .board-scroll { touch-action: pan-x pan-y; }
.viewer.annotating[data-annot-tool="hand"] .pdf-page,
.board[data-board-tool="hand"] .bpage { cursor: grab; }
.viewer.annotating[data-annot-tool="hand"] .pdf-page:active,
.board[data-board-tool="hand"] .bpage:active { cursor: grabbing; }
.btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }

/* ---------- notifications ---------- */
.bell-wrap { position: relative; }
.bell-wrap > .btn { position: relative; }
.bell-count { position: absolute; top: 1px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.bell-panel { width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; padding: 6px; right: 0; }
.bell-h { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.bell-h > div { display: flex; gap: 2px; }
.bell-item { display: flex; gap: 10px; padding: 9px 8px; border-radius: 9px; align-items: flex-start; }
.bell-item:hover { background: var(--surface-2); }
.bell-item .k { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.bell-item .k svg { width: 16px; height: 16px; }
.bell-item .k.session { background: var(--accent-soft); color: var(--accent-text); }
.bell-item .k.deadline { background: var(--warning-soft); color: var(--warning); }
.bell-item .k.daily { background: var(--success-soft); color: var(--success); }
.bell-item .t { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.bell-item .t b { font-weight: 500; font-size: 13.5px; }
.bell-item .t small { font-size: 12px; color: var(--muted); }
.bell-item.unread .t b { font-weight: 700; }
.bell-item.unread .k { box-shadow: 0 0 0 2px var(--accent); }
.nf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.nf-card { margin-bottom: 16px; }
.nf-grid .nf-card { margin-bottom: 0; }
.nf-card .card-h h2 { display: flex; align-items: center; gap: 8px; }
.nf-card .card-h h2 svg { width: 17px; height: 17px; color: var(--accent-text); }
.nf-card .card-b.off { opacity: .45; pointer-events: none; }
.small { font-size: 12.5px; }
.err { color: var(--danger) !important; }
.switch { position: relative; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.offsets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--muted); }
.chip-btn:hover { border-color: var(--accent); color: var(--text); }
.chip-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .chip-btn.on { color: #0b0d12; } }
.off-custom { display: inline-flex; gap: 4px; align-items: center; margin-left: 4px; }
.off-custom input, .off-custom select { width: 58px; padding: 5px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 12.5px; }
.off-custom select { width: auto; }
.override .segmented { margin-bottom: 8px; }
.override .segmented .n { font-size: 11.5px; }
.ovr-list { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.ovr-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 9px; font-size: 13px; }
.ovr-row:hover { background: var(--surface-2); }
.ovr-row > span:nth-child(2) { flex: 1; min-width: 0; }
.ovr-row.past { opacity: .5; }
.dev-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; flex: none; }
.dev-ic svg { width: 16px; height: 16px; }
.devices { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; }
.device { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; }
.device .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.device small { font-size: 12px; }
.device-actions:empty { display: none; }
.ios-steps { background: var(--accent-soft); color: var(--text); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; font-size: 13.5px; }
.ios-steps ol { margin: 8px 0 6px; padding-left: 20px; }
.ios-steps li { margin: 4px 0; }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); font-size: 12px; }
.inline-field { max-width: 180px; margin-bottom: 0; }
.deadlines { margin-bottom: 18px; }
.dl-row { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 10px; cursor: pointer; }
.dl-row:hover { background: var(--surface-2); }
.dl-row .dot { background: var(--c); }
.dl-row .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-row .t b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-row .t small { font-size: 12px; color: var(--muted); }
.dl-row .when { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.dl-row.soon .when { color: var(--warning); }
.dl-row.late .when { color: var(--danger); }
.due { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.due svg { width: 12px; height: 12px; }
.due.soon { background: var(--warning-soft); color: var(--warning); }
.due.late { background: var(--danger-soft); color: var(--danger); }
.due.ok { background: var(--success-soft); color: var(--success); }
@media (max-width: 900px) { .nf-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .dl-row .lbl { display: none; }
  .device { flex-wrap: wrap; }
}
@media (max-width: 760px) { .topbar .btn .lbl { display: none; } }
.push-status { margin: 0; font-size: 13.5px; color: var(--muted); }
.push-status.err { color: var(--danger); }
