/* INTO Study — calm iOS-like theme (Things typography · My Study Life colours · Structured timeline) */
:root {
  --bg: #ffffff;
  --bg2: #f4f4f6;
  --bg3: #ebebef;
  --text: #1d1d1f;
  --text2: #6e6e73;
  --text3: #a1a1a6;
  --sep: #e6e6ea;
  --accent: #2f6bed;
  --accent-soft: #e9f0fe;
  --on-accent: #ffffff;
  --red: #e5484d;
  --red-soft: #fdecec;
  --orange: #e8801f;
  --green: #22a06b;
  --danger: var(--red);
  --ok: var(--green);
  --warn: var(--orange);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 28px rgba(0, 0, 0, .12);
  --elev: #ffffff;

  --math: #3d6ff0;  --math-bg: #edf2fe;
  --econ: #1f9d66;  --econ-bg: #e6f5ee;
  --bus: #e07b1a;   --bus-bg: #fdf0e3;
  --eap: #8155e8;   --eap-bg: #f2edfd;
  --other: #8e8e93; --other-bg: #f1f1f4;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --tabbar: 56px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #111113;
    --bg2: #1c1c1f;
    --bg3: #2a2a2e;
    --text: #f5f5f7;
    --text2: #98989f;
    --text3: #636368;
    --sep: #2a2a2d;
    --accent: #5b8cff;
    --accent-soft: rgba(91, 140, 255, .16);
    --on-accent: #0b1020;
    --red: #ff6b6b;
    --red-soft: rgba(255, 107, 107, .14);
    --orange: #ffa04d;
    --green: #3ccf8e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .5);

    --math: #7d9dff;  --math-bg: rgba(125, 157, 255, .15);
    --econ: #45cf92;  --econ-bg: rgba(69, 207, 146, .13);
    --bus: #ffa04d;   --bus-bg: rgba(255, 160, 77, .14);
    --eap: #a98bff;   --eap-bg: rgba(169, 139, 255, .15);
    --other: #98989f; --other-bg: rgba(152, 152, 159, .14);
    color-scheme: dark;
    --elev: var(--bg3);
  }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113;
    --bg2: #1c1c1f;
    --bg3: #2a2a2e;
    --text: #f5f5f7;
    --text2: #98989f;
    --text3: #636368;
    --sep: #2a2a2d;
    --accent: #5b8cff;
    --accent-soft: rgba(91, 140, 255, .16);
    --on-accent: #0b1020;
    --red: #ff6b6b;
    --red-soft: rgba(255, 107, 107, .14);
    --orange: #ffa04d;
    --green: #3ccf8e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .5);

    --math: #7d9dff;  --math-bg: rgba(125, 157, 255, .15);
    --econ: #45cf92;  --econ-bg: rgba(69, 207, 146, .13);
    --bus: #ffa04d;   --bus-bg: rgba(255, 160, 77, .14);
    --eap: #a98bff;   --eap-bg: rgba(169, 139, 255, .15);
    --other: #98989f; --other-bg: rgba(152, 152, 159, .14);
    color-scheme: dark;
    --elev: var(--bg3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; letter-spacing: inherit; }
a { color: inherit; text-decoration: none; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.s-math  { --s: var(--math);  --s-bg: var(--math-bg); }
.s-econ  { --s: var(--econ);  --s-bg: var(--econ-bg); }
.s-bus   { --s: var(--bus);   --s-bg: var(--bus-bg); }
.s-eap   { --s: var(--eap);   --s-bg: var(--eap-bg); }
.s-other { --s: var(--other); --s-bg: var(--other-bg); }

/* ---------- shell ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  height: calc(env(safe-area-inset-top) + 44px);
  padding: env(safe-area-inset-top) 16px 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.crumbs { display: none; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text2); padding: 5px 10px; border-radius: 999px; background: var(--bg2); }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.status.warn .dot { background: var(--orange); }
.status.bad .dot { background: var(--red); }
.status.busy .dot { animation: pulse 1s infinite; background: var(--accent); }
@keyframes pulse { 50% { opacity: .3; } }

.page-head { max-width: 760px; margin: 0 auto; padding: 0 20px 6px; }
.page-head h1 { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -0.025em; margin: 0; }
.page-sub { color: var(--text2); font-size: 17px; margin-top: 4px; }
.page-sub:empty { display: none; }
.view { padding: 8px 20px calc(var(--tabbar) + env(safe-area-inset-bottom) + 36px); max-width: 760px; margin: 0 auto; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep);
}
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 500; color: var(--text3); min-width: 0; }
.tabs button > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tabs .userbtn { display: none; }
.tabs svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.active { color: var(--accent); }
.brand, .side-label, .kbd-hint { display: none; }

/* ---------- type ---------- */
.section-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 34px 0 10px;
}
.section-title > .sub.small { font-size: 17px; font-weight: 400; color: var(--text3); margin-right: auto; letter-spacing: 0; }
.section-title > button, .section-title > a { font-size: 16px; font-weight: 400; color: var(--accent); letter-spacing: 0; }
.sub { color: var(--text2); font-size: 15px; }
.small { font-size: 14px; }
.empty { color: var(--text3); padding: 14px 0; font-size: 16px; }
.card { background: var(--bg2); border-radius: var(--r); padding: 16px; }
.card.empty { text-align: center; }

.list > * + * { border-top: .5px solid var(--sep); }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text2); white-space: nowrap; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--s, var(--text3)); flex-shrink: 0; }
.tag { font-size: 13px; color: var(--text3); }

