/* ============================================================
   dashboard.css -- focus-tracking dashboard page (dashboard.html), plus the
   .dash__state/.dash__fade/.dash__head/.dash scaffolding also used by the
   sign-in gate (login.html) so the two pages share one visual language
   instead of forking a second stylesheet for a single small page.
   Extends styles.css's tokens/components (--card, --border-soft, .card,
   .btn, .table-scroll, .ticket-badge, .section-sub) rather than redefining them.

   App-native palette, deliberately breaking from index.html's Checkpoint
   Claim-Ticket chrome: this surface shows the exact same data the companion
   app's Stats/Calendar screens do, so it borrows the app's own dark-mode
   colors, flat-card shape, and system type (app/src/theme/theme.ts's
   MODES.dark + ACCENTS.dark.mint, tokens.ts's radius/elevation) instead of
   the marketing site's stencil/steel/thermal-paper materials -- consistency
   with the software this page mirrors outranks matching the rest of the
   website here. dashboard.js overrides these custom properties with the
   signed-in user's *actual* themeMode/accent (website/js/theme.js resolves
   the same MODES/ACCENTS table); login.html (pre-auth, no user settings yet)
   always shows this default, matching useSettingsStore.ts's own
   SYNCABLE_SETTINGS_DEFAULTS (dark/mint).
   ============================================================ */
:root {
  --bg: #0b0b0c;
  --bg-2: #0b0b0c;
  --card: #17181b;
  --card-2: #17181b;
  --border: rgba(255, 255, 255, 0.16);
  --border-soft: rgba(255, 255, 255, 0.07);
  --text: #ffffff;
  --text-2: #9aa0a6;
  --text-3: #9aa0a6;
  --unlocked: #22c55e;
  --unlocked-2: #22c55e;
  --locked: #ef4444;
  --locked-2: #ef4444;
  --closed: #f2b84b;
  /* Matches readableTextColor('#ef4444') (dashboard.js's applyTheme sets the
     real per-mode value once JS runs) -- #fff fails AA against this exact
     red (3.76:1), #0b0b0b clears it (5.23:1). See .dash__labels-confirm-delete
     below, the one place this gets painted as text. */
  --locked-text: #0b0b0b;
  --accent: #22c55e;
  --accent-text: #04210f;
  --accent-soft: #1d2a20;
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 14px;
  --radius-sm: 12px;
}
/* Deliberately page-wide, NOT `.dash`-scoped. Two reasons, one of them a
   real accessibility bug rather than a palette preference:

   1. styles.css's global `:focus-visible { outline: 2px solid var(--steel) }`
      uses --steel (#c9cbce), which is a dark-mode-only assumption. Measured
      against the light theme's surfaces it is 1.50:1 on --bg (#f5f6f8) and
      1.63:1 on --card (#ffffff) -- well under WCAG 2.2 SC 1.4.11's 3:1
      floor for focus indicators. (It's 12.1:1 on the dark --bg, which is
      why this went unnoticed.) A `.dash`-scoped fix would not reach it: the
      nav lives in <header class="nav">, OUTSIDE .dash, so in light mode the
      page's primary navigation had no usable focus ring at all.
   2. The palette reason that was already here: scope this surface's focus
      color to its own app-native palette instead of the inherited
      marketing-chrome tone, so it stays visually distinct from --locked,
      which the save/error flashes below also use.

   --unlocked is the resolved accent (applyTheme repoints it per theme), and
   theme.js's ACCENTS table authors a darker variant for light mode
   precisely so accents stay contrasty against a light ground. Only
   dashboard.html and login.html load this file, so "page-wide" here means
   those two pages -- index.html keeps the steel ring on its dark ground. */
:focus-visible { outline-color: var(--unlocked); }

/* Only .dash .btn had no disabled treatment before this pass -- the add-label
   submit button below now starts disabled by default (no color picked yet),
   unlike the always-enabled button it replaces. */
