:root {
  color-scheme: light;
  --font-sans: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Surfaces */
  --canvas: #F6F7F9;
  --sidebar: #EEF0F3;
  --surface: #FFFFFF;
  --card-bg: #FFFFFF;
  --column-bg: #EEF0F3;
  --hover: #E8EBEF;

  /* Ink */
  --ink: #14181F;
  --ink-inv: #F6F7F9;
  --muted: #5A6472;

  /* Lines */
  --line: #D3D8DF;
  --line-strong: #A9B1BC;

  /* Accent (selection, focus, in progress) */
  --accent: #1D4ED8;
  --accent-hover: #1A43B8;
  --accent-soft: #E8EEFD;
  --on-accent: #FFFFFF;

  /* Status (used only to mean something) */
  --ok: #17794A;
  --ok-soft: #E4F3EB;
  --warn: #8A5300;
  --warn-soft: #FFF1D6;
  --danger: #B3261E;
  --danger-soft: #FCE9E7;

  --scrim: rgba(12, 14, 18, 0.5);
  --shadow-overlay: 0 16px 40px -12px rgba(12, 14, 18, 0.35);
  --toast-action: #9DB8FF;

  /* Spacing */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;

  /* Type scale */
  --text-xs: 12px; --text-sm: 14px; --text-md: 16px; --text-lg: 20px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --sidebar-w: 284px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0D0F14;
  --sidebar: #13171E;
  --surface: #13171E;
  --card-bg: #181D25;
  --column-bg: #13171E;
  --hover: #1D2430;
  --ink: #E8EDF5;
  --ink-inv: #0D0F14;
  --muted: #9AA6B8;
  --line: #28303B;
  --line-strong: #4A576B;
  --accent: #78A7FF;
  --accent-hover: #93B8FF;
  --accent-soft: rgba(120, 167, 255, 0.12);
  --on-accent: #0D0F14;
  --ok: #54C89A;
  --ok-soft: rgba(84, 200, 154, 0.12);
  --warn: #D5A65C;
  --warn-soft: rgba(213, 166, 92, 0.12);
  --danger: #D87878;
  --danger-soft: rgba(216, 120, 120, 0.12);
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow-overlay: 0 12px 32px -12px rgba(0, 0, 0, 0.7);
  --toast-action: #2F5FC4;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body, button, a, input, textarea, select { font-family: var(--font-sans); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button, a { font: inherit; }
a { color: inherit; text-decoration: none; }
button { border: 0; border-radius: 0; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Everything that is data, not prose, is mono */
.nav-badge, .column-count, .due-badge, .subject-tag, .task-row-due, .summary, .admin-status,
.save-state, .announce-date, .announce-count, .field-label, .prop-value, .status-option,
.cal-time, .cal-num, .cal-dow, .quick-chip, .quick-chip-btn, .quick-code, .quick-field-label,
.quick-group-label, .quick-keys, kbd, .dp-input, .dp-day, .dp-dow, .dp-hint, .drop-placeholder,
.brand-name, .sync-note, .list-empty-meta { font-family: var(--font-mono); }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; display: flex; width: var(--sidebar-w); flex-direction: column; padding: 0 var(--s3) var(--s4); border-right: 1px solid var(--line); background: var(--sidebar); }
.brand { position: relative; display: flex; align-items: center; height: 56px; margin: 0 calc(var(--s3) * -1) var(--s3); padding: 0 var(--s4); border-bottom: 1px solid var(--line); }
.brand-name { display: inline-flex; align-items: center; gap: var(--s2); color: var(--ink); font-size: var(--text-sm); font-weight: 600; letter-spacing: 0; white-space: nowrap; }
.brand-mark { width: 18px; height: 18px; flex: none; color: var(--accent); }
.sidebar-toggle { position: absolute; top: var(--s3); right: var(--s3); display: grid; place-content: center; width: 32px; height: 32px; color: var(--muted); background: transparent; cursor: pointer; }
.sidebar-toggle:hover { color: var(--ink); background: var(--hover); }
.sidebar-toggle svg { width: 18px; height: 18px; stroke-width: 1.75; }

   .nav-group { display: grid; gap: var(--s1); }
   .sidebar-close { display: none; }
.nav-item { position: relative; display: flex; align-items: center; gap: var(--s3); min-height: 40px; padding: var(--s2) 14px; color: var(--muted); font-size: var(--text-sm); font-weight: 500; white-space: nowrap; }
.nav-item:hover { color: var(--ink); background: var(--hover); }
.nav-item.is-active { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.nav-item::before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: var(--accent); transform: scaleY(0); }
.nav-item.is-active::before { transform: scaleY(1); }
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-linecap: square; stroke-linejoin: miter; stroke-width: 1.75; }
.nav-badge { margin-left: auto; min-width: 20px; padding: 0 6px; color: var(--ink-inv); background: var(--ink); font-size: 11px; font-weight: 500; line-height: 20px; text-align: center; }

.main-content { width: calc(100% - var(--sidebar-w)); margin-left: var(--sidebar-w); }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; height: 56px; align-items: center; justify-content: space-between; gap: var(--s3); padding: 0 var(--s6); border-bottom: 1px solid var(--line); background: var(--canvas); }
.header-title { flex: 1; color: var(--ink); font-size: var(--text-md); font-weight: 600; line-height: 24px; }
.mobile-menu { display: none; }

.page-container { width: min(95%, 1400px); margin: 0 auto; padding: var(--s5) 0 var(--s7); }
.page-heading { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s4) var(--s5); }
.page-supporting-copy { margin: 0; color: var(--muted); font-size: var(--text-sm); line-height: 24px; }
.page-actions { display: flex; align-items: center; gap: var(--s3); }
.utility-page .page-heading { margin-bottom: var(--s5); }
#page-my-tasks, #page-class-tasks, #page-calendar { max-width: 1120px; margin-inline: auto; }
#page-done { max-width: 720px; margin-inline: auto; }
#page-my-tasks[data-view="list"], #page-class-tasks[data-view="list"] { max-width: 720px; }

