/* ============================================================================
   claude-theme.css — shared claude.ai design-system stylesheet for AutomationTG
   ----------------------------------------------------------------------------
   THREE-theme, accent-overridable token system.

   Themes are selected by  <html data-theme="…">  (NEVER by prefers-color-scheme,
   so the user's explicit choice always wins). Any prefers-* rule is gated to
   :root:not([data-theme]) so it only acts as a no-choice fallback.

     :root  /  [data-theme="light"]   LIGHT  — clean, bright, warm-neutral
     [data-theme="sand"]              SAND   — the classic claude.ai warm paper
                                               (this is the app's default look;
                                                appearance.js sets data-theme=sand
                                                when the user hasn't chosen one)
     [data-theme="dark"]              DARK   — warm dark (not cold slate)

   ACCENT — every accent usage flows from three vars:
       --c-accent · --c-accent-hover · --c-accent-active
   The default family is "clay" (#CC785C). At runtime appearance.js overrides
   those three INLINE on <html>, which beats every rule here. Everything else that
   uses the accent (subtle wash, focus ring, selection) is DERIVED from --c-accent
   via color-mix in each theme block, so overriding just those three recolours the
   whole UI in any theme — no extra vars required from appearance.js.

   The file then REMAPS every Tailwind CDN utility class the pages use
   (gray/blue/red/green/etc.) onto the --c-* tokens, so the same markup adopts the
   active theme + accent automatically. !important beats the Tailwind CDN.

   Include on every page, AFTER the Tailwind CDN <script>:
     <link rel="stylesheet" href="/claude-theme.css">
   And, in <head> BEFORE this sheet, the tiny no-FOUC boot in appearance.js.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─────────────────────────────────────────────────────────────────────────
   0. THEME-INVARIANT TOKENS — typography, radii, accent default
   These live on :root and are inherited by every theme; each theme block
   below only overrides the colour / surface / ink / border / shadow tokens.
   ───────────────────────────────────────────────────────────────────────── */
