/* ============================================================================
   LEX84 LABS — shared design system
   Single source of truth. Served by every app from /shared/lex84.css.
   Do not fork this file; app-specific rules belong in that app's own <style>
   block and should consume the tokens below rather than raw hex.

   Modelled on Apple's HIG: the platform font, semantic colour roles that flip
   with the colour scheme, hairline separators, restrained elevation, and
   generous whitespace. No webfont — SF on Apple devices, Segoe on Windows,
   Roboto on Android, all of which beat a 300ms render-blocking CDN request.
   ========================================================================= */

/* ── Tokens ───────────────────────────────────────────────────────────────
   Colour roles are named for their JOB (label, separator, fill), not their
   value, so the dark scheme is an override of the same names rather than a
   parallel set of rules. */

:root {
  color-scheme: light dark;

  /* Type — the platform UI font, in the order each OS prefers it. */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto,
          'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  /* Scale, loosely Apple's text styles. Line heights are unitless so they
     survive being nested in a larger context. */
  --text-large-title: 2rem;      --lh-large-title: 1.15;
  --text-title-1: 1.5rem;        --lh-title-1: 1.2;
  --text-title-2: 1.25rem;       --lh-title-2: 1.25;
  --text-title-3: 1.0625rem;     --lh-title-3: 1.3;
  --text-body: 0.9375rem;        --lh-body: 1.5;
  --text-callout: 0.875rem;      --lh-callout: 1.45;
  --text-footnote: 0.8125rem;    --lh-footnote: 1.4;
  --text-caption: 0.75rem;       --lh-caption: 1.35;
  --text-caption-2: 0.6875rem;   --lh-caption-2: 1.3;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Tracking. Apple tightens large text and opens up small caps-y labels. */
  --tracking-tight: -0.021em;
  --tracking-normal: 0;
  --tracking-wide: 0.06em;

  /* Space — 4pt base, 8pt rhythm. */
  --space-1: 4px;   --space-2: 8px;   --space-3: 12px;  --space-4: 16px;
  --space-5: 20px;  --space-6: 24px;  --space-8: 32px;  --space-10: 40px;
  --space-12: 48px; --space-16: 64px;

  /* Radius — continuous-feeling corners; the larger the surface the rounder. */
  --radius-xs: 6px;  --radius-sm: 8px;  --radius-md: 10px;
  --radius-lg: 14px; --radius-xl: 18px; --radius-full: 999px;

  /* Elevation. Deliberately shallow: Apple separates with hairlines and
     contrast first, shadow last. */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08), 0 12px 32px rgba(0, 0, 0, 0.06);

  /* Motion. Short and ease-out; anything slower reads as lag, not polish. */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 120ms;
  --duration: 200ms;

  --topbar-height: 52px;
  --content-width: 760px;
}

/* ── Light scheme (default) ───────────────────────────────────────────── */

:root,
:root[data-theme='light'] {
  /* Backgrounds: page is grey, content sits on white. */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-raised: #ffffff;

  /* Fills — tinted greys for inputs, tracks, and inactive chips. */
  --fill: rgba(118, 118, 128, 0.08);
  --fill-strong: rgba(118, 118, 128, 0.14);

  /* Text */
  --label: #1d1d1f;
  --label-2: #6e6e73;
  --label-3: #86868b;
  --label-on-accent: #ffffff;

  /* Lines */
  --separator: rgba(0, 0, 0, 0.08);
  --separator-strong: #d2d2d7;

  /* Brand accent — Lex84 forest green. */
  --accent: #1b4332;
  --accent-hover: #123026;
  --accent-text: #1b5e40;
  --accent-soft: #e7f1ec;
  --accent-soft-text: #14532d;
  --ring: rgba(45, 106, 79, 0.35);

  /* Status */
  --positive: #1b7f4f;
  --positive-soft: #e6f4ec;
  --warning: #9a6300;
  --warning-soft: #fdf3e0;
  --negative: #b3261e;
  --negative-soft: #fdecec;

  --overlay: rgba(0, 0, 0, 0.28);
  --material: rgba(255, 255, 255, 0.72);
}