/* ---------- Controls ---------- */
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 36px; padding: 0 var(--s4); border: 1px solid transparent; font-size: var(--text-sm); font-weight: 600; line-height: 20px; cursor: pointer; }
.primary-button { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.primary-button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.primary-button:active { background: var(--accent-hover); }
.primary-button svg { width: 16px; height: 16px; flex-shrink: 0; }
.secondary-button { color: var(--ink); background: transparent; border-color: var(--line-strong); }
.secondary-button:hover, .secondary-button:active { background: var(--hover); }
.primary-button:disabled, .secondary-button:disabled, .text-button:disabled { opacity: 0.4; cursor: not-allowed; }
.primary-button.is-loading::after, .danger-button.is-loading::after { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 700ms linear infinite; }

.text-button { padding: 0; background: transparent; color: var(--ink); font-size: var(--text-sm); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.text-button:hover { color: var(--accent); }

.icon-button { display: grid; place-content: center; width: 36px; height: 36px; border: 1px solid var(--line-strong); color: var(--muted); background: transparent; cursor: pointer; }
.icon-button:hover, .icon-button:active { color: var(--ink); background: var(--hover); }
.icon-button svg { width: 18px; height: 18px; stroke-width: 1.75; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

.mobile-menu span { display: block; width: 16px; height: 2px; background: var(--muted); }

.view-tabs { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); }
.view-tab { min-height: 34px; padding: 0 var(--s3); background: transparent; color: var(--muted); font-size: var(--text-sm); font-weight: 500; cursor: pointer; }
.view-tab + .view-tab { border-left: 1px solid var(--line-strong); }
.view-tab:hover { color: var(--ink); background: var(--hover); }
.view-tab.is-active { color: var(--ink-inv); background: var(--ink); font-weight: 600; }

.search { display: flex; align-items: center; gap: var(--s2); min-height: 36px; padding: 0 var(--s3); border: 1px solid var(--line-strong); color: var(--muted); background: var(--surface); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.search svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 1.75; }
.search input { width: 180px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: var(--text-sm); }
.search input::placeholder { color: var(--muted); }

.text-input { width: 100%; min-height: 36px; padding: 0 var(--s3); border: 1px solid var(--line-strong); outline: 0; color: var(--ink); background: var(--surface); font-size: var(--text-sm); }
.text-input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* ---------- Banners, summary, admin ---------- */
.sync-note, .preview-banner { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin: var(--s4) 0 0; padding: var(--s2) var(--s3); border: 1px solid var(--warn); color: var(--warn); background: var(--warn-soft); font-size: var(--text-xs); line-height: 20px; }
.preview-banner { font-family: var(--font-mono); }

.admin-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3) var(--s5); margin-top: var(--s4); padding: var(--s3) var(--s4); border: 1px solid var(--line); background: var(--surface); }
.admin-status { color: var(--muted); font-size: var(--text-xs); line-height: 20px; }
.admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); }

.summary { display: flex; flex-wrap: wrap; align-items: center; margin: var(--s4) 0 0; color: var(--muted); font-size: var(--text-xs); line-height: 20px; }
.summary span:first-child { color: var(--ink); font-weight: 500; }
.summary span + span { margin-left: var(--s3); padding-left: var(--s3); border-left: 1px solid var(--line-strong); }
.summary .is-alert { color: var(--danger); font-weight: 500; }