.dash .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* De-stencils styles.css's global uppercase/display h1-h3 rule for this
   surface only -- app headings are normal-case system-bold, not a marquee
   stencil face.

   The de-stencil has to restore leading and tracking too, not just case and
   weight. styles.css sets `line-height: 1; letter-spacing: 0.01em` on
   h1-h3, which is right for what it targets: Bebas Neue, all-caps, and
   capitals have no descenders, so lh:1 is a deliberate marquee treatment.
   Switching to a mixed-case system face here reintroduces descenders (g, y,
   p, j, q), and the inherited lh:1 was crowding them -- measured 28px/lh1.0
   on h1 and 17.6px/lh1.0 on h2.

   The old flat `-0.3px` had the same shape of problem: a fixed px tracking
   gets proportionally TIGHTER as text gets smaller (-0.011em at 28px, but
   -0.017em at 17.6px and -0.021em at 14px) -- backwards from how optical
   tracking works. Both values below are em-based and size-specific, and
   they mirror app/src/theme/tokens.ts's `typeScale`, which this surface
   already declares itself a mirror of: title 28/32 ls-0.3 (= lh 1.14,
   -0.011em) and sectionTitle 16/20 ls-0.1 (= lh 1.25, -0.006em). That curve
   -- leading loosening as size drops, negative tracking only at display
   sizes -- is the same one Linear and Stripe measure out to. */
.dash h1, .dash h2, .dash h3 {
  text-transform: none;
  font-weight: 700;
}
.dash h1 { line-height: 1.14; letter-spacing: -0.011em; }
.dash h2, .dash h3 { line-height: 1.25; letter-spacing: -0.006em; }
/* Flat fill + soft shadow instead of styles.css's gradient+border card --
   matches tokens.ts's `elevation.card` (shadowOpacity .18, shadowRadius 6,
   offset 0/2) rather than a bordered gradient panel. */
.dash .card {
  background: var(--card);
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
/* Rounded pill buttons with a flat accent fill, replacing styles.css's
   uppercase stamped-press button for this surface -- matches the app's own
   AnimatedPressable buttons (flat accent fill, no 3D press shadow). */
.dash .btn {
  text-transform: none;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0;
  border-radius: 12px;
}
/* The border:none/box-shadow:none below are load-bearing, not cosmetic:
   styles.css's .btn--primary hardcodes a mint-700 (#15803d) ring and a mint
   glow outside any variable, so without these two lines a violet/amber
   accent would sit inside a fixed green ring. This override predates the
   light-mode pass -- noted here because it is the reason that bug was never
   actually reachable on the dashboard, only on index.html/login.html. */
.dash .btn--primary {
  background: var(--unlocked);
  color: var(--accent-text);
  border: none;
  box-shadow: none;
}
.dash .btn--primary:hover { box-shadow: 0 8px 20px -8px var(--unlocked); }
.dash .btn--primary:active { transform: scale(0.97); box-shadow: none; }
/* styles.css's .btn--ghost fill/outline are a fixed near-white wash --
   readable on dark, a smear on light. --border-soft/--border (theme-derived,
   see applyTheme) flip the wash for free. */
.dash .btn--ghost {
  border-radius: 12px;
  background: var(--border-soft);
  border-color: var(--border);
}
.dash .btn--ghost:hover { background: var(--border); }

.dash { padding-top: clamp(40px, 6vw, 72px); }
.dash__head { max-width: 640px; margin-bottom: clamp(28px, 4vw, 44px); }
.dash__head h1 { font-size: clamp(1.75rem, 3vw, 2rem); margin-top: var(--space-2-5); }
.dash__head .section-sub { margin-top: var(--space-3-5); }

.dash__state { padding: var(--space-6) var(--space-5); }
.dash__state h2 { font-size: 1.1rem; margin-bottom: var(--space-2-5); }
.dash__state p { color: var(--text-2); font-size: var(--fs-base); max-width: 60ch; }
.dash__state code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--border-soft); /* was a fixed white-8% wash, invisible on a light card */
  padding: var(--space-0-5) var(--space-1-5); border-radius: 6px; font-size: 0.92em;
}
/* A left accent bar reads as "this card is an alert" without needing the
   all-around border the flat/shadow card system above just removed. */
.dash__state--error { border-left: 3px solid var(--locked); padding-left: var(--space-4); }
.dash__state--error h2 { color: var(--locked); }
/* Was a bare unstyled <p> -- no card, no spinner, indistinguishable from a
   stalled page. Now matches #dashNotConfigured/#dashError's card treatment. */
