/* ==========================================================================
   umarkin's personal zettelkasten — design system
   Dark only. Three themes via <html data-theme="work|uni|notes">.
   ========================================================================== */

:root {
  --bg: #1b1b1c;
  --s1: #212122;
  --s2: #282829;
  --s3: #303031;
  --line: #2e2e30;
  --line-2: #3a3a3d;
  --tx: #eeeff0;
  --tx-2: #bcbcbc;
  --tx-3: #7c7c80;
  --accent: #c42a4a;
  --accent-ink: #fff;
  --ok: #3ecf8e;
  --warn: #f0b344;
  --bad: #ef6b6b;
  --violet: #8b7cf6;
  --blue: #5b8def;

  --r-ctl: 8px;
  --r-panel: 12px;
  --ui: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "EB Garamond", Georgia, serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --sidebar: 232px;
}

html[data-theme="uni"] {
  --bg: #0b1a33;
  --s1: #10213d;
  --s2: #162a48;
  --s3: #1d3454;
  --line: #1c3352;
  --line-2: #274468;
  --accent: #2cc48a;
  --accent-ink: #06231a;
}

html[data-theme="notes"] {
  --bg: #1e1e1e;
  --s1: #222222;
  --s2: #262626;
  --s3: #2c2c2c;
  --line: #2f2f2f;
  --line-2: #3a3a3a;
  --accent: #8b7cf6;
  --accent-ink: #fff;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
a { color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

.num, .tnum, table td.n, .stat-v {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--line-2);
  background: var(--s2);
  color: var(--tx);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--s3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--tx-2); }
