/* ============================================================
   GAVITAMINA · TE-SYS // V3.4
   ------------------------------------------------------------
   THE DESIGNERS REPUBLIC & TEENAGE ENGINEERING HARDWARE DESIGN SYSTEM
   1. Tokens (Matte Industrial Aluminum, PBT Keycaps, Phosphor Accents)
   2. Base, Typography & Schematic Dot-Grid
   3. Tactile Push Buttons, Telemetry Fields, Hardware Chips & Tabs
   4. Chassis Header, Technical Nav & Selector Switches
   5. Specification Plate Footer, Dialogs & Modals
   6. Accessibility & Print Calibration
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light;

  /* Matte Industrial Chassis & Keycaps (Teenage Engineering Field Edition) */
  --paper: #EAE9E1;
  --paper-2: #E1E0D7;
  --paper-3: #D7D5CA;
  --surface: #F6F5EF;
  --surface-2: #ECEBE2;
  --surface-3: #E1DFD5;

  /* Screenprint Ink & Precision Carbon */
  --ink: #111215;
  --ink-soft: #353B42;
  --ink-muted: #626B74;
  --ink-faint: #9099A2;

  /* Mechanical Structural Seams (Razor-sharp high contrast) */
  --line: #181B1E;
  --line-soft: #D0CEC4;
  --line-strong: #111215;

  /* Signature TE Safety Flame Orange (OP-1 / K.O. II hardware encoder) */
  --brand: #FF4000;
  --brand-strong: #DF3800;
  --brand-soft: #FFE9DF;
  --brand-softer: #FFF4EE;
  --on-brand: #FFFFFF;

  /* High-Vis Warning & Telemetry Accents */
  --accent-yellow: #D8FF00;
  --accent-cyan: #00E5FF;
  --accent-blue: #0044FF;

  /* Status Colors */
  --amber: #FF7700;
  --amber-soft: #FFF2E3;
  --amber-line: #FFA852;
  --danger: #E62626;
  --danger-soft: #FFE8E8;
  --danger-line: #FFA1A1;

  --ok: #00B368;
  --mid: #FF7700;
  --none: #8A95A0;
  --track: #D4D2C7;

  --focus: #FF4000;
  --shadow: 2px 2px 0px var(--line);
  --shadow-lift: 4px 4px 0px var(--line);
  --scrim: rgba(18, 20, 23, 0.76);

  /* Precise Hardware Chamfers (Zero AI-slop rounded bubbles) */
  --r-xs: 2px;
  --r-sm: 2px;
  --r-md: 3px;
  --r-lg: 4px;
  --r-pill: 2px;

  /* Dimensions */
  --max: 1200px;
  --header-h: 64px;
  --tabbar-h: 64px;
  --gutter: 16px;
  --touch: 48px;

  /* Typography: Space Grotesk + JetBrains Mono */
  --font: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: var(--font);
  --font-display: var(--font);
  --font-mono: 'JetBrains Mono', 'Space Mono', ui-monospace, Consolas, monospace;

  --base-font: 17px;
  --font-scale: 1;
  --fs-small: 0.82rem;

  /* Static Aliases */
  --accent: var(--brand);
  --accent-2: var(--amber);
  --on-accent: var(--on-brand);
  --leaf: var(--brand);
  --berry: var(--danger);
  --plum: #5C4A5E;
  --sky: var(--accent-cyan);
  --ok-bg: var(--brand-soft);
  --ok-ink: var(--brand);

  /* Chassis rear plate footer */
  --footer-bg: #111215;
  --footer-fg: #EDEFEA;
  --footer-soft: rgba(237, 239, 234, .78);
  --footer-faint: rgba(237, 239, 234, .45);
  --footer-line: #2B3037;
  --footer-accent: var(--accent-yellow);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  /* Stealth Matte Black Anodized Chassis (EP-133 / Pocket Operator) */
  --paper: #0C0D0F;
  --paper-2: #121418;
  --paper-3: #191C22;
  --surface: #15171C;
  --surface-2: #1E2128;
  --surface-3: #272C36;

  /* Phosphor & Silkscreen Typography */
  --ink: #F0F2F5;
  --ink-soft: #B2BAC5;
  --ink-muted: #788392;
  --ink-faint: #4E5764;

  /* Structural Seams */
  --line: #2D333F;
  --line-soft: #1E232B;
  --line-strong: #424B5C;

  /* Phosphor Flame Orange */
  --brand: #FF4D1A;
  --brand-strong: #FF6838;
  --brand-soft: #301710;
  --brand-softer: #20100B;
  --on-brand: #0C0D0F;

  /* High-Vis Phosphor Accents */
  --accent-yellow: #E0FF00;
  --accent-cyan: #00F0FF;
  --accent-blue: #3B82F6;

  --amber: #FFA31A;
  --amber-soft: #36220B;
  --amber-line: #664115;
  --danger: #FF4747;
  --danger-soft: #381515;
  --danger-line: #6A2222;

  --ok: #00F08B;
  --mid: #FFA31A;
  --none: #667180;
  --track: #232832;

  --focus: #FF4D1A;
  --shadow: 2px 2px 0px #000000;
  --shadow-lift: 4px 4px 0px #000000;
  --scrim: rgba(0, 0, 0, .8);

  --footer-bg: #070809;
  --footer-fg: #F0F2F5;
  --footer-soft: rgba(240, 242, 245, .72);
  --footer-faint: rgba(240, 242, 245, .42);
  --footer-line: #1E222A;
  --footer-accent: var(--accent-yellow);
}

