/* Layout: daily-decision overview first (four blocks), detail behind tabs, project pages and "More options". */
:root {
  --bg: #f4f6f8; --panel: #ffffff; --fg: #16202a; --muted: #5a6675; --line: #dce2e8; --line-soft: #ebeff3;
  --accent: #0d6b72; --accent-fg: #ffffff;
  --ok: #1d7f47; --warn: #a96a0e; --bad: #bf3a26; --info: #2f5f9e;
  --font-display: "IBM Plex Sans Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0e1318; --panel: #161d24; --fg: #e3e9ef; --muted: #93a0ae; --line: #29333d; --line-soft: #1f2830;
  --accent: #4db3ba; --accent-fg: #06272a;
  --ok: #4cc07c; --warn: #e2a94b; --bad: #f07562; --info: #79a6e6; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0e1318; --panel: #161d24; --fg: #e3e9ef; --muted: #93a0ae; --line: #29333d; --line-soft: #1f2830;
  --accent: #4db3ba; --accent-fg: #06272a;
  --ok: #4cc07c; --warn: #e2a94b; --bad: #f07562; --info: #79a6e6; color-scheme: dark; }

html { color-scheme: light; }
body { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }
.userbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.top > .userbar { order: -1; flex-basis: 100%; justify-content: flex-end; }
.temp-pw { font-family: var(--font-data); padding: 8px 10px; border-radius: 6px; background: color-mix(in srgb, var(--ok) 10%, var(--panel)); border: 1px solid var(--ok); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px; line-height: 1.45; }
.wrap { max-width: 1200px; margin: 0 auto; padding-block: 20px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 16px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; text-wrap: balance; letter-spacing: 0.01em; }
h1 { font-size: 26px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0; }
.mono, td.n { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
small { font-size: 12px; }
a { color: var(--accent); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.top .sub { margin-top: 2px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { font: inherit; font-weight: 500; border: 1px solid var(--line); background: var(--panel); color: var(--fg); padding: 7px 12px; border-radius: 6px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.danger { color: var(--bad); }
.btn.danger.armed { background: var(--bad); color: var(--panel); border-color: var(--bad); }
:is(.btn, .tab, select, input, textarea, a, .linkish, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ro .write-only { display: none !important; }

.banner { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; border: 1px dashed var(--accent); border-radius: var(--radius); padding: 10px 14px; background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.banner.warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--panel)); }
.toast { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 8px 10px 8px 14px; border-radius: 6px; z-index: 30; max-width: calc(100vw - 32px); display: flex; gap: 12px; align-items: center; }
.toast button { font: inherit; font-weight: 600; background: none; border: 1px solid currentColor; color: inherit; border-radius: 4px; padding: 2px 8px; cursor: pointer; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { font: inherit; font-weight: 500; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.tab .count { font-family: var(--font-data); font-size: 11px; margin-left: 4px; padding: 0 5px; border-radius: 8px; background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.view { display: grid; gap: 16px; min-width: 0; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; min-width: 0; align-content: start; }
.panel-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); }
select, input, textarea { font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
input[type="checkbox"] { accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; }
.summary-line { color: var(--muted); }
.summary-line b { color: var(--fg); font-weight: 600; }

details.panel > summary, details.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 600; }
details.panel > summary::-webkit-details-marker, details.fold > summary::-webkit-details-marker { display: none; }
details.panel > summary::before, details.fold > summary::before { content: "▸"; color: var(--muted); font-size: 12px; transition: transform .12s; }
details[open].panel > summary::before, details[open].fold > summary::before { transform: rotate(90deg); }
details.panel > summary h2 { display: inline; }
details.fold { border-top: 1px solid var(--line); padding-top: 10px; }
details.fold > summary { font-size: 13px; color: var(--muted); }
details.fold[open] > summary { margin-bottom: 10px; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 999px; white-space: nowrap; color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--tone); }
.pill.st-blocked::before { border-radius: 1px; }
.tone-ok { --tone: var(--ok); } .tone-warn { --tone: var(--warn); } .tone-bad { --tone: var(--bad); } .tone-info { --tone: var(--info); } .tone-muted { --tone: var(--muted); }
.flag { font-size: 12px; color: var(--bad); font-weight: 500; }
.flag::before { content: "! "; font-weight: 700; }

.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list > li { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 4px 9px 0; border-bottom: 1px solid var(--line-soft); }
.list > li.click { cursor: pointer; }
.list > li:last-child { border-bottom: 0; }
.list > li.click:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.list .stripe { align-self: stretch; border-radius: 2px; background: var(--tone, var(--line)); }
.list .main { min-width: 0; display: grid; gap: 1px; }
.list .ttl { font-weight: 500; overflow-wrap: anywhere; }
.list .meta { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.list .side { display: grid; justify-items: end; gap: 4px; text-align: right; }
.empty { color: var(--muted); padding: 10px 0; }
.more-link { justify-self: start; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters label { color: var(--muted); font-size: 12px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fchip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 4px 2px 9px; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent); }
.fchip button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0 4px; font-size: 14px; line-height: 1; }

.tl-scroll { overflow-x: auto; }
.tl { min-width: 720px; display: grid; }
.tl-row { display: grid; grid-template-columns: 180px 1fr; align-items: center; min-height: 44px; border-bottom: 1px solid var(--line-soft); }
.tl.single .tl-row { grid-template-columns: 0 1fr; }
.tl.single .tl-label { padding: 0; }
.tl-row.head { min-height: 26px; border-bottom: 1px solid var(--line); }
.tl-label { padding-right: 12px; display: grid; min-width: 0; overflow: hidden; }
.tl-label b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-label small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track { position: relative; height: 100%; min-height: 44px; }
.tl-row.head .tl-track { min-height: 26px; }
.tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line-soft); font-size: 11px; color: var(--muted); padding-left: 4px; font-family: var(--font-data); white-space: nowrap; }
.tl-row.head .tick { padding-top: 6px; border-left-color: var(--line); }
.today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--accent); z-index: 2; }
.tl-row.head .today::after { content: "Today"; position: absolute; top: 5px; left: 4px; font-size: 11px; font-weight: 600; color: var(--accent); }
.bar { position: absolute; top: 50%; height: 12px; transform: translateY(-50%); border-radius: 3px; background: color-mix(in srgb, var(--tone) 22%, transparent); border: 1px solid color-mix(in srgb, var(--tone) 60%, transparent); overflow: hidden; }
.bar .fill { height: 100%; background: color-mix(in srgb, var(--tone) 55%, transparent); }
.slipline { position: absolute; top: 50%; height: 0; border-top: 1px dashed var(--muted); z-index: 2; }
.mk { position: absolute; top: 50%; z-index: 3; cursor: pointer; }
.mk.ms { width: 11px; height: 11px; transform: translate(-50%, -50%) rotate(45deg); background: var(--panel); border: 2px solid var(--tone); }
.mk.ms.done { background: var(--tone); }
.mk.ghost { width: 9px; height: 9px; transform: translate(-50%, -50%) rotate(45deg); border: 1.5px dashed var(--muted); background: transparent; z-index: 2; cursor: default; }
.mk.bl { width: 12px; height: 12px; transform: translate(-50%, 40%); border-radius: 50%; background: var(--tone); border: 2px solid var(--panel); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .mk { position: static; transform: none; }
.legend .mk.ms, .legend .mk.ghost { transform: rotate(45deg); width: 9px; height: 9px; }
.legend .mk.bl { width: 10px; height: 10px; }
.legend .today { position: static; display: inline-block; height: 12px; }

.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
td.n, th.n { text-align: right; white-space: nowrap; }
td.nw { white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
td .sub { display: block; font-size: 12px; color: var(--muted); }
.rowbtns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.prog { display: grid; gap: 3px; min-width: 84px; }
.prog .track { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.prog .track i { display: block; height: 100%; background: var(--accent); }
.stale { color: var(--warn); }
.slip-up { color: var(--warn); } .slip-bad { color: var(--bad); }

.detail-h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; }
.detail-h .t { display: grid; gap: 4px; min-width: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px 16px; }
.fact { display: grid; gap: 2px; }
.fact .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.fact .v { font-weight: 500; }
.fact .v.mono { font-weight: 400; }
.update-box { border-left: 3px solid var(--accent); padding: 6px 0 6px 12px; display: grid; gap: 2px; }

.aging { display: grid; gap: 12px; }
.aging .stack { display: flex; height: 18px; border-radius: 4px; overflow: hidden; background: var(--line-soft); }
.aging .stack i { display: block; height: 100%; background: var(--c); }
.aging .keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.aging .key { display: grid; gap: 2px; padding-left: 10px; border-left: 4px solid var(--c); }
.aging .key .v { font-family: var(--font-data); font-size: 16px; font-variant-numeric: tabular-nums; }
.age0 { --c: var(--info); } .age1 { --c: color-mix(in srgb, var(--warn) 65%, var(--panel)); } .age2 { --c: var(--warn); } .age3 { --c: color-mix(in srgb, var(--bad) 70%, var(--panel)); } .age4 { --c: var(--bad); }

.chips { display: grid; gap: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--fg); font-size: 13px; }
.chip.after { background: color-mix(in srgb, var(--warn) 15%, transparent); }
.chip button { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 5px; }
.chip-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-add input { width: 70px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.status-card { display: grid; gap: 6px; padding: 12px 14px; border-radius: 6px; border: 1px solid var(--line); background: color-mix(in srgb, var(--warn) 6%, var(--panel)); }
.schedule-sum { padding: 10px 12px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }

.email { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; font-size: 13px; }
.email .eh { padding: 8px 12px; background: var(--line-soft); display: grid; gap: 2px; }
.email .eb { padding: 12px; display: grid; gap: 8px; }
.email .ebtn { justify-self: start; background: var(--accent); color: var(--accent-fg); padding: 6px 12px; border-radius: 5px; font-weight: 500; }

dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); padding: 0; width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(10, 16, 22, 0.45); }
dialog form { display: grid; gap: 14px; padding: 18px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 4px; min-width: 0; align-content: start; }
.field.wide { grid-column: 1 / -1; }
.field > label, .sect-lbl { font-size: 12px; font-weight: 500; color: var(--muted); }
.field input:not([type="checkbox"]), .field select, .field textarea { width: 100%; box-sizing: border-box; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--bad); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--bad); }
.newperson { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pays { display: grid; gap: 6px; }
.pays table td, .pays table th { padding: 4px 6px; }
.pay-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pay-add input { flex: 1 1 110px; min-width: 0; }
.form-err { color: var(--bad); min-height: 1em; }
.form-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.form-foot .r { display: flex; gap: 8px; margin-left: auto; }
.sect { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.files li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.files .fname { display: grid; min-width: 0; }
.files .fname a { font-weight: 500; overflow-wrap: anywhere; }
.upl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.upl input[type="file"] { flex: 1 1 200px; min-width: 0; }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 200px; overflow-y: auto; }
.hist li { font-size: 12px; display: grid; gap: 1px; }
.hist .when { color: var(--muted); }
.sched { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.sched li { display: flex; justify-content: space-between; gap: 10px; }
.sched li.past { color: var(--muted); text-decoration: line-through; }
.sched li.next { font-weight: 600; }
@media (max-width: 560px) { .fields, .newperson { grid-template-columns: 1fr; } }

#tip { position: fixed; z-index: 40; pointer-events: none; background: var(--fg); color: var(--bg); font-size: 12px; padding: 6px 9px; border-radius: 5px; max-width: 260px; white-space: pre-line; }
@media (prefers-reduced-motion: no-preference) { .btn, .list > li, tr.click td { transition: background-color .12s, border-color .12s; } }
@media (prefers-reduced-motion: reduce) { details > summary::before { transition: none !important; } }