.empty-state { display: none; align-items: baseline; gap: var(--s3); margin-top: var(--s4); padding: var(--s4) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.empty-state p { margin: 0; color: var(--muted); font-size: var(--text-sm); }
#page-my-tasks.is-blank .empty-state { display: flex; }
#page-my-tasks.is-blank .summary, #page-my-tasks.is-blank .kanban-board, #page-my-tasks.is-blank .task-list { display: none; }
.list-empty { margin: 0; padding: var(--s5) var(--s3); color: var(--muted); font-size: var(--text-sm); }

/* ---------- Announcements ---------- */
.announcements { margin-top: var(--s4); padding: var(--s4); border: 1px solid var(--line); border-left: 2px solid var(--accent); background: var(--surface); }
.announce-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.announce-header h2 { display: flex; align-items: center; gap: var(--s2); font-size: var(--text-sm); line-height: 24px; }
.announce-header h2 svg { width: 16px; height: 16px; color: var(--accent); stroke-width: 2; }
.announce-form { margin-top: var(--s3); }
.announce-form textarea { width: 100%; padding: var(--s2) var(--s3); border: 1px solid var(--line-strong); outline: 0; color: var(--ink); background: var(--canvas); font-size: var(--text-sm); line-height: 20px; resize: vertical; }
.announce-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.announce-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--s4); margin-top: var(--s3); }
.announce-count { margin-right: auto; color: var(--muted); font-size: var(--text-xs); line-height: 20px; }
.announce-count.is-low { color: var(--danger); }
.announce-toolbar { display: flex; gap: var(--s1); margin-top: var(--s3); }
.announce-tool { display: grid; place-content: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--ink); font-size: var(--text-sm); line-height: 20px; cursor: pointer; }
.announce-tool:hover { border-color: var(--line-strong); background: var(--hover); }
.announce-tool[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.announce-tool svg { width: 16px; height: 16px; stroke-width: 1.75; }
.announce-editor { min-height: calc(var(--s7) + var(--s4)); max-height: 240px; margin-top: var(--s2); padding: var(--s2) var(--s3); border: 1px solid var(--line-strong); border-radius: 4px; overflow-y: auto; outline: 0; color: var(--ink); background: var(--canvas); font-size: var(--text-sm); line-height: 20px; overflow-wrap: anywhere; }
.announce-editor:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.announce-editor:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.announce-editor ul, .announce-text ul { margin: var(--s1) 0; padding-left: var(--s5); list-style: square; }
.announce-text.is-rich { white-space: normal; }
.announce-text b, .announce-editor b { font-weight: 600; }
.announce-text a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.announce-text a:hover { color: var(--accent-hover); }
@media (max-width: 720px) { .announce-tool { width: 44px; height: 44px; } }
.announce-list { margin: var(--s3) 0 0; padding: 0; list-style: none; }
.announce-item { display: grid; grid-template-columns: minmax(0, 1fr) auto 32px; align-items: start; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.announce-item:hover .task-delete-btn, .announce-item:focus-within .task-delete-btn { opacity: 1; }
.announce-text { margin: 0; font-size: var(--text-sm); line-height: 20px; white-space: pre-wrap; word-break: break-word; }
.announce-date { color: var(--muted); font-size: var(--text-xs); line-height: 20px; white-space: nowrap; }
.announce-empty { margin: 0; padding-top: var(--s3); border-top: 1px solid var(--line); color: var(--muted); font-size: var(--text-sm); line-height: 20px; }

/* ---------- Board ---------- */
.kanban-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin-top: var(--s4); align-items: stretch; }
.kanban-column { display: flex; min-width: 0; min-height: 320px; flex-direction: column; padding: var(--s3); border: 1px solid var(--line); background: var(--column-bg); }
.column-header { display: flex; align-items: center; gap: var(--s2); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.column-header > div { display: flex; flex: 1; min-width: 0; align-items: baseline; gap: var(--s2); }
.column-header h2 { font-size: var(--text-sm); line-height: 24px; }
.column-count { color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; line-height: 24px; }
.column-marker { order: -1; width: 8px; height: 8px; flex-shrink: 0; }
.marker-todo { background: var(--line-strong); }
.marker-progress { background: var(--accent); }
.marker-done { background: var(--ok); }
.column-content { display: grid; flex: 1; align-content: start; gap: var(--s2); padding: var(--s3) 0 0; }
.column-content.is-empty { place-items: center; align-content: center; }
.column-empty { margin: var(--s2) 0; color: var(--muted); font-size: var(--text-sm); line-height: 24px; text-align: center; }
.kanban-column.drag-over { background: var(--accent-soft); border-color: var(--accent); }
.drop-placeholder { display: grid; place-content: center; height: 56px; border: 1px dashed var(--accent); background: var(--accent-soft); color: var(--accent); font-size: var(--text-xs); font-weight: 500; }

/* ---------- Task card ---------- */
.task-card { position: relative; display: grid; gap: var(--s1); padding: var(--s3) var(--s3) var(--s3) 14px; border: 1px solid var(--line); background: var(--card-bg); cursor: pointer; }
.task-card::before { content: ''; position: absolute; top: -1px; bottom: -1px; left: -1px; width: 3px; background: var(--edge, var(--line-strong)); }
.task-card[data-status="in_progress"] { --edge: var(--accent); }
.task-card[data-status="done"] { --edge: var(--ok); }
.task-card:hover { border-color: var(--line-strong); }
.task-card:active { background: var(--hover); }
.task-card.is-dragging { opacity: 0.45; }
.task-card-header, .task-card-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.task-card-header .status-check { flex-shrink: 0; }
.task-card-footer { flex-wrap: wrap; row-gap: var(--s1); margin-top: var(--s1); }
.task-card-footer .due-badge { margin-left: auto; }
.task-card-title { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); font-size: var(--text-sm); font-weight: 600; line-height: 20px; word-break: break-word; }
.task-card[data-status="done"] .task-card-title { color: var(--muted); text-decoration: line-through; }
.is-changed .task-card-title::after, .is-changed .task-row-title::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: var(--s2); background: var(--accent); vertical-align: middle; }

.task-delete-btn { display: grid; place-content: center; width: 28px; height: 28px; color: var(--muted); background: transparent; cursor: pointer; opacity: 0; }
.task-card:hover .task-delete-btn, .task-card:focus-within .task-delete-btn, .task-row:hover .task-delete-btn, .task-row:focus-within .task-delete-btn { opacity: 1; }
.task-delete-btn:hover { color: var(--danger); background: var(--danger-soft); }
.task-delete-btn:focus-visible { opacity: 1; }
.task-delete-btn i, .task-delete-btn svg { width: 16px; height: 16px; stroke-width: 2; }
@media (hover: none) { .task-delete-btn { opacity: 1; } }