.btn.ghost:hover { background: var(--s2); color: var(--tx); }
.btn.danger { color: var(--bad); border-color: transparent; background: transparent; }
.btn.danger:hover { background: rgba(239, 107, 107, .12); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.icon { padding: 5px 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

input, select, textarea {
  font: inherit;
  color: var(--tx);
  background: var(--s1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  padding: 8px 10px;
  width: 100%;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
textarea { resize: vertical; line-height: 1.6; }
label.f { display: block; margin-bottom: 10px; }
label.f > span { display: block; font-size: 12px; color: var(--tx-3); margin-bottom: 4px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }

.seg {
  display: inline-flex; background: var(--s1); border: 1px solid var(--line);
  border-radius: var(--r-ctl); padding: 2px; gap: 2px;
}
.seg button {
  font: inherit; font-size: 12.5px; font-weight: 500;
  border: 0; background: transparent; color: var(--tx-3);
  padding: 5px 11px; border-radius: 6px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--s3); color: var(--tx); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500;
  padding: 2px 8px; border-radius: 999px;
  background: var(--s3); color: var(--tx-2);
  border: 1px solid var(--line-2);
  white-space: nowrap;
}
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.pill.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- panels / layout ---------- */
.panel {
  background: var(--s1);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow: hidden;
}
.panel > header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.panel > header h3 { font-size: 13.5px; }
.panel > header .sub { font-size: 12px; color: var(--tx-3); }
.panel .body { padding: 14px; }
.panel .body.flush { padding: 0; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g-side { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 1100px) { .g-side, .g3, .g4, .g2 { grid-template-columns: 1fr; } }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat {
  background: var(--s1); border: 1px solid var(--line);
  border-radius: var(--r-panel); padding: 13px 14px;
}
.stat .stat-v { font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
.stat .stat-l { font-size: 11.5px; color: var(--tx-3); margin-top: 3px; text-transform: uppercase; letter-spacing: .06em; }
.stat .delta { font-size: 12px; margin-top: 5px; font-family: var(--mono); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--tx-3); }

.empty {
  border: 1px dashed var(--line-2);
  border-radius: var(--r-panel);
  padding: 22px;
  text-align: center;
  color: var(--tx-3);
  font-size: 13px;
}
.empty strong { display: block; color: var(--tx-2); font-weight: 600; margin-bottom: 4px; }

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: default;
}
.list-row:last-child { border-bottom: 0; }
.list-row.click { cursor: pointer; }
.list-row.click:hover { background: var(--s2); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-size: 13.5px; }
.list-row .m { font-size: 12px; color: var(--tx-3); }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bar { height: 6px; background: var(--s3); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.ok > i { background: var(--ok); }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  position: sticky; top: 0; z-index: 2;
  background: var(--s2); color: var(--tx-3);
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  text-align: left; font-weight: 600;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--s2); }
table.data td.n, table.data th.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }
.scroll-y { overflow-y: auto; max-height: 460px; }

.chart-wrap { position: relative; height: 260px; }
.chart-wrap.tall { height: 320px; }

.findings { display: flex; flex-direction: column; gap: 8px; }
.finding {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 13px; color: var(--tx-2);
  padding: 9px 11px; background: var(--s2); border-radius: var(--r-ctl);
  border-left: 3px solid var(--line-2);
}
.finding.good { border-left-color: var(--ok); }
.finding.warn { border-left-color: var(--warn); }
.finding.bad { border-left-color: var(--bad); }
.finding b { color: var(--tx); font-weight: 600; }

/* ---------- shell ---------- */
#app { min-height: 100%; }
.shell { display: flex; min-height: 100vh; }
.side {
  width: var(--sidebar); flex: 0 0 var(--sidebar);
  border-right: 1px solid var(--line);
  background: var(--s1);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side .top { padding: 12px; border-bottom: 1px solid var(--line); }
.side .seg { width: 100%; }
.side .seg button { flex: 1; }
.side nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.navgroup { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--tx-3); padding: 12px 10px 6px; }
.navlink {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--r-ctl);
  color: var(--tx-2); text-decoration: none; font-size: 13.5px;
  cursor: pointer;
}
.navlink:hover { background: var(--s2); color: var(--tx); }
.navlink[aria-current="page"] { background: var(--s3); color: var(--tx); font-weight: 500; }
.navlink .ico { width: 16px; text-align: center; opacity: .8; font-size: 13px; }
.navlink .badge { margin-left: auto; font-size: 11px; color: var(--tx-3); font-family: var(--mono); }
.side .foot { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px 0;
}
.topbar h1 { font-size: 20px; }
.topbar .spacer { flex: 1; }
.page { padding: 18px 24px 60px; display: flex; flex-direction: column; gap: 14px; }
.page.wide { max-width: none; }
.crumb { font-size: 12px; color: var(--tx-3); }
.mobilebar { display: none; }

@media (max-width: 900px) {
  .side { display: none; }
  .page { padding: 14px 14px 84px; }
  .topbar { padding: 12px 14px 0; flex-wrap: wrap; }
  .topbar h1 { font-size: 19px; }
  .topbar .spacer { display: none; }
  .topbar > .wrap { width: 100%; }
  .mobilebar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: var(--s1); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .mobilebar a {
    flex: 1; text-align: center; text-decoration: none; color: var(--tx-3);
    font-size: 10.5px; padding: 5px 2px; border-radius: var(--r-ctl);
  }
  .mobilebar a .ico { display: block; font-size: 16px; margin-bottom: 1px; }
  .mobilebar a[aria-current="page"] { color: var(--accent); }
  .stats { grid-template-columns: 1fr 1fr; }
}