/* Font Scales */
:root[data-font="1"] { --font-scale: 1.1; }
:root[data-font="2"] { --font-scale: 1.2; }

@media (min-width: 960px) {
  :root { --gutter: 24px; --base-font: 18px; }
}

/* ---------- 2. Base & Typography ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: calc(var(--base-font) * var(--font-scale));
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(17, 18, 21, 0.08) 1px, transparent 1px);
  background-size: 20px 20px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] body {
  background-image: radial-gradient(rgba(240, 242, 245, 0.065) 1px, transparent 1px);
}

body.sin-scroll { overflow: hidden; }

[hidden] { display: none !important; }

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

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.3rem, 6vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.8vw, 2.25rem); }
h3 { font-size: 1.15rem; line-height: 1.25; }
h4 { font-size: 1rem; }

p { max-width: 68ch; }

a {
  color: var(--brand);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
  transition: color .12s ease;
}
a:hover {
  color: var(--brand-strong);
  text-decoration-thickness: 2px;
}

strong, b { font-weight: 700; }
small { font-size: var(--fs-small); }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; }

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

::selection {
  background: var(--brand);
  color: var(--on-brand);
}

/* Numerals & telemetry alignments */
.tnum, table, .ring strong, .gvit__pct, .rank__val, .rank__pct,
.foodcard__value, .summary__stats strong, .meal__kcal, .nrow__val, .nrow__pct {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 1.2em;
  height: 1.2em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: square;
  stroke-linejoin: miter;
  vertical-align: -0.16em;
}

/* ---------- Structural Utilities ---------- */
.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-160%);
  padding: 10px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--brand);
  color: var(--on-brand);
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: var(--shadow-lift);
}
.skip:focus { transform: translateY(0); }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 6px;
  max-width: none;
}
.eyebrow::before {
  content: "/// ";
  opacity: 0.55;
}

.lead {
  max-width: 62ch;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.5;
}

.note {
  font-size: var(--fs-small);
  color: var(--ink-muted);
  max-width: 66ch;
}

.empty {
  padding: 24px;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
  color: var(--ink-soft);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--r-xs);
  background: var(--cat, var(--ink-faint));
  border: 1px solid var(--line);
  flex: none;
}
.dot--ok { background: var(--ok); }
.dot--mid { background: var(--mid); }
.dot--none { background: var(--none); }

