/* CMF Panel — one stylesheet, no build step. Light and dark are both designed; the toggle wins over the OS setting. */

:root {
  color-scheme: light;
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f9f9f7;
  --border: rgba(11, 11, 11, .10);
  --border-strong: rgba(11, 11, 11, .20);
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7d7b75;
  --accent: #2a78d6;
  --accent-hover: #256abf;
  --accent-ink: #1c5cab;
  --accent-soft: rgba(42, 120, 214, .10);
  --on-accent: #ffffff;
  --good: #0ca30c;
  --good-ink: #006300;
  --warn: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-soft: rgba(208, 59, 59, .09);
  --good-soft: rgba(12, 163, 12, .10);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --shadow: 0 1px 2px rgba(11, 11, 11, .04), 0 6px 20px rgba(11, 11, 11, .04);
  --shadow-pop: 0 12px 40px rgba(11, 11, 11, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 236px;
  --tabbar-h: 58px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #222221;
    --border: rgba(255, 255, 255, .10);
    --border-strong: rgba(255, 255, 255, .22);
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #918f88;
    --accent: #3987e5;
    --accent-hover: #5598e7;
    --accent-ink: #86b6ef;
    --accent-soft: rgba(57, 135, 229, .16);
    --good-ink: #2fbf2f;
    --critical: #e66767;
    --critical-soft: rgba(230, 103, 103, .13);
    --good-soft: rgba(12, 163, 12, .16);
    --grid: #2c2c2a;
    --axis: #383835;
    --series-1: #3987e5;
    --series-2: #d95926;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #222221;
  --border: rgba(255, 255, 255, .10);
  --border-strong: rgba(255, 255, 255, .22);
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #918f88;
  --accent: #3987e5;
  --accent-hover: #5598e7;
  --accent-ink: #86b6ef;
  --accent-soft: rgba(57, 135, 229, .16);
  --good-ink: #2fbf2f;
  --critical: #e66767;
  --critical-soft: rgba(230, 103, 103, .13);
  --good-soft: rgba(12, 163, 12, .16);
  --grid: #2c2c2a;
  --axis: #383835;
  --series-1: #3987e5;
  --series-2: #d95926;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, .6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 .75em; }
img { max-width: 100%; }
.icon { flex: none; vertical-align: -4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 16px; font-weight: 700; font-size: 16px; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-sep { height: 1px; background: var(--border); margin: 8px 10px; }
.sidebar-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--radius-sm); color: var(--text); min-width: 0; flex: 1; }
.user-chip:hover { background: var(--surface-2); text-decoration: none; }
.user-chip .who { min-width: 0; line-height: 1.25; }
.user-chip .who b { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 26px 28px 56px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tabbar { display: none; }

/* ---------- Building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px 0; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 12px 18px 16px; }
.card-foot { padding: 10px 18px 14px; border-top: 1px solid var(--border); font-size: 13.5px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px 14px; box-shadow: var(--shadow); color: var(--text); }
a.tile:hover { text-decoration: none; border-color: var(--border-strong); }
.tile-label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.tile-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: 6px; }
.tile-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.delta-up { color: var(--good-ink); font-weight: 600; }
.delta-bad { color: var(--critical); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--critical); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field > label, .label { font-size: 13px; font-weight: 550; color: var(--text-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.select { appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%237d7b75' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1.5 1.5 4.5 4.5 4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }

.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .input, .filters .select { width: auto; min-height: 36px; font-size: 14px; padding-top: 5px; padding-bottom: 5px; }
.filters .search { flex: 1 1 180px; max-width: 280px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; }
.seg a, .seg button {
  border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 13px; font-weight: 550;
  padding: 5px 11px; border-radius: 7px; color: var(--text-2); white-space: nowrap;
}
.seg a:hover, .seg button:hover { color: var(--text); text-decoration: none; }
.seg .on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(11, 11, 11, .12); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.badge-critical { background: var(--critical-soft); color: var(--critical); border-color: transparent; }
.badge-good { background: var(--good-soft); color: var(--good-ink); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.dot-urgent { background: var(--critical); }
.dot-high { background: var(--serious); }
.dot-normal { background: var(--accent); }
.dot-low { background: var(--axis); }

.avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; background: var(--muted); object-fit: cover; }
.avatar-sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }
img.avatar { background: var(--surface-2); }

.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid var(--border); background: var(--surface); font-size: 14px; }
.flash-ok { border-color: transparent; background: var(--good-soft); }
.flash-ok .icon { color: var(--good-ink); }
.flash-error { border-color: transparent; background: var(--critical-soft); }
.flash-error .icon { color: var(--critical); }
.flash .copy-row { display: flex; gap: 8px; margin-top: 8px; }
.flash .copy-row .input { font-size: 13px; min-height: 34px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); font-size: 13.5px; margin-bottom: 14px; }
.notice .icon { color: var(--accent-ink); margin-top: 1px; }

.empty { padding: 30px 18px; text-align: center; color: var(--muted); font-size: 14px; }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th a { color: inherit; }
.table th a.on { color: var(--text); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table th.right, .table td.right { text-align: right; }
.table td:first-child, .table th:first-child { padding-left: 18px; }
.table td:last-child, .table th:last-child { padding-right: 18px; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-main:hover { color: var(--accent-ink); }
.cell-sub { font-size: 12.5px; color: var(--muted); max-width: 460px; }
.spark { display: block; }
.spark-bar { fill: var(--series-1); }
.spark-zero { fill: var(--axis); }
.spark-base { stroke: var(--axis); stroke-width: 1; }

/* ---------- Feeds ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 11px; padding: 11px 18px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.feed li:last-child { border-bottom: 0; }
.feed .body { min-width: 0; flex: 1; }
.feed .title { font-weight: 550; overflow-wrap: anywhere; color: var(--text); }
a.title:hover { color: var(--accent-ink); }
.feed .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.feed .when { font-size: 12.5px; color: var(--muted); white-space: nowrap; flex: none; padding-top: 2px; }
.feed .ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.feed .rank { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.feed .figure { flex: none; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.feed .figure small { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); }
.day-head { padding: 14px 18px 6px; font-size: 12.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.src { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--text-2); }
.src-hf { color: #b45309; }
:root[data-theme="dark"] .src-hf { color: #eda100; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .src-hf { color: #eda100; } }

/* ---------- Bar list (ranked values, no JS) ---------- */
.barlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.barlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; font-size: 14px; }
.barlist .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.barlist .val { font-variant-numeric: tabular-nums; font-weight: 600; }
.barlist .track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.barlist .fill { display: block; height: 100%; border-radius: 3px; background: var(--series-1); min-width: 3px; }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 260px; }
.chart-box.short { height: 200px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 14px; padding: 0 16px; }

