/*
 * QuestLog — dark arcade theme.
 * Applied from PRD/theme-transfer.md (in the repository root). Section numbers
 * below refer to that spec.
 *
 * Channel assignment for this app (§5.4 — one channel per element):
 *   Green  — action:   logo, day total, running rows/dots/clocks, transport,
 *                      primary buttons, links, focus rings, the day bar
 *   Cyan   — metadata: every micro-label
 *   Pink   — emphasis: danger only — the error banner, delete-on-hover.
 *                      At most one pink element on screen, and only transiently.
 *   Gold   — status:   the "N timers running" badge
 */

/* ═══════════════════════════════════════════════ §2  Design tokens */

/* The theme's one webfont, self-hosted from static/ rather than fetched from
 * Google at runtime (the spec's "self-host instead" option). Latin subset,
 * single weight, no italic — requesting anything else synthesises and smears
 * the pixel grid. Licence: ../fonts/OFL.txt */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/press-start-2p-latin.05d166028cea.woff2") format('woff2');
  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;
}

:root {
  /* ── Surfaces & text ── */
  --c-bg:            #04040F;   /* page ground — near-black with a blue cast */
  --c-surface:       #080818;   /* alternating sections, code, inline CTAs */
  --c-surface-hi:    #0E0E24;   /* raised cards, form fields */
  --c-border:        #1E1E38;   /* default hairline */
  --c-border-strong: #2E2E50;   /* hover / emphasis hairline */
  --c-text:          #E8E8F5;   /* body copy                    16.8:1 on bg */
  --c-text-muted:    #8888AA;   /* secondary copy                5.98:1 on bg */
  --c-text-faint:    #444466;   /* dates, captions — DECORATIVE, 2.20:1 (see §9) */

  /* ── Phosphor green — primary accent ── */
  --c-accent:        #39FF14;   /* links, primary buttons       15.1:1 on bg */
  --c-accent-hover:  #4FFF22;
  --c-accent-fg:     #04040F;   /* text ON accent               15.1:1 on accent */
  --c-accent-subtle: rgba(57, 255, 20, 0.08);
  --c-accent-mid:    #2ABB0F;

  --c-link:          #39FF14;
  --c-link-hover:    #4FFF22;

  /* ── Secondary accent channels ── */
  --c-pink:          #FF1493;   /* emphasis headlines            5.61:1 on bg */
  --c-cyan:          #00F5FF;   /* eyebrows, labels             15.1:1 on bg */
  --c-gold:          #FFD700;   /* availability / status        14.6:1 on bg */
  --c-dot-avail:     #FFD700;

  /* ── Nav glass ── */
  --c-nav-bg:        rgba(4, 4, 15, 0.95);

  /* ── Typography ── */
  /* Two families by role: mono for the UI's own chrome (labels, buttons,
   * badges, menus, figures), sans for content (names, notes, inputs, prose).
   * The pixel face is kept for the QuestLog wordmark only. */
  --font-px:   'Press Start 2P', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui,
               'Helvetica Neue', Arial, sans-serif;
  /* Deviation from §2: ui-monospace/SFMono-Regular/Menlo prepended. 'SF Mono'
   * is not resolvable by that name from web content, so the spec's stack fell
   * through to Courier New — every mono readout rendered as a typewriter. */
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, 'Fira Code',
               'Cascadia Code', Consolas, monospace;

  /* ── Type scale (1.25 major-third, rem) ── */
  --text-xs:   0.6875rem;   /* 11px */
  --text-sm:   0.875rem;    /* 14px */
  --text-base: 1rem;        /* 16px */
  --text-lg:   1.125rem;    /* 18px */
  --text-xl:   1.25rem;     /* 20px */
  --text-2xl:  1.5625rem;   /* 25px */
  --text-3xl:  1.9375rem;   /* 31px */
  --text-4xl:  2.4375rem;   /* 39px */
  --text-5xl:  3.0625rem;   /* 49px */
  --text-6xl:  3.8125rem;   /* 61px */
  --text-7xl:  4.75rem;     /* 76px */

  /* ── Spacing (4px base) ── */
  --sp-1:  0.25rem;  --sp-2:  0.5rem;  --sp-3:  0.75rem;  --sp-4: 1rem;
  --sp-5:  1.25rem;  --sp-6:  1.5rem;  --sp-8:  2rem;     --sp-10: 2.5rem;
  --sp-12: 3rem;     --sp-16: 4rem;    --sp-20: 5rem;     --sp-24: 6rem;
  /* NOTE: --sp-7, --sp-9, --sp-14 etc. deliberately do not exist. See §12. */

  /* ── Layout ── */
  --container-max:   72rem;   /* 1152px — default */
  --container-wide:  56rem;   /*  896px — listings */
  --container-prose: 42rem;   /*  672px — article body */
  --container-pad:   1.25rem; /* fluid, see §11 */

  /* ── Elevation (neutral; colour glow is separate) ── */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.35);
  --shadow-sm:  0 1px 4px rgba(0,0,0,.45), 0 0 1px rgba(0,0,0,.25);
  --shadow-md:  0 4px 16px rgba(0,0,0,.55), 0 1px 4px rgba(0,0,0,.35);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.65), 0 2px 8px rgba(0,0,0,.4);
  --shadow-xl:  0 24px 64px rgba(0,0,0,.75), 0 4px 16px rgba(0,0,0,.5);

  /* ── Motion ── */
  --ease-out:    cubic-bezier(0.33, 1, 0.68, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);  /* overshoots — arrows, gaps */
  --dur-fast:    120ms;   /* colour */
  --dur-base:    200ms;   /* transform, shadow */
  --dur-slow:    320ms;
  --transition:  var(--dur-base) var(--ease-out);

  /* ── Radii & misc ── */
  --radius-sm:  3px;    /* tags, inline code */
  --radius-md:  7px;    /* nav links, inputs, pre */
  --radius-lg:  14px;   /* cards */
  --radius-xl:  24px;   /* pill badges */
  --nav-h:      3.75rem;

  /* ── App shell (not part of the theme contract) ── */
  --sidebar-w:  17rem;

  color-scheme: dark;
}

