/* ==========================================================================
   What Am I Eating? — Multi-Theme Cognitive-First Design System
   Default Theme: "Neon Plum" (Midnight Plum #2D1836 · Royal Violet #442482 ·
   Mint Teal #42B79C · Golden Mango #F9C54B · Electric Rose #FA438A)
   Supports 5 account-synced themes selectable from the top-right switcher.
   ========================================================================== */

:root,
[data-theme="neon-plum"] {
  /* Default Theme: Neon Plum (User's Exact Palette!) */
  --color-bg:            #1A0E22;
  --color-surface:       #2A1634;
  --color-surface-alt:   #381E4C;
  --color-surface-inv:   #442482;
  --color-border:        #4E2D6D;
  --color-border-strong: #6A4196;

  --color-text:          #FAF5FF;
  --color-text-soft:     #DFD1EE;
  --color-muted:         #B49CCA;

  /* Primary Brand Accent = Fresh Mint Teal (#42B79C) */
  --color-accent:        #42B79C;
  --color-accent-hover:  #56CCB0;
  --color-accent-soft:   rgba(66, 183, 156, 0.16);
  --color-accent-ink:    #120918;

  /* Secondary Brand Violet Highlight */
  --color-violet:        #6E44C4;

  /* Pre-Attentive Traffic-Light Colors Mapped Directly to Palette! */
  --tl-green:            #42B79C;   /* Mint Teal = Good / Low Risk */
  --tl-green-bg:         rgba(66, 183, 156, 0.14);
  --tl-green-border:     rgba(66, 183, 156, 0.45);
  --tl-green-ink:        #0D1F1B;

  --tl-amber:            #F9C54B;   /* Golden Mango = Medium / Watch */
  --tl-amber-bg:         rgba(249, 197, 75, 0.14);
  --tl-amber-border:     rgba(249, 197, 75, 0.48);
  --tl-amber-ink:        #241902;

  --tl-red:              #FA438A;   /* Hot Electric Rose = High Risk / Limit */
  --tl-red-bg:           rgba(250, 67, 138, 0.15);
  --tl-red-border:       rgba(250, 67, 138, 0.50);
  --tl-red-ink:          #FFFFFF;

  /* Macro Split Colors */
  --macro-protein:       #42B79C;
  --macro-carbs:         #F9C54B;
  --macro-fat:           #FA438A;

  --color-positive:      var(--tl-green);
  --color-positive-bg:   var(--tl-green-bg);
  --color-caution:       var(--tl-amber);
  --color-caution-bg:    var(--tl-amber-bg);
  --color-warning:       var(--tl-red);
  --color-warning-bg:    var(--tl-red-bg);
  --color-danger:        var(--tl-red);
  --color-danger-bg:     var(--tl-red-bg);

  --theme-meta-color:    #2A1634;

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-sans:    'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* 8px Spacing Rhythm */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* Radii */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   22px;
  --radius-full: 9999px;

  /* Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 140ms;
  --dur-base: 240ms;

  --shadow-xs: 0 2px 6px rgba(10, 4, 16, 0.32);
  --shadow-sm: 0 6px 16px rgba(10, 4, 16, 0.38);
  --shadow-md: 0 12px 28px rgba(8, 3, 14, 0.48);
  --shadow-lg: 0 24px 50px rgba(6, 2, 12, 0.62);

  --rail-width: 244px;
  --bottom-nav-h: 64px;
}

/* Theme 2: Citrus Crisp (Bright Daylight Sister to Neon Plum) */
[data-theme="citrus-crisp"] {
  --color-bg:            #FBF8FD;
  --color-surface:       #FFFFFF;
  --color-surface-alt:   #F2EAF8;
  --color-surface-inv:   #2D1836;
  --color-border:        #E2D4EE;
  --color-border-strong: #C6B1DC;

  --color-text:          #23132B;
  --color-text-soft:     #493556;
  --color-muted:         #6F5A7E;

  --color-accent:        #248C74;
  --color-accent-hover:  #1B735F;
  --color-accent-soft:   #E4F6F1;
  --color-accent-ink:    #FFFFFF;
  --color-violet:        #442482;

  --tl-green:            #1D876E;
  --tl-green-bg:         #E5F7F2;
  --tl-green-border:     #91D8C7;
  --tl-green-ink:        #FFFFFF;

  --tl-amber:            #B07200;
  --tl-amber-bg:         #FFF6DF;
  --tl-amber-border:     #F3CF78;
  --tl-amber-ink:        #FFFFFF;

  --tl-red:              #D4206A;
  --tl-red-bg:           #FFEAF3;
  --tl-red-border:       #F89DC0;
  --tl-red-ink:          #FFFFFF;

  --macro-protein:       #248C74;
  --macro-carbs:         #D99400;
  --macro-fat:           #D4206A;

  --shadow-xs: 0 1px 2px rgba(45, 24, 54, 0.06);
  --shadow-sm: 0 3px 10px rgba(45, 24, 54, 0.08);
  --shadow-md: 0 10px 26px rgba(45, 24, 54, 0.11);
  --shadow-lg: 0 20px 44px rgba(45, 24, 54, 0.16);
}

/* Theme 3: Midnight Ocean (Deep Abyss Navy + Aqua + Coral) */
[data-theme="midnight-ocean"] {
  --color-bg:            #0B1320;
  --color-surface:       #121E31;
  --color-surface-alt:   #1A2B45;
  --color-surface-inv:   #0F3D57;
  --color-border:        #243A5C;
  --color-border-strong: #375582;

  --color-text:          #F1F6FC;
  --color-text-soft:     #C5D5EA;
  --color-muted:         #8BA4C4;

  --color-accent:        #34D1BF;
  --color-accent-hover:  #4CE2D0;
  --color-accent-soft:   rgba(52, 209, 191, 0.15);
  --color-accent-ink:    #071A1D;
  --color-violet:        #3B82F6;

  --tl-green:            #34D1BF;
  --tl-green-bg:         rgba(52, 209, 191, 0.13);
  --tl-green-border:     rgba(52, 209, 191, 0.44);
  --tl-green-ink:        #061B19;

  --tl-amber:            #FBBF24;
  --tl-amber-bg:         rgba(251, 191, 36, 0.14);
  --tl-amber-border:     rgba(251, 191, 36, 0.46);
  --tl-amber-ink:        #241802;

  --tl-red:              #FF637D;
  --tl-red-bg:           rgba(255, 99, 125, 0.14);
  --tl-red-border:       rgba(255, 99, 125, 0.48);
  --tl-red-ink:          #FFFFFF;

  --macro-protein:       #34D1BF;
  --macro-carbs:         #FBBF24;
  --macro-fat:           #FF637D;
}

/* Theme 4: Warm Linen (Editorial Apothecary Light) */
[data-theme="warm-linen"] {
  --color-bg:            oklch(96.8% 0.010 85);
  --color-surface:       oklch(99.5% 0.004 85);
  --color-surface-alt:   oklch(93.8% 0.012 82);
  --color-surface-inv:   oklch(21% 0.024 152);
  --color-border:        oklch(87% 0.013 78);
  --color-border-strong: oklch(76% 0.018 74);

  --color-text:          oklch(19% 0.016 55);
  --color-text-soft:     oklch(34% 0.016 58);
  --color-muted:         oklch(47% 0.016 65);

  --color-accent:        oklch(38% 0.095 154);
  --color-accent-hover:  oklch(32% 0.100 154);
  --color-accent-soft:   oklch(93% 0.032 150);
  --color-accent-ink:    oklch(98.5% 0.005 85);
  --color-violet:        oklch(42% 0.115 150);

  --tl-green:            oklch(43% 0.135 148);
  --tl-green-bg:         oklch(94.5% 0.042 148);
  --tl-green-border:     oklch(76% 0.095 148);
  --tl-green-ink:        #FFFFFF;

  --tl-amber:            oklch(48% 0.145 72);
  --tl-amber-bg:         oklch(95.5% 0.058 84);
  --tl-amber-border:     oklch(78% 0.125 78);
  --tl-amber-ink:        #FFFFFF;

  --tl-red:              oklch(46% 0.195 25);
  --tl-red-bg:           oklch(94.5% 0.048 25);
  --tl-red-border:       oklch(74% 0.135 25);
  --tl-red-ink:          #FFFFFF;

  --macro-protein:       oklch(43% 0.135 148);
  --macro-carbs:         oklch(55% 0.145 72);
  --macro-fat:           oklch(48% 0.185 28);

  --shadow-xs: 0 1px 2px oklch(18% 0.02 60 / 6%);
  --shadow-sm: 0 3px 10px oklch(18% 0.02 60 / 7%);
  --shadow-md: 0 10px 26px oklch(18% 0.02 60 / 10%);
  --shadow-lg: 0 20px 44px oklch(16% 0.02 60 / 16%);
}

/* Theme 5: Espresso Botanical (Warm Dark OLED) */
[data-theme="espresso-dark"] {
  --color-bg:            oklch(14% 0.010 60);
  --color-surface:       oklch(19.5% 0.012 60);
  --color-surface-alt:   oklch(24.5% 0.014 62);
  --color-surface-inv:   oklch(27% 0.045 152);
  --color-border:        oklch(30% 0.014 62);
  --color-border-strong: oklch(42% 0.016 65);

  --color-text:          oklch(94% 0.010 85);
  --color-text-soft:     oklch(82% 0.010 82);
  --color-muted:         oklch(67% 0.012 76);

  --color-accent:        oklch(70% 0.125 152);
  --color-accent-hover:  oklch(76% 0.130 152);
  --color-accent-soft:   oklch(25% 0.045 152);
  --color-accent-ink:    oklch(14% 0.020 152);
  --color-violet:        oklch(70% 0.125 152);

  --tl-green:            oklch(74% 0.145 148);
  --tl-green-bg:         oklch(23% 0.048 148);
  --tl-green-border:     oklch(42% 0.095 148);
  --tl-green-ink:        #0D1F15;

  --tl-amber:            oklch(80% 0.145 80);
  --tl-amber-bg:         oklch(25% 0.052 76);
  --tl-amber-border:     oklch(48% 0.110 78);
  --tl-amber-ink:        #211703;

  --tl-red:              oklch(72% 0.185 26);
  --tl-red-bg:           oklch(24% 0.068 24);
  --tl-red-border:       oklch(48% 0.135 25);
  --tl-red-ink:          #FFFFFF;

  --macro-protein:       oklch(74% 0.145 148);
  --macro-carbs:         oklch(80% 0.145 80);
  --macro-fat:           oklch(72% 0.185 26);
}

/* Theme 6: Lemon Lavender (Deep Forest Green · Lemon Zest · Electric Orchid · Soft Lavender) */
[data-theme="lemon-lavender"] {
  --color-bg:            #121F15;
  --color-surface:       #1B2E1F;
  --color-surface-alt:   #28462E;
  --color-surface-inv:   #2F5935;
  --color-border:        #3A6341;
  --color-border-strong: #53805B;

  --color-text:          #F5F7F2;
  --color-text-soft:     #D5E0D7;
  --color-muted:         #A7BFA9;

  --color-accent:        #E2C32C;   /* Lemon Zest primary pop */
  --color-accent-hover:  #F0D348;
  --color-accent-soft:   rgba(226, 195, 44, 0.16);
  --color-accent-ink:    #162214;
  --color-violet:        #A69BD2;   /* Soft Lavender */

  --tl-green:            #63D07E;   /* Botanical Mint-Leaf = Good */
  --tl-green-bg:         rgba(99, 208, 126, 0.14);
  --tl-green-border:     rgba(99, 208, 126, 0.44);
  --tl-green-ink:        #0D2012;

  --tl-amber:            #E8C62E;   /* Lemon Zest = Medium */
  --tl-amber-bg:         rgba(232, 198, 46, 0.15);
  --tl-amber-border:     rgba(232, 198, 46, 0.48);
  --tl-amber-ink:        #211B02;

  --tl-red:              #EE49B0;   /* Electric Orchid = High / Alert */
  --tl-red-bg:           rgba(238, 73, 176, 0.16);
  --tl-red-border:       rgba(238, 73, 176, 0.50);
  --tl-red-ink:          #FFFFFF;

  --macro-protein:       #63D07E;
  --macro-carbs:         #E8C62E;
  --macro-fat:           #EE49B0;
}

/* Theme 7: Tropical Splash (Periwinkle #8393E4 · Aqua Teal #1BC0BA · Marigold #FAB817 · Watermelon #F84882 · Blush #F9B8D8) */
[data-theme="tropical-splash"] {
  --color-bg:            #F5F7FE;
  --color-surface:       #FFFFFF;
  --color-surface-alt:   #EBEEFD;
  --color-surface-inv:   #2D386E;
  --color-border:        #D5DCF7;
  --color-border-strong: #B0BDEF;

  --color-text:          #1B2142;
  --color-text-soft:     #3F4975;
  --color-muted:         #66719E;

  --color-accent:        #149E99;   /* Accessible Aqua Teal (#1BC0BA darkened slightly for AA text) */
  --color-accent-hover:  #0F8580;
  --color-accent-soft:   #E2F9F8;
  --color-accent-ink:    #FFFFFF;
  --color-violet:        #8393E4;

  --tl-green:            #129994;   /* Aqua Teal = Good / Low */
  --tl-green-bg:         #E2F9F8;
  --tl-green-border:     #7BE0DC;
  --tl-green-ink:        #FFFFFF;

  --tl-amber:            #B37D00;   /* Rich Marigold = Medium */
  --tl-amber-bg:         #FFF6DC;
  --tl-amber-border:     #FAB817;
  --tl-amber-ink:        #FFFFFF;

  --tl-red:              #DB2865;   /* Watermelon Pink = High / Alert */
  --tl-red-bg:           #FFEBF2;
  --tl-red-border:       #F9B8D8;
  --tl-red-ink:          #FFFFFF;

  --macro-protein:       #129994;
  --macro-carbs:         #D49400;
  --macro-fat:           #F84882;

  --shadow-xs: 0 1px 2px rgba(45, 56, 110, 0.06);
  --shadow-sm: 0 3px 10px rgba(45, 56, 110, 0.08);
  --shadow-md: 0 10px 26px rgba(45, 56, 110, 0.11);
  --shadow-lg: 0 20px 44px rgba(45, 56, 110, 0.16);
}

/* ==========================================================================
   Bulletproof Zero-Overflow Mobile Base (Galaxy S24 Ultra Ready)
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.94rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  touch-action: manipulation;
}

/* Subtle ambient palette glow behind Neon Plum & Midnight Ocean */
[data-theme="neon-plum"] body::before,
:root body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(620px 340px at 90% -5%, rgba(250, 67, 138, 0.14), transparent 65%),
    radial-gradient(560px 360px at 0% 25%, rgba(68, 36, 130, 0.28), transparent 65%),
    radial-gradient(520px 320px at 85% 95%, rgba(66, 183, 156, 0.12), transparent 60%);
}
[data-theme="lemon-lavender"] body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(560px 320px at 90% 0%, rgba(238, 73, 176, 0.12), transparent 65%),
    radial-gradient(520px 340px at 5% 85%, rgba(166, 155, 210, 0.14), transparent 65%);
}
[data-theme="tropical-splash"] body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(520px 300px at 95% 0%, rgba(249, 184, 216, 0.28), transparent 60%),
    radial-gradient(520px 300px at 0% 90%, rgba(131, 147, 228, 0.18), transparent 60%);
}
[data-theme="warm-linen"] body::before,
[data-theme="citrus-crisp"] body::before,
[data-theme="espresso-dark"] body::before,
[data-theme="midnight-ocean"] body::before {
  background: none;
}