/* Subject tags */
.subject-tag { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 1px 6px; color: var(--ink); font-size: 11px; font-weight: 500; line-height: 16px; letter-spacing: 0.02em; box-shadow: inset 0 0 0 1px var(--line-strong); }
.subject-tag::before { content: ''; width: 6px; height: 6px; flex: none; background: var(--tag, var(--line-strong)); }
.bg-blue { --tag: #58affc; }
.bg-sunglow { --tag: #fed430; }
.bg-cyan { --tag: #70d1fe; }
.bg-green { --tag: #e0fcde; }
.bg-sand { --tag: #e3d8c6; }
.bg-stone { --tag: #bebfba; }
.bg-mauve { --tag: #d2c1cb; }
.bg-yellow { --tag: #fcf603; }
.bg-pink { --tag: #fba6f7; }

/* Due badges: urgency you can scan */
.due-badge { display: inline-flex; align-items: center; gap: var(--s1); width: fit-content; padding: 1px 6px; color: var(--muted); font-size: var(--text-xs); font-weight: 400; line-height: 16px; }
.due-badge svg { width: 12px; height: 12px; stroke-width: 2; }
.due-badge.due-soon { color: var(--warn); background: var(--warn-soft); font-weight: 500; }
.due-badge.overdue { color: var(--danger); background: var(--danger-soft); font-weight: 500; }

/* ---------- Status ---------- */
.status-dot { width: 8px; height: 8px; flex-shrink: 0; }
.dot-not-started { background: var(--line-strong); }
.dot-in-progress { background: var(--accent); }
.dot-done { background: var(--ok); }

/* Checkbox: [ ] not started, [-] in progress, [x] done */
.status-check { position: relative; display: grid; place-content: center; width: 16px; height: 16px; margin: 0; padding: 0; border: 1px solid var(--line-strong); background: transparent; color: var(--on-accent); cursor: pointer; }
.status-check::after { content: ''; position: absolute; inset: -12px; }
.status-check:hover { border-color: var(--ink); }
.status-check:active { background: var(--hover); }
.status-check svg { width: 12px; height: 12px; stroke-width: 3; }
.status-check.is-in-progress { background: var(--accent); border-color: var(--accent); }
.status-check.is-done { background: var(--ok); border-color: var(--ok); }
.status-check.is-done, .status-check.is-in-progress { color: var(--on-accent); }
:root[data-theme="dark"] .status-check.is-done { color: #0B1A12; }

/* ---------- List ---------- */
.task-list { margin-top: var(--s4); border: 1px solid var(--line); background: var(--surface); }
.task-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto 32px; align-items: center; gap: var(--s3); min-height: 48px; padding: var(--s2); border-bottom: 1px solid var(--line); cursor: pointer; }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--hover); }
.task-row:active { background: var(--hover); }
.task-row:focus-visible { outline-offset: -2px; }
.task-row .status-check { justify-self: center; }
.task-row-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 15px; font-weight: 600; line-height: 24px; }
.task-row-title.is-ghost { color: var(--muted); }
.task-row-title.is-done { color: var(--muted); text-decoration: line-through; }
.task-row-due { color: var(--muted); font-size: var(--text-xs); white-space: nowrap; }
.task-row-due.is-overdue { color: var(--danger); font-weight: 600; }
.task-list-add { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 48px; padding: 0 var(--s2); border-top: 1px solid var(--line); background: transparent; color: var(--muted); font-size: var(--text-sm); text-align: left; cursor: pointer; }
.task-list-add:hover { color: var(--ink); background: var(--hover); }
.task-list-add svg { width: 16px; height: 16px; margin: 0 4px; stroke-width: 2; }
.done-row { grid-template-columns: 24px minmax(0, 1fr) auto auto auto; }
.done-row .status-dot { justify-self: center; }

/* ---------- Popovers, toast ---------- */
.status-dropdown { position: absolute; left: 0; top: calc(100% + 4px); z-index: 5; min-width: 180px; padding: var(--s1); border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow-overlay); }
.status-dropdown:not([hidden]) { display: block; animation: pop-in 100ms var(--ease); }
.status-popover { position: fixed; z-index: 120; transform-origin: top left; }
.subject-dropdown { max-height: 280px; overflow-y: auto; }
.status-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: var(--s2) var(--s3); background: transparent; color: var(--ink); font-size: 13px; font-weight: 500; text-align: left; cursor: pointer; }
.status-option:hover, .status-option.is-active { background: var(--hover); }

.toast { position: fixed; bottom: calc(var(--s5) + env(safe-area-inset-bottom, 0px)); left: 50%; z-index: 200; display: flex; align-items: center; gap: var(--s4); max-width: calc(100% - var(--s5)); padding: var(--s3) var(--s4); color: var(--ink-inv); background: var(--ink); box-shadow: var(--shadow-overlay); font-size: var(--text-sm); line-height: 20px; transform: translateX(-50%); animation: toast-in 140ms var(--ease); }
.toast-action { padding: var(--s1) var(--s2); background: transparent; color: var(--toast-action); font-size: var(--text-sm); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- Dialogs ---------- */
.task-dialog-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: var(--s4); background: var(--scrim); }
.task-dialog { display: flex; flex-direction: column; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow-overlay); }
.task-dialog.is-dropping { border-color: var(--accent); box-shadow: var(--shadow-overlay), 0 0 0 1px var(--accent); }
.dialog-header { display: flex; align-items: flex-start; gap: var(--s2); padding: var(--s3) var(--s3) var(--s3) var(--s5); border-bottom: 1px solid var(--line); }
.dialog-title-input { display: block; flex: 1; min-width: 0; max-height: 116px; padding: 2px 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.01em; line-height: 28px; overflow-wrap: anywhere; overflow-y: auto; resize: none; }
.dialog-title-input::placeholder { color: var(--muted); }
.dialog-heading { flex: 1; padding: 2px 0; font-size: var(--text-lg); line-height: 28px; }
.panel-close { display: grid; place-content: center; width: 32px; height: 32px; background: transparent; color: var(--muted); cursor: pointer; }
.panel-close:hover { background: var(--hover); color: var(--ink); }
.panel-close i, .panel-close svg { width: 18px; height: 18px; stroke-width: 2; }
.dialog-body { display: grid; gap: var(--s4); padding: var(--s4) var(--s5); overflow-y: auto; }
.dialog-controls { display: flex; flex-wrap: wrap; gap: var(--s4); }
.dialog-summary { margin: 0; font-size: var(--text-sm); line-height: 20px; }
.form-error { margin: 0; color: var(--danger); font-size: var(--text-sm); line-height: 20px; }
.field { position: relative; min-width: 0; }
.field-label { display: block; margin-bottom: var(--s1); color: var(--muted); font-size: var(--text-xs); line-height: 16px; }
.due-hint { margin-left: var(--s2); color: var(--muted); }
.due-hint:not(:empty)::before { content: '· '; }
.due-hint.is-overdue { color: var(--danger); }
.due-controls { display: flex; align-items: center; gap: var(--s1); }
.prop-value { display: inline-flex; align-items: center; gap: var(--s2); min-height: 32px; padding: 0 10px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 13px; font-weight: 500; line-height: 20px; cursor: pointer; }
.prop-value:hover { border-color: var(--line-strong); background: var(--hover); }
.prop-value.empty-value { color: var(--muted); }
.prop-value:disabled { cursor: default; }
.prop-value:disabled:hover { background: transparent; border-color: var(--line); }
.prop-clear { display: grid; place-content: center; width: 32px; height: 32px; background: transparent; color: var(--muted); cursor: pointer; }
.prop-clear:hover { background: var(--hover); color: var(--ink); }
.prop-clear-icon { width: 16px; height: 16px; stroke-width: 2.5; }
.dialog-doc { min-height: 160px; padding: var(--s3); border: 1px solid var(--line); outline: 0; color: var(--ink); font-size: var(--text-md); line-height: 24px; word-break: break-word; overflow-wrap: anywhere; }
.dialog-doc:focus { border-color: var(--accent); }
.dialog-doc:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.dialog-doc a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; overflow-wrap: anywhere; }
.dialog-doc a:hover { color: var(--accent-hover); }
.dialog-doc img { display: block; max-width: 100%; height: auto; margin: var(--s2) 0; cursor: default; }
.dialog-doc img::selection { background: transparent; }
.note-toolbar { display: flex; gap: var(--s1); margin-bottom: var(--s2); }
.note-tool { display: grid; place-content: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--ink); font-size: var(--text-sm); line-height: 20px; cursor: pointer; }
.note-tool:hover { border-color: var(--line-strong); background: var(--hover); }
.note-tool[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.note-tool svg { width: 16px; height: 16px; stroke-width: 1.75; }
.dialog-doc ul { margin: var(--s1) 0; padding-left: var(--s5); list-style: square; }
.dialog-doc b { font-weight: 600; }
.task-dialog.is-readonly .note-toolbar { display: none; }
@media (max-width: 720px) { .note-tool { width: 44px; height: 44px; } }
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; gap: var(--s4); padding: var(--s3) var(--s5); border-top: 1px solid var(--line); }
.save-state { margin-right: auto; color: var(--muted); font-size: var(--text-xs); line-height: 16px; }
.task-dialog.is-readonly .dialog-title-input { cursor: default; }
.task-dialog.is-readonly .dialog-doc { min-height: 48px; }

/* ---------- Quick add ---------- */
.quick-overlay { position: fixed; inset: 0; z-index: 150; display: flex; align-items: flex-start; justify-content: center; padding: 10vh var(--s4) var(--s4); background: var(--scrim); }
.quick-add { position: relative; width: min(720px, 100%); padding: var(--s5); border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow-overlay); }
.quick-input { width: 100%; padding: var(--s3) 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: var(--text-lg); line-height: 28px; }
.quick-input::placeholder { color: var(--muted); }
.quick-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3) var(--s4); margin-top: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--line); color: var(--muted); font-size: var(--text-sm); line-height: 20px; }
.quick-field { display: grid; gap: var(--s1); min-width: 0; }
.quick-field:first-child { grid-column: 1 / -1; }
.quick-field-label { color: var(--muted); font-size: var(--text-xs); line-height: 16px; }
.quick-field-value { display: flex; align-items: center; min-height: 24px; min-width: 0; overflow-wrap: anywhere; }
.quick-field-value.is-empty { opacity: 0.6; }
.quick-field-value.is-changed { animation: field-in 140ms var(--ease); }
.quick-title { color: var(--ink); font-weight: 600; }
.quick-due { display: flex; flex-wrap: wrap; gap: var(--s1); }
.quick-chip { display: inline-flex; align-items: center; padding: 1px var(--s2); border: 1px solid var(--line-strong); color: var(--ink); font-size: var(--text-xs); line-height: 16px; }
.quick-chips { display: grid; gap: var(--s3); margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }
.quick-group { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.quick-group-label { flex: 0 0 56px; color: var(--muted); font-size: var(--text-xs); line-height: 16px; }
.quick-chip-btn { display: inline-flex; align-items: center; gap: var(--s2); min-height: 32px; padding: var(--s1) var(--s2); border: 1px solid var(--line); color: var(--ink); background: transparent; font-size: 13px; font-weight: 500; line-height: 20px; cursor: pointer; }
.quick-chip-btn.is-subject { padding: 0 var(--s1); }
.quick-chip-btn:hover, .quick-chip-btn:active { border-color: var(--line-strong); background: var(--hover); }
.quick-chip-btn.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.quick-chip-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.quick-code { color: var(--muted); font-size: var(--text-xs); }
.quick-keys { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin-top: var(--s4); color: var(--muted); font-size: var(--text-xs); line-height: 20px; }
kbd { padding: 0 var(--s1); border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--surface); font-size: 11px; }

