/* plaud-kanban:managed — Plaud Kanban styles. No build step; CSP style-src 'self' (no inline styles).
   Desktop >= 768px: sidebar + board. Phone < 768px: separate layout (drawer, tabs + swipe, sheets). */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eceef2;
  --text: #1c1f24;
  --muted: #69707c;
  --border: #d9dce2;
  --accent: #2f5fd0;
  --accent-weak: #e3ebfb;
  --accent-text: #ffffff;
  --danger: #c53030;
  --warn-bg: #fff4d6;
  --warn-text: #7a5200;
  --ok: #1f7a3d;
  --p-high: #c53030;
  --p-mid: #b7791f;
  --p-low: #69707c;
  --radius: 10px;
  --shadow: 0 6px 24px rgb(15 20 30 / 0.16);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --surface: #1f2228;
    --surface-2: #191c21;
    --text: #e7e9ee;
    --muted: #9aa1ad;
    --border: #343943;
    --accent: #6b95ff;
    --accent-weak: #25314d;
    --accent-text: #0d1220;
    --danger: #ff7a7a;
    --warn-bg: #3a2f12;
    --warn-text: #ffd479;
    --ok: #6fd48f;
    --p-high: #ff7a7a;
    --p-mid: #f0b44c;
    --shadow: 0 6px 24px rgb(0 0 0 / 0.5);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow-wrap: anywhere;
}
html:has(dialog[open]) { overflow: hidden; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
code { font-size: 13px; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  max-width: 100%;
  min-width: 0;
}
textarea { width: 100%; resize: vertical; field-sizing: content; min-height: 3lh; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 13px; }
.error { background: #fde8e8; color: #8a1c1c; border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.notice { background: var(--accent-weak); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
@media (prefers-color-scheme: dark) { .error { background: #4a1f1f; color: #ffc9c9; } }

/* ---------------------------------------------------------------- buttons, chips, switches */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 5px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-danger { color: var(--danger); }
.btn-small { min-height: 28px; padding: 2px 8px; font-size: 13px; }
.btn:disabled, button:disabled { opacity: .5; cursor: default; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; min-height: 32px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; font-size: 16px;
}
.icon-btn:hover { background: var(--surface-2); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; }
.chip {
  display: inline-flex; align-items: center; min-height: 24px; padding: 1px 8px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-size: 12.5px; color: inherit; cursor: pointer; max-width: 100%;
}
.chip-project { background: var(--accent-weak); border-color: transparent; cursor: default; }
.chip-cand { border-color: var(--accent); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-radio, .chip-check { position: relative; display: inline-flex; }
.chip-radio input, .chip-check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip-radio span, .chip-check span {
  display: inline-flex; align-items: center; justify-content: center; min-height: 30px; min-width: 38px;
  padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 13.5px;
}
.chip-radio input:checked + span, .chip-check input:checked + span {
  background: var(--accent); border-color: var(--accent); color: var(--accent-text);
}
.chip-radio input:focus-visible + span, .chip-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 32px; }
.switch input { width: 34px; height: 20px; margin: 0; accent-color: var(--accent); }
.switch input:disabled + span { color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--accent-weak); color: var(--accent); font-size: 12px; font-weight: 600;
}
.mark { display: inline-block; font-size: 12px; color: var(--warn-text); background: var(--warn-bg); border-radius: 6px; padding: 0 6px; }

/* ---------------------------------------------------------------- sidebar and filters */
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; font-size: 16px; }
.segmented { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented a { flex: 1; text-align: center; padding: 6px 8px; color: var(--text); text-decoration: none; font-size: 14px; }
.segmented a[aria-current="page"] { background: var(--accent); color: var(--accent-text); }
.side-search { width: 100%; }
.projects { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; }
.proj { position: relative; border-radius: 8px; }
.proj > a {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px;
  color: var(--muted); text-decoration: none; border-left: 3px solid transparent;
}
.proj.is-active > a { color: var(--text); }
.proj > a:hover { background: var(--surface); }
.proj.is-selected > a { background: var(--accent-weak); border-left-color: var(--accent); color: var(--text); font-weight: 600; }
.proj.is-dim > a { opacity: .6; }
.proj.is-inbox { border-bottom: 1px solid var(--border); margin-bottom: 4px; padding-bottom: 4px; }
.proj.is-inbox.is-active .badge { background: var(--warn-bg); color: var(--warn-text); }
.proj-name { flex: 1; min-width: 0; }
.proj-note { font-size: 11.5px; color: var(--muted); }
.proj .drop { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; pointer-events: none; }
.proj .drop > .card { display: none; }
.app.is-dragging .proj .drop { pointer-events: auto; }
.proj:has(.drop > .card) > a { outline: 2px solid var(--accent); }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 14px; }
.side-foot form { margin: 0; }
.filters fieldset { border: 0; margin: 0 0 8px; padding: 0; min-width: 0; }
.filters legend { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; padding: 0; }
.filters .dates { display: none; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.filters .period:has(#period-custom:checked) .dates { display: grid; }
.filters .dates label { display: grid; gap: 2px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.filters .dates input { width: 100%; }
.reset-link { font-size: 13px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }

/* ---------------------------------------------------------------- main area, board */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.st-line {
  margin: 0; padding: 4px 16px; font-size: 12.5px; color: var(--muted);
  display: flex; flex-wrap: wrap; column-gap: 14px; row-gap: 2px;
}
.st-line .is-stale { color: var(--warn-text); background: var(--warn-bg); border-radius: 4px; padding: 0 4px; }
.banner { margin: 6px 16px 0; padding: 6px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-text); font-size: 14px; }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; flex-wrap: wrap; }
.board-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex-wrap: wrap; }
.folder { color: var(--muted); font-size: 13px; }
.board-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sort-state { font-size: 13px; color: var(--muted); }
.empty-state { padding: 32px 16px; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 10px; }
.columns { flex: 1; min-height: 0; }
.col { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface-2); border-radius: 12px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 4px 12px; }
.col-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.col-head .count { color: var(--muted); font-size: 13px; }
.col-head .col-add { margin-left: auto; }
.col-list {
  list-style: none; margin: 0; padding: 6px 8px 12px; flex: 1; min-height: 80px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain;
}
.more-item { list-style: none; display: flex; justify-content: center; }

/* ---------------------------------------------------------------- card face */
.card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: start;
  padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; cursor: pointer;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.card-check {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); background: transparent;
  color: transparent; cursor: pointer; font-size: 14px; display: inline-flex; align-items: center; justify-content: center;
}
.card-check:hover { border-color: var(--ok); color: var(--ok); }
.card.is-done .card-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.card.is-done .card-title { color: var(--muted); text-decoration: line-through; }
.card-main { min-width: 0; display: grid; gap: 4px; }
.card-title {
  color: var(--text); text-decoration: none; font-weight: 500; font-size: 14.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.cands { display: flex; flex-wrap: wrap; gap: 4px; }
.card-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.prio {
  min-width: 30px; height: 22px; padding: 0 5px; border-radius: 6px; border: 1px dashed var(--border);
  background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
}
.prio.prio-1, .prio.prio-2, .prio.prio-3 { border: 0; background: var(--p-high); color: #fff; }
.prio.prio-4, .prio.prio-5, .prio.prio-6 { border: 0; background: var(--p-mid); color: #fff; }
.prio.prio-7, .prio.prio-8, .prio.prio-9 { border: 0; background: var(--p-low); color: #fff; }
.card-more { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; min-width: 30px; min-height: 26px; border-radius: 6px; }
.card-more:hover { background: var(--surface-2); color: var(--text); }
.card--ghost { opacity: .35; }
.card--chosen { box-shadow: var(--shadow); }
.card--drag { transform: rotate(1.5deg); }

/* ---------------------------------------------------------------- «Записи Plaud», feed */
.plaud-panel { margin: 0 16px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.plaud-panel > summary { padding: 8px 12px; cursor: pointer; font-size: 14px; }
.panel-body { padding: 0 12px 12px; display: grid; gap: 6px; }
.panel-body h3 { margin-top: 8px; }
.panel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.panel-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 14px; }
.pl-meta, .pl-snippet { color: var(--muted); font-size: 13px; }
.pl-snippet { flex-basis: 100%; }
.pl-actions { display: flex; gap: 6px; }
.feed { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 24px; }
.feed-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; max-width: 820px; }
.feed-rest > summary { cursor: pointer; padding: 8px 0; color: var(--muted); }

/* ---------------------------------------------------------------- dialogs, menus, toast */
.dialog {
  border: 0; border-radius: 14px; padding: 0; width: min(760px, calc(100vw - 32px)); max-height: 90dvh;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow); overscroll-behavior: contain;
}
.dialog::backdrop { background: rgb(10 14 22 / 0.45); }
.form-dialog { width: min(620px, calc(100vw - 32px)); }
.picker-dialog { width: min(440px, calc(100vw - 32px)); padding-bottom: 12px; }
.cd, .card-form { padding: 16px 20px 20px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.cd-head { display: flex; align-items: flex-start; gap: 12px; }
.picker-dialog .cd-head { padding: 16px 16px 8px; }
.cd-title { flex: 1; font-size: 19px; min-width: 0; }
.cd-actions { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.field-inline { display: grid; gap: 2px; font-size: 12.5px; color: var(--muted); }
.field-inline select { color: var(--text); font-size: 14px; }
.cd-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.blk { border-radius: var(--radius); }
.blk > h3 { margin-bottom: 4px; }
.blk > :last-child { margin-bottom: 0; }
.blk ul, .blk ol { margin: 6px 0; padding-left: 22px; }
.blk p { margin: 6px 0; }
/* code blocks scroll inside themselves: a long line must never widen the dialog */
.blk pre { max-width: 100%; overflow-x: auto; margin: 6px 0; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; }
.blk pre code { white-space: pre; }
.blk-todo { background: var(--accent-weak); border-left: 4px solid var(--accent); padding: 10px 14px; font-size: 15.5px; }
.blk-desc { padding: 0 2px; }
.blk-transcript { background: var(--surface-2); padding: 8px 12px; }
.blk-transcript > summary { cursor: pointer; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.transcript { white-space: pre-wrap; font-size: 14px; margin-top: 8px; }
.meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; margin: 0; font-size: 13px; color: var(--muted); }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; color: var(--text); }
.field { display: grid; gap: 4px; font-size: 13.5px; color: var(--muted); min-width: 0; }
.field > input, .field > select, .field > textarea { color: var(--text); font-size: 15px; width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.picker-list { list-style: none; margin: 8px 0 0; padding: 0 8px; max-height: 60dvh; overflow-y: auto; }
.picker-dialog .side-search { margin: 0 16px; width: calc(100% - 32px); }
.picker-item {
  display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; min-height: 40px;
}
.picker-item:hover, .picker-item:focus-visible { background: var(--accent-weak); }
.picker-item.is-inbox { font-weight: 600; }
.picker-item:disabled { color: var(--muted); }
.menu, .prio-pop {
  inset: auto; margin: 0; padding: 6px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.menu { width: 264px; max-height: 80dvh; overflow-y: auto; }
.menu > button, .menu-group > button {
  display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer;
}
.menu > button:hover, .menu-group > button:hover, .menu button:focus-visible { background: var(--accent-weak); }
.menu button[aria-checked="true"] { font-weight: 600; color: var(--accent); }
.menu .danger { color: var(--danger); }
.menu-title { margin: 4px 10px 6px; font-weight: 600; font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.menu-group { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 4px; }
.menu-grid .menu-label { grid-column: 1 / -1; }
.menu-label { display: block; padding: 2px 10px; font-size: 12px; color: var(--muted); }
.prio-chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 6px; }
.prio-chips button {
  min-width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-weight: 600;
}
.prio-chips button:hover, .prio-chips button:focus-visible { border-color: var(--accent); }
.prio-chips button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.prio-pop .prio-chips { max-width: 200px; }
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  padding: 10px 14px; border-radius: 10px; background: #22262e; color: #f3f4f6; box-shadow: var(--shadow); z-index: 20;
}
.copy-buffer { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; }
.toast-undo { border: 0; background: none; color: #9cc0ff; font-weight: 600; cursor: pointer; padding: 4px 6px; min-height: 32px; }

/* ---------------------------------------------------------------- settings page */
.page-settings { background: var(--bg); }
.settings { max-width: 880px; margin: 0 auto; padding: 16px; }
.set-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.set-head h1 { flex: 1; }
.set-account { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.set-account form { margin: 0; }
.set-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; overflow-x: auto; }
.set-tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.set-tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.set-section { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 14px; display: grid; gap: 12px; }
.set-form { display: grid; gap: 12px; }
.set-form fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 12px; margin: 0; display: grid; gap: 8px; min-width: 0; }
.set-form legend { padding: 0 4px; font-weight: 600; color: var(--text); }
.set-form .switch { color: var(--text); }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 14.5px; color: var(--text); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.field-label { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.health { margin: 0; font-size: 14px; }
.proj-admin { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pa-row {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.pa-row.is-inbox { background: var(--surface-2); }
.pa-main { display: grid; gap: 2px; min-width: 0; flex: 1 1 220px; }
.pa-meta { font-size: 13px; color: var(--muted); }
.pa-order { display: flex; gap: 2px; }
.pa-order form { margin: 0; }
.pa-edit, .pa-delete { margin-left: 30px; }
.pa-edit[open], .pa-delete[open] { flex-basis: 100%; margin-left: 0; }
.pa-edit[open] > summary, .pa-delete[open] > summary { margin-bottom: 8px; }
.pa-edit > summary, .pa-delete > summary { cursor: pointer; font-size: 13.5px; color: var(--accent); display: inline-block; margin-right: 12px; }
.pa-delete > summary { color: var(--danger); }
.handle { cursor: grab; color: var(--muted); font-size: 18px; touch-action: none; padding: 4px; }
.pa-row.sortable-ghost { opacity: .4; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.action-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.action-result.is-ok { color: var(--ok); }
.action-result.is-error { color: var(--danger); }
.action-details { display: block; font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- auth pages (templates/auth, module web-auth) */
.auth-page { display: grid; place-items: center; min-height: 100dvh; padding: 16px; }
.auth-card {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 24px 20px; box-shadow: var(--shadow); display: grid; gap: 12px;
}
.auth-brand { margin: 0; font-weight: 700; color: var(--muted); font-size: 14px; }
.auth-title { font-size: 22px; }
.auth-form { display: grid; gap: 12px; }
.auth-field { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.auth-field input { width: 100%; font-size: 16px; min-height: 44px; color: var(--text); }
.auth-submit {
  min-height: 44px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-text);
  font-weight: 600; cursor: pointer;
}
.auth-error { margin: 0; background: #fde8e8; color: #8a1c1c; border-radius: 8px; padding: 8px 12px; }
.auth-notice { margin: 0; background: var(--accent-weak); border-radius: 8px; padding: 8px 12px; }
.auth-hint { margin: 0; font-size: 13px; color: var(--muted); }
.auth-links { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.auth-inline { margin: 0; }
.auth-link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }
@media (prefers-color-scheme: dark) { .auth-error { background: #4a1f1f; color: #ffc9c9; } }

/* ---------------------------------------------------------------- desktop >= 768px */
@media (min-width: 768px) {
  .only-phone { display: none !important; }
  .app { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: 100dvh; }
  .side-col { display: flex; flex-direction: column; min-height: 0; background: var(--surface-2); border-right: 1px solid var(--border); }
  .sidebar {
    position: static; inset: auto; margin: 0; width: auto; height: auto; border: 0; padding: 12px 10px 8px;
    background: transparent; color: inherit; overflow: hidden;
    display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-height: 0;
  }
  .filters {
    position: static; inset: auto; margin: 0; width: auto; height: auto; border: 0; border-top: 1px solid var(--border);
    padding: 10px 12px; background: transparent; color: inherit; display: block; overflow: visible;
  }
  .main { height: 100dvh; }
  .columns {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px;
    padding: 0 16px 16px; overflow-x: auto;
  }
}

/* ---------------------------------------------------------------- phone < 768px */
@media (max-width: 767px) {
  body { font-size: 16px; }
  input, select, textarea { font-size: 16px; }
  .app { display: block; }
  .side-col { display: contents; }
  .sidebar:popover-open {
    position: fixed; inset: 0 auto 0 0; margin: 0; width: min(88vw, 360px); height: 100dvh; max-height: none;
    border: 0; border-radius: 0 14px 14px 0; background: var(--surface-2); color: var(--text);
    display: flex; flex-direction: column; gap: 10px; overflow: hidden;
    padding: calc(10px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
  }
  .sidebar::backdrop, .filters::backdrop, .menu::backdrop { background: rgb(10 14 22 / 0.45); }
  .proj > a { min-height: 48px; }
  .side-foot { min-height: 44px; }
  .sidebar .btn { min-height: 44px; }
  .filters:popover-open {
    position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%; max-height: 88dvh; height: auto;
    border: 0; border-radius: 16px 16px 0 0; background: var(--surface); color: var(--text); overflow-y: auto;
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); display: block;
  }
  .chip-radio span, .chip-check span { min-height: 44px; min-width: 44px; }
  .switch { min-height: 44px; }
  .main { height: 100dvh; }
  .mbar {
    display: flex; align-items: center; gap: 6px; padding: calc(4px + env(safe-area-inset-top)) 8px 4px;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .mbar-title {
    flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 8px;
    border: 0; background: none; font-size: 17px; font-weight: 600; text-align: left; cursor: pointer;
  }
  .mbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .mbar-filter.is-on { background: var(--accent-weak); color: var(--accent); }
  .mbar-filter svg { width: 22px; height: 22px; }
  .st-line { padding: 4px 12px; }
  .banner { margin: 6px 12px 0; }
  .board-head { padding: 6px 12px; }
  .board-head .board-title, .board-head .btn-primary { display: none; }
  .board-head:not(:has(.sort-state)) { display: none; }
  .main[data-view="priority"] .board-head { display: flex; }
  .main[data-view="priority"] .board-head .board-title { display: flex; }
  .plaud-panel { margin: 8px 12px; }
  .tabs { display: flex; background: var(--surface); border-bottom: 1px solid var(--border); }
  .tabs a {
    flex: 1; min-width: 0; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-decoration: none; color: var(--muted); font-size: 13px; border-bottom: 3px solid transparent;
  }
  .tabs a[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
  .tab-count { font-size: 12px; }
  .columns {
    display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .columns::-webkit-scrollbar { display: none; }
  .col { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; border-radius: 0; background: transparent; }
  .col-head { display: none; }
  .col-list { padding: 10px 12px 96px; }
  .card { grid-template-columns: auto minmax(0, 1fr) auto; padding: 6px 4px 6px 6px; }
  .card-check { width: 44px; height: 44px; border-width: 0; position: relative; }
  .card-check::before {
    content: ""; position: absolute; inset: 9px; border: 2px solid var(--border); border-radius: 50%;
  }
  .card.is-done .card-check { background: transparent; color: #fff; }
  .card.is-done .card-check::before { background: var(--ok); border-color: var(--ok); z-index: -1; }
  .card-check { isolation: isolate; }
  .card-side { flex-direction: row; align-items: center; gap: 0; }
  .prio { min-width: 44px; height: 44px; border: 0; background: transparent; }
  .prio.prio-1, .prio.prio-2, .prio.prio-3 { color: var(--p-high); background: transparent; }
  .prio.prio-4, .prio.prio-5, .prio.prio-6 { color: var(--p-mid); background: transparent; }
  .prio.prio-7, .prio.prio-8, .prio.prio-9 { color: var(--p-low); background: transparent; }
  .card-more { min-width: 44px; min-height: 44px; }
  .chip { min-height: 36px; }
  /* every tap target on the phone paths is ≥ 44 px (research/ui-stack.md §4), the small links too */
  .chip-cand, .chip-other { min-height: 44px; }
  .reset-link, .side-foot a, .side-foot .link-btn, .set-account a, .set-account .link-btn, .brand, .health a {
    display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px;
  }
  .segmented a { display: flex; align-items: center; justify-content: center; min-height: 44px; }
  .set-tabs a { display: flex; align-items: center; min-height: 44px; }
  input:not([type="checkbox"], [type="radio"]), select { min-height: 44px; }
  .blk-transcript > summary, .cd-edit details > summary, .pa-edit > summary, .pa-delete > summary { line-height: 44px; }
  .check { min-height: 44px; align-items: center; }
  .check input { margin-top: 0; }
  .feed { padding: 8px 12px 96px; }
  .fab {
    position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 56px; height: 56px;
    border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-text); font-size: 28px;
    box-shadow: var(--shadow); cursor: pointer; z-index: 5;
  }
  .dialog, .form-dialog, .picker-dialog {
    width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0;
  }
  .cd, .card-form { padding: calc(10px + env(safe-area-inset-top)) 14px calc(20px + env(safe-area-inset-bottom)); }
  .cd-head { position: sticky; top: 0; background: var(--surface); padding: 4px 0; z-index: 1; }
  .cd-buttons .btn, .form-actions .btn { min-height: 44px; }
  .field-row { grid-template-columns: 1fr; }
  .cd-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .cd-actions .field-inline:nth-child(2) { grid-column: 1 / -1; order: 1; }
  .field-inline select { width: 100%; min-height: 44px; }
  .picker-list { max-height: none; }
  .picker-item { min-height: 48px; }
  .menu:popover-open, .prio-pop:popover-open {
    position: fixed; inset: auto 0 0 0; width: 100%; max-width: 100%; max-height: 85dvh; overflow-y: auto;
    border-radius: 16px 16px 0 0; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .menu > button, .menu-group > button { min-height: 48px; }
  .prio-chips { justify-content: flex-start; }
  .prio-chips button { min-width: 44px; height: 44px; }
  .prio-pop .prio-chips { max-width: none; }
  .settings { padding: 12px; }
  .set-tabs a { padding: 8px 9px; font-size: 15px; }
  .btn { min-height: 44px; }
}
