/* ===========================================================
   MedCurious Studio — design system + app shell
   Light by default, dark on toggle. Solid accents only (no gradients).
   =========================================================== */
:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-2: #f7f8fb;
  --panel-3: #eef1f6;
  --ink: #0e1a33;
  --ink-2: #36425c;
  --mute: #69748b;
  --line: rgba(14, 26, 51, 0.09);
  --line-2: rgba(14, 26, 51, 0.17);
  --acc: #168aa0;
  --acc-2: #0f6f82;
  --acc-ink: #ffffff;
  --acc-soft: rgba(22, 138, 160, 0.1);
  --acc-line: rgba(22, 138, 160, 0.35);
  --ok: #2b8a5b;
  --ok-soft: rgba(43, 138, 91, 0.12);
  --warn: #b7791f;
  --warn-soft: rgba(183, 121, 31, 0.14);
  --info: #3d63c9;
  --info-soft: rgba(61, 99, 201, 0.12);
  --violet: #7a4fc4;
  --violet-soft: rgba(122, 79, 196, 0.12);
  --danger: #c23a2e;
  --danger-soft: rgba(194, 58, 46, 0.11);
  --shadow-1: 0 1px 2px rgba(14, 26, 51, 0.05);
  --shadow-2: 0 1px 2px rgba(14, 26, 51, 0.06), 0 8px 24px -10px rgba(14, 26, 51, 0.18);
  --shadow-3: 0 2px 6px rgba(14, 26, 51, 0.08), 0 24px 60px -20px rgba(14, 26, 51, 0.35);
  --scrim: rgba(10, 18, 36, 0.45);

  --display: "Playfair Display", Georgia, serif;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --side-w: 248px;
  --top-h: 60px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #070c18;
  --panel: #0e1628;
  --panel-2: #121c32;
  --panel-3: #18233c;
  --ink: #e9eef7;
  --ink-2: #bcc6d8;
  --mute: #8591a8;
  --line: rgba(233, 238, 247, 0.09);
  --line-2: rgba(233, 238, 247, 0.18);
  --acc: #4fd1d9;
  --acc-2: #7de0e6;
  --acc-ink: #06101c;
  --acc-soft: rgba(79, 209, 217, 0.12);
  --acc-line: rgba(79, 209, 217, 0.4);
  --ok: #4cc38a;
  --ok-soft: rgba(76, 195, 138, 0.14);
  --warn: #e3a94a;
  --warn-soft: rgba(227, 169, 74, 0.14);
  --info: #7b9cf0;
  --info-soft: rgba(123, 156, 240, 0.15);
  --violet: #b394f0;
  --violet-soft: rgba(179, 148, 240, 0.15);
  --danger: #ef7a6e;
  --danger-soft: rgba(239, 122, 110, 0.14);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px -12px rgba(0, 0, 0, 0.65);
  --shadow-3: 0 2px 6px rgba(0, 0, 0, 0.4), 0 28px 70px -20px rgba(0, 0, 0, 0.85);
  --scrim: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14.5px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
::selection { background: var(--acc); color: var(--acc-ink); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after { transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease) !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* ---------- boot ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 1000; transition: opacity .4s var(--ease); }
.boot.gone { opacity: 0; pointer-events: none; }
.boot-mark { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.boot-word { font: 500 34px/1 var(--display); letter-spacing: -0.012em; }
.boot-word b { font-weight: 800; }
.boot-mark i { display: block; height: 3px; width: 46%; border-radius: 2px; background: var(--acc); animation: boot-rule 1.1s var(--ease) infinite alternate; transform-origin: left; }
@keyframes boot-rule { from { transform: scaleX(.4); } to { transform: scaleX(2); } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px 12px; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; z-index: 30;
}
.brand { display: flex; flex-direction: column; gap: 5px; padding: 4px 10px 16px; text-decoration: none !important; color: var(--ink); }
.brand-word { font: 500 23px/1 var(--display); letter-spacing: -0.012em; }
.brand-word b { font-weight: 800; }
.brand-row { display: flex; align-items: center; gap: 8px; }
.brand-rule { display: block; width: 36px; height: 2px; background: var(--acc); border-radius: 2px; transition: width .5s var(--ease); }
.brand:hover .brand-rule { width: 64px; }
.brand-tag { font: 600 10px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--mute); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font: 600 10.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: var(--r); color: var(--ink-2);
  font-weight: 500; text-decoration: none !important; position: relative; transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav-item:hover { background: var(--panel-3); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--acc-soft); color: var(--acc-2); font-weight: 600; }
