/* ==========================================================================
   Bookoo Themis Ultra – Teenage Engineering Theme
   Inspired by the industrial design language of Teenage Engineering
   (OP-1, EP-133 K.O. II, TX-6, Pocket Operators & teenage.engineering)
   ========================================================================== */

:root {
  /* Teenage Engineering Chassis & Surface Palette */
  --te-bg: #ece9e2;             /* Warm stone/bone gray chassis */
  --te-bg-subtle: #dfdbd1;      /* Recessed panel groove */
  --te-card: #f8f7f2;           /* Matte bone module surface */
  --te-card-alt: #ffffff;       /* Pure white keycap / subcard surface */
  --te-well: #131316;           /* Recessed matte black display module */
  --te-well-border: #262529;    /* Inset display bezel */
  
  /* Ink & Typography */
  --te-ink: #141312;            /* Deep technical black ink */
  --te-ink-muted: #6e6c64;      /* Muted technical spec gray */
  --te-ink-faint: #a6a49a;      /* Registration / screw gray */
  --te-border: #141312;         /* Stark 1.5px black mechanical border */
  --te-seam: #d4d1c7;           /* Hairline division seam */

  /* Iconic TE Signature Accent Colors */
  --te-orange: #ff4400;         /* Iconic TE Safety Orange (OP-1 / EP-133 key) */
  --te-orange-hover: #ff591a;
  --te-orange-shadow: #b32a00;
  --te-orange-tint: rgba(255, 68, 0, 0.12);
  --te-blue: #0055ff;           /* TE Electric Blue (Audio / Flow Rate) */
  --te-blue-tint: rgba(0, 85, 255, 0.12);
  --te-yellow: #ffb800;         /* TE Ochre Yellow */
  --te-green: #00c853;          /* TE Signal Green (BLE Active LED) */
  --te-red: #ef4444;            /* Emergency Stop Keycap */
  --te-red-shadow: #991b1b;

  /* Typography */
  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Univers Next Pro", "Univers", "Helvetica Neue", sans-serif;
  --font-mono: 'Space Mono', 'DM Mono', 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --font-matrix: 'Silkscreen', 'Space Mono', monospace;

  /* Geometry & Radii */
  --radius-xs: 3px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;

  /* Tactile Physical Keycap Shadows */
  --keycap-shadow: 0 3.5px 0 var(--te-border);
  --keycap-shadow-hover: 0 4.5px 0 var(--te-border);
  --keycap-shadow-active: 0 1px 0 var(--te-border);
}

/* ==========================================================================
   Global Reset & Base Setup
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body.te-theme {
  background-color: var(--te-bg);
  color: var(--te-ink);
  font-family: var(--font-sans);
  /* Subtle dot-matrix industrial chassis pattern */
  background-image: radial-gradient(rgba(20, 19, 18, 0.08) 1px, transparent 1px);
  background-size: 16px 16px;
  min-height: 100vh;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.font-mono {
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.hidden {
  display: none !important;
}

/* App Container */
.app-container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ==========================================================================
   Chassis Modules & Corner Screws
   ========================================================================== */
.card,
.te-module {
  position: relative;
  background: var(--te-card);
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.03);
  padding: 1.35rem;
}

/* Authentic TE Corner Screws (+) */
.te-screws {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.te-screw {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--te-ink-faint);
  line-height: 1;
  user-select: none;
}
.s-tl { top: 6px; left: 8px; }
.s-tr { top: 6px; right: 8px; }
.s-bl { bottom: 6px; left: 8px; }
.s-br { bottom: 6px; right: 8px; }

/* Section Title (TE module numbering style) */
.section-title {
  font-size: 0.92rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--te-ink);
  letter-spacing: -0.01em;
  text-transform: lowercase;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.te-module-num {
  color: var(--te-orange);
  font-weight: 800;
}

/* ==========================================================================
   Header & Brand Module
   ========================================================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--te-card);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.te-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--te-border);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 0 var(--te-border);
}

.te-logo-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--te-orange);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--te-ink);
  line-height: 1.1;
  text-transform: lowercase;
}

.brand-subtitle {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--te-ink-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.te-spec {
  color: var(--te-orange);
  font-weight: 700;
  margin-left: 0.2rem;
}

/* Tactile Scale Selector in Header */
.te-scale-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--te-bg-subtle);
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.55rem;
  margin-left: 0.5rem;
  box-shadow: 0 2px 0 var(--te-border);
  cursor: pointer;
  transition: all 0.15s ease;
}

.te-scale-picker:hover {
  background: #ffffff;
}

.te-picker-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--te-ink-muted);
  letter-spacing: 0.05em;
}

.te-picker-select {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: lowercase;
  background: transparent;
  border: none;
  color: var(--te-ink);
  cursor: pointer;
  outline: none;
  padding: 0;
}

.te-picker-select:focus {
  outline: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Status Pill (LED indicator style) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  box-shadow: 0 2px 0 var(--te-border);
  text-transform: lowercase;
  color: var(--te-ink);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--te-ink-faint);
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.status-pill.connected .status-dot {
  background: var(--te-green);
  box-shadow: 0 0 8px rgba(0, 200, 83, 0.8);
  animation: pulse-dot 1.8s infinite alternate ease-in-out;
}

.status-pill.connected {
  border-color: var(--te-border);
  color: var(--te-ink);
}