/* ---------- login ---------- */
.login { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.login .brand {
  position: relative; overflow: hidden;
  background: #8a1a29; color: #f7e9df;
  padding: 34px 38px; display: flex; flex-direction: column;
}
.login .brand .grain {
  position: absolute; inset: 0; opacity: .32; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='240' height='240' filter='url(%23n)' opacity='0.55'/></svg>");
  mix-blend-mode: overlay;
}
.login .brand > * { position: relative; z-index: 1; }
.login .logos { display: flex; align-items: center; gap: 14px; }
.login .logos .logo {
  height: 38px; display: flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase; opacity: .92;
}
.login .logos .logo svg { height: 34px; width: 34px; }
.login .art { flex: 1; display: flex; align-items: center; justify-content: center; padding: 18px 0; }
.login .art svg { width: 100%; max-width: 560px; height: auto; }
.login h1.title { font-family: var(--serif); font-weight: 500; font-size: 44px; line-height: 1.05; letter-spacing: -0.01em; }
.login .tagline { font-family: var(--serif); font-style: italic; font-size: 17px; opacity: .8; margin-top: 8px; }
.login .today { font-family: var(--mono); font-size: 12px; opacity: .7; margin-top: 22px; letter-spacing: .04em; }
.login .form-side { display: flex; align-items: center; justify-content: center; padding: 30px; background: var(--bg); }
.login .form { width: 100%; max-width: 330px; }
.login .form h2 { font-size: 24px; margin-bottom: 6px; }
.login .form p.hint { color: var(--tx-3); font-size: 13px; margin: 0 0 20px; }
.login .pw { position: relative; }
.login .pw input { padding-right: 62px; }
.login .pw button {
  position: absolute; right: 5px; top: 5px; bottom: 5px;
  border: 0; background: transparent; color: var(--tx-3); font: inherit; font-size: 12px; cursor: pointer; padding: 0 8px;
}
.login .err { color: var(--bad); font-size: 12.5px; min-height: 18px; margin-top: 8px; }
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login .brand > div:last-child { margin-top: 4px; }
  .login .today { margin-top: 10px; }
  .login .brand { padding: 20px; }
  .login .art { display: none; }
  .login h1.title { font-size: 30px; }
  .login .form-side { padding: 26px 20px 50px; }
}