main, section, article, div, aside, header { min-width: 0; }

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  overflow-wrap: break-word;
}

p { margin: 0; overflow-wrap: break-word; }
button, input, select, textarea { font: inherit; color: inherit; }

/* >=16px on mobile prevents Chrome/Safari auto-zoom when tapping inputs */
input[type="text"], input[type="number"], input[type="date"], select {
  font-size: 16px;
}
@media (min-width: 768px) {
  input[type="text"], input[type="number"], input[type="date"], select {
    font-size: 0.94rem;
  }
}

button { cursor: pointer; }
img { max-width: 100%; display: block; }
a { color: var(--color-accent); text-underline-offset: 3px; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.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;
}

.skip-link {
  position: fixed; top: -100px; left: 16px; z-index: 9999;
  background: var(--color-accent); color: var(--color-accent-ink);
  padding: 10px 16px; border-radius: var(--radius-md); font-weight: 700;
}
.skip-link:focus { top: 12px; }

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

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

/* ==========================================================================
   App Shell (Mobile Top Bar + Desktop Top-Right Utility Bar + Rail)
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-height: 100dvh;
}

.side-rail { display: none; }

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top, 10px));
  background: color-mix(in srgb, var(--color-bg) 90%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--color-border);
}

.desktop-topbar {
  display: none;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--color-text);
  min-width: 0;
}
.brand-mark { width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; }
.brand-title { font-family: var(--font-display); font-size: 1.06rem; font-weight: 700; line-height: 1.1; white-space: nowrap; }
.brand-sub { font-size: 0.66rem; color: var(--color-muted); letter-spacing: 0.05em; text-transform: uppercase; font-weight: 700; }

.main-content {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
  padding: 12px 14px calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 24px);
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--color-surface) 95%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--color-border);
}
.bottom-nav-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; border: 0; background: transparent; color: var(--color-muted);
  font-size: 0.7rem; font-weight: 700; min-height: 48px; position: relative;
}
.bottom-nav-btn i { font-size: 1.32rem; }
.bottom-nav-btn.active { color: var(--color-accent); }
.bottom-nav-btn.active::before {
  content: ''; position: absolute; top: 0; width: 28px; height: 3px;
  border-radius: 0 0 4px 4px; background: var(--color-accent);
}
.bottom-nav-btn:active { transform: scale(0.94); }

@media (min-width: 960px) {
  .app-shell { grid-template-columns: var(--rail-width) minmax(0, 1fr); }
  .mobile-header, .bottom-nav { display: none; }
  .side-rail {
    position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
    justify-content: space-between; padding: 22px 16px;
    background: var(--color-surface); border-right: 1px solid var(--color-border); overflow-y: auto;
  }
  .desktop-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 12px;
  }
  .main-content { padding: 18px 32px 48px; }
}

.rail-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 22px; }
.rail-nav-btn {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 13px;
  border: 0; border-radius: var(--radius-md); background: transparent;
  color: var(--color-text-soft); font-weight: 600; font-size: 0.9rem; text-align: left;
}
.rail-nav-btn i { font-size: 1.2rem; }
.rail-nav-btn:hover { background: var(--color-surface-alt); color: var(--color-text); }
.rail-nav-btn.active { background: var(--color-accent-soft); color: var(--color-accent); }

.rail-badge {
  margin-left: auto; font-family: var(--font-mono); font-size: 0.72rem;
  padding: 2px 7px; border-radius: var(--radius-full);
  background: var(--color-surface-alt); color: var(--color-text-soft);
}
.rail-nav-btn.active .rail-badge { background: var(--color-accent); color: var(--color-accent-ink); }
.rail-footer { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--color-border); }
.rail-credit { font-size: 0.72rem; color: var(--color-muted); line-height: 1.4; }

/* ==========================================================================
   Shared Primitives & Top-Right Theme Button
   ========================================================================== */