.dash__state--loading { display: flex; align-items: center; gap: var(--space-3); }
.dash__state--loading p { margin: 0; }
.dash__spinner {
  flex: none; width: var(--space-5); height: var(--space-5); border-radius: 50%;
  border: 2px solid var(--border-soft); border-top-color: var(--unlocked);
  animation: dashSpin 0.8s linear infinite;
}
@keyframes dashSpin { to { transform: rotate(360deg); } }
#dashLoading p { color: var(--text-2); }
.dash__state .btn { margin-top: var(--space-4-5); }

/* State crossfade -- was an instant `hidden`-attribute swap between five
   mutually-exclusive containers (dashboard.js showState()); now settles in
   with the same opacity/translateY pattern as the waitlist form -> thanks
   hand-off on index.html (styles.css .waitlist__thanks), reusing --ease-snap
   rather than forking a new curve. Applied to all five state containers,
   including #dashContent which carries no other .dash__state styling. */
.dash__fade { opacity: 0; transform: translateY(10px); transition: opacity var(--dur-slow) var(--ease-snap), transform var(--dur-slow) var(--ease-snap); }
.dash__fade.is-in { opacity: 1; transform: none; }

/* Smaller-scale sibling of .dash__fade above -- same curve/technique, a
   shorter distance/duration because this fades a one-line inline status
   message (#dashWriteError, #dashLabelsMsg), not a whole panel. */
.dash__msg { opacity: 0; transform: translateY(-4px); transition: opacity var(--dur-base) var(--ease-snap), transform var(--dur-base) var(--ease-snap); }
.dash__msg.is-in { opacity: 1; transform: none; }

/* Another .dash__fade sibling, scaled for an inline pill-sized swap: the
   label chip<->picker swap, the recolor-popover swatches, and the
   add-form<->at-capacity-message toggle all reuse this one class rather
   than inventing a third fade variant per surface. */
.dash__pick-fade { opacity: 0; transform: scale(0.94); transition: opacity var(--dur-base) var(--ease-snap), transform var(--dur-base) var(--ease-snap); }
.dash__pick-fade.is-in { opacity: 1; transform: none; }

.dash__hint { color: var(--text-2); font-size: var(--fs-sm); margin: -6px 0 var(--space-7); }

/* ---------- Email/password sign-in (login.html's #loginSignedOut card,
   built by emailAuthForm.js) -- reuses this file's existing .dash__state/
   .dash__fade/.dash__msg scaffolding and styles.css's .card/.btn/.form-msg,
   so only what a real input form needs that nothing above already covers
   (field/input/divider/link chrome) is added here. Both new blocks get a
   max-width rather than the card itself, matching .dash__state p's own
   max-width: 60ch above -- on this page the card spans the full .wrap, and
   constraining just the content (not the card) is the established way this
   file keeps that content from stretching edge to edge. ---------- */
