/* Project Portal by KoozWorks — compact, high-contrast working UI.
   Roboto is self-hosted (Apache-2.0, see assets/fonts/LICENSE-Roboto-Apache-2.0.txt). */
@font-face { font-family: "Roboto"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/roboto-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/roboto-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/roboto-latin-700-normal.woff2") format("woff2"); }

:root, [data-theme="light"] {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --surface-2: #f0f2f4;
  --surface-raised: #ffffff;
  --border: #dadce0;
  --border-strong: #80868b;
  --text: #1f1f1f;
  --text-2: #444746;
  --text-3: #5f6368;
  --primary: #0b57d0;
  --primary-hover: #0842a0;
  --on-primary: #ffffff;
  --primary-soft: #e8f0fe;
  --on-primary-soft: #0842a0;
  --selected: #d3e3fd;
  --on-selected: #041e49;
  --focus: #0b57d0;
  --ok: #146c2e;      --ok-soft: #e6f4ea;
  --warn: #7a4a00;    --warn-soft: #fef3d6;
  --bad: #b3261e;     --bad-soft: #fce8e6;
  --info: #0b57d0;    --info-soft: #e8f0fe;
  --muted-soft: #eceff1; --muted: #444746;
  --rec: #c5221f;
  --shadow: 0 1px 2px rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15);
  --brand-green: #1f4d2b;
  --brand-gold: #c9a646;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #1b1c1f;
  --surface: #222326;
  --surface-2: #2b2c30;
  --surface-raised: #2b2c30;
  --border: #44474c;
  --border-strong: #80868b;
  --text: #e8eaed;
  --text-2: #c4c7c5;
  --text-3: #a8acb0;
  --primary: #a8c7fa;
  --primary-hover: #c2d7fb;
  --on-primary: #062e6f;
  --primary-soft: #26344a;
  --on-primary-soft: #d3e3fd;
  --selected: #33496b;
  --on-selected: #eef3fd;
  --focus: #a8c7fa;
  --ok: #7fd99a;      --ok-soft: #1f3326;
  --warn: #f3c46b;    --warn-soft: #3b3020;
  --bad: #f2b8b5;     --bad-soft: #43282a;
  --info: #a8c7fa;    --info-soft: #26344a;
  --muted-soft: #33353a; --muted: #c4c7c5;
  --rec: #ff8a80;
  --shadow: 0 1px 3px rgba(0,0,0,.6), 0 4px 10px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Roboto", system-ui, "Segoe UI", Arial, sans-serif;
  font-size: 14px; line-height: 1.43; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.boot { padding: 24px; color: var(--text-2); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 48px; display: flex; align-items: center; gap: 8px;
  padding: 0 8px 0 12px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); min-width: 0; }
.brand img { width: 28px; height: 28px; flex: none; }
.brand-name { font-weight: 500; font-size: 16px; white-space: nowrap; }
.brand-by { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.edition-chip {
  font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 8px; white-space: nowrap;
  border: 1px dashed var(--border-strong); color: var(--text-2); background: transparent;
}
.spacer, .topbar .spacer { flex: 1; }
.dialog-err { padding: 0 16px; }
.dialog-err .callout { margin-bottom: 10px; }
.iconbtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 36px; height: 36px; padding: 0 8px; border: 0; border-radius: 18px; background: transparent; color: var(--text-2); cursor: pointer;
  text-decoration: none; font-size: 13px;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.count-badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--bad); color: var(--bg); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