/* ── Dark scheme ──────────────────────────────────────────────────────────
   Apple's dark treatment: near-black page, elevated surfaces lifted by
   lightness rather than shadow, and an accent brightened enough to survive
   the inversion — the light-mode forest green is unreadable on black. */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --surface-raised: #2c2c2e;

    --fill: rgba(120, 120, 128, 0.20);
    --fill-strong: rgba(120, 120, 128, 0.32);

    --label: #f5f5f7;
    --label-2: rgba(235, 235, 245, 0.62);
    --label-3: rgba(235, 235, 245, 0.38);
    --label-on-accent: #ffffff;

    --separator: rgba(84, 84, 88, 0.55);
    --separator-strong: rgba(84, 84, 88, 0.80);

    --accent: #35835f;
    --accent-hover: #3f9b71;
    --accent-text: #55d6a0;
    --accent-soft: rgba(85, 214, 160, 0.15);
    --accent-soft-text: #6fe0b0;
    --ring: rgba(85, 214, 160, 0.45);

    --positive: #4fd1a1;
    --positive-soft: rgba(79, 209, 161, 0.15);
    --warning: #e3a23c;
    --warning-soft: rgba(227, 162, 60, 0.15);
    --negative: #ff6b61;
    --negative-soft: rgba(255, 107, 97, 0.15);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.55), 0 12px 32px rgba(0, 0, 0, 0.45);

    --overlay: rgba(0, 0, 0, 0.55);
    --material: rgba(28, 28, 30, 0.72);
  }
}

/* Explicit opt-in, so the toggle can override the OS in both directions. */
:root[data-theme='dark'] {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-raised: #2c2c2e;
  --fill: rgba(120, 120, 128, 0.20);
  --fill-strong: rgba(120, 120, 128, 0.32);
  --label: #f5f5f7;
  --label-2: rgba(235, 235, 245, 0.62);
  --label-3: rgba(235, 235, 245, 0.38);
  --label-on-accent: #ffffff;
  --separator: rgba(84, 84, 88, 0.55);
  --separator-strong: rgba(84, 84, 88, 0.80);
  --accent: #35835f;
  --accent-hover: #3f9b71;
  --accent-text: #55d6a0;
  --accent-soft: rgba(85, 214, 160, 0.15);
  --accent-soft-text: #6fe0b0;
  --ring: rgba(85, 214, 160, 0.45);
  --positive: #4fd1a1;
  --positive-soft: rgba(79, 209, 161, 0.15);
  --warning: #e3a23c;
  --warning-soft: rgba(227, 162, 60, 0.15);
  --negative: #ff6b61;
  --negative-soft: rgba(255, 107, 97, 0.15);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.55), 0 12px 32px rgba(0, 0, 0, 0.45);
  --overlay: rgba(0, 0, 0, 0.55);
  --material: rgba(28, 28, 30, 0.72);
}

/* ── Compatibility aliases ────────────────────────────────────────────────
   The four apps grew their own token vocabularies for the same values
   (--card vs --surface, --text2 vs --label-2, and --navy/--blue both holding
   green). These aliases keep each app's remaining local rules working while
   they migrate. Write new rules against the semantic names above; treat
   everything in this block as deprecated. */

:root {
  --card: var(--surface);
  --surface2: var(--surface-2);
  --card-2: var(--surface-2);
  --border: var(--separator);
  --text: var(--label);
  --text2: var(--label-2);
  --text3: var(--label-3);
  --muted: var(--label-2);
  --navy: var(--accent);          /* historically held green, not navy */
  --blue: var(--accent);          /* ditto */
  --blue-light: var(--accent-text);
  --accent-2: var(--accent-text);
  --green: var(--positive);
  --red: var(--negative);
  --err: var(--negative);
  --star: #e0a100;
  --shadow: var(--shadow-md);
  --radius: var(--radius-xl);
}

/* ── Reset ────────────────────────────────────────────────────────────── */

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

* { margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  background: var(--bg);
  color: var(--label);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }

/* Inherit the UI font into controls — browsers otherwise substitute their own. */
button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* One focus treatment everywhere. :focus-visible so pointer users never see
   a ring, keyboard users always do. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
  border-radius: var(--radius-xs);
}

::selection { background: var(--accent-soft); color: var(--accent-soft-text); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Layout ───────────────────────────────────────────────────────────── */

.lex-page,
.app,
.wrap {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-16);
}

@media (max-width: 640px) {
  .lex-page, .app, .wrap { padding: var(--space-4) var(--space-3) var(--space-12); }
}

/* ── Top bar ──────────────────────────────────────────────────────────────
   One component, one name. Sticky and translucent so content scrolls under
   it — the single most "Apple" gesture available for the cost. */

.lex-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  background: var(--material);
  border-bottom: 1px solid var(--separator);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

/* No backdrop-filter (older Firefox): fall back to an opaque bar rather than
   unreadable text over scrolling content. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .lex-topbar { background: var(--surface); }
}

.lex-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-title-3);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  color: var(--label);
  text-decoration: none;
}
.lex-brand:hover { color: var(--label); text-decoration: none; }
.lex-brand::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--accent-text);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex: none;
}

.lex-topbar-spacer { margin-left: auto; }

/* App switcher — the thing that makes four tools feel like one product. */
.lex-switcher { position: relative; }