.status-pill.connecting .status-dot {
  background: var(--te-yellow);
}

.status-pill.disconnected .status-dot {
  background: var(--te-red);
}

/* Battery Pill */
.battery-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  box-shadow: 0 2px 0 var(--te-border);
  color: var(--te-ink);
  text-transform: lowercase;
}

.battery-pill.low {
  border-color: var(--te-red);
  color: var(--te-red);
}

@keyframes pulse-dot {
  from { transform: scale(0.9); opacity: 0.8; }
  to { transform: scale(1.15); opacity: 1; }
}

/* Alert Banner */
.alert-banner {
  background: #fff8e6;
  border: 1.5px solid var(--te-yellow);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: #7c4a00;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  box-shadow: 0 2px 0 var(--te-yellow);
}

.alert-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ==========================================================================
   Tactile Mechanical Buttons & Keycaps (OP-1 & EP-133 style)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: -0.01em;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--te-border);
  cursor: pointer;
  position: relative;
  transition: all 0.08s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  box-shadow: var(--keycap-shadow);
  line-height: 1.2;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--keycap-shadow-hover);
}

.btn:active {
  transform: translateY(3px);
  box-shadow: var(--keycap-shadow-active);
}

/* Primary Connect Key: TE Safety Orange */
.btn-primary {
  background: var(--te-orange);
  color: #ffffff;
  border-color: var(--te-border);
  box-shadow: 0 3.5px 0 var(--te-border);
}
.btn-primary:hover {
  background: var(--te-orange-hover);
}

/* Secondary Button: Clean Bone / White Keycap */
.btn-secondary {
  background: #ffffff;
  color: var(--te-ink);
  border-color: var(--te-border);
}
.btn-secondary:hover {
  background: #fdfdfc;
}

/* Donate Keycap (Header Action) */
.btn-donate {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  background: #ffffff;
  color: var(--te-ink);
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 0 var(--te-border);
  padding: 0.38rem 0.72rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  text-transform: lowercase;
  cursor: pointer;
  transition: all 0.08s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  line-height: 1.2;
}

.btn-donate svg {
  color: var(--te-orange);
  transition: transform 0.15s ease;
}

.btn-donate:hover {
  background: #faf8f5;
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--te-border);
  color: var(--te-ink);
}

.btn-donate:hover svg {
  transform: scale(1.18);
}

.btn-donate:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--te-border);
}

/* Icon Buttons (Header actions: Settings, Help, Fullscreen) */
.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-md);
  color: var(--te-ink);
  cursor: pointer;
  box-shadow: 0 2px 0 var(--te-border);
  transition: all 0.08s ease;
}
.btn-icon:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--te-border);
  background: #faf9f6;
}
.btn-icon:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--te-border);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  box-shadow: 0 2px 0 var(--te-border);
}
.btn-sm:hover {
  box-shadow: 0 3px 0 var(--te-border);
}
.btn-sm:active {
  box-shadow: 0 0 0 var(--te-border);
  transform: translateY(2px);
}

.btn-ghost {
  background: #ffffff;
  color: var(--te-ink);
  border: 1.5px solid var(--te-border);
}
.btn-ghost:hover {
  background: #f4f3ed;
}

.btn-outline {
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  color: var(--te-ink);
}

/* ==========================================================================
   Dashboard Grid
   ========================================================================== */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

/* ==========================================================================
   Module 01: Primary Scale Display Card
   ========================================================================== */
.scale-display-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.display-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--te-seam);
}

.scale-mode-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--te-ink);
  text-transform: lowercase;
}

.stability-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--te-ink);
  text-transform: lowercase;
  background: #ffffff;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--te-border);
  box-shadow: 0 1.5px 0 var(--te-border);
}

.stability-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--te-green);
}

.stability-indicator.unstable .stability-dot {
  background: var(--te-yellow);
}

/* Telemetry Cockpit Container */
.telemetry-cockpit {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}

.well-mini-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.95rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  z-index: 3;
}

/* Inset Matte Black OLED/LCD Display Well */
.weight-hero-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.75rem 1.5rem;
  background: var(--te-well);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--te-well-border);
  box-shadow: inset 0 3px 12px rgba(0, 0, 0, 0.75), 0 2px 0 rgba(255, 255, 255, 0.6);
  user-select: none;
  overflow: hidden;
}

/* Subtle millimeter matrix grid on OLED glass */
.weight-hero-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.weight-hero {
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.05em;
  color: #ffffff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.25);
  position: relative;
  z-index: 2;
}

.weight-hero.negative {
  color: #ff6b6b;
}

.weight-sign {
  font-size: 3.5rem;
  margin-right: 0.15rem;
  line-height: 1;
}

.weight-integer {
  font-size: 6.75rem;
  line-height: 0.95;
}

.weight-decimal-dot {
  font-size: 5.5rem;
  margin: 0 0.05rem;
  color: var(--te-orange);
}

.weight-fraction {
  font-size: 4.25rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1;
}

/* Unit Selector: Physical Rocker / Slider Switch */
.unit-selector {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  z-index: 3;
  transition: all 0.15s ease;
}

.unit-selector:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
}

.unit-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  text-transform: lowercase;
  transition: color 0.15s ease;
}

.unit-pill.active {
  color: var(--te-orange);
}