/* ═══════════════════════════════════════════════ §3  Reset & base layer */

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

/* The page scripts show and hide elements with the hidden attribute; without
 * this, a class that sets display (flex, grid…) would override it. */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  background-color: var(--c-bg);
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.7;                    /* generous — dark backgrounds need air */
  color: var(--c-text);
  background-color: var(--c-bg);
  min-height: 100vh;
  display: flex;                       /* sticky-footer scaffold */
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;  /* essential: light-on-dark otherwise blooms */
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

/* §3 sets `img, video, svg { display:block; height:auto }`. Every svg here is
 * an inline icon sized by its own attributes, so svg is left out on purpose. */
img, video { display: block; max-width: 100%; height: auto; }

a {
  color: var(--c-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--c-link-hover); }

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  letter-spacing: -0.025em;          /* tighten sans headings… */
  font-weight: 700;
  font-size: inherit;
}
/* …but pixel-font headings override to POSITIVE tracking. See §5.1. */

hr { border: none; border-top: 1px solid var(--c-border); margin: var(--sp-8) 0; }

button, input { font-family: inherit; font-size: inherit; color: inherit; }
button { background: none; border: none; }

/* §9 — one global focus ring, 15:1 against every surface in the theme */
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════════ §4  The CRT layer */

/* The §4 vignette (body::before) is off for now: on this full-bleed shell it
 * dimmed the sidebar and the topbar's right end until text there was hard
 * to read. */

/* Scanlines — 1px dark line every 4px */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.11) 3px,
    rgba(0, 0, 0, 0.11) 4px
  );
  pointer-events: none;
  z-index: 999;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1;    transform: scale(1);    }
  50%      { opacity: 0.45; transform: scale(0.82); }
}

/* ═══════════════════════════════════════════════ §6.13  Skip link */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  background: var(--c-accent);
  color: var(--c-accent-fg);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  z-index: 1000;                       /* above the scanlines — see §12 */
  transition: top var(--transition);
}
.skip-link:focus { top: var(--sp-2); }

/* ═══════════════════════════════════════════════ App shell */

.app {
  display: flex;
  flex: 1;
  min-height: 0;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.main:focus { outline: none; }

/* ═══════════════════════════════════════════════ Micro-labels (§5.4 cyan) */

.label-caps {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--c-cyan);
  text-shadow: 0 0 6px var(--c-cyan);   /* single-layer: small labels (§5.3) */
}

/* ═══════════════════════════════════════════════ Sidebar */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
}

/* §6.3 nav__logo — pixel type, green, two-layer glow */
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  font-family: var(--font-px);
  font-size: clamp(0.5625rem, 1.6vw, 0.75rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--c-accent);
  text-shadow: 0 0 6px var(--c-accent), 0 0 18px rgba(57,255,20,.45);
}

