/* ==========================================================================
   BREAD NERD — Modern Dark Mode Bread Baking App Stylesheet
   ========================================================================== */

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* High-Contrast Dark Theme Palette (Kitchen Optimized) */
  --bg-app: #080b12;
  --bg-surface: #0f172a;
  --bg-surface-elevated: #1e293b;
  --bg-card: #0f172a;
  --bg-card-hover: #1e293b;
  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-medium: rgba(255, 255, 255, 0.2);
  --border-focus: #f59e0b;

  /* Typography Colors — Raised contrast to > 4.5:1 (WCAG AA) */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Semantic Brand & Accent Colors */
  --crust-gold: #f59e0b;
  --crust-gold-glow: rgba(245, 158, 11, 0.25);
  --crust-amber: #d97706;
  --crust-light: #fef3c7;
  --water-cyan: #38bdf8;
  --water-glow: rgba(56, 189, 248, 0.2);
  --success-green: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger-red: #ef4444;

  /* Shadows (Removed backdrop blur to preserve mobile battery during screen wake) */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 30px -4px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px -4px rgba(245, 158, 11, 0.2);
  --glass-blur: none;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --header-height: 105px;
}

/* ==========================================================================
   OPTIONAL LIGHT THEME (Activated via manual toggle button)
   Defaults to user-preferred Dark Mode
   ========================================================================== */
[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #b45309;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-dim: #475569;

  --crust-gold: #b45309;
  --crust-gold-glow: rgba(180, 83, 9, 0.15);
  --crust-amber: #92400e;
  --crust-light: #78350f;
  --water-cyan: #0284c7;
  --water-glow: rgba(2, 132, 199, 0.15);
  --success-green: #059669;
  --success-glow: rgba(5, 150, 105, 0.15);
  --danger-red: #dc2626;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px -4px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px -4px rgba(180, 83, 9, 0.12);
}