.unit-divider {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.7rem;
}

/* ==========================================================================
   Live Metrics Row (4 Sub-Modules)
   ========================================================================== */
.live-metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  width: 100%;
}

.metric-box {
  background: var(--te-card-alt);
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 2.5px 0 var(--te-border);
  position: relative;
  transition: transform 0.1s ease;
}

.metric-box:hover {
  transform: translateY(-1px);
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--te-ink-muted);
  text-transform: lowercase;
  margin-bottom: 0.35rem;
}

.metric-value-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--te-ink);
  line-height: 1.1;
}

.metric-unit {
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--te-ink-muted);
}

/* Flow Meter Bar: Stacked LED Segment VU-Meter */
.flow-meter-bar {
  width: 100%;
  height: 6px;
  background: var(--te-bg);
  border: 1px solid var(--te-seam);
  border-radius: 2px;
  margin-top: 0.65rem;
  overflow: hidden;
}

.flow-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--te-blue), var(--te-orange));
  border-radius: 1px;
  transition: width 0.12s ease-out;
}

.timer-source-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: lowercase;
  color: var(--te-orange);
  background: var(--te-orange-tint);
  border: 1px solid rgba(255, 68, 0, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-xs);
  margin-top: 0.45rem;
}

.metric-sub {
  font-size: 0.72rem;
  color: var(--te-ink-muted);
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  text-transform: lowercase;
}

/* Dose Input for Ratio */
.dose-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--te-ink-muted);
  font-family: var(--font-mono);
  text-transform: lowercase;
}

.dose-input {
  width: 58px;
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-xs);
  color: var(--te-ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.25rem;
  text-align: center;
  box-shadow: 0 1px 0 var(--te-border);
  -moz-appearance: textfield;
}

.dose-input::-webkit-outer-spin-button,
.dose-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.dose-input:focus {
  outline: none;
  border-color: var(--te-orange);
}

/* ==========================================================================
   Module 01 Transport Keycaps: Controls Panel
   ========================================================================== */
.controls-panel {
  display: grid;
  grid-template-columns: 2fr 2fr 1.25fr 1.25fr;
  gap: 0.75rem;
  width: 100%;
}

/* Tare Keycap (Bone White Physical Button) */
.btn-tare {
  background: #ffffff;
  color: var(--te-ink);
  border: 1.5px solid var(--te-border);
  box-shadow: 0 3.5px 0 var(--te-border);
  padding: 0.95rem 1.25rem;
  font-size: 0.92rem;
  font-weight: 700;
}
.btn-tare:hover {
  background: #faf8f5;
}

/* Combo Keycap (Tare & Start): Iconic TE Safety Orange */
.btn-combo {
  background: var(--te-orange);
  color: #ffffff;
  border: 1.5px solid var(--te-border);
  box-shadow: 0 3.5px 0 var(--te-border);
  padding: 0.95rem 1.15rem;
  font-size: 0.92rem;
  font-weight: 800;
}
.btn-combo:hover {
  background: var(--te-orange-hover);
}

/* Action Keycaps (Start & Reset): Warm Putty Keycap */
.btn-action {
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  color: var(--te-ink);
  box-shadow: 0 3.5px 0 var(--te-border);
  padding: 0.95rem 1rem;
  font-size: 0.88rem;
  font-weight: 700;
}
.btn-action:hover {
  background: #faf8f5;
}

/* Morph: Active STOP State Keycap */
.btn-stop {
  background: var(--te-red) !important;
  border-color: var(--te-border) !important;
  color: #ffffff !important;
  box-shadow: 0 3.5px 0 var(--te-border) !important;
}
.btn-stop:hover {
  background: #dc2626 !important;
}

/* Morph: Armed READY State Keycap (Waiting for Pour) */
.btn-combo.btn-ready {
  background: #ff5500 !important;
  border-color: var(--te-border) !important;
  color: #ffffff !important;
  box-shadow: 0 3.5px 0 var(--te-border), 0 0 16px rgba(255, 85, 0, 0.55) !important;
  animation: te-ready-pulse 1.3s infinite alternate ease-in-out !important;
}
.btn-combo.btn-ready:hover {
  background: #ff6a1a !important;
}

@keyframes te-ready-pulse {
  from {
    transform: translateY(0);
    filter: brightness(1);
    box-shadow: 0 3.5px 0 var(--te-border), 0 0 8px rgba(255, 85, 0, 0.4);
  }
  to {
    transform: translateY(-1px);
    filter: brightness(1.15);
    box-shadow: 0 4.5px 0 var(--te-border), 0 0 22px rgba(255, 85, 0, 0.75);
  }
}

/* Pulsing Highlight on Reset Keycap when Stopped */
.btn-reset-pulse {
  background: #fff8f5 !important;
  border-color: var(--te-orange) !important;
  color: var(--te-orange) !important;
  box-shadow: 0 3.5px 0 var(--te-orange), 0 0 14px rgba(255, 68, 0, 0.45) !important;
  animation: te-pulse 1.6s infinite alternate ease-in-out;
}

@keyframes te-pulse {
  from { transform: translateY(0); box-shadow: 0 3.5px 0 var(--te-orange), 0 0 8px rgba(255, 68, 0, 0.3); }
  to { transform: translateY(-1px); box-shadow: 0 4.5px 0 var(--te-orange), 0 0 18px rgba(255, 68, 0, 0.6); }
}