/* ---------- Due picker ---------- */
.due-picker { position: fixed; z-index: 210; width: 296px; padding: var(--s3); border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow-overlay); transform-origin: top left; animation: pop-in 100ms var(--ease); }
.dp-fields { display: grid; grid-template-columns: 1fr 128px; gap: var(--s2); }
.dp-input { min-width: 0; height: 32px; padding: 0 var(--s2); border: 1px solid var(--line-strong); outline: 0; color: var(--ink); background: var(--canvas); font-size: var(--text-xs); }
.dp-input::placeholder { color: var(--muted); }
.dp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.dp-head { display: flex; align-items: center; gap: var(--s1); margin: var(--s3) 0 var(--s2); }
.dp-month { flex: 1; font-size: var(--text-sm); font-weight: 600; line-height: 20px; }
.dp-nav { display: grid; place-content: center; min-width: 28px; height: 28px; padding: 0 var(--s2); background: transparent; color: var(--muted); font-size: var(--text-xs); font-weight: 600; cursor: pointer; }
.dp-nav:hover { background: var(--hover); color: var(--ink); }
.dp-nav svg { width: 16px; height: 16px; stroke-width: 2; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; color: var(--muted); font-size: var(--text-xs); line-height: 24px; }
.dp-day { height: 32px; background: transparent; color: var(--ink); font-size: var(--text-xs); cursor: pointer; }
.dp-day:hover { background: var(--hover); }
.dp-day.is-outside { color: var(--muted); opacity: 0.55; }
.dp-day.is-today { box-shadow: inset 0 0 0 1px var(--accent); }
.dp-day.is-selected { background: var(--accent); color: var(--on-accent); opacity: 1; }
.dp-foot { display: flex; align-items: center; justify-content: space-between; margin-top: var(--s3); padding-top: var(--s2); border-top: 1px solid var(--line); }
.dp-hint { color: var(--muted); font-size: var(--text-xs); }