[data-theme="light"] body {
  background-image: 
    radial-gradient(ellipse at 20% 0%, rgba(217, 119, 6, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(2, 132, 199, 0.04) 0%, transparent 50%);
}

[data-theme="light"] .app-header {
  background: #ffffff;
  border-bottom-color: var(--border-subtle);
}

[data-theme="light"] .brand-title {
  background: linear-gradient(to right, #78350f, #b45309);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-icon {
  background: #fef3c7;
  border-color: #fcd34d;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.12);
}

[data-theme="light"] .badge-tag {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

[data-theme="light"] .header-timer-btn {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #0369a1;
}

[data-theme="light"] .header-timer-btn:hover {
  background: #bae6fd;
  border-color: #0284c7;
  color: #0c4a6e;
}

[data-theme="light"] .header-timer-btn.running {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

[data-theme="light"] .header-timer-btn.ringing {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

[data-theme="light"] .action-btn {
  background: #ffffff;
  border-color: var(--border-medium);
  color: #334155;
}

[data-theme="light"] .action-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

[data-theme="light"] .action-btn.active {
  background: #fef3c7;
  border-color: #b45309;
  color: #78350f;
}

[data-theme="light"] .source-banner {
  background: #fefce8;
  border-bottom-color: #fef08a;
}

[data-theme="light"] .source-badge {
  background: #fef3c7;
  color: #78350f;
  border: 1px solid #fcd34d;
}

[data-theme="light"] .source-title em {
  color: #92400e;
}

[data-theme="light"] .source-link {
  color: #b45309;
}

[data-theme="light"] .source-link:hover {
  color: #78350f;
}

[data-theme="light"] .card {
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  border-color: var(--border-subtle);
}

[data-theme="light"] .card:hover {
  border-color: var(--border-medium);
}

/* Card 1: Batch Scaling Controls */
[data-theme="light"] .stat-badge {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

[data-theme="light"] .stat-label {
  color: #64748b;
}

[data-theme="light"] .stat-value {
  color: #0f172a;
  font-weight: 700;
}

[data-theme="light"] .loaf-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="light"] .loaf-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

[data-theme="light"] .loaf-btn.active {
  background: #fef3c7;
  border-color: #b45309;
  color: #78350f;
}

[data-theme="light"] .input-unit-group {
  background: #ffffff;
  border-color: #cbd5e1;
}

[data-theme="light"] .input-unit-group input {
  color: #0f172a;
}

[data-theme="light"] .input-unit-group span {
  color: #64748b;
}

[data-theme="light"] .btn-subtle-reset {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

[data-theme="light"] .btn-subtle-reset:hover {
  background: #fde68a;
  border-color: #b45309;
  color: #78350f;
}

/* Card 2: Specialty Grain & Chips */
[data-theme="light"] .grain-pct-display {
  color: #b45309;
}

[data-theme="light"] .grain-pct-display .pct {
  color: #d97706;
}

[data-theme="light"] .section-intro strong {
  color: #92400e;
}

[data-theme="light"] .grain-chip {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="light"] .grain-chip:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

[data-theme="light"] .grain-chip-hint {
  color: #64748b;
}

[data-theme="light"] .grain-chip.active {
  background: #fef3c7;
  border-color: #b45309;
  box-shadow: 0 0 10px rgba(180, 83, 9, 0.2);
}

[data-theme="light"] .grain-chip.active .grain-chip-name {
  color: #78350f;
}

[data-theme="light"] .grain-chip.active .grain-chip-hint {
  color: #92400e;
  font-weight: 600;
}

[data-theme="light"] .grain-advisory-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .advisory-grain-badge {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

[data-theme="light"] .advisory-timing-speed {
  color: #0369a1;
}

[data-theme="light"] .advisory-cell {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .advisory-cell h4 {
  color: #0f172a;
}

[data-theme="light"] .advisory-cell p {
  color: #334155;
}

[data-theme="light"] .advisory-cell p strong {
  color: #92400e;
}

[data-theme="light"] .apply-hydration-btn {
  background: #0284c7;
  border-color: #0369a1;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

[data-theme="light"] .apply-hydration-btn:hover {
  background: #0369a1;
  color: #ffffff;
}

[data-theme="light"] .advisory-action-note.auto-adjust-active {
  color: #0369a1;
  font-weight: 600;
}

[data-theme="light"] .advisory-action-note.auto-adjust-active strong {
  color: #0369a1;
}

[data-theme="light"] .step-grain-note {
  color: #92400e;
}

[data-theme="light"] .proof-hack-callout {
  background: #f0f9ff;
  border-left: 3px solid #0284c7;
  color: #0f172a;
}

[data-theme="light"] .proof-hack-callout strong {
  color: #0369a1;
}

[data-theme="light"] .grain-advisory-accordion {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .grain-advisory-summary {
  background: #f8fafc;
  color: #1e293b;
}

[data-theme="light"] .grain-advisory-summary:hover {
  background: #f1f5f9;
}

[data-theme="light"] .advisory-details-body {
  background: #ffffff;
  border-top-color: #e2e8f0;
}

/* Card 2: Auto-Hydration Toggle Row */
[data-theme="light"] .auto-hydration-toggle-row {
  background: #f8fafc;
  border-color: #cbd5e1;
}

[data-theme="light"] .auto-hydration-toggle-row:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

[data-theme="light"] .toggle-text strong {
  color: #0f172a;
}

[data-theme="light"] .toggle-hint {
  color: #0284c7;
  font-weight: 600;
}

[data-theme="light"] .toggle-slider-round {
  background-color: #cbd5e1;
}

[data-theme="light"] .toggle-switch-label input:checked + .toggle-slider-round {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.3);
}

/* Card 3: Hydration Percentage */
[data-theme="light"] .hydration-comp-badge {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
}

[data-theme="light"] .hydration-value-display {
  color: #b45309;
}

[data-theme="light"] .hydration-value-display .pct {
  color: #d97706;
}

[data-theme="light"] .preset-btn {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="light"] .preset-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .preset-btn.active {
  background: #fef3c7;
  border-color: #b45309;
  color: #78350f;
}

[data-theme="light"] .hydration-profile-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .profile-badge {
  background: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}

[data-theme="light"] .difficulty-rating {
  color: #334155;
}

[data-theme="light"] .profile-description {
  color: #334155;
}

[data-theme="light"] .profile-tips {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-left: 3px solid #b45309;
  color: #451a03;
}

[data-theme="light"] .profile-tips strong {
  color: #78350f;
}

/* Card 4: Baker's Formula Table */
[data-theme="light"] .formula-table th {
  background: #f8fafc;
  color: #475569;
  border-bottom-color: #cbd5e1;
}

[data-theme="light"] .formula-table td {
  border-bottom-color: #f1f5f9;
}

[data-theme="light"] .formula-table tr:hover td {
  background: #f8fafc;
}

[data-theme="light"] .pct-pill {
  color: #0f172a;
  background: #e2e8f0;
}

[data-theme="light"] .weight-cell {
  color: #0f172a;
}

[data-theme="light"] .water-weight {
  color: #0369a1;
}

[data-theme="light"] .toggle-hint {
  color: #0369a1;
}

.formula-table tfoot td {
  padding: 0.75rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.4);
  border-top: 1px solid var(--border-medium);
}

[data-theme="light"] .formula-table tfoot td {
  background: #f1f5f9;
  color: #334155;
  border-top: 1px solid #cbd5e1;
}

[data-theme="light"] .fine-tuning-accordion {
  border-color: #e2e8f0;
}

[data-theme="light"] .accordion-header {
  background: #f8fafc;
  color: #0f172a;
}

[data-theme="light"] .accordion-header:hover {
  background: #f1f5f9;
}

[data-theme="light"] .accordion-body {
  background: #ffffff;
  border-top-color: #e2e8f0;
}

[data-theme="light"] .custom-select {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

[data-theme="light"] .mini-input {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

[data-theme="light"] .sourdough-controls {
  background: #fffbeb;
  border-color: #fcd34d;
}

[data-theme="light"] .sub-label {
  color: #334155;
}

[data-theme="light"] .sub-label strong {
  color: #78350f;
}

[data-theme="light"] .default-badge {
  color: #475569;
  background: #e2e8f0;
  border-color: #cbd5e1;
}

/* Kitchen Timer Card */
[data-theme="light"] .timer-hub-card {
  border-color: #bae6fd;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .timer-countdown {
  color: #0f172a;
  text-shadow: none;
}

[data-theme="light"] .timer-label {
  color: #334155;
  font-weight: 600;
}

[data-theme="light"] #headerTimerText {
  color: inherit;
}

[data-theme="light"] .header-timer-btn.paused {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

[data-theme="light"] .timer-status-badge.idle {
  background: #e2e8f0;
  color: #475569;
}

[data-theme="light"] .timer-status-badge.running {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
}

[data-theme="light"] .timer-status-badge.paused {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

[data-theme="light"] .timer-status-badge.ringing {
  background: #fee2e2;
  color: #991b1b;
  border-color: #ef4444;
}

[data-theme="light"] .timer-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="light"] .timer-btn:hover:not(:disabled) {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .timer-btn.primary {
  background: linear-gradient(135deg, #d97706, #b45309);
  border-color: transparent;
  color: #ffffff;
}

[data-theme="light"] .timer-btn-pause {
  background: #fef3c7 !important;
  border: 1px solid #f59e0b !important;
  color: #78350f !important;
}

[data-theme="light"] .timer-btn-clear {
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
  background: #fef2f2;
}

[data-theme="light"] .timer-btn-clear:hover:not(:disabled) {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
}

[data-theme="light"] .timer-btn:disabled {
  opacity: 0.55;
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #64748b;
}

[data-theme="light"] .timer-btn.primary:disabled {
  background: #e2e8f0;
  color: #64748b;
  border: 1px solid #cbd5e1;
  box-shadow: none;
}

[data-theme="light"] .chip-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="light"] .chip-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .chip-btn.chip-sub {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}

[data-theme="light"] .chip-btn.chip-add {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

/* Card 5: Method, Timeline Steps & Step Cards */
[data-theme="light"] .vessel-selector-bar {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

[data-theme="light"] .vessel-bar-label {
  color: #334155;
}

[data-theme="light"] .vessel-btn {
  color: #475569;
}

[data-theme="light"] .vessel-btn:hover {
  color: #0f172a;
  background: #e2e8f0;
}

[data-theme="light"] .vessel-btn.active {
  background: #ffffff;
  border-color: #b45309;
  color: #78350f;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .steps-progress {
  background: #fef3c7;
  color: #92400e;
}

[data-theme="light"] .marker-circle {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #475569;
}

[data-theme="light"] .timeline-step.active .marker-circle {
  border-color: #b45309;
  color: #b45309;
}

[data-theme="light"] .step-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .step-card:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

[data-theme="light"] .timeline-step.completed .step-card {
  background: #f0fdf4;
  border-color: #bbf7d0;
  opacity: 1;
}

[data-theme="light"] .step-phase {
  color: #b45309;
}

[data-theme="light"] .step-title {
  color: #0f172a;
}

[data-theme="light"] .step-desc {
  color: #334155;
}

[data-theme="light"] .step-desc strong {
  color: #0f172a;
}

[data-theme="light"] .step-check-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #64748b;
}

[data-theme="light"] .step-check-btn:hover {
  background: #d1fae5;
  color: #047857;
  border-color: #10b981;
}

[data-theme="light"] .meta-tag {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}

[data-theme="light"] .load-timer-btn {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #0369a1;
  font-weight: 700;
}

[data-theme="light"] .load-timer-btn:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

/* Science & FAQ Card */
[data-theme="light"] .science-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #0284c7;
}

[data-theme="light"] .science-item h4 {
  color: #0369a1;
}

[data-theme="light"] .science-item p {
  color: #334155;
}

[data-theme="light"] .science-item code {
  background: #e2e8f0;
  color: #78350f;
  font-weight: 600;
}

/* Toast Notification */
[data-theme="light"] .toast {
  background: #0f172a;
  color: #ffffff;
  border-color: #334155;
}

[data-theme="light"] .app-footer {
  background: #ffffff;
  border-top-color: var(--border-subtle);
}

/* Base Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Accessibility Utilities */
.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;
}

/* Accessible High-Contrast Focus Visible Rings */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--crust-gold) !important;
  outline-offset: 2px !important;
}

[data-theme="light"] button:focus-visible,
[data-theme="light"] input:focus-visible,
[data-theme="light"] select:focus-visible,
[data-theme="light"] a:focus-visible,
[data-theme="light"] [tabindex]:focus-visible {
  outline: 2px solid #b45309 !important;
  outline-offset: 2px !important;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(ellipse at 20% 0%, rgba(245, 158, 11, 0.07) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(56, 189, 248, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 50% 100%, rgba(217, 119, 6, 0.05) 0%, transparent 60%);
  background-attachment: fixed;
}

/* App Wrapper */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.app-header {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(8, 11, 18, 0.85);
  backdrop-filter: var(--glass-blur);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

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

.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(245, 158, 11, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  cursor: default;
}

.brand-icon svg {
  width: 36px;
  height: 36px;
  display: block;
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #fde68a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(245, 158, 11, 0.15);
  color: var(--crust-gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.header-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 32px;
  box-sizing: border-box;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  padding: 0 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  vertical-align: middle;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.btn-svg {
  display: block;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
}

.action-btn .btn-text {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  white-space: nowrap;
}

.action-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-medium);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.action-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--crust-gold);
  color: var(--crust-gold);
}

/* Pair corresponding pills in row 1 and row 2 with matched widths for clean vertical column alignment */
#headerTimerBtn,
#viewModeBtn {
  width: 124px;
  min-width: 124px;
}

#wakeLockBtn,
#copyRecipeBtn {
  width: 160px;
  min-width: 160px;
}

#tempUnitBtn {
  width: 74px;
  min-width: 74px;
}

#themeToggleBtn {
  width: 74px;
  min-width: 74px;
}

/* In Row 2, Print Recipe spans the combined width of Col 3 + gap + Col 4 (74 + 8 + 74 = 156px) */
#printBtn {
  width: 156px;
  min-width: 156px;
}

.header-timer-btn {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.25);
  color: #7dd3fc;
  cursor: pointer;
  position: relative;
  border-radius: 999px;
}

#headerTimerText {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1;
}

.header-timer-btn:hover {
  background: rgba(56, 189, 248, 0.16);
  border-color: #38bdf8;
  color: #fff;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.25);
}

.header-timer-btn.running {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #fef08a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.header-timer-btn.paused {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.header-timer-btn.ringing {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
  animation: pulse-ring 0.6s infinite alternate;
}

.timer-hub-pulse {
  animation: hub-pulse-anim 1.2s ease;
}

@keyframes hub-pulse-anim {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.8); border-color: #38bdf8; }
  50% { box-shadow: 0 0 24px 6px rgba(56, 189, 248, 0.4); border-color: #38bdf8; }
  100% { box-shadow: none; }
}

/* ==========================================================================
   SOURCE BANNER
   ========================================================================== */

.source-banner {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.08), rgba(15, 21, 36, 0.5));
  border-bottom: 1px solid var(--border-subtle);
}