/* Disabled Keycap State */
.btn:disabled,
button:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  filter: grayscale(0.5) !important;
  transform: translateY(2px) !important;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15) !important;
  background: #e8e6df !important;
  color: var(--te-ink-muted) !important;
}

/* ==========================================================================
   Module 02: Extraction Curve (Synthesizer Oscilloscope)
   ========================================================================== */
.chart-card {
  padding: 1.35rem;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.chart-title-wrap {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: wrap;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: lowercase;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-color {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.legend-weight .legend-color {
  background: var(--te-orange);
}

.legend-flow .legend-color {
  background: var(--te-blue);
}

.chart-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Inset OLED Screen for Oscilloscope */
.chart-container {
  position: relative;
  width: 100%;
  height: 290px;
  border-radius: var(--radius-md);
  background: var(--te-well);
  border: 1.5px solid var(--te-well-border);
  box-shadow: inset 0 3px 12px rgba(0, 0, 0, 0.75), 0 2px 0 rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

#brewChart {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  color: var(--te-ink-faint);
  text-align: center;
  padding: 1rem;
  pointer-events: none;
  font-family: var(--font-mono);
  text-transform: lowercase;
}

.chart-empty-state p {
  font-size: 0.82rem;
  max-width: 320px;
}

/* Viewing Historical Session Badge (Tape Track Tag) */
.viewing-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.65rem;
  background: #ffffff;
  border: 1.5px solid var(--te-orange);
  border-radius: var(--radius-sm);
  color: var(--te-orange);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  box-shadow: 0 1.5px 0 var(--te-orange);
  text-transform: lowercase;
}

.btn-badge-close {
  background: var(--te-orange);
  border: none;
  border-radius: var(--radius-xs);
  color: #ffffff;
  cursor: pointer;
  padding: 0.15rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: lowercase;
  transition: all 0.1s ease;
}
.btn-badge-close:hover {
  background: var(--te-orange-hover);
}

/* ==========================================================================
   Module 03: Brew Sessions Log (Data Sheet Table)
   ========================================================================== */
.logs-card {
  padding: 1.35rem;
}

.logs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.logs-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: 0 2px 0 var(--te-border);
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.logs-table th {
  padding: 0.75rem 0.95rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--te-ink-muted);
  border-bottom: 1.5px solid var(--te-border);
  background: var(--te-card);
  text-transform: lowercase;
}

.logs-table td {
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--te-seam);
  color: var(--te-ink);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* Brew Row Hover & Selection */
.logs-table tr.brew-row {
  cursor: pointer;
  transition: background 0.1s ease;
}

.logs-table tr.brew-row:hover td {
  background: #fbfaf6;
}

.logs-table tr.brew-row.selected td {
  background: rgba(255, 68, 0, 0.08) !important;
  color: var(--te-ink) !important;
  border-bottom-color: rgba(255, 68, 0, 0.25);
}

.logs-table tr.brew-row.selected td:first-child {
  border-left: 3.5px solid var(--te-orange);
}

.logs-table .empty-row td {
  text-align: center;
  padding: 2.25rem 1rem;
  color: var(--te-ink-muted);
  font-family: var(--font-mono);
  text-transform: lowercase;
}

/* Curve Badges inside Table */
.curve-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid var(--te-border);
  box-shadow: 0 1.5px 0 var(--te-border);
  color: var(--te-ink);
  text-transform: lowercase;
  transition: all 0.1s ease;
}

.brew-row:hover .curve-badge:not(.disabled) {
  border-color: var(--te-orange);
  color: var(--te-orange);
  box-shadow: 0 1.5px 0 var(--te-orange);
}

.curve-badge.active {
  background: var(--te-orange) !important;
  border-color: var(--te-border) !important;
  color: #ffffff !important;
  box-shadow: 0 1.5px 0 var(--te-border) !important;
}

.curve-badge.disabled {
  opacity: 0.35;
  border: none;
  box-shadow: none;
  background: transparent;
}

/* ==========================================================================
   Module 04: BLE Telemetry Terminal
   ========================================================================== */
.inspector-card {
  padding: 1rem 1.25rem;
}

.inspector-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--te-ink);
  list-style: none;
  text-transform: lowercase;
}

.inspector-summary::-webkit-details-marker {
  display: none;
}

.inspector-summary-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.packet-rate-badge {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  background: #ffffff;
  border: 1px solid var(--te-border);
  border-radius: var(--radius-xs);
  color: var(--te-green);
  font-weight: 700;
}

.toggle-indicator {
  font-size: 0.72rem;
  color: var(--te-ink-muted);
}

.inspector-content {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--te-seam);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.65rem;
}

.tel-item {
  background: #ffffff;
  border: 1px solid var(--te-seam);
  border-radius: var(--radius-xs);
  padding: 0.45rem 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  font-family: var(--font-mono);
}

.tel-label {
  color: var(--te-ink-muted);
  text-transform: lowercase;
}

.tel-val {
  color: var(--te-ink);
  font-weight: 700;
}

.hex-dump-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--te-ink-muted);
  text-transform: lowercase;
}

