/* Layout: one column, iPhone first. Sticky header on top, capture bar + tab bar docked at the bottom
   where the thumb is. Type colours carry meaning; the cobalt accent is for actions only. */
:root {
  --bg: #EEF1F4;
  --surface: #FFFFFF;
  --surface-2: #F6F8FA;
  --ink: #141920;
  --muted: #5B6573;
  --faint: #8A939F;
  --line: #DCE1E7;
  --accent: #2F45C6;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3E7FB;
  --t-deadline: #C2302A;
  --t-reminder: #1F7A4B;
  --t-followup: #6A43B4;
  --t-shopping: #9A6200;
  --t-task: #1F7A4B;
  --t-job: #1C7FC0;
  --t-code: #23649A;
  --t-inbox: #5B6573;
  --danger: #B42318;
  --font-display: 'Bricolage Grotesque', 'Avenir Next', -apple-system, system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, system-ui, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --r: 12px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1217;
    --surface: #171C23;
    --surface-2: #1D232B;
    --ink: #E8ECF1;
    --muted: #A0A9B5;
    --faint: #6F7884;
    --line: #29303A;
    --accent: #8C9CFF;
    --accent-ink: #0E1217;
    --accent-soft: #232A4A;
    --t-deadline: #FF7B72;
    --t-reminder: #5FCB8C;
    --t-followup: #BC9BF5;
    --t-shopping: #F0B44A;
    --t-task: #5FCB8C;
    --t-job: #7CC7FF;
    --t-code: #6FB3EE;
    --t-inbox: #A0A9B5;
    --danger: #FF7B72;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 400 16px/1.45 var(--font-body);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.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; }

/* ---------- header ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--bg); z-index: 20; }
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  padding: 12px var(--gutter-r) 10px var(--gutter-l);
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  margin-top: calc(-1 * env(safe-area-inset-top, 0px));
  display: grid; gap: 10px;
  max-width: 680px; margin-inline: auto;
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.heading { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex-wrap: wrap; }
.heading h1 { font: 700 30px/1.05 var(--font-display); letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.heading span { font-size: 13px; }
.top-actions { display: flex; gap: 4px; align-items: center; flex: none; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: var(--muted);
}
.icon-btn[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; justify-self: start; }
.seg button { border: 0; background: transparent; padding: 5px 14px; border-radius: 7px; font-size: 14px; font-weight: 500; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }

/* ---------- main ---------- */
main {
  max-width: 680px; margin: 0 auto;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  padding-block: 4px calc(170px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 22px;
  outline: none;
}
.summary { font-size: 15px; color: var(--muted); margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.summary b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.summary a { color: inherit; text-decoration: none; }

section.group { display: grid; gap: 8px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-inline: 2px; }
.group-head h2 { margin: 0; font: 600 12px/1.2 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.group-head .link-btn { font-size: 14px; }
.group.quiet .item { background: transparent; border-color: transparent; padding-block: 6px; }
.group.quiet .title { color: var(--muted); }

ul.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.item {
  --tc: var(--t-inbox);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 10px 12px;
}
.item.t-deadline { --tc: var(--t-deadline); }
.item.t-reminder { --tc: var(--t-reminder); }
.item.t-followup { --tc: var(--t-followup); }
.item.t-shopping { --tc: var(--t-shopping); }
.item.t-task { --tc: var(--t-task); }
.item.t-job { --tc: var(--t-job); }
.chip.t-job { --tc: var(--t-job); }
.check {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--tc); background: transparent;
  cursor: pointer; padding: 0; display: grid; place-items: center; flex: none;
}
.t-shopping .check { border-radius: 7px; }
.check svg { width: 16px; height: 16px; stroke: var(--surface); stroke-width: 3; fill: none; opacity: 0; }
.item.done .check { background: var(--tc); }
.item.done .check svg { opacity: 1; }
.item.done .title { text-decoration: line-through; color: var(--faint); }
.body { min-width: 0; cursor: pointer; display: grid; gap: 3px; }
.title { font-weight: 500; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 13px; color: var(--muted); }
.meta .type { color: var(--tc); font-weight: 600; }
.meta .code { font-family: var(--font-mono); font-size: 12px; color: var(--t-code); }
.meta .late { color: var(--t-deadline); font-weight: 600; }
.meta .area { color: var(--faint); }
.pill {
  font: 500 12px/1 var(--font-mono); padding: 6px 8px; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--tc) 12%, transparent); color: var(--tc);
}
.pill.urgent { background: var(--tc); color: var(--surface); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 9px 14px; font-weight: 500; font-size: 15px; cursor: pointer; text-decoration: none;
}
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.danger.armed { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-weight: 500; }

/* Each Today tab has its own colour: Deadline red, Internal green, Follow-up purple, Scheduled light blue. */
.today-seg { display: grid; grid-template-columns: repeat(4, 1fr); justify-self: stretch; }
.today-seg .tab-deadlines { --tc: var(--t-deadline); }
.today-seg .tab-todos { --tc: var(--t-reminder); }
.today-seg .tab-followups { --tc: var(--t-followup); }
.today-seg .tab-jobs { --tc: var(--t-job); }
.today-seg button {
  padding: 7px 4px; font-size: 13px; line-height: 1.15; text-align: center;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 5px;
  border-bottom: 3px solid transparent; border-radius: 7px;
}
.today-seg button[aria-pressed="true"] { color: var(--tc); background: color-mix(in srgb, var(--tc) 10%, var(--surface)); border-bottom-color: var(--tc); box-shadow: none; }
.tab-name { min-width: 0; }
.count-dot {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  font: 600 11px/1 var(--font-mono); font-variant-numeric: tabular-nums;
  color: var(--tc); background: color-mix(in srgb, var(--tc) 14%, transparent);
}
.today-seg button[aria-pressed="true"] .count-dot, .count-dot.alert { color: var(--surface); background: var(--tc); }

/* Card: check | title + details | date block. The date is always top-right, the tab's key number under it. */
.item { align-items: start; }
.item .check { margin-top: 1px; }
.side { display: grid; justify-items: end; align-content: start; gap: 5px; min-width: 96px; }
.side:empty { display: none; }
.side .when { font: 600 13px/1.2 var(--font-body); color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill.quiet { background: transparent; color: var(--faint); padding-inline: 0; }
.nudge-btn { --tc: var(--t-followup); color: var(--tc); border-color: color-mix(in srgb, var(--tc) 45%, var(--line)); }
.meta { align-items: center; }

.pri { display: inline-flex; align-items: center; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 3px 8px; font: 600 11px/1 var(--font-body); cursor: pointer; }
.pri-top { color: var(--surface); background: var(--t-deadline); border-color: var(--t-deadline); }
.pri-mid { color: var(--ink); }
.pri-low { color: var(--faint); }
.meta .no-proj { color: var(--faint); font-style: italic; }
.meta .proj-name { color: var(--t-code); }
.meta .aim-late { color: var(--t-shopping); font-weight: 600; }
/* Header corner: one quiet segmented bar of icons, with the filter as a matching pill underneath. */
.sort-bar, .filter-pill {
  display: flex; gap: 2px; padding: 3px; width: 152px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
}
.sort-btn { flex: 1; height: 30px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--faint); cursor: pointer; transition: background .15s, color .15s; }
.sort-btn .ico { width: 18px; height: 18px; }
.sort-btn:hover { color: var(--ink); }
.sort-btn[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgb(0 0 0 / 0.10), 0 0 0 0.5px rgb(0 0 0 / 0.04); }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -1px; margin-right: 3px; }
.sort-current { margin-left: 6px; font-size: 13px; color: var(--muted); }
.meta .person { color: var(--ink); }
.sort-label { font: 600 12px/1.2 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.window-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.window-grid > div { min-width: 0; }
.area-row { grid-template-columns: 1fr auto auto; padding: 6px 8px; }
.area-row input.area-name { background: transparent; border-color: transparent; font-weight: 500; padding: 6px 8px; }
.area-row input.area-name:focus { background: var(--surface-2); border-color: var(--line); }
.area-seg { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.area-seg button { white-space: nowrap; }
.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.triage { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 2 / -1; }
.triage button { --tc: var(--t-inbox); border: 1px solid color-mix(in srgb, var(--tc) 40%, var(--line)); color: var(--tc); background: transparent; }
.triage button[data-type="deadline"] { --tc: var(--t-deadline); }
.triage button[data-type="reminder"] { --tc: var(--t-reminder); }
.triage button[data-type="followup"] { --tc: var(--t-followup); }
.triage button[data-type="shopping"] { --tc: var(--t-shopping); }
.triage button[data-type="task"] { --tc: var(--t-task); }

.callout {
  background: var(--surface); border: 1px dashed color-mix(in srgb, var(--t-task) 55%, var(--line));
  border-radius: var(--r); padding: 12px 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
}
.callout p { margin: 0; }
.callout .mono { color: var(--t-task); font-weight: 500; }
.notice { background: var(--accent-soft); border-radius: var(--r); padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.notice p { margin: 0; }

.empty { text-align: left; color: var(--muted); padding: 18px 4px; display: grid; gap: 8px; }
.empty h3 { margin: 0; color: var(--ink); font: 600 18px/1.2 var(--font-display); }
.empty p { margin: 0; max-width: 46ch; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; }
.examples button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; color: var(--ink); }

details.done-list summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px 2px; }
details.done-list ul { margin-top: 8px; }

/* projects + settings */
.proj { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.proj .code { font: 500 15px var(--font-mono); color: var(--t-task); }
.proj .count { font: 500 13px var(--font-mono); color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 10px; }
.panel h2 { margin: 0; font: 600 18px/1.2 var(--font-display); }
.panel p { margin: 0; }
.radio { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.radio input { margin-top: 4px; }
.test-out { font-size: 14px; }
.test-out.ok { color: var(--t-shopping); }
.test-out.bad { color: var(--danger); }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: 10px 0 4px; }
input:not([type="radio"]):not([type="checkbox"]), select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px;
  padding: 10px 12px; font-size: 16px; min-width: 0;
}
textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row > div { min-width: 0; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.form-error { color: var(--danger); font-size: 14px; margin: 8px 0 0; }

/* ---------- dock ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
  padding: 8px var(--gutter-r) env(safe-area-inset-bottom, 0px) var(--gutter-l);
}
.dock > * { max-width: 680px; margin-inline: auto; }
.capture { display: flex; gap: 8px; }
.capture input { flex: 1; border-radius: 12px; padding: 11px 14px; background: var(--surface-2); }
.add-btn { width: 46px; flex: none; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); cursor: pointer; display: grid; place-items: center; }
.add-btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; fill: none; }
.preview { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 8px; align-items: center; }
.chip {
  --tc: var(--t-inbox);
  border: 1px solid color-mix(in srgb, var(--tc) 45%, var(--line)); background: color-mix(in srgb, var(--tc) 9%, var(--surface));
  color: var(--tc); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip.plain { --tc: var(--muted); cursor: default; }
.chip.t-deadline { --tc: var(--t-deadline); } .chip.t-reminder { --tc: var(--t-reminder); }
.chip.t-followup { --tc: var(--t-followup); } .chip.t-shopping { --tc: var(--t-shopping); }
.chip.t-task { --tc: var(--t-task); } .chip.code { --tc: var(--t-code); } .chip.code { font-family: var(--font-mono); }
.preview .why { font-size: 12px; color: var(--faint); }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 6px; }
.tabs a {
  position: relative; display: grid; place-items: center; padding: 8px 2px 10px; text-decoration: none;
  color: var(--muted); font-size: 12px; font-weight: 500; text-align: center;
}
.tabs a[aria-current="page"] { color: var(--accent); }
.tabs a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 2px; background: var(--accent); }
.tab-label { white-space: nowrap; }
.badge { font: 500 11px/1 var(--font-mono); color: var(--faint); min-height: 11px; margin-top: 3px; }
.badge.alert:not(:empty) { color: var(--t-deadline); }

#alerts { display: grid; gap: 6px; }
#alerts .notice { margin-bottom: 8px; }

/* ---------- sheets ---------- */
dialog.sheet {
  border: 0; padding: 0; background: var(--surface); color: var(--ink);
  width: min(560px, 100%); max-height: min(92vh, 900px); border-radius: 18px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.25);
}
dialog.sheet::backdrop { background: rgb(10 14 20 / 0.45); }
dialog.sheet form { padding: 16px var(--gutter-r) calc(18px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); }
@media (max-width: 600px) {
  dialog.sheet { margin: auto 0 0; max-width: 100%; width: 100%; border-radius: 18px 18px 0 0; }
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-head h2 { margin: 0; font: 600 20px/1.2 var(--font-display); }
.sheet-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px var(--gutter-r) 24px var(--gutter-l); }
.login-card { width: min(380px, 100%); display: grid; gap: 4px; }
.login-card h1 { font: 700 34px/1.05 var(--font-display); margin: 0 0 6px; letter-spacing: -0.02em; }
.login-card p { margin: 0 0 8px; color: var(--muted); }
.login-card .btn { margin-top: 14px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30;
  bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); border-radius: 12px; padding: 10px 14px;
  display: flex; gap: 14px; align-items: center; font-size: 15px; max-width: calc(100% - 32px);
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.2);
}
.toast button { border: 0; background: none; color: var(--accent-soft); font-weight: 600; cursor: pointer; padding: 0; }
@media (prefers-color-scheme: dark) { .toast button { color: var(--accent-ink); } }