.banner { border-radius: var(--r); padding: 14px 16px; font-size: 15px; margin-top: 12px; background: var(--bg2); color: var(--text2); }
.banner.bad { background: var(--red-soft); color: var(--red); }
.callout { background: var(--bg2); border-radius: var(--r); padding: 16px; }

.bar { position: relative; height: 6px; background: var(--bg3); border-radius: 3px; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--s, var(--accent)); border-radius: 3px; }
.bar em { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .25; border-radius: 1px; }

/* ---------- week strip (Today) ---------- */
.strip { display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); gap: 4px; margin: 14px 0 6px; }
.strip button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 8px; border-radius: var(--r); }
.strip .wd { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--text3); letter-spacing: .02em; }
.strip .dn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; font-weight: 600; }
.strip button.today .dn { color: var(--accent); }
.strip button.sel { background: var(--bg2); }
.strip button.sel .dn { background: var(--text); color: var(--bg); }
.strip button.sel.today .dn { background: var(--accent); color: var(--on-accent); }
.strip .dots { display: flex; gap: 3px; height: 6px; }
.strip .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--s); }

/* ---------- timeline ---------- */
.tl { margin-top: 8px; }
.tl-item { display: grid; grid-template-columns: 52px 18px minmax(0, 1fr); gap: 0 10px; }
.tl-time { text-align: right; font-variant-numeric: tabular-nums; padding-top: 10px; line-height: 1.25; }
.tl-time b { display: block; font-size: 16px; font-weight: 600; }
.tl-time span { display: block; font-size: 14px; color: var(--text3); }
.tl-rail { position: relative; }
.tl-rail::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--bg3); }
.tl-item:first-child .tl-rail::before { top: 16px; }
.tl-item:last-child .tl-rail::before { bottom: calc(100% - 16px); }
.tl-rail .node { position: absolute; left: 3px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: var(--s, var(--text3)); box-shadow: 0 0 0 3px var(--bg); }
.tl-body { padding: 4px 0 10px; min-width: 0; }
.tl-card { background: var(--s-bg); border-radius: var(--r); padding: 11px 14px; cursor: pointer; transition: transform .1s; }
.tl-card:active { transform: scale(.99); }
.tl-card .name { font-weight: 600; font-size: 17px; }
.tl-card .meta { font-size: 15px; color: var(--text2); margin-top: 1px; }
.tl-item.past { opacity: .5; }
.tl-item.current .tl-card { box-shadow: inset 0 0 0 2px var(--s); }
.tl-item.brk .tl-rail::before { background: repeating-linear-gradient(var(--bg3) 0 4px, transparent 4px 8px); }
.tl-item.brk .tl-body { padding: 8px 0 12px; font-size: 15px; color: var(--text3); }
.tl-item.dl .node { background: var(--bg); box-shadow: inset 0 0 0 2px var(--red), 0 0 0 3px var(--bg); }
.tl-item.dl .tl-body { padding-top: 8px; }
.tl-dl { display: flex; gap: 10px; align-items: flex-start; }
.tl-dl .title { font-weight: 500; }
.tl-dl .meta { font-size: 14px; color: var(--text2); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.tl-now { display: grid; grid-template-columns: 52px 18px 1fr; gap: 0 10px; align-items: center; margin: 2px 0; }
.tl-now span { text-align: right; font-size: 13px; font-weight: 600; color: var(--red); font-variant-numeric: tabular-nums; }
.tl-now i { position: relative; height: 18px; }
.tl-now i::before { content: ""; position: absolute; left: 4px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.tl-now em { height: 2px; background: var(--red); border-radius: 1px; }
.tl-empty { color: var(--text3); font-size: 16px; padding: 18px 0 6px; }

/* ---------- today summary tiles ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--bg2); border-radius: var(--r-lg); padding: 14px 16px; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.tile .lbl { font-size: 14px; color: var(--text2); }
.tile .big { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile .big small { font-size: 15px; font-weight: 600; color: var(--text2); margin-left: 4px; }
.tile .foot { font-size: 13px; color: var(--text3); }
.progress-head { display: flex; justify-content: space-between; font-size: 15px; color: var(--text2); }

/* ---------- class rows (week list) ---------- */
.cls { display: grid; grid-template-columns: 52px 4px 1fr; gap: 12px; padding: 12px 0; align-items: stretch; }
.cls .t { font-variant-numeric: tabular-nums; font-size: 16px; line-height: 1.25; text-align: right; }
.cls .t b { display: block; font-weight: 600; }
.cls .t span { color: var(--text3); font-size: 14px; }
.cls .stripe { background: var(--s); border-radius: 2px; }
.cls .name { font-weight: 600; }
.cls .meta { color: var(--text2); font-size: 15px; }
.cls.past { opacity: .5; }
.cls.dlrow .stripe { background: none; border-left: 2px dashed var(--red); border-radius: 0; }

/* stats (Tasks / Progress) */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 6px 0 4px; }
.stat { background: var(--bg2); border-radius: var(--r-lg); padding: 14px 16px; text-align: left; }
button.stat { width: 100%; }
.stat .big { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .lbl { display: block; font-size: 14px; color: var(--text2); }
.stat .lbl:first-letter { text-transform: uppercase; }
.stat .sub2 { color: var(--text3); }

/* ---------- week view ---------- */
.weeknav { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; }
.weeknav button { width: 40px; height: 40px; border-radius: 50%; background: var(--bg2); font-size: 22px; color: var(--text2); display: grid; place-items: center; }
.weeknav .lbl { font-weight: 600; text-align: center; font-size: 17px; }
.weeknav .lbl small { display: block; font-weight: 400; color: var(--text2); font-size: 15px; }
.day-title { font-size: 20px; font-weight: 700; margin: 28px 0 2px; display: flex; gap: 10px; align-items: baseline; letter-spacing: -0.015em; }
.day-title.today { color: var(--accent); }
.day-title .count { color: var(--text3); font-weight: 400; font-size: 15px; letter-spacing: 0; }
.weeksum { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 14px 0 0; font-size: 15px; color: var(--text2); }
.weeksum b { color: var(--text); font-weight: 600; }

/* ---------- controls ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin: 6px 0 4px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 4px; }
.seg { display: flex; background: var(--bg2); border-radius: 10px; padding: 3px; flex: 1; min-width: 0; }
.seg button { flex: 1; font-size: 15px; font-weight: 500; padding: 7px 8px; border-radius: 8px; color: var(--text2); white-space: nowrap; }
.seg button.on { background: var(--elev); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.controls .seg { flex: 0 1 auto; }
.mat-side .controls .seg { flex: 1; }
.sel { display: inline-flex; align-items: center; gap: 4px; background: var(--bg2); border-radius: 10px; padding: 0 6px 0 12px; font-size: 15px; color: var(--text2); }
.sel select { font: inherit; font-size: 15px; font-weight: 500; color: var(--text); background: transparent; border: 0; padding: 8px 4px; outline: none; cursor: pointer; }
.sel select option { background: var(--bg); color: var(--text); }
.section-title .sel { font-size: 15px; font-weight: 400; letter-spacing: 0; }
.section-title:has(.sel) { flex-wrap: wrap; align-items: center; }
.pill { font-size: 15px; font-weight: 500; padding: 8px 14px; border-radius: 10px; background: var(--bg2); color: var(--text2); white-space: nowrap; }
.pill.on { background: var(--accent-soft); color: var(--accent); }
.add-btn { background: var(--accent); color: var(--on-accent); border-radius: 10px; padding: 8px 16px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.search {
  width: 100%; font: inherit; font-size: 17px; padding: 10px 14px; border-radius: 10px;
  border: 0; background: var(--bg2); color: var(--text); outline: none;
}
.search::placeholder { color: var(--text3); }
.search.sm { flex: 1 1 200px; width: auto; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { padding: 7px 14px; border-radius: 999px; background: var(--bg2); font-size: 15px; font-weight: 500; white-space: nowrap; color: var(--text); }
.chips button.on { background: var(--text); color: var(--bg); }
.chips button .n { color: var(--text3); font-size: 13px; margin-left: 6px; font-weight: 400; }
.chips button.on .n { color: inherit; opacity: .6; }
.chips.filter button { display: inline-flex; align-items: center; gap: 7px; }
.chips.filter .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--s); }
.chips.filter button.on { background: var(--s-bg); color: var(--s); }
.chips.filter .clear { background: none; color: var(--accent); }

/* ---------- tasks ---------- */
.task { display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding: 12px 0; align-items: start; }
.check {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--text3); margin-top: 1px;
  display: grid; place-items: center; transition: background .12s, border-color .12s; flex-shrink: 0;
}
.check.on { background: var(--accent); border-color: var(--accent); }
.check.on::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--on-accent); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.task .title { font-weight: 400; overflow-wrap: anywhere; }
.task.done .title { text-decoration: line-through; color: var(--text3); }
.task .row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 3px; font-size: 14px; color: var(--text2); }
.task .due.late { color: var(--red); font-weight: 500; }
.task .due.soon { color: var(--orange); font-weight: 500; }
.task .more { margin-top: 8px; font-size: 15px; color: var(--text2); white-space: pre-wrap; }
.task .actions { display: flex; gap: 18px; margin-top: 10px; font-size: 15px; }
.task .actions > * { color: var(--accent); }
.task .actions .del { color: var(--red); }
.prio { font-size: 13px; font-weight: 600; white-space: nowrap; }
.prio.p1 { color: var(--orange); }
.prio.p2 { color: var(--red); }
details.group > summary { list-style: none; cursor: pointer; justify-content: flex-start; gap: 8px; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::after { content: "›"; font-weight: 400; color: var(--text3); transition: transform .15s; display: inline-block; }
details.group[open] > summary::after { transform: rotate(90deg); }

.tablewrap { overflow-x: auto; }
.dbtable, .gtable { width: 100%; border-collapse: collapse; font-size: 15px; }
.dbtable { table-layout: fixed; min-width: 660px; }
.dbtable th, .gtable th { text-align: left; font-size: 13px; font-weight: 500; color: var(--text3); padding: 8px 10px; border-bottom: .5px solid var(--sep); white-space: nowrap; }
.dbtable td, .gtable td { padding: 11px 10px; border-bottom: .5px solid var(--sep); vertical-align: top; }
.dbtable th .ti, .gtable th .ti { display: none; }
.dbtable th:nth-child(1) { width: 40px; }
.dbtable th:nth-child(3) { width: 160px; }
.dbtable th:nth-child(4) { width: 140px; }
.dbtable th:nth-child(5) { width: 100px; }
.dbtable th:nth-child(6) { width: 90px; }
.dbtable .ttitle { font-weight: 500; overflow-wrap: anywhere; }
.dbtable .done .ttitle { text-decoration: line-through; color: var(--text3); }
.dbtable .check { margin-top: 0; }
.gtable .num { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; margin-top: 12px; scrollbar-width: thin; }
.bcol { flex: 0 0 270px; background: var(--bg2); border-radius: var(--r-lg); padding: 12px; }
.bcol-head { display: flex; align-items: center; gap: 8px; padding: 0 2px 10px; font-size: 15px; font-weight: 600; }
.bcol-head .chip { font-size: 15px; color: var(--text); font-weight: 600; }
.bcol-head .n { color: var(--text3); font-weight: 400; }
.bcard { background: var(--elev); border-radius: var(--r); padding: 12px; margin-bottom: 8px; font-size: 15px; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.bcard .btitle { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; overflow-wrap: anywhere; }
.bcard.done .btitle span { text-decoration: line-through; color: var(--text3); }
.bcard .bprops { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0 0 32px; font-size: 13px; color: var(--text2); align-items: center; }

/* ---------- progress ---------- */
.ringrow { display: flex; align-items: center; gap: 18px; background: var(--bg2); border-radius: var(--r-lg); padding: 16px; }
.ring { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: var(--bg3); }
.ring .val { stroke: var(--green); stroke-linecap: round; }
.ring.low .val { stroke: var(--red); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ringrow .txt { font-size: 15px; color: var(--text2); }
.ringrow .txt strong { display: block; font-size: 17px; color: var(--text); margin-bottom: 2px; }
.att { padding: 14px 0; }
.att .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.att .head .chip { font-size: 17px; font-weight: 600; color: var(--text); }
.att .pct { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.att .pct.low { color: var(--red); }
.attgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; margin-top: 12px; font-size: 13px; color: var(--text3); }
.attgrid span { display: block; }
.attgrid span::first-letter { text-transform: uppercase; }
.attgrid b { display: block; font-size: 16px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.attgrid b.bad { color: var(--red); }
.avgrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.avg { display: flex; flex-direction: column; gap: 4px; padding: 14px; background: var(--bg2); border-radius: var(--r-lg); }
.avg b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gcourse { padding: 16px; margin-bottom: 10px; }
.gtask { display: flex; justify-content: space-between; gap: 12px; }
.gtask .main { font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.gtask .main .chip { display: block; margin-top: 4px; font-size: 14px; }
.gtask .main .chip::before { display: none; }
.gtask .items { font-size: 14px; color: var(--text2); margin-top: 2px; }
.gline { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; }
.gres { font-weight: 700; font-size: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gres .chip { margin-left: 6px; font-size: 14px; font-weight: 600; }
.gres .chip::before { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text3); margin: 14px 0; }
.legend b { color: var(--text2); font-weight: 600; }

/* ---------- materials ---------- */
details.mod > summary {
  padding: 12px 0; font-weight: 600; cursor: pointer; list-style: none; display: flex; gap: 10px; align-items: center;
  border-bottom: .5px solid var(--sep);
}
details.mod > summary::-webkit-details-marker { display: none; }
details.mod > summary::before { content: "›"; color: var(--text3); font-weight: 400; font-size: 20px; line-height: 1; width: 10px; transition: transform .15s; }
details.mod[open] > summary::before { transform: rotate(90deg); }
details.mod > summary > span:first-child { flex: 1; }
details.mod > summary .n { color: var(--text3); font-weight: 400; font-size: 15px; }
details.mod > div { padding-left: 20px; }
.topic { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; padding: 11px 0; align-items: center; border-bottom: .5px solid var(--sep); }
.list > .topic { border-bottom: 0; }
.topic .tmain { min-width: 0; overflow-wrap: anywhere; font-size: 16px; }
.topic .ico { font-size: 11px; font-weight: 700; text-align: center; text-transform: uppercase; color: var(--text3); letter-spacing: .03em; }
.ico.ty-pdf { color: var(--red); }
.ico.ty-slides { color: var(--bus); }
.ico.ty-docs { color: var(--math); }
.ico.ty-quiz { color: var(--eap); }
.ico.ty-video { color: var(--econ); }
.topic .path { font-size: 13px; color: var(--text3); margin-top: 1px; }
.topic .tdate { font-size: 13px; color: var(--text3); white-space: nowrap; }
[data-cls] { cursor: pointer; }

/* ---------- sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .32); }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 90vh; overflow: auto;
  background: var(--bg); border-radius: 18px 18px 0 0; box-shadow: var(--shadow);
  padding: 22px 20px calc(env(safe-area-inset-bottom) + 20px);
  max-width: 720px; margin: 0 auto; animation: up .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-body h2 { margin: 4px 0 16px; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.sheet-body .chip { font-size: 15px; }
.sheet .card { padding: 4px 16px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; color: var(--text2); margin: 0 0 6px 2px; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 17px; padding: 11px 14px; border-radius: 10px;
  border: 0; background: var(--bg2); color: var(--text); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { box-shadow: 0 0 0 2px var(--accent); }
.field textarea { min-height: 84px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { display: block; width: 100%; text-align: center; padding: 14px; border-radius: 12px; font-weight: 600; font-size: 17px; background: var(--accent); color: var(--on-accent); margin-top: 8px; }
.btn.secondary { background: var(--bg2); color: var(--text); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: .5px solid var(--sep); font-size: 16px; }
.kv:last-child { border-bottom: 0; }
.err { color: var(--red); font-size: 15px; }
.pin { max-width: 320px; margin: 12vh auto 0; text-align: center; }
.pin input { text-align: center; font-size: 28px; letter-spacing: .3em; }

@media (max-width: 899px) {
  .tasks-stats { display: none; }
  .controls .sel { flex: 1 1 140px; }
  .controls .sel select { flex: 1; min-width: 0; }
}

/* ---------- results ---------- */
.res-card { background: var(--bg2); border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px; }
.res-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.res-title { font-weight: 600; font-size: 17px; margin-top: 6px; }
.res-score { text-align: right; white-space: nowrap; }
.res-score b { display: block; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.res-score b small { font-size: 16px; color: var(--text2); font-weight: 600; }
.res-score span { font-size: 15px; color: var(--text2); font-weight: 600; }
.good { color: var(--green); } .mid { color: var(--orange); } .low { color: var(--red); }
.res-score b.good, .res-score b.mid, .res-score b.low { color: var(--text); }
.rubric { margin-top: 14px; display: grid; gap: 8px; }
.crit { display: grid; grid-template-columns: minmax(0, 1fr) 90px 56px; gap: 10px; align-items: center; font-size: 14px; }
.crit .cn { overflow-wrap: anywhere; color: var(--text); }
.crit .cbar { height: 6px; border-radius: 3px; background: var(--bg3); overflow: hidden; }
.crit .cbar i { display: block; height: 100%; background: var(--s); border-radius: 3px; }
.crit .cs { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text2); }
.crit.na { opacity: .45; }
.res-link { display: inline-block; margin-top: 12px; font-size: 15px; color: var(--accent); }
.quiz-row { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; padding: 12px 0; cursor: pointer; }
.quiz-row .qmain { min-width: 0; flex: 1; }
.quiz-row .title { font-weight: 500; overflow-wrap: anywhere; }
.quiz-row .row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 3px; }
.qscore { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 2px; }
.pend-txt { font-size: 13px; font-weight: 600; color: var(--orange); }
.trail { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; }
.trail i { font-style: normal; font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--bg2); font-variant-numeric: tabular-nums; }
.trail i.good { background: color-mix(in srgb, var(--green) 14%, transparent); }
.trail i.mid { background: color-mix(in srgb, var(--orange) 14%, transparent); }
.trail i.low { background: color-mix(in srgb, var(--red) 14%, transparent); }
.trail i.pend { color: var(--text3); }
.trail .arr { color: var(--text3); font-size: 13px; }
.attempts { margin-top: 10px; }
.attempts .kv { font-size: 15px; padding: 8px 0; }

/* ---------- own events: colours ---------- */
:root { --pink: #e0457b; --pink-bg: #fdeaf1; }
:root[data-theme="dark"] { --pink: #ff7aa8; --pink-bg: rgba(255, 122, 168, .15); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --pink: #ff7aa8; --pink-bg: rgba(255, 122, 168, .15); } }
.c-blue   { --s: var(--math);  --s-bg: var(--math-bg); }
.c-green  { --s: var(--econ);  --s-bg: var(--econ-bg); }
.c-orange { --s: var(--bus);   --s-bg: var(--bus-bg); }
.c-purple { --s: var(--eap);   --s-bg: var(--eap-bg); }
.c-pink   { --s: var(--pink);  --s-bg: var(--pink-bg); }
.c-gray   { --s: var(--other); --s-bg: var(--other-bg); }
.cls.own .stripe { border-radius: 2px; background: repeating-linear-gradient(var(--s) 0 6px, transparent 6px 9px); }
.cls.own { cursor: pointer; }
.swatches { display: flex; gap: 10px; }
.swatches .sw { width: 32px; height: 32px; border-radius: 50%; background: var(--s); box-shadow: inset 0 0 0 2px var(--bg); }
.swatches .sw.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--s); }
.day-add { margin-left: auto; width: 28px; height: 28px; border-radius: 50%; background: var(--bg2); color: var(--accent); font-size: 18px; font-weight: 500; line-height: 1; }
.link-btn { color: var(--accent); font-size: 16px; margin-left: 6px; }
.opt-list.qa button { display: flex; flex-direction: column; gap: 2px; }
.opt-list.qa button span { font-size: 14px; color: var(--text2); }

/* ---------- quick-add button (phone) ---------- */
.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px); z-index: 7;
  width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: none; place-items: center; box-shadow: 0 6px 20px rgba(47, 107, 237, .35);
}
.fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.fab:active { transform: scale(.95); }
body[data-tab="today"] .fab, body[data-tab="week"] .fab, body[data-tab="tasks"] .fab { display: grid; }
body.auth .fab { display: none !important; }
@media (min-width: 900px) { .fab { display: none !important; } }

/* ---------- phone simplification ---------- */
.phone-bar { display: flex; align-items: center; gap: 10px; margin: 4px 0 6px; }
.phone-bar .search { flex: 1; min-width: 0; }
.phone-bar .seg { flex: 1; }
.phone-bar .grow { flex: 1; }
.icon-btn.filt { width: 42px; height: 42px; border-radius: 12px; background: var(--bg2); color: var(--text); flex-shrink: 0; position: relative; }
.icon-btn.filt svg { width: 20px; height: 20px; }
.icon-btn.filt.on::after { content: ""; position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg2); }
.fsheet { display: grid; gap: 4px; margin-bottom: 8px; }
.fsec { margin: 8px 0 4px; }
.fsec > span { display: block; font-size: 14px; color: var(--text2); margin: 0 0 8px 2px; }
.fsheet .controls { margin: 8px 0 0; }
.fsheet .chips { flex-wrap: wrap; overflow: visible; padding-top: 0; }
.sumline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 15px; color: var(--text2); margin: 6px 2px 4px; }
.sumline b { color: var(--text); font-weight: 600; }
.sumline i { font-style: normal; color: var(--text3); }
.quick-links { display: grid; margin-top: 26px; border-top: .5px solid var(--sep); }
.qlink { display: flex; justify-content: space-between; align-items: center; padding: 14px 2px; border-bottom: .5px solid var(--sep); font-size: 16px; }
.qlink span { color: var(--text2); }
.qlink b { font-weight: 600; }
.qlink b::after { content: "›"; color: var(--text3); font-weight: 400; margin-left: 10px; }
.menu-item .menu-st { margin-left: auto; font-size: 13px; color: var(--text3); }
.menu-st.st-bad, .menu-st.st-warn { color: var(--orange); }
#topAvatar { position: relative; }
#topAvatar::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px var(--bg); }
#topAvatar[data-st="warn"]::after, #topAvatar[data-st="busy"]::after { background: var(--orange); }
#topAvatar[data-st="bad"]::after { background: var(--red); }
.top-title { display: none; }
@media (max-width: 899px) {
  #statusBtn { display: none; }
  .top { justify-content: flex-end; transition: box-shadow .2s; }
  .top-title { display: block; position: absolute; left: 60px; right: 60px; bottom: 11px; text-align: center; font-size: 17px; font-weight: 600;
    opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.scrolled .top-title { opacity: 1; transform: none; }
  body.scrolled .top { box-shadow: 0 .5px 0 var(--sep); }
  .page-head h1 { font-size: 32px; }
  .add-btn, .day-add { display: none; }
  .view { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 96px); }
  .wgrid.single { margin-top: 4px; }
  .weeknav { gap: 8px; }
  .weeknav .lbl { flex: 1; }
  .weeknav .icon-btn.filt { width: 40px; height: 40px; border-radius: 50%; }
  .section-title { margin-top: 28px; }
}