.hex-dump {
  background: var(--te-well);
  border: 1.5px solid var(--te-well-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.78rem;
  color: #38ef7d;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
  word-break: break-all;
}

/* ==========================================================================
   Modals (Teenage Engineering Hardware Manual Cards)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 19, 18, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-dialog {
  background: var(--te-card);
  border: 2px solid var(--te-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 0 var(--te-border), 0 20px 30px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.35rem;
  border-bottom: 1.5px solid var(--te-border);
  background: #ffffff;
}

.modal-title {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--te-ink);
  text-transform: lowercase;
}

.modal-body {
  padding: 1.35rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  font-size: 0.85rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.35rem;
  border-top: 1.5px solid var(--te-border);
  background: #ffffff;
}

/* Setting Groups */
.setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.setting-group h4 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--te-ink);
  text-transform: lowercase;
}

.radio-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 0 var(--te-border);
  cursor: pointer;
}

.radio-content strong {
  font-size: 0.82rem;
  color: var(--te-ink);
  text-transform: lowercase;
}

.radio-content p {
  font-size: 0.75rem;
  color: var(--te-ink-muted);
  margin-top: 0.2rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.85rem;
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 0 var(--te-border);
  cursor: pointer;
}

.toggle-info strong {
  font-size: 0.82rem;
  color: var(--te-ink);
  text-transform: lowercase;
}

.toggle-info p {
  font-size: 0.75rem;
  color: var(--te-ink-muted);
}

.setting-select {
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--te-ink);
  box-shadow: 0 1.5px 0 var(--te-border);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: lowercase;
  border: 1.5px solid var(--te-border);
  background: #ffffff;
  color: var(--te-ink);
  box-shadow: 0 4px 0 var(--te-border);
  animation: slideUp 0.15s ease;
}

.toast.toast-success {
  border-color: var(--te-border);
  background: #ffffff;
  border-left: 5px solid var(--te-green);
}

.toast.toast-error {
  border-color: var(--te-border);
  background: #ffffff;
  border-left: 5px solid var(--te-red);
}

.toast.toast-info {
  border-color: var(--te-border);
  background: #ffffff;
  border-left: 5px solid var(--te-orange);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 768px) {
  .controls-panel {
    grid-template-columns: 1fr 1fr;
  }
  
  .weight-integer {
    font-size: 4.85rem;
  }
  .weight-fraction {
    font-size: 3.25rem;
  }
  .weight-decimal-dot {
    font-size: 4rem;
  }
  
  .app-container {
    padding: 0.75rem 0.5rem 2.5rem 0.5rem;
  }

  .workflow-mode-inner {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }
  .workflow-left, .workflow-right {
    justify-content: space-between !important;
  }

  .steps-timeline {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   Workflow Mode Bar (Espresso vs Pour Over)
   ========================================================================== */
.workflow-mode-bar {
  padding: 0.65rem 1.25rem;
  background: var(--te-card);
  border: 1.5px solid var(--te-border);
  box-shadow: 0 2px 0 rgba(20, 19, 18, 0.05);
}

.workflow-mode-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.workflow-left,
.workflow-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.workflow-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--te-ink-muted);
  letter-spacing: 0.05em;
}

.te-mode-segmented {
  display: inline-flex;
  background: var(--te-bg-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--te-border);
  gap: 3px;
}

.mode-segment {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  border: 1.5px solid transparent;
  background: transparent;
  border-radius: var(--radius-xs);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--te-ink-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.mode-segment:hover {
  color: var(--te-ink);
  background: rgba(255, 255, 255, 0.4);
}

.mode-segment.active {
  background: #ffffff;
  color: var(--te-ink);
  border-color: var(--te-border);
  box-shadow: 0 1.5px 0 var(--te-border);
}

.mode-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #bbb;
  transition: all 0.2s ease;
}

.mode-segment.active[data-mode="espresso"] .mode-dot {
  background: var(--te-orange);
  box-shadow: 0 0 6px rgba(255, 68, 0, 0.6);
}

.mode-segment.active[data-mode="pourover"] .mode-dot {
  background: var(--te-blue);
  box-shadow: 0 0 6px rgba(0, 85, 255, 0.6);
}

.mode-badge-tag {
  font-size: 0.68rem;
  color: var(--te-ink-faint);
  font-weight: 500;
}

.mode-segment.active .mode-badge-tag {
  color: var(--te-ink-muted);
}

/* Submode Segmented (Manual vs Recipes) */
.te-submode-segmented {
  display: inline-flex;
  background: var(--te-bg-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--te-border);
  gap: 3px;
}

.submode-segment {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-xs);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--te-ink-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.submode-segment:hover {
  color: var(--te-ink);
}

.submode-segment.active {
  background: #ffffff;
  color: var(--te-ink);
  border-color: var(--te-border);
  box-shadow: 0 1px 0 var(--te-border);
}

.submode-badge {
  font-size: 0.62rem;
  padding: 1px 4px;
  border-radius: 2px;
  background: var(--te-orange-tint);
  color: var(--te-orange);
  font-weight: 700;
}

/* ==========================================================================
   Recipe Guidance & Stepper Module (Unified & Integrated)
   ========================================================================== */
.recipe-header-block {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--te-seam);
}

.recipe-sub-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--te-orange);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.recipe-guide-section {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  width: 100%;
  padding-top: 1rem;
  border-top: 1.5px solid var(--te-seam);
}

.recipe-guide-card {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  border: 1.5px solid var(--te-border);
  box-shadow: var(--keycap-shadow);
}