[data-theme="dark"] .count-badge { color: #1b1c1f; }
.menu {
  position: absolute; right: 8px; top: 44px; min-width: 220px; background: var(--surface-raised); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 6px 0; z-index: 40;
}
.menu h3 { font-size: 12px; font-weight: 500; color: var(--text-3); margin: 6px 14px 4px; text-transform: uppercase; letter-spacing: .04em; }
.menu .menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px; border: 0; background: none; text-align: left; cursor: pointer; color: var(--text); text-decoration: none; }
.menu .menu-item:hover, .menu .menu-item:focus-visible { background: var(--surface-2); }
.menu .menu-item[aria-checked="true"] { color: var(--on-primary-soft); background: var(--primary-soft); font-weight: 500; }
.menu .menu-note { padding: 4px 14px 8px; color: var(--text-3); font-size: 12px; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

/* ---------- layout ---------- */
main { min-height: calc(100vh - 48px); }
.page { padding: 8px 12px 24px; max-width: 1400px; margin: 0 auto; }
.toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 0; }
.toolbar .grow { flex: 1 1 160px; min-width: 140px; }
.page-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0 2px; }
.page-head h1 { font-size: 18px; font-weight: 500; margin: 0; line-height: 28px; }
.page-head .crumb { color: var(--text-2); text-decoration: none; font-size: 13px; }
.page-head .crumb:hover { text-decoration: underline; }
.subtle { color: var(--text-2); }
.small { font-size: 12px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px;
  border-radius: 16px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--primary);
  font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; font-size: 13px;
}
.btn:hover { background: var(--primary-soft); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--bad); }
.btn.text { border-color: transparent; background: transparent; padding: 0 8px; }
.btn.text:hover { background: var(--primary-soft); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn.mic { background: var(--primary); color: var(--on-primary); border-color: var(--primary); height: 40px; border-radius: 20px; padding: 0 18px; font-size: 14px; }
.btn.rec { background: var(--rec); border-color: var(--rec); color: #fff; }
[data-theme="dark"] .btn.rec { color: #1b1c1f; }
input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="date"], input[type="url"], input[type="number"], select, textarea {
  height: 32px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg); color: var(--text); min-width: 0;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; width: 100%; line-height: 1.4; }
select { padding-right: 6px; max-width: 220px; text-overflow: ellipsis; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: var(--focus); }
label.field { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); font-weight: 500; }
label.field > input, label.field > select, label.field > textarea { font-size: 14px; font-weight: 400; width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 16px; overflow: hidden; height: 32px; }
.seg button { border: 0; background: var(--bg); color: var(--text-2); padding: 0 12px; cursor: pointer; font-weight: 500; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--selected); color: var(--on-selected); }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--muted-soft); color: var(--muted); }
.st-open { background: var(--muted-soft); color: var(--muted); }
.st-in_progress { background: var(--info-soft); color: var(--info); }
.st-blocked { background: var(--bad-soft); color: var(--bad); }
.st-awaiting_review { background: var(--warn-soft); color: var(--warn); }
.st-done { background: var(--ok-soft); color: var(--ok); }
.st-cancelled { background: var(--muted-soft); color: var(--text-3); text-decoration: line-through; }
.st-active { background: var(--info-soft); color: var(--info); }
.st-planning { background: var(--muted-soft); color: var(--muted); }
.st-on_hold { background: var(--warn-soft); color: var(--warn); }
.due-overdue { color: var(--bad); font-weight: 500; }
.due-soon { color: var(--warn); font-weight: 500; }
.undated { color: var(--text-3); font-style: italic; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: none; }
.pill { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; padding: 0 6px; height: 18px; border-radius: 9px; }
.pill.unread { background: var(--primary); color: var(--on-primary); }
.pill.waiting { background: var(--warn-soft); color: var(--warn); border: 1px solid currentColor; }
.role-chip { font-size: 11px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border-strong); color: var(--text-2); white-space: nowrap; }