/* ---------- assessments ---------- */
.res-card.up { border-left: 4px solid var(--s); }
.up-date { font-size: 15px; color: var(--text2); margin-top: 2px; }
.up-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; padding: 8px 0 0; }
.up-row span { color: var(--text2); }
.up-row b { font-weight: 600; text-align: right; }
.tl-fa { text-align: left; width: 100%; background: color-mix(in srgb, var(--red) 8%, var(--bg)); border-radius: var(--r); padding: 10px 14px; }
.tl-fa .title { font-weight: 600; }
.tl-fa .meta { font-size: 14px; color: var(--text2); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }

/* ---------- study groups ---------- */
.groups { display: grid; gap: 10px; }
.grp-card { background: var(--bg2); border-radius: var(--r-lg); padding: 14px 16px; }
.grp-head { display: flex; align-items: center; gap: 10px; }
.grp-head b { font-size: 17px; }
.grp-head .sub { margin-right: auto; }
.grp-members { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mchip { display: inline-flex; align-items: center; gap: 4px; background: var(--elev); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 14px; }
.mchip button { width: 22px; height: 22px; border-radius: 50%; color: var(--text3); font-size: 16px; line-height: 1; }
.mchip button:hover { background: var(--bg3); color: var(--red); }
.form-card .mchip { padding-right: 12px; }
.grp-add { margin-top: 10px; width: 100%; font: inherit; font-size: 15px; padding: 9px 12px; border-radius: 10px; border: 0; background: var(--elev); color: var(--text); }
.grp-new { display: flex; gap: 8px; }
.grp-new input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 10px 14px; border-radius: 10px; border: 0; background: var(--bg2); color: var(--text); }
.tag.grp { color: var(--accent); }
.share-row { background: var(--accent-soft); border-radius: var(--r); padding: 12px 14px; }
.share-row b { color: var(--text); font-weight: 600; }