/* ==========================================================================
   Guided Recipe Mode: Dual-Hero Cockpit Layout
   Prominently fuses Live Weight & Brew Time alongside brew steps
   ========================================================================== */
.scale-display-card.recipe-mode-active .telemetry-cockpit {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 1rem;
  width: 100%;
}

.scale-display-card.recipe-mode-active .weight-hero-wrapper {
  margin: 0;
  padding: 1.15rem 1.35rem;
  min-height: 155px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.scale-display-card.recipe-mode-active .weight-integer {
  font-size: 4.85rem;
  line-height: 0.95;
}

.scale-display-card.recipe-mode-active .weight-fraction {
  font-size: 3.35rem;
}

.scale-display-card.recipe-mode-active .weight-decimal-dot {
  font-size: 4rem;
}

.scale-display-card.recipe-mode-active .weight-sign {
  font-size: 2.75rem;
}

.scale-display-card.recipe-mode-active .live-metrics-row {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
  height: 100%;
}

.scale-display-card.recipe-mode-active .peak-metric-box,
.scale-display-card.recipe-mode-active .ratio-metric-box {
  display: none !important;
}

.scale-display-card.recipe-mode-active .timer-metric-box {
  order: 1;
  flex: 1;
  background: var(--te-well);
  border: 1.5px solid var(--te-well-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.35rem;
  box-shadow: inset 0 3px 12px rgba(0, 0, 0, 0.75), 0 2px 0 rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  min-height: 105px;
  overflow: hidden;
  text-align: left;
  align-items: flex-start;
}

.scale-display-card.recipe-mode-active .timer-metric-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.scale-display-card.recipe-mode-active .timer-metric-box .metric-label {
  color: var(--te-orange);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.15rem;
}

.scale-display-card.recipe-mode-active .timer-metric-box .metric-value-wrap {
  z-index: 2;
}

.scale-display-card.recipe-mode-active .timer-metric-box .metric-value {
  font-size: 4.25rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.25);
  line-height: 1;
  letter-spacing: -0.04em;
  font-family: var(--font-mono);
}

.scale-display-card.recipe-mode-active .flow-metric-box {
  order: 2;
  padding: 0.45rem 0.85rem;
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 1.5px 0 var(--te-border);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.scale-display-card.recipe-mode-active .unit-selector {
  top: 0.65rem;
  right: 0.85rem;
  padding: 0.2rem 0.45rem;
}

.well-mini-badge {
  display: none;
}

.scale-display-card.recipe-mode-active .well-mini-badge {
  display: block;
  position: absolute;
  top: 0.65rem;
  left: 0.85rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--te-orange);
  text-transform: uppercase;
  z-index: 3;
}

.scale-display-card.recipe-mode-active .flow-metric-box .metric-label {
  font-size: 0.68rem;
  margin: 0;
  text-transform: uppercase;
}

.scale-display-card.recipe-mode-active .flow-metric-box .metric-value-wrap {
  font-size: 0.95rem;
  margin: 0;
}

.scale-display-card.recipe-mode-active .flow-metric-box .flow-meter-bar {
  flex: 1;
  max-width: 140px;
  margin: 0;
}

@media (max-width: 768px) {
  .scale-display-card.recipe-mode-active .telemetry-cockpit {
    grid-template-columns: 1fr;
  }
  .scale-display-card.recipe-mode-active .weight-integer {
    font-size: 4.25rem;
  }
  .scale-display-card.recipe-mode-active .timer-metric-box .metric-value {
    font-size: 3.4rem;
  }
}

.recipe-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.recipe-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.recipe-name {
  font-size: 1.18rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  color: var(--te-ink);
}

.recipe-header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.recipe-picker-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.recipe-picker-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--te-ink-muted);
  text-transform: uppercase;
}

.recipe-meta-strip {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.15rem;
  padding: 0.5rem 0.85rem;
  background: var(--te-bg-subtle);
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  flex-wrap: wrap;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Dose Control & Quick Tools */
.meta-dose-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.meta-dose-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-xs);
  padding: 0.12rem 0.4rem;
  box-shadow: 0 1.5px 0 var(--te-border);
  transition: border-color 0.12s ease;
}

.meta-dose-input-wrap:focus-within {
  border-color: var(--te-orange);
}

.recipe-dose-input {
  width: 44px;
  border: none;
  background: transparent;
  color: var(--te-ink);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: right;
  padding: 0;
  margin: 0;
  -moz-appearance: textfield;
}

.recipe-dose-input::-webkit-outer-spin-button,
.recipe-dose-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.recipe-dose-input:focus {
  outline: none;
}

.meta-dose-unit {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--te-ink-muted);
}

.btn-dose-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.5rem;
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--te-ink);
  text-transform: lowercase;
  cursor: pointer;
  box-shadow: 0 1.5px 0 var(--te-border);
  transition: all 0.1s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-dose-tool svg {
  flex-shrink: 0;
}

.btn-dose-tool:hover {
  background: #fbfbfa;
  border-color: var(--te-ink);
  color: var(--te-orange);
}

.btn-dose-tool:active {
  transform: translateY(1.5px);
  box-shadow: 0 0 0 var(--te-border);
}

.btn-dose-reset {
  color: var(--te-ink-muted);
}

.btn-dose-reset:hover {
  color: var(--te-ink);
}