.mono {
  display: inline-grid;
  place-items: center;
  min-width: 1.8em;
  height: 1.8em;
  padding-inline: 0.3em;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--c, var(--ink-soft));
  font-family: var(--font-mono);
  font-size: 0.78em;
  font-weight: 700;
  line-height: 1;
}

.btn.is-armed {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
}
.link-arrow:hover { text-decoration: underline; }
.link-arrow .icon { width: 1.05em; height: 1.05em; }

/* ---------- 3. Tactile Push Buttons (Teenage Engineering Hardware) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 8px 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 2px 2px 0px var(--line);
  transition: transform .08s ease, box-shadow .08s ease, background-color .12s ease;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px var(--line);
  background: var(--surface-2);
}

.btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px var(--line);
}

.btn--primary {
  background: var(--brand);
  border-color: var(--line);
  color: var(--on-brand);
}
.btn--primary:hover {
  background: var(--brand-strong);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
.btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

.btn--small {
  min-height: 40px;
  padding: 6px 12px;
  font-size: 0.74rem;
}

.btn--xl {
  min-height: 56px;
  padding: 12px 24px;
  font-size: 0.95rem;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: 1px 1px 0px var(--line) !important;
}

/* ---------- Fields & Inputs ---------- */
.field {
  position: relative;
  display: flex;
  align-items: center;
  min-height: var(--touch);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: 2px 2px 0px var(--line);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field:focus-within {
  border-color: var(--brand);
  box-shadow: 3px 3px 0px var(--brand);
}

.field__icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--ink-muted);
  pointer-events: none;
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 8px 14px 8px 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  outline: none;
}
.field input::placeholder { color: var(--ink-faint); opacity: 1; }
.field input::-webkit-search-cancel-button { cursor: pointer; }

.field--lg { min-height: 54px; }
.field--lg input { min-height: 52px; padding-block: 10px; font-size: 0.98rem; }

.select {
  width: 100%;
  min-height: var(--touch);
  padding: 8px 40px 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23111215' stroke-width='2' fill='none' stroke-linecap='square'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  appearance: none;
  box-shadow: 2px 2px 0px var(--line);
}
:root[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23F0F2F5' stroke-width='2' fill='none' stroke-linecap='square'/%3E%3C/svg%3E");
}
.select--lg { min-height: 52px; font-size: 0.9rem; }
.select:focus {
  border-color: var(--brand);
  box-shadow: 3px 3px 0px var(--brand);
  outline: none;
}

.ctrl { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ctrl--grow { flex: 1 1 260px; }
.ctrl__label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

/* ---------- Segmented Switch Controls ---------- */
.segmented {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 3px;
  padding: 3px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  box-shadow: 1px 1px 0px var(--line);
}
.segmented--wrap { flex-wrap: wrap; }

.seg {
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transition: all .1s ease;
}
.seg:hover { background: var(--surface); color: var(--ink); }
.seg.is-active {
  background: var(--brand);
  border-color: var(--line);
  color: var(--on-brand);
  box-shadow: 1px 1px 0px var(--line);
}

/* ---------- Hardware Chips & Tags ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: 1px 1px 0px var(--line);
  transition: transform .08s ease, background-color .1s ease;
}
.chip:hover {
  background: var(--surface-2);
  transform: translateY(-1px);
}
.chip[aria-pressed="true"] {
  border-color: var(--line);
  background: var(--brand);
  color: var(--on-brand);
}
.chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 0;
  background: var(--c, var(--brand));
  flex: none;
}
.chip__emoji { font-size: 0.95rem; line-height: 1; }
.chip b { font-weight: 700; color: inherit; }
.chip[aria-pressed="true"] b { color: inherit; }

/* ---------- Tabs (Slot Trackers) ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--line);
  overflow-x: auto;
  scrollbar-width: thin;
}
.tabs [role="tab"] {
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  transition: color .12s ease;
}
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* ---------- Toggle Switch ---------- */
.toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: 2px 2px 0px var(--line);
  cursor: pointer;
}
.toggle input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--brand);
  flex: none;
}
.toggle strong {
  display: block;
  font-size: 0.96rem;
  font-weight: 700;
}
.toggle small {
  display: block;
  color: var(--ink-muted);
  margin-top: 2px;
  font-size: var(--fs-small);
}