/* ---------- project rows ---------- */
.rows { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg); }
.rows-head, .prow { display: grid; grid-template-columns: minmax(160px, 2fr) 92px minmax(160px, 2.2fr) minmax(110px, 1.2fr) 124px 56px; gap: 10px; align-items: center; padding: 0 12px; }
.rows-head { height: 32px; font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--surface); border-bottom: 1px solid var(--border); }
.prow { min-height: 48px; padding-top: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); cursor: pointer; }
.prow:last-child { border-bottom: 0; }
.prow:hover { background: var(--surface); }
.prow:focus-visible { outline-offset: -2px; background: var(--primary-soft); }
.prow .pname { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .psub, .cell-sub { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .ind { display: flex; gap: 4px; justify-content: flex-end; }
.lbl { display: none; }

/* ---------- project view: list + detail ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { flex: none; padding: 0 12px; height: 36px; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; border: 0; background: none; border-bottom: 3px solid transparent; font-weight: 500; cursor: pointer; font-size: 13px; }
.tabs a[aria-current="page"], .tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover, .tabs button:hover { background: var(--surface); }

.split { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; height: calc(100vh - 48px - 132px); min-height: 420px; background: var(--bg); }
.split .listpane { border-right: 1px solid var(--border); overflow-y: auto; background: var(--bg); }
.split .detailpane { overflow-y: auto; background: var(--bg); }
.group-h { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; padding: 4px 12px; font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--surface); border-bottom: 1px solid var(--border); }
.group-h.overdue { color: var(--bad); }
.trow { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 7px 12px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); cursor: pointer; border-left: 3px solid transparent; }
.trow:hover { background: var(--surface); }
.trow[aria-current="true"] { background: var(--selected); color: var(--on-selected); border-left-color: var(--primary); }
.trow[aria-current="true"] .cell-sub { color: var(--on-selected); }
.trow:focus-visible { outline-offset: -2px; }
.trow .ttitle { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .tdue { font-size: 12px; text-align: right; white-space: nowrap; }
.trow .tmeta { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.empty { padding: 24px 16px; color: var(--text-2); text-align: center; }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; font-weight: 500; }

.detail { padding: 12px 16px 24px; }
.detail-head { display: flex; gap: 8px; align-items: flex-start; }
.detail-head h2 { font-size: 18px; font-weight: 500; margin: 0; flex: 1; line-height: 26px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 6px 0 10px; font-size: 13px; color: var(--text-2); }
.meta-line b { color: var(--text); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.desc { white-space: pre-wrap; margin: 6px 0 12px; }
.section { margin-top: 14px; }
.section h3 { font-size: 13px; font-weight: 500; color: var(--text-2); margin: 0 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.card + .card { margin-top: 8px; }
.callout { border-radius: 8px; padding: 8px 12px; font-size: 13px; border: 1px solid; }
.callout.warn { background: var(--warn-soft); color: var(--text); border-color: var(--warn); }
.callout.info { background: var(--info-soft); color: var(--text); border-color: var(--info); }
.callout.bad { background: var(--bad-soft); color: var(--text); border-color: var(--bad); }
.callout.ok { background: var(--ok-soft); color: var(--text); border-color: var(--ok); }
.callout + .callout { margin-top: 6px; }
.back-link { display: none; }

/* timeline / comments */
.feed { list-style: none; margin: 0; padding: 0; }
.feed > li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.feed > li:last-child { border-bottom: 0; }
.feed .who { font-weight: 500; }
.feed .when { color: var(--text-3); font-size: 12px; margin-left: 6px; }
.feed .body { white-space: pre-wrap; margin-top: 2px; overflow-wrap: anywhere; }
.feed .reply { margin-left: 20px; padding-left: 10px; border-left: 2px solid var(--border); }
.feed li.highlight { background: var(--primary-soft); border-radius: 6px; padding-left: 8px; padding-right: 8px; }
.mention { color: var(--on-primary-soft); background: var(--primary-soft); border-radius: 4px; padding: 0 3px; font-weight: 500; }
.composer { position: relative; margin-top: 8px; }
.composer .row { display: flex; gap: 6px; justify-content: space-between; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.ac-list { position: absolute; left: 8px; bottom: 100%; margin: 0 0 4px; padding: 4px 0; list-style: none; min-width: 240px; max-height: 220px; overflow-y: auto; background: var(--surface-raised); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); z-index: 30; }
.ac-list li { padding: 6px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.ac-list li[aria-selected="true"] { background: var(--selected); color: var(--on-selected); }
.ac-list li .role-chip { border-color: currentColor; color: inherit; }
.replying { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }

/* report review */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 12px; overflow-y: auto; }
.dialog { width: min(720px, 100%); background: var(--bg); color: var(--text); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.dialog > header { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.dialog > header h2 { font-size: 16px; font-weight: 500; margin: 0; flex: 1; }
.dialog .dbody { padding: 12px 16px; display: grid; gap: 12px; }
.dialog > footer { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.voice-box { display: grid; gap: 8px; }
.rec-state { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--rec); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--rec); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.transcript { border: 1px dashed var(--border-strong); border-radius: 8px; padding: 8px 10px; min-height: 40px; white-space: pre-wrap; background: var(--surface); }
.source-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 4px; }
.source-tag.voice { background: var(--ok-soft); color: var(--ok); }
.source-tag.typed { background: var(--muted-soft); color: var(--muted); }
.proposal { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: grid; gap: 8px; }
.proposal.needs { border-color: var(--warn); }
.proposal .excerpt { font-style: italic; color: var(--text-2); }
.status-change { font-size: 13px; color: var(--text-2); }
.status-change b { color: var(--text); }
.diag { font-size: 12px; color: var(--text-2); }
.diag dt { font-weight: 500; color: var(--text); }
.diag dd { margin: 0 0 6px; }

/* calendar */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 12px; }
.cal-head { display: flex; align-items: center; gap: 6px; padding: 6px 0; }
.cal-head h2 { font-size: 16px; font-weight: 500; margin: 0 8px; min-width: 140px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal .dow { font-size: 11px; font-weight: 500; color: var(--text-2); text-align: center; padding: 4px 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); }
.cal .day { min-height: 84px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 2px 3px; overflow: hidden; }
.cal .day.other { background: var(--surface); }
.cal .day.other .dnum { color: var(--text-3); }
.cal .dnum { font-size: 12px; color: var(--text-2); display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 11px; }
.cal .day.today .dnum { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.cal-chip { display: block; width: 100%; text-align: left; font-size: 11px; line-height: 16px; padding: 1px 4px; margin-top: 2px; border-radius: 4px; border: 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip[aria-current="true"] { outline: 2px solid var(--primary); outline-offset: -1px; }
.unsched { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; align-self: start; }
.unsched h3 { margin: 0; padding: 8px 12px; font-size: 13px; font-weight: 500; background: var(--surface); border-bottom: 1px solid var(--border); }
.unsched .trow { grid-template-columns: 1fr; }

/* tables (audit, payments, docs) */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 12px; padding: 6px 8px; background: var(--surface); border-bottom: 1px solid var(--border); }
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl-wrap { border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 6px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 24px); }
.toast.error { background: var(--bad); color: #fff; }
[data-theme="dark"] .toast.error { color: #1b1c1f; }

/* login */
.login { max-width: 380px; margin: 48px auto; padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.login h1 { font-size: 20px; font-weight: 500; margin: 12px 0 4px; }
.login form { display: grid; gap: 12px; margin-top: 16px; }

.notif { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: start; padding: 10px 12px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.notif:hover { background: var(--surface); }
.notif.unread .nsum { font-weight: 500; }
.notif.read .dot { visibility: hidden; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .rows-head, .prow { grid-template-columns: minmax(150px, 1.6fr) 84px minmax(150px, 2fr) minmax(100px, 1fr) 100px 56px; gap: 8px; }
}
@media (max-width: 860px) {
  .brand-by { display: none; }
  .rows-head { display: none; }
  .prow { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name name due" "next next next" "meta status ind"; gap: 2px 8px; padding: 8px 12px; }
  .prow .c-name { grid-area: name; } .prow .c-due { grid-area: due; text-align: right; }
  .prow .c-name .pname { white-space: normal; overflow-wrap: anywhere; }
  .prow .c-next { grid-area: next; } .prow .c-status { grid-area: status; justify-self: end; }
  .prow .c-person { grid-area: meta; font-size: 12px; color: var(--text-2); } .prow .ind { grid-area: ind; }
  .prow .c-next .cell-sub { display: inline; }
  .prow .c-next .cell-sub::before { content: " · "; }
  .lbl { display: inline; color: var(--text-3); }
  .split { display: block; height: auto; min-height: 0; border: 0; border-radius: 0; overflow: visible; }
  .split .listpane { border: 1px solid var(--border); border-radius: 8px; overflow: visible; }
  .split.show-detail .listpane { display: none; }
  .split:not(.show-detail) .detailpane { display: none; }
  .split .detailpane { border: 1px solid var(--border); border-radius: 8px; overflow: visible; }
  .group-h { top: 48px; }
  .back-link { display: inline-flex; }
  .cal-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .page { padding: 4px 8px 24px; }
  .brand-name { font-size: 15px; }
  .topbar { gap: 2px; padding: 0 4px 0 8px; }
  .iconbtn .lbl-txt { display: none; }
  .cal .day { min-height: 56px; }
  .cal-chip { font-size: 10px; padding: 0 2px; }
  .detail { padding: 10px 10px 20px; }
  .dialog-backdrop { padding: 0; }
  .dialog { border-radius: 0; min-height: 100%; }
  .toolbar select { max-width: 46%; }
}
.cell-sub.due-overdue, .tdue.due-overdue { color: var(--bad); }
.cell-sub.due-soon, .tdue.due-soon { color: var(--warn); }
.menu .menu-item svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.menu .menu-item .ic-space { display: inline-block; width: 18px; flex: none; }

/* ---------- main navigation ---------- */
.mainnav { display: flex; align-items: center; gap: 2px; margin-left: 12px; }
.navlink {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 18px;
  color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 13px; white-space: nowrap;
}
.navlink svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.navlink:hover { background: var(--surface-2); color: var(--text); }
.navlink[aria-current="page"] { background: var(--selected); color: var(--on-selected); }
.navlink .count-badge { position: static; margin-left: 2px; }
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1000px) { .user-name { display: none; } }
@media (max-width: 860px) { .brand-name + .brand-by { display: none; } .navlink { padding: 0 10px; } }
@media (max-width: 720px) {
  .mainnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; margin: 0; height: 60px; gap: 0;
    background: var(--bg); border-top: 1px solid var(--border); justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .navlink { flex-direction: column; justify-content: center; gap: 2px; height: 56px; border-radius: 12px; padding: 0 12px; font-size: 11px; flex: 1; max-width: 120px; }
  .navlink .count-badge { position: absolute; top: 4px; left: calc(50% + 4px); right: auto; margin: 0; }
  main { padding-bottom: 72px; }
  .toast { bottom: 76px; }
}
.day-filter { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px;
  padding: 6px 8px 6px 12px; background: var(--primary-soft); color: var(--on-primary-soft); border-bottom: 1px solid var(--border); font-size: 13px; }
.day-filter-actions { display: inline-flex; gap: 2px; }
.cal-chip.more { background: transparent; color: var(--primary); font-weight: 500; }
.cal-chip.more:hover { text-decoration: underline; }
@media (max-width: 860px) { .day-filter { top: 48px; } }