.dash__auth-divider {
  display: flex; align-items: center; gap: var(--space-3); max-width: 360px;
  margin: var(--space-5) 0; color: var(--text-2); font-size: var(--fs-2xs);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.dash__auth-divider::before, .dash__auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.dash__auth-form { display: flex; flex-direction: column; gap: var(--space-4); max-width: 360px; }
.dash__auth-field { display: flex; flex-direction: column; gap: var(--space-1-5); }
.dash__auth-field-label { color: var(--text-2); font-size: var(--fs-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.dash__auth-input {
  width: 100%; padding: var(--space-3) var(--space-3-5); font-size: var(--fs-sm); font-family: var(--font-body);
  color: var(--text); background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
}
.dash__auth-links { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.dash__auth-link {
  border: none; background: none; cursor: pointer; font: inherit;
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); text-decoration: underline;
  padding: 0; transition: color var(--dur-base) var(--ease-snap);
}
.dash__auth-link:hover { color: var(--text); }

/* ---------- Summary card (mirrors StatsScreen.tsx's "Total focus time" card) ---------- */
.dash__summary-card { margin-bottom: var(--space-4-5); }
.dash__summary-label { color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; }
.dash__summary-total {
  font-weight: 800; letter-spacing: -0.5px; color: var(--unlocked);
  font-size: clamp(1.8rem, 4vw, 2.5rem); margin-top: var(--space-0-5);
}
.dash__summary-sub { color: var(--text-2); font-size: var(--fs-sm); margin-top: var(--space-0-5); }
.dash__mini-row { display: flex; gap: var(--space-5); margin-top: var(--space-3); }
.dash__mini-stat { display: flex; flex-direction: column; align-items: flex-start; }
.dash__mini-value { font-size: var(--fs-lg); font-weight: 700; color: var(--text); }
.dash__mini-label { font-size: var(--fs-2xs); color: var(--text-2); margin-top: var(--space-0-5); }

/* ---------- Two-panel grid ---------- */
.dash__grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--space-4-5); margin-bottom: var(--space-4-5); align-items: stretch; }
.dash__panel h2 { font-size: 1.1rem; margin-bottom: var(--space-4-5); }

/* ---------- Trend bars (mirrors StatsScreen.tsx's pill-shaped accent bars
   over an accent-tinted track, not a flat gray/gradient bar) ---------- */
.dash__trend { display: flex; align-items: flex-end; gap: var(--space-2-5); height: 140px; }
.dash__trend-day { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: var(--space-2); }
.dash__trend-track {
  position: relative; width: 100%; max-width: 18px; flex: 1;
  border-radius: 9px; overflow: hidden; background: var(--accent-soft);
}
/* A full-height bar scaled with transform, not an animated `height` --
   transform/opacity are the only properties that skip layout on change. */
.dash__trend-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 100%;
  border-radius: 9px;
  background: var(--unlocked);
  transform-origin: bottom; transform: scaleY(var(--h, 0.04));
  transition: transform var(--dur-slower) var(--ease);
}
.dash__trend-label { color: var(--text-2); font-size: var(--fs-2xs); font-weight: 600; }

/* ---------- Label breakdown (same pill/tint language as the trend bars
   above, for one consistent "meter" idiom across the page) ---------- */
.dash__breakdown { display: flex; flex-direction: column; gap: var(--space-3); }
.dash__breakdown-row { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: var(--space-2-5); }
.dash__breakdown-swatch { width: 12px; height: 12px; border-radius: 50%; }
.dash__breakdown-meta { display: flex; justify-content: space-between; gap: var(--space-2-5); font-size: var(--fs-sm); }
.dash__breakdown-name { color: var(--text); font-weight: 600; }
.dash__breakdown-value { color: var(--text-2); white-space: nowrap; }
/* background is set per-row inline by dashboard.js, tinted with that row's
   own topic color -- var(--border-soft) below is the pre-JS fallback only
   (was a fixed white-6% wash, invisible on a light card). */
.dash__breakdown-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--border-soft); overflow: hidden; }
.dash__breakdown-fill {
  height: 100%; width: 100%; border-radius: 3px;
  transform-origin: left; transform: scaleX(var(--w, 0));
  transition: transform var(--dur-slower) var(--ease);
}

/* ---------- Sessions table ---------- */
.dash__table { width: 100%; border-collapse: collapse; min-width: 560px; }
.dash__table th, .dash__table td { text-align: left; padding: var(--space-3) var(--space-4); font-size: var(--fs-sm); border-bottom: 1px solid var(--border-soft); }
.dash__table th { color: var(--text-2); font-size: var(--fs-2xs); font-weight: 600; }
.dash__table tbody tr:last-child td { border-bottom: none; }
.dash__chip {
  display: inline-flex; align-items: center; gap: var(--space-1-5); padding: var(--space-1) var(--space-2); border-radius: 999px; font-size: var(--fs-2xs); font-weight: 600;
}
.dash__outcome--completed { color: var(--unlocked); }
.dash__outcome--overridden { color: var(--closed); }

/* ---------- Fun facts (best-day banner + icon rows, mirrors StatsScreen.tsx) ---------- */
.dash__facts-card { margin-bottom: var(--space-4-5); }
.dash__facts { display: flex; flex-direction: column; gap: var(--space-1-5); }
.dash__facts-empty { color: var(--text-2); font-size: var(--fs-sm); }
.dash__best-day {
  display: flex; align-items: center; gap: var(--space-2); border-radius: 10px; padding: var(--space-2-5);
  margin-bottom: var(--space-1-5); background: var(--accent-soft); color: var(--unlocked);
}
.dash__best-day span { color: var(--text); font-weight: 600; font-size: var(--fs-base); }
.dash__fact-row { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) 0; color: var(--text-2); }
.dash__fact-row span { color: var(--text); font-size: var(--fs-base); }

