  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  /* ===== DARK MODE — Charcoal ===== */
  /* html[data-theme] specificity 0,1,1 beats :root 0,1,0 — always overrides light defaults */
  html[data-theme="dark"] {
    --bg:           #111111;
    --surface:      #1C1C1C;
    --surface2:     #282828;
    --border:       rgba(255,255,255,0.09);
    --border-strong:rgba(255,255,255,0.20);
    --primary:      #4CC87A;
    --primary-light:rgba(76,200,122,0.14);
    --accent:       #E8724E;
    --accent-light: rgba(232,114,78,0.16);
    --text:         #F0EDE8;
    --text-muted:   rgba(240,237,232,0.58);
    --text-dim:     rgba(240,237,232,0.30);
    --green:        #4CC87A;
    --green-light:  rgba(76,200,122,0.14);
    --amber:        #E4A840;
    --amber-light:  rgba(228,168,64,0.15);
    --red:          #E07070;
    --red-light:    rgba(224,112,112,0.15);
  }

  html[data-theme="dark"] body  { background: var(--bg); }
  html[data-theme="dark"] .screen { background: var(--bg); }

  /* Header & nav — slightly elevated from page bg */
  html[data-theme="dark"] .dash-header {
    background: #181818 !important;
    border-bottom-color: rgba(255,255,255,0.07) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  html[data-theme="dark"] .bottom-nav {
    background: #181818;
    border-top-color: rgba(255,255,255,0.07);
  }
  html[data-theme="dark"] .dash-nav {
    background: #181818;
    border-bottom-color: rgba(255,255,255,0.07);
  }

  /* Cards */
  html[data-theme="dark"] .card       { background: var(--surface); border: 1px solid var(--border); }
  html[data-theme="dark"] .stat-box   { background: var(--surface); border: 1px solid var(--border); }
  html[data-theme="dark"] .upgrade-banner { background: linear-gradient(135deg, #1C2E22, #1A2820); }

  /* Inputs */
  html[data-theme="dark"] input,
  html[data-theme="dark"] textarea,
  html[data-theme="dark"] select {
    background: var(--surface2) !important;
    border-color: var(--border-strong) !important;
    color: var(--text) !important;
  }
  html[data-theme="dark"] input::placeholder,
  html[data-theme="dark"] textarea::placeholder { color: var(--text-dim) !important; }

  /* Buttons */
  html[data-theme="dark"] .btn-outline {
    border-color: var(--border-strong);
    color: var(--text);
    background: transparent;
  }
  html[data-theme="dark"] .btn-outline:hover { background: var(--surface2); }
  html[data-theme="dark"] .btn-primary { background: var(--primary); }
  html[data-theme="dark"] .btn-primary:hover { background: #3DB868; }

  /* Feature-specific */
  html[data-theme="dark"] .recipe-modal       { background: var(--surface); }
  html[data-theme="dark"] .swap-alt-card      { background: var(--surface2); border-color: var(--border-strong); }
  html[data-theme="dark"] .cswap-input,
  html[data-theme="dark"] .cswap-textarea     { background: var(--surface2) !important; color: var(--text) !important; }
  html[data-theme="dark"] .cswap-pill         { background: var(--surface2); border-color: var(--border-strong); color: var(--text-muted); }
  html[data-theme="dark"] .weekly-summary-card{ background: var(--surface); border-color: var(--border-strong); }
  html[data-theme="dark"] .streak-shield-bar  { background: rgba(228,168,64,0.10); border-color: rgba(228,168,64,0.35); }
  html[data-theme="dark"] .badge-cel-card     { background: #1C1C1C; }
  html[data-theme="dark"] .onboard-card       { background: var(--surface); }
  html[data-theme="dark"] .rest-day-card      { background: var(--surface2); }
  html[data-theme="dark"] .check-item         { border-color: var(--border); }
  html[data-theme="dark"] .check-item:hover   { background: var(--surface2); }
  html[data-theme="dark"] .shop-banner        { background: var(--surface); border-color: var(--border-strong); }
  html[data-theme="dark"] .badge-tile.earned  { background: rgba(76,200,122,0.12); }
  html[data-theme="dark"] .badge-tile.locked  { background: var(--surface2); }
  html[data-theme="dark"] .notif-enable-card  { background: var(--surface2); }
  html[data-theme="dark"] .kcal-bar-track     { background: var(--surface2); }
  html[data-theme="dark"] .dialog-card        { background: var(--surface); }
  html[data-theme="dark"] .recipe-hero-wrap   { background: var(--surface2); }

  :root {
    --chat-height: 100vh;
    --bg: #F7F6F2;
    --surface: #FFFFFF;
    --surface2: #EFEDE6;
    --border: rgba(14,16,12,0.08);
    --border-strong: rgba(14,16,12,0.14);
    --primary: #1B3E2B;
    --primary-light: #D0EADA;
    --accent: #D85230;
    --accent-light: #FDE9E2;
    --text: #0D0F0C;
    --text-muted: rgba(13,15,12,0.58);
    --text-dim: rgba(13,15,12,0.34);
    --green: #1B3E2B;
    --green-light: #D0EADA;
    --amber: #8C5200;
    --amber-light: #FEF0C5;
    --red: #A91C1C;
    --red-light: #FDE8E8;
    --radius: 18px;
    --radius-sm: 12px;
    --radius-lg: 26px;
    --serif: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  }
  html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
  }

  /* ===== Layout shells ===== */
  .app-shell { width: min(100%, 100vw); max-width: 1200px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; position: relative; }
  .screen { display: none; flex: 1; flex-direction: column; }
  .screen.active { display: flex; }
  .screen-auth-layout,
  .screen-welcome-layout,
  .quiz-layout,
  .generating-layout { width: 100%; }
  input, select, textarea, button { font: inherit; }
  input, select, textarea { -webkit-appearance: none; appearance: none; }
  input:-webkit-autofill,
  input:-webkit-autofill:hover,
  input:-webkit-autofill:focus,
  textarea:-webkit-autofill,
  textarea:-webkit-autofill:hover,
  textarea:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    box-shadow: 0 0 0 1000px var(--surface) inset;
    transition: background-color 9999s ease-out 0s;
    caret-color: var(--text);
  }

  /* ===== Quiz ===== */
  .quiz-header {
    padding: 18px 22px 12px;
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .quiz-back {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--surface2); border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 17px;
    flex-shrink: 0;
    transition: background .15s, color .15s;
  }
  .quiz-back:hover { background: #E0DDD5; color: var(--text); }
  .quiz-progress-track {
    flex: 1; height: 3px; background: var(--surface2); border-radius: 99px; overflow: hidden;
  }
  .quiz-progress-fill {
    height: 100%; background: var(--primary); border-radius: 99px;
    transition: width 0.4s cubic-bezier(.16,1,.3,1);
  }
  .quiz-step-label { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; font-weight: 500; }

  .quiz-body { flex: 1; padding: max(28px, env(safe-area-inset-top)) 24px 20px; display: flex; flex-direction: column; }
  .quiz-eyebrow {
    font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--accent); margin-bottom: 12px;
  }
  .quiz-question {
    font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1.25;
    color: var(--text); margin-bottom: 8px; letter-spacing: -0.01em;
  }
  .quiz-subtext { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; line-height: 1.65; }

  .option-list { display: flex; flex-direction: column; gap: 8px; }
  .option-card {
    background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    padding: 15px 17px; cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    display: flex; align-items: center; gap: 13px;
    -webkit-tap-highlight-color: transparent;
  }
  .option-card:hover { border-color: rgba(27,62,43,0.28); box-shadow: 0 2px 10px rgba(14,16,12,0.06); }
  .option-card.selected { border-color: var(--primary); background: var(--primary-light); }
  .option-icon { font-size: 19px; flex-shrink: 0; width: 26px; text-align: center; }
  .option-text { flex: 1; }
  .option-title { font-size: 14.5px; font-weight: 600; color: var(--text); }
  .option-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.45; }
  .option-check {
    width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-strong);
    flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, border-color 0.15s;
  }
  .option-card.selected .option-check { background: var(--primary); border-color: var(--primary); }
  .option-card.selected .option-check::after {
    content: ''; width: 9px; height: 5.5px; border-left: 2px solid white; border-bottom: 2px solid white;
    transform: rotate(-45deg) translateY(-1px); display: block;
  }

  /* Multi-select chips */
  .chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
  .chip {
    padding: 9px 16px; border-radius: 99px; border: 1.5px solid var(--border);
    background: var(--surface); font-size: 13px; font-weight: 500; color: var(--text-muted);
    cursor: pointer; transition: all 0.14s; -webkit-tap-highlight-color: transparent;
  }
  .chip:hover { border-color: var(--border-strong); color: var(--text); }
  .chip.selected { background: var(--primary); border-color: var(--primary); color: white; }

  /* Inputs */
  .quiz-field { margin-top: 18px; text-align: left; }
  .quiz-field-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 10px;
  }
  .quiz-field-hint {
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.55;
  }
  .input-row { display: flex; gap: 10px; align-items: stretch; }
  .quiz-input {
    width: 100%;
    flex: 1;
    display: block;
    min-height: 58px;
    height: 58px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 15px;
    padding: 0 18px;
    font-size: 16px;
    line-height: 1.2;
    color: var(--text);
    outline: none;
    font-family: var(--sans);
    transition: border-color 0.15s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(14,16,12,0.04);
  }
  .quiz-input::placeholder { color: var(--text-dim); }
  .quiz-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27,62,43,0.12), 0 1px 3px rgba(14,16,12,0.04);
  }
  .quiz-textarea {
    width: 100%;
    min-height: 168px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 18px;
    padding: 16px 18px;
    font-size: 15px;
    line-height: 1.65;
    color: var(--text);
    outline: none;
    font-family: var(--sans);
    resize: vertical;
    box-shadow: 0 1px 3px rgba(14,16,12,0.04);
    transition: border-color 0.15s, box-shadow 0.2s;
  }
  .quiz-textarea::placeholder { color: var(--text-dim); }
  .quiz-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27,62,43,0.12);
  }
  .quiz-select {
    width: 100%;
    min-height: 58px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 15px;
    padding: 0 48px 0 18px;
    font-size: 16px;
    color: var(--text);
    outline: none;
    font-family: var(--sans);
    transition: border-color 0.15s, box-shadow 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230D0F0C' stroke-opacity='.4' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 16px center;
    box-shadow: 0 1px 3px rgba(14,16,12,0.04);
  }
  .quiz-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27,62,43,0.12);
  }
  .input-unit {
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    background: var(--surface2);
    border-radius: 15px;
    border: 1.5px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
  }
  .unit-toggle { display: flex; gap: 6px; margin-top: 10px; }
  .unit-btn {
    flex: 1; padding: 11px 10px; border-radius: 11px; border: 1.5px solid var(--border);
    background: var(--surface); font-size: 12.5px; font-weight: 700; color: var(--text-muted); cursor: pointer; text-align: center;
    transition: all 0.14s;
  }
  .unit-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
  .height-guide-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%; background: var(--surface2);
    border: 1.5px solid var(--border-strong); font-size: 11px; font-weight: 700;
    color: var(--text-muted); cursor: pointer; vertical-align: middle; margin-left: 6px;
    transition: background 0.13s;
  }
  .height-guide-btn:hover { background: var(--primary-light); color: var(--primary); }
  .height-guide-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 400;
    display: flex; align-items: flex-end; justify-content: center;
  }
  .height-guide-sheet {
    background: var(--surface); border-radius: 22px 22px 0 0; padding: 28px 24px 40px;
    max-width: 500px; width: 100%;
  }
  .height-guide-title { font-family: var(--serif); font-size: 18px; font-weight: 700; margin-bottom: 16px; }
  .height-guide-step { display: flex; gap: 12px; margin-bottom: 14px; align-items: flex-start; }
  .height-guide-num { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
  .height-guide-text { font-size: 14px; color: var(--text); line-height: 1.55; }

  .quiz-footer {
    padding: 14px 24px calc(22px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(247,246,242,0) 0%, var(--bg) 28%);
    position: sticky;
    bottom: 0;
  }
  .btn {
    width: 100%; min-height: 58px; padding: 16px 22px; border-radius: 16px; font-size: 16px; font-weight: 600;
    cursor: pointer; border: none; transition: all 0.15s cubic-bezier(.16,1,.3,1); font-family: var(--sans);
    letter-spacing: -0.01em;
  }
  .btn-primary { background: var(--primary); color: white; }
  .btn-primary:hover { background: #254F39; }
  .btn-primary:active { transform: scale(0.98); }
  .btn-primary:disabled { background: var(--surface2); color: var(--text-dim); cursor: not-allowed; transform: none; }
  .btn-accent { background: var(--accent); color: white; }
  .btn-accent:hover { opacity: 0.92; }
  .btn-accent:active { transform: scale(0.98); }
  .btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); }
  .btn-outline:hover { background: var(--surface2); border-color: var(--border-strong); color: var(--text); }
  .btn-ghost { background: none; color: var(--text-muted); font-size: 13px; text-decoration: underline; padding: 8px; border: none; }
  .dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 450;
    background: rgba(13,15,12,0.44);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
  }
  .dialog-overlay.active { display: flex; }
  .dialog-card {
    width: min(100%, 460px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 28px;
    box-shadow: 0 28px 80px -40px rgba(13,15,12,0.4);
  }
  .dialog-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 10px;
  }
  .dialog-title {
    font-family: var(--serif);
    font-size: 26px;
    line-height: 1.15;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
  }
  .dialog-body {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-muted);
    white-space: pre-line;
  }
  .dialog-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
  }
  .dialog-actions .btn {
    flex: 1;
    min-height: 52px;
    padding: 13px 18px;
    font-size: 15px;
    white-space: nowrap;
  }
  .dialog-card.info .dialog-eyebrow { color: var(--accent); }
  .dialog-card.success .dialog-eyebrow { color: var(--green); }
  .dialog-card.danger .dialog-eyebrow,
  .dialog-card.danger .dialog-title { color: var(--red); }

  /* ===== Welcome screen ===== */
  .welcome-screen {
    flex: 1; display: flex; flex-direction: column; justify-content: center;
    padding: max(36px, env(safe-area-inset-top)) 28px calc(34px + env(safe-area-inset-bottom)); text-align: center;
  }
  .welcome-mark {
    width: 66px; height: 66px; margin: 0 auto 26px; border-radius: 20px;
    background: var(--primary); display: flex; align-items: center; justify-content: center;
    font-family: var(--serif); font-size: 30px; font-weight: 700; color: white;
    box-shadow: 0 8px 28px rgba(27,62,43,0.28);
  }
  .brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
  }
  .welcome-mark.has-logo,
  .public-brand-mark.has-logo { padding: 0; overflow: hidden; background: var(--surface); }
  .welcome-title { font-family: var(--serif); font-size: 26px; font-weight: 800; line-height: 1.2; margin-bottom: 12px; letter-spacing: -0.02em; }
  .welcome-sub { font-size: 15px; color: var(--text-muted); margin-bottom: 36px; line-height: 1.7; }
  .welcome-features { display: flex; flex-direction: column; gap: 12px; margin-bottom: 36px; text-align: left; }
  .feature-row { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; color: var(--text); }
  .feature-dot {
    width: 28px; height: 28px; border-radius: 9px; background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; margin-top: 1px;
  }
  .public-topbar {
    width: min(100%, 560px);
    margin: 0 auto;
    padding: max(18px, env(safe-area-inset-top)) 22px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }
  .public-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  .public-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: var(--primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-size: 17px;
    font-weight: 700;
  }
  .public-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 15px;
    border-radius: 99px;
    border: 1.5px solid var(--border);
    background: rgba(255,255,255,0.72);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(14,16,12,0.06);
    backdrop-filter: blur(8px);
    transition: background 0.14s, border-color 0.14s;
  }
  .public-link:hover { background: var(--surface); border-color: var(--border-strong); }
  .public-link:active { transform: scale(0.98); }

  /* ===== Loading / generation screen ===== */
  .generating-screen {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: max(36px, env(safe-area-inset-top)) 24px calc(30px + env(safe-area-inset-bottom)); text-align: center;
  }
  .generating-orb {
    width: 88px; height: 88px; border-radius: 50%; margin-bottom: 28px; position: relative;
    background: conic-gradient(from 0deg, var(--primary), var(--accent), var(--primary));
    animation: spin 2.4s linear infinite;
  }
  .generating-orb::after {
    content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--bg);
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .generating-title { font-family: var(--serif); font-size: 20px; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.01em; }
  .generating-step { font-size: 13.5px; color: var(--text-muted); transition: opacity 0.3s; }
  .generating-layout {
    width: min(100%, 420px);
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .generating-meta {
    width: 100%;
    margin-top: 28px;
    display: grid;
    gap: 14px;
  }
  .generating-card {
    background: rgba(255,255,255,0.76);
    border: 1px solid rgba(14,16,12,0.06);
    border-radius: 24px;
    padding: 18px;
    box-shadow: 0 4px 20px rgba(14,16,12,0.07);
    backdrop-filter: blur(10px);
    text-align: left;
  }
  .loading-checklist { display: grid; gap: 10px; }
  .loading-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    color: var(--text-muted);
    opacity: 0.5;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .loading-item.is-active,
  .loading-item.is-done { opacity: 1; }
  .loading-item.is-active { transform: translateX(2px); }
  .loading-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(14,16,12,0.1);
    background: rgba(239,237,230,0.8);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
  }
  .loading-item.is-active .loading-marker {
    border-color: rgba(27,62,43,0.2);
    background: rgba(27,62,43,0.08);
    color: var(--primary);
  }
  .loading-item.is-done .loading-marker {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
  }
  .loading-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: livePulse 1.4s infinite;
  }
  @keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(27,62,43,0.28); }
    70% { box-shadow: 0 0 0 10px rgba(27,62,43,0); }
    100% { box-shadow: 0 0 0 0 rgba(27,62,43,0); }
  }
  .loading-copy { min-width: 0; flex: 1; }
  .loading-label { font-size: 14px; font-weight: 700; color: var(--text); }
  .loading-meta-text { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.5; }
  .preview-skeleton { display: grid; gap: 12px; }
  .skeleton-card {
    border-radius: 18px;
    background: linear-gradient(90deg, rgba(239,237,230,0.92) 0%, rgba(255,255,255,0.96) 45%, rgba(239,237,230,0.92) 100%);
    background-size: 220% 100%;
    animation: shimmer 1.9s linear infinite;
    border: 1px solid rgba(14,16,12,0.05);
    padding: 14px;
  }
  .skeleton-bar {
    height: 9px;
    border-radius: 99px;
    background: rgba(27,62,43,0.1);
    margin-bottom: 10px;
  }
  .skeleton-bar:last-child { margin-bottom: 0; }
  .skeleton-bar.short { width: 34%; }
  .skeleton-bar.mid { width: 56%; }
  .skeleton-bar.long { width: 100%; }
  .skeleton-bar.tiny { width: 22%; }
  @keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -20% 0; }
  }

  /* ===== Dashboard ===== */
  .dash-header {
    padding: 18px 22px 15px;
    background: rgba(255,255,255,0.92);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .dash-header-main {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
  }
  .dash-header-copy {
    min-width: 0;
    flex: 1;
  }
  .dash-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary-light);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--primary);
    font-family: var(--serif);
    font-size: 19px;
    font-weight: 700;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 0 0 1px var(--border);
  }
  .dash-greeting { font-family: var(--serif); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
  .dash-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
  .dash-badge { background: var(--primary-light); color: var(--primary); font-size: 11.5px; font-weight: 700; padding: 5px 11px; border-radius: 99px; }
  .dash-header-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
  }
  .dash-notification-wrap {
    position: relative;
    flex-shrink: 0;
  }
  .dash-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--surface2);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    position: relative;
    transition: background 0.14s, border-color 0.14s;
  }
  .dash-icon-btn:hover { background: var(--primary-light); border-color: rgba(27,62,43,0.2); }
  .notification-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 19px;
    height: 19px;
    border-radius: 99px;
    background: var(--accent);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    font-size: 10.5px;
    font-weight: 700;
    border: 2px solid var(--surface);
    box-shadow: 0 4px 12px rgba(216,82,48,0.3);
  }
  .notification-count.show { display: inline-flex; }
  .notification-pop {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(92vw, 380px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 20px 60px -28px rgba(13,15,12,0.36);
    padding: 14px;
    display: none;
    z-index: 70;
  }
  .notification-pop.active { display: block; }
  .notification-pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
  }
  .notification-pop-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted);
  }
  .notification-pop-action {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
  }
  .notification-list {
    display: grid;
    gap: 8px;
    max-height: min(60vh, 420px);
    overflow-y: auto;
  }
  .notification-item {
    width: 100%;
    text-align: left;
    border: 1px solid var(--border);
    background: var(--surface2);
    border-radius: 14px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    display: grid;
    gap: 5px;
    transition: background 0.14s;
  }
  .notification-item.is-unread {
    border-color: rgba(27,62,43,0.2);
    background: rgba(208,234,218,0.42);
  }
  .notification-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .notification-item-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
  }
  .notification-item-time {
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
  }
  .notification-item-body {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-muted);
  }
  .notification-empty {
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: 18px 14px;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-muted);
    background: rgba(239,237,230,0.4);
  }
  .dash-mini-profile {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 5px 8px 5px 5px;
    border-radius: 99px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    color: var(--text);
    cursor: pointer;
    min-width: 0;
    transition: background 0.14s, border-color 0.14s;
  }
  .dash-mini-profile:hover { background: var(--primary-light); border-color: rgba(27,62,43,0.2); }
  .dash-mini-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--surface);
    background-size: cover;
    background-position: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    font-family: var(--serif);
    flex-shrink: 0;
  }
  .dash-mini-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dash-nav {
    display: flex; background: rgba(255,255,255,0.95); border-bottom: 1px solid var(--border);
    position: sticky; top: 65px; z-index: 49; padding: 0 8px;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  }
  .dash-nav-btn {
    flex: 1; padding: 13px 4px 11px; font-size: 12.5px; font-weight: 600; color: var(--text-muted);
    background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent;
    transition: color 0.18s, border-color 0.18s; letter-spacing: 0.01em;
  }
  .dash-nav-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
  .dash-nav-btn:hover:not(.active) { color: var(--text); }

  .dash-page { display: none; padding: 20px 20px 100px; }
  .dash-page.active { display: block; }

  /* Weight discrepancy notice */
  .weight-notice {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--amber-light); border: 1px solid rgba(140,82,0,0.16);
    border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px;
    font-size: 13px; line-height: 1.55; color: var(--amber);
  }
  .weight-notice-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
  .weight-notice strong { display: block; font-weight: 700; margin-bottom: 2px; }
  .weight-notice-btn {
    display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700;
    color: var(--amber); text-decoration: underline; background: none; border: none;
    cursor: pointer; padding: 0; font-family: var(--sans);
  }

  .card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
    padding: 18px; margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(14,16,12,0.05);
  }
  .card-title {
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-dim); margin-bottom: 12px;
  }

  /* Goal compass */
  .compass-card {
    background: linear-gradient(145deg, var(--primary) 0%, #254F39 100%);
    color: white; border: none; padding: 22px 20px;
    box-shadow: 0 6px 28px rgba(27,62,43,0.32);
  }
  .compass-row { display: flex; align-items: center; gap: 20px; }
  .compass-ring-wrap { position: relative; width: 94px; height: 94px; flex-shrink: 0; }
  .compass-ring-wrap svg { transform: rotate(-90deg); }
  .compass-bg { fill: none; stroke: rgba(255,255,255,0.14); stroke-width: 7; }
  .compass-fill { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
  .compass-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
  .compass-pct { font-size: 22px; font-weight: 700; font-family: var(--sans); letter-spacing: -0.02em; }
  .compass-lbl { font-size: 9px; opacity: 0.65; text-transform: uppercase; letter-spacing: 0.06em; }
  .compass-info { flex: 1; }
  .compass-goal { font-family: var(--serif); font-size: 16px; font-weight: 700; margin-bottom: 5px; letter-spacing: -0.01em; }
  .compass-detail { font-size: 12.5px; opacity: 0.72; line-height: 1.6; }

  /* Stat grid */
  .stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
  .stat-box {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 14px 10px; text-align: center; box-shadow: 0 1px 3px rgba(14,16,12,0.04);
  }
  .stat-box-num { font-size: 22px; font-weight: 700; color: var(--text); font-family: var(--serif); letter-spacing: -0.02em; }
  .stat-box-lbl { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

  /* Checklist items */
  .check-item {
    display: flex; align-items: flex-start; gap: 13px; padding: 13px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
    transition: opacity 0.14s;
  }
  .check-item:last-child { border-bottom: none; padding-bottom: 0; }
  .check-item:first-child { padding-top: 0; }
  .checkbox {
    width: 23px; height: 23px; border-radius: 8px; border: 1.5px solid var(--border-strong);
    background: var(--surface); flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; margin-top: 2px;
  }
  .check-item.done .checkbox { background: var(--primary); border-color: var(--primary); }
  .check-item.done .checkbox::after {
    content: ''; width: 11px; height: 7px; border-left: 2.5px solid white; border-bottom: 2.5px solid white;
    transform: rotate(-45deg) translateY(-2px); display: block;
  }
  .check-item.done { opacity: 0.62; }
  .check-item.done .check-label { color: var(--text-muted); text-decoration: line-through; }
  .check-label { font-size: 13.5px; flex: 1; font-weight: 600; line-height: 1.45; color: var(--text); }
  .check-time { font-size: 11px; font-weight: 700; color: var(--primary); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 2px; }
  .check-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.55; }
  .check-kcal {
    font-size: 11px; font-weight: 700; color: var(--text-muted); background: var(--surface2);
    padding: 3px 9px; border-radius: 10px; white-space: nowrap; margin-top: 3px; letter-spacing: 0.01em;
  }

  /* Calorie progress bar */
  .kcal-bar-track {
    width: 100%; height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; margin-top: 10px;
  }
  .kcal-bar-fill {
    height: 100%; border-radius: 3px; background: var(--primary); transition: width 0.35s ease;
  }
  .kcal-bar-fill.over { background: var(--accent); }

  /* ===== EXERCISE GUIDE ===== */
  .ex-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer;
    transition: background 0.13s; border-radius: 10px; margin: 0 -8px; padding: 10px 8px;
  }
  .ex-item:hover { background: var(--surface2); }
  .ex-item:last-child { border-bottom: none; }
  .ex-thumb {
    width: 60px; height: 60px; border-radius: 14px; flex-shrink: 0;
    object-fit: cover; background: var(--surface2); display: block;
    transition: opacity .3s;
  }
  @keyframes ex-shimmer { 0%,100%{opacity:.45} 50%{opacity:.9} }
  .ex-thumb[src$=".svg"],[src^="data:image/svg"] { animation: ex-shimmer 1.4s ease-in-out infinite; }
  .ex-thumb-wrap { position: relative; width: 60px; height: 60px; flex-shrink: 0; border-radius: 14px; overflow: hidden; background: var(--surface2); }
  .ex-thumb-label {
    position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
    font-size: 8px; font-weight: 800; letter-spacing: 0.07em;
    background: rgba(0,0,0,0.52); color: #fff; padding: 2px 5px;
    border-radius: 4px; white-space: nowrap;
  }
  .ex-info { flex: 1; min-width: 0; }
  .ex-name { font-size: 13.5px; font-weight: 700; color: var(--text); line-height: 1.35; margin-bottom: 3px; }
  .ex-sets { font-size: 12px; color: var(--text-muted); font-weight: 500; }
  .ex-guide-btn {
    flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 700; color: var(--primary);
    background: var(--primary-light); border: none; border-radius: 8px;
    padding: 5px 10px; cursor: pointer; font-family: var(--sans);
    transition: background 0.13s; white-space: nowrap;
  }
  .ex-guide-btn:hover { background: rgba(208,234,218,0.85); }

  /* Exercise Guide Modal */
  .ex-guide-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    display: none; align-items: flex-end; justify-content: center;
  }
  .ex-guide-overlay.active { display: flex; }
  .ex-guide-modal {
    background: var(--bg); width: 100%; max-width: 560px;
    max-height: 92vh; border-radius: 24px 24px 0 0;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .ex-guide-hero {
    position: relative; height: 220px; overflow: hidden;
    background: linear-gradient(135deg, #D0EADA 0%, #EFEDE6 100%);
  }
  .ex-guide-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .ex-guide-hero-close {
    position: absolute; top: 14px; right: 14px;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(0,0,0,0.42); color: #fff; border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 20px; backdrop-filter: blur(6px);
  }
  .ex-guide-muscle-badge {
    position: absolute; top: 14px; left: 14px;
    font-size: 11px; font-weight: 800; padding: 5px 12px;
    border-radius: 99px; letter-spacing: 0.06em; text-transform: uppercase;
  }
  .ex-guide-body { padding: 20px 20px 48px; }
  .ex-guide-title { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); line-height: 1.2; margin-bottom: 8px; }
  .ex-guide-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
  .ex-guide-pill { font-size: 11px; font-weight: 700; padding: 4px 11px; border-radius: 99px; background: var(--surface2); color: var(--text-muted); }
  .ex-guide-pill.green { background: var(--primary-light); color: var(--primary); }
  .ex-guide-pill.accent { background: var(--accent-light); color: var(--accent); }
  .ex-guide-muscles { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
  .ex-guide-muscle-tag {
    font-size: 11.5px; font-weight: 700; padding: 5px 12px;
    border-radius: 8px; background: var(--surface2); color: var(--text);
  }
  .ex-guide-muscle-tag.primary { background: var(--primary-light); color: var(--primary); }
  .ex-guide-section { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .ex-guide-steps { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 10px; }
  .ex-guide-step { display: flex; gap: 12px; align-items: flex-start; }
  .ex-guide-step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
  .ex-guide-step-text { font-size: 13.5px; line-height: 1.65; color: var(--text); flex: 1; }
  .ex-guide-mistakes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
  .ex-guide-mistake { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text); line-height: 1.55; }
  .ex-guide-mistake::before { content: '✗'; color: var(--accent); font-weight: 800; flex-shrink: 0; margin-top: 1px; font-size: 14px; }
  .ex-guide-yt-btn {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    width: 100%; padding: 14px; border-radius: var(--radius-sm);
    background: #FF0000; color: #fff; border: none; font-size: 14px;
    font-weight: 700; cursor: pointer; font-family: var(--sans);
    text-decoration: none; transition: background 0.14s;
  }
  .ex-guide-yt-btn:hover { background: #CC0000; }

  /* Exercise overview text */
  .ex-guide-overview {
    font-size: 13px; color: var(--text-muted); line-height: 1.65;
    padding: 0 20px 18px; font-weight: 450;
  }
  /* Pro tips */
  .ex-guide-tips { display: flex; flex-direction: column; gap: 10px; padding: 0 20px 18px; }
  .ex-guide-tip {
    font-size: 13px; color: var(--text); line-height: 1.6;
    background: var(--surface2); border-radius: 10px; padding: 10px 13px;
    border-left: 3px solid var(--primary-light);
  }
  .ex-guide-tip-title { font-weight: 700; color: var(--primary); }

  /* wger anatomical reference image strip */
  .ex-ref-strip {
    display: flex; gap: 10px; padding: 0 20px 18px; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .ex-ref-strip::-webkit-scrollbar { display: none; }
  .ex-ref-img-wrap {
    position: relative; flex-shrink: 0; width: 140px; height: 100px;
    border-radius: 12px; overflow: hidden; background: var(--surface2);
  }
  .ex-ref-img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .ex-ref-label {
    position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
    font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
    background: rgba(0,0,0,.5); color: #fff; padding: 2px 7px; border-radius: 4px;
    white-space: nowrap; backdrop-filter: blur(4px);
  }

  /* ===== RECIPE BUTTON (inline on meal items) ===== */
  .recipe-btn {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 700; color: var(--primary);
    background: var(--primary-light); border: none; border-radius: 7px;
    padding: 4px 9px; cursor: pointer; font-family: var(--sans);
    transition: background 0.13s, transform 0.1s; white-space: nowrap;
    letter-spacing: 0.01em; line-height: 1;
  }
  .recipe-btn:hover { background: rgba(208,234,218,0.85); }
  .recipe-btn:active { transform: scale(0.96); }

  /* ===== RECIPE MODAL ===== */
  .recipe-modal-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,0.54); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    display: none; align-items: flex-end; justify-content: center;
  }
  .recipe-modal-overlay.active { display: flex; }
  .recipe-modal {
    background: var(--bg); width: 100%; max-width: 540px;
    max-height: 92vh; border-radius: 24px 24px 0 0;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    position: relative;
  }
  .recipe-hero-wrap {
    position: relative; height: 220px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--surface2) 100%);
    overflow: hidden;
  }
  .recipe-hero-wrap img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: opacity 0.3s;
  }
  .recipe-close-btn {
    position: absolute; top: 14px; right: 14px; z-index: 10;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(0,0,0,0.45); color: #fff; border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 20px; line-height: 1;
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  }
  .recipe-kcal-badge {
    position: absolute; bottom: 14px; right: 14px;
    background: var(--primary); color: #fff; font-size: 12px; font-weight: 700;
    padding: 5px 12px; border-radius: 99px; letter-spacing: 0.02em;
  }
  .recipe-body { padding: 20px 20px 44px; }
  .recipe-chef-row { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
  .recipe-chef-avatar {
    width: 40px; height: 40px; border-radius: 50%; background: var(--primary);
    color: #fff; font-size: 14px; font-weight: 800;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .recipe-chef-name { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.3; }
  .recipe-chef-cuisine { font-size: 11px; color: var(--text-muted); letter-spacing: 0.05em; font-weight: 600; text-transform: uppercase; }
  .recipe-title { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); line-height: 1.2; margin-bottom: 8px; }
  .recipe-pills { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
  .recipe-pill {
    font-size: 11px; font-weight: 700; padding: 4px 11px; border-radius: 99px;
    background: var(--surface2); color: var(--text-muted);
  }
  .recipe-pill.accent { background: var(--primary-light); color: var(--primary); }
  .recipe-section {
    font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text-dim); margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
  }
  .recipe-ing-table {
    width: 100%; border-collapse: collapse; margin-bottom: 22px; font-size: 13.5px;
  }
  .recipe-ing-table thead th {
    text-align: left; padding: 8px 12px;
    background: var(--surface2); color: var(--text-dim);
    font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  }
  .recipe-ing-table thead th:first-child { border-radius: 8px 0 0 8px; }
  .recipe-ing-table thead th:last-child { border-radius: 0 8px 8px 0; }
  .recipe-ing-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); line-height: 1.5; }
  .recipe-ing-table tr:last-child td { border-bottom: none; }
  .recipe-ing-table td:first-child { font-weight: 700; color: var(--primary); white-space: nowrap; min-width: 90px; }
  .recipe-steps { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 10px; }
  .recipe-step { display: flex; gap: 12px; align-items: flex-start; }
  .recipe-step-num {
    width: 28px; height: 28px; border-radius: 50%; background: var(--primary);
    color: #fff; font-size: 12px; font-weight: 800;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px;
  }
  .recipe-step-text { font-size: 13.5px; line-height: 1.65; color: var(--text); flex: 1; }
  .recipe-footer { font-size: 11.5px; color: var(--text-dim); text-align: center; margin-top: 16px; line-height: 1.6; }

  /* Pills */
  .pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
  .pill { font-size: 12px; padding: 5px 12px; border-radius: 99px; font-weight: 600; }
  .pill-green { background: var(--green-light); color: var(--green); }
  .pill-amber { background: var(--amber-light); color: var(--amber); }
  .pill-red { background: var(--red-light); color: var(--red); }
  .pill-neutral { background: var(--surface2); color: var(--text-muted); }

  /* Requests */
  .request-hero-card {
    background: linear-gradient(180deg, rgba(27,62,43,0.05) 0%, rgba(255,255,255,1) 60%);
  }
  .request-hero-title {
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1.18;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
  }
  .request-hero-copy {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.7;
  }
  .request-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
  }
  .request-chip {
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 99px;
    padding: 9px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(14,16,12,0.05);
    transition: all 0.14s;
  }
  .request-chip:hover { background: var(--primary-light); border-color: rgba(27,62,43,0.2); color: var(--primary); }
  .request-helper-row { margin-top: 14px; }
  .request-card {
    border-top: 1px solid var(--border);
    padding: 14px 0;
  }
  .request-card:first-child {
    border-top: none;
    padding-top: 0;
  }
  .request-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
  }
  .request-card-time {
    font-size: 11.5px;
    color: var(--text-dim);
    white-space: nowrap;
  }
  .request-card-text {
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--text);
  }
  .request-card-note {
    margin-top: 8px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--primary);
  }
  .request-card-error {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--red);
  }

  /* Bottom nav — frosted glass, pill active indicator */
  .bottom-nav {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 1200px;
    background: rgba(255,255,255,0.88); border-top: 1px solid var(--border);
    display: flex; z-index: 100; padding-bottom: env(safe-area-inset-bottom);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
  }
  .bottom-nav-btn {
    flex: 1; padding: 11px 4px 10px; display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none; cursor: pointer; color: var(--text-dim);
    font-size: 10px; font-weight: 600; letter-spacing: 0.01em; transition: color 0.2s;
  }
  .bottom-nav-btn.active { color: var(--primary); }
  .bottom-nav-icon {
    font-size: 20px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 28px;
    border-radius: 9px;
    transition: background 0.2s;
  }
  .bottom-nav-btn.active .bottom-nav-icon { background: var(--primary-light); }

  /* Chat */
  #screen-chat {
    position: fixed;
    inset: 0 auto 0 50%;
    transform: translateX(-50%);
    width: min(100%, 560px);
    height: var(--chat-height);
    min-height: var(--chat-height);
    overflow: hidden;
    z-index: 220;
    background: var(--bg);
  }
  .chat-screen {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    min-height: 0;
    background: var(--bg);
  }
  #screen-chat .dash-header { flex-shrink: 0; }
  .chat-page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .chat-msg {
    max-width: 84%; padding: 11px 15px; border-radius: 18px; font-size: 14px; line-height: 1.62;
  }
  .chat-msg.user {
    align-self: flex-end; background: var(--primary); color: white; border-bottom-right-radius: 5px;
    box-shadow: 0 2px 10px rgba(27,62,43,0.22);
  }
  .chat-msg.ai {
    align-self: flex-start; background: var(--surface); border: 1px solid var(--border);
    border-bottom-left-radius: 5px; box-shadow: 0 1px 4px rgba(14,16,12,0.05);
  }
  .chat-composer {
    flex-shrink: 0;
    background: rgba(247,246,242,0.95);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .chat-input-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px 12px;
  }
  .chat-input {
    flex: 1; border: 1.5px solid var(--border); border-radius: 22px;
    padding: 10px 18px; font-size: 14px; outline: none; font-family: var(--sans);
    background: var(--surface); transition: border-color 0.14s;
  }
  .chat-input:focus { border-color: var(--primary); }
  .chat-send {
    width: 42px; height: 42px; border-radius: 50%; background: var(--primary); color: white;
    border: none; font-size: 18px; cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.14s, transform 0.1s;
    box-shadow: 0 2px 10px rgba(27,62,43,0.28);
  }
  .chat-send:hover { background: #254F39; }
  .chat-send:active { transform: scale(0.94); }
  .chat-suggestions {
    display: flex;
    gap: 8px;
    padding: 10px 16px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
  }
  .chat-suggestions::-webkit-scrollbar { display: none; }
  .chat-suggestion {
    white-space: nowrap; font-size: 12.5px; padding: 7px 14px; border-radius: 14px;
    border: 1.5px solid var(--border); background: var(--surface); color: var(--text-muted);
    cursor: pointer; transition: all 0.14s;
  }
  .chat-suggestion:hover { background: var(--primary-light); border-color: rgba(27,62,43,0.2); color: var(--primary); }
  .chat-retake-chip { background: var(--primary-light); border-color: rgba(27,62,43,0.25); color: var(--primary); font-weight: 600; }
  .chat-retake-chip:hover { background: var(--primary); color: #fff; }
  .typing-dots span {
    display: inline-block; width: 5px; height: 5px; background: var(--text-dim);
    border-radius: 50%; margin: 0 2px; animation: bounce 1.2s infinite;
  }
  .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
  .typing-dots span:nth-child(3) { animation-delay: 0.4s; }
  @keyframes bounce { 0%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-5px); } }

  /* Empty state */
  .empty { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13.5px; }
  .empty-icon { font-size: 28px; margin-bottom: 10px; }

  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  /* Auth screen */
  .auth-card {
    width: min(100%, 420px);
    margin: 0 auto;
    background: rgba(255,255,255,0.84);
    border: 1px solid rgba(14,16,12,0.06);
    border-radius: 26px;
    padding: 22px;
    box-shadow: 0 24px 60px -44px rgba(13,15,12,0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    text-align: left;
  }
  .auth-tabs {
    display: flex; gap: 6px; margin-bottom: 20px;
    background: var(--surface2); border-radius: 16px; padding: 4px;
  }
  .auth-tab {
    flex: 1; text-align: center; padding: 11px 10px; border-radius: 13px;
    font-size: 13.5px; font-weight: 700; cursor: pointer; color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
  }
  .auth-tab.active { background: var(--surface); color: var(--primary); }
  .auth-field { margin-bottom: 12px; }
  .auth-field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-dim);
  }
  .auth-panel { display: none; }
  .auth-panel.active { display: block; }
  .auth-step-title {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
  }
  .auth-step-sub {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 18px;
  }
  .auth-step-email {
    color: var(--accent);
    font-weight: 700;
    word-break: break-word;
  }
  .auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 10px;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .auth-divider::before,
  .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
  }
  .auth-otp-panel { display: none; margin-top: 6px; }
  .auth-otp-actions { display: flex; gap: 10px; margin-top: 10px; }
  .auth-otp-actions .btn { margin-top: 0 !important; }
  .auth-otp-help {
    font-size: 12.5px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
    margin-top: 8px;
  }
  .auth-text-btn {
    display: inline-flex;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.14s;
  }
  .auth-text-btn:hover { opacity: 0.75; }
  .otp-boxes {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 9px;
    margin: 10px 0 16px;
  }
  .otp-box {
    aspect-ratio: 1 / 1;
    min-height: 52px;
    border-radius: 16px;
    border: 1.5px solid var(--border);
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    font-family: var(--sans);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  }
  .otp-box.is-active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(27,62,43,0.12);
  }
  .otp-box.is-filled {
    background: var(--surface);
    border-color: var(--border-strong);
  }
  .otp-hidden-input {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    width: 1px;
    height: 1px;
  }
  .auth-error { font-size: 13px; color: var(--red); margin-top: 8px; min-height: 18px; text-align: center; font-weight: 500; }
  .auth-meta-link {
    display: inline-flex;
    justify-content: center;
    width: 100%;
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.14s;
  }
  .auth-meta-link:hover { color: var(--text); }

  /* Pro badge, upgrade, pricing */
  .pro-badge {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--accent); color: white; font-size: 10.5px; font-weight: 700;
    padding: 3px 8px; border-radius: 10px; margin-left: 6px; letter-spacing: 0.01em;
  }
  .lock-overlay { position: relative; }
  .lock-overlay::before {
    content: '\\1F512 Pro feature'; position: absolute; inset: 0; background: rgba(247,246,242,0.93);
    display: flex; align-items: center; justify-content: center; font-size: 13px;
    font-weight: 600; color: var(--text-muted); border-radius: var(--radius); z-index: 5; gap: 6px;
    backdrop-filter: blur(4px);
  }
  .upgrade-banner {
    background: linear-gradient(145deg, var(--primary) 0%, #254F39 100%);
    color: white; border-radius: var(--radius);
    padding: 20px; margin-bottom: 14px; text-align: center;
    box-shadow: 0 8px 28px rgba(27,62,43,0.22);
  }
  .upgrade-banner h3 { font-family: var(--serif); font-size: 18px; margin-bottom: 6px; font-weight: 700; letter-spacing: -0.01em; }
  .upgrade-banner p { font-size: 13px; opacity: 0.84; margin-bottom: 14px; line-height: 1.55; }
  .checkout-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.82fr);
    gap: 22px;
    align-items: start;
    padding-bottom: 26px;
  }
  .checkout-main,
  .checkout-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .checkout-card,
  .detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 18px 42px -34px rgba(27, 62, 43, 0.34);
  }
  .checkout-card-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
  }
  .checkout-card-title {
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--text);
  }
  .checkout-card-copy,
  .checkout-provider-note,
  .checkout-legal {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
  }
  .checkout-contact-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .checkout-input-label {
    display: block;
    margin-bottom: 10px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    text-transform: uppercase;
  }
  .checkout-input {
    width: 100%;
    min-height: 58px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    padding: 0 22px;
    font-size: 16px;
    color: var(--text);
    outline: none;
  }
  .checkout-input[readonly] {
    color: var(--text);
    opacity: 1;
  }
  .checkout-methods {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .checkout-method {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface-2);
    overflow: hidden;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
  }
  .checkout-method.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(47, 104, 77, 0.12), 0 20px 42px -34px rgba(27,62,43,0.42);
    transform: translateY(-1px);
  }
  .checkout-method-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: transparent;
    border: none;
    text-align: left;
    color: inherit;
    cursor: pointer;
  }
  .checkout-method-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.88);
    border: 1px solid rgba(47, 104, 77, 0.08);
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
  }
  .checkout-method-copy {
    min-width: 0;
    flex: 1;
  }
  .checkout-method-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
  }
  .checkout-method-subtitle {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.45;
  }
  .checkout-method-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 13px;
    flex-shrink: 0;
    transition: all .2s ease;
  }
  .checkout-method.active .checkout-method-check {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
  }
  .checkout-method-body {
    border-top: 1px solid var(--border);
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .checkout-method-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .checkout-method-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .checkout-method-field.full {
    grid-column: 1 / -1;
  }
  .checkout-method-field span {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
  }
  .checkout-method-field strong,
  .checkout-provider-note strong {
    font-size: 14px;
    color: var(--text);
    font-weight: 700;
  }
  .checkout-provider-note {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.78);
    border: 1px solid var(--border);
  }
  .checkout-provider-note.is-stripe {
    background: rgba(47,104,77,0.06);
    border-color: rgba(47,104,77,0.12);
  }
  .checkout-provider-note.is-manual {
    background: rgba(240, 105, 65, 0.06);
    border-color: rgba(240, 105, 65, 0.14);
  }
  .checkout-action {
    margin-top: 2px;
  }
  .checkout-legal {
    text-align: center;
    margin-top: 6px;
  }
  .price-panel {
    background: linear-gradient(155deg, var(--primary) 0%, #254F39 100%);
    color: white;
    border-radius: 22px;
    padding: 24px 22px;
    margin-bottom: 16px;
    box-shadow: 0 20px 52px -28px rgba(27,62,43,0.65);
  }
  .price-panel-eyebrow {
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.65);
    font-weight: 700;
    margin-bottom: 10px;
  }
  .price-panel-name {
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
  }
  .price-panel-tagline {
    font-size: 13.5px;
    color: rgba(255,255,255,0.76);
    line-height: 1.6;
  }
  .price-panel-price {
    margin-top: 18px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
  }
  .price-panel-amount {
    font-family: var(--serif);
    font-size: 44px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
  }
  .price-panel-period {
    font-size: 14px;
    color: rgba(255,255,255,0.68);
  }
  .price-panel-meta {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .price-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.9);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
  }
  .detail-card-title {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
  }
  .detail-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .detail-list-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text);
  }
  .detail-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    margin-top: 1px;
  }
  .summary-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
  }
  .summary-row:last-child { border-bottom: none; padding-bottom: 0; }
  .summary-label { color: var(--text-muted); }
  .summary-value { color: var(--text); font-weight: 600; text-align: right; }
  .checkout-status {
    min-height: 20px;
    text-align: center;
    font-size: 12.5px;
    margin-top: 8px;
    color: var(--text-muted);
  }

  /* === File input + textarea in checkout === */
  .checkout-file-label {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    border-radius: 999px;
    border: 1.5px dashed var(--border-strong);
    background: var(--surface2);
    padding: 0 20px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: 14px;
    color: var(--text-muted);
  }
  .checkout-file-label:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
  }
  .checkout-file-icon { font-size: 18px; flex-shrink: 0; }
  .checkout-file-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .checkout-textarea {
    width: 100%;
    min-height: 110px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface2);
    padding: 14px 18px;
    font-size: 15px;
    color: var(--text);
    outline: none;
    resize: vertical;
    font-family: inherit;
    line-height: 1.55;
    transition: border-color .15s;
  }
  .checkout-textarea:focus { border-color: var(--primary); }
  .checkout-textarea::placeholder { color: var(--text-dim); }

  /* === Upgrade page redesign === */
  #screen-upgrade .quiz-back,
  #screen-checkout .quiz-back {
    width: auto;
    height: auto;
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 600;
    gap: 4px;
  }
  .upgrade-page-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  .upgrade-page-shell {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 32px 40px 40px;
    flex: 1;
    align-items: start;
  }
  .upgrade-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 18px;
  }
  .upgrade-page-title {
    font-family: var(--serif);
    font-size: 44px;
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 14px;
  }
  .upgrade-title-em {
    font-style: italic;
    color: var(--primary);
    display: block;
  }
  .upgrade-page-sub {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 26px;
  }
  .upgrade-plan-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 12px 36px -20px rgba(27,62,43,0.16);
  }
  .upgrade-plan-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
  }
  .upgrade-plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .upgrade-plan-trial {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
  }
  .upgrade-plan-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
  }
  .upgrade-plan-amount {
    font-family: var(--serif);
    font-size: 44px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1;
  }
  .upgrade-plan-period {
    font-size: 16px;
    color: var(--text-muted);
  }
  .upgrade-plan-billing {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 22px;
  }
  .upgrade-plan-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
  }
  .upgrade-plan-legal {
    text-align: center;
    font-size: 11.5px;
    color: var(--text-dim);
    margin-top: 10px;
  }
  .upgrade-visual {
    border-radius: 24px;
    overflow: hidden;
    position: sticky;
    top: 0;
    min-height: 440px;
    background: linear-gradient(150deg, var(--primary) 0%, #2a6649 55%, #3d7a60 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 48px;
  }
  .upgrade-visual-icon {
    font-size: 72px;
    line-height: 1;
    margin-bottom: auto;
    filter: drop-shadow(0 6px 18px rgba(0,0,0,0.22));
  }
  .upgrade-quote-card {
    margin: 24px 18px 18px;
    background: rgba(247, 246, 242, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 18px;
    padding: 16px 18px;
  }
  .upgrade-quote-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 8px;
  }
  .upgrade-quote-text {
    font-family: var(--serif);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
    font-style: italic;
    margin-bottom: 7px;
  }
  .upgrade-quote-sig {
    font-size: 11.5px;
    color: var(--text-muted);
  }
  .upgrade-vat {
    text-align: center;
    font-size: 11.5px;
    color: var(--text-dim);
    padding: 4px 24px 24px;
  }

  /* Responsive */
  @media (max-width: 480px) {
    .welcome-screen,
    .quiz-body,
    .quiz-footer,
    .generating-screen { padding-left: 20px; padding-right: 20px; }
    .welcome-title,
    .quiz-question { font-size: 22px; line-height: 1.12; letter-spacing: -0.02em; }
    .welcome-sub,
    .quiz-subtext { font-size: 14px; }
    .btn { min-height: 56px; font-size: 16px; }
    .auth-card { padding: 18px; border-radius: 22px; }
    .auth-step-title { font-size: 20px; }
    .otp-boxes { gap: 7px; }
    .otp-box { min-height: 48px; border-radius: 14px; font-size: 20px; }
    .generating-card { border-radius: 20px; }
    .chat-messages { padding-left: 14px; padding-right: 14px; }
    .chat-input-bar { padding-left: 12px; padding-right: 12px; }
    .chat-suggestions { padding-left: 12px; padding-right: 12px; }
    .dash-header {
      padding: 14px 16px 12px;
      align-items: flex-start;
      gap: 12px;
    }
    .dash-header-main {
      align-items: flex-start;
      gap: 12px;
      flex: 1;
      min-width: 0;
    }
    .dash-header-copy {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .dash-greeting { font-size: 17px; line-height: 1.18; }
    .dash-sub { font-size: 11.5px; line-height: 1.45; }
    .dash-header-actions { gap: 8px; align-self: flex-start; }
    .dash-icon-btn[data-mobile-hide="true"],
    .dash-badge { display: none; }
    .dash-mini-profile {
      padding: 0;
      width: 40px;
      height: 40px;
      justify-content: center;
      border-radius: 50%;
    }
    .dash-mini-avatar { width: 28px; height: 28px; font-size: 12px; }
    .dash-mini-name { display: none; }
    .dash-avatar { width: 42px; height: 42px; }
    .dialog-overlay { align-items: flex-end; padding: 12px; }
    .dialog-card {
      width: 100%;
      border-radius: 22px;
      padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
    }
    .dialog-title { font-size: 22px; }
    .dialog-actions { flex-direction: column-reverse; }
    .checkout-shell { grid-template-columns: 1fr; gap: 16px; }
    .checkout-card,
    .detail-card,
    .price-panel { padding: 18px; border-radius: 20px; }
    .checkout-card-title,
    .price-panel-name { font-size: 20px; }
    .price-panel-amount { font-size: 38px; }
    .checkout-method-btn { padding: 14px; }
    .checkout-method-icon { width: 40px; height: 40px; font-size: 14px; }
    .checkout-method-grid { grid-template-columns: 1fr; }
    .checkout-input { min-height: 54px; font-size: 15px; padding: 0 18px; }
    .upgrade-page-shell { grid-template-columns: 1fr; gap: 20px; padding: 16px 18px 32px; }
    .upgrade-visual { display: none; }
    .upgrade-page-title { font-size: 28px; }
    .upgrade-plan-amount { font-size: 38px; }
  }
  @media (max-width: 380px) {
    .input-row { flex-direction: column; }
    .input-unit { min-height: 48px; justify-content: flex-start; padding-left: 18px; }
  }
  @media (min-width: 481px) and (max-width: 900px) {
    .upgrade-page-shell { gap: 24px; padding: 24px 28px 36px; }
    .upgrade-page-title { font-size: 34px; }
    .upgrade-visual { min-height: 360px; }
  }
  @media (min-width: 700px) {
    .app-shell { max-width: 1200px; }
    .screen-auth-layout,
    .screen-welcome-layout,
    .quiz-layout,
    .generating-layout {
      width: min(100%, 520px);
      margin: 0 auto;
    }
    .dash-page { padding-left: 24px; padding-right: 24px; }
    .dash-header,
    .dash-nav { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  }
  @media (max-height: 740px) {
    .welcome-screen { justify-content: flex-start; }
    .generating-screen { justify-content: flex-start; }
  }

  /* ── Settings eyebrow ─────────────────────── */
  .settings-eyebrow {
    font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--accent); margin-bottom: 12px;
  }

  /* ── Toggle switch ────────────────────────── */
  .toggle-list { display: flex; flex-direction: column; gap: 0; }
  .toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border);
    font-size: 14px; color: var(--text); cursor: pointer;
  }
  .toggle-row:last-child { border-bottom: none; }
  .toggle-switch { position: relative; flex-shrink: 0; }
  .toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
  .toggle-track {
    display: block; width: 46px; height: 26px; border-radius: 99px;
    background: var(--border); transition: background 0.2s;
    position: relative;
  }
  .toggle-track::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18); transition: transform 0.2s;
  }
  .toggle-switch input:checked + .toggle-track { background: var(--primary); }
  .toggle-switch input:checked + .toggle-track::after { transform: translateX(20px); }

  /* ── Notifications screen ─────────────────── */
  #screen-dashboard { position: relative; }
  .notif-controls {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0; border-bottom: 1px solid var(--border); margin-bottom: 12px;
  }
  .notif-ctrl-btn {
    display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px;
    font-size: 12.5px; font-weight: 600; border: 1.5px solid var(--border);
    border-radius: 99px; background: var(--surface); color: var(--text);
    cursor: pointer; transition: background 0.14s;
  }
  .notif-ctrl-btn:hover { background: var(--surface2); }
  .notif-ctrl-danger { color: var(--red); border-color: var(--red-light); }
  .notif-enable-card {
    display: flex; align-items: flex-start; gap: 12px;
    background: rgba(216,82,48,0.07); border: 1px solid rgba(216,82,48,0.2);
    border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 16px;
  }
  .notif-enable-icon {
    flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
    background: rgba(216,82,48,0.12); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
  }
  .notif-empty-state {
    display: flex; flex-direction: column; align-items: center;
    border: 1.5px dashed var(--border); border-radius: var(--radius);
    padding: 36px 24px; margin-top: 8px; text-align: center;
  }
  .notif-empty-icon {
    width: 56px; height: 56px; border-radius: 50%; background: var(--surface2);
    display: flex; align-items: center; justify-content: center; color: var(--text-muted);
  }

  /* ── Shopping list ────────────────────────── */
  .shop-banner {
    display: flex; align-items: center; gap: 14px;
    background: var(--surface); border: 1.5px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px;
    width: 100%; text-align: left; cursor: pointer;
    transition: border-color 0.14s, background 0.14s;
    margin-bottom: 12px;
  }
  .shop-banner:hover { border-color: var(--primary); background: var(--primary-light); }
  .shop-banner-icon {
    width: 42px; height: 42px; border-radius: 12px;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .shop-category { margin-bottom: 20px; }
  .shop-cat-head {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
    color: var(--text-dim); padding: 0 0 8px;
    border-bottom: 1.5px solid var(--border); margin-bottom: 4px;
  }
  .shop-cat-count {
    background: var(--surface2); color: var(--text-muted);
    font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px;
  }
  .shop-item {
    display: flex; align-items: center; gap: 13px;
    width: 100%; padding: 13px 4px; border-bottom: 1px solid var(--border);
    background: none; border-left: none; border-right: none; border-top: none;
    text-align: left; cursor: pointer; transition: opacity 0.14s;
  }
  .shop-item:last-child { border-bottom: none; }
  .shop-item.checked { opacity: 0.45; }
  .shop-item.checked .shop-item-name { text-decoration: line-through; color: var(--text-muted); }
  .shop-cb {
    width: 22px; height: 22px; border-radius: 50%;
    border: 1.8px solid var(--border); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.14s, border-color 0.14s; color: #fff;
  }
  .shop-item.checked .shop-cb { background: var(--primary); border-color: var(--primary); }
  .shop-item-name { flex: 1; font-size: 14.5px; font-weight: 500; color: var(--text); }
  .shop-item-qty {
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    background: var(--surface2); padding: 3px 9px; border-radius: 99px; flex-shrink: 0;
  }

  /* ===== MEAL SWAP ===== */
  .swap-btn {
    color: var(--accent) !important;
    background: rgba(216, 82, 48, 0.09) !important;
  }
  .swap-btn:hover { background: rgba(216, 82, 48, 0.16) !important; }

  .swap-alt-card {
    border: 1.5px solid var(--border); border-radius: 14px;
    padding: 14px; margin-bottom: 10px; cursor: pointer;
    background: var(--surface); transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  }
  .swap-alt-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(27,62,43,0.10); }
  .swap-alt-card:active { transform: scale(0.985); }

  .swap-spinner {
    width: 36px; height: 36px; margin: 0 auto;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* Custom swap form */
  .cswap-divider {
    display: flex; align-items: center; gap: 10px;
    margin: 18px 0 14px; color: var(--text-dim); font-size: 11.5px; font-weight: 600;
  }
  .cswap-divider::before, .cswap-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
  }

  .cswap-custom-btn {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 16px; border-radius: 12px; cursor: pointer;
    border: 1.5px dashed var(--border); background: none;
    font-size: 14px; font-weight: 600; color: var(--text-muted);
    font-family: var(--sans); transition: border-color 0.15s, color 0.15s, background 0.15s;
    margin-bottom: 4px;
  }
  .cswap-custom-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

  .cswap-back-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 600; color: var(--text-muted);
    background: none; border: none; cursor: pointer; padding: 0;
    font-family: var(--sans); margin-bottom: 16px;
    transition: color 0.13s;
  }
  .cswap-back-btn:hover { color: var(--text); }

  .cswap-field { margin-bottom: 16px; }
  .cswap-label {
    font-size: 13px; font-weight: 700; color: var(--text);
    margin-bottom: 7px;
  }
  .cswap-input {
    width: 100%; padding: 11px 13px; border-radius: 10px;
    border: 1.5px solid var(--border); background: var(--surface);
    font-size: 14px; color: var(--text); font-family: var(--sans);
    outline: none; box-sizing: border-box; transition: border-color 0.15s;
  }
  .cswap-input:focus { border-color: var(--primary); }

  .cswap-pills {
    display: flex; gap: 8px; flex-wrap: wrap;
  }
  .cswap-pill {
    padding: 8px 14px; border-radius: 99px; border: 1.5px solid var(--border);
    background: var(--surface); font-size: 13px; font-weight: 600;
    color: var(--text-muted); cursor: pointer; font-family: var(--sans);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
  }
  .cswap-pill.active {
    border-color: var(--primary); background: var(--primary-light); color: var(--primary);
  }
  .cswap-pill:hover:not(.active) { border-color: var(--text-dim); color: var(--text); }

  .cswap-textarea {
    width: 100%; padding: 11px 13px; border-radius: 10px;
    border: 1.5px solid var(--border); background: var(--surface);
    font-size: 14px; color: var(--text); font-family: var(--sans);
    outline: none; box-sizing: border-box; resize: vertical;
    line-height: 1.5; transition: border-color 0.15s;
  }
  .cswap-textarea:focus { border-color: var(--primary); }

  /* ===== BADGE CELEBRATION ===== */
  .badge-cel-card {
    position: relative; z-index: 1;
    background: var(--surface); border-radius: 22px;
    padding: 32px 28px; width: 100%; max-width: 340px;
    text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,0.4);
  }
  .badge-cel-eyebrow {
    font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--accent); margin-bottom: 16px;
  }
  .badge-cel-emoji {
    font-size: 64px; line-height: 1; display: block; margin-bottom: 16px;
    animation: badge-pop 0.45s cubic-bezier(0.175,0.885,0.32,1.275) both;
  }
  @keyframes badge-pop {
    from { transform: scale(0.3) rotate(-15deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg); opacity: 1; }
  }
  .badge-cel-name {
    font-size: 22px; font-weight: 800; color: var(--text);
    font-family: var(--serif); margin-bottom: 6px;
  }
  .badge-cel-desc { font-size: 14px; color: var(--text-muted); }

  /* Confetti */
  .confetti-piece {
    position: absolute; top: -14px;
    animation: confetti-fall linear forwards;
  }
  @keyframes confetti-fall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
  }

  /* ===== BADGES GRID ===== */
  .badge-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
    padding: 4px 0;
  }
  .badge-tile {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    padding: 10px 4px; border-radius: 12px; text-align: center;
    transition: transform 0.15s;
  }
  .badge-tile.earned { background: var(--primary-light); }
  .badge-tile.locked { background: var(--surface2); opacity: 0.5; }
  .badge-tile-emoji { font-size: 24px; line-height: 1; }
  .badge-tile-name  { font-size: 9px; font-weight: 700; color: var(--text-muted); line-height: 1.3; }
  .badge-tile.earned .badge-tile-name { color: var(--primary); }
  .badge-tile.earned:hover { transform: scale(1.06); }

  /* ===== WEEKLY SUMMARY CARD ===== */
  .weekly-summary-card {
    background: var(--surface); border-radius: var(--r-lg);
    border: 1.5px solid var(--border);
    padding: 16px 18px; margin-bottom: 14px;
  }
  .weekly-summary-days {
    font-size: 26px; font-weight: 800; font-family: var(--serif);
    letter-spacing: -0.02em; line-height: 1;
  }
  .weekly-summary-bar-track {
    height: 5px; background: var(--surface2); border-radius: 99px;
    overflow: hidden; margin: 6px 0 4px;
  }
  .weekly-summary-bar-fill {
    height: 100%; border-radius: 99px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
  }

  /* ===== STREAK SHIELD BAR ===== */
  .streak-shield-bar {
    display: flex; align-items: center; gap: 12px;
    background: #FFF8EC; border: 1.5px solid #F0C040;
    border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 14px;
  }
  .streak-shield-btn {
    flex-shrink: 0; padding: 9px 14px; border-radius: 10px;
    background: #F0C040; border: none; cursor: pointer;
    font-size: 13px; font-weight: 700; color: #5A3E00;
    font-family: var(--sans); white-space: nowrap;
    transition: background 0.13s;
  }
  .streak-shield-btn:hover { background: #e6b800; }

  /* ===== REST DAY CARD ===== */
  .rest-day-card {
    display: flex; align-items: flex-start; gap: 14px;
    background: var(--primary-light); border-radius: 14px;
    padding: 16px; margin-bottom: 2px;
  }
  .rest-day-icon { font-size: 28px; line-height: 1; flex-shrink: 0; margin-top: 1px; }
  .rest-day-tip {
    font-size: 12.5px; color: var(--text-muted); line-height: 1.55;
    background: var(--surface); border-radius: 8px; padding: 8px 10px;
  }

  /* ===== ONBOARDING OVERLAY ===== */
  .onboard-card {
    background: var(--surface); border-radius: 24px;
    padding: 28px 24px; width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  }
  .onboard-dots {
    display: flex; justify-content: center; gap: 7px; margin-bottom: 22px;
  }
  .onboard-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--border-strong); transition: background 0.2s, width 0.2s;
  }
  .onboard-dot.active { background: var(--primary); width: 22px; border-radius: 4px; }
  .onboard-emoji { font-size: 52px; line-height: 1; margin-bottom: 16px; display: block; }
  .onboard-title {
    font-size: 22px; font-weight: 800; color: var(--text);
    font-family: var(--serif); margin-bottom: 10px; line-height: 1.2;
  }
  .onboard-body {
    font-size: 14.5px; color: var(--text-muted); line-height: 1.65;
  }
  .onboard-body strong { color: var(--text); font-weight: 700; }
  .onboard-card .btn { white-space: nowrap; }

  /* ===== TAB SWIPE ===== */
  .dash-page { animation: none; }
  .dash-page.active { animation: fade-in-tab 0.18s ease; }
  @keyframes fade-in-tab {
    from { opacity: 0.6; transform: translateY(4px); }
    to   { opacity: 1;   transform: translateY(0); }
  }

  /* ===== PHASE 3 — TRACKING ===== */

  /* Macro breakdown */
  .macro-row { margin-bottom: 12px; }
  .macro-row:last-child { margin-bottom: 0; }
  .macro-row-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
  .macro-row-name { font-size: 13px; font-weight: 600; color: var(--text); }
  .macro-row-val  { font-size: 12.5px; font-weight: 500; color: var(--text); }
  .macro-bar-track { height: 7px; border-radius: 4px; background: var(--surface2); overflow: hidden; }
  .macro-bar-fill  { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
  .macro-fill-protein { background: var(--green); }
  .macro-fill-carbs   { background: var(--amber); }
  .macro-fill-fat     { background: var(--accent); }

  /* Body measurements */
  .meas-input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .meas-field { display: flex; flex-direction: column; gap: 4px; }
  .meas-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
  .meas-input { font-size: 14px !important; padding: 10px 12px !important; }
  .meas-metric-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
  .meas-tab {
    padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: 600;
    border: 1.5px solid var(--border-strong); background: transparent;
    color: var(--text-muted); cursor: pointer; transition: all 0.15s;
  }
  .meas-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
  .meas-hist-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--border); }
  .meas-hist-row:first-child { border-top: none; padding-top: 4px; }
  .meas-hist-date { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }
  .meas-hist-vals { font-size: 13px; color: var(--text); font-weight: 500; line-height: 1.5; }

  /* Progress photos */
  .photos-card-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 10px; margin-bottom: 16px;
  }
  .photo-add-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: 22px; font-size: 13px; font-weight: 600;
    background: var(--primary); color: #fff;
    cursor: pointer; white-space: nowrap; flex-shrink: 0;
    border: none; transition: opacity 0.15s;
  }
  .photo-add-btn:hover { opacity: 0.88; }

  /* Empty state */
  .photo-empty-zone {
    display: flex; flex-direction: column; align-items: center;
    padding: 32px 20px 28px; border-radius: 16px;
    border: 2px dashed var(--border-strong);
    background: var(--surface2); cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
  }
  .photo-empty-zone:hover { border-color: var(--primary); background: var(--primary-light); }
  .photo-empty-icon { font-size: 44px; line-height: 1; margin-bottom: 12px; }
  .photo-empty-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; font-family: var(--serif); }
  .photo-empty-sub   { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }
  .photo-empty-btn   {
    display: inline-block; padding: 10px 22px; border-radius: 22px;
    background: var(--primary); color: #fff; font-size: 13.5px; font-weight: 600;
    pointer-events: none;
  }

  /* Before/After header */
  .photo-ba-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
  .photo-ba-title  { font-size: 13px; font-weight: 700; color: var(--text); }
  .photo-ba-count  { font-size: 12px; color: var(--text-muted); }

  /* Comparison grid */
  .photo-compare-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px;
  }
  .photo-compare-item { position: relative; border-radius: 14px; overflow: hidden; }
  .photo-compare-img  {
    width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block;
    border-radius: 14px;
  }
  .photo-img-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 28px 10px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.60) 0%, transparent 100%);
    border-radius: 0 0 14px 14px;
    display: flex; align-items: flex-end; justify-content: space-between;
  }
  .photo-img-badge {
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em;
    background: rgba(255,255,255,0.22); backdrop-filter: blur(6px);
    color: #fff; padding: 3px 8px; border-radius: 20px; text-transform: uppercase;
  }
  .photo-img-badge-green { background: rgba(76,200,122,0.55); }
  .photo-img-date { font-size: 10px; color: rgba(255,255,255,0.75); font-weight: 500; }

  .photo-del-btn {
    position: absolute; top: 8px; right: 8px;
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(0,0,0,0.48); backdrop-filter: blur(4px); color: #fff;
    border: none; font-size: 11px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
  }
  .photo-del-btn:hover { background: rgba(220,60,60,0.70); }

  /* Single photo */
  .photo-single-wrap { position: relative; border-radius: 14px; overflow: hidden; max-width: 50%; }
  .photo-add-more-hint {
    font-size: 12.5px; color: var(--text-muted); text-align: center;
    padding: 10px 0 4px; line-height: 1.5;
  }

  /* All photos strip */
  .photo-all-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 4px 0 8px; }
  .photo-mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .photo-mini-wrap { position: relative; border-radius: 10px; overflow: hidden; }
  .photo-mini-img  { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
  .photo-mini-date { font-size: 10px; color: var(--text-dim); text-align: center; margin-top: 3px; }
  .photo-mini-del  {
    position: absolute; top: 4px; right: 4px;
    width: 20px; height: 20px; border-radius: 50%;
    background: rgba(0,0,0,0.46); color: #fff;
    border: none; font-size: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
  }
  .photo-mini-del:hover { background: rgba(220,60,60,0.70); }

  /* Plan tab empty state */
  .plan-empty-state {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; padding: 48px 24px 40px;
    background: var(--surface); border-radius: var(--radius);
    margin: 4px 0;
  }
  .plan-empty-icon  { font-size: 52px; line-height: 1; margin-bottom: 16px; }
  .plan-empty-title {
    font-size: 22px; font-weight: 800; color: var(--text);
    font-family: var(--serif); margin-bottom: 10px; letter-spacing: -0.02em;
  }
  .plan-empty-sub {
    font-size: 14.5px; color: var(--text-muted); line-height: 1.65;
    max-width: 300px; margin-bottom: 24px;
  }

  /* Dark mode — Phase 3 */
  html[data-theme="dark"] .macro-bar-track { background: var(--surface2); }
  html[data-theme="dark"] .meas-tab { border-color: var(--border-strong); color: var(--text-muted); }
  html[data-theme="dark"] .meas-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