.lex-switcher-btn,
.lex-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 32px;
  padding: 0 var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--fill);
  color: var(--label);
  font-size: var(--text-footnote);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease);
}
.lex-iconbtn { width: 32px; padding: 0; }
.lex-switcher-btn:hover,
.lex-iconbtn:hover { background: var(--fill-strong); }

.lex-switcher-btn .lex-chev {
  width: 10px; height: 10px;
  transition: transform var(--duration) var(--ease);
}
.lex-switcher-btn[aria-expanded='true'] .lex-chev { transform: rotate(180deg); }

.lex-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 232px;
  padding: var(--space-1);
  background: var(--surface-raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease-out);
}
.lex-menu[data-open='true'] {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.lex-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--label);
  font-size: var(--text-callout);
  text-decoration: none;
}
.lex-menu-item:hover { background: var(--fill); text-decoration: none; }
.lex-menu-item[aria-current='page'] { color: var(--accent-text); font-weight: var(--weight-semibold); }
.lex-menu-item .lex-menu-glyph { font-size: 15px; width: 20px; text-align: center; flex: none; }
.lex-menu-item .lex-menu-sub {
  display: block;
  font-size: var(--text-caption);
  color: var(--label-3);
  font-weight: var(--weight-regular);
}
.lex-menu-sep { height: 1px; margin: var(--space-1) var(--space-2); background: var(--separator); }

.lex-identity { text-align: right; line-height: 1.25; min-width: 0; }
.lex-identity-name { font-size: var(--text-footnote); font-weight: var(--weight-medium); }
.lex-identity-email {
  font-size: var(--text-caption-2);
  color: var(--label-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

@media (max-width: 560px) {
  .lex-identity { display: none; }
}

/* ── Page header ──────────────────────────────────────────────────────── */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-2) var(--space-1) var(--space-6);
}

.ph-left { min-width: 0; }
.ph-kicker {
  font-size: var(--text-caption-2);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: var(--space-1);
}
.ph-title {
  font-size: var(--text-large-title);
  line-height: var(--lh-large-title);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}
.ph-sub {
  font-size: var(--text-callout);
  color: var(--label-2);
  margin-top: var(--space-1);
}
.ph-right { margin-left: auto; text-align: right; font-size: var(--text-caption); color: var(--label-2); }
.ph-stat {
  font-size: var(--text-title-1);
  font-weight: var(--weight-bold);
  color: var(--label);
  letter-spacing: var(--tracking-tight);
}

@media (max-width: 640px) {
  .page-header { padding-bottom: var(--space-4); }
  .ph-title { font-size: var(--text-title-1); }
  .ph-right { margin-left: 0; text-align: left; }
}

/* ── Card ─────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
  .card { padding: var(--space-4); border-radius: var(--radius-lg); }
}

.card-title {
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--label-3);
  margin-bottom: var(--space-1);
}
.card-sub {
  font-size: var(--text-callout);
  color: var(--label-2);
  margin-bottom: var(--space-4);
}

/* ── Buttons ──────────────────────────────────────────────────────────────
   One base, three intents. Height is fixed so buttons line up on a row
   regardless of label length or icon presence. */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 38px;
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-callout);
  font-weight: var(--weight-semibold);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease),
              opacity var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--label-on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-ghost { background: var(--fill); color: var(--label); }
.btn-ghost:hover:not(:disabled) { background: var(--fill-strong); }

.btn-danger { background: var(--negative-soft); color: var(--negative); }
.btn-danger:hover:not(:disabled) { background: var(--negative); color: #fff; }

.btn-mini {
  height: 28px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-xs);
  font-size: var(--text-caption);
  background: var(--fill);
  color: var(--label-2);
  border: none;
  cursor: pointer;
  font-weight: var(--weight-medium);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}
.btn-mini:hover { background: var(--fill-strong); color: var(--label); }
.btn-mini.danger:hover { background: var(--negative-soft); color: var(--negative); }

.actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-4);
}

/* ── Forms ────────────────────────────────────────────────────────────── */

label {
  display: block;
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  color: var(--label-2);
  margin-bottom: var(--space-1);
}

input, select, textarea {
  width: 100%;
  padding: 10px var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  color: var(--label);
  font-size: var(--text-body);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease),
              background var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--label-3); }
input:focus, select:focus, textarea:focus {
  background: var(--surface);
  border-color: var(--accent-text);
  box-shadow: 0 0 0 3px var(--ring);
}
input[type='checkbox'], input[type='radio'] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-text);
}
/* Date/time pickers render their own glyphs — make them visible in dark mode. */
input[type='date'], input[type='time'] { color-scheme: light dark; }

.row { display: grid; gap: var(--space-3); margin-bottom: var(--space-3); }
.row-2 { grid-template-columns: 1fr 1fr; }
.row-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) {
  .row-2, .row-3 { grid-template-columns: 1fr; }
}