.source-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.source-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.source-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.source-title {
  color: var(--text-primary);
}

.source-title em {
  color: #fde68a;
  font-style: normal;
  font-weight: 600;
}

.source-link {
  color: var(--crust-gold);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}

.source-link:hover {
  color: #fde68a;
  text-decoration: underline;
}

/* ==========================================================================
   MAIN LAYOUT & GRID
   ========================================================================== */

.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
  flex: 1;
  width: 100%;
  min-width: 0;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.75rem;
  align-items: start;
  min-width: 0;
}

.formula-section,
.process-section {
  min-width: 0;
}

@media (max-width: 1040px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   CARD SYSTEM & SURFACES
   ========================================================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-width: 0;
}

.card:hover {
  border-color: var(--border-medium);
}

.highlight-card {
  position: relative;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  min-width: 0;
  flex-wrap: wrap;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-icon {
  font-size: 1.3rem;
}

.card-header h2 {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.text-btn {
  background: none;
  border: none;
  color: var(--crust-gold);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.text-btn:hover {
  text-decoration: underline;
  color: #fde68a;
}

/* ==========================================================================
   BATCH SCALING
   ========================================================================== */

.batch-selector-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 640px) {
  .batch-selector-grid {
    grid-template-columns: 1fr;
  }
}

.selector-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.loaf-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

@media (max-width: 480px) {
  .loaf-buttons {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
}

.loaf-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
}

.loaf-btn small {
  display: block;
  font-size: 0.62rem;
  font-weight: 400;
  opacity: 0.8;
}

.loaf-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.loaf-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--crust-gold);
  color: var(--crust-gold);
  font-weight: 700;
}