/* ---------- Dial Rings & Meters ---------- */
.ring {
  --p: 0;
  --c: var(--brand);
  position: relative;
  width: 96px;
  aspect-ratio: 1;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--track) 0);
  display: grid;
  place-items: center;
  box-shadow: 2px 2px 0px var(--line);
}
.ring__hole {
  width: 76%;
  height: 76%;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  line-height: 1.05;
  padding: 4px;
}
.ring__hole strong {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.ring__hole small {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  line-height: 1.15;
  white-space: nowrap;
}
.ring--sm { width: 56px; }
.ring--sm .ring__hole strong { font-size: 0.95rem; }
.ring--sm .ring__hole small { font-size: 0.55rem; }
.ring--md { width: 92px; }
.ring--md .ring__hole strong { font-size: 1.35rem; }
.ring--lg { width: 116px; }
.ring--lg .ring__hole strong { font-size: 1.7rem; }
.ring--xl { width: 148px; }
.ring--xl .ring__hole strong { font-size: 2.15rem; }
.ring--xl .ring__hole small { font-size: 0.65rem; }

.ring--full .ring__hole strong { color: var(--brand); }

/* ---------- Inline Undobar / Alerts ---------- */
.undobar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-block: 12px 0;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  box-shadow: 2px 2px 0px var(--line);
}

/* ---------- 4. Cabecera (Chassis Topbar) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 2px solid var(--line);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.05);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  color: var(--ink);
  text-decoration: none;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface);
  box-shadow: 1px 1px 0px var(--line);
  color: var(--ink);
}
.brand__mark svg { width: 22px; height: 22px; }
.brand__text {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}
.brand__spec {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--accent-yellow);
  color: #111215;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline: auto;
}
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 6px 14px;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  white-space: nowrap;
  transition: all .1s ease;
}
.nav a:hover {
  color: var(--ink);
  background: var(--surface-2);
}
.nav a.is-active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.nav__badge,
.tabbar__badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding-inline: 4px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--brand);
  color: var(--on-brand);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
}
.nav__badge[hidden], .tabbar__badge[hidden] { display: none; }

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* Mechanical Font Switcher */
.fontctl {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface);
  box-shadow: 1px 1px 0px var(--line);
}
.fontctl button {
  min-width: 38px;
  min-height: 36px;
  padding: 0 6px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.82rem;
  transition: all .1s ease;
}
.fontctl button:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.fontctl button[aria-pressed="true"] {
  background: var(--brand);
  color: var(--on-brand);
}

/* Theme Toggle Button */
.themebtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  box-shadow: 1px 1px 0px var(--line);
  transition: all .1s ease;
}
.themebtn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.themebtn__icon { display: inline-flex; }
.themebtn__icon .icon { width: 16px; height: 16px; }

/* Mobile bottom bar */
.tabbar { display: none; }

/* ---------- 5. Chassis Specification Plate (Footer) ---------- */
.footer {
  margin-top: 64px;
  background: var(--footer-bg);
  color: var(--footer-fg);
  border-top: 3px solid var(--line);
  padding: 48px 0 24px;
  position: relative;
}
.footer::before {
  content: "[SYS.LABEL // CHASSIS BACKPLATE SPECIFICATION]";
  position: absolute;
  top: 8px;
  left: var(--gutter);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--footer-faint);
}