/* ---------- Calendar ---------- */
.dash__cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.dash__cal-nav { display: flex; align-items: center; gap: var(--space-1); }
/* Bare icon buttons, no visible box -- matches the app's chevron-only month
   nav (Feather icons, accent-colored, no background/border square). A
   generous hit area (44px) replaces the app's native hitSlop for the same
   comfortable tap target without a visible button shape. */
.dash__cal-navbtn {
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--unlocked); padding: 0;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  transition: background var(--dur-base) var(--ease-snap), transform var(--dur-fast) var(--ease-snap);
}
.dash__cal-navbtn:hover { background: var(--border-soft); } /* was a fixed white-6% wash */
.dash__cal-navbtn:active { transform: scale(0.9); }
.dash__cal-month { font-size: var(--fs-lg); font-weight: 600; color: var(--text); min-width: 140px; text-align: center; }
.dash__cal-weekdays, .dash__cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.dash__cal-weekdays span { text-align: center; color: var(--text-3); font-size: var(--fs-2xs); padding-bottom: var(--space-2); }
.dash__cal-cell { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); padding: var(--space-1) 0 var(--space-2-5); }
.dash__cal-daynum {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); color: var(--text-2); background: transparent; border: none; cursor: pointer; font-family: inherit;
  transition: background var(--dur-base) var(--ease-snap), transform var(--dur-fast) var(--ease-snap);
}
.dash__cal-daynum:hover { background: var(--border-soft); } /* was a fixed white-6% wash */
.dash__cal-daynum:active { transform: scale(0.96); }
.dash__cal-cell--selected .dash__cal-daynum { border: 2px solid var(--unlocked-2); color: var(--text); }
.dash__cal-cell--today:not(.dash__cal-cell--selected) .dash__cal-daynum { border: 1px solid var(--text-3); }
/* Background + text color are both set inline by dashboard.js (accent
   alpha-composited per day's intensity, text picked by measured contrast
   against the resulting shade) -- this is a fallback only. */
.dash__cal-cell--focus .dash__cal-daynum { font-weight: 700; }
.dash__cal-dot { width: 5px; height: 5px; border-radius: 50%; }
.dash__cal-day { margin-top: var(--space-3-5); border-top: 1px solid var(--border-soft); padding-top: var(--space-3-5); }
.dash__cal-day h3 { font-size: var(--fs-sm); color: var(--text); margin-bottom: var(--space-2); }
.dash__cal-daylist { display: flex; flex-direction: column; gap: var(--space-2); }
.dash__cal-daylist li {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2-5);
  font-size: var(--fs-xs); color: var(--text-2); padding: var(--space-0-5) 0;
}
.dash__cal-daylist .dash__cal-dot { flex: none; }
.dash__cal-empty { color: var(--text-2); font-size: var(--fs-sm); }

/* ---------- Manage labels (catalog CRUD + per-session relabel picker) ---------- */
.dash__labels-list { display: flex; flex-direction: column; gap: var(--space-2-5); margin-bottom: var(--space-4); }
.dash__labels-row { display: flex; align-items: center; gap: var(--space-2-5); }
.dash__labels-row-main { display: flex; align-items: center; gap: var(--space-2-5); flex: 1; min-width: 0; }
.dash__labels-name {
  flex: 1; min-width: 0; padding: var(--space-2) var(--space-3); font-size: var(--fs-sm); font-family: var(--font-body);
  color: var(--text); background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
}
.dash__labels-empty { color: var(--text-2); font-size: var(--fs-sm); }
.dash__label-delete {
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  background: transparent; color: var(--text-2); font-size: var(--fs-md); line-height: 1;
  transition: background var(--dur-base) var(--ease-snap), color var(--dur-base) var(--ease-snap);
}
.dash__label-delete:hover { background: rgba(239, 68, 68, 0.12); color: var(--locked); }
.dash__label-add { display: flex; align-items: center; gap: var(--space-2-5); flex-wrap: wrap; }
.dash__label-add input[type="text"] {
  flex: 1; min-width: 160px; padding: var(--space-2-5) var(--space-3-5); font-size: var(--fs-sm); font-family: var(--font-body);
  color: var(--text); background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
}
.dash__labels-cap-msg { color: var(--text-2); }