@media (prefers-reduced-motion: no-preference) {
  .item { transition: opacity .2s; }
  .toast { animation: rise .18s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
}
@media (min-width: 700px) {
  .heading h1 { font-size: 34px; }
}

/* ---------- filter pill: right under the icons, same width ---------- */
.top-right { display: grid; justify-items: end; gap: 6px; flex: none; }
.filter-bar { width: 152px; }
.filter-row { display: flex; gap: 2px; align-items: center; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; height: 38px; }
.fchips { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.fchips::-webkit-scrollbar { display: none; }
.fchip { flex: 1 0 auto; border: 0; background: transparent; color: var(--muted); border-radius: 9px; padding: 0 7px; height: 30px; font-size: 12px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: background .15s, color .15s; }
.fchip[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.10); }
#filterBar .filter-row input, #filterBar .filter-row select { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 0; background: transparent; font-size: 14px; border-radius: 9px; }
#filterBar .filter-row input { font-size: 16px; }
#filterBar .filter-row select { color: var(--ink); font-weight: 500; cursor: pointer; }
#filterBar .filter-row input:focus, #filterBar .filter-row select:focus { background: var(--surface); outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.list-btn { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: var(--muted); }
.list-btn .ico { width: 18px; height: 18px; }
.list-btn:hover { color: var(--accent); background: var(--surface); }

/* Settings now lives in the dock beside the + button */
.dock-gear { width: 46px; height: auto; flex: none; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }

/* Priorities screen */
.prio-row { grid-template-columns: auto 1fr auto; row-gap: 6px; padding: 8px 10px; }
.prio-row input.prio-name { background: transparent; border-color: transparent; font-weight: 600; padding: 6px 8px; }
.prio-row input.prio-name:focus { background: var(--surface-2); border-color: var(--line); }
.prio-tools { display: flex; gap: 4px; }
.prio-meta { grid-column: 2 / -1; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; padding-left: 8px; }
.prio-meta .radio { margin: 0; font-size: 13px; color: var(--muted); font-weight: 400; }
.icon-mini { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 14px; }
.icon-mini:disabled { opacity: .35; cursor: default; }
.icon-mini.danger { color: var(--danger); }
.icon-mini.armed { width: auto; padding: 0 8px; background: var(--danger); color: var(--surface); border-color: var(--danger); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- database tables (projects, people) ---------- */
.db-tools { display: flex; gap: 8px; align-items: center; }
.db-tools input { flex: 1; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table.db { width: 100%; border-collapse: collapse; font-size: 14px; }
table.db th { text-align: left; font: 600 11px/1.2 var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
table.db td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.db tr:last-child td { border-bottom: 0; }
table.db tbody tr { cursor: pointer; }
table.db tbody tr:hover, table.db tbody tr:focus-visible { background: var(--surface-2); }
table.db tr.archived td { color: var(--faint); }
table.db .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.db .code-cell { color: var(--t-code); font-weight: 500; white-space: nowrap; }
table.db .name { font-weight: 500; white-space: nowrap; }
table.db .c-deadline { color: var(--t-deadline); } table.db .c-internal { color: var(--t-reminder); }
table.db .c-followup { color: var(--t-followup); } table.db .c-job { color: var(--t-job); }
.faint { color: var(--faint); }

.dots { display: inline-flex; gap: 4px; justify-content: flex-end; }
.count-dot.c-deadline { --tc: var(--t-deadline); } .count-dot.c-internal { --tc: var(--t-reminder); }
.count-dot.c-followup { --tc: var(--t-followup); } .count-dot.c-job { --tc: var(--t-job); }
.hint .count-dot { min-width: 16px; height: 16px; font-size: 10px; vertical-align: 1px; }

/* ---------- tap "Today" to print ---------- */
.title-print { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; border-radius: 8px; }
.title-print:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.title-print .print-ico { width: 18px; height: 18px; color: var(--faint); stroke-width: 1.8; }
.title-print:hover .print-ico { color: var(--accent); }

/* ---------- the printed daily sheet (A4, pen-friendly) ---------- */
.print-sheet { display: none; }
@media print {
  @page { size: A4; margin: 13mm 14mm; }
  :root { color-scheme: light; }
  html, body { background: #fff !important; color: #111 !important; }
  body::before, #app, #login, dialog, .toast { display: none !important; }
  .print-sheet { display: block; font: 10.5pt/1.35 var(--font-body); color: #111; }
  .ps-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-bottom: 2pt solid #111; padding-bottom: 6pt; margin-bottom: 10pt; }
  .ps-kicker { margin: 0; font: 600 8.5pt var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: #555; }
  .ps-head h1 { margin: 2pt 0 0; font: 700 21pt/1.05 var(--font-display); letter-spacing: -0.01em; }
  .ps-tally { display: flex; gap: 10pt; font-size: 9pt; color: #444; white-space: nowrap; }
  .ps-tally b { font-family: var(--font-mono); color: #111; }
  .ps-sec { margin: 0 0 10pt; break-inside: avoid-page; }
  .ps-sec h2 { display: flex; align-items: center; gap: 6pt; margin: 0 0 3pt; padding: 2pt 0 2pt 7pt; font: 700 11pt var(--font-display); border-left: 4pt solid var(--psc, #111); }
  .ps-n { font: 600 8pt var(--font-mono); color: #fff; background: var(--psc, #111); border-radius: 99pt; padding: 1pt 5pt; }
  .ps-deadline { --psc: #C2302A; } .ps-internal { --psc: #1F7A4B; } .ps-followup { --psc: #6A43B4; } .ps-job { --psc: #1C7FC0; }
  .ps-shop { --psc: #9A6200; } .ps-extra, .ps-notes { --psc: #555; }
  .ps-sec ul { list-style: none; margin: 0; padding: 0; }
  .ps-sec li { display: grid; grid-template-columns: 13pt 1fr auto; gap: 7pt; align-items: start; padding: 5pt 0; border-bottom: 0.5pt solid #ccc; break-inside: avoid; }
  .ps-box { width: 10pt; height: 10pt; border: 1.2pt solid #111; border-radius: 2pt; margin-top: 1.5pt; }
  .ps-title { font-weight: 600; }
  .ps-meta { display: flex; flex-wrap: wrap; gap: 0 9pt; font-size: 8.5pt; color: #555; margin-top: 1pt; }
  .ps-code { font-family: var(--font-mono); font-weight: 500; color: #111; }
  .ps-right { text-align: right; font-size: 9pt; white-space: nowrap; display: grid; gap: 1pt; }
  .ps-right em { font-style: normal; font-size: 8.5pt; color: var(--psc); font-weight: 600; }
  .ps-none { margin: 2pt 0 0 7pt; font-size: 9pt; color: #777; }
  .ps-cols { columns: 3; column-gap: 14pt; }
  .ps-cols-2 { columns: 2; column-gap: 22pt; }
  .ps-shop .ps-title { font-size: 12pt; font-weight: 500; }
  .ps-shop li { padding: 7pt 0; }
  .ps-cols li { grid-template-columns: 13pt 1fr; }
  .ps-blank { grid-template-columns: 13pt 1fr; }
  .ps-rule { border-bottom: 0.5pt solid #999; height: 12pt; }
  .ps-blank { border-bottom: 0 !important; }
  .ps-lines div { height: 18pt; border-bottom: 0.5pt solid #bbb; }
  .ps-foot { margin-top: 8pt; font-size: 7.5pt; color: #777; border-top: 0.5pt solid #ccc; padding-top: 4pt; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Email inbox settings */
.sub-h { margin: 10px 0 0; font: 600 14px/1.2 var(--font-body); }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.copy-row .mono { overflow-wrap: anywhere; font-weight: 500; }
.sender-row { grid-template-columns: 1fr auto; padding: 8px 10px; }
.log-row { grid-template-columns: 1fr auto; }
.log-row .side { min-width: 0; }
.log-added .pill { --tc: var(--t-reminder); } .log-followup .pill { --tc: var(--t-followup); }
.log-unassigned .pill { --tc: var(--t-shopping); } .log-blocked .pill { --tc: var(--t-deadline); }