.input-unit-group {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.input-unit-group:focus-within {
  border-color: var(--crust-gold);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.input-unit-group input {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0.55rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  outline: none;
}

.input-unit-group .unit-label {
  padding: 0 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-left: 1px solid var(--border-subtle);
  user-select: none;
}

.input-helper {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* ==========================================================================
   SPECIALTY GRAIN & HERITAGE FLOUR CARD
   ========================================================================== */

.specialty-grain-card {
  border-color: rgba(217, 119, 6, 0.25);
  position: relative;
}

.card-subtitle-tag {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.35rem;
}

.grain-pct-display {
  display: flex;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: #fbbf24;
  line-height: 1;
}

.grain-pct-display .pct {
  font-size: 1.25rem;
  font-weight: 600;
  margin-left: 0.15rem;
  color: #fde68a;
}

.section-intro {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.15rem;
}

.section-intro strong {
  color: #fde68a;
}

/* Grain Type Chips Grid (Compact Single-Line) */
.grain-type-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.15rem;
}

@media (max-width: 860px) {
  .grain-type-grid {
    grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
    gap: 0.45rem;
  }
}

@media (max-width: 480px) {
  .grain-type-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
  }
}

.grain-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.5rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
  color: var(--text-secondary);
  text-align: left;
}

.grain-chip:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-medium);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.grain-chip.active {
  background: rgba(217, 119, 6, 0.18);
  border-color: var(--crust-gold);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.grain-chip-icon {
  font-size: 1.35rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.grain-chip-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.grain-chip-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  white-space: nowrap;
}

.grain-chip-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.15;
  white-space: normal;
  word-break: break-word;
}

.grain-chip.active .grain-chip-name {
  color: var(--crust-gold);
}

.grain-chip.active .grain-chip-hint {
  color: #fde68a;
}