/* ---------- layout helpers ---------- */
.dash > .col > :first-child, .blk > :first-child { margin-top: 18px; }
/* ---------- timetable grid (desktop week, phone day view) ---------- */
.wgrid { display: none; grid-template-columns: 56px repeat(var(--days), minmax(0, 1fr)); margin-top: 16px; user-select: none; -webkit-user-select: none; }
.wgrid.single { display: grid; grid-template-columns: 46px minmax(0, 1fr); margin-top: 8px; }
.wgrid.single .whead { display: none; }
.wgrid.single .corner { display: none; }
.wgrid .whead { padding: 6px 8px 12px; text-align: center; min-height: 74px; }
.wgrid .whead .wd { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--text3); letter-spacing: .03em; }
.wgrid .whead .dn { width: 36px; height: 36px; margin: 2px auto; border-radius: 50%; display: grid; place-items: center; font-size: 19px; font-weight: 600; }
.wgrid .whead.today .dn { background: var(--accent); color: var(--on-accent); }
.wgrid .whead small { display: none; }
.wgrid .wdl { display: block; margin-top: 4px; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--red); }
.wgrid .corner { }
.wgrid .hours { position: relative; }
.wgrid .hours span { position: absolute; right: 10px; transform: translateY(-50%); font-size: 12px; color: var(--text3); font-variant-numeric: tabular-nums; }
.wgrid .dcol { position: relative; border-left: .5px solid var(--sep); background-image: linear-gradient(var(--sep) .5px, transparent .5px); background-size: 100% var(--hour); }
.wgrid .ev { position: absolute; left: 4px; right: 4px; border-radius: 10px; padding: 7px 10px; overflow: hidden; background: var(--s-bg); border-left: 3px solid var(--s); font-size: 13px; line-height: 1.3; }
.wgrid .ev b { display: block; font-size: 14px; font-weight: 600; }
.wgrid .ev span { display: block; color: var(--text2); font-size: 12.5px; }
.wgrid .ev.past { opacity: .5; }
.wgrid .nowline { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 2; }
.wgrid .nowline::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.wgrid .dcol { cursor: copy; }
.wgrid .ev { cursor: pointer; z-index: 1; }
.wgrid .ev.own { border-left-width: 4px; touch-action: none; -webkit-touch-callout: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.wgrid .ev.own b { color: var(--text); }
.wgrid .ev-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 10px; cursor: ns-resize; }
.wgrid .ev-resize::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 24px; height: 3px; margin-left: -12px; border-radius: 2px; background: var(--s); opacity: .45; }
.wgrid .ev.dragging { z-index: 5; opacity: .92; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); transition: none; cursor: grabbing; }
.grid-hint { display: none; }

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  :root { --side-w: 248px; }
  body { font-size: 16px; }
  .tabs {
    top: 0; right: auto; bottom: 0; width: var(--side-w); height: auto;
    display: flex; flex-direction: column; gap: 2px; padding: 14px 12px;
    background: var(--bg2); border-top: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 6px 10px 18px; }
  .brand img { width: 28px; height: 28px; border-radius: 7px; }
  .side-label { display: block; font-size: 12px; font-weight: 600; color: var(--text3); padding: 6px 12px; text-transform: uppercase; letter-spacing: .04em; }
  .tabs button { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; font-weight: 500; padding: 9px 12px; border-radius: 9px; color: var(--text2); }
  .tabs svg { width: 20px; height: 20px; }
  .tabs button:hover { background: var(--bg3); color: var(--text); }
  .tabs button.active { background: var(--elev); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
  .tabs button.active svg { color: var(--accent); }
  .kbd-hint { display: block; margin-top: auto; padding: 10px 12px; font-size: 12px; color: var(--text3); line-height: 2; }
  kbd { font: 11px ui-monospace, SFMono-Regular, monospace; background: var(--bg); border-radius: 4px; padding: 1px 5px; color: var(--text2); box-shadow: 0 1px 0 var(--sep); }

  .top { margin-left: var(--side-w); padding: 0 24px; justify-content: space-between; }
  .crumbs { display: flex; gap: 8px; font-size: 14px; color: var(--text3); }
  #crumbTitle { color: var(--text2); }
  .page-head, .view { margin-left: calc(var(--side-w) + max(0px, (100vw - var(--side-w) - 1120px) / 2)); max-width: 1120px; margin-right: auto; }
  .page-head { padding: 18px 48px 6px; }
  .page-head h1 { font-size: 36px; }
  .view { padding: 6px 48px 64px; }

  .dash { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 48px; align-items: start; }
  .cols2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 0 40px; align-items: start; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .tl-card:hover { filter: brightness(.98); }
  .strip { max-width: 520px; }
  .toolbar .seg { max-width: 380px; }

  .wlist { display: none; }
  .wgrid.full { display: grid; }
  .grid-hint { display: block; margin: 14px 0 0; }
  .mobile-only { display: none !important; }

  .mat { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; }
  .mat-side { position: sticky; top: 60px; }
  .mat .chips { flex-direction: column; overflow: visible; gap: 2px; }
  .mat .chips button { text-align: left; border-radius: 9px; background: none; padding: 9px 12px; display: flex; justify-content: space-between; }
  .mat .chips button:hover { background: var(--bg2); }
  .mat .chips button.on { background: var(--bg2); color: var(--text); font-weight: 600; }
  .mat #mres > :first-child { margin-top: 0; }

  .sheet-body { top: 10vh; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); width: 560px; border-radius: 18px; padding: 28px; max-height: 80vh; animation: pop .16s ease-out; }
  @keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }
}