/* Square, double-lit tube — the §6.6 badge treatment at icon scale */
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  border: 2px solid var(--c-accent);
  border-radius: 0;
  color: var(--c-accent);
  text-shadow: none;
  box-shadow: 0 0 10px rgba(57,255,20,.3),
              inset 0 0 12px rgba(57,255,20,.06);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 0 var(--sp-5) var(--sp-3);
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: 0 var(--sp-3);
  flex: 1;
  overflow-y: auto;
}

/* §6.7 B — left-accent row: only the spine lights */
.project-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-height: 2.5rem;
  padding: var(--sp-2) var(--sp-3);
  background: transparent;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;  /* square on the spine */
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}

.project-row-main {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.project-row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding-left: calc(6px + var(--sp-2));
}

.project-rate {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--c-text-muted);
}
.project-row:hover {
  background: var(--c-surface-hi);
  border-color: var(--c-border);
  border-left-color: var(--c-border-strong);
}
.project-row.running {
  background: var(--c-accent-subtle);
  border-color: transparent;
  border-left-color: var(--c-accent);
  box-shadow: inset 0 0 12px rgba(57,255,20,.06);   /* inner tube bloom (§6.6) */
}

.project-name {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}
.project-row.running .project-name {
  color: var(--c-text);
  font-weight: 600;
}

/* Running elapsed clock — mono figure, single-layer green glow */
.elapsed {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--c-accent);
  text-shadow: 0 0 6px rgba(57,255,20,.55);
  flex-shrink: 0;
}

/* §6.6 availability-dot, re-hued to the action channel */
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--c-border-strong);
}
.dot.pulse {
  background: var(--c-accent);
  box-shadow: 0 0 6px var(--c-accent),
              0 0 0 2px rgba(57,255,20,.2);
  animation: pulse-glow 1.8s var(--ease-out) infinite;
}

/* ═══════════════════════════════════════════════ §6.11  Form fields */

.date-input,
.time-input,
.popover-field input,
.popover-field select {
  font-family: var(--font-sans);
  font-size: var(--text-base);         /* ≥16px stops iOS zoom-on-focus */
  color: var(--c-text);
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-3);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow   var(--dur-fast) var(--ease-out);
}
.date-input:focus,
.time-input:focus,
.popover-field input:focus,
.popover-field select:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(57, 255, 20, 0.15);   /* the ring replaces the outline */
}
/* Text fields drop the native appearance (kills iOS's inset shadow); the
 * date and time fields keep theirs so the native picker stays reachable. */
.popover-field input {
  -webkit-appearance: none;
  appearance: none;
}

.date-input,
.time-input {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  padding: var(--sp-1) var(--sp-2);
  width: fit-content;
  max-width: 100%;
}

/* ═══════════════════════════════════════════════ §6.2  Buttons */

.primary-button,
.export-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  border-radius: 0;                    /* arcade: sharp */
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background   var(--dur-base) var(--ease-out),
              color        var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              box-shadow   var(--dur-base) var(--ease-out),
              transform    var(--dur-fast) var(--ease-spring);
}
.primary-button:not(:disabled):active,
.export-button:not(:disabled):active,
.icon-button:not(:disabled):active { transform: translateY(1px); }   /* physical key press */

/* btn--primary */
.primary-button {
  padding: 0.6875rem 1.3125rem;
  background: var(--c-accent);
  color: var(--c-accent-fg);
  border-color: var(--c-accent);
  box-shadow: 0 0 10px rgba(57,255,20,.35), 0 1px 4px rgba(57,255,20,.2);
}
.primary-button:not(:disabled):hover {
  background: var(--c-accent-hover);
  border-color: var(--c-accent-hover);
  box-shadow: 0 0 18px rgba(57,255,20,.55), 0 4px 16px rgba(57,255,20,.3);
  transform: translateY(-1px);
}

/* btn--ghost */
.export-button {
  padding: var(--sp-2) var(--sp-4);
  background: transparent;
  color: var(--c-text);
  border-color: var(--c-border);
}
.export-button:not(:disabled):hover {
  background: var(--c-surface);
  border-color: var(--c-border-strong);
  transform: translateY(-1px);
}
.export-button.caret { padding-inline: var(--sp-2); }

/* Icon buttons — ghost, square, sized to a comfortable target */
.icon-button {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  color: var(--c-text-muted);
}
.icon-button:not(:disabled):hover {
  background: var(--c-surface-hi);
  border-color: var(--c-border-strong);
  color: var(--c-text);
}
.icon-button.bordered {
  width: 2rem;
  height: 2rem;
  border-color: var(--c-border);
}
.icon-button.ghost:not(:disabled):hover { background: transparent; border-color: transparent; }

/* Accent — for a primary icon action that needs to read as clearly
 * actionable at a glance, not just on hover (e.g. "add project"). */
.icon-button.accent {
  color: var(--c-accent);
  border-color: var(--c-accent);
}
.icon-button.accent:not(:disabled):hover {
  background: var(--c-accent-subtle);
  color: var(--c-accent-hover);
  border-color: var(--c-accent-hover);
}

/* Delete is the one place the pink channel does double duty as danger */
.icon-button.danger:not(:disabled):hover {
  color: var(--c-pink);
  border-color: var(--c-pink);
  background: rgba(255,20,147,.08);
  text-shadow: 0 0 6px rgba(255,20,147,.6);
}

/* Disabled: flatten every variant to the same inert, muted look so state
 * reads at a glance rather than only on click (see PRD feedback — buttons
 * were indistinguishable from enabled ones). Wins over the variant's own
 * background/border/shadow by following them in source order. */
.primary-button:disabled,
.export-button:disabled,
.icon-button:disabled,
.text-button:disabled {
  background: transparent;
  color: var(--c-text-muted);
  border-color: var(--c-border);
  box-shadow: none;
  text-shadow: none;
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Transport: btn--outline when idle, btn--primary when recording */
.icon-button.transport {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
}
.icon-button.transport.start {
  background: transparent;
  color: var(--c-accent);
  border-color: var(--c-accent);
}
.icon-button.transport.start:not(:disabled):hover {
  background: var(--c-accent-subtle);
  color: var(--c-accent-hover);
  border-color: var(--c-accent-hover);
  transform: translateY(-1px);
}
.icon-button.transport.stop {
  background: var(--c-accent);
  color: var(--c-accent-fg);
  border-color: var(--c-accent);
  box-shadow: 0 0 10px rgba(57,255,20,.35), 0 1px 4px rgba(57,255,20,.2);
}
.icon-button.transport.stop:not(:disabled):hover {
  background: var(--c-accent-hover);
  border-color: var(--c-accent-hover);
  box-shadow: 0 0 18px rgba(57,255,20,.55), 0 4px 16px rgba(57,255,20,.3);
  transform: translateY(-1px);
}

/* Row action clusters stay hidden until the row is engaged */
.row-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.project-row:hover .row-actions,
.group-table-row:hover .row-actions,
.cost-table-row:hover .row-actions,
.row-actions:focus-within { opacity: 1; }

@media (hover: none) {
  .row-actions, .note-link.unset { opacity: 1; gap: var(--sp-2); }
  .icon-button { width: 2.25rem; height: 2.25rem; }
}

/* Text button — reads as a link, mono micro-caps */
.text-button {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-accent);
  cursor: pointer;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--c-accent);
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.text-button:not(:disabled):hover {
  background: var(--c-accent-subtle);
  color: var(--c-accent-hover);
}

.export-dialog-presets { display: flex; gap: var(--sp-2); }
.export-dialog-presets button.active {
  background: var(--c-accent-subtle);
  border-color: var(--c-accent);
}

/* ═══════════════════════════════════════════════ §6.3  Sticky glass topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;                        /* below the CRT overlays at 998/999 */
  min-height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: var(--sp-3) var(--container-pad);
  background: var(--c-nav-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--c-border);
}

.date-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════ Filter dropdown */

.filter-dropdown {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 1px;
}

.filter-dropdown-menu,
.account-menu-list {
  position: absolute;
  top: calc(100% + var(--sp-2));
  right: 0;
  z-index: 90;
  min-width: 11rem;
  display: flex;
  flex-direction: column;
  padding: var(--sp-1);
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.filter-dropdown-option,
.menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--c-text);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.filter-dropdown-option:hover,
.menu-item:hover,
.menu-item:focus-visible { background: var(--c-surface); }
.filter-dropdown-option input { accent-color: var(--c-accent); }

.report-filters {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════ Content column */

.content {
  padding: var(--sp-8) var(--container-pad) var(--sp-16);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  max-width: var(--container-max);
  width: 100%;
}

/* Error banner — the pink channel, at most one on screen (§5.4) */
.error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--c-pink);
  text-shadow: 0 0 8px rgba(255,20,147,.45);
  background: rgba(255,20,147,.08);
  border: 1px solid var(--c-pink);
  border-left: 3px solid var(--c-pink);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  box-shadow: 0 0 16px rgba(255,20,147,.12);
}
.error-banner .icon-button { color: var(--c-pink); }
.error-banner .icon-button:hover {
  background: rgba(255,20,147,.14);
  color: var(--c-pink);
}

/* ── Day summary — the loudest figure on the page ── */

.summary {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-5);
  flex-wrap: wrap;
}

.summary-figures {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-8);
  flex-wrap: wrap;
}

.summary-figure {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* Money never glows — glow reads as "changing", and these are static. */
.summary-money {
  font-family: var(--font-mono);
  font-size: clamp(var(--text-2xl), 4vw, var(--text-3xl));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--c-text);
}

.summary-value {
  font-family: var(--font-mono);
  font-size: clamp(var(--text-4xl), 7vw, var(--text-5xl));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--c-accent);
  text-shadow: 0 0 8px var(--c-accent), 0 0 28px rgba(57,255,20,.5);
  transition: color var(--dur-base) var(--ease-out),
              text-shadow var(--dur-base) var(--ease-out);
}
.summary-value.zero {
  color: var(--c-accent-mid);
  text-shadow: none;
}

/* §6.6 status badge — square, double-lit, the gold channel */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--c-gold);
  text-shadow: 0 0 6px var(--c-gold);
  border: 2px solid var(--c-gold);
  border-radius: 0;
  padding: 0.5rem var(--sp-4);
  background: transparent;
  box-shadow: 0 0 10px  rgba(255,215,0,.3),          /* outer halo */
              inset 0 0 12px rgba(255,215,0,.05);    /* inner tube bloom */
}
.live-pill .dot.pulse {
  background: var(--c-gold);
  box-shadow: 0 0 6px var(--c-gold),
              0 0 0 2px rgba(255,215,0,.2);
}

/* A smaller inline tag on the same gold channel — "Not billable" */
.badge-status {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-gold);
  text-shadow: 0 0 6px rgba(255,215,0,.45);
  border: 1px solid var(--c-gold);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.4rem;
  background: rgba(255,215,0,.08);
  white-space: nowrap;
}

/* ── Day bar — a phosphor readout, so a green luminance ramp (§2 --c-accent-mid) ── */

.day-bar {
  display: flex;
  gap: 1px;
  height: 0.625rem;
  overflow: hidden;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 0;                    /* sharp: this is instrumentation */
}

.day-bar-segment { min-width: 2px; }
.day-bar-segment.shade-0 { background: rgba(57,255,20,.62); }
.day-bar-segment.shade-1 { background: rgba(57,255,20,.44); }
.day-bar-segment.shade-2 { background: rgba(57,255,20,.30); }
.day-bar-segment.shade-3 { background: var(--c-accent-mid); }
.day-bar-segment.live {
  background: var(--c-accent);
  box-shadow: 0 0 10px rgba(57,255,20,.55);
}

/* ── Project groups — §6.7 A, full-border card ── */

.groups {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.group {
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--dur-base) var(--ease-out);
}
/* No hover lift: these are data containers, not clickable cards. */
.group:hover { border-color: var(--c-border-strong); }

.group-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
}

.group-name {
  flex: 1;
  min-width: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-subtotal {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--c-text-muted);
  flex-shrink: 0;
}
.group-subtotal-money {
  margin-left: var(--sp-3);
  color: var(--c-text);
}

.group-table-head,
.group-table-row {
  display: grid;
  grid-template-columns: 6rem 6rem 6rem 6rem 1fr;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-5);
}

.group-table-head {
  padding-top: var(--sp-3);
  padding-bottom: var(--sp-2);
}

.group-table-row {
  border-top: 1px solid var(--c-border);
  min-height: 2.5rem;
  transition: background var(--dur-fast) var(--ease-out);
}
.group-table-row:first-of-type { border-top: none; }
.group-table-row:hover { background: var(--c-surface); }
.group-table-row.editing { background: var(--c-accent-subtle); }

.cell-time {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--c-text-muted);
}

.cell-duration {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--c-text);
}

.group-table-row .row-actions { justify-content: flex-end; }

/* Last cell. Entry rows: the note (click to edit) with the delete button
   fading in beside it. Cost rows: a status badge, swapped for the row
   actions on hover — same slot. */
.cell-tail {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  min-width: 0;
  min-height: 1.5rem;
}
.cell-hint {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--c-cyan);
  text-shadow: 0 0 6px rgba(0,245,255,.35);
  white-space: nowrap;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.cost-table-row:hover .cell-tail .badge-status {
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.cost-table-row .cell-tail .row-actions { position: absolute; right: 0; }
.cell-tail .row-actions.static { position: static; opacity: 1; }

/* Times, duration and amount open the time editor on click. */
.cell-link { cursor: pointer; }
button.cell-link {
  font: inherit;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: inherit;
  background: none;
  border: none;
  padding: 0;
}
.group-table-row:not(.editing) .cell-link:hover,
button.cell-link:focus-visible { color: var(--c-accent); }

.entry-manual {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-cyan);
  text-shadow: 0 0 6px rgba(0,245,255,.35);
}

/* The note reads as a link; clicking it opens the multi-line editor. */
.note-link {
  min-width: 0;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-cyan);
  text-shadow: 0 0 6px rgba(0,245,255,.35);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.note-link:hover,
.note-link:focus-visible {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
/* "add note" and the delete icon appear on hover in the neon accent, so they
   read as actions; delete still turns pink under the pointer. */
.note-link.unset {
  color: var(--c-accent);
  text-shadow: 0 0 6px rgba(57,255,20,.5);
  opacity: 0;
}
.group-table-row:hover .note-link.unset,
.note-link.unset:focus-visible { opacity: 1; }
/* A running entry's Stop sits in its row, always visible, like the sidebar's. */
.icon-button.transport.entry-stop {
  width: 1.75rem;
  height: 1.75rem;
}
.group-table-row .icon-button.danger:not(:disabled) {
  color: var(--c-accent);
  filter: drop-shadow(0 0 4px rgba(57,255,20,.5));
}
.group-table-row .icon-button.danger:not(:disabled):hover {
  color: var(--c-pink);
  filter: drop-shadow(0 0 4px rgba(255,20,147,.6));
}

.hours-input,
.rate-input,
.note-input {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  color: var(--c-text);
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: var(--sp-1) var(--sp-2);
  width: 100%;
}
.note-input { font-family: var(--font-sans); }
textarea.note-input {
  display: block;
  min-height: calc(2lh + 2 * var(--sp-1) + 2px);
  max-height: 16rem;
  line-height: 1.4;
  white-space: pre-wrap;
  resize: vertical;
  field-sizing: content;
}
.hours-input.invalid { border-color: var(--c-pink); }
.rate-input.overridden { color: var(--c-cyan); border-color: var(--c-cyan); }

.running-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-accent);
  text-shadow: 0 0 6px rgba(57,255,20,.5);
}

/* Empty states carry real copy — muted, never --c-text-faint (§9) */
.empty {
  color: var(--c-text-muted);
  font-size: var(--text-sm);
  padding: var(--sp-3) var(--sp-1);
}
.groups .empty {
  padding: var(--sp-8);
  text-align: center;
  border: 1px dashed var(--c-border);
  border-radius: var(--radius-lg);
}

/* ═══════════════════════════════════════════════ Costs section (§5.4) */

.cost-section {
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cost-section-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
}
.cost-section-header .label-caps { flex: 1; }

.cost-table-row {
  display: grid;
  grid-template-columns: 7rem 1fr 6rem 8rem;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-5);
  border-top: 1px solid var(--c-border);
  min-height: 2.5rem;
  transition: background var(--dur-fast) var(--ease-out);
}
.cost-table-row:first-of-type { border-top: none; }
.cost-table-row:hover { background: var(--c-surface); }

.cost-category-label { color: var(--c-cyan); }

.cost-description {
  font-size: var(--text-sm);
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════ Form fields and project settings dialog */

.popover-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.popover-field input,
.popover-field select {
  width: 100%;
}
.popover-field select { font-family: var(--font-mono); }

.popover-reprice {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--c-border);
}
.popover-reprice-row {
  display: flex;
  gap: var(--sp-2);
}
.popover-reprice-row .date-input { flex: 1; min-width: 0; }

.popover-share {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--c-border);
}
/* A 36-character UUID is wider than the popover: let it wrap, and select it
 * whole with one click so it can be copied. */
.project-uid {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  overflow-wrap: anywhere;
  user-select: all;
}
.popover-hint {
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--c-text-muted);
}

/* ═══════════════════════════════════════════════ Dialogs (§6 dialog cards) */

.dialog-scrim {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background: rgba(4, 4, 15, 0.72);
}

.dialog-card {
  width: 100%;
  max-width: 34rem;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.dialog-card.log-work-dialog { max-width: 56rem; }

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5);
  border-bottom: 1px solid var(--c-border);
}
.dialog-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--c-text);
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-5);
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--c-border);
}
.dialog-footer-actions {
  display: flex;
  gap: var(--sp-2);
}
.dialog-error {
  color: var(--c-pink);
  font-size: var(--text-sm);
}

.input-suffix {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.input-suffix input { width: 6rem; }
.input-suffix span {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
}

/* ═══════════════════════════════════════════════ Log work dialog */

.log-work-project {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-4);
}
.log-work-project .project-rate {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  padding-bottom: var(--sp-2);
}

.log-work-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.log-work-grid-head,
.log-work-grid-row {
  display: grid;
  grid-template-columns: 8.5rem 7rem 6rem 6rem 1fr 2rem;
  gap: var(--sp-3);
  align-items: center;
}
.log-work-hours-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.log-work-add { align-self: flex-start; }
.log-work-summary {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--c-text);
}

/* ═══════════════════════════════════════════════ Cost dialog */

.cost-dialog-row {
  display: flex;
  gap: var(--sp-4);
}
.cost-dialog-row .popover-field { flex: 1; }

.cost-category {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.cost-category-options {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.cost-radio {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--c-text);
  cursor: pointer;
}
.cost-radio input { accent-color: var(--c-accent); }

.cost-travel-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
}
.cost-travel-fields {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-left: calc(1rem + var(--sp-2));
}
.cost-travel-fields .hours-input,
.cost-travel-fields .rate-input {
  width: 6rem;
  flex: none;
}
.cost-travel-fields span {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
}

.cost-billable {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--c-text);
  cursor: pointer;
}
.cost-billable input { accent-color: var(--c-accent); }

/* ═══════════════════════════════════════════════ Reports link (header) */

.reports-link {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-2) var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--c-cyan);
  border: 2px solid var(--c-cyan);
  border-radius: 0;
  text-shadow: 0 0 6px rgba(0,245,255,.45);
  box-shadow: 0 0 10px rgba(0,245,255,.2);
  transition: background var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              transform var(--dur-fast) var(--ease-spring);
}
.reports-link:hover {
  background: rgba(0,245,255,.1);
  box-shadow: 0 0 18px rgba(0,245,255,.4);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════ Account (header) & login */

.account-menu { position: relative; }
.account-menu-list { min-width: 12rem; }

.account-name {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: normal;
}

.account-menu-who {
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-text-muted);
}
.account-menu-who strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-text);
}

.menu-item {
  width: 100%;
  text-align: left;
  font-family: var(--font-mono);        /* actions, like the buttons */
}
.menu-item svg { color: var(--c-text-muted); }

.menu-separator {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: var(--sp-1) 0;
}

.account-logout { display: contents; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.login-card { max-width: 24rem; }

/* ═══════════════════════════════════════════════ Reports page */

.reports-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.reports-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: var(--nav-h);
  padding: var(--sp-3) var(--container-pad);
  background: var(--c-nav-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--c-border);
}
.reports-back {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}
.report-name-input {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--c-text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: var(--sp-1) var(--sp-2);
  text-align: right;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.report-name-input:hover,
.report-name-input:focus {
  outline: none;
  border-color: var(--c-border);
  background: var(--c-surface-hi);
}

.reports-content {
  padding: var(--sp-8) var(--container-pad) var(--sp-16);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  max-width: var(--container-max);
  width: 100%;
  margin: 0 auto;
}

/* ── Dropzone ── */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-10) var(--sp-5);
  text-align: center;
  color: var(--c-text-muted);
  background: var(--c-surface);
  border: 2px dashed var(--c-border);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.dropzone.active {
  border-color: var(--c-accent);
  background: var(--c-accent-subtle);
}

/* ── Sources list ── */

.report-sources {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.report-source-row {
  display: grid;
  grid-template-columns: 1.5rem 1fr 10rem 12rem 6rem auto;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
}
.report-source-row.error { border-color: var(--c-pink); }
.report-source-status { text-align: center; color: var(--c-accent); }
.report-source-row.error .report-source-status { color: var(--c-pink); }
.report-source-filename {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-source-person {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: var(--sp-1) var(--sp-2);
}
.report-source-error {
  font-size: var(--text-sm);
  color: var(--c-pink);
  grid-column: span 2;
}
.report-source-period,
.report-source-hours {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--c-text-muted);
}
.report-source-warnings {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--text-xs);
  color: var(--c-gold);
  padding-left: calc(1.5rem + var(--sp-3));
}

/* ── Import summary ── */

.import-summary {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.import-summary-filename {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--c-text);
}
.import-summary-error { color: var(--c-pink); }
.import-summary-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding-left: var(--sp-5);
  font-size: var(--text-sm);
  color: var(--c-text);
}
.import-summary-warnings {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--text-xs);
  color: var(--c-gold);
}

/* ── Alias editor ── */

.report-aliases {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.report-alias-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
}
.report-alias-variants {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-alias-arrow { color: var(--c-cyan); }
.report-alias-row input {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: var(--sp-1) var(--sp-2);
}

/* ── The report itself ── */

.report-view {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--c-border);
}