/* ---------- kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .kanban { grid-template-columns: 1fr; } }
.kcol { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-panel); }
.kcol > header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.kcol > header h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--tx-3); }
.kcol .cards { padding: 10px; display: flex; flex-direction: column; gap: 9px; min-height: 60px; }
.kcard {
  background: var(--s2); border: 1px solid var(--line-2); border-radius: var(--r-ctl);
  padding: 10px 11px; cursor: pointer;
}
.kcard:hover { border-color: var(--accent); }
.kcard .kt { font-size: 13.5px; font-weight: 500; }
.kcard .kmeta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; align-items: center; }
.kcard .next { font-size: 12px; color: var(--tx-3); margin-top: 5px; }
.kcard .kbtns { display: flex; gap: 4px; margin-top: 8px; }

/* ---------- teacher journal ---------- */
.entry { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry .body { flex: 1; min-width: 0; white-space: pre-wrap; font-size: 13.5px; }
.entry .del { opacity: 0; }
.entry:hover .del { opacity: 1; }
.daygroup { padding: 12px 14px; }
.daygroup > h4 { font-size: 11.5px; color: var(--tx-3); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; }
.done-text { text-decoration: line-through; color: var(--tx-3); }

/* ---------- timetable ---------- */
.tt { display: grid; grid-template-columns: 56px repeat(6, 1fr); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; background: var(--s1); }
.tt .hd { padding: 8px 6px; text-align: center; font-size: 12px; color: var(--tx-2); background: var(--s2); border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.tt .hd.corner { border-left: 0; }
.tt .col { position: relative; border-left: 1px solid var(--line); }
.tt .hours { position: relative; }
.tt .hourline { height: 52px; border-bottom: 1px solid var(--line); }
.tt .hourlab { height: 52px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--tx-3); text-align: right; padding: 2px 6px 0 0; font-family: var(--mono); }
.ttblock {
  position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 4px 6px;
  font-size: 11.5px; overflow: hidden; cursor: pointer; color: #fff;
  border-left: 3px solid rgba(255,255,255,.55);
}
.ttblock b { display: block; font-weight: 600; font-size: 12px; }
.type-lecture { background: color-mix(in srgb, var(--accent) 62%, #000); }
.type-tutorial { background: color-mix(in srgb, var(--warn) 55%, #000); }
.type-lab { background: color-mix(in srgb, var(--blue) 60%, #000); }
.type-seminar { background: color-mix(in srgb, var(--violet) 58%, #000); }
.type-other { background: var(--s3); }

/* ---------- notes ---------- */
.vault { display: grid; grid-template-columns: 250px 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .vault { grid-template-columns: 1fr; } }
.tree { font-size: 13px; }
.tree .fold, .tree .file {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; cursor: pointer; color: var(--tx-2);
}
.tree .fold:hover, .tree .file:hover { background: var(--s2); color: var(--tx); }
.tree .file[aria-current="page"] { background: var(--s3); color: var(--tx); }
.tree .fold { color: var(--tx-3); font-size: 12.5px; }
.writer { max-width: 68ch; margin: 0 auto; padding: 8px 0 60px; }
.writer .wtitle {
  width: 100%; background: transparent; border: 0; padding: 0; font-size: 30px; font-weight: 600;
  color: var(--tx); letter-spacing: -0.02em; margin-bottom: 6px;
}
.writer .wtitle:focus { box-shadow: none; }
.writer .wtags { width: 100%; background: transparent; border: 0; padding: 0; font-family: var(--mono); font-size: 12px; color: var(--tx-3); margin-bottom: 16px; }
.writer .wtags:focus { box-shadow: none; color: var(--tx-2); }
.writer .wbody {
  width: 100%; background: transparent; border: 0; padding: 0; resize: none;
  font-size: 17px; line-height: 1.75; color: var(--tx-2); min-height: 50vh; font-family: var(--ui);
}
.writer .wbody:focus { box-shadow: none; }
.writer .wctl { opacity: .35; transition: opacity .18s; display: flex; align-items: center; gap: 8px; }
.writer:hover .wctl, .writer .wctl:focus-within { opacity: 1; }
.writer .wfoot { margin-top: 26px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--tx-3); font-size: 12px; font-family: var(--mono); display: flex; gap: 14px; flex-wrap: wrap; }
.read { font-size: 17px; line-height: 1.75; color: var(--tx-2); }
.read h1, .read h2, .read h3 { color: var(--tx); margin: 1.4em 0 .5em; }
.read h1 { font-size: 26px; } .read h2 { font-size: 21px; } .read h3 { font-size: 17px; }
.read code { font-family: var(--mono); font-size: .88em; background: var(--s2); padding: 1px 5px; border-radius: 5px; }
.read pre { background: var(--s2); padding: 12px 14px; border-radius: var(--r-ctl); overflow-x: auto; }
.read pre code { background: transparent; padding: 0; }
.read blockquote { margin: 1em 0; padding-left: 14px; border-left: 3px solid var(--line-2); color: var(--tx-3); }
.read a { color: var(--accent); text-decoration: none; }
.read table { border-collapse: collapse; } .read td, .read th { border: 1px solid var(--line-2); padding: 5px 9px; }
.wl { color: var(--accent); text-decoration: none; cursor: pointer; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.wl.missing { color: var(--tx-3); border-bottom-style: dashed; }
body.zen .side, body.zen .topbar, body.zen .mobilebar { display: none; }
body.zen .page { padding-top: 30px; }
.exwrap { height: min(78vh, 820px); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.exwrap.full { position: fixed; inset: 0; z-index: 90; border-radius: 0; height: 100vh; }

/* ---------- calendar ---------- */
.cal { border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--s1); overflow: hidden; }
.cal .cal-head { display: grid; position: sticky; top: 0; z-index: 5; background: var(--s2); border-bottom: 1px solid var(--line); }
.cal .cal-head .d { padding: 7px 8px; text-align: center; font-size: 12px; border-left: 1px solid var(--line); }
.cal .cal-head .d .dn { font-size: 17px; font-family: var(--mono); }
.cal .cal-head .d.today .dn { color: var(--accent); font-weight: 600; }
.cal .allday { display: grid; border-bottom: 1px solid var(--line); background: var(--s1); min-height: 26px; }
.cal .allday .cell { border-left: 1px solid var(--line); padding: 3px; display: flex; flex-direction: column; gap: 3px; }
.cal .gridwrap { max-height: 62vh; overflow-y: auto; position: relative; }
.cal .grid-body { display: grid; position: relative; }
.cal .gutter { border-right: 1px solid var(--line); }
.cal .gutter .h { height: 46px; font-size: 10.5px; color: var(--tx-3); text-align: right; padding-right: 6px; font-family: var(--mono); }
.cal .daycol { position: relative; border-left: 1px solid var(--line); }
.cal .daycol.today { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.cal .hr { height: 46px; border-bottom: 1px solid var(--line); }
.cal .ev {
  position: absolute; border-radius: 5px; padding: 2px 5px; font-size: 11px; color: #fff;
  overflow: hidden; cursor: pointer; border-left: 3px solid rgba(255,255,255,.5); line-height: 1.3;
}
.cal .ev.allday-chip { position: static; font-size: 11px; padding: 2px 8px; border-radius: 999px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .nowline { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--bad); z-index: 4; pointer-events: none; }
.cal .nowline::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; background: var(--bad); border-radius: 50%; }
.cal .month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal .mcell { min-height: 108px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; cursor: pointer; }
.cal .mcell.out { opacity: .38; }
.cal .mcell.today { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.cal .mcell .mn { font-family: var(--mono); font-size: 11.5px; color: var(--tx-3); }
.cal .mcell.today .mn { color: var(--accent); font-weight: 600; }
.cal .mchip { font-size: 10.5px; padding: 1px 5px; border-radius: 4px; color: #fff; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend button {
  font: inherit; font-size: 11.5px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--s2); color: var(--tx-2);
  border-radius: 999px; padding: 2px 9px; display: inline-flex; align-items: center; gap: 6px;
}
.legend button[aria-pressed="false"] { opacity: .42; text-decoration: line-through; }
.legend .sw { width: 8px; height: 8px; border-radius: 50%; }
.bookframe { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: var(--r-panel); background: #fff; }

/* ---------- dialog / toast ---------- */
dialog {
  border: 1px solid var(--line-2); background: var(--s1); color: var(--tx);
  border-radius: var(--r-panel); padding: 0; width: min(520px, calc(100vw - 28px));
  box-shadow: var(--shadow);
}
dialog.wide { width: min(860px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }
dialog header { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); }
dialog header h3 { font-size: 15px; }
dialog .dbody { padding: 16px; max-height: 68vh; overflow-y: auto; }
dialog footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); }
dialog footer .left { margin-right: auto; }

#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--s3); border: 1px solid var(--line-2); border-radius: var(--r-ctl);
  padding: 9px 13px; font-size: 13px; box-shadow: var(--shadow); max-width: 320px;
  animation: slidein .18s ease-out;
}
.toast.bad { border-color: var(--bad); color: var(--bad); }
.toast.ok { border-color: var(--ok); color: var(--ok); }
@keyframes slidein { from { opacity: 0; transform: translateY(6px); } }
@media (max-width: 900px) { #toasts { bottom: 74px; left: 14px; right: 14px; } }

.mini { font-size: 12px; color: var(--tx-3); }
.mut { color: var(--tx-3); }
.b { font-weight: 600; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hbar { display: inline-block; height: 6px; border-radius: 3px; background: var(--accent); vertical-align: middle; }
.tagline-mono { font-family: var(--mono); font-size: 11.5px; color: var(--tx-3); }
details.raw > summary { cursor: pointer; padding: 10px 14px; color: var(--tx-2); font-size: 13px; }
details.raw > summary:hover { color: var(--tx); }
.badge-role { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); margin-left: 5px; font-family: var(--mono); }
.drop { border: 1px dashed var(--line-2); border-radius: var(--r-panel); padding: 26px; text-align: center; color: var(--tx-3); }
.drop.over { border-color: var(--accent); color: var(--tx); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