/* ---------- History ---------- */
.history-bar { display: flex; justify-content: flex-end; }
.history-list, .history-detail { margin: 0; padding: 0; list-style: none; }
.history-item { padding: var(--s3) 0; border-top: 1px solid var(--line); }
.history-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); }
.history-label { flex: 1 1 100%; font-size: var(--text-sm); font-weight: 600; line-height: 20px; }
.history-detail { margin-top: var(--s2); color: var(--muted); font-size: var(--text-sm); line-height: 20px; }

/* ---------- Calendar ---------- */
.cal-title { color: var(--ink); font-size: var(--text-lg); line-height: 28px; }
.cal-nav { display: inline-flex; gap: var(--s1); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--line); background: var(--line); overflow: hidden; }
.cal-dow, .cal-day { background: var(--surface); }
.cal-dow { padding: var(--s2) var(--s3); color: var(--muted); font-size: var(--text-xs); line-height: 16px; }
.cal-day { display: grid; align-content: start; gap: var(--s1); min-width: 0; min-height: 112px; padding: var(--s2); }
.cal[data-mode="week"] .cal-day { min-height: 320px; }
.cal-day.is-outside { background: var(--column-bg); }
.cal-day.is-outside .cal-num { opacity: 0.5; }
.cal-num { display: grid; place-content: center; justify-self: start; min-width: 24px; height: 24px; padding: 0 var(--s1); color: var(--ink); font-size: var(--text-xs); }
.cal-day.is-today .cal-num { background: var(--accent); color: var(--on-accent); }
.cal-chip { display: flex; align-items: center; gap: var(--s1); width: 100%; min-width: 0; padding: var(--s1) var(--s2); border: 0; border-left: 3px solid var(--edge, var(--line-strong)); color: var(--ink); background: var(--column-bg); font-size: var(--text-xs); line-height: 16px; text-align: left; cursor: pointer; }
.cal-chip:hover, .cal-chip:active { background: var(--hover); }
.cal-chip[data-status="in_progress"] { --edge: var(--accent); }
.cal-chip[data-status="done"] { --edge: var(--ok); color: var(--muted); }
.cal-chip[data-status="done"] .cal-chip-title { text-decoration: line-through; }
.cal-chip.is-overdue .cal-time { color: var(--danger); }
.cal-time { flex: none; color: var(--muted); }
.cal-chip-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cal-dot { flex: none; width: 8px; height: 8px; background: var(--tag, var(--line-strong)); }
.cal-more { padding: 0 var(--s2); background: transparent; color: var(--muted); font-size: var(--text-xs); line-height: 16px; text-align: left; cursor: pointer; }
.cal-more:hover { color: var(--ink); }

/* ---------- Loading + motion (short, answers an action) ---------- */
.skeleton { background: var(--hover); animation: skeleton-pulse 1.2s ease-in-out infinite; }
.skeleton-card { height: 76px; border: 1px solid var(--line); }
.skeleton-row { height: 48px; margin-bottom: 1px; }

@keyframes skeleton-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes quick-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes quick-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-6px); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes card-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes field-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes check-pop { 0% { transform: scale(0.85); } 100% { transform: scale(1); } }
@keyframes check-draw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }

.page:not([hidden]) { animation: page-in 120ms ease-out; }
.announce-form:not([hidden]) { animation: menu-in 120ms var(--ease); }
.task-dialog-overlay:not([hidden]), .quick-overlay:not([hidden]) { animation: fade-in 120ms ease-out; }
.task-dialog-overlay:not([hidden]) .task-dialog, .quick-add { animation: quick-in 160ms var(--ease); }
.task-dialog-overlay.is-closing, .quick-overlay.is-closing { animation: fade-out 120ms ease-in forwards; }
.task-dialog-overlay.is-closing .task-dialog, .quick-overlay.is-closing .quick-add { animation: quick-out 120ms ease-in forwards; }
.task-card.is-entering, .task-row.is-entering { animation: card-in 160ms var(--ease) backwards; }
.status-check.is-popping { animation: check-pop 140ms ease-out; }
.status-check.is-popping svg { stroke-dasharray: 24; animation: check-draw 180ms ease-out 40ms backwards; }
.is-swapping .kanban-board, .is-swapping .task-list { animation: page-in 120ms ease-out; }
::view-transition-old(root) { animation: fade-out 100ms ease-in both; }
::view-transition-new(root) { animation: page-in 140ms ease-out both; }