.check-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-callout);
  font-weight: var(--weight-regular);
  color: var(--label-2);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  margin-bottom: 0;
}
.check-row input { width: 16px; height: 16px; flex: none; }

.hint, .note {
  font-size: var(--text-caption);
  color: var(--label-3);
  line-height: 1.5;
  margin-top: var(--space-2);
}

/* ── Segmented control (tabs) ─────────────────────────────────────────────
   Apple's segmented control: a track holding equal segments, with the active
   one raised on a white pill rather than inverted. */

.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  margin-bottom: var(--space-4);
  background: var(--fill);
  border-radius: var(--radius-md);
}
.tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 6px var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-footnote);
  font-weight: var(--weight-medium);
  color: var(--label-2);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}
.tab:hover { color: var(--label); }
.tab.active,
.tab[aria-selected='true'] {
  background: var(--surface);
  color: var(--label);
  font-weight: var(--weight-semibold);
  box-shadow: var(--shadow-sm);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Chips / pills / badges ───────────────────────────────────────────── */

.pill, .badge, .tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px var(--space-2);
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  font-size: var(--text-caption-2);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}
.pill.off, .badge.off { background: var(--fill); color: var(--label-2); }
.pill.positive { background: var(--positive-soft); color: var(--positive); }
.pill.warning { background: var(--warning-soft); color: var(--warning); }
.pill.negative { background: var(--negative-soft); color: var(--negative); }

/* Selectable chip — presets, weekday pickers. Always a real <button>. */
.chip, .preset-btn, .wd {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px var(--space-3);
  border: 1px solid var(--separator);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--label-2);
  font-size: var(--text-footnote);
  font-weight: var(--weight-medium);
  cursor: pointer;
  user-select: none;
  transition: background var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease);
}
.chip:hover, .preset-btn:hover:not(:disabled), .wd:hover {
  border-color: var(--accent-text);
  color: var(--accent-text);
}
.chip[aria-pressed='true'], .wd[aria-pressed='true'], .wd.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--label-on-accent);
}
.preset-btn.suggested { background: var(--accent-soft); border-color: transparent; color: var(--accent-soft-text); }
.preset-btn:disabled { opacity: 0.4; cursor: default; }

.preset-row, .wd-grid, .chip-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

/* ── Lists ────────────────────────────────────────────────────────────────
   Hairline-separated rows, last one flush — the inset grouped table style. */

.list-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--separator);
}
.list-row:last-child { border-bottom: none; padding-bottom: 0; }
.list-row:first-child { padding-top: 0; }

.row-title { font-size: var(--text-callout); font-weight: var(--weight-semibold); }
.row-meta { font-size: var(--text-caption); color: var(--label-2); margin-top: 2px; }

/* ── Feedback ─────────────────────────────────────────────────────────── */

.msg {
  display: none;
  margin-top: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-caption);
  line-height: 1.5;
}
.msg.show { display: block; }
.msg.ok { background: var(--positive-soft); color: var(--positive); }
.msg.err { background: var(--negative-soft); color: var(--negative); }

.empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--label-3);
  font-size: var(--text-callout);
  line-height: 1.6;
}

.toast-wrap {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toast {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--material);
  border: 1px solid var(--separator);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow-lg);
  color: var(--label);
  font-size: var(--text-callout);
  max-width: 320px;
  animation: lex-toast-in var(--duration) var(--ease-out);
}
.toast.err { color: var(--negative); }

@keyframes lex-toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .toast-wrap { left: var(--space-3); right: var(--space-3); bottom: var(--space-3); }
  .toast { max-width: none; }
}

/* Status dot */
.dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  background: var(--label-3);
  flex: none;
  transition: background var(--duration) var(--ease);
}
.dot.on { background: var(--positive); }
.dot.err { background: var(--negative); }

/* Skeleton — for content that is loading rather than absent. */
.skeleton {
  background: linear-gradient(90deg, var(--fill) 25%, var(--fill-strong) 37%, var(--fill) 63%);
  background-size: 400% 100%;
  border-radius: var(--radius-xs);
  animation: lex-shimmer 1.4s ease-in-out infinite;
}
@keyframes lex-shimmer {
  from { background-position: 100% 50%; }
  to { background-position: 0 50%; }
}

/* ── Tables ───────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: var(--text-footnote); }
th {
  text-align: left;
  font-size: var(--text-caption-2);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--label-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--separator);
  white-space: nowrap;
}
td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--separator);
  color: var(--label);
}
tbody tr:last-child td { border-bottom: none; }

/* Wide tables scroll inside their own container — the page never does. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Utilities ────────────────────────────────────────────────────────── */

.muted { color: var(--label-2); }
.mono { font-family: var(--font-mono); font-size: 0.9em; }
.sep { color: var(--label-3); }

/* Visible only to screen readers — for labels a sighted user gets from context. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