.report-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.report-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--c-text);
}
.report-meta {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--c-text-muted);
}

.report-vat-line {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--c-text-muted);
}

.report-table-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.report-table th,
.report-table td {
  padding: var(--sp-2) var(--sp-3);
  text-align: right;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--c-border);
}
.report-table th:first-child,
.report-table td:first-child {
  text-align: left;
  font-variant-numeric: normal;
}
.report-table thead th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-cyan);
}
.report-table tbody td { color: var(--c-text); }
.report-table tbody tr:hover { background: var(--c-surface); }

.report-matrix-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.report-matrix-toggle {
  display: flex;
  gap: 1px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.report-matrix-toggle button {
  padding: var(--sp-1) var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.report-matrix-toggle button.active {
  background: var(--c-accent);
  color: var(--c-accent-fg);
}

.report-categories {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--c-text);
}

.report-actions {
  display: flex;
  gap: var(--sp-3);
}

/* ═══════════════════════════════════════════════ §11  Responsive */

@media (max-width: 760px) {
  :root { --container-pad: 1rem; --nav-h: 3.25rem; }

  .app { flex-direction: column; }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--c-border);
  }

  .project-list { max-height: 15rem; }

  .group-table-head { display: none; }         /* labels drop; cells stay ordered */
  .group-table-row {
    grid-template-columns: 4.5rem 4.5rem 4rem 4.5rem 1fr;
    gap: var(--sp-2);
    padding-inline: var(--sp-4);
  }
  /* The 16px time fields need two rows at this width. */
  .group-table-row.editing {
    grid-template-columns: 1fr 1fr;
    row-gap: var(--sp-3);
    padding-block: var(--sp-3);
  }
  .group-table-row.editing .cell-tail,
  .group-table-row.editing.manual .cell-tail {
    grid-column: 1 / -1;
  }
  .group-header { padding-inline: var(--sp-4); }


  .log-work-grid-head { display: none; }
  .log-work-grid-row {
    grid-template-columns: 1fr 1fr;
    row-gap: var(--sp-2);
  }

  .cost-table-row {
    grid-template-columns: 5rem 1fr 4.5rem;
    row-gap: var(--sp-1);
    padding-inline: var(--sp-4);
  }
  .cost-table-row .cell-tail { grid-column: 1 / -1; justify-content: flex-start; }
  .cost-dialog-row { flex-direction: column; gap: var(--sp-3); }

  .report-source-row {
    grid-template-columns: 1.5rem 1fr auto;
    row-gap: var(--sp-1);
  }
  .report-source-period, .report-source-hours { display: none; }
  .report-alias-row { flex-direction: column; align-items: stretch; }
}

@media (min-width: 640px)  { :root { --container-pad: 1.5rem; } }
@media (min-width: 1280px) { :root { --container-pad: 2rem; } }

/* ═══════════════════════════════════════════════ §9  Reduced motion */

@media (prefers-reduced-motion: reduce) {
  /* The query is treated as a general low-visual-noise request, so the CRT
   * overlays go too — not only the animation. */
  body::before, body::after { display: none; }

  .dot.pulse { animation: none; }

  *, *::before, *::after {
    transition-duration: 0.001ms !important;
  }
}

/* ═══════════════════════════════════════════════ §10.4  Print */

@media print {
  .topbar, .sidebar, .skip-link, .dialog-scrim,
  .row-actions, .day-bar, .live-pill, .note-link.unset { display: none !important; }

  body { font-size: 12pt; color: #000; background: #fff; }
  body::before, body::after { display: none; }     /* kill the CRT layer */

  .content { padding: 0; max-width: 100%; }
  .summary-value, .summary-money, .label-caps, .running-label,
  .group-name, .cell-time, .cell-duration, .cell-hint, .note-link, .entry-manual,
  .group-subtotal, .group-subtotal-money,
  .cost-category-label, .cost-description, .badge-status {
    color: #000;
    text-shadow: none;
  }
  .group, .cost-section { border-color: #999; background: #fff; }

  .reports-topbar, .dropzone, .report-sources, .report-aliases,
  .report-actions, .skip-link { display: none !important; }
  .reports-content { padding: 0; max-width: 100%; }
  .report-title, .report-meta, .report-vat-line, .report-categories,
  .report-table th, .report-table td {
    color: #000;
    text-shadow: none;
  }
  .report-table th, .report-table td { border-color: #999; }
  .report-matrix-toggle { display: none; }
}