/* ---------- Desktop: collapsible sidebar ---------- */
@media (min-width: 721px) {
  .sidebar { overflow: hidden; transition: width 200ms var(--ease); }
  .main-content { transition: width 200ms var(--ease), margin-left 200ms var(--ease); }
  .sidebar-toggle { transition: right 200ms var(--ease); }
  .brand-text, .nav-item > span { transition: opacity 100ms ease; }
  .brand { transition: padding 200ms var(--ease); }
  .brand-mark { transition: opacity 100ms ease; }
  [data-sidebar="collapsed"] .sidebar { width: 72px; }
  [data-sidebar="collapsed"] .main-content { width: calc(100% - 72px); margin-left: 72px; }
  [data-sidebar="collapsed"] .sidebar-toggle { right: 20px; }
  [data-sidebar="collapsed"] .brand-text, [data-sidebar="collapsed"] .nav-item > span { opacity: 0; }
  .sidebar-toggle { transition: right 200ms var(--ease), opacity 100ms ease; }
  [data-sidebar="collapsed"] .brand { padding-left: 27px; }
  [data-sidebar="collapsed"] .sidebar-toggle { opacity: 0; }
  [data-sidebar="collapsed"] .brand:hover .sidebar-toggle,
  [data-sidebar="collapsed"] .sidebar-toggle:focus-visible { opacity: 1; }
  [data-sidebar="collapsed"] .brand:hover .brand-mark { opacity: 0; }
  @media (hover: none) {
    [data-sidebar="collapsed"] .sidebar-toggle { opacity: 1; }
    [data-sidebar="collapsed"] .brand-mark { opacity: 0; }
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  :root { --sidebar-w: 232px; }
  .topbar { padding: 0 var(--s5); }
  .page-container { width: calc(100% - 48px); }
}
@media (max-width: 720px) {
  .sidebar { width: min(280px, 86vw); transform: translateX(-102%); transition: transform 180ms var(--ease); box-shadow: var(--shadow-overlay); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 9; background: var(--scrim); animation: fade-in 120ms ease-out; }
  .nav-item { min-height: 44px; }
  .panel-close, .prop-clear, .icon-button { width: 44px; height: 44px; }
  .task-row .task-delete-btn, .announce-item .task-delete-btn { width: 44px; height: 44px; }
  .task-card .task-delete-btn { width: 44px; height: 44px; margin: -12px -8px -12px 0; }
  .announce-item { grid-template-columns: minmax(0, 1fr) auto 44px; }
  .status-check::after { inset: -14px; }
  .dp-day { height: 40px; }
  .view-tab, .primary-button, .secondary-button, .danger-button { min-height: 44px; }
     .sidebar-toggle { display: none; }
     .sidebar-close { position: absolute; top: 6px; right: var(--s2); display: grid; place-content: center; width: 44px; height: 44px; color: var(--muted); background: transparent; cursor: pointer; }
     .sidebar-close:hover { color: var(--ink); background: var(--hover); }
     .sidebar-close svg { width: 18px; height: 18px; stroke-width: 1.75; }
  .main-content { width: 100%; margin-left: 0; }
  .topbar { padding: 0 var(--s4); }
  .mobile-menu { display: grid; width: 44px; height: 44px; place-content: center; gap: 4px; padding: var(--s2); background: transparent; cursor: pointer; }
  .page-container { width: calc(100% - 32px); padding: var(--s5) 0 var(--s7); }
  .page-actions { width: 100%; flex-wrap: wrap; }
  .search { flex: 1 1 100%; }
  .search input { width: 100%; }
  .kanban-board { grid-template-columns: 1fr; }
  .kanban-column { min-height: 240px; }
  .cal-day { min-height: 80px; padding: var(--s1); }
  .cal-time { display: none; }
  .task-row, .done-row { grid-template-columns: 24px auto minmax(0, 1fr) auto; row-gap: var(--s1); }
  .task-row > :nth-child(1), .done-row > :nth-child(1) { grid-column: 1; grid-row: 1; }
  .task-row > :nth-child(2), .done-row > :nth-child(2) { grid-column: 2 / 4; grid-row: 1; }
  .task-row > :nth-child(5), .done-row > :nth-child(5) { grid-column: 4; grid-row: 1; }
  .task-row > :nth-child(3), .done-row > :nth-child(3) { grid-column: 2; grid-row: 2; align-self: start; }
  .task-row > :nth-child(4), .done-row > :nth-child(4) { grid-column: 3; grid-row: 2; min-width: 0; white-space: normal; line-height: 16px; }
  .task-row:has(> :nth-child(3):empty) > :nth-child(4), .done-row:has(> :nth-child(3):empty) > :nth-child(4) { grid-column: 2 / 4; }
}
@media (max-width: 480px) { .quick-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
@media (prefers-contrast: more) {
  :root { --line: var(--line-strong); }
}

::selection { background: var(--accent-soft); color: var(--ink); }
.primary-button, .secondary-button, .icon-button, .text-input, .search,
.task-card, .task-list, .kanban-column, .announcements, .admin-bar,
.task-dialog, .quick-add, .due-picker, .status-dropdown, .toast, .view-tabs { border-radius: 4px; }
.view-tab:first-child { border-radius: 3px 0 0 3px; }
.view-tab:last-child { border-radius: 0 3px 3px 0; }

/* ---------- Light theme ---------- */
:root[data-theme="light"] {
  color-scheme: light;

  --canvas: #EBEEF2;
  --sidebar: #E1E5EB;
  --surface: #F8F9FB;
  --card-bg: #FBFCFD;
  --column-bg: #E4E8EE;
  --hover: #DADFE7;

  --ink: #1B2430;
  --ink-inv: #F8F9FB;
  --muted: #4B586A;

  --line: #CBD2DC;
  --line-strong: #7B889B;

  --accent: #2B5BC0;
  --accent-hover: #234B9E;
  --accent-soft: #DCE6F8;
  --on-accent: #FFFFFF;

  --ok: #1E7552;
  --ok-soft: #DDEFE6;
  --warn: #86560F;
  --warn-soft: #F6E9CF;
  --danger: #A83E3E;
  --danger-soft: #F6DEDE;

  --scrim: rgba(27, 36, 48, 0.45);
  --shadow-overlay: 0 12px 32px -16px rgba(27, 36, 48, 0.35);
  --toast-action: #A9C2FF;
}

/* Cards read as paper resting on the column: one hairline edge, no blur */
:root[data-theme="light"] .task-card { box-shadow: 0 1px 0 rgba(27, 36, 48, 0.06); }
:root[data-theme="light"] .task-card:hover { box-shadow: 0 1px 0 rgba(27, 36, 48, 0.1); }
:root[data-theme="light"] .nav-item.is-active { box-shadow: inset 0 0 0 1px var(--line), 0 1px 0 rgba(27, 36, 48, 0.05); }
:root[data-theme="light"] .status-check.is-done { color: #FFFFFF; }

:where(svg.i) { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: square; stroke-linejoin: miter; }

/* ---------- Settings ---------- */
.sidebar-footer { margin-top: auto; padding-top: var(--s3); border-top: 1px solid var(--line); }
.nav-item-button { width: 100%; background: transparent; text-align: left; cursor: pointer; }
.settings-body { gap: 0; padding-block: 0; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s5); padding: var(--s4) 0; border-top: 1px solid var(--line); }
.settings-row:first-child { border-top: 0; }
.settings-row > .secondary-button, .settings-row > .danger-button { flex: none; }
.settings-title { margin: 0; color: var(--ink); font-size: var(--text-sm); font-weight: 600; line-height: 20px; }
.settings-desc { margin: var(--s1) 0 0; color: var(--muted); font-size: var(--text-sm); line-height: 20px; }
.settings-confirm { display: grid; gap: var(--s3); padding: 0 0 var(--s4); }
.settings-confirm-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--s4); }
.danger-button { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 36px; padding: 0 var(--s4); border: 1px solid var(--danger); border-radius: 4px; color: var(--danger); background: transparent; font-size: var(--text-sm); font-weight: 600; line-height: 20px; cursor: pointer; }
.danger-button:hover { background: var(--danger-soft); }
.danger-button:disabled { opacity: 0.4; cursor: not-allowed; }
.danger-button:disabled:hover { background: transparent; }
.danger-button.is-solid:not(:disabled), .danger-button.is-solid:not(:disabled):hover { color: var(--on-accent); background: var(--danger); }
@media (max-width: 720px) {
  .settings-row { flex-direction: column; align-items: flex-start; gap: var(--s3); }
}