:root[data-theme="dark"] .nav-item[aria-current="page"] { color: var(--acc); }
.nav-item[aria-current="page"] svg { opacity: 1; }
.nav-item .count { margin-left: auto; font: 600 11px/1 var(--sans); background: var(--panel-3); color: var(--ink-2); padding: 3px 7px; border-radius: 99px; }
.nav-item .count.hot { background: var(--acc); color: var(--acc-ink); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: transparent; border-radius: var(--r); text-align: left; width: 100%; }
.user-btn:hover { background: var(--panel-3); }
.user-btn .who { min-width: 0; line-height: 1.25; }
.user-btn .who b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-btn .who span { font-size: 12px; color: var(--mute); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.top .menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; color: var(--mute); }
.crumbs b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .spacer { flex: 1; }
.search-btn {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; min-width: 220px; border: 1px solid var(--line-2);
  background: var(--panel); border-radius: 99px; color: var(--mute); font-size: 13.5px;
}
.search-btn:hover { border-color: var(--ink-2); color: var(--ink-2); }
.search-btn svg { width: 16px; height: 16px; }
.search-btn kbd { margin-left: auto; font: 500 11px/1 var(--mono); padding: 3px 6px; border: 1px solid var(--line-2); border-radius: 5px; }
.view { padding: 28px 28px 80px; flex: 1; min-width: 0; animation: view-in .35s var(--ease); }
.view.wide { padding: 0; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font: 500 34px/1.05 var(--display); letter-spacing: -0.015em; margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--mute); max-width: 60ch; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .3s var(--ease); box-shadow: var(--shadow-3); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: var(--scrim); z-index: 25; }
  .top { padding: 0 14px; }
  .top .menu-btn { display: inline-grid; }
  .search-btn { min-width: 0; width: 36px; padding: 0; justify-content: center; }
  .search-btn span, .search-btn kbd { display: none; }
  .view { padding: 20px 16px 80px; }
  .page-head h1 { font-size: 28px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 99px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .2s var(--ease), box-shadow .2s;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.btn.primary:hover { background: var(--acc-2); border-color: var(--acc-2); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-3); color: var(--ink); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn.lg { height: 42px; padding: 0 20px; font-size: 14.5px; }
.btn.block { width: 100%; }
.btn.loading { pointer-events: none; opacity: .7; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid transparent; background: transparent;
  color: var(--ink-2); transition: background .15s, border-color .15s, color .15s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--panel-3); color: var(--ink); }
.icon-btn.bordered { border-color: var(--line-2); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.theme-btn .i-moon { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: block; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl { font: 600 12px/1.2 var(--sans); color: var(--ink-2); letter-spacing: .01em; }
.field .hint { font-size: 12px; color: var(--mute); }
.field .err { font-size: 12.5px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel);
  color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--mute); opacity: .8; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2369748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input.sm, .select.sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.sm { gap: 8px; }
.grow { flex: 1; min-width: 0; }
.mute { color: var(--mute); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { accent-color: var(--acc); width: 16px; height: 16px; margin: 0; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .25s var(--ease); }
.switch input:checked + i { background: var(--acc); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--acc); outline-offset: 2px; }
.seg { display: inline-flex; padding: 3px; background: var(--panel-3); border-radius: 99px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 13px; border-radius: 99px; font-weight: 600; font-size: 12.5px; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.seg button svg { width: 15px; height: 15px; }
.seg button[aria-pressed="true"], .seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- cards / panels ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card.pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.card-head h2, .card h2.t { font: 600 15px/1.2 var(--sans); margin: 0; }
.card-head .sub { color: var(--mute); font-size: 12.5px; }
.card-head .grow { flex: 1; }
.card-body { padding: 14px 20px 20px; }
.divider { height: 1px; background: var(--line); margin: 6px 0; border: 0; }
.eyebrow { font: 600 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }

/* ---------- chips / avatars ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font: 600 11.5px/1.3 var(--sans); background: var(--panel-3); color: var(--ink-2); white-space: nowrap; }
.chip svg { width: 12px; height: 12px; }
.chip.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.s-draft { background: var(--panel-3); color: var(--mute); }
.chip.s-review { background: var(--warn-soft); color: var(--warn); }
.chip.s-approved { background: var(--violet-soft); color: var(--violet); }
.chip.s-published { background: var(--ok-soft); color: var(--ok); }
.chip.s-archived { background: var(--panel-3); color: var(--mute); opacity: .8; }
.chip.s-changes { background: var(--info-soft); color: var(--info); }
.chip.acc { background: var(--acc-soft); color: var(--acc-2); }
:root[data-theme="dark"] .chip.acc { color: var(--acc); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.avatar { --s: 30px; width: var(--s); height: var(--s); border-radius: 50%; display: inline-grid; place-items: center; flex: none; font: 700 calc(var(--s) * .38)/1 var(--sans); color: #fff; letter-spacing: .02em; user-select: none; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--panel); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font: 600 11px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--panel-2); }
.tbl tbody tr.sel { background: var(--acc-soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; font-weight: 600; font-size: 13.5px; color: var(--mute); position: relative; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--acc); border-radius: 2px; }
.tabs .n { font: 600 11px/1 var(--sans); background: var(--panel-3); padding: 3px 7px; border-radius: 99px; color: var(--ink-2); }

/* ---------- layers: modal / drawer / menu / toast ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 200; display: grid; place-items: center; padding: 20px; animation: fade .2s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .28s var(--ease); }
.modal.lg { width: min(860px, 100%); }
.modal.xl { width: min(1100px, 100%); }
.modal.sm { width: min(420px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 0; }
.modal-head h2 { font: 600 17px/1.25 var(--sans); margin: 0; flex: 1; }
.modal-body { padding: 14px 22px 8px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; }
.drawer-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 190; animation: fade .2s var(--ease); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow-3); z-index: 195; display: flex; flex-direction: column; animation: slide-in .32s var(--ease); }
.drawer.lg { width: min(640px, 100vw); }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font: 600 16px/1.25 var(--sans); margin: 0; flex: 1; min-width: 0; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.menu { position: fixed; z-index: 300; min-width: 200px; max-width: 320px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow-3); padding: 6px; animation: pop .18s var(--ease); max-height: 70vh; overflow-y: auto; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 7px; text-align: left; font-size: 13.5px; }
.menu button svg { width: 16px; height: 16px; opacity: .75; flex: none; }
.menu button:hover, .menu button:focus-visible { background: var(--panel-3); outline: none; }
.menu button.danger { color: var(--danger); }
.menu button[disabled] { opacity: .4; pointer-events: none; }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 5px 4px; }
.menu .menu-lbl { font: 600 10.5px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--mute); padding: 8px 10px 4px; }
.menu button .check-mark { margin-left: auto; color: var(--acc); }
#toasts { position: fixed; z-index: 400; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(560px, calc(100vw - 24px)); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 11px 14px 11px 16px; background: var(--ink); color: var(--bg); border-radius: 12px; box-shadow: var(--shadow-3); font-weight: 500; animation: toast-in .3s var(--ease); max-width: 100%; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok svg.t-ico { color: #62dba0; }
.toast button { background: transparent; border: 0; color: inherit; font-weight: 700; text-decoration: underline; padding: 2px 4px; }
.toast .t-ico { width: 16px; height: 16px; flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--mute); }
.empty .e-ico { width: 54px; height: 54px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 16px; background: var(--acc-soft); color: var(--acc); }
.empty .e-ico svg { width: 26px; height: 26px; }
.empty h3 { margin: 0 0 6px; font: 500 22px/1.2 var(--display); color: var(--ink); }
.empty p { margin: 0 auto 16px; max-width: 42ch; }
.skel { background: linear-gradient(90deg, var(--panel-3) 25%, var(--panel-2) 50%, var(--panel-3) 75%); background-size: 200% 100%; animation: skel 1.3s linear infinite; border-radius: 8px; }
@keyframes skel { to { background-position: -200% 0; } }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--acc); animation: spin .7s linear infinite; display: inline-block; }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r); background: var(--acc-soft); color: var(--ink); border: 1px solid var(--acc-line); }
.banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.banner.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.banner svg { width: 18px; height: 18px; flex: none; }
.banner .grow { min-width: 0; }
kbd { font: 500 11px/1 var(--mono); padding: 3px 6px; border: 1px solid var(--line-2); border-radius: 5px; background: var(--panel-2); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; }
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel); min-height: 38px; align-items: center; cursor: text; }
.tag-input:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.tag-input .chip button { border: 0; background: transparent; padding: 0; line-height: 1; opacity: .6; }
.tag-input .chip button:hover { opacity: 1; }
.tag-input input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 90px; padding: 3px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 520px) 1fr; background: var(--bg); }
.login-form { padding: 48px clamp(24px, 5vw, 64px); display: flex; flex-direction: column; justify-content: center; gap: 22px; background: var(--panel); border-right: 1px solid var(--line); }
.login-form .brand { padding: 0 0 8px; }
.login-form h1 { font: 500 36px/1.05 var(--display); letter-spacing: -.015em; margin: 0; }
.login-form p.lede { margin: -8px 0 0; color: var(--mute); }
.login-art { position: relative; display: grid; place-items: center; overflow: hidden; background: var(--bg-art, var(--panel-3)); }
.login-art svg { width: min(78%, 640px); height: auto; }
.login-art .quote { position: absolute; left: 7%; right: 7%; bottom: 8%; font: italic 400 clamp(20px, 2.2vw, 30px)/1.25 var(--display); color: var(--ink); }
.login-art .quote span { display: block; margin-top: 10px; font: 600 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; font-style: normal; color: var(--mute); }
.login .err-box { padding: 10px 12px; border-radius: var(--r); background: var(--danger-soft); color: var(--danger); font-size: 13.5px; }
.login .ok-box { padding: 10px 12px; border-radius: var(--r); background: var(--ok-soft); color: var(--ok); font-size: 13.5px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } .login-form { border: 0; min-height: 100vh; } }

/* ---------- command palette ---------- */
.palette { width: min(620px, 100%); background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-3); overflow: hidden; animation: pop .22s var(--ease); align-self: start; margin-top: 12vh; }
.palette input { width: 100%; border: 0; outline: 0; background: transparent; padding: 18px 20px; font-size: 16px; border-bottom: 1px solid var(--line); }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 8px; }
.palette-list .p-group { font: 600 10.5px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--mute); padding: 10px 10px 6px; }
.palette-list button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 9px 10px; border: 0; background: transparent; border-radius: 8px; }
.palette-list button svg { width: 17px; height: 17px; opacity: .7; flex: none; }
.palette-list button small { margin-left: auto; color: var(--mute); }
.palette-list button.on { background: var(--acc-soft); }
.palette .p-empty { padding: 28px; text-align: center; color: var(--mute); }

/* full-bleed workspaces (article editor, magazine builder) carry their own header: drop the global top bar */
.shell.wide-page { --top-h: 0px; }
.shell.wide-page .top { display: none; }
.wide-menu { display: none; }
@media (max-width: 960px) { .shell.wide-page .wide-menu { display: inline-grid; } }