.footer__inner {
  display: grid;
  gap: 32px;
}
.footer__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--footer-fg);
  max-width: none;
}
.footer__brand-doodle {
  width: 26px;
  height: 26px;
  color: var(--brand);
  flex: none;
}
.footer__title {
  margin-bottom: 8px;
  color: var(--footer-accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  max-width: none;
}
.footer__text {
  color: var(--footer-soft);
  font-size: var(--fs-small);
  line-height: 1.55;
  max-width: 48ch;
}
.footer__text a {
  color: var(--footer-accent);
  text-decoration: underline;
}

.footer__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--footer-line);
}
.footer__nav-title {
  color: var(--footer-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.footer__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--footer-soft);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
}
.footer__nav a:hover {
  color: var(--footer-fg);
  text-decoration: underline;
}
.footer__bottom {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--footer-line);
  color: var(--footer-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.footer__bottom p { max-width: none; }

/* ---------- 6. Selector de Comida (Modal) ---------- */
.modal {
  width: min(680px, calc(100vw - 24px));
  max-height: min(86dvh, 900px);
  padding: 0;
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
}
.modal::backdrop { background: var(--scrim); }
.modal__inner {
  display: flex;
  flex-direction: column;
  max-height: min(86dvh, 900px);
}
.modal__head {
  position: relative;
  padding: 18px 20px 12px;
  border-bottom: 1.5px solid var(--line);
  background: var(--surface-2);
}
.modal__title {
  margin-top: 2px;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}
.modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: 1px 1px 0px var(--line);
}
.modal__close:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.modal__foot {
  padding: 14px 20px 18px;
  border-top: 1.5px solid var(--line);
  background: var(--surface-2);
}
.modal__foot .btn { width: 100%; }

.picker-tools {
  display: grid;
  gap: 10px;
  padding: 14px 20px;
}
.picker-msg {
  padding-inline: 20px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  min-height: 0;
}
.picker-list { overflow-y: auto; padding: 4px 12px 12px; }

/* ---------- 7. Impresión ---------- */
.print-area { display: none; }

@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; color: #000 !important; font-size: 11pt; font-family: monospace; }
  body.imprimiendo-lista > *:not(.print-area) { display: none !important; }
  body.imprimiendo-lista .print-area { display: block !important; }
  .print-area .print-title { font-size: 18pt; font-weight: 700; margin: 0 0 4pt; }
  .print-area p { margin: 0 0 8pt; }
  .print-area ul { list-style: none; padding: 0; margin: 0; }
  .print-area li {
    display: flex;
    gap: 8pt;
    align-items: baseline;
    padding: 4pt 0;
    border-bottom: 1pt solid #000;
  }
  .print-area .print-group { margin-top: 12pt; font-weight: 700; border-bottom: none; }
  .print-area .print-check {
    width: 10pt; height: 10pt;
    border: 1pt solid #000;
    display: inline-block;
    flex: none;
  }
}

/* ---------- 8. Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* Ajuste móvil Gavitamina */
@media (max-width: 720px) {
  .topbar__inner {
    flex-wrap: wrap;
    gap: 6px 10px;
    padding-block: 8px;
  }
  .topbar__actions {
    flex: 1 1 100%;
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  .site-back { margin-right: auto; }
  .f-table-wrap { max-width: 100%; }
}

/* Donación Ko-fi */
.donacion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 840px;
  margin: 34px auto 0;
  padding: 18px 22px;
  border: 2px solid var(--line);
  background: var(--surface);
}
.donacion__texto { min-width: 0; }
.donacion__texto strong {
  display: block;
  margin-bottom: 3px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
}
.donacion__texto span {
  display: block;
  color: var(--ink-muted);
  font-size: .86rem;
  line-height: 1.45;
}
.btn--donar {
  flex: 0 0 auto;
  background: #ff6b4a;
  color: #1b0b07;
  border-color: transparent;
}
.btn--donar:hover {
  background: #ff8a6f;
  color: #1b0b07;
  border-color: transparent;
}
.btn--donar:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
[data-donacion][hidden] { display: none; }

@media (max-width: 680px) {
  .donacion { flex-direction: column; align-items: flex-start; }
  .donacion .btn--donar { width: 100%; }
}