/* Visible focus for fields that removed the default outline */
.dialog-doc:focus-visible, .dialog-title-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.quick-input:focus-visible { outline: 0; box-shadow: 0 2px 0 0 var(--accent); }

/* ---------- First-time tutorial ---------- */
.tour-overlay { position: fixed; inset: 0; z-index: 300; }
.tour-overlay.is-centered { background: var(--scrim); }
.tour-overlay:not([hidden]) { animation: fade-in 120ms ease-out; }
.tour-overlay.is-closing { animation: fade-out 120ms ease-in forwards; }
.tour-spot { position: fixed; border-radius: 4px; pointer-events: none; box-shadow: 0 0 0 200vmax var(--scrim), 0 0 0 2px var(--accent); transition: top 160ms var(--ease), left 160ms var(--ease), width 160ms var(--ease), height 160ms var(--ease); }
.tour-overlay.is-centered .tour-spot { display: none; }
.tour-card { position: fixed; display: grid; gap: var(--s3); width: min(360px, calc(100vw - var(--s4) * 2)); padding: var(--s4) var(--s5); border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); box-shadow: var(--shadow-overlay); }
.tour-text { display: grid; gap: var(--s2); }
.tour-step { margin: 0; color: var(--muted); font-family: var(--font-mono); font-size: var(--text-xs); line-height: 16px; }
.tour-title { font-size: var(--text-md); line-height: 24px; }
.tour-body { margin: 0; color: var(--ink); font-size: var(--text-sm); line-height: 20px; }
.tour-sample-card { cursor: default; }
.tour-sample-card .task-card-header { position: relative; }
.tour-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--s3); }
.tour-actions #tour-skip { margin-right: auto; }

/* ---------- Transfer ---------- */
.transfer-qr-frame { display: grid; justify-self: center; width: fit-content; max-width: 100%; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; background: #FFFFFF; }
.transfer-qr-frame canvas { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
.transfer-link-row { display: flex; gap: var(--s2); }
.transfer-link-row .text-input { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: var(--text-xs); }
.transfer-countdown { margin: 0; color: var(--muted); font-family: var(--font-mono); font-size: var(--text-xs); font-variant-numeric: tabular-nums; line-height: 20px; text-align: center; }
.import-summary { margin: 0; padding-left: var(--s5); list-style: square; font-size: var(--text-sm); line-height: 20px; }
.import-summary li + li { margin-top: var(--s1); }
.import-check { display: flex; align-items: flex-start; gap: var(--s3); font-size: var(--text-sm); line-height: 20px; cursor: pointer; }
.import-check input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); }
.import-note { margin: 0; color: var(--muted); font-size: var(--text-sm); line-height: 20px; }
@media (max-width: 720px) { .transfer-link-row { flex-direction: column; } }