/* Timetracker: timesheet paper, ink, and one signal.
   Red means "recording" and is used for nothing else; errors use rust. */

@font-face {
  font-family: "Recursive";
  src: url("/static/fonts/recursive-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Recursive";
  src: url("/static/fonts/recursive-latin-ext.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #e8ecf0;
  --sheet: #f8fafb;
  --ink: #15212d;
  --ink-2: #3a4855;
  --muted: #56626e;
  --rule: #c9d1d9;
  --rule-strong: #95a2ae;
  --rec: #d61f3c;
  --error: #a4410e;
  --ok: #2b6e4f;
  --focus: #2f5bd3;

  /* Customer inks: muted, distinguishable, shared by strip, ledger and reports. */
  --c0: #3b64b0;
  --c1: #2e8577;
  --c2: #8a5db5;
  --c3: #b07a2a;
  --c4: #4d7f35;
  --c5: #a84f6b;
  --c6: #2f7894;
  --c7: #6e6a2e;

  --sans: "Recursive", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 6px;
  --radius-lg: 10px;
  --control-h: 2.375rem;
  --page: 1600px;
  --gutter: 1.5rem;
  color-scheme: light dark;
}

/* Theme: follows the system until the header switch sets data-theme on <html>
   ("light" or "dark", remembered per browser). The dark tokens apply in both cases. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #10161c;
  --sheet: #18212a;
  --ink: #e3e9ee;
  --ink-2: #b6c1cb;
  --muted: #8f9ca8;
  --rule: #27323d;
  --rule-strong: #46535f;
  --rec: #ff4d61;
  --error: #f08a5d;
  --ok: #6cc79a;
  --focus: #8fb0ff;

  --c0: #7ea2e8;
  --c1: #5ec1b0;
  --c2: #b795e0;
  --c3: #e0ae5e;
  --c4: #8dbe6e;
  --c5: #de8aa5;
  --c6: #6db6d3;
  --c7: #bdb76c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #10161c;
    --sheet: #18212a;
    --ink: #e3e9ee;
    --ink-2: #b6c1cb;
    --muted: #8f9ca8;
    --rule: #27323d;
    --rule-strong: #46535f;
    --rec: #ff4d61;
    --error: #f08a5d;
    --ok: #6cc79a;
    --focus: #8fb0ff;

    --c0: #7ea2e8;
    --c1: #5ec1b0;
    --c2: #b795e0;
    --c3: #e0ae5e;
    --c4: #8dbe6e;
    --c5: #de8aa5;
    --c6: #6db6d3;
    --c7: #bdb76c;
  }
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }

html {
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  font-variation-settings: "MONO" 0, "CASL" 0;
}

/* Durations and clock times: Recursive's monospaced setting, like a recorder display. */
.num, .clock, .tick,
input[type="time"], input[type="date"], input[type="month"] {
  font-variation-settings: "MONO" 1, "CASL" 0;
  font-variant-numeric: tabular-nums;
}

h1 { font-size: 2.25rem; line-height: 1.1; font-weight: 700; letter-spacing: -0.015em; margin: 0; }
h2 { font-size: 1.3125rem; line-height: 1.25; font-weight: 650; margin: 0 0 0.75rem; }
h3 { font-size: 1.125rem; line-height: 1.3; font-weight: 650; margin: 1.75rem 0 0.25rem; }
p { margin: 0 0 0.75rem; max-width: 70ch; }

a { color: var(--ink); text-decoration-color: var(--rule-strong); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
form.inline { display: inline; margin: 0; }

/* ------------------------------------------------------------------ header */

.topbar {
  display: flex;
  align-items: stretch;
  gap: 2.5rem;
  min-height: 3.75rem;
  padding-inline: max(var(--gutter), calc((100% - var(--page)) / 2 + var(--gutter)));
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.0625rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
/* An outlined record button: the product's one ornament, in ink, never red. */
.wordmark-dot { width: 0.85rem; height: 0.85rem; border-radius: 50%; border: 2.5px solid var(--ink); }

.nav-links { display: flex; gap: 1.75rem; }
.nav-links a {
  display: flex;
  align-items: center;
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding-top: 2px;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--ink); font-weight: 650; border-bottom-color: var(--ink); }

.nav-user { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.avatar {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.75rem;
  font-weight: 700;
}
.user-name { color: var(--ink-2); font-size: 0.9375rem; white-space: nowrap; }
.nav-links:empty, .nav-user:empty { display: none; }

/* Light/dark switch: shows the moon in light mode and the sun in dark mode. */
.theme-toggle { display: grid; place-items: center; width: 2.25rem; padding: 0; }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 0 1rem; }
  .user-name { display: none; }
  .nav-links {
    order: 3;
    flex-basis: 100%;
    gap: 1.25rem;
    min-height: 2.75rem;
    overflow-x: auto;
    scrollbar-width: none;
  }
}

/* ------------------------------------------------------------------ layout */

.container { max-width: var(--page); margin: 0 auto; padding: 1.75rem var(--gutter) 3rem; }

/* Today page: strip, timers, booking bar and the booked-time ledger, stacked at full width. */
.today { margin-bottom: 2rem; }
.today-layout { display: grid; gap: 2.25rem; }
.booked { container-type: inline-size; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.section-head h2 { margin: 0; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }

/* Month switcher on entries and reports */
.month-switch { display: flex; align-items: center; gap: 0.4rem; }
.month-switch strong { min-width: 9.5rem; text-align: center; font-weight: 650; }
.month-switch a {
  display: grid;
  place-items: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.6rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.month-switch a:hover { border-color: var(--ink-2); }
.month-switch .this-month { font-size: 0.875rem; margin-left: 0.5rem; }

/* ------------------------------------------------------------------ controls */

button {
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  height: var(--control-h);
  padding: 0 0.95rem;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  white-space: nowrap;
  cursor: pointer;
}
button:hover { border-color: var(--ink-2); }
button.primary { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
button.primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
button.danger { color: var(--error); }
button.quiet { background: none; border-color: transparent; color: var(--ink-2); font-weight: 500; padding: 0 0.5rem; }
button.quiet:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; }
button.quiet.danger { color: var(--error); }
button.link { height: auto; padding: 0 0.15rem; background: none; border: 0; color: var(--muted); font-weight: 500; }

label { display: block; margin-bottom: 0.3rem; font-size: 0.8125rem; font-weight: 550; color: var(--ink-2); }

input, select, textarea {
  font: inherit;
  font-size: 0.9375rem;
  width: 100%;
  height: var(--control-h);
  padding: 0 0.65rem;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
}
input:hover, select:hover { border-color: var(--ink-2); }
::placeholder { color: var(--muted); opacity: 1; }

input[type="checkbox"], input[type="radio"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  padding: 0;
  accent-color: var(--ink);
}
label.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: var(--control-h);
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.field { min-width: 0; }

.error, .notice {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.9375rem;
  background: var(--sheet);
  border-left: 3px solid currentColor;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.error { color: var(--error); }
.notice { color: var(--ok); }

/* ------------------------------------------------------------------ customer colors */

.c0 { --swatch: var(--c0); }
.c1 { --swatch: var(--c1); }
.c2 { --swatch: var(--c2); }
.c3 { --swatch: var(--c3); }
.c4 { --swatch: var(--c4); }
.c5 { --swatch: var(--c5); }
.c6 { --swatch: var(--c6); }
.c7 { --swatch: var(--c7); }
.swatch {
  display: inline-block;
  flex: none;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
  background: var(--swatch, var(--ink-2));
}

/* ------------------------------------------------------------------ day strip (the one bold element) */

.today-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.today-total { margin: 0; color: var(--ink-2); }
.today-total .num { font-size: 1.3125rem; font-weight: 650; color: var(--ink); }

.strip { margin-top: 1.5rem; container-type: inline-size; }
.strip-ticks { position: relative; height: 1.4rem; }
.tick { position: absolute; transform: translateX(-50%); font-size: 0.75rem; color: var(--muted); }
.tick:first-child { transform: none; }
.tick:last-child { transform: translateX(-100%); }

.strip-bar {
  position: relative;
  height: calc(1rem + var(--lanes, 1) * 1.75rem);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.gridline { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--rule); }
.block {
  position: absolute;
  top: calc(6px + (100% - 12px) / var(--lanes, 1) * var(--lane, 0));
  height: calc((100% - 12px) / var(--lanes, 1) - 3px);
  min-width: 3px;
  border-radius: 3px;
  background: var(--swatch, var(--ink-2));
}
.block.rec {
  background: repeating-linear-gradient(-45deg, var(--rec) 0 5px, color-mix(in srgb, var(--rec) 55%, var(--sheet)) 5px 10px);
}
.now { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: var(--rec); }
.now::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rec);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}
.legend li { display: flex; align-items: center; gap: 0.45rem; }
.legend .num { color: var(--ink-2); }

/* Hourly ticks on a wide strip; fewer as it gets narrower. */
.gridline.minor { border-left-style: dotted; opacity: 0.6; }
@container (max-width: 900px) {
  .tick.minor, .gridline.minor { display: none; }
}
@container (max-width: 520px) {
  .tick.mid, .gridline.mid { display: none; }
  .strip-bar { height: calc(1rem + var(--lanes, 1) * 1.25rem); }
}

/* ------------------------------------------------------------------ timer tracks */

.tracks { border-top: 2px solid var(--ink); }
.tracks:not(:empty) + .empty-hint { display: none; }
.empty-hint { margin: 0; max-width: none; padding: 1rem 0; color: var(--ink-2); border-bottom: 1px solid var(--rule); }

/* A timer is one row: state and time | what | on what | tags | billable | actions. */
.track {
  padding: 0.6rem 0 0.6rem 1rem;
  border-bottom: 1px solid var(--rule);
  box-shadow: inset 3px 0 transparent;
}
.track.is-running { box-shadow: inset 3px 0 var(--rec); }
.track-row {
  display: grid;
  /* Fixed outer columns keep every timer row aligned, whatever buttons it shows. */
  grid-template-columns: 8.5rem minmax(0, 2.2fr) minmax(0, 2fr) minmax(0, 0.9fr) 6.25rem 14.5rem;
  align-items: center;
  gap: 0.6rem;
}
.track .error, .track .notice { margin: 0.6rem 0 0; }

.track-clock { display: flex; flex-direction: column; justify-content: center; min-height: var(--control-h); }
.clock-line { display: flex; align-items: center; gap: 0.5rem; }
.clock { font-size: 1.375rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; }
.clock-state { font-size: 1rem; font-weight: 600; color: var(--ink-2); }
.clock-since { margin-left: 1.15rem; font-size: 0.75rem; color: var(--muted); }
.clock-since .warn { color: var(--error); font-weight: 600; }

.rec-dot {
  flex: none;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--rec);
  animation: rec-pulse 1.8s ease-in-out infinite;
}
@keyframes rec-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.pause-glyph { flex: none; width: 0.65rem; height: 0.75rem; border-inline: 3px solid var(--ink-2); }
.idle-glyph { flex: none; width: 0.65rem; height: 0.65rem; border-radius: 50%; border: 2px solid var(--rule-strong); }

/* Combined customer › cost center › task picker with the customer's color in front. */
.picker { position: relative; min-width: 0; }
.picker > .swatch {
  position: absolute;
  top: 50%;
  left: 0.7rem;
  transform: translateY(-50%);
  pointer-events: none;
  background: var(--swatch, var(--rule-strong));
}
.combobox-input { padding-left: 1.75rem; text-overflow: ellipsis; }
.combobox-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  min-width: max(100%, 24rem);
  max-height: 20rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgb(0 0 0 / 0.22);
}
.combobox-list[hidden] { display: none; }
.combobox-group { padding: 0.5rem 0.55rem 0.2rem; font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.combobox-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.9375rem;
  border-radius: 4px;
  cursor: pointer;
}
.combobox-option:hover { background: var(--paper); }
.combobox-option[aria-selected="true"] { background: var(--ink); color: var(--sheet); }
.combobox-empty { padding: 0.55rem; font-size: 0.875rem; color: var(--muted); }
.row-billable { white-space: nowrap; }
.row-actions { display: flex; justify-content: flex-end; gap: 0.4rem; }

/* Narrow: time, description and picker on their own lines, tags beside billable, buttons last. */
@media (max-width: 1100px) {
  .track-row { grid-template-columns: minmax(0, 1fr) auto; }
  .track-row :is(.track-clock, .row-desc, .picker, .row-actions) { grid-column: 1 / -1; }
  .track-row .row-actions { justify-content: flex-start; }
}

/* ------------------------------------------------------------------ dialog and toast */

.dialog {
  width: min(60rem, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
  padding: 1.25rem 1.5rem 1.5rem;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  /* Suggestion lists may extend beyond the dialog. */
  overflow: visible;
}
.dialog::backdrop { background: color-mix(in srgb, var(--paper) 35%, rgb(0 0 0 / 0.55)); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.dialog-head h2 { margin: 0; }
/* The dialog is the surface; the form inside needs no panel of its own. */
.dialog .booking { padding: 0; background: none; border: 0; }

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  z-index: 10;
  transform: translateX(-50%);
  max-width: calc(100vw - 2rem);
  margin: 0;
  padding: 0.65rem 1rem;
  color: var(--sheet);
  background: var(--ink);
  border-radius: var(--radius);
  font-weight: 550;
}
.toast[hidden] { display: none; }

/* ------------------------------------------------------------------ book time */

.booking {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}
.booking input, .booking select { background: var(--paper); }
.booking .error, .booking .notice { margin: 0; background: var(--paper); }

/* Row 1 has the shape of a timer row: what | on what | tags | billable. */
.booking-what {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 2fr) minmax(0, 0.9fr) auto;
  align-items: center;
  gap: 0.6rem;
}
/* Row 2: how and when, then the action at the end. */
.booking-when { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.when-date { width: 10.5rem; }
.when-range { display: inline-flex; align-items: center; gap: 0.4rem; }
.when-range input { width: 7.25rem; }
.when-dash { color: var(--muted); }
.when-hours { width: 13rem; }
.when-spread { width: auto; min-width: 13rem; }
.when-actions { margin-left: auto; }

.booking:has(input[name="mode"][value="range"]:checked) .duration-fields { display: none; }
.booking:has(input[name="mode"][value="duration"]:checked) .range-fields { display: none; }

@media (max-width: 900px) {
  .booking-what { grid-template-columns: minmax(0, 1fr) auto; }
  .booking-what :is(.row-desc, .picker) { grid-column: 1 / -1; }
  .when-actions { margin-left: 0; }
}

.segmented {
  display: inline-flex;
  height: var(--control-h);
  margin: 0;
  padding: 2px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
}
.segmented label { position: relative; display: flex; margin: 0; }
.segmented input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.segmented span {
  display: flex;
  align-items: center;
  padding: 0 0.8rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
  border-radius: 4px;
  cursor: pointer;
}
.segmented input:checked + span { background: var(--ink); color: var(--sheet); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Row 3, hours only: weekdays left out when hours are spread over several days. */
.weekdays { min-width: 0; margin: 0; padding: 0; border: 0; }
.weekday-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.weekday-label { font-size: 0.8125rem; font-weight: 550; color: var(--ink-2); }
.weekday-toggles { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.weekday { position: relative; margin: 0; }
.weekday input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.weekday span:not(.sr-only) {
  display: grid;
  place-items: center;
  min-width: 3.1rem;
  height: 2.125rem;
  padding: 0 0.6rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  cursor: pointer;
}
/* Left out: filled and struck through, so the state does not rely on color alone. */
.weekday input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--sheet); text-decoration: line-through; }
.weekday input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.weekdays-hint { flex: 1 1 18rem; max-width: 60ch; margin: 0; font-size: 0.8125rem; color: var(--muted); }

/* ------------------------------------------------------------------ ledger (entries) */

.ledger-summary { color: var(--ink-2); }
.ledger-summary .num { color: var(--ink); font-weight: 650; }

.ledger-day { margin-top: 2rem; }
.booked .section-head + .ledger-day { margin-top: 0.5rem; }
.ledger-empty { margin: 0; padding: 0.8rem 0; color: var(--muted); border-bottom: 1px solid var(--rule); }
.ledger-day :is(h2, h3) {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0;
  padding-bottom: 0.45rem;
  font-size: 1.0625rem;
  border-bottom: 2px solid var(--ink);
}

.entry {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr) 6.5rem auto;
  align-items: baseline;
  gap: 0.15rem 1.25rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}

/* In the narrow ledger beside the timers: time and duration frame the row, the actions
   sit quietly under the text. */
@container (max-width: 720px) {
  .entry { grid-template-columns: 6.25rem minmax(0, 1fr) auto; gap: 0.1rem 0.85rem; }
  .entry-actions { grid-column: 2 / -1; grid-row: 2; }
  .entry-actions button { height: 1.75rem; padding: 0 0.4rem; font-size: 0.8125rem; }
  .entry-actions button:first-child { padding-left: 0; }
}
.entry.editing { display: block; padding: 1rem 0; }
.entry-time { font-size: 0.9375rem; color: var(--ink-2); }
.entry-time.untimed { color: var(--muted); }
.entry-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0.15rem 0.5rem; }
.entry-path { color: var(--muted); }
/* Description and tags continue the title line and wrap only when they must. */
.entry-desc { color: var(--ink-2); }
.tag {
  padding: 0.05rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 550;
  color: var(--ink-2);
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
}
.entry-duration { text-align: right; }
.entry-duration .num { font-size: 1.0625rem; font-weight: 650; }
.entry-hint { font-size: 0.8125rem; color: var(--muted); }
.entry-actions { display: flex; gap: 0.25rem; align-self: center; }

.empty { padding: 2rem 0; border-top: 2px solid var(--ink); }
.empty p { color: var(--ink-2); }

@media (max-width: 760px) {
  .entry { grid-template-columns: minmax(0, 1fr) auto; }
  .entry-main { grid-column: 1 / -1; grid-row: 2; }
  .entry-actions { grid-column: 1 / -1; grid-row: 3; }
}

/* ------------------------------------------------------------------ reports */

.summary { max-width: 46ch; margin: 0 0 1.75rem; font-size: 1.3125rem; line-height: 1.45; color: var(--ink-2); }
.summary .num { font-weight: 650; color: var(--ink); }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
  gap: 0.75rem;
  margin-bottom: 2.25rem;
  padding: 1rem 1.25rem;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}
.filters input, .filters select { background: var(--paper); }
.filters .actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; }

.report-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 2.5rem 3rem;
}
.report-group h2 { margin: 0; padding-bottom: 0.45rem; font-size: 1.0625rem; border-bottom: 2px solid var(--ink); }
.report-group .note { margin: 0.5rem 0 0; font-size: 0.8125rem; color: var(--muted); }
.report-group .nothing { margin: 0.75rem 0 0; color: var(--muted); }

.bars { margin: 0; padding: 0; list-style: none; }
.bars li {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(3rem, 1fr) 3.75rem 4.75rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--rule);
}
.bar-label { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.bar-label span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 0.5rem; overflow: hidden; background: var(--rule); border-radius: 2px; }
.bar-fill { display: block; height: 100%; background: var(--swatch, var(--ink-2)); }
.bars .num { text-align: right; }

@media (max-width: 520px) {
  .bars li { grid-template-columns: minmax(0, 1fr) 3.75rem 4.75rem; }
  .bars .bar { grid-column: 1 / -1; grid-row: 2; }
}

/* ------------------------------------------------------------------ setup lists (customers & tasks, settings) */

.panel + .panel { margin-top: 2.75rem; }
.panel > h2 { margin-bottom: 0.25rem; padding-bottom: 0.45rem; border-bottom: 2px solid var(--ink); }
.panel > .lede { margin: 0.6rem 0 0; color: var(--ink-2); }

/* Rows and their "add" row share one grid: parent | name | flags | action */
.md-list { --md-cols: minmax(8rem, 13rem) minmax(0, 1fr) 12rem 9rem; }
.md-list.no-parent { --md-cols: minmax(0, 1fr) 12rem 9rem; }
.md-list.skip-days { --md-cols: 10rem minmax(0, 1fr) 9rem; }
.md-row, .md-add {
  display: grid;
  grid-template-columns: var(--md-cols);
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.45rem 0;
}
.md-row { border-bottom: 1px solid var(--rule); }
.md-add { padding-top: 0.9rem; }
.md-list button { width: 100%; }
.md-flags { display: flex; justify-content: flex-end; gap: 1rem; }
.md-parent { color: var(--muted); font-size: 0.9375rem; }

.with-swatch { position: relative; }
.with-swatch .swatch { position: absolute; top: 50%; left: 0.7rem; transform: translateY(-50%); }
.with-swatch input { padding-left: 1.75rem; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.75rem 0 0.25rem; }
.tag-list .tag { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.875rem; padding: 0.15rem 0.3rem 0.15rem 0.55rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: end;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
}
.form-grid .actions { grid-column: 1 / -1; }

details { margin-top: 1rem; }
summary { cursor: pointer; font-weight: 600; color: var(--error); }
details[open] summary { margin-bottom: 0.75rem; }

@media (max-width: 760px) {
  .md-list, .md-list.no-parent, .md-list.skip-days { --md-cols: minmax(0, 1fr) auto; }
  .md-row > :is(input, select, .md-parent, .with-swatch),
  .md-add > :is(input, select, .with-swatch) { grid-column: 1 / -1; }
  .md-flags { justify-content: flex-start; }
  .md-list button { width: auto; }
}

/* ------------------------------------------------------------------ sign in / sign up */

.auth { max-width: 26rem; margin: 3rem auto 0; }
.auth h1 { margin-bottom: 1.25rem; font-size: 1.75rem; }
.auth form {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}
.auth form input { background: var(--paper); }
.auth .alt { margin-top: 1.25rem; color: var(--ink-2); }
