/* Inputiv WorkLog — design system. No framework, no build step.
   Tokens first, then base elements, layout shell, components, pages. Light and dark themes
   are set by data-theme on <html> (inline script in base.html picks saved choice or OS). */

/* ---------- Tokens ---------- */
:root {
  --bg: #f6f6f8; --surface: #ffffff; --surface-2: #f2f2f5; --surface-3: #e8e8ee;
  --border: #e3e3e9; --border-strong: #cdcdd6;
  --ink: #16161c; --ink-2: #474753; --muted: #6b6b78;
  --accent: #4338ca; --accent-hover: #3730a3; --accent-text: #4338ca;
  --accent-soft: #eef0ff; --on-accent: #ffffff; --track: #e2e5fb;
  --ok: #157a3c; --ok-soft: #e2f5e8; --warn: #9a5800; --warn-soft: #fdf0d6;
  --bad: #b42318; --bad-soft: #fde8e6; --info: #1d56c9; --info-soft: #e5edfd;
  --neutral-soft: #ececf1;
  --shadow-1: 0 1px 2px rgb(16 16 24 / .06);
  --shadow-2: 0 12px 32px rgb(16 16 24 / .14), 0 2px 6px rgb(16 16 24 / .06);
  --ring: 0 0 0 3px rgb(67 56 202 / .28);
  --r-sm: 6px; --r: 8px; --r-lg: 12px;
  --sidebar-w: 248px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0d0d11; --surface: #15151b; --surface-2: #1c1c23; --surface-3: #26262f;
  --border: #282830; --border-strong: #3a3a46;
  --ink: #f1f1f4; --ink-2: #c3c3cd; --muted: #9393a1;
  --accent: #4f46e5; --accent-hover: #6058ee; --accent-text: #a5b0fc;
  --accent-soft: #22234a; --on-accent: #ffffff; --track: #2a2c52;
  --ok: #5fd68a; --ok-soft: #13301e; --warn: #f5b942; --warn-soft: #36280b;
  --bad: #f68b82; --bad-soft: #3b1715; --info: #93b2fb; --info-soft: #172647;
  --neutral-soft: #26262f;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-2: 0 12px 32px rgb(0 0 0 / .5);
  --ring: 0 0 0 3px rgb(129 140 248 / .4);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 12px; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .small { font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
ul { margin: 0 0 12px; padding-left: 20px; }
code { font-family: var(--mono); font-size: 12.5px; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.muted { color: var(--muted); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.error-text { color: var(--bad); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pre { white-space: pre-line; }
.stack { display: grid; gap: 16px; }
.row { display: flex; flex-direction: row; gap: 8px; align-items: center; flex-wrap: wrap; }
.row .spacer, .spacer { flex: 1; }

/* ---------- Forms (base elements) ---------- */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 550; min-width: 0; }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]), label.check {
  flex-direction: row; align-items: center; gap: 8px; font-weight: 450; font-size: 14px; cursor: pointer;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea {
  height: 36px; width: 100%; padding: 0 10px; font: inherit; font-weight: 400; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
}
textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
select:not([multiple]) {
  appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
select[multiple] { height: auto; padding: 4px; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }
:disabled { cursor: not-allowed; }
fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea,
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-2); }
.req { color: var(--bad); margin-left: 2px; }
.hint, label small { font-size: 12px; font-weight: 400; color: var(--muted); }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.input-icon { position: relative; display: block; }
.input-icon svg { position: absolute; left: 10px; top: 10px; color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 32px !important; }
.input-suffix { position: relative; display: block; }
.input-suffix input { padding-right: 44px !important; }
.input-suffix span { position: absolute; right: 10px; top: 8px; color: var(--muted); font-size: 13px; font-weight: 400; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.inline-form input:not([type="checkbox"]) { width: auto; flex: 1 1 14rem; }
form.inline { display: inline; margin: 0; }

/* ---------- Buttons ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px;
  padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); font: inherit;
  font-weight: 550; cursor: pointer; white-space: nowrap; color: var(--ink); background: var(--surface);
  box-shadow: var(--shadow-1); text-decoration: none !important; transition: background .1s, border-color .1s;
}
button:hover, .btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 34px; padding: 0; }
.btn-sm.btn-icon { width: 28px; }
button:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.link-button {
  height: auto; padding: 0 4px; border: 0; background: none; box-shadow: none; color: var(--accent-text);
  font-weight: 500; font-size: 13px;
}
.link-button:hover { background: none; text-decoration: underline; }
.link-button.danger { color: var(--bad); }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- Chips & badges ---------- */
.chip, .badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 12px; font-weight: 550; white-space: nowrap;
  background: var(--neutral-soft); color: var(--ink-2); vertical-align: middle;
}
.chip.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok, .badge-open { background: var(--ok-soft); color: var(--ok); }
.chip.warn, .badge-locked { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info, .badge-sent { background: var(--info-soft); color: var(--info); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); font-size: 13px;
  color: var(--ink); text-decoration: none !important;
}
.filter-chip b { font-weight: 600; }
.filter-chip .x {
  color: var(--muted); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
}
.filter-chip:hover .x { background: var(--surface-2); color: var(--ink); }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.app.collapsed { --sidebar-w: 64px; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); padding: 14px 10px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; color: var(--ink); text-decoration: none !important; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-weight: 700; font-size: 16px; flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 15px; letter-spacing: -.01em; }
.brand-text span { font-size: 12px; color: var(--muted); }
.nav-group { margin-top: 14px; }
.nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 0 10px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 500; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 6px; }
.me-text { min-width: 0; flex: 1; line-height: 1.2; }
.me-text strong, .me-text span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text strong { font-size: 13px; }
.me-text span { font-size: 12px; color: var(--muted); }
.foot-actions { display: flex; gap: 2px; }
.foot-actions form { display: contents; }
.app.collapsed .brand-text, .app.collapsed .nav-label, .app.collapsed .nav a span,
.app.collapsed .me-text { display: none; }
.app.collapsed .nav a { justify-content: center; }
.app.collapsed .me { flex-direction: column; padding: 6px 0; }
.app.collapsed .foot-actions { flex-direction: column; align-items: center; }
.app.collapsed .nav-group { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
.content { padding: 28px 32px 48px; max-width: 1440px; width: 100%; }
.scrim { display: none; }

.avatar {
  width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); color: var(--ink-2);
  font-size: 10.5px; font-weight: 650; display: inline-grid; place-items: center; flex: none;
}
.avatar.lg { width: 32px; height: 32px; font-size: 12px; }
.person { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

/* ---------- Page header ---------- */
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs svg { width: 14px; height: 14px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 24px 0 10px; }
.section-title p { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- Cards, callouts ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; }
.callout, .flash, .errors {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin: 0 0 16px;
  border-radius: var(--r); border: 1px solid var(--border); background: var(--surface);
  border-left: 3px solid var(--info);
}
.callout > svg { margin-top: 2px; color: var(--info); }
.callout.ok, .flash { border-left-color: var(--ok); } .callout.ok > svg, .flash > svg { color: var(--ok); }
.callout.warn { border-left-color: var(--warn); } .callout.warn > svg { color: var(--warn); }
.callout.bad, .errors { border-left-color: var(--bad); } .callout.bad > svg, .errors > svg { color: var(--bad); }
.callout ul, .errors ul { margin: 4px 0 0; }
.callout p:last-child { margin: 0; }

/* ---------- Toolbar & popovers ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .search { flex: 1 1 260px; max-width: 380px; }
.segmented {
  display: inline-flex; padding: 2px; border-radius: var(--r); background: var(--surface-2);
  border: 1px solid var(--border); gap: 0; margin: 0;
}
.segmented > a, .segmented > button, .segmented > label {
  border: 0; background: none; box-shadow: none; font: inherit; font-size: 13px; font-weight: 550; color: var(--muted);
  height: 28px; padding: 0 10px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center;
  gap: 6px; flex-direction: row; text-decoration: none !important;
}
.segmented > label input { position: absolute; opacity: 0; pointer-events: none; }
.segmented > [aria-pressed="true"], .segmented > [aria-current="page"], .segmented > label:has(input:checked) {
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1);
}
.segmented > label:has(input:focus-visible) { box-shadow: var(--ring); }
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
details.pop { position: relative; }
details.pop > summary { list-style: none; }
details.pop > summary::-webkit-details-marker { display: none; }
.pop-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 14px;
}
.pop-panel.right { left: auto; right: 0; }
.pop-panel.form { width: 300px; display: grid; gap: 12px; }
.pop-panel .row { justify-content: flex-end; }
.menu-panel { padding: 6px; min-width: 200px; }
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%; height: auto;
  padding: 7px 10px; border-radius: var(--r-sm); color: var(--ink); font: inherit; font-weight: 450;
  background: none; border: 0; box-shadow: none; cursor: pointer; text-align: left;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); text-decoration: none; }
.menu-panel hr { margin: 6px 0; }
.menu-panel .menu-label { font-size: 11.5px; color: var(--muted); padding: 6px 10px 2px; font-weight: 600; }

/* ---------- Tables ---------- */
.table-card { overflow: hidden; }
.table-scroll { overflow: auto; }
.table-scroll.tall { max-height: calc(100vh - 260px); min-height: 200px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
  background: var(--surface-2); text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
thead th { position: sticky; top: 0; z-index: 2; }
tbody th { background: none; color: var(--ink); font-size: 14px; font-weight: 550; white-space: normal; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tfoot th, tfoot td { background: var(--surface-2); color: var(--ink); font-size: 14px; border-top: 1px solid var(--border-strong); border-bottom: 0; }
table.hover tbody tr:hover td { background: var(--surface-2); }
tr[data-href] { cursor: pointer; }
tr.inactive td { color: var(--muted); }
tr.selected td { background: var(--accent-soft) !important; }
td.sel, th.sel { width: 36px; }
.id { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
a.id:hover { color: var(--accent-text); }
.cell-2 { display: flex; flex-direction: column; min-width: 0; }
.cell-2 .p { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.cell-2 .s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-task { max-width: 300px; }
.c-partner { max-width: 240px; }
.c-status { min-width: 120px; }
.dur { font-weight: 600; font-variant-numeric: tabular-nums; }
.compact td { padding-top: 6px; padding-bottom: 6px; }
.compact .cell-2 .s { display: none; }
.table-foot {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted); flex-wrap: wrap;
}
.pager { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.pager .btn[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.summary-line { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.summary-line b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.draft-all { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 12px; }
.draft-all h3 { margin: 0 0 2px; font-size: 14px; }
.draft-all .hint { margin: 0; }
.toolbar .btn-quiet[aria-current="true"] { background: var(--accent-soft); color: var(--accent-text); }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.empty p { margin: 0; }
table.small-table td, table.small-table th { padding: 7px 10px; font-size: 13px; }
table.grouped tr.group-head td { background: var(--surface-2); border-top: 1px solid var(--border); }
.group-name { display: flex; align-items: center; gap: 10px; font-weight: 600; }

/* meter: single-series magnitude (title names it, so no legend) */
.meter { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.meter .bar { width: 120px; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; flex: none; }
.meter .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter .bar.over i { background: var(--bad); }
.meter.wide .bar { width: 100%; flex: 1; }

/* ---------- Stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { padding: 16px 18px; }
.tile .k { font-size: 13px; color: var(--muted); font-weight: 550; display: flex; align-items: center; gap: 6px; }
.tile .v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .d { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
a.tile { color: inherit; text-decoration: none; display: block; }
a.tile:hover { border-color: var(--border-strong); }

/* ---------- Form layout ---------- */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.form-narrow { max-width: 760px; }
.form-section { padding: 20px 22px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.section-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 14px; flex-wrap: wrap; }
.section-head p { margin: 0; font-size: 13px; color: var(--muted); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick button {
  height: 28px; padding: 0 10px; border-radius: 999px; box-shadow: none; color: var(--ink-2);
  font-size: 12.5px;
}
.quick button:hover { border-color: var(--accent); color: var(--accent-text); background: var(--surface); }
.quick button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
details.more > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 16px 22px;
  font-weight: 600;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .chev { transition: transform .15s; color: var(--muted); }
details.more[open] > summary .chev { transform: rotate(180deg); }
details.more .form-section { padding-top: 0; }
.picker { border: 1px solid var(--border-strong); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.picker .input-icon { border-bottom: 1px solid var(--border); }
.picker .input-icon input { border: 0; border-radius: 0; box-shadow: none; }
.picker-list { max-height: 196px; overflow: auto; padding: 4px; }
.picker-list label { padding: 6px 8px; border-radius: var(--r-sm); }
.picker-list label:hover { background: var(--surface-2); }
.switch { display: flex !important; flex-direction: row !important; gap: 12px; align-items: flex-start !important; cursor: pointer; font-weight: 400 !important; }
.switch input {
  appearance: none; width: 34px !important; height: 20px !important; border-radius: 999px; background: var(--border-strong);
  position: relative; flex: none; margin: 1px 0 0; cursor: pointer; transition: background .15s;
}
.switch input::after {
  content: ""; position: absolute; width: 16px; height: 16px; top: 2px; left: 2px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: var(--shadow-1);
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }
.switch b { font-weight: 550; }
.savebar {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 12px 22px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(6px); border-top: 1px solid var(--border); border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.savebar .spacer { flex: 1; }
.aside { display: grid; gap: 16px; position: sticky; top: 24px; }
.aside h2 { margin-bottom: 12px; }
.daystats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.daystats .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.daystats .k { font-size: 12.5px; color: var(--muted); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 96px; }
.week > div { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.week .col { width: 100%; max-width: 26px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.week .col.zero { background: var(--track); }
.week span { font-size: 11.5px; color: var(--muted); }
.week .today span { color: var(--ink); font-weight: 650; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.recent li:first-child { border-top: 0; padding-top: 0; }
.recent .t { min-width: 0; display: flex; flex-direction: column; }
.recent .t a { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; }

/* ---------- Timeline (history) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.timeline li::after { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .when { color: var(--muted); font-size: 12px; }
.timeline .change { color: var(--ink-2); overflow-wrap: anywhere; }
.timeline .change b { font-weight: 550; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a {
  padding: 8px 12px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; gap: 8px; align-items: center; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--accent); }

/* ---------- Selection bar ---------- */
.selbar {
  position: sticky; bottom: 16px; z-index: 10; margin: 12px auto 0; width: fit-content; max-width: 100%;
  display: flex; gap: 10px; align-items: center; padding: 8px 8px 8px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-2); flex-wrap: wrap;
}
.selbar b { font-variant-numeric: tabular-nums; }
.selbar button { box-shadow: none; }
.selbar .btn-quiet { color: var(--bg); opacity: .8; }
.selbar .btn-quiet:hover { background: rgb(127 127 127 / .2); color: var(--bg); opacity: 1; }
.selbar .btn-secondary { background: transparent; color: var(--bg); border-color: rgb(127 127 127 / .5); }
.selbar .btn-secondary:hover { background: rgb(127 127 127 / .2); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 60; display: grid; gap: 8px; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; min-width: 280px; max-width: 400px;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--ok);
  border-radius: var(--r); box-shadow: var(--shadow-2); animation: toast-in .18s ease-out;
}
.toast > svg { color: var(--ok); margin-top: 2px; }
.toast .close { margin-left: auto; height: 22px; width: 22px; padding: 0; border: 0; box-shadow: none; background: none; color: var(--muted); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Drafts (timesheet review) ---------- */
.draft { margin-bottom: 14px; }
.draft.has-errors { border-color: var(--bad); }
.draft-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.draft-head .actions { margin-left: auto; display: flex; gap: 4px; }
.draft .body { padding: 16px 18px; display: grid; gap: 14px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; padding: 28px; }
.auth-card .brand { padding: 0 0 20px; }
.auth-card form { display: grid; gap: 14px; }

/* ---------- Report cards ---------- */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.report-card { display: flex; gap: 14px; padding: 18px; color: inherit; text-decoration: none !important; }
.report-card:hover { border-color: var(--border-strong); }
.report-card .icon { width: 36px; height: 36px; border-radius: var(--r); background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.report-card h2 { color: var(--ink); margin-bottom: 4px; }
.report-card p { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- Report charts. Categorical palette: validated 8-slot reference palette, light and
   dark steps (see CLAUDE.md). Slot order is fixed; never cycle or generate hues. */
.viz {
  --viz-surface: #fcfcfb; --viz-ink: #0b0b0b; --viz-muted: #52514e; --viz-grid: #e4e3df;
  --viz-tip-bg: #ffffff; --viz-tip-ink: #0b0b0b;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --series-other: #a3a29c;
  --viz-track: #cde2fb; /* sequential blue 100: unused capacity behind series-1 */
  --viz-critical: #d03b3b; /* status: critical (always shown with a ⚠ label in the table) */
  margin: 0 0 16px; padding: 16px; background: var(--viz-surface); border-radius: var(--r-lg);
  border: 1px solid var(--border);
}
[data-theme="dark"] .viz {
  --viz-surface: #1a1a19; --viz-ink: #f0efec; --viz-muted: #c3c2b7; --viz-grid: #3a3936;
  --viz-tip-bg: #262624; --viz-tip-ink: #f0efec;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #0ca30c; --series-7: #9085e9; --series-8: #e66767;
  --series-other: #6e6d68;
  --viz-track: #0d366b; --viz-critical: #e66767; /* blue 700: recedes on the dark surface */
}
.viz-box { position: relative; width: 100%; }
.viz figcaption { margin-top: 12px; font-size: 12.5px; color: var(--viz-muted); }
.report-table td.total, .report-table tfoot th { font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 1360px) {
  .c-task { max-width: 220px; } .c-partner { max-width: 180px; }
  td, th { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 1100px) {
  .form-layout { grid-template-columns: 1fr; }
  .aside { position: static; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 40; left: 0; top: 0; width: 280px; transform: translateX(-100%);
    transition: transform .2s; box-shadow: var(--shadow-2);
  }
  .app.drawer .sidebar { transform: none; }
  .app.collapsed .brand-text, .app.collapsed .nav-label, .app.collapsed .nav a span, .app.collapsed .me-text { display: revert; }
  .app.drawer .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgb(0 0 0 / .4); }
  .collapse-btn { display: none !important; }
  .mobilebar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .mobilebar .brand { padding: 0; }
  .mobilebar .btn-primary { margin-left: auto; }
  .content { padding: 20px 16px 40px; }
  .aside { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .page-head .actions .hide-sm, .hide-sm { display: none !important; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .table-scroll.tall { max-height: none; }
  .savebar { padding: 12px 16px; }
  .savebar .hint, .savebar a.btn-quiet { display: none; }
  /* work log rows become cards */
  table.cards thead { display: none; }
  table.cards tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }
  table.cards tbody tr:last-child { border-bottom: 0; }
  table.cards td { padding: 0; border: 0; max-width: none; min-width: 0; }
  table.cards tbody tr:hover td { background: none; }
  table.cards .c-id { display: none; }
  table.cards .c-task { grid-column: 1; grid-row: 1; }
  table.cards .c-dur { grid-column: 2; grid-row: 1; }
  table.cards .c-date { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
  table.cards .c-partner, table.cards .c-eng, table.cards .c-status { grid-column: 1 / -1; }
  .meter .bar { width: 64px; }
  .selbar { border-radius: var(--r-lg); }
  .form-section { padding: 16px; }
  details.more > summary { padding: 14px 16px; }
}