/* ---------- Kanban ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; display: flex; flex-direction: column; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-weight: 650; font-size: 14px; }
.col-head .count { color: var(--muted); font-weight: 600; font-size: 13px; }
.col-body { padding: 4px 8px 10px; display: flex; flex-direction: column; gap: 8px; min-height: 70px; }
.col.drop-over { border-color: var(--accent); background: var(--accent-soft); }
.task {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 12px; color: var(--text); box-shadow: 0 1px 2px rgba(11, 11, 11, .04);
}
.task:hover { text-decoration: none; border-color: var(--border-strong); }
.task[draggable="true"] { cursor: grab; }
.task.dragging { opacity: .45; }
.task-title { font-weight: 550; line-height: 1.35; overflow-wrap: anywhere; }
.task.is-done .task-title { color: var(--muted); text-decoration: line-through; }
.task-meta { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.task-meta .spacer { flex: 1; }
.task-due.overdue { color: var(--critical); font-weight: 600; }
.task-project { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.col-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 14px 6px; border: 1px dashed var(--border-strong); border-radius: 10px; }
.col-tabs { display: none; }

/* ---------- Dialog ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 16px; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); box-shadow: var(--shadow-pop); }
dialog.modal::backdrop { background: rgba(11, 11, 11, .45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.modal-body { padding: 8px 18px 18px; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 28px 26px 24px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin-bottom: 20px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card .lead { color: var(--muted); margin-bottom: 18px; font-size: 14px; }
.auth-foot { margin-top: 14px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------- Task page ---------- */
.status-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.status-pick button { min-height: 40px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px; }
.status-pick button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment:last-of-type { border-bottom: 0; }
.comment .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.history { list-style: none; margin: 0; padding: 0; font-size: 13.5px; color: var(--text-2); }
.history li { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.history li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 18px; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); font: inherit; font-weight: 550; cursor: pointer; text-align: left; }
.menu-list li:last-child a, .menu-list li:last-child button { border-bottom: 0; }
.menu-list a:hover { text-decoration: none; background: var(--surface-2); }
.pager { display: flex; justify-content: space-between; gap: 10px; padding: 14px 18px; }
.fab { display: none; }

/* ---------- Phone and small tablet ---------- */
@media (max-width: 900px) {
  .app { display: block; }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    height: 52px; padding: 0 14px; padding-top: env(safe-area-inset-top);
    box-sizing: content-box;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .topbar .brand { padding: 0; font-size: 15px; }
  .topbar .grow { flex: 1; }
  .content { padding: 16px 14px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px); }
  h1 { font-size: 20px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-top: 1px solid var(--border);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 600; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--accent-ink); }
  .cols, .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }  /* no orphan half-width tile */
  .tile { padding: 13px 13px 12px; }
  .tile-value { font-size: 23px; }
  .chart-box { height: 220px; }
  .hide-sm { display: none !important; }
  .card-head { padding: 14px 14px 0; }
  .card-body { padding: 10px 14px 14px; }
  .card-pad { padding: 14px; }
  .feed li { padding: 11px 14px; }
  .day-head { padding: 12px 14px 4px; }
  .table td:first-child, .table th:first-child { padding-left: 14px; }
  .table td:last-child, .table th:last-child { padding-right: 14px; }
  .table td, .table th { padding-left: 8px; padding-right: 8px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .filters .search { max-width: none; flex-basis: 100%; }

  /* board: one column per screen, swipe between them */
  .board { grid-template-columns: repeat(4, 86vw); scroll-snap-type: x mandatory; gap: 10px; margin: 0 -14px; padding: 0 14px 8px; scroll-padding: 0 14px; }
  .col { scroll-snap-align: start; }
  .col-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -14px 10px; padding: 0 14px; scrollbar-width: none; }
  .col-tabs::-webkit-scrollbar { display: none; }
  .col-tabs a { flex: none; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; }
  .col-tabs a:hover { text-decoration: none; }
  .col-tabs a b { color: var(--muted); font-weight: 600; margin-left: 3px; }
  .fab {
    display: grid; place-items: center; position: fixed; right: 16px; z-index: 25;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px);
    width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 20px rgba(42, 120, 214, .45);
  }
  .status-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  dialog.modal { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .input, .select, .textarea { font-size: 16px; } /* iOS zooms into smaller fields */
}

@media (max-width: 380px) {
  .tile-value { font-size: 21px; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .nav a, .task, .tile { transition: background-color .12s, border-color .12s, color .12s; }
}