.btn-dose-tool:disabled {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  transform: none !important;
  box-shadow: none !important;
  background: transparent !important;
  border-color: rgba(20, 19, 18, 0.2) !important;
  color: var(--te-ink-muted) !important;
}

/* Ratio Control */
.meta-ratio-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.meta-ratio-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-xs);
  padding: 0.12rem 0.4rem;
  box-shadow: 0 1.5px 0 var(--te-border);
  transition: border-color 0.12s ease;
  cursor: text;
}

.meta-ratio-input-wrap:focus-within {
  border-color: var(--te-orange);
}

.meta-ratio-prefix {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--te-ink-muted);
  user-select: none;
  pointer-events: none;
  line-height: 1;
}

.recipe-ratio-input {
  width: 42px;
  border: none;
  background: transparent;
  color: var(--te-ink);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  padding: 0;
  margin: 0;
  -moz-appearance: textfield;
}

.recipe-ratio-input::-webkit-outer-spin-button,
.recipe-ratio-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.recipe-ratio-input:focus {
  outline: none;
}

/* Grind Control & Grinder Scale Translator */
.meta-grind-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.meta-grind-val-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
}

.meta-grind-sub {
  font-size: 0.7rem;
  color: var(--te-ink-muted);
  font-weight: 500;
  white-space: nowrap;
}

.grinder-picker-wrap {
  display: inline-flex;
  align-items: center;
}

.grinder-select {
  padding: 0.2rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  background: #ffffff;
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-xs);
  color: var(--te-ink);
  box-shadow: 0 1.5px 0 var(--te-border);
  cursor: pointer;
  transition: all 0.1s ease;
  height: 24px;
}

.grinder-select:hover {
  background: #fbfbfa;
  border-color: var(--te-ink);
  color: var(--te-orange);
}

.grinder-select:focus {
  outline: none;
  border-color: var(--te-orange);
}

.meta-divider {
  width: 1px;
  height: 18px;
  background: var(--te-border);
  opacity: 0.35;
  margin: 0 0.1rem;
}

@media (max-width: 640px) {
  .meta-divider {
    display: none;
  }
}

.meta-k {
  color: var(--te-ink-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
}

.meta-v {
  font-weight: 700;
  color: var(--te-ink);
}

.meta-v.highlight-val {
  color: var(--te-orange);
}

/* ==========================================================================
   Active Step Directive HUD (Recessed Industrial Well)
   ========================================================================== */
.active-step-hud {
  background: var(--te-well);
  color: #f8f8f8;
  border: 1.5px solid var(--te-well-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.45);
}

.step-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.step-pill-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.step-num {
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(255, 68, 0, 0.2);
  color: var(--te-orange);
  border: 1px solid rgba(255, 68, 0, 0.4);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-xs);
  letter-spacing: 0.04em;
}

.step-type-badge {
  font-size: 0.74rem;
  font-weight: 600;
  color: #a6a49a;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.step-countdown-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 184, 0, 0.15);
  border: 1px solid rgba(255, 184, 0, 0.4);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-xs);
}

.countdown-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--te-yellow);
  animation: pulseCountdown 1s infinite alternate;
}

@keyframes pulseCountdown {
  from { opacity: 0.4; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.15); }
}

.countdown-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--te-yellow);
  letter-spacing: 0.04em;
}

.countdown-seconds {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

/* Directive Hero */
.directive-hero {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.directive-primary {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

.directive-secondary {
  font-size: 0.92rem;
  color: #c4c1b7;
  line-height: 1.45;
}

/* Gauge Bar */
.step-gauge-bar {
  position: relative;
  height: 12px;
  background: #222226;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #333338;
}

.step-gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, #0055ff, #ff4400);
  border-radius: 6px;
  transition: width 0.12s linear;
}

.step-gauge-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #a6a49a;
}

.step-delta-tag {
  color: var(--te-orange);
  font-weight: 700;
}

/* Next Cue Banner */
.next-cue-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
}

.cue-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #88867f;
  letter-spacing: 0.05em;
}

.cue-text {
  color: #e5e3db;
}

/* Stepper Navigation Buttons */
.step-action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.step-action-bar .btn {
  font-size: 0.78rem;
  padding: 0.4rem 0.85rem;
}

/* ==========================================================================
   Lookahead Stepper (Timeline Sequence)
   ========================================================================== */
.lookahead-stepper-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stepper-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--te-ink-muted);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stepper-hint {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--te-ink-faint);
}

.steps-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}

.timeline-step-card {
  background: var(--te-card-alt);
  border: 1.5px solid var(--te-seam);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.timeline-step-card:hover {
  border-color: var(--te-border);
  transform: translateY(-1px);
}

.timeline-step-card.active {
  border-color: var(--te-orange);
  background: #ffffff;
  box-shadow: 0 0 0 2px var(--te-orange-tint), 0 2px 0 var(--te-border);
}

.timeline-step-card.completed {
  border-color: var(--te-border);
  background: #fbfbf9;
  opacity: 0.8;
}

.timeline-step-card.disabled,
.steps-timeline.disabled .timeline-step-card {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  border-color: var(--te-seam) !important;
  transform: none !important;
  box-shadow: none !important;
}

.step-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  font-weight: 700;
}

.step-card-num {
  color: var(--te-ink-muted);
}

.timeline-step-card.active .step-card-num {
  color: var(--te-orange);
}

.step-card-method {
  padding: 1px 5px;
  background: var(--te-bg-subtle);
  border-radius: 2px;
  font-size: 0.64rem;
  color: var(--te-ink);
}

.step-card-weight {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--te-ink);
  letter-spacing: -0.02em;
}

.step-card-delta {
  font-size: 0.72rem;
  color: var(--te-ink-muted);
  font-weight: 500;
  margin-left: 0.25rem;
}

.step-card-notes {
  font-size: 0.72rem;
  color: var(--te-ink-muted);
  line-height: 1.3;
}

.step-check-icon {
  position: absolute;
  top: 6px;
  right: 6px;
  color: var(--te-green);
  font-weight: 700;
  font-size: 0.85rem;
}

/* ==========================================================================
   Recipe Catalog Page (Dedicated Page/Tab)
   ========================================================================== */
.recipe-catalog-page {
  grid-column: 1 / -1;
  background: var(--te-card);
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 480px;
  position: relative;
}

.catalog-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.2rem;
  border-bottom: 1.5px solid var(--te-border);
}

.catalog-page-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.catalog-page-subtitle {
  font-size: 0.78rem;
  color: var(--te-ink-muted);
  line-height: 1.4;
  margin: 0;
}

.catalog-header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.catalog-filters {
  display: flex;
  gap: 0.4rem;
}

.catalog-filter-btn {
  padding: 0.25rem 0.65rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--te-ink-muted);
  cursor: pointer;
}

.catalog-filter-btn:hover {
  color: var(--te-ink);
}

.catalog-filter-btn.active {
  background: #ffffff;
  border-color: var(--te-border);
  color: var(--te-ink);
  box-shadow: 0 1px 0 var(--te-border);
}

.catalog-meta {
  font-size: 0.72rem;
  color: var(--te-ink-muted);
}

.catalog-list-wrap {
  overflow-y: auto;
  padding: 1.25rem;
  flex: 1;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.catalog-recipe-card {
  background: var(--te-card-alt);
  border: 1.5px solid var(--te-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: var(--keycap-shadow);
  transition: all 0.15s ease;
  cursor: pointer;
}

.catalog-recipe-card:hover {
  transform: translateY(-2px);
  border-color: var(--te-ink);
  box-shadow: var(--keycap-shadow-hover);
}

.catalog-recipe-card.active-recipe {
  border-color: var(--te-orange);
  background: #ffffff;
  box-shadow: 0 0 0 1px var(--te-orange), var(--keycap-shadow);
}

.catalog-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.catalog-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--te-ink);
}

.catalog-card-brewer {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  background: var(--te-bg-subtle);
  border-radius: var(--radius-xs);
  color: var(--te-ink-muted);
}

.catalog-card-specs {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--te-ink-muted);
  flex-wrap: wrap;
}

.catalog-card-desc {
  font-size: 0.8rem;
  color: var(--te-ink-muted);
  line-height: 1.4;
  flex: 1;
}

.catalog-card-steps-summary {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.45rem 0.6rem;
  background: var(--te-bg-subtle);
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
}

.catalog-card-source {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  padding: 0.35rem 0.55rem;
  background: var(--te-bg-subtle);
  border: 1px dashed rgba(20, 19, 18, 0.25);
  border-radius: var(--radius-xs);
  flex-wrap: wrap;
}

.catalog-source-k {
  font-weight: 700;
  text-transform: lowercase;
  color: var(--te-ink-muted);
}

.catalog-source-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--te-ink);
  text-decoration: underline;
  text-decoration-color: rgba(20, 19, 18, 0.35);
  text-underline-offset: 2.5px;
  font-weight: 700;
  transition: all 0.12s ease;
}

.catalog-source-link:hover {
  color: var(--te-orange);
  text-decoration-color: var(--te-orange);
}

.catalog-source-link svg {
  flex-shrink: 0;
}

.catalog-source-link svg.icon-youtube {
  color: #cc0000;
}

.catalog-source-link svg.icon-web {
  color: var(--te-ink);
}

.catalog-source-link:hover svg {
  color: var(--te-orange);
}

.catalog-source-arrow {
  font-size: 0.75rem;
  line-height: 1;
  color: var(--te-ink-muted);
}

.catalog-source-link:hover .catalog-source-arrow {
  color: var(--te-orange);
}

.catalog-select-btn {
  width: 100%;
  margin-top: 0.4rem;
}

/* ==========================================================================
   Module 04: Footer & Copyright Notice
   ========================================================================== */
.app-footer {
  margin-top: 1.5rem;
  padding: 0.95rem 1.4rem;
  border-radius: var(--radius-lg);
  background: var(--te-card);
  border: 1.5px solid var(--te-border);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.03);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
}

.footer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--te-orange);
  box-shadow: 0 0 6px rgba(255, 68, 0, 0.4);
}

.footer-brand {
  font-weight: 800;
  color: var(--te-ink);
  letter-spacing: -0.01em;
}

.footer-sub {
  color: var(--te-ink-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.footer-right {
  font-size: 0.75rem;
  color: var(--te-ink-muted);
  letter-spacing: 0.01em;
}

.footer-copyright {
  text-transform: lowercase;
}

@media (max-width: 640px) {
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }
}