/* Amber Range Slider for Grain */
.range-slider-amber {
  background: linear-gradient(to right, #475569 0%, #d97706 40%, #b45309 100%) !important;
}

/* Visual Flour Ratio Bar */
.flour-ratio-bar-wrap {
  margin: 1.25rem 0 1rem;
}

.flour-ratio-bar {
  width: 100%;
  height: 32px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  border: 1px solid var(--border-subtle);
}

.ratio-segment {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.5rem;
  transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.bread-flour-seg {
  background: linear-gradient(90deg, #334155, #475569);
  color: #f8fafc;
}

.specialty-seg {
  background: linear-gradient(90deg, #b45309, #d97706);
  color: #fff;
}

/* Auto-Hydration Toggle Row */
.auto-hydration-toggle-row {
  margin: 1.15rem 0 1rem;
  background: rgba(15, 21, 36, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
}

.auto-hydration-toggle-row:hover {
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(20, 28, 48, 0.75);
}

.toggle-switch-label {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.toggle-switch-label input[type="checkbox"] {
  display: none;
}

.toggle-slider-round {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: #334155;
  border-radius: 999px;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.toggle-slider-round::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch-label input:checked + .toggle-slider-round {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.toggle-switch-label input:checked + .toggle-slider-round::before {
  transform: translateX(20px);
}

.toggle-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.84rem;
  color: var(--text-primary);
}

.toggle-hint {
  font-size: 0.8rem;
  color: var(--water-cyan);
  font-family: var(--font-sans);
}

/* Baker's Advisory Card & Details (Card 5) */
.advisory-card {
  padding: 1.15rem 1.4rem;
}

.advisory-details {
  border: none;
  background: transparent;
}

.advisory-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  list-style: none;
  user-select: none;
  gap: 0.75rem;
}

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

.advisory-summary-content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.advisory-summary-content h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.advisory-summary-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.advisory-details[open] .accordion-arrow {
  transform: rotate(180deg);
}

.advisory-body {
  margin-top: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* Grain Advisory & Effects Box */
.grain-advisory-box {
  background: rgba(15, 21, 36, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  transition: all 0.2s ease;
}

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

.advisory-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.advisory-grain-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.advisory-timing-speed {
  font-size: 0.74rem;
  font-weight: 700;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.advisory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

@media (max-width: 640px) {
  .advisory-grid {
    grid-template-columns: 1fr;
  }
}

.advisory-cell {
  background: rgba(8, 11, 18, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
}

.advisory-cell h4 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
}

.advisory-cell p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.advisory-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.advisory-action-note {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.advisory-action-note.auto-adjust-active {
  color: #7dd3fc;
  font-weight: 600;
}

.advisory-action-note.auto-adjust-active strong {
  color: #38bdf8;
}

.step-grain-note {
  margin-top: 0.4rem;
  color: #fde68a;
  font-size: 0.8rem;
}

.proof-hack-callout {
  margin-top: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: rgba(56, 189, 248, 0.08);
  border-left: 3px solid #38bdf8;
  border-radius: 0 4px 4px 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.proof-hack-callout strong {
  color: #bae6fd;
}

.apply-hydration-btn {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(14, 165, 233, 0.25));
  border: 1px solid #38bdf8;
  color: #e0f2fe;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.18s ease;
}

.apply-hydration-btn:hover {
  background: #0284c7;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

/* ==========================================================================
   HYDRATION MASTER CONTROLLER
   ========================================================================== */

.hydration-header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hydration-comp-badge {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.hydration-comp-badge.hidden {
  display: none;
}

.hydration-value-display {
  display: flex;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--crust-gold);
  line-height: 1;
}

.hydration-value-display .pct {
  font-size: 1.25rem;
  font-weight: 600;
  margin-left: 0.15rem;
  color: #fbbf24;
}

.slider-wrapper {
  margin: 1.25rem 0 1rem;
  position: relative;
}

.slider-track-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.range-slider {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(to right, #0284c7 0%, #38bdf8 100%);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  border: 3.5px solid #0284c7;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  cursor: grab;
  transition: transform 0.12s ease;
}

.range-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.18);
}

.range-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  border: 3.5px solid #0284c7;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  cursor: grab;
}

/* Presets */
.preset-buttons-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.preset-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.preset-btn-group {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.preset-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.preset-btn.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--crust-gold);
  color: #fde68a;
  font-weight: 700;
}

/* Dough Character Box */
.hydration-profile-box {
  background: rgba(15, 21, 36, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  transition: all 0.2s ease;
}

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

.profile-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.difficulty-rating {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-sans);
}

.profile-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 0.65rem;
}

.profile-tips {
  font-size: 0.8rem;
  color: #cbd5e1;
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--crust-gold);
  padding: 0.5rem 0.75rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.profile-tips .insight-cue {
  line-height: 1.45;
}

/* ==========================================================================
   FORMULA & INGREDIENTS TABLE
   ========================================================================== */

.formula-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stat-badge {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  margin-bottom: 1.25rem;
}

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

.formula-table th {
  padding: 0.75rem 0.95rem;
  background: rgba(15, 21, 36, 0.9);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
}

.formula-table td {
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.formula-table tr:last-child td {
  border-bottom: none;
}

.formula-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.th-ingredient { width: 38%; }
.th-pct { width: 16%; }
.th-weight { width: 24%; }
.th-ref { width: 22%; }

.ingredient-title-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ing-icon {
  font-size: 1.15rem;
}

.ingredient-name {
  font-weight: 600;
  color: var(--text-primary);
}

.ingredient-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
}

.pct-pill {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.weight-cell {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.water-weight {
  color: #7dd3fc;
}

.volume-ref {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Accordion */
.fine-tuning-accordion {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1rem;
}

.accordion-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.accordion-header:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.accordion-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.accordion-arrow.rotated {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 1.25rem;
  background: rgba(15, 21, 36, 0.4);
  border-top: 1px solid var(--border-subtle);
}

.accordion-body.hidden {
  display: none;
}

.tuning-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 640px) {
  .tuning-grid {
    grid-template-columns: 1fr;
  }
}

.tuning-item label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.range-slider-sm {
  width: 100%;
  height: 6px;
  accent-color: var(--crust-gold);
  cursor: pointer;
}

.tuning-desc {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.custom-select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: #fff;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.custom-select:focus {
  border-color: var(--crust-gold);
}

.salt-type-wrap {
  margin-bottom: 0.25rem;
}

.sourdough-controls {
  margin-top: 0.6rem;
  padding: 0.65rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-sm);
}

.sourdough-controls.hidden {
  display: none;
}

.sub-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.sub-label strong {
  color: var(--crust-gold);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.sugar-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-inline {
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.flour-blend-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.flour-ratio-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.mini-input {
  width: 55px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: right;
}

.default-badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 500;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.08rem 0.38rem;
  border-radius: 3px;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.tuning-footer {
  margin-top: 1.25rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tuning-footer-hint {
  font-size: 0.73rem;
  color: var(--text-muted);
}

.btn-subtle-reset {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fde68a;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-subtle-reset:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--crust-gold);
  color: #fff;
  transform: translateY(-1px);
}

/* Pan Prep Note */
.pan-prep-note {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.82rem;
  color: #fde68a;
  background: rgba(217, 119, 6, 0.1);
  border: 1px dashed rgba(245, 158, 11, 0.3);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
}

.note-icon {
  font-size: 1.15rem;
}

/* ==========================================================================
   KITCHEN TIMER HUB
   ========================================================================== */

.timer-hub-card {
  border-color: rgba(56, 189, 248, 0.25);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  position: sticky;
  top: calc(var(--header-height, 105px) - 1px);
  scroll-margin-top: var(--header-height, 105px);
  z-index: 50;
  padding: 0.85rem 1.15rem;
}

.timer-hub-header {
  margin-bottom: 0.35rem;
  padding-bottom: 0.35rem;
}

.timer-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-family: var(--font-mono);
}

.timer-status-badge.idle {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.timer-status-badge.running {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  animation: pulse-badge 1.8s infinite;
}

.timer-status-badge.paused {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.timer-status-badge.ringing {
  background: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border: 1px solid #ef4444;
  animation: pulse-ring 0.6s infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.active-timer-display.compact {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.timer-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  flex-wrap: wrap;
}

.timer-countdown {
  font-family: var(--font-mono);
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1;
  margin: 0;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.35);
}

.timer-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0.25rem 0 0.45rem;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer-controls {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.timer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 32px;
  line-height: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  vertical-align: middle;
  box-sizing: border-box;
}

.timer-btn-svg {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

.timer-btn span {
  display: inline-block;
  line-height: 1;
}

.timer-btn:hover:not(:disabled) {
  background: var(--bg-surface-elevated);
  transform: translateY(-1px);
}

.timer-btn.primary {
  background: linear-gradient(135deg, #d97706, #b45309);
  border: 1px solid transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.3);
}

.timer-btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.timer-btn-pause {
  background: rgba(245, 158, 11, 0.2) !important;
  border: 1px solid #f59e0b !important;
  color: #fde68a !important;
}

.timer-btn-clear {
  color: #f87171 !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

.timer-btn-clear:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: #ef4444 !important;
}

.timer-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.quick-timer-chips {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  align-items: center;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.48rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.chip-btn.chip-sub {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.chip-btn.chip-sub:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fff;
}

.chip-btn.chip-add {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
  color: #fde68a;
}

.chip-btn.chip-add:hover {
  background: rgba(245, 158, 11, 0.2);
  color: #fff;
}

/* ==========================================================================
   TIMELINE & STEP-BY-STEP
   ========================================================================== */

.method-card-header {
  flex-wrap: wrap;
  gap: 0.75rem;
}

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

.vessel-selector-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-surface-elevated);
  padding: 0.24rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border-medium);
}

.vessel-bar-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding-left: 0.45rem;
}

.vessel-btn-group {
  display: flex;
  gap: 0.25rem;
}

.vessel-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.vessel-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.vessel-btn.active {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fff;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.steps-progress {
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--crust-gold);
  background: rgba(245, 158, 11, 0.1);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.timeline-step {
  display: flex;
  gap: 1.15rem;
  position: relative;
}

.step-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 32px;
  flex-shrink: 0;
}

.marker-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  transition: all 0.2s ease;
  z-index: 2;
}

.timeline-step.completed .marker-circle {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}

.timeline-step.active .marker-circle {
  border-color: var(--crust-gold);
  color: var(--crust-gold);
  box-shadow: 0 0 12px var(--crust-gold-glow);
}

.marker-line {
  width: 2px;
  flex: 1;
  background: var(--border-subtle);
  margin: 4px 0;
}

.timeline-step:last-child .marker-line {
  display: none;
}

.step-card {
  flex: 1;
  background: rgba(15, 21, 36, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  margin-bottom: 0.85rem;
  transition: all 0.2s ease;
}

.step-card:hover {
  background: rgba(20, 28, 48, 0.7);
  border-color: var(--border-medium);
}

.timeline-step.completed .step-card {
  border-color: rgba(16, 185, 129, 0.3);
  opacity: 0.8;
}

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

.step-phase {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--crust-gold);
}

.step-check-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  transition: all 0.15s ease;
}

.step-check-btn:hover {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: #10b981;
}

.timeline-step.completed .step-check-btn {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}

.step-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.45rem;
}

.step-desc {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.85rem;
}

.step-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.meta-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.step-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.load-timer-btn {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #7dd3fc;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.load-timer-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #fff;
  border-color: #38bdf8;
  transform: translateY(-1px);
}

/* ==========================================================================
   SCIENCE & FAQ SECTION
   ========================================================================== */

.science-notes {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.science-item {
  background: rgba(15, 21, 36, 0.5);
  border-left: 3px solid #38bdf8;
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.science-item h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: #bae6fd;
  margin-bottom: 0.35rem;
}

.science-item p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.science-item code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: #fde68a;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.app-footer {
  border-top: 1px solid var(--border-subtle);
  background: rgba(8, 11, 18, 0.95);
  margin-top: auto;
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem 1.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-content {
  text-align: left;
  flex: 1 1 520px;
}

.footer-container a {
  color: var(--crust-gold);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

.footer-container a:hover {
  color: #fde68a;
  text-decoration: underline;
}

[data-theme="light"] .footer-container a {
  color: #b45309;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

[data-theme="light"] .footer-container a:hover {
  color: #78350f;
}

.footer-sub {
  font-size: 0.74rem;
  margin-top: 0.35rem;
  color: var(--text-dim);
}

[data-theme="light"] .footer-sub {
  color: #475569;
}

.footer-links {
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  margin-left: auto;
  gap: 0.75rem;
}

.footer-github-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted) !important;
  text-decoration: none !important;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background: rgba(255, 255, 255, 0.04);
  transition: all 0.2s ease;
}

.footer-github-link:hover {
  color: var(--text-primary) !important;
  border-color: var(--crust-gold);
  background: rgba(217, 119, 6, 0.12);
  text-decoration: none !important;
  transform: translateY(-1px);
}

.footer-github-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

[data-theme="light"] .footer-github-link {
  color: #475569 !important;
  background: #f8fafc;
  border-color: #cbd5e1;
}

[data-theme="light"] .footer-github-link:hover {
  color: #0f172a !important;
  background: #fef3c7;
  border-color: #f59e0b;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */

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

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  pointer-events: auto;
  animation: slide-toast 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.toast-success {
  border-color: #10b981;
  background: #064e3b;
}

.toast.toast-warning {
  border-color: #f59e0b;
  background: #78350f;
}

.toast.fade-out {
  opacity: 0;
  transform: translateY(8px);
}

@keyframes slide-toast {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   RECIPE MODE / KITCHEN FOCUS VIEW
   ========================================================================== */

body.recipe-mode .card-calculator-controls,
body.recipe-mode .source-banner,
body.recipe-mode .science-notes-card {
  display: none !important;
}

body.recipe-mode .view-mode-btn {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--crust-gold);
  color: #fde68a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

body.recipe-mode .content-grid {
  grid-template-columns: minmax(360px, 490px) 1fr;
}

@media (max-width: 960px) {
  body.recipe-mode .content-grid {
    grid-template-columns: 1fr;
  }
}

/* Grain Advisory Collapsible Details */
.grain-advisory-accordion {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
  transition: all 0.2s ease;
}

.grain-advisory-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  cursor: pointer;
  background: var(--bg-surface);
  user-select: none;
  list-style: none;
}

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

.grain-advisory-summary:hover {
  background: var(--bg-surface-elevated);
}

.advisory-summary-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.advisory-summary-rise {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.advisory-toggle-indicator {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.grain-advisory-accordion[open] .advisory-toggle-indicator {
  transform: rotate(180deg);
}

.advisory-details-body {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   RESPONSIVE LAYOUT & MOBILE OPTIMIZATIONS
   ========================================================================== */

@media (max-width: 860px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.85rem 1.25rem;
  }
  .header-actions {
    align-items: flex-start;
    width: 100%;
  }
  .header-actions-row {
    justify-content: flex-start;
    flex-wrap: wrap;
    width: 100%;
    gap: 0.45rem;
  }
  #headerTimerBtn,
  #viewModeBtn,
  #wakeLockBtn,
  #copyRecipeBtn,
  #tempUnitBtn,
  #themeToggleBtn,
  #printBtn {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
  }
}

/* On phones: Release sticky header to reclaim 30%+ of the viewport */
@media (max-width: 768px) {
  .app-header {
    position: static;
    backdrop-filter: none;
  }

  .timer-hub-card {
    position: static;
  }
}

/* Tablet & Mobile Grid Single Column */
@media (max-width: 640px) {
  .main-container {
    padding: 1.25rem 1rem 2.5rem;
  }

  .card {
    padding: 1.15rem;
    margin-bottom: 1.15rem;
  }

  /* Slider track labels: shorten on phones to prevent collisions */
  .slider-track-labels .label-desc {
    display: none !important;
  }

  /* Ingredients Table: Hide description & volume column to prevent narrow text towers */
  .formula-table .th-ref,
  .formula-table .volume-ref,
  .formula-table .ingredient-desc {
    display: none !important;
  }

  .formula-table .th-ingredient {
    width: 48%;
  }

  .formula-table .th-pct {
    width: 22%;
    text-align: center;
  }

  .formula-table .th-weight {
    width: 30%;
    text-align: right;
  }

  .formula-table th,
  .formula-table td {
    padding: 0.65rem 0.5rem;
  }

  .ingredient-name {
    font-size: 0.88rem;
  }

  .weight-cell,
  .water-weight {
    font-size: 0.95rem;
  }

  .method-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .method-header-controls {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .footer-container {
    padding: 1.25rem 1rem;
    gap: 0.75rem;
  }
}

/* Small phones (<= 480px, e.g. iPhone 390px) */
@media (max-width: 480px) {
  .main-container {
    padding: 1rem 0.75rem 2.5rem;
  }

  .footer-container {
    padding: 1.15rem 0.75rem;
  }

  .card {
    padding: 0.95rem;
  }

  .card-header h2 {
    font-size: 1.05rem;
  }

  .brand-title {
    font-size: 1.25rem;
  }

  .brand-subtitle {
    font-size: 0.75rem;
  }

  .header-actions-row {
    gap: 0.35rem;
  }

  .action-btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
  }

  .stat-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.45rem;
  }

  .preset-btn {
    font-size: 0.72rem;
    padding: 0.3rem 0.5rem;
  }
}

/* ==========================================================================
   PRINT-ONLY RECIPE CARD STYLES
   ========================================================================== */

.print-recipe-card {
  display: none;
}

@media print {
  @page {
    size: letter portrait;
    margin: 0.3in 0.35in;
  }

  html, body {
    background: #ffffff !important;
    color: #111827 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide the web interactive UI entirely */
  .app-layout,
  #toastContainer {
    display: none !important;
    visibility: hidden !important;
  }

  /* Show only the formatted clean recipe card */
  .print-recipe-card {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    color: #111827 !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }

  .print-recipe-card * {
    visibility: visible !important;
  }

  .print-header {
    border-bottom: 1.5pt solid #111827;
    padding-bottom: 0.25rem;
    margin-bottom: 0.45rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
  }

  .print-title {
    font-size: 15pt;
    font-weight: 800;
    margin: 0 0 0.1rem;
    color: #000;
  }

  .print-subtitle {
    font-size: 8pt;
    color: #4b5563;
    margin: 0;
  }

  .print-date {
    font-size: 7.5pt;
    color: #4b5563;
    font-weight: 600;
  }

  /* 2-Column Print Layout */
  .print-grid {
    display: grid !important;
    grid-template-columns: 4.2fr 5.8fr !important;
    gap: 0.65rem !important;
    align-items: start !important;
  }

  .print-col-left,
  .print-col-right {
    min-width: 0;
  }

  .print-meta-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.3rem !important;
    background: #f3f4f6 !important;
    padding: 0.35rem 0.5rem !important;
    border-radius: 4px;
    margin-bottom: 0.45rem !important;
    font-size: 8pt !important;
  }

  .print-meta-item strong {
    display: block;
    color: #111;
    font-size: 8.5pt;
    line-height: 1.2;
  }

  .print-meta-item span {
    color: #4b5563;
    font-size: 7pt;
    text-transform: uppercase;
    font-weight: 600;
  }

  .print-section-title {
    font-size: 8.5pt !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1pt solid #d1d5db !important;
    padding-bottom: 0.15rem !important;
    margin: 0.4rem 0 0.3rem !important;
    color: #111827 !important;
  }

  /* Print Formula Table */
  .print-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-bottom: 0.45rem !important;
    font-size: 8pt !important;
  }

  .print-table th {
    text-align: left;
    border-bottom: 1pt solid #111 !important;
    padding: 0.18rem 0.25rem !important;
    font-size: 7.5pt !important;
    text-transform: uppercase;
    color: #374151 !important;
  }

  .print-table td {
    border-bottom: 0.5pt solid #e5e7eb !important;
    padding: 0.18rem 0.25rem !important;
    line-height: 1.25 !important;
  }

  .print-table .th-weight,
  .print-table td.weight-col {
    font-family: monospace;
    font-weight: 700;
    text-align: right;
  }

  .print-table .th-pct,
  .print-table td.pct-col {
    font-family: monospace;
    text-align: center;
  }

  .print-notes p {
    font-size: 7.5pt !important;
    color: #374151 !important;
    margin: 0.2rem 0 !important;
    line-height: 1.35 !important;
  }

  /* Print Method Steps */
  .print-steps {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .print-step-item {
    margin-bottom: 0.38rem !important;
    page-break-inside: avoid !important;
    font-size: 7.8pt !important;
    display: flex !important;
    gap: 0.35rem !important;
    line-height: 1.35 !important;
  }

  .print-step-num {
    font-weight: 800;
    font-size: 8.5pt;
    color: #111827;
    min-width: 1.15rem;
    flex-shrink: 0;
  }

  .print-step-body strong {
    color: #000;
    font-size: 8pt;
  }

  .print-step-body p {
    margin: 0.05rem 0 0 !important;
    color: #374151 !important;
  }
}

/* ==========================================================================
   Mobile Floating Timer Widget (Visible only on phone/mobile when timer active)
   ========================================================================== */
.mobile-floating-timer {
  display: none;
}

@keyframes pill-ringing-glow {
  0%, 100% {
    border-color: #ef4444;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 10px rgba(239, 68, 68, 0.4);
  }
  50% {
    border-color: #f87171;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.8), 0 0 20px rgba(239, 68, 68, 0.85);
  }
}

@media (max-width: 768px) {
  body.has-floating-timer .app-footer {
    padding-bottom: 4.5rem;
  }

  .toast-container {
    bottom: 4.75rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(100vw - 2rem);
    max-width: 380px;
    align-items: center;
  }

  .mobile-floating-timer {
    display: flex;
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    align-items: center;
    gap: 0.65rem;
    background: #0f172a;
    border: 1.5px solid var(--crust-gold);
    color: #ffffff;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(245, 158, 11, 0.25);
    white-space: nowrap;
    max-width: calc(100vw - 1.5rem);
    box-sizing: border-box;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  }

  [data-theme="light"] .mobile-floating-timer {
    background: #ffffff;
    border-color: #0284c7;
    color: #0f172a;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 0 12px rgba(2, 132, 199, 0.2);
  }

  .mobile-floating-timer.hidden {
    display: none !important;
  }

  .mobile-floating-timer.ringing {
    border-color: #ef4444;
    background: #7f1d1d;
    color: #fff;
    animation: pill-ringing-glow 1s infinite alternate ease-in-out;
  }

  [data-theme="light"] .mobile-floating-timer.ringing {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
    animation: pill-ringing-glow 1s infinite alternate ease-in-out;
  }

  @media (prefers-reduced-motion: reduce) {
    .mobile-floating-timer.ringing {
      animation: none !important;
    }
  }

  .mobile-timer-clickable {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    min-width: 0;
  }

  .mobile-timer-icon {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
  }

  .mobile-timer-digits {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 800;
    color: #fde68a;
    letter-spacing: -0.02em;
    flex-shrink: 0;
  }

  [data-theme="light"] .mobile-timer-digits {
    color: #b45309;
  }

  .mobile-timer-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
  }

  @media (max-width: 400px) {
    .mobile-timer-sub {
      max-width: 80px;
    }
  }

  [data-theme="light"] .mobile-timer-sub {
    color: #64748b;
  }

  .mobile-timer-action-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: all 0.15s ease;
  }

  .mobile-timer-action-btn svg {
    display: block;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
  }

  [data-theme="light"] .mobile-timer-action-btn {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
  }

  .mobile-timer-action-btn:hover {
    transform: scale(1.08);
  }
}