:root {
  /* typography */
  --font-ui: 'Styrene B', 'Inter', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Tiempos Headline', 'Copernicus', 'Fraunces', ui-serif, Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, 'Cascadia Code', 'Roboto Mono', Menlo, Consolas, monospace;

  /* radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-button: 10px;
  --r-input: 10px;
  --r-card: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 9999px;

  /* ── ACCENT (clay) — DEFAULT family. ──────────────────────────────────────
     appearance.js overrides --c-accent / --c-accent-hover / --c-accent-active
     INLINE on <html> when a non-default accent is picked. Everything below is
     DERIVED from --c-accent via color-mix, so overriding just those three vars
     automatically recolours the subtle wash, focus ring and selection too — no
     need for appearance.js to also set the derived tokens. Each theme block may
     still re-state --c-accent-subtle / --c-accent-text for its own contrast. */
  --c-accent: #CC785C;
  --c-accent-hover: #B5654B;
  --c-accent-active: #A9583E;
  --c-accent-subtle: color-mix(in srgb, var(--c-accent) 16%, #ffffff); /* wash behind accent text / badges */
  --c-accent-text: #FFFFFF;     /* text / icon colour ON the accent fill */
}

/* ─────────────────────────────────────────────────────────────────────────
   1. LIGHT  — :root default + explicit [data-theme="light"]
   Clean, brighter, still warm-neutral: near-white bg, white surface, dark warm
   ink, hairline borders.
   ───────────────────────────────────────────────────────────────────────── */
:root,
[data-theme="light"] {
  --c-bg: #FAF9F7;
  --c-surface: #FFFFFF;
  --c-raised: #FFFFFF;
  --c-surface-sunken: #F4F2EE;
  --c-border: #E8E5DE;
  --c-border-soft: #EFEDE7;
  --c-border-strong: #D8D4CB;
  --c-text: #23211E;
  --c-text-ink: #141312;
  --c-text-dim: #44423D;
  --c-text-muted: #6E6C66;
  --c-text-faint: #8B8880;

  /* semantic */
  --c-danger: #BE5A4E;
  --c-danger-text: #FFFFFF;
  --c-success: #4F8350;
  --c-warning: #B57F26;
  --c-info: #5E8FC0;

  --c-accent-subtle: color-mix(in srgb, var(--c-accent) 15%, #ffffff);
  --c-focus-ring: color-mix(in srgb, var(--c-accent) 35%, transparent);
  --c-overlay: rgba(20, 19, 18, 0.42);
  --c-selection: color-mix(in srgb, var(--c-accent) 16%, transparent);

  /* shadows (warm-tinted, ink not pure black) */
  --s-hairline: 0 0 0 1px var(--c-border);
  --s-xs: 0 1px 2px rgba(20, 19, 18, 0.05);
  --s-sm: 0 1px 3px rgba(20, 19, 18, 0.08), 0 1px 2px rgba(20, 19, 18, 0.04);
  --s-md: 0 4px 12px rgba(20, 19, 18, 0.08), 0 1px 3px rgba(20, 19, 18, 0.05);
  --s-lg: 0 12px 32px rgba(20, 19, 18, 0.12), 0 4px 10px rgba(20, 19, 18, 0.06);
  --s-focus: 0 0 0 3px var(--c-focus-ring);

  color-scheme: light;
}

/* ─────────────────────────────────────────────────────────────────────────
   2. SAND  — the classic claude.ai warm paper (the app's DEFAULT look)
   bg #F0EEE6 · surface #FAF9F5 · sunken #EFE9DE · warm ink #1F1E1D · line #E5E2D9
   ───────────────────────────────────────────────────────────────────────── */
[data-theme="sand"] {
  --c-bg: #F0EEE6;
  --c-surface: #FAF9F5;
  --c-raised: #FFFFFF;
  --c-surface-sunken: #EFE9DE;
  --c-border: #E5E2D9;
  --c-border-soft: #EBE6DF;
  --c-border-strong: #D9D5C9;
  --c-text: #1F1E1D;
  --c-text-ink: #141413;
  --c-text-dim: #3D3D3A;
  --c-text-muted: #73726C;
  --c-text-faint: #8E8B82;

  --c-danger: #BE5A4E;
  --c-danger-text: #FFFFFF;
  --c-success: #5B8C5A;
  --c-warning: #C28A2B;
  --c-info: #6A9BCC;

  /* sand keeps the warm-paper wash; derived from the active accent */
  --c-accent-subtle: color-mix(in srgb, var(--c-accent) 16%, #FAF9F5);
  --c-focus-ring: color-mix(in srgb, var(--c-accent) 35%, transparent);
  --c-overlay: rgba(20, 20, 19, 0.45);
  --c-selection: color-mix(in srgb, var(--c-accent) 18%, transparent);

  --s-hairline: 0 0 0 1px var(--c-border);
  --s-xs: 0 1px 2px rgba(20, 20, 19, 0.05);
  --s-sm: 0 1px 3px rgba(20, 20, 19, 0.08), 0 1px 2px rgba(20, 20, 19, 0.04);
  --s-md: 0 4px 12px rgba(20, 20, 19, 0.08), 0 1px 3px rgba(20, 20, 19, 0.05);
  --s-lg: 0 12px 32px rgba(20, 20, 19, 0.12), 0 4px 10px rgba(20, 20, 19, 0.06);
  --s-focus: 0 0 0 3px var(--c-focus-ring);

  color-scheme: light;
}

/* ─────────────────────────────────────────────────────────────────────────
   3. DARK  — warm dark (not cold slate)
   bg #1A1714 · surface #232020 · raised #2D2823 · off-white #F5F1ED · line ~#3A3530
   The default-accent (clay) is nudged BRIGHTER so it stays vivid on dark; when an
   accent is picked, appearance.js supplies that accent's dark variant inline.
   ───────────────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --c-bg: #1A1714;
  --c-surface: #232020;
  --c-raised: #2D2823;
  --c-surface-sunken: #161310;
  --c-border: #3A3530;
  --c-border-soft: #322D29;
  --c-border-strong: #4A443D;
  --c-text: #F5F1ED;
  --c-text-ink: #FBF8F4;
  --c-text-dim: #CDC8C0;
  --c-text-muted: #9E9A91;
  --c-text-faint: #7A766E;

  /* clay, brightened for dark (overridden inline when a non-clay accent is set) */
  --c-accent: #D98B6E;
  --c-accent-hover: #E49E84;
  --c-accent-active: #C5775B;
  --c-accent-text: #1A1714;

  --c-danger: #E08272;
  --c-danger-text: #1A1714;
  --c-success: #8FB57E;
  --c-warning: #D6AE5C;
  --c-info: #8DB2D8;

  /* dark wash: mix the accent into the dark surface (derives from any accent) */
  --c-accent-subtle: color-mix(in srgb, var(--c-accent) 22%, var(--c-surface));
  --c-focus-ring: color-mix(in srgb, var(--c-accent) 45%, transparent);
  --c-overlay: rgba(0, 0, 0, 0.58);
  --c-selection: color-mix(in srgb, var(--c-accent) 26%, transparent);

  --s-hairline: 0 0 0 1px var(--c-border);
  --s-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --s-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --s-md: 0 4px 14px rgba(0, 0, 0, 0.45);
  --s-lg: 0 14px 36px rgba(0, 0, 0, 0.55);
  --s-focus: 0 0 0 3px var(--c-focus-ring);

  color-scheme: dark;
}

/* ─────────────────────────────────────────────────────────────────────────
   3b. NO-CHOICE FALLBACK — honour the OS only when NO theme is set on <html>.
   appearance.js sets data-theme on first paint, so this rarely fires; it is the
   safety net for a JS-disabled load. Gated to :root:not([data-theme]) so any
   explicit choice always overrides it.
   ───────────────────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --c-bg: #1A1714;
    --c-surface: #232020;
    --c-raised: #2D2823;
    --c-surface-sunken: #161310;
    --c-border: #3A3530;
    --c-border-soft: #322D29;
    --c-border-strong: #4A443D;
    --c-text: #F5F1ED;
    --c-text-ink: #FBF8F4;
    --c-text-dim: #CDC8C0;
    --c-text-muted: #9E9A91;
    --c-text-faint: #7A766E;

    --c-accent: #D98B6E;
    --c-accent-hover: #E49E84;
    --c-accent-active: #C5775B;
    --c-accent-text: #1A1714;

    --c-danger: #E08272;
    --c-danger-text: #1A1714;
    --c-success: #8FB57E;
    --c-warning: #D6AE5C;
    --c-info: #8DB2D8;

    --c-accent-subtle: color-mix(in srgb, var(--c-accent) 22%, var(--c-surface));
    --c-focus-ring: color-mix(in srgb, var(--c-accent) 45%, transparent);
    --c-overlay: rgba(0, 0, 0, 0.58);
    --c-selection: color-mix(in srgb, var(--c-accent) 26%, transparent);

    --s-hairline: 0 0 0 1px var(--c-border);
    --s-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --s-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --s-md: 0 4px 14px rgba(0, 0, 0, 0.45);
    --s-lg: 0 14px 36px rgba(0, 0, 0, 0.55);
    --s-focus: 0 0 0 3px var(--c-focus-ring);

    color-scheme: dark;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   4. BASE — body, typography, selection, scrollbars
   ───────────────────────────────────────────────────────────────────────── */
html {
  background: var(--c-bg);
}

body {
  background-color: var(--c-bg) !important;
  color: var(--c-text) !important;
  font-family: var(--font-ui) !important;
  font-weight: 400;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color .2s ease, color .2s ease;
}

/* Headings — FIELD DNA: BOLD SANS (not serif). App-like, dense, tight tracking.
   The UI sans stack at weight 700–800; the .font-display / .display opt-in classes
   keep the editorial serif available for the rare marketing surface. */
h1, h2, h3 {
  font-family: var(--font-ui) !important;
  font-weight: 800 !important;
  color: var(--c-text-ink);
  letter-spacing: -0.02em;
}
h1 { font-size: 34px; line-height: 1.12; letter-spacing: -0.025em; }
h2 { font-size: 26px; line-height: 1.16; letter-spacing: -0.02em; }
h3 { font-size: 20px; line-height: 1.28; letter-spacing: -0.018em; font-weight: 700 !important; }

/* Sub-headings / UI titles — bold sans, slightly lighter weight. */
h4, h5, h6 {
  font-family: var(--font-ui) !important;
  font-weight: 700 !important;
  color: var(--c-text-ink);
  letter-spacing: -0.012em;
}

/* Opt-in editorial serif (kept available for marketing/hero copy only). */
.display, .font-display {
  font-family: var(--font-display) !important;
  font-weight: 400 !important;
  color: var(--c-text-ink);
  letter-spacing: -0.02em;
}

code, kbd, pre, samp, .font-mono {
  font-family: var(--font-mono) !important;
}

a { color: var(--c-accent-active); }
a:hover { color: var(--c-accent-hover); }

::selection { background: var(--c-selection); }

* { scrollbar-color: var(--c-border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--c-border-strong);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--c-text-faint); }

/* Typography scale helpers (optional opt-in classes) */
.t-display-2xl { font-family: var(--font-display); font-size: 60px; line-height: 1.04; font-weight: 400; letter-spacing: -0.03em; }
.t-display-xl  { font-family: var(--font-display); font-size: 48px; line-height: 1.08; font-weight: 400; letter-spacing: -0.025em; }
.t-display-lg  { font-family: var(--font-display); font-size: 36px; line-height: 1.12; font-weight: 400; letter-spacing: -0.02em; }
.t-display-md  { font-family: var(--font-display); font-size: 28px; line-height: 1.18; font-weight: 400; letter-spacing: -0.015em; }
.t-title-lg    { font-size: 22px; line-height: 1.3; font-weight: 800; letter-spacing: -0.02em; }
.t-title-md    { font-size: 18px; line-height: 1.4; font-weight: 700; letter-spacing: -0.015em; }
.t-title-sm    { font-size: 16px; line-height: 1.4; font-weight: 700; letter-spacing: -0.01em; }
.t-body-lg     { font-size: 17px; line-height: 1.6; font-weight: 400; }
.t-body-md     { font-size: 15px; line-height: 1.6; font-weight: 400; }
.t-body-sm     { font-size: 13.5px; line-height: 1.55; font-weight: 400; }
.t-label       { font-size: 13px; line-height: 1.4; font-weight: 500; }
.t-overline    { font-size: 12px; line-height: 1.4; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.t-code        { font-family: var(--font-mono); font-size: 13.5px; line-height: 1.6; }

/* ============================================================================
   5. TAILWIND UTILITY REMAP
   ----------------------------------------------------------------------------
   The pages are authored with a dark Tailwind palette (bg-gray-950 body,
   text-white, blue accents). We remap every utility onto the --c-* tokens, so
   the SAME markup auto-adapts to whichever theme + accent is active. !important
   beats the Tailwind CDN's injected rules.
   ============================================================================ */

/* ── Surfaces: bg-gray-* ──────────────────────────────────────────────────
   950/900 page/panel backgrounds, 800 the workhorse card surface,
   700/600/500 progressively "raised" chrome. */
.bg-gray-950 { background-color: var(--c-bg) !important; }
.bg-gray-900 { background-color: var(--c-surface) !important; }
.bg-gray-800 { background-color: var(--c-raised) !important; }
.bg-gray-700 { background-color: var(--c-surface-sunken) !important; }
.bg-gray-600 { background-color: var(--c-border-strong) !important; }
.bg-gray-500 { background-color: var(--c-text-faint) !important; }
.bg-gray-100, .bg-gray-50, .bg-white { background-color: var(--c-surface) !important; }

/* ── Text: text-white + text-gray-* ──────────────────────────────────────── */
.text-white    { color: var(--c-text-ink) !important; }
.text-gray-100 { color: var(--c-text-ink) !important; }
.text-gray-200 { color: var(--c-text) !important; }
.text-gray-300 { color: var(--c-text-dim) !important; }
.text-gray-400 { color: var(--c-text-muted) !important; }
.text-gray-500 { color: var(--c-text-muted) !important; }
.text-gray-600 { color: var(--c-text-muted) !important; }
.text-gray-700 { color: var(--c-text-dim) !important; }
.text-gray-800 { color: var(--c-text-dim) !important; }
.text-gray-900 { color: var(--c-text-ink) !important; }

/* ── Borders: border-gray-* ──────────────────────────────────────────────── */
.border-gray-200 { border-color: var(--c-border) !important; }
.border-gray-300 { border-color: var(--c-border) !important; }
.border-gray-400 { border-color: var(--c-border-strong) !important; }
.border-gray-500 { border-color: var(--c-border-strong) !important; }
.border-gray-600 { border-color: var(--c-border-strong) !important; }
.border-gray-700 { border-color: var(--c-border) !important; }
.border-gray-800 { border-color: var(--c-border-soft) !important; }

/* ── Hover surfaces: hover:bg-gray-* ─────────────────────────────────────── */
.hover\:bg-gray-900:hover { background-color: var(--c-surface) !important; }
.hover\:bg-gray-800:hover { background-color: var(--c-surface-sunken) !important; }
.hover\:bg-gray-700:hover { background-color: var(--c-border) !important; }
.hover\:bg-gray-100:hover, .hover\:bg-gray-50:hover { background-color: var(--c-surface-sunken) !important; }

/* ── Primary accent (blue → accent): bg-blue-* ───────────────────────────── */
.bg-blue-900 { background-color: var(--c-accent-subtle) !important; }
.bg-blue-700 { background-color: var(--c-accent-active) !important; }
.bg-blue-600 { background-color: var(--c-accent) !important; color: var(--c-accent-text) !important; }
.bg-blue-500 { background-color: var(--c-accent) !important; color: var(--c-accent-text) !important; }

.hover\:bg-blue-900:hover { background-color: var(--c-accent-subtle) !important; }
.hover\:bg-blue-700:hover { background-color: var(--c-accent-active) !important; }
.hover\:bg-blue-600:hover, .hover\:bg-blue-500:hover { background-color: var(--c-accent-hover) !important; }

.text-blue-300 { color: var(--c-accent) !important; }
.text-blue-400 { color: var(--c-accent) !important; }
.text-blue-500 { color: var(--c-accent-active) !important; }
.text-blue-600 { color: var(--c-accent-active) !important; }

.border-blue-500 { border-color: var(--c-accent) !important; }
.border-blue-600 { border-color: var(--c-accent) !important; }
.border-blue-700 { border-color: var(--c-accent-active) !important; }
.border-blue-800 { border-color: var(--c-accent-active) !important; }

/* ── Danger / red: bg-red-*, text-red-*, border-red-* ────────────────────── */
.bg-red-950 { background-color: var(--c-accent-subtle) !important; }
.bg-red-700 { background-color: var(--c-accent-active) !important; }
.bg-red-600 { background-color: var(--c-danger) !important; color: var(--c-danger-text) !important; }
.bg-red-500 { background-color: var(--c-danger) !important; color: var(--c-danger-text) !important; }

.hover\:bg-red-950:hover { background-color: var(--c-accent-subtle) !important; }
.hover\:bg-red-600:hover, .hover\:bg-red-500:hover { background-color: var(--c-danger) !important; filter: brightness(1.06); }

.text-red-300 { color: var(--c-danger) !important; }
.text-red-400 { color: var(--c-danger) !important; }

.border-red-500 { border-color: var(--c-danger) !important; }
.border-red-800 { border-color: var(--c-danger) !important; }

/* ── Success / info green: bg-green-*, text-green-*, border-green-* ───────── */
.bg-green-900 { background-color: color-mix(in srgb, var(--c-success) 18%, transparent) !important; }
.bg-green-700 { background-color: var(--c-success) !important; color: #FFFFFF !important; }
.text-green-300 { color: var(--c-success) !important; }
.text-green-400 { color: var(--c-success) !important; }
.border-green-800 { border-color: color-mix(in srgb, var(--c-success) 45%, transparent) !important; }

/* ── Focus / ring states → accent focus ring ─────────────────────────────── */
.focus\:border-blue-500:focus { border-color: var(--c-accent) !important; }
.focus\:ring-blue-500:focus,
.ring-blue-500 { --tw-ring-color: var(--c-focus-ring) !important; box-shadow: var(--s-focus) !important; }
.focus\:ring-gray-600:focus,
.ring-gray-600 { --tw-ring-color: var(--c-border-strong) !important; box-shadow: 0 0 0 3px var(--c-border) !important; }
.focus\:ring-1:focus { box-shadow: var(--s-focus) !important; }

/* ============================================================================
   6. COMPONENT POLISH — buttons, inputs, cards, badges, toast
   Layered on top of the remap so Tailwind markup gains the claude.ai tactile
   feel (accent primary, hairline cards, warm inputs) without page edits.
   ============================================================================ */

/* ── Buttons — any element carrying the accent primary class ──────────────── */
button.bg-blue-600, a.bg-blue-600, .btn-primary,
button.bg-blue-500, a.bg-blue-500 {
  background-color: var(--c-accent) !important;
  color: var(--c-accent-text) !important;
  border: none !important;
  border-radius: var(--r-button) !important;
  font-family: var(--font-ui) !important;
  font-weight: 500 !important;
  box-shadow: var(--s-xs);
  transition: background-color .15s ease, box-shadow .15s ease, transform .04s ease;
}
button.bg-blue-600:hover, a.bg-blue-600:hover, .btn-primary:hover,
button.bg-blue-500:hover, a.bg-blue-500:hover {
  background-color: var(--c-accent-hover) !important;
}
button.bg-blue-600:active, a.bg-blue-600:active, .btn-primary:active {
  background-color: var(--c-accent-active) !important;
  transform: translateY(0.5px);
}
button.bg-blue-600:disabled, .btn-primary:disabled,
button.bg-blue-500:disabled, button[disabled].bg-blue-600 {
  background-color: var(--c-surface-sunken) !important;
  color: var(--c-text-faint) !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}

/* Secondary — gray surface buttons get a hairline border + warm hover */
button.bg-gray-800, a.bg-gray-800.inline-flex, .btn-secondary,
button.bg-gray-700 {
  border-radius: var(--r-button) !important;
  font-weight: 500 !important;
  transition: background-color .15s ease, border-color .15s ease;
}

/* Danger button */
button.bg-red-600, a.bg-red-600, .btn-danger {
  background-color: var(--c-danger) !important;
  color: var(--c-danger-text) !important;
  border: none !important;
  border-radius: var(--r-button) !important;
  font-weight: 500 !important;
  box-shadow: var(--s-xs);
  transition: filter .15s ease;
}
button.bg-red-600:hover, a.bg-red-600:hover, .btn-danger:hover { filter: brightness(1.06); }

/* ── Inputs / textareas / selects — warm surface, hairline, accent focus ──── */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
textarea,
select {
  background-color: var(--c-surface) !important;
  color: var(--c-text-ink) !important;
  border: 1px solid var(--c-border) !important;
  border-radius: var(--r-input) !important;
  font-family: var(--font-ui) !important;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--c-text-muted) !important; opacity: 1; }
input:focus:not([type="checkbox"]):not([type="radio"]),
textarea:focus,
select:focus {
  outline: none !important;
  border-color: var(--c-accent) !important;
  box-shadow: var(--s-focus) !important;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--c-accent); }

/* ── Cards — workhorse surface + a radius reads as a hairline card with a soft
   warm shadow. Scoped to block-ish radii so pills / avatars aren't over-shadowed. */
.bg-gray-800.rounded-lg,
.bg-gray-800.rounded-xl,
.bg-gray-800.rounded-2xl,
.bg-gray-900.rounded-lg,
.bg-gray-900.rounded-xl,
.bg-gray-900.rounded-2xl,
.card {
  background-color: var(--c-raised) !important;
  border: 1px solid var(--c-border) !important;
  box-shadow: var(--s-sm);
}
.bg-gray-800.rounded-2xl,
.bg-gray-900.rounded-2xl { border-radius: var(--r-lg) !important; }

/* Feature / sunken panel */
.card-feature {
  background-color: var(--c-surface-sunken) !important;
  border: none !important;
  border-radius: var(--r-lg) !important;
  padding: 32px;
  box-shadow: none;
}
/* Accent callout */
.card-callout {
  background-color: var(--c-accent) !important;
  color: var(--c-accent-text) !important;
  border-radius: var(--r-lg) !important;
  padding: 40px;
}
.card-callout h1, .card-callout h2, .card-callout h3 { color: var(--c-accent-text) !important; }

/* ── Badges / pills ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-family: var(--font-ui);
  font-size: 12px; font-weight: 500; line-height: 1.4;
  letter-spacing: 0.01em;
  background: var(--c-surface-sunken);
  color: var(--c-text-dim);
  border: 1px solid var(--c-border);
}
.badge-accent  { background: var(--c-accent-subtle); color: var(--c-accent-active); border-color: transparent; }
.badge-success { background: color-mix(in srgb, var(--c-success) 16%, transparent); color: var(--c-success); border-color: transparent; }
.badge-danger  { background: color-mix(in srgb, var(--c-danger) 16%, transparent); color: var(--c-danger); border-color: transparent; }
.badge-warning { background: color-mix(in srgb, var(--c-warning) 18%, transparent); color: var(--c-warning); border-color: transparent; }
.badge-info    { background: color-mix(in srgb, var(--c-info) 18%, transparent); color: var(--c-info); border-color: transparent; }

/* ── Toast (shell.js #shell-toasts) — overridable hook + claude.ai variants ─ */
#shell-toasts > div {
  font-family: var(--font-ui) !important;
  border-radius: var(--r-button) !important;
  box-shadow: var(--s-lg) !important;
  border: 1px solid var(--c-border-strong) !important;
}
.toast {
  background: var(--c-raised);
  color: var(--c-text-ink);
  border: 1px solid var(--c-border);
  border-radius: var(--r-button);
  box-shadow: var(--s-lg);
  padding: 11px 16px;
  font: 500 14px/1.4 var(--font-ui);
}
.toast-success { background: var(--c-success); color: #FFFFFF; border-color: transparent; }
.toast-error   { background: var(--c-danger); color: var(--c-danger-text); border-color: transparent; }
.toast-info    { background: var(--c-surface-sunken); color: var(--c-text-ink); }

/* ── Misc: code blocks, hr, focus-visible ────────────────────────────────── */
pre, code:not(pre code) {
  background: var(--c-surface-sunken);
  color: var(--c-text-ink);
  border-radius: var(--r-sm);
}
pre { padding: 14px 16px; border: 1px solid var(--c-border); border-radius: var(--r-md); overflow: auto; }
code:not(pre code) { padding: 1px 5px; font-size: 0.92em; }
hr { border: none; border-top: 1px solid var(--c-border); }

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

/* ============================================================================
   7. CONTRAST FIXES — per-theme, AA-aware. Token-driven so they hold in every
   theme + accent (no literal whites / near-blacks leaking through).
   ============================================================================ */

/* hover:text-white must go to ink, not literal white (invisible on warm paper) */
.hover\:text-white:hover { color: var(--c-text-ink) !important; }

/* secondary / muted text mapped to an AA-passing grey per theme */
.text-gray-500, .text-gray-600 { color: var(--c-text-muted) !important; }

/* translucent dark utility backgrounds (sticky bars / glass) → themed glass.
   These render as near-black bars on light themes; tie them to the surface so
   they blur the page behind them instead. */
.bg-black\/40, .bg-black\/50, .bg-black\/60,
.bg-gray-900\/80, .bg-gray-950\/80, .bg-gray-900\/90, .bg-gray-950\/90,
.bg-gray-900\/95, .bg-gray-950\/95 {
  background-color: color-mix(in srgb, var(--c-surface) 88%, transparent) !important;
  backdrop-filter: blur(8px);
}
/* Full-screen modal scrims should stay a real dimming overlay (themed). */
.bg-black\/70, .bg-black\/80 {
  background-color: var(--c-overlay) !important;
}

/* indigo / violet / purple primary buttons → accent */
.bg-indigo-600, .bg-violet-600, .bg-purple-600 {
  background-color: var(--c-accent) !important; color: var(--c-accent-text) !important;
}
.hover\:bg-indigo-500:hover, .hover\:bg-indigo-700:hover,
.hover\:bg-violet-500:hover, .hover\:bg-purple-500:hover {
  background-color: var(--c-accent-hover) !important;
}

/* form-control accents follow the active accent */
.accent-blue-500, input[type=checkbox], input[type=radio] { accent-color: var(--c-accent) !important; }

/* semantic text colours readable in every theme (badges / status text) */
.text-green-300, .text-green-400, .text-green-500 { color: var(--c-success) !important; }
.text-red-300,   .text-red-400,   .text-red-500   { color: var(--c-danger)  !important; }
.text-yellow-300, .text-yellow-400, .text-amber-400, .text-amber-500 { color: var(--c-warning) !important; }
.text-blue-300,  .text-blue-400 { color: var(--c-info) !important; }
.text-purple-300, .text-purple-400, .text-purple-500 { color: var(--c-accent-active) !important; }

/* translucent semantic badge backgrounds → readable tints in every theme */
.bg-green-500\/10, .bg-green-900\/30, .bg-green-900\/40 { background-color: color-mix(in srgb, var(--c-success) 15%, transparent) !important; }
.bg-red-500\/10,   .bg-red-900\/30,   .bg-red-900\/40   { background-color: color-mix(in srgb, var(--c-danger)  15%, transparent) !important; }
.bg-yellow-500\/10, .bg-amber-900\/30 { background-color: color-mix(in srgb, var(--c-warning) 16%, transparent) !important; }
.bg-blue-500\/10,  .bg-blue-900\/30  { background-color: color-mix(in srgb, var(--c-info) 15%, transparent) !important; }
.bg-purple-500\/10, .bg-purple-900\/30 { background-color: color-mix(in srgb, var(--c-accent) 14%, transparent) !important; }

/* ============================================================================
   8. APPEARANCE PICKER — theme buttons + accent swatches (settings UI)
   Styled here so any page can drop in the markup appearance.js expects:
     <div class="ap-theme">…buttons (emoji + label, .is-on when active)…</div>
     <div class="ap-acc">
       <span class="ap-acc__label">…</span>
       <div class="ap-acc__row">…swatches (button.ap-swatch, .is-on shows ✓)…</div>
     </div>
   ============================================================================ */
.ap-theme {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.ap-theme button {
  flex: 1 1 0; min-width: 100px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 16px;
  border: 1.5px solid var(--c-border) !important;
  border-radius: 14px;
  background: var(--c-surface) !important;
  color: var(--c-text-ink) !important;
  font-family: var(--font-ui); font-size: 15px; font-weight: 700;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.ap-theme button:hover { border-color: var(--c-border-strong) !important; }
/* field's selected look: accent border + accent text + a soft accent halo ring */
.ap-theme button.is-on {
  border-color: var(--c-accent) !important;
  background: var(--c-surface) !important;
  color: var(--c-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-accent) 16%, transparent);
}

.ap-acc { margin-top: 16px; }
.ap-acc__label {
  display: block; font-size: 12px; font-weight: 500; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--c-text-muted); margin-bottom: 10px;
}
.ap-acc__row { display: flex; gap: 10px; flex-wrap: wrap; }
.ap-swatch {
  position: relative;
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid var(--c-border) !important;
  cursor: pointer; padding: 0;
  transition: transform .12s ease, box-shadow .12s ease;
}
.ap-swatch:hover { transform: scale(1.08); }
/* field's selected look: a surface gap-ring then a same-colour halo (currentColor
   is set to the swatch fill inline by appearance.js) */
.ap-swatch.is-on {
  border-color: transparent !important;
  box-shadow: 0 0 0 3px var(--c-surface), 0 0 0 5px currentColor;
}
.ap-swatch__tick {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: 15px; font-weight: 700; line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

/* ── Emoji / icon editor (built by appearance.js into [data-emoji-editor]) ──
   <div data-emoji-editor>
     <div class="ap-emoji__group">
       <span class="ap-emoji__heading">Theme</span>
       <div class="ap-emoji__grid">
         <div class="ap-emoji__cell">
           <label class="ap-emoji__label">Light</label>
           <div class="ap-emoji__box">
             <input class="ap-emoji__input"><button class="ap-emoji__reset">↺</button>
           </div>
         </div> …
       </div>
     </div> …
   </div>                                                                       */
.ap-emoji__group + .ap-emoji__group { margin-top: 18px; }
.ap-emoji__heading {
  display: block; font-size: 12px; font-weight: 500; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--c-text-muted); margin-bottom: 10px;
}
.ap-emoji__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 12px;
}
.ap-emoji__cell { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ap-emoji__label {
  font-size: 12px; font-weight: 500; color: var(--c-text-muted); text-align: center;
}
.ap-emoji__box { position: relative; width: 100%; }
.ap-emoji__input {
  width: 100%; height: 48px; box-sizing: border-box;
  text-align: center; font-size: 22px; line-height: 1;
  padding: 0 6px;
  background: var(--c-surface) !important;
  border: 1px solid var(--c-border) !important;
  border-radius: var(--r-input);
  color: var(--c-text-ink) !important;
  font-family: var(--font-ui);
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.ap-emoji__input:hover { border-color: var(--c-border-strong) !important; }
.ap-emoji__input:focus {
  outline: none; border-color: var(--c-accent) !important; box-shadow: var(--s-focus) !important;
}
.ap-emoji__reset {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: var(--c-surface-sunken); color: var(--c-text-muted);
  border: 1px solid var(--c-border-strong);
  font-size: 12px; line-height: 1; cursor: pointer; padding: 0;
  box-shadow: var(--s-xs);
  transition: color .12s ease, border-color .12s ease, background-color .12s ease, transform .12s ease;
}
.ap-emoji__reset:hover {
  color: var(--c-accent); border-color: var(--c-accent); transform: rotate(-90deg);
}
.ap-emoji__reset[hidden] { display: none !important; }

/* ============================================================================
   9. FIELD COMPONENT LAYER  (the f* contract)
   ----------------------------------------------------------------------------
   A field-worker, app-like component kit adapted from the FIELD design system
   (elinstallation.nu / elkontakten) onto THIS app's --c-* token system. Every
   value flows from --c-* so all three themes (light / sand / dark) + all eight
   accents apply automatically — no per-theme overrides needed.

   FIELD token  →  our token
     --ink / --ink-deep   →  --c-text-ink
     --red (accent)       →  --c-accent  (+ -hover / -active / -subtle / -text)
     --surface            →  --c-surface  (raised cards → --c-raised)
     --bg / --bg-2        →  --c-bg / --c-surface-sunken
     --cream              →  --c-surface-sunken
     --line               →  --c-border
     --muted              →  --c-text-muted

   Mobile-first: bottom-sheet modals, scrollable pill tabs, safe-area insets,
   >=44px tap targets, right drawer that becomes a full-width sheet on phones.
   Everything is prefixed f* to avoid clashing with the Tailwind utility remap.

   PUBLIC CLASS CONTRACT (page agents USE these):
     .fcard
     .fbtn / .fbtn--primary / .fbtn--dark / .fbtn--ghost / .fbtn--outline
       (modifiers: .fbtn--sm / .fbtn--lg / .fbtn--block)
     .finput  (apply to <input> / <textarea> / <select>)
     .ftabs + .ftab / .ftab--on        (scrollable pill tabs)
     .fjob  (+ .fjob__time / .fjob__main / .fjob__title / .fjob__sub)
     .fchip / .fchip--on
     .fsheet / .fsheet__card / .fsheet__grip / .fsheet__head / .fsheet__title
     .fdrawer (+ .fdrawer__scrim / .fdrawer__resize / .fdrawer__head /
               .fdrawer__title / .fdrawer__sub / .fdrawer__x / .fdrawer__actions /
               .fdrawer__body / .fdrawer__label)
     .fempty  (dashed empty state)
     .favatar
     .ficon-btn  (square icon button)
     .ftoasts / .ftoast (+ .ftoast--ok / .ftoast--error / .ftoast--info)
   ============================================================================ */

/* ── Card — radius 14–16, hairline border, soft shadow, subtle hover lift.
   Separation comes from the border, not heavy shadow. ─────────────────────── */
.fcard {
  background: var(--c-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--s-sm);
  transition: border-color .14s ease, box-shadow .14s ease, transform .1s ease;
}
.fcard--pad { padding: 24px; }
.fcard--tap { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fcard--tap:hover { border-color: var(--c-border-strong); box-shadow: var(--s-md); transform: translateY(-1px); }
.fcard--sunken { background: var(--c-surface-sunken); border-color: transparent; box-shadow: none; }

/* ── Buttons — pill radius, bold label, >=44px tap target. Accent primary. ── */
.fbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 11px 20px;
  border-radius: var(--r-pill);
  border: 1.5px solid transparent;
  background: var(--c-surface);
  color: var(--c-text-ink);
  font-family: var(--font-ui);
  font-weight: 700; font-size: 15px; letter-spacing: -0.01em; line-height: 1;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.fbtn:active { transform: translateY(0.5px); }
.fbtn:disabled { opacity: .45; cursor: not-allowed; }
.fbtn:focus-visible { outline: none; box-shadow: var(--s-focus); }

.fbtn--primary { background: var(--c-accent); color: var(--c-accent-text); border-color: var(--c-accent); box-shadow: var(--s-xs); }
.fbtn--primary:hover { background: var(--c-accent-hover); border-color: var(--c-accent-hover); }
.fbtn--primary:active { background: var(--c-accent-active); border-color: var(--c-accent-active); }
.fbtn--primary:disabled:hover { background: var(--c-accent); border-color: var(--c-accent); }

.fbtn--dark { background: var(--c-text-ink); color: var(--c-bg); border-color: var(--c-text-ink); box-shadow: var(--s-xs); }
.fbtn--dark:hover { filter: brightness(1.12); }

.fbtn--ghost { background: var(--c-accent-subtle); color: var(--c-accent-active); border-color: transparent; }
.fbtn--ghost:hover { background: color-mix(in srgb, var(--c-accent) 24%, var(--c-surface)); }

.fbtn--outline { background: transparent; color: var(--c-text-ink); border-color: var(--c-border-strong); }
.fbtn--outline:hover { border-color: var(--c-accent); color: var(--c-accent-active); }

.fbtn--sm { min-height: 38px; padding: 9px 15px; font-size: 13.5px; }
.fbtn--lg { min-height: 52px; padding: 15px 26px; font-size: 16px; border-radius: var(--r-pill); }
.fbtn--block { display: flex; width: 100%; }

/* ── Inputs — warm surface, hairline, accent focus ring. 16px font on mobile
   stops iOS focus-zoom. Class form so pages opt in deliberately. ──────────── */
.finput {
  width: 100%; box-sizing: border-box;
  min-height: 44px; padding: 11px 14px;
  background: var(--c-surface);
  color: var(--c-text-ink);
  border: 1px solid var(--c-border);
  border-radius: var(--r-input);
  font-family: var(--font-ui); font-size: 15px; line-height: 1.4;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  -webkit-appearance: none; appearance: none;
}
textarea.finput { resize: vertical; min-height: 96px; line-height: 1.55; }
.finput::placeholder { color: var(--c-text-muted); opacity: 1; }
.finput:hover { border-color: var(--c-border-strong); }
.finput:focus { outline: none; border-color: var(--c-accent); box-shadow: var(--s-focus); }
@media (max-width: 640px) { .finput, textarea.finput, select.finput { font-size: 16px; } }

/* ── Scrollable pill tabs — sticky-bar tab strip; hidden scrollbar; active =
   solid ink bg with on-accent text. ──────────────────────────────────────── */
.ftabs {
  display: flex; gap: 7px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding: 4px 0; margin: 0;
}
.ftabs::-webkit-scrollbar { display: none; }
.ftab {
  flex: none;
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 38px; padding: 9px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-muted);
  font-family: var(--font-ui); font-weight: 700; font-size: 14px; letter-spacing: -0.01em;
  white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.ftab:hover { border-color: var(--c-border-strong); color: var(--c-text-ink); }
.ftab__ic { font-size: 15px; line-height: 1; }
.ftab--on {
  background: var(--c-text-ink); color: var(--c-bg);
  border-color: var(--c-text-ink); box-shadow: var(--s-sm);
}
.ftab--on:hover { color: var(--c-bg); }
/* Dark theme: an all-ink pill is near-white — switch to an accent-outlined chip. */
[data-theme="dark"] .ftab--on {
  background: var(--c-accent-subtle); color: var(--c-accent);
  border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent);
}
[data-theme="dark"] .ftab--on:hover { color: var(--c-accent); }

/* ── Job-card list row — time/lead column + title + sub/chips, tap to open. ── */
.fjob {
  display: flex; align-items: center; gap: 14px; width: 100%;
  text-align: left;
  background: var(--c-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 14px 16px; min-height: 64px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  box-shadow: var(--s-xs);
  font-family: var(--font-ui); color: var(--c-text);
  transition: border-color .12s ease, box-shadow .12s ease, transform .1s ease;
}
.fjob:hover { border-color: var(--c-border-strong); box-shadow: var(--s-sm); transform: translateY(-1px); }
.fjob:active { transform: translateY(0); }
.fjob:focus-visible { outline: none; box-shadow: var(--s-focus); }
.fjob__time {
  flex: none; min-width: 52px; text-align: center;
  font-weight: 800; font-size: 17px; letter-spacing: -0.02em; color: var(--c-text-ink); line-height: 1.1;
}
.fjob__time span { display: block; font-size: 11px; font-weight: 600; color: var(--c-text-muted); letter-spacing: 0; }
.fjob__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fjob__title { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; color: var(--c-text-ink); }
.fjob__sub { font-size: 13px; color: var(--c-text-muted); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.fjob__go { flex: none; color: var(--c-text-faint); }

/* ── Chips — small status / filter pills. Selectable variant goes solid ink. ─ */
.fchip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: var(--r-pill);
  background: var(--c-surface-sunken); color: var(--c-text-dim);
  border: 1px solid transparent;
  font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: 0.005em;
  white-space: nowrap; line-height: 1.4;
}
button.fchip { cursor: pointer; border-color: var(--c-border); -webkit-tap-highlight-color: transparent; transition: background-color .14s ease, color .14s ease, border-color .14s ease; }
button.fchip:hover { border-color: var(--c-border-strong); }
.fchip--on { background: var(--c-text-ink); color: var(--c-bg); border-color: var(--c-text-ink); }
.fchip--accent { background: var(--c-accent-subtle); color: var(--c-accent-active); }
[data-theme="dark"] .fchip--on { background: var(--c-accent-subtle); color: var(--c-accent); border-color: var(--c-accent); }

/* ── Selectable option card — big tap target, accent-ringed when chosen. ──── */
.fopt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  text-align: left; width: 100%;
  padding: 16px; border: 1.5px solid var(--c-border); border-radius: var(--r-lg);
  background: var(--c-surface); color: var(--c-text);
  font-family: var(--font-ui); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.fopt:hover { border-color: var(--c-accent); transform: translateY(-2px); box-shadow: var(--s-sm); }
.fopt--on { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-focus-ring); }
.fopt__ic { font-size: 26px; line-height: 1; margin-bottom: 4px; }
.fopt__l { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; color: var(--c-text-ink); }
.fopt__d { font-size: 12.5px; color: var(--c-text-muted); }

/* ── Avatar circle ────────────────────────────────────────────────────────── */
.favatar {
  flex: none;
  width: 34px; height: 34px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: var(--c-accent); color: var(--c-accent-text);
  font-family: var(--font-ui); font-weight: 800; font-size: 13px; letter-spacing: -0.01em;
}
.favatar--sm { width: 26px; height: 26px; font-size: 11px; }
.favatar--lg { width: 44px; height: 44px; font-size: 16px; }

/* ── Square icon button — >=40px, hairline, accent on hover. ──────────────── */
.ficon-btn {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-surface); color: var(--c-text-ink);
  font-size: 17px; line-height: 1; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.ficon-btn:hover { border-color: var(--c-accent); color: var(--c-accent-active); }
.ficon-btn:focus-visible { outline: none; box-shadow: var(--s-focus); }
.ficon-btn--sm { width: 34px; height: 34px; font-size: 15px; border-radius: var(--r-sm); }

/* ── Empty state — dashed hairline, muted copy. ──────────────────────────── */
.fempty {
  background: var(--c-surface);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-lg);
  padding: 44px 22px; text-align: center;
  color: var(--c-text-muted); font-size: 15px; line-height: 1.55;
}
.fempty__ic { font-size: 30px; line-height: 1; margin-bottom: 10px; }

/* ── Bottom-sheet modal — docks to the bottom on phones (radius 22px top, drag
   grip, slide-up, safe-area padding); centers + tightens on desktop. ──────── */
.fsheet {
  position: fixed; inset: 0; z-index: 210;
  display: flex; align-items: flex-end; justify-content: center;
  background: var(--c-overlay);
  animation: fsheet-fade .2s ease;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.fsheet__card {
  position: relative;
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  background: var(--c-surface);
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--s-lg);
  animation: fsheet-up .3s cubic-bezier(.2,.7,.2,1);
}
.fsheet__grip {
  width: 40px; height: 4px; border-radius: var(--r-pill);
  background: var(--c-border-strong); margin: 4px auto 12px;
}
.fsheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.fsheet__title { font-family: var(--font-ui); font-weight: 800; font-size: 19px; letter-spacing: -0.02em; color: var(--c-text-ink); line-height: 1.18; }
@media (min-width: 700px) {
  .fsheet { align-items: center; padding: 24px; }
  .fsheet__card { border-radius: var(--r-xl); max-height: 88vh; box-shadow: var(--s-lg); }
}
@keyframes fsheet-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fsheet-up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ── Right-side drawer — resizable on desktop, becomes a full-width bottom
   sheet on phones. Width is set inline by the page (style="width:540px"). ── */
.fdrawer__scrim {
  position: fixed; inset: 0; z-index: 200;
  background: var(--c-overlay);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  animation: fsheet-fade .2s ease;
}
.fdrawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 201;
  width: 540px; max-width: 100vw;
  display: flex; flex-direction: column;
  background: var(--c-bg);
  border-left: 1px solid var(--c-border);
  box-shadow: var(--s-lg);
  animation: fdrawer-in .3s cubic-bezier(.2,.7,.2,1);
}
@keyframes fdrawer-in { from { transform: translateX(36px); opacity: .3; } to { transform: none; opacity: 1; } }
.fdrawer__resize { position: absolute; left: -4px; top: 0; bottom: 0; width: 9px; cursor: col-resize; z-index: 3; }
.fdrawer__resize:hover, .fdrawer__resize:active { background: linear-gradient(90deg, transparent, var(--c-focus-ring)); }
.fdrawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 14px; border-bottom: 1px solid var(--c-border); }
.fdrawer__title { font-family: var(--font-ui); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; color: var(--c-text-ink); line-height: 1.15; word-break: break-word; }
.fdrawer__sub { color: var(--c-text-muted); font-size: 13px; margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fdrawer__x {
  flex: none; width: 34px; height: 34px; border-radius: var(--r-sm);
  border: 1px solid var(--c-border); background: var(--c-surface);
  color: var(--c-text-muted); font-size: 15px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, color .15s ease;
}
.fdrawer__x:hover { border-color: var(--c-accent); color: var(--c-accent-active); }
.fdrawer__actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 24px; border-bottom: 1px solid var(--c-border); background: var(--c-surface-sunken); }
.fdrawer__body { flex: 1; overflow-y: auto; padding: 20px 24px 48px; }
.fdrawer__label { font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-text-muted); margin: 14px 0 6px; }
@media (max-width: 700px) {
  .fdrawer {
    width: 100% !important; left: 0; top: auto;
    border-left: none; border-top: 1px solid var(--c-border);
    border-radius: 22px 22px 0 0; max-height: 92vh;
    animation: fsheet-up .28s cubic-bezier(.2,.7,.2,1);
  }
  .fdrawer__resize { display: none; }
  .fdrawer__head { padding: 16px 18px 12px; }
  .fdrawer__actions, .fdrawer__body { padding-left: 18px; padding-right: 18px; }
  .fdrawer__body { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
}

/* ── Toasts — bottom-center stack, auto-dismiss; ink pill with status variants. */
.ftoasts {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: max-content; max-width: 92vw;
}
/* lift above the mobile bottom-tab bar when present */
@media (max-width: 640px) { .ftoasts { bottom: calc(72px + env(safe-area-inset-bottom)); } }
.ftoast {
  display: flex; align-items: center; gap: 9px;
  background: var(--c-text-ink); color: var(--c-bg);
  padding: 11px 17px; border-radius: var(--r-card);
  font-family: var(--font-ui); font-weight: 700; font-size: 14px; letter-spacing: -0.01em;
  box-shadow: var(--s-lg);
  animation: ftoast-in .22s ease;
}
.ftoast__ic { font-weight: 800; font-size: 15px; line-height: 1; }
.ftoast--ok { background: var(--c-success); color: #fff; }
.ftoast--error { background: var(--c-danger); color: var(--c-danger-text); }
.ftoast--info { background: var(--c-surface-sunken); color: var(--c-text-ink); border: 1px solid var(--c-border-strong); }
@keyframes ftoast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