/* ---------- Swatch picker (replaces the old native <input type=color>) ----------
   Same LABEL_SWATCHES set and selected-border treatment as the app's own
   CustomLabelsSection.tsx ColorSwatchRow, so choosing a label color feels
   identical between the app and this page. Two presentations of the same
   .dash__swatch-opt button: always-visible in the add-form (.dash__swatch-row),
   compact-popover for an existing row's recolor (.dash__swatch-pop) -- showing
   all 12 swatches inline per row would be visually heavy once several labels
   exist. */
.dash__swatch-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.dash__swatch-row .dash__swatch-opt { width: 26px; height: 26px; }

.dash__labels-swatch-wrap { position: relative; flex: none; }
.dash__labels-swatch {
  width: 28px; height: 28px; padding: 0; border: none; border-radius: 50%; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-snap);
}
.dash__labels-swatch:hover { transform: scale(1.08); }
/* Anchored to its trigger via `position: absolute` -- safe today since no
   ancestor (.dash__labels-row -> .dash__labels-list -> .dash .card) sets
   overflow: hidden/auto, but flag this in code if that ever changes: an
   overflow-clipping ancestor would clip this popover, and it would need
   `position: fixed` + getBoundingClientRect() anchoring instead.

   One `left: 0` anchor holds at every width, deliberately not switched by a
   media query: .dash__labels-swatch-wrap is always the FIRST child of
   .dash__labels-row-main (swatch, then name, then delete), and styles.css's
   .wrap/.card margins+padding put that trigger a fixed ~46px from the
   viewport edge regardless of viewport width (the outer .wrap's 22px side
   margin only shrinks once the viewport is wide enough for its `min(100% -
   44px, ...)` clamp to stop binding, at which point there's ample room
   anyway). This popover's own width (178px at 6 columns) plus that fixed
   46px offset fits inside every real viewport width, including 320-375px,
   so no narrower breakpoint variant is needed -- a `right: 0` anchor would
   actively break this, since it measures from the trigger's *right* edge
   while the trigger itself sits near the viewport's *left* edge. */
.dash__swatch-pop {
  position: absolute; top: 100%; left: 0; margin-top: var(--space-1-5); z-index: 5;
  display: grid; grid-template-columns: repeat(6, 22px); gap: var(--space-1-5);
  padding: var(--space-2); background: var(--card-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.4);
}
.dash__swatch-opt {
  width: 22px; height: 22px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent;
  transition: transform var(--dur-fast) var(--ease-snap), border-color var(--dur-fast) var(--ease-snap);
}
.dash__swatch-opt:hover { transform: scale(1.1); }
.dash__swatch-opt[aria-pressed="true"] { border-color: var(--text); }

/* ---------- Inline delete confirmation (replaces window.confirm) ---------- */
.dash__labels-confirm { display: flex; align-items: center; gap: var(--space-2-5); flex-wrap: wrap; }
.dash__labels-confirm-text { color: var(--text-2); font-size: var(--fs-xs); flex: 1 1 220px; }
/* color was a hardcoded #fff -- passes AA against the light-mode danger red
   (4.83:1) but fails it against the dark-mode one (3.76:1, see
   --locked-text's own comment above). var(--locked-text) is computed per-mode
   by dashboard.js's applyTheme via readableTextColor, the same helper the
   calendar heatmap cells use for the same reason. */
.dash__labels-confirm-delete {
  background: var(--locked); color: var(--locked-text); border: none; border-radius: 12px;
  font-family: var(--font-body); font-weight: 600; padding: var(--space-2) var(--space-4-5); font-size: var(--fs-sm);
  cursor: pointer; transition: transform var(--dur-fast) var(--ease-snap), box-shadow var(--dur-base);
}
.dash__labels-confirm-delete:hover { box-shadow: 0 8px 20px -8px var(--locked); }
.dash__labels-confirm-delete:active { transform: scale(0.97); }
/* Unlike its cancelBtn sibling (which carries .btn and already gets
   .dash .btn:disabled above), this button has no shared .btn class, so the
   disable-during-write treatment in labelsPanel.js's deleteBtn handler
   needs its own rule here. */
.dash__labels-confirm-delete:disabled { opacity: 0.5; cursor: not-allowed; }

/* Per-session relabel chip-button + <select>, swapped in for each other on
   click (sessionLabelPicker.js's createLabelPicker) -- sized to sit inline in
   a table cell or the calendar day list without disturbing row height.
   Always paired with .dash__chip in the markup (resolved, one-time-tag, and
   "Untagged" states) so this only resets button chrome (border/background/
   cursor/font) and never touches padding/border-radius -- .dash__chip alone
   owns those, so cascade order between the two classes can't fight over them. */
.dash__label-picker { position: relative; display: inline-flex; align-items: center; min-height: 24px; }
.dash__chip-btn {
  border: none; background: none; cursor: pointer; font: inherit;
  display: inline-flex; align-items: center; gap: var(--space-1);
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: filter var(--dur-base) var(--ease-snap);
}
/* Small caret affordance -- same Feather-outline icon language as
   .dash__cal-navbtn's chevrons, not a new icon system -- so a static-looking
   pill reads as clickable. */
.dash__chip-btn::after {
  content: "";
  width: 8px; height: 8px; flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0.55;
  transition: opacity var(--dur-base) var(--ease-snap);
}
.dash__chip-btn:hover, .dash__chip-btn:focus-visible { filter: brightness(1.08); }
.dash__chip-btn:hover::after, .dash__chip-btn:focus-visible::after { opacity: 0.9; }
.dash__chip-select {
  font-size: var(--fs-2xs); font-weight: 600; font-family: var(--font-body);
  color: var(--text); background: var(--card-2); border: 1px solid var(--border-soft);
  border-radius: 999px; padding: var(--space-1) var(--space-2);
}
/* Generic "this control is mid-write" dimming -- applied to the relabel
   <select> while its updateDoc is in flight, and reused as-is (not
   reinvented) for the rename <input> during its own write in labelsPanel.js. */
.dash__chip-select--saving { opacity: 0.6; cursor: wait; }

/* One-shot save/error flash -- fire-and-forget @keyframes rather than a
   transition+class-removal pair, since there's no persistent "flashed" end
   state to toggle back from. Still plain CSS, consistent with this file's
   NO-GSAP header comment: a single low-key 2px ring is not the repeated
   overshoot beat that decision was written against. Both durations are
   covered by styles.css's existing global prefers-reduced-motion rule. */
.dash__save-flash { animation: dashSaveFlash var(--dur-flash) var(--ease) forwards; }
@keyframes dashSaveFlash {
  0% { box-shadow: 0 0 0 2px var(--unlocked); }
  100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}