.theme-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.76rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.theme-trigger-btn:hover { border-color: var(--color-accent); background: var(--color-surface-alt); }
.theme-dot-tri {
  display: inline-flex;
  align-items: center;
}
.theme-dot-tri span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid var(--color-surface);
  margin-left: -3px;
}
.theme-dot-tri span:first-child { margin-left: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 16px; border-radius: var(--radius-md);
  border: 1px solid transparent; font-weight: 700; font-size: 0.88rem;
  white-space: nowrap; max-width: 100%;
  transition: transform var(--dur-fast) var(--ease-out-expo), background var(--dur-fast), border-color var(--dur-fast);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); color: var(--color-accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--color-accent-hover); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--color-surface-alt); }
.btn-ghost { background: transparent; color: var(--color-text-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--color-surface-alt); color: var(--color-text); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 0.81rem; border-radius: 9px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--color-border); background: var(--color-surface);
  color: var(--color-text); flex-shrink: 0;
}
.icon-btn:hover { background: var(--color-surface-alt); }

.surface-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  max-width: 100%;
}

.section-kicker {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--color-accent);
}

.view-panel { display: none; animation: fadeSlideUp 220ms var(--ease-out-expo); }
.view-panel.active { display: block; }
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tone-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radius-full);
  font-size: 0.73rem; font-weight: 700; line-height: 1.25; max-width: 100%;
}
.tone-pill.nowrap { white-space: nowrap; flex-shrink: 0; }
.tone-positive { background: var(--tl-green-bg); color: var(--tl-green); border: 1px solid var(--tl-green-border); }
.tone-caution  { background: var(--tl-amber-bg); color: var(--tl-amber); border: 1px solid var(--tl-amber-border); }
.tone-warning,
.tone-danger   { background: var(--tl-red-bg);   color: var(--tl-red);   border: 1px solid var(--tl-red-border); }
.tone-neutral  { background: var(--color-surface-alt); color: var(--color-text-soft); border: 1px solid var(--color-border); }

.toast-rack {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 10px);
  left: 12px; right: 12px; z-index: 120;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
@media (min-width: 960px) {
  .toast-rack { left: auto; right: 24px; bottom: 24px; width: 380px; }
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-md);
  background: var(--color-surface-inv); color: #FFFFFF;
  font-size: 0.85rem; font-weight: 600; box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border-strong);
  animation: fadeSlideUp 200ms var(--ease-out-expo);
}