/* ---------- account: avatar, user menu ---------- */
.top-actions { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #5b8cff, #8155e8); letter-spacing: 0;
}
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }
.userbtn { display: none; }
.menu { position: fixed; inset: 0; z-index: 30; }
.menu-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .25); }
.menu-panel {
  position: absolute; left: 8px; right: 8px; bottom: calc(env(safe-area-inset-bottom) + 8px);
  background: var(--elev); border-radius: 18px; box-shadow: var(--shadow); padding: 8px; animation: up .2s cubic-bezier(.2, .8, .2, 1);
}
.menu-head { display: flex; gap: 12px; align-items: center; padding: 10px 10px 12px; border-bottom: .5px solid var(--sep); margin-bottom: 6px; }
.menu-head b { display: block; font-size: 16px; }
.menu-head span { font-size: 14px; color: var(--text2); }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 10px; border-radius: 10px; font-size: 16px; text-align: left; }
.menu-item:hover { background: var(--bg2); }
.menu-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--text2); }
.menu-item.danger, .menu-item.danger svg { color: var(--red); }
.menu-row { padding: 8px 10px; }
.menu-row > span { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.menu-sep { height: .5px; background: var(--sep); margin: 6px 0; }

/* ---------- auth screen ---------- */
body.auth .tabs, body.auth .top, body.auth .page-head { display: none; }
body.auth .view { padding-top: max(8vh, env(safe-area-inset-top)); max-width: 420px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin-bottom: 28px; }
.auth-brand img { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 6px 20px rgba(47, 107, 237, .25); }
.auth-brand h1 { margin: 6px 0 0; font-size: 30px; letter-spacing: -0.02em; }
.auth-brand p { margin: 0; color: var(--text2); font-size: 16px; max-width: 320px; }
.unofficial { font-size: 12.5px; color: var(--text3); text-align: center; margin: 20px auto 0; max-width: 340px; line-height: 1.45; }
.auth-foot { display: flex; justify-content: center; gap: 16px; margin-top: 22px; font-size: 14px; color: var(--text3); }
.auth-foot button { color: var(--text2); }
.auth-foot button.on { color: var(--accent); font-weight: 600; }
.note { font-size: 14px; color: var(--text2); background: var(--bg2); border-radius: var(--r); padding: 12px 14px; margin: 4px 0 14px; line-height: 1.45; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--text2); margin: 4px 0 12px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }

/* connect flow */
.connect-state { text-align: center; padding: 18px 0 6px; }
.connect-state .big-num { font-size: 56px; font-weight: 700; letter-spacing: .04em; margin: 10px 0; font-variant-numeric: tabular-nums; }
.connect-state p { color: var(--text2); margin: 6px 0; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--bg3); border-top-color: var(--accent); margin: 8px auto 14px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ok-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--green); margin: 4px auto 12px; display: grid; place-items: center; }
.ok-mark::after { content: ""; width: 22px; height: 11px; border: 3px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(2px, -2px); }
.opt-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.opt-list button { background: var(--bg2); border-radius: var(--r); padding: 13px 14px; text-align: left; font-size: 16px; }

/* setup / connection cards */
.setup { display: grid; gap: 12px; margin-top: 12px; }
.conn { display: flex; align-items: center; gap: 14px; background: var(--bg2); border-radius: var(--r-lg); padding: 14px 16px; }
.conn .logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff; flex-shrink: 0; }
.conn .logo.compass { background: #1d4ed8; }
.conn .logo.d2l { background: #e8590c; }
.conn .info { flex: 1; min-width: 0; }
.conn .info b { display: block; font-size: 17px; }
.conn .info span { font-size: 14px; color: var(--text2); }
.conn .info span.bad { color: var(--red); }
.conn .info span.good { color: var(--green); }
.conn .act { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 560px) {
  .conn { flex-wrap: wrap; }
  .conn .info { flex: 1 1 calc(100% - 60px); }
  .conn .act { width: 100%; padding-left: 58px; }
}
.btn-sm { font-size: 15px; font-weight: 600; padding: 8px 14px; border-radius: 10px; background: var(--accent); color: var(--on-accent); white-space: nowrap; }
.btn-sm.ghost { background: var(--elev); color: var(--text); box-shadow: inset 0 0 0 1px var(--sep); }
.btn-sm.danger { background: none; color: var(--red); padding: 8px 6px; }

/* profile */
.prof-head { display: flex; align-items: center; gap: 16px; margin: 6px 0 4px; }
.prof-head b { display: block; font-size: 22px; }
.prof-head span { color: var(--text2); }
.form-card { background: var(--bg2); border-radius: var(--r-lg); padding: 16px; }
.form-card .field input { background: var(--elev); }
.steps { margin: 0; padding-left: 20px; color: var(--text2); font-size: 15px; line-height: 1.7; }
.steps b { color: var(--text); }

/* admin */
.admin-users { width: 100%; border-collapse: collapse; font-size: 15px; }
.admin-users th { text-align: left; font-size: 13px; font-weight: 500; color: var(--text3); padding: 8px 10px; border-bottom: .5px solid var(--sep); white-space: nowrap; }
.admin-users td { padding: 12px 10px; border-bottom: .5px solid var(--sep); vertical-align: middle; }
.admin-users .who b { display: block; }
.admin-users .who span { font-size: 13px; color: var(--text2); }
.pillst { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.pillst::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text3); }
.pillst.ok::before { background: var(--green); }
.pillst.login::before, .pillst.error::before { background: var(--red); }
.pillst.connecting::before { background: var(--orange); }
.role { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--bg2); color: var(--text2); }
.role.admin { background: var(--accent-soft); color: var(--accent); }
.role.off { background: var(--red-soft); color: var(--red); }
.events { font-size: 14px; }
.events .ev { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 8px 0; border-bottom: .5px solid var(--sep); }
.events .ev time { color: var(--text3); font-variant-numeric: tabular-nums; }
.events .ev .k { font-weight: 600; }
.events .ev .m { color: var(--text2); overflow-wrap: anywhere; }
.toggle { position: relative; width: 50px; height: 30px; border-radius: 999px; background: var(--bg3); transition: background .15s; flex-shrink: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .15s; }
.toggle.on { background: var(--green); }
.toggle.on::after { transform: translateX(20px); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--bg2); border-radius: var(--r-lg); padding: 14px 16px; }
.setting-row b { display: block; }
.setting-row span { font-size: 14px; color: var(--text2); }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center; color: var(--text2); }
.icon-btn:hover { background: var(--bg2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 900px) {
  #topAvatar { display: none; }
  .tabs .userbtn {
    display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 8px 10px; border-radius: 10px; text-align: left; width: 100%;
  }
  .userbtn:hover { background: var(--bg3); }
  .userbtn .uinfo { flex: 1; min-width: 0; }
  .userbtn .uinfo b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .userbtn .uinfo span { display: block; font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .userbtn svg { width: 16px; height: 16px; fill: none; stroke: var(--text3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .menu-backdrop { background: transparent; }
  .menu-panel { left: 12px; right: auto; bottom: 70px; width: 300px; border-radius: 14px; animation: pop2 .14s ease-out; }
  @keyframes pop2 { from { opacity: 0; transform: translateY(6px); } }
  body.auth .view { margin-left: auto; margin-right: auto; padding-top: 10vh; }
}