.dash__save-flash--err { animation-name: dashSaveFlashErr; animation-duration: var(--dur-flash-err); }
@keyframes dashSaveFlashErr {
  0% { box-shadow: 0 0 0 2px var(--locked); }
  100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

/* ---------- Focus goals (goalsPanel.js) ----------
   Reuses the page's existing "meter" idiom rather than introducing a third
   one: the same track/fill pair, the same transform-not-width scaling via
   --w, and the same transition timing as .dash__breakdown-fill above, so a
   goal's progress bar and a label's share bar read as one system. Row
   chrome (empty state, inline delete confirm, action buttons) is likewise
   shared with the Manage-labels rules above wherever the class is identical
   -- only the goal-specific pieces are new here. */
.dash__goals-list { display: flex; flex-direction: column; gap: var(--space-4-5); margin-bottom: var(--space-3-5); }
.dash__goals-row-main { display: flex; flex-direction: column; gap: var(--space-2); }
.dash__goals-head { display: flex; align-items: center; gap: var(--space-2); }
.dash__goals-swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dash__goals-name {
  color: var(--text); font-weight: 600; font-size: var(--fs-sm);
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash__goals-period {
  flex: none; font-size: var(--fs-3xs); font-weight: 600; color: var(--text-2);
  background: var(--border-soft); /* matches the old fixed white-7% fill's alpha exactly */
  border-radius: 8px; padding: var(--space-0-5) var(--space-2);
}
/* position: relative anchors .dash__goals-notch, which is the one thing this
   track has that .dash__breakdown-track doesn't. overflow: hidden still
   clips the fill to the rounded ends -- the notch is always strictly inside
   the track (targetPct < 100 whenever it's drawn at all, see
   goalsPanel.js's barGeometry), so nothing legitimate gets clipped by it. */
.dash__goals-track {
  position: relative; height: 8px; border-radius: 4px; overflow: hidden;
  background: var(--border-soft); /* was a fixed white-9% wash (pre-JS fallback only, see below) */
}
/* background is set per-row inline by goalsPanel.js (the goal's own topic
   color) except when the goal is met, where --unlocked below takes over --
   this is the pre-JS fallback only, same arrangement as
   .dash__breakdown-fill's. */
.dash__goals-fill {
  height: 100%; width: 100%; border-radius: 4px; background: var(--text-3);
  transform-origin: left; transform: scaleX(var(--w, 0));
  transition: transform var(--dur-slower) var(--ease);
}
/* A met goal switches to the page's "good" status color rather than staying
   on its own topic color, so "target hit" is legible at a glance down a list
   of several goals -- the same semantic use of --unlocked as
   .dash__outcome--completed. */
.dash__goals-fill--met { background: var(--unlocked); }
/* The target line on an over-target bar. Punched in the panel's own card
   background so it reads as a GAP in the bar at the target, not as a third
   colored segment competing with the fill. translateX centers it on the
   percentage goalsPanel.js sets as `left`. */
.dash__goals-notch {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--card); transform: translateX(-1px);
}
.dash__goals-meta { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2-5); font-size: var(--fs-xs); color: var(--text-2); }
.dash__goals-pct { font-weight: 700; color: var(--text-2); flex: none; }
.dash__goals-pct--met { color: var(--unlocked); }
.dash__goals-actions { display: flex; align-items: center; gap: var(--space-3-5); }
.dash__goals-window { flex: 1; min-width: 0; color: var(--text-3); font-size: var(--fs-2xs); }
/* Text-only affordances, matching the app row's "Edit"/"Delete" links rather
   than the page's filled .btn -- two filled buttons per goal would out-weigh
   the progress bar they sit under. */
.dash__goals-action {
  flex: none; border: none; background: none; cursor: pointer;
  font: inherit; font-size: var(--fs-xs); font-weight: 600; padding: var(--space-0-5) 0;
  color: var(--unlocked); transition: filter var(--dur-base) var(--ease-snap);
}
.dash__goals-action:hover { filter: brightness(1.15); }
.dash__goals-action--danger { color: var(--locked); }
.dash__goals-confirm { display: flex; align-items: center; gap: var(--space-2-5); flex-wrap: wrap; }

/* The add/edit form, built by goalsPanel.js's buildGoalForm and mounted
   either in #dashGoalFormSlot (create) or in place of a row (edit) -- one
   ruleset covers both, since it is literally the same DOM either way. */
.dash__goal-form-slot { display: flex; }
.dash__goal-form {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: var(--space-3);
  width: 100%; padding: var(--space-3-5); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  background: var(--bg);
}
.dash__goal-field { display: flex; flex-direction: column; gap: var(--space-1-5); }
.dash__goal-field-label { color: var(--text-2); font-size: var(--fs-2xs); font-weight: 600; }
/* The selects inherit .dash__chip-select (the relabel dropdown's pill), but
   that one is sized for a table cell -- these sit in a form row, so they get
   the form controls' own padding/size without redefining color or chrome. */
.dash__goal-form .dash__chip-select { font-size: var(--fs-xs); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }
.dash__goal-target-row { display: flex; align-items: center; gap: var(--space-1-5); }
.dash__goal-num {
  width: 66px; padding: var(--space-2) var(--space-2-5); font-size: var(--fs-xs); font-family: var(--font-body);
  color: var(--text); background: var(--card-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
}
.dash__goal-unit { color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; }
.dash__goal-form-actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
/* Full-width so a validation message from goals.js (which can be a full
   sentence, e.g. "Goal target must be between 60 and 604800 seconds for a
   weekly goal.") wraps under the fields instead of squeezing them. */
.dash__goal-form .form-msg { flex: 1 0 100%; order: 99; margin: 0; }

@media (max-width: 860px) {
  .dash__grid { grid-template-columns: 1fr; }
  /* Stack the goal form's fields once the row can no longer hold them side
     by side -- the selects/number inputs would otherwise each shrink below a
     usable tap width. */
  .dash__goal-form { flex-direction: column; align-items: stretch; }
  .dash__goal-form-actions { margin-left: 0; }
}
