    :root {
      --bg: #09090b;
      --surface: rgba(24,24,27,0.65);
      --surface-solid: #18181b;
      --surface-hover: rgba(39,39,42,0.8);
      --border: rgba(63,63,70,0.4);
      --border-glow: rgba(16,185,129,0.3);
      --text: #f4f4f5;
      --muted: #a1a1aa;
      --green: #10b981;
      --green-glow: rgba(16,185,129,0.2);
      --orange: #f59e0b;
      --purple: #8b5cf6;
      --cyan: #06b6d4;
      --danger: #ef4444;
      --font: 'Inter', sans-serif;
      --font2: 'Space Grotesk', sans-serif;
      --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
      --glass-blur: blur(12px);
    }
    * { margin:0; padding:0; box-sizing:border-box; }
    body {
      font-family: var(--font);
      background-color: var(--bg);
      color: var(--text);
      min-height: 100vh;
      overflow-x: hidden;
      -webkit-font-smoothing: antialiased;
      background-image:
        radial-gradient(circle at 15% 50%, rgba(16,185,129,0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139,92,246,0.05), transparent 25%);
    }
    h1,h2,h3,h4 { font-family: var(--font2); }
    a { text-decoration:none; color:inherit; }
    .btn { cursor:pointer; border:none; font-family:var(--font); transition:var(--transition); border-radius:10px; font-weight:600; display:inline-flex; align-items:center; justify-content:center; }
    .btn-ghost { background:transparent; color:var(--muted); border:1px solid transparent; }
    .btn-ghost:hover { background:var(--surface-hover); color:var(--text); border-color:var(--border); }

    .nav {
      position:fixed; top:0; width:100%; height:72px; z-index:100;
      background:rgba(9,9,11,0.7); backdrop-filter:var(--glass-blur); -webkit-backdrop-filter:var(--glass-blur);
      border-bottom:1px solid var(--border);
    }
    .nav-inner { max-width:1400px; margin:0 auto; height:100%; display:flex; align-items:center; padding:0 24px; justify-content:space-between; }
    .nav-logo { display:flex; align-items:center; gap:10px; font-family:var(--font2); font-weight:700; font-size:20px; letter-spacing:-0.5px; color:var(--text); }
    .nav-logo span { color:var(--green); }
    .nav-logo-icon { display:flex; align-items:center; justify-content:center; width:36px; height:36px; background:var(--green-glow); border-radius:10px; border:1px solid var(--border-glow); }

    .dash-layout { display:grid; grid-template-columns:280px 1fr; min-height:100vh; padding-top:72px; max-width:1400px; margin:0 auto; }

    .dash-sidebar {
      padding:32px 24px; position:sticky; top:72px; height:calc(100vh - 72px);
      overflow-y:auto; border-right:1px solid var(--border);
    }
    .dash-avatar-wrap { display:flex; align-items:center; gap:16px; margin-bottom:40px; padding:16px; background:var(--surface); border:1px solid var(--border); border-radius:16px; backdrop-filter:var(--glass-blur); }
    .dash-avatar { width:48px; height:48px; border-radius:14px; background:linear-gradient(135deg,var(--green),var(--cyan)); display:flex; align-items:center; justify-content:center; font-size:20px; font-weight:800; color:#000; flex-shrink:0; box-shadow:0 4px 20px rgba(16,185,129,0.3); }
    .dash-user-name { font-weight:700; font-size:15px; letter-spacing:-0.3px; }
    .dash-user-email { font-size:13px; color:var(--muted); margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:160px; }

    .dash-nav { display:flex; flex-direction:column; gap:8px; }
    .dash-nav-item { display:flex; align-items:center; gap:14px; padding:14px 18px; border-radius:12px; font-size:15px; font-weight:500; color:var(--muted); transition:var(--transition); cursor:pointer; border:1px solid transparent; }
    .dash-nav-item:hover { background:var(--surface-hover); color:var(--text); }
    .dash-nav-item.active { background:var(--green-glow); color:var(--green); font-weight:600; border-color:rgba(16,185,129,0.2); }

    .dash-main { padding:48px 40px; max-width:960px; width:100%; margin:0 auto; }
    .dash-tab { display:none; animation:fadeIn 0.4s ease forwards; }
    .dash-tab.active { display:block; }
    @keyframes fadeIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

    .dash-title { font-size:32px; font-weight:700; margin-bottom:8px; letter-spacing:-1px; }
    .dash-subtitle { font-size:20px; font-weight:700; margin:40px 0 16px; letter-spacing:-0.5px; }

    .wallet-balance-card {
      background:linear-gradient(135deg,rgba(16,185,129,0.1),rgba(6,182,212,0.05));
      border:1px solid var(--border-glow); border-radius:24px; padding:48px 32px;
      text-align:center; margin-bottom:24px; display:flex; flex-direction:column; align-items:center; gap:12px;
      position:relative; overflow:hidden; box-shadow:0 10px 40px rgba(0,0,0,0.2);
    }
    .wallet-balance-num { font-family:var(--font2); font-size:64px; font-weight:800; background:linear-gradient(to right,#10b981,#06b6d4); -webkit-background-clip:text; -webkit-text-fill-color:transparent; line-height:1; }

    .wallet-costs-card { background:var(--surface); border:1px solid var(--border); border-radius:20px; padding:24px; margin-bottom:40px; backdrop-filter:var(--glass-blur); }
    .wallet-costs-title { font-weight:700; font-size:15px; margin-bottom:20px; }
    .cost-row { display:flex; justify-content:space-between; align-items:center; padding:12px 0; font-size:14px; color:var(--muted); border-bottom:1px solid rgba(255,255,255,0.03); }
    .cost-row:last-of-type { border-bottom:none; }
    .cost-row span:first-child { display:flex; align-items:center; gap:8px; }
    .cost-badge { font-family:var(--font2); font-size:12px; font-weight:700; padding:4px 10px; border-radius:8px; letter-spacing:0.5px; }
    .cost-badge.green  { background:rgba(16,185,129,0.15); color:var(--green); border:1px solid rgba(16,185,129,0.2); }
    .cost-badge.orange { background:rgba(245,158,11,0.15); color:var(--orange); border:1px solid rgba(245,158,11,0.2); }
    .cost-badge.purple { background:rgba(139,92,246,0.15); color:var(--purple); border:1px solid rgba(139,92,246,0.2); }
    .cost-note { font-size:13px; color:var(--green); margin-top:16px; padding-top:16px; border-top:1px solid var(--border); display:flex; align-items:center; gap:8px; }

    .pack-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:16px; margin-bottom:40px; }
    .pack-card { display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:16px; background:var(--surface); border:1px solid var(--border); border-radius:20px; padding:32px 24px; cursor:pointer; transition:var(--transition); position:relative; backdrop-filter:var(--glass-blur); }
    .pack-card:hover { border-color:rgba(16,185,129,0.4); transform:translateY(-4px); box-shadow:0 12px 24px rgba(0,0,0,0.3),0 0 20px rgba(16,185,129,0.1); background:var(--surface-hover); }
    .pack-popular { border-color:rgba(245,158,11,0.4); background:linear-gradient(180deg,rgba(245,158,11,0.05),var(--surface)); }
    .pack-popular:hover { border-color:var(--orange); box-shadow:0 12px 24px rgba(0,0,0,0.3),0 0 20px rgba(245,158,11,0.15); }
    .pack-popular-badge { position:absolute; top:-12px; background:linear-gradient(135deg,#f59e0b,#ef4444); color:#fff; font-size:11px; font-weight:800; letter-spacing:1px; padding:4px 16px; border-radius:100px; box-shadow:0 4px 10px rgba(245,158,11,0.3); }
    .pack-left { display:flex; flex-direction:column; gap:6px; align-items:center; }
    .pack-tokens { font-family:var(--font2); font-weight:700; font-size:22px; color:var(--text); }
    .pack-label { font-size:13px; color:var(--muted); text-transform:uppercase; letter-spacing:1px; font-weight:600; }
    .pack-btn { background:rgba(255,255,255,0.05); color:var(--text); border:1px solid var(--border); border-radius:12px; padding:10px 24px; font-weight:700; font-size:16px; cursor:pointer; transition:var(--transition); width:100%; font-family:var(--font); }
    .pack-card:hover .pack-btn { background:var(--text); color:var(--bg); }
    .pack-btn.orange { background:var(--orange); color:#fff; border:none; }
    .pack-popular:hover .pack-btn.orange { background:#fbbf24; color:#000; }

    .legal-card { background:transparent; border:1px dashed var(--border); border-radius:16px; padding:20px; }
    .legal-title { font-size:14px; font-weight:600; margin-bottom:10px; color:var(--muted); }
    .legal-card p { font-size:13px; color:#71717a; line-height:1.6; }
    .legal-card a { color:var(--green); font-weight:500; }

    .tx-list { display:flex; flex-direction:column; gap:12px; }
    .tx-row { display:flex; align-items:center; gap:16px; background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:16px 20px; transition:var(--transition); }
    .tx-row:hover { background:var(--surface-hover); transform:translateX(4px); }
    .tx-icon { font-size:24px; flex-shrink:0; background:rgba(255,255,255,0.05); width:48px; height:48px; display:flex; align-items:center; justify-content:center; border-radius:12px; }
    .tx-info { flex:1; display:flex; flex-direction:column; gap:4px; }
    .tx-note { font-size:15px; font-weight:600; color:var(--text); }
    .tx-date { font-size:12px; color:var(--muted); }
    .tx-right { display:flex; flex-direction:column; align-items:flex-end; gap:4px; }
    .tx-amount { font-family:var(--font2); font-size:18px; font-weight:700; }
    .tx-bal { font-size:12px; color:var(--muted); }

    .profile-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:16px; }
    .profile-row { display:flex; flex-direction:column; gap:6px; background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:20px; transition:var(--transition); }
    .profile-row:hover { border-color:rgba(255,255,255,0.2); }
    .profile-key { font-size:13px; color:var(--muted); text-transform:uppercase; letter-spacing:0.5px; font-weight:600; }
    .profile-val { font-size:16px; font-weight:500; color:var(--text); }

    .history-day-card {
      background:linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
      border:1px solid var(--border);
      border-radius:22px;
      overflow:hidden;
      margin-bottom:16px;
      box-shadow:0 14px 40px rgba(0,0,0,0.18);
      backdrop-filter:var(--glass-blur);
    }
    .history-day-header,
    .history-meal-header {
      width:100%;
      background:transparent;
      border:none;
      color:inherit;
      font:inherit;
      text-align:left;
    }
    .history-day-header {
      display:flex;
      justify-content:space-between;
      align-items:center;
      gap:18px;
      padding:20px;
      cursor:pointer;
      transition:var(--transition);
    }
    .history-day-header:hover { background:rgba(255,255,255,0.025); }
    .history-day-copy { min-width:0; }
    .history-day-label {
      font-family:var(--font2);
      font-weight:700;
      font-size:16px;
      margin-bottom:10px;
      letter-spacing:-0.3px;
    }
    .history-day-macros { display:flex; gap:8px; flex-wrap:wrap; }
    .history-day-toggle { display:flex; align-items:center; gap:12px; flex-shrink:0; }
    .history-day-count { font-size:13px; color:var(--muted); font-weight:600; white-space:nowrap; }
    .history-chevron {
      width:18px;
      height:18px;
      display:inline-flex;
      align-items:center;
      justify-content:center;
      color:var(--muted);
      transition:transform 0.24s ease, color 0.24s ease;
    }
    .history-chevron svg {
      width:18px;
      height:18px;
      stroke:currentColor;
      fill:none;
      stroke-width:1.8;
      stroke-linecap:round;
      stroke-linejoin:round;
    }
    .history-day-card.open .history-day-chevron,
    .history-meal-group.open .history-meal-chevron {
      color:var(--text);
      transform:rotate(180deg);
    }
    .history-day-body,
    .history-meal-body,
    .history-scan-items {
      display:grid;
      grid-template-rows:0fr;
      transition:grid-template-rows 0.3s ease;
    }
    .history-day-card.open .history-day-body,
    .history-meal-group.open .history-meal-body,
    .history-scan-card.open .history-scan-items {
      grid-template-rows:1fr;
    }
    .history-day-card.open .history-day-body { border-top:1px solid rgba(255,255,255,0.06); }
    .history-day-body-inner,
    .history-meal-body-inner,
    .history-scan-items-inner { overflow:hidden; }
    .history-day-body-inner {
      padding:4px 12px 14px;
      background:linear-gradient(180deg, rgba(0,0,0,0.18), rgba(0,0,0,0.1));
    }
    .history-meal-group {
      border-bottom:1px solid rgba(255,255,255,0.05);
      padding:4px 4px 0;
    }
    .history-meal-group:last-child { border-bottom:none; }
    .history-meal-header {
      display:flex;
      justify-content:space-between;
      align-items:center;
      gap:16px;
      padding:14px 10px;
      cursor:pointer;
      transition:var(--transition);
      border-radius:16px;
    }
    .history-meal-header:hover { background:rgba(255,255,255,0.025); }
    .history-meal-copy { min-width:0; }
    .history-meal-label { font-size:14px; font-weight:700; color:var(--text); }
    .history-meal-count { font-size:12px; color:var(--muted); margin-top:4px; }
    .history-meal-actions {
      display:flex;
      align-items:center;
      justify-content:flex-end;
      gap:10px;
      flex-shrink:0;
    }
    .history-meal-body-inner {
      display:flex;
      flex-direction:column;
      gap:12px;
      padding:0 0 14px 12px;
    }
    .history-scan-card {
      border:1px solid rgba(255,255,255,0.06);
      border-radius:20px;
      overflow:hidden;
      background:rgba(255,255,255,0.025);
      box-shadow:0 10px 26px rgba(0,0,0,0.18);
      transition:border-color 0.24s ease, transform 0.24s ease, box-shadow 0.24s ease;
    }
    .history-scan-card.open {
      border-color:rgba(255,255,255,0.12);
      box-shadow:0 18px 34px rgba(0,0,0,0.24);
    }
    .history-scan-summary {
      position:relative;
      cursor:pointer;
      outline:none;
      overflow:hidden;
    }
    .history-scan-summary:focus-visible {
      box-shadow:inset 0 0 0 1px var(--border-glow), 0 0 0 3px rgba(16,185,129,0.16);
    }
    .history-scan-card-photo .history-scan-summary {
      min-height:188px;
      display:flex;
      align-items:flex-end;
    }
    .history-scan-image {
      position:absolute;
      inset:0;
      width:100%;
      height:100%;
      object-fit:cover;
    }
    .history-scan-scrim {
      position:absolute;
      inset:0;
      background:linear-gradient(180deg, rgba(0,0,0,0.16), rgba(0,0,0,0.04) 38%, rgba(9,9,11,0.92));
    }
    .history-scan-toolbar {
      position:absolute;
      top:12px;
      right:12px;
      display:flex;
      gap:8px;
      z-index:2;
    }
    .history-icon-btn {
      width:40px;
      height:40px;
      display:inline-flex;
      align-items:center;
      justify-content:center;
      border-radius:999px;
      border:1px solid rgba(255,255,255,0.12);
      background:rgba(0,0,0,0.45);
      color:#fff;
      cursor:pointer;
      transition:transform 0.24s ease, background 0.24s ease, border-color 0.24s ease;
      backdrop-filter:blur(10px);
      -webkit-backdrop-filter:blur(10px);
    }
    .history-icon-btn:hover {
      transform:translateY(-1px);
      background:rgba(0,0,0,0.62);
      border-color:rgba(255,255,255,0.2);
    }
    .history-icon-btn svg {
      width:18px;
      height:18px;
      stroke:currentColor;
      fill:none;
      stroke-width:1.85;
      stroke-linecap:round;
      stroke-linejoin:round;
      transition:transform 0.24s ease;
    }
    .history-scan-card.open .history-scan-toggle-btn svg { transform:rotate(180deg); }
    .history-scan-footer {
      position:relative;
      z-index:1;
      width:100%;
      display:flex;
      justify-content:space-between;
      align-items:flex-end;
      gap:12px;
      padding:16px;
    }
    .history-scan-title {
      font-size:16px;
      font-weight:700;
      line-height:1.2;
      letter-spacing:-0.25px;
    }
    .history-scan-card-photo .history-scan-title {
      color:#fff;
      text-shadow:0 3px 14px rgba(0,0,0,0.45);
    }
    .history-scan-macros {
      display:flex;
      flex-wrap:wrap;
      gap:6px;
      align-items:center;
    }
    .history-scan-card-plain .history-scan-summary {
      display:flex;
      justify-content:space-between;
      align-items:center;
      gap:16px;
      padding:14px 16px;
      background:rgba(255,255,255,0.03);
    }
    .history-scan-plain-copy { flex:1; min-width:0; }
    .history-scan-card-plain .history-scan-title {
      color:var(--text);
      margin-bottom:8px;
    }
    .history-scan-card-plain .history-icon-btn {
      background:rgba(255,255,255,0.06);
      color:var(--text);
      border-color:rgba(255,255,255,0.08);
    }
    .history-scan-card-plain .history-icon-btn:hover {
      background:rgba(255,255,255,0.11);
      border-color:rgba(255,255,255,0.14);
    }
    .history-scan-card.open .history-scan-items { border-top:1px solid rgba(255,255,255,0.06); }
    .history-log-row {
      display:flex;
      justify-content:space-between;
      align-items:center;
      gap:14px;
      padding:14px 16px;
      border-bottom:1px solid rgba(255,255,255,0.05);
    }
    .history-log-row:last-child { border-bottom:none; }
    .history-log-main { flex:1; min-width:0; }
    .history-log-name { font-size:14px; font-weight:600; color:var(--text); }
    .history-log-qty  { font-size:12px; color:var(--muted); margin-top:4px; }
    .history-log-macros {
      display:flex;
      gap:8px;
      flex-wrap:wrap;
      justify-content:flex-end;
      align-items:center;
    }
    .macro-chip {
      font-family:var(--font2);
      font-size:11px;
      font-weight:700;
      padding:5px 10px;
      border-radius:999px;
      letter-spacing:0.2px;
      border:1px solid transparent;
    }
    .macro-chip.orange { background:rgba(245,158,11,0.1); color:var(--orange); border-color:rgba(245,158,11,0.2); }
    .macro-chip.green  { background:rgba(16,185,129,0.1);  color:var(--green);  border-color:rgba(16,185,129,0.2); }
    .macro-chip.purple { background:rgba(139,92,246,0.1);  color:var(--purple); border-color:rgba(139,92,246,0.2); }
    .history-log-action-btn {
      width:36px;
      height:36px;
      display:inline-flex;
      align-items:center;
      justify-content:center;
      padding:0;
      border-radius:12px;
      border:1px solid rgba(255,255,255,0.08);
      background:rgba(255,255,255,0.06);
      color:var(--text);
      cursor:pointer;
      transition:var(--transition);
      font-size:15px;
      line-height:1;
    }
    .history-log-action-btn:hover {
      transform:translateY(-1px);
      border-color:rgba(255,255,255,0.16);
      background:rgba(255,255,255,0.1);
    }
    .log-edit-btn { opacity:1; }
    .log-del-btn {
      background:rgba(239,68,68,0.1);
      border-color:rgba(239,68,68,0.18);
      color:var(--danger);
    }
    .log-del-btn:hover {
      background:rgba(239,68,68,0.18);
      border-color:rgba(239,68,68,0.28);
    }

    .admin-loading { display:flex; justify-content:center; align-items:center; padding:60px; }
    .pay-spinner { width:40px; height:40px; border:3px solid rgba(255,255,255,0.1); border-top-color:var(--green); border-radius:50%; animation:spin 1s linear infinite; }
    @keyframes spin { to { transform:rotate(360deg); } }

    #pay-modal { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.8); backdrop-filter:blur(8px); z-index:999; align-items:center; justify-content:center; padding:20px; }
    #pay-modal.open { display:flex; }
    .pay-modal-box { background:var(--surface-solid); border:1px solid var(--border); border-radius:24px; width:100%; max-width:440px; position:relative; box-shadow:0 24px 60px rgba(0,0,0,0.5); animation:modalPop 0.4s cubic-bezier(0.16,1,0.3,1); overflow:hidden; }
    @keyframes modalPop { 0%{opacity:0;transform:scale(0.95) translateY(20px)} 100%{opacity:1;transform:scale(1) translateY(0)} }
    .pay-modal-close { position:absolute; top:20px; right:20px; background:rgba(255,255,255,0.1); border:none; color:var(--text); width:32px; height:32px; border-radius:50%; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:var(--transition); z-index:10; font-size:16px; }
    .pay-modal-close:hover { background:var(--danger); color:white; }
    #pay-modal-body { padding:32px; }
    .pay-loading { display:flex; flex-direction:column; align-items:center; gap:16px; padding:20px; color:var(--muted); }
    .pay-login-prompt,.pay-success,.pay-error { display:flex; flex-direction:column; align-items:center; gap:16px; text-align:center; }
    .pay-modal-icon { font-size:48px; }
    .pay-login-prompt h3,.pay-success h3 { font-size:20px; font-weight:700; }
    .pay-login-prompt p,.pay-success p,.pay-error p { color:var(--muted); font-size:14px; }
    .pay-pack-preview { display:flex; gap:12px; align-items:center; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:12px 20px; font-weight:600; }
    .pay-pack-price { color:var(--green); }
    .pay-google-btn { width:100%; padding:14px; gap:10px; background:rgba(255,255,255,0.08); border:1px solid var(--border); border-radius:12px; color:var(--text); font-size:15px; font-weight:600; cursor:pointer; font-family:var(--font); transition:var(--transition); display:flex; align-items:center; justify-content:center; }
    .pay-google-btn:hover { background:rgba(255,255,255,0.15); }
    .btn-primary { background:var(--green); color:#000; padding:12px 24px; font-size:15px; border-radius:12px; font-weight:700; cursor:pointer; border:none; font-family:var(--font); transition:var(--transition); }
    .btn-primary:hover { background:#0ea572; }
    .btn-outline { background:transparent; color:var(--text); padding:12px 24px; font-size:15px; border-radius:12px; font-weight:600; cursor:pointer; border:1px solid var(--border); font-family:var(--font); transition:var(--transition); }
    .btn-outline:hover { background:var(--surface-hover); }
    .pay-success-sub { font-size:13px; color:var(--muted); }

    @media(max-width:768px) {
      .nav-inner .nav-logo { gap: 2% !important; padding-right: 4% !important; } /* 2% gap, 4% padding */
      .nav-inner .nav-logo span.logo-space { display: none !important; margin: 0 !important; padding: 0 !important; width: 0 !important; }
      .nav-inner .nav-logo-icon { margin-right:6px !important; }
      .nav-inner > div { padding-right: 50px !important; } /* Push the entire right-side block left away from absolute FAB */
      .signout-text { display:none; }
      .dash-signout-btn { display:none !important; } /* Replaced by FAB on mobile */
      .dash-layout { display:block; padding-top:72px; padding-bottom:96px; }
      .dash-sidebar { position:fixed; bottom:0; top:auto; left:0; width:100%; height:auto; padding:8px 12px; padding-bottom:calc(8px + env(safe-area-inset-bottom)); background:rgba(24,24,27,0.92); backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px); border-right:none; border-top:1px solid var(--border); z-index:90; display:flex; justify-content:center; }
      .dash-avatar-wrap { display:none; }
      /* Sign-out as a floating icon under the topnav on mobile */
      .mobile-signout-fab { display:flex !important; }
      .dash-nav { 
        flex-direction:row; gap:4px; width:100%; 
        justify-content:flex-start; overflow-x:auto; overflow-y:hidden; 
        scroll-snap-type: x mandatory; padding-bottom:8px; margin-bottom:-8px;
        -webkit-overflow-scrolling: touch; 
      }
      .dash-nav::-webkit-scrollbar { display:none; }
      .dash-nav-item { 
        flex-direction:column; gap:2px; padding:8px 2px; font-size:10px; 
        font-weight:600; border-radius:10px; flex:0 0 72px; 
        text-align:center; justify-content:center; scroll-snap-align: start; 
      }
      .dash-nav-item span:first-child { font-size:20px; }
      /* Force display all tabs so user can scroll to them */
      .dash-nav-item.mobile-hidden { display:flex; }
      
      /* Reorder Mobile Navigation */
      .nav-home { order: 1; }
      .nav-history { order: 2; }
      .nav-wallet { order: 3; }
      .nav-transactions { order: 4; }
      .nav-profile { order: 5; }
      .nav-mealplan { order: 6; }
      .nav-workout { order: 7; }
      .nav-aria { order: 8; }
      
      .logo-space { display: none; }

      .dash-main { padding:24px 16px; }
      .dash-title { font-size:28px; }
      .wallet-balance-card { padding:32px 20px; }
      .wallet-balance-num { font-size:52px; }
      .pack-list { grid-template-columns:1fr; }
      
      /* Premium Mobile History View */
      .history-day-card { border-radius: 20px; }
      .history-day-header {
        padding: 18px 16px;
        align-items: flex-start;
      }
      .history-day-label { font-size: 15px; margin-bottom: 8px; }
      .history-day-toggle {
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
      }
      .history-day-body-inner { padding: 2px 8px 12px; }
      .history-meal-header { padding: 12px 8px; }
      .history-meal-body-inner {
        padding: 0 0 10px 4px;
        gap: 10px;
      }
      .history-scan-card { border-radius: 18px; }
      .history-scan-card-photo .history-scan-summary { min-height: 170px; }
      .history-scan-toolbar {
        top: 10px;
        right: 10px;
      }
      .history-icon-btn {
        width: 38px;
        height: 38px;
      }
      .history-scan-footer {
        padding: 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
      }
      .history-scan-title { font-size: 15px; }
      .history-scan-card-plain .history-scan-summary { padding: 14px; }
      .history-scan-macros { width: 100%; }
      .history-log-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px;
        gap: 12px;
      }
      .history-log-macros { width: 100%; justify-content: flex-start; }
      .history-log-action-btn {
        width: 38px;
        height: 38px;
      }
      
      /* Mobile Transaction History Optimization */
      .tx-row { padding: 14px 16px; gap: 12px; }
      .tx-icon { width: 40px; height: 40px; font-size: 20px; border-radius: 10px; }
      .tx-note { font-size: 14px; }
      .tx-amount { font-size: 16px; }
    }
    .pagination-bar { display:flex; gap:6px; justify-content:center; margin-top:20px; flex-wrap:wrap; }
    .pg-btn { background:var(--surface); border:1px solid var(--border); color:var(--muted); border-radius:8px; padding:6px 14px; font-size:13px; font-weight:600; cursor:pointer; font-family:var(--font); transition:var(--transition); }
    .pg-btn:hover:not([disabled]) { border-color:var(--green); color:var(--green); }
    .pg-btn.pg-active { background:rgba(16,185,129,0.15); border-color:var(--green); color:var(--green); }
    .pg-btn[disabled] { opacity:0.3; cursor:default; }

    /* Mobile sign-out FAB — hidden on desktop */
    .mobile-signout-fab {
      display:none;
      position:fixed;
      top:14px;
      right:16px;
      z-index:200;
      background:transparent;
      border:none;
      padding:10px 14px;
      font-size:24px;
      cursor:pointer;
      line-height:1;
    }

    @media(max-width:480px) {
      .nav-inner { padding:0 16px; }
      .cost-row { flex-direction:column; align-items:flex-start; gap:8px; }
    }

    /* ── HOME TAB ── */
    .home-greeting { font-size:28px; font-weight:800; letter-spacing:-0.8px; margin-bottom:4px; }
    .home-date { font-size:14px; color:var(--muted); margin-bottom:32px; }

    .home-macro-row { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin-bottom:24px; }
    .home-macro-card {
      background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:16px 12px;
      display:flex; flex-direction:column; align-items:center; gap:8px; text-align:center;
      backdrop-filter:var(--glass-blur); transition:var(--transition);
    }
    .home-macro-card:hover { border-color:rgba(255,255,255,0.15); }
    .home-macro-ring { position:relative; width:72px; height:72px; flex-shrink:0; }
    .home-macro-ring svg { width:72px; height:72px; transform:rotate(-90deg); }
    .home-macro-ring-label { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); display:flex; flex-direction:column; align-items:center; line-height:1; }
    .home-macro-ring-val { font-family:var(--font2); font-size:14px; font-weight:800; }
    .home-macro-ring-pct { font-size:9px; color:var(--muted); font-weight:600; }
    .home-macro-name { font-size:12px; color:var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:0.5px; }
    .home-macro-sub { font-size:11px; color:var(--muted); }

    .home-cal-card {
      background:linear-gradient(135deg,rgba(16,185,129,0.08),rgba(6,182,212,0.04));
      border:1px solid var(--border-glow); border-radius:20px; padding:24px;
      display:flex; align-items:center; gap:20px; margin-bottom:24px;
    }
    .home-cal-big { font-family:var(--font2); font-size:56px; font-weight:800;
      background:linear-gradient(to right,#10b981,#06b6d4); -webkit-background-clip:text; -webkit-text-fill-color:transparent; line-height:1; }
    .home-cal-info { flex:1; }
    .home-cal-label { font-size:13px; color:var(--muted); text-transform:uppercase; letter-spacing:0.5px; font-weight:600; margin-bottom:4px; }
    .home-cal-target { font-size:14px; color:var(--text); font-weight:500; }
    .home-cal-remain { font-size:13px; color:var(--green); font-weight:600; margin-top:2px; }

    .home-progress-bar { width:100%; height:6px; background:rgba(255,255,255,0.07); border-radius:3px; overflow:hidden; margin-top:12px; }
    .home-progress-fill { height:100%; border-radius:3px; transition:width 0.8s cubic-bezier(0.4,0,0.2,1); }

    .home-scan-btn {
      background: linear-gradient(135deg, var(--green), var(--cyan)); color: #000;
      border: none; border-radius: 14px; padding: 12px 20px; cursor: pointer;
      display: flex; align-items: center; gap: 8px; flex-shrink: 0;
      box-shadow: 0 8px 24px rgba(16,185,129,0.25); transition: var(--transition);
    }
    .home-scan-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(16,185,129,0.4); }
    @media(max-width: 640px) {
      .home-cal-card { flex-direction: column; align-items: stretch; text-align: center; gap: 16px; padding: 20px; }
      .home-scan-btn { justify-content: center; padding: 14px; }
    }

    .home-log-title { font-family:var(--font2); font-size:18px; font-weight:700; margin-bottom:16px; letter-spacing:-0.3px; }
    .home-log-list { display:flex; flex-direction:column; gap:10px; }
    .home-log-item {
      display:flex; align-items:center; gap:12px; background:var(--surface); border:1px solid var(--border);
      border-radius:14px; padding:14px 16px; transition:var(--transition);
    }
    .home-log-item:hover { background:var(--surface-hover); border-color:rgba(255,255,255,0.12); }
    .home-log-icon { font-size:20px; width:40px; height:40px; display:flex; align-items:center; justify-content:center;
      background:rgba(255,255,255,0.05); border-radius:10px; flex-shrink:0; }
    .home-log-info { flex:1; }
    .home-log-name { font-size:14px; font-weight:600; color:var(--text); }
    .home-log-time { font-size:12px; color:var(--muted); margin-top:2px; }
    .home-log-chips { display:flex; gap:5px; flex-wrap:wrap; }
    .home-empty { display:flex; flex-direction:column; align-items:center; padding:48px 20px; text-align:center; }
    .home-empty-icon { font-size:48px; margin-bottom:12px; }
    .home-empty-text { color:var(--muted); font-size:15px; }
    .home-log-thumb {
      width:44px; height:44px; border-radius:10px; object-fit:cover; flex-shrink:0;
      border:1px solid var(--border);
    }
    .history-log-thumb {
      width:48px; height:48px; border-radius:10px; object-fit:cover; flex-shrink:0;
      border:1px solid var(--border); margin-right:4px;
    }

    /* ── PROFILE REDESIGN ── */
    .prof-card { display:flex; flex-direction:column; gap:0; max-width:600px; }
    .prof-empty { display:flex; flex-direction:column; align-items:center; padding:60px 20px; text-align:center; }

    .prof-header {
      display:flex; align-items:center; gap:16px;
      background:linear-gradient(135deg,rgba(16,185,129,0.08),rgba(139,92,246,0.05));
      border:1px solid var(--border-glow); border-radius:20px; padding:20px;
      margin-bottom:16px;
    }
    .prof-avatar {
      width:60px; height:60px; border-radius:18px; flex-shrink:0;
      background:linear-gradient(135deg,var(--green),var(--cyan));
      display:flex; align-items:center; justify-content:center;
      font-size:26px; font-weight:800; color:#000;
      box-shadow:0 4px 20px rgba(16,185,129,0.3);
    }
    .prof-header-info { flex:1; min-width:0; }
    .prof-name { font-family:var(--font2); font-size:18px; font-weight:700; letter-spacing:-0.3px; }
    .prof-email { font-size:13px; color:var(--muted); margin-top:3px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .prof-edit-btn {
      background:rgba(16,185,129,0.12); border:1px solid rgba(16,185,129,0.3);
      color:var(--green); border-radius:10px; padding:8px 16px;
      font-size:13px; font-weight:700; cursor:pointer; white-space:nowrap;
      font-family:var(--font); transition:var(--transition); text-decoration:none; display:inline-flex; align-items:center;
    }
    .prof-edit-btn:hover { background:rgba(16,185,129,0.2); }

    .prof-rings {
      display:grid; grid-template-columns:repeat(3,1fr); gap:12px;
      margin-bottom:8px;
    }
    .prof-ring-wrap {
      position:relative; display:flex; flex-direction:column; align-items:center; gap:10px;
      background:var(--surface); border:1px solid var(--border); border-radius:18px;
      padding:18px 10px 14px; transition:var(--transition);
    }
    .prof-ring-wrap:hover { border-color:rgba(255,255,255,0.14); }
    .prof-ring-svg { width:88px; height:88px; transform:rotate(-90deg); display:block; }
    .prof-ring-label {
      position:absolute;
      top:calc(18px + 44px); /* perfectly aligned to center of 88px ring */
      left:50%; transform:translate(-50%,-50%);
      display:flex; flex-direction:column; align-items:center; line-height:1.1; white-space:nowrap;
    }
    .prof-ring-val { font-family:var(--font2); font-size:18px; font-weight:800; line-height:1; }
    .prof-ring-unit { font-size:10px; color:var(--muted); font-weight:600; margin-top:1px; }
    .prof-ring-name { font-size:11px; color:var(--muted); font-weight:700; text-transform:uppercase; letter-spacing:0.6px; }
    .prof-rings-label { text-align:center; font-size:11px; color:var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:1px; margin-bottom:20px; }

    .prof-info-grid { display:flex; flex-direction:column; gap:8px; margin-bottom:16px; }
    .prof-info-row {
      display:flex; align-items:center; gap:12px;
      background:var(--surface); border:1px solid var(--border);
      border-radius:14px; padding:14px 16px; transition:var(--transition);
    }
    .prof-info-row:hover { border-color:rgba(255,255,255,0.12); }
    .prof-info-icon { font-size:18px; flex-shrink:0; width:28px; text-align:center; }
    .prof-info-label { font-size:13px; color:var(--muted); flex:1; }
    .prof-info-val { font-size:14px; font-weight:600; color:var(--text); text-align:right; }

    .prof-tag-section { margin-bottom:16px; }
    .prof-section-title { font-size:13px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:0.8px; margin-bottom:10px; }
    .prof-tags { display:flex; flex-wrap:wrap; gap:8px; }
    .prof-tag {
      background:rgba(255,255,255,0.05); border:1px solid var(--border);
      border-radius:20px; padding:6px 14px; font-size:13px; color:var(--text);
    }

    .prof-danger {
      background:rgba(239,68,68,0.05); border:1px solid rgba(239,68,68,0.2);
      border-radius:20px; padding:20px; margin-top:8px;
    }
    .prof-delete-btn {
      background:rgba(239,68,68,0.12); border:1px solid rgba(239,68,68,0.3);
      color:var(--danger); border-radius:12px; padding:12px 20px;
      font-size:14px; font-weight:700; cursor:pointer; font-family:var(--font);
      transition:var(--transition); width:100%;
    }
    .prof-delete-btn:hover { background:rgba(239,68,68,0.2); }

    /* ── PROFILE MODAL ── */
    .prof-modal-overlay {
      display:none; position:fixed; inset:0;
      background:rgba(0,0,0,0.82); backdrop-filter:blur(8px);
      z-index:999; align-items:flex-end; justify-content:center; padding:0;
      overflow-y:auto;
    }
    .prof-modal-overlay.open { display:flex; }
    body.modal-open { overflow:hidden; }
    .prof-modal-box {
      background:var(--surface-solid); border:1px solid var(--border);
      border-radius:24px 24px 0 0; width:100%; max-width:600px;
      display:flex; flex-direction:column;
      animation:slideUp 0.35s cubic-bezier(0.16,1,0.3,1);
      overflow:hidden; flex-shrink:0;
      margin-top:auto;
    }
    @keyframes slideUp { from{transform:translateY(60px);opacity:0} to{transform:translateY(0);opacity:1} }
    @media(min-width:640px) {
      .prof-modal-overlay { align-items:center; padding:24px; }
      .prof-modal-box { border-radius:24px; margin-top:0; max-height:none; }
    }
    .pedit-header {
      display:flex; align-items:center; justify-content:space-between;
      padding:20px 24px; border-bottom:1px solid var(--border); flex-shrink:0;
      position:sticky; top:0; background:var(--surface-solid); z-index:2;
    }
    .pedit-header h3 { font-family:var(--font2); font-size:18px; font-weight:700; }
    .pedit-close {
      background:rgba(255,255,255,0.08); border:none; color:var(--text);
      width:32px; height:32px; border-radius:50%; cursor:pointer;
      display:flex; align-items:center; justify-content:center;
      font-size:14px; transition:var(--transition); font-family:var(--font);
    }
    .pedit-close:hover { background:var(--danger); color:#fff; }
    .pedit-scroll { padding:20px 24px 40px; display:flex; flex-direction:column; gap:14px; }
    .pedit-section {
      font-size:11px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
      color:var(--green); padding-top:8px; border-top:1px solid var(--border);
    }
    .pedit-section:first-child { border-top:none; padding-top:0; }
    .pedit-field { display:flex; flex-direction:column; gap:6px; }
    .pedit-field label { font-size:12px; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:0.5px; }
    .pedit-row2 { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
    .pedit-input {
      background:rgba(255,255,255,0.05); border:1px solid var(--border);
      border-radius:12px; padding:12px 14px; color:var(--text);
      font-size:15px; font-family:var(--font); outline:none;
      transition:border-color 0.2s; -webkit-appearance:none; width:100%;
    }
    .pedit-input:focus { border-color:var(--green); }
    .pedit-input option { background:#18181b; }
    .pedit-error {
      background:rgba(239,68,68,0.1); border:1px solid rgba(239,68,68,0.3);
      border-radius:10px; padding:10px 14px; font-size:13px; color:#fca5a5;
    }
    .pedit-save-btn {
      background:var(--green); color:#000; border:none; border-radius:14px;
      padding:16px; font-size:16px; font-weight:700; cursor:pointer;
      font-family:var(--font); transition:var(--transition); width:100%; margin-top:8px;
    }
    .pedit-save-btn:hover { background:#0ea572; }
    .pedit-save-btn:disabled { opacity:0.5; cursor:not-allowed; }
    .pedit-cancel-btn {
      background:transparent; border:1px solid var(--border); color:var(--muted);
      border-radius:14px; padding:14px; font-size:15px; font-weight:600;
      cursor:pointer; font-family:var(--font); transition:var(--transition); width:100%;
    }
    .pedit-cancel-btn:hover { border-color:var(--text); color:var(--text); }

    /* ── Profile edit chip styles ── */
    .pedit-chip-wrap { display:flex; flex-direction:column; gap:8px; }
    .pedit-chip-wrap-flow { flex-direction:row; flex-wrap:wrap; }
    .pedit-chip {
      display:flex; align-items:center; justify-content:space-between; gap:8px;
      background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08);
      border-radius:12px; padding:11px 16px; font-size:13px; color:rgba(255,255,255,0.8);
      cursor:pointer; text-align:left; font-family:var(--font); transition:var(--transition);
    }
    .pedit-chip:hover:not(:disabled) { border-color:rgba(16,185,129,0.4); color:var(--text); }
    .pedit-chip-sel {
      background:rgba(16,185,129,0.12); border-color:var(--green); color:var(--green); font-weight:600;
    }
    .pedit-chip-purple { border-color:rgba(139,92,246,0.15); }
    .pedit-chip-sel-purple { background:rgba(139,92,246,0.12); border-color:var(--purple); color:var(--purple); font-weight:600; }
    .pedit-chip-tag {
      padding:7px 14px; border-radius:20px; font-size:12px; flex:none;
    }
    .pedit-chip-dis { opacity:0.3; cursor:not-allowed; }
    .pedit-chip-note { font-size:10px; opacity:0.6; font-weight:400; }

@keyframes pulse { 50% { opacity: 0.5; } }

/* ── ARIA VOICE ── */
.aria-container { max-width: 600px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.aria-header { width: 100%; text-align: center; }
.aria-cost-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.25);
  color: var(--green); font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 100px; margin-top: 8px;
}

/* Orb */
.aria-orb-wrap { padding: 24px; }
.aria-orb {
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(16,185,129,0.15) 0%, transparent 70%);
  border: 2px solid rgba(16,185,129,0.25);
  display: flex; align-items: center; justify-content: center;
  position: relative; transition: all 0.4s ease;
}
.aria-orb::before {
  content: '🎙️'; font-size: 40px; position: absolute;
}
.aria-orb.connecting::before { content: '⏳'; animation: pulse 1s infinite; }
.aria-orb.listening {
  border-color: var(--green);
  box-shadow: 0 0 0 0 rgba(16,185,129,0.6);
  animation: listeningPulse 1.5s ease-out infinite;
  background: radial-gradient(circle, rgba(16,185,129,0.25) 0%, transparent 70%);
}
.aria-orb.listening::before { content: '🎙️'; }
.aria-orb.speaking {
  border-color: var(--cyan);
  box-shadow: 0 0 30px rgba(6,182,212,0.4);
  animation: speakingRipple 0.8s ease-in-out infinite alternate;
  background: radial-gradient(circle, rgba(6,182,212,0.25) 0%, transparent 70%);
}
.aria-orb.speaking::before { content: '🔊'; }

@keyframes listeningPulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.6); }
  70%  { box-shadow: 0 0 0 20px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
@keyframes speakingRipple {
  from { transform: scale(1);   box-shadow: 0 0 20px rgba(6,182,212,0.3); }
  to   { transform: scale(1.08); box-shadow: 0 0 40px rgba(6,182,212,0.5); }
}

.aria-status { font-size: 16px; font-weight: 600; color: var(--text); text-align: center; min-height: 24px; }
.aria-timer  { font-family: var(--font2); font-size: 14px; color: var(--muted); letter-spacing: 2px; }

/* Controls */
.aria-controls { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.aria-start-btn { padding: 14px 32px; font-size: 16px; border-radius: 14px; gap: 8px; }
.aria-ctrl-btn  {
  padding: 10px 20px; font-size: 14px; border-radius: 12px; gap: 8px;
  display: flex; align-items: center;
}
.aria-stop-btn {
  background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger); padding: 10px 20px; font-size: 14px; border-radius: 12px;
  cursor: pointer; font-family: var(--font); transition: var(--transition);
  display: flex; align-items: center; gap: 8px;
}
.aria-stop-btn:hover { background: rgba(239,68,68,0.25); }

/* Transcript */
.aria-transcript-wrap { width: 100%; }
.aria-transcript-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.aria-transcript {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px; min-height: 80px; max-height: 200px; overflow-y: auto;
  font-size: 15px; line-height: 1.7; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}
.aria-transcript:empty::before { content: 'Aria\'s response will appear here…'; color: var(--muted); }

/* Tips */
.aria-tips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%; }
.aria-tip {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 100px; padding: 8px 16px;
  font-size: 13px; color: var(--muted);
}

@media(max-width:480px) {
  .aria-orb { width: 100px; height: 100px; }
  .aria-orb::before { font-size: 32px; }
  .aria-start-btn { width: 100%; justify-content: center; }
  .aria-controls { flex-direction: column; align-items: stretch; width: 100%; }
  .aria-ctrl-btn, .aria-stop-btn { justify-content: center; }
}


/* ── Image Lightbox ── */
#img-lightbox {
  display: none; position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.92); backdrop-filter: blur(16px);
  align-items: center; justify-content: center; padding: 20px;
  animation: lbFadeIn 0.25s ease;
}
#img-lightbox.open { display: flex; }
@keyframes lbFadeIn { from { opacity: 0; } to { opacity: 1; } }

#img-lightbox-inner {
  position: relative; max-width: min(860px, 94vw); max-height: 90vh;
  border-radius: 20px; overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.08);
  animation: lbPop 0.3s cubic-bezier(0.16,1,0.3,1);
}
@keyframes lbPop { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

#img-lightbox-img {
  display: block; max-width: 100%; max-height: 90vh;
  object-fit: contain; border-radius: 20px;
}

#img-lightbox-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.15);
  color: #fff; font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.2s; z-index: 1;
  backdrop-filter: blur(8px);
}
#img-lightbox-close:hover { background: var(--danger); transform: scale(1.1); }

.home-log-thumb, .history-log-thumb { cursor: zoom-in; }

/* ── Edit log modal spinner ── */
.el-spin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,0.25); border-top-color: #000;
  border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   SCAN FOOD MODAL — Futuristic Design System
   ═══════════════════════════════════════════════════════════════ */

/* ── Modal inner box — both mobile & desktop ── */
.scan-modal-box {
  background: linear-gradient(160deg, rgba(18,18,22,0.98), rgba(14,14,18,0.99)) !important;
  border: 1px solid rgba(16,185,129,0.18) !important;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7), 0 0 48px rgba(16,185,129,0.06), inset 0 1px 0 rgba(255,255,255,0.04) !important;
  overflow: hidden !important;
  /* Mobile bottom-sheet: full width, max 92dvh tall, rounded only at top */
  width: 100% !important;
  max-width: 100% !important;
  max-height: 92dvh !important;
  border-radius: 28px 28px 0 0 !important;
}
/* Desktop: centered card, proper rounding all sides, capped width */
@media(min-width:640px) {
  .scan-modal-box {
    max-width: 520px !important;
    max-height: 90vh !important;
    border-radius: 24px !important;
  }
}

/* ── Modal scroll container ── */
.scan-modal-scroll {
  padding: 8px 28px 32px;  /* 8px top for grab handle spacing */
  display: flex;
  flex-direction: column;
  gap: 0;
  /* cap height; on mobile the .scan-modal-box max-height controls the box */
  max-height: calc(92dvh - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(16,185,129,0.3) transparent;
}
.scan-modal-scroll::-webkit-scrollbar { width: 4px; }
.scan-modal-scroll::-webkit-scrollbar-track { background: transparent; }
.scan-modal-scroll::-webkit-scrollbar-thumb { background: rgba(16,185,129,0.3); border-radius: 2px; }

/* ── Bottom-sheet grab handle (mobile only) ── */
.scan-modal-scroll::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
  margin: 0 auto 20px;
  flex-shrink: 0;
}
@media(min-width:640px) {
  .scan-modal-scroll { padding: 28px 28px 32px; }
  .scan-modal-scroll::before { display: none; }
}


/* ── Profile incomplete banner ── */
.scan-profile-banner {
  background: rgba(245,158,11,0.07);
  border: 1px solid rgba(245,158,11,0.18);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--orange);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ── Header ── */
.scan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.scan-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.scan-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(6,182,212,0.15));
  border: 1px solid rgba(16,185,129,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.scan-header-title {
  font-family: var(--font2);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, var(--text), rgba(240,240,245,0.75));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.scan-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.scan-close-btn:hover { background: rgba(239,68,68,0.18); color: #fca5a5; border-color: rgba(239,68,68,0.3); }

/* ── Upload Area Container ── */
.scan-upload-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 16px;
}
.scan-upload-title-wrap {
  text-align: center;
  margin-bottom: 8px;
}
.scan-upload-main-icon {
  font-size: 44px;
  display: inline-block;
  margin-bottom: 12px;
  animation: scanIconPulse 3s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(16,185,129,0.4));
}

.scan-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  max-width: 440px;
}
@media (max-width: 480px) {
  .scan-options-grid {
    grid-template-columns: 1fr;
  }
}

.scan-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(160deg, rgba(16,185,129,0.06), rgba(6,182,212,0.03));
  border: 2px dashed rgba(16,185,129,0.25);
  border-radius: 20px;
  padding: 24px 16px;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  color: var(--text);
  font-family: var(--font);
  position: relative;
  overflow: hidden;
}
.scan-option-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: radial-gradient(ellipse at 50% 0%, rgba(16,185,129,0.08), transparent 70%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.scan-option-btn:hover {
  border-color: rgba(16,185,129,0.6);
  background: linear-gradient(160deg, rgba(16,185,129,0.1), rgba(6,182,212,0.06));
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(16,185,129,0.15);
}
.scan-option-btn:hover::after {
  opacity: 1;
}

.scan-option-icon {
  font-size: 36px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.25));
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.scan-option-btn:hover .scan-option-icon {
  transform: scale(1.15) translateY(-3px);
}
.scan-option-text {
  font-family: var(--font2);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

@keyframes scanIconPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.85; }
}
.scan-upload-title {
  font-family: var(--font2);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.scan-upload-sub {
  font-size: 13px;
  color: var(--muted);
}
.scan-upload-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 14px;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  letter-spacing: 0.2px;
}

/* ── Loading state ── */
.scan-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 56px 0;
  text-align: center;
}
.scan-loading-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(16,185,129,0.12);
  border-top-color: var(--green);
  animation: spin 0.9s linear infinite;
  box-shadow: 0 0 20px rgba(16,185,129,0.25);
}
.scan-loading-text {
  font-family: var(--font2);
  font-size: 15px;
  font-weight: 600;
  color: var(--green);
  letter-spacing: -0.2px;
  animation: scanTextPulse 1.8s ease-in-out infinite;
}
.scan-loading-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: -10px;
}
@keyframes scanTextPulse { 0%,100%{opacity:1} 50%{opacity:0.55} }

/* ── Result / Editor area ── */
.scan-result-area { display: none; }

/* ── Meal name row ── */
.scan-meal-name-row {
  margin-bottom: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(16,185,129,0.07), rgba(6,182,212,0.04));
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scan-meal-name-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.scan-meal-name-icon { font-size: 14px; line-height: 1; }
.scan-meal-name-input {
  font-size: 16px !important;
  font-weight: 700 !important;
  font-family: var(--font2) !important;
  background: rgba(255,255,255,0.05) !important;
  border-color: rgba(16,185,129,0.25) !important;
  color: var(--text) !important;
  border-radius: 12px !important;
  letter-spacing: -0.3px;
}
.scan-meal-name-input:focus {
  border-color: var(--green) !important;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15) !important;
}
.scan-meal-name-input::placeholder {
  color: rgba(161,161,170,0.4) !important;
  font-weight: 400 !important;
  font-size: 14px !important;
}

/* ── Totals bar ── */
.scan-totals-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.scan-totals-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.scan-totals-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.scan-ai-badge {
  font-size: 10px;
  color: rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.scan-totals-chips {
  display: flex;
  gap: 6px;
}

/* ── Items scrollable list ── */
.scan-items-container {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.scan-items-container::-webkit-scrollbar { width: 3px; }
.scan-items-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ── No food message ── */
.scan-no-food {
  text-align: center;
  padding: 28px 20px;
  color: var(--orange);
  font-size: 14px;
  font-weight: 600;
  background: rgba(245,158,11,0.06);
  border: 1px dashed rgba(245,158,11,0.2);
  border-radius: 14px;
}

/* ── Item card ── */
.scan-item-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 16px;
  position: relative;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  border-left: 3px solid rgba(16,185,129,0.35);
}
.scan-item-card:hover {
  border-color: rgba(255,255,255,0.14);
  border-left-color: var(--green);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

/* ── Confidence chip ── */
.scan-confidence-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(16,185,129,0.12);
  color: var(--green);
  border: 1px solid rgba(16,185,129,0.25);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

/* ── Remove button ── */
.scan-remove-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  color: #fca5a5;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  z-index: 2;
}
.scan-remove-btn:hover { background: rgba(239,68,68,0.25); transform: scale(1.1); }

/* ── Field (label + input stacked) ── */
.scan-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}
.scan-field:last-child { margin-bottom: 0; }
.scan-field-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.scan-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.scan-input:focus {
  outline: none;
  border-color: rgba(16,185,129,0.5);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}
.scan-input::placeholder { color: rgba(161,161,170,0.5); }
.scan-input-name {
  font-size: 15px;
  font-weight: 600;
  padding-right: 36px;
}
.scan-input-qty {
  font-size: 13px;
  color: var(--muted);
}
.scan-input-qty:focus { color: var(--text); }

/* ── Macro grid (3 cols) ── */
.scan-macro-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 2px;
}
.scan-macro-grid .scan-field { margin-bottom: 0; }
.scan-macro-grid .scan-field-label { text-align: center; }
.scan-macro-grid .scan-input {
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  padding: 9px 6px;
  font-family: var(--font2);
}
.scan-macro-cal   .scan-input { color: var(--orange); }
.scan-macro-prot  .scan-input { color: var(--green); }
.scan-macro-carb  .scan-input { color: var(--purple); }

/* ── Autocomplete suggestion box ── */
.scan-sug-box {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: rgba(22,22,28,0.98);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 12px;
  z-index: 20;
  max-height: 160px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  scrollbar-width: thin;
  scrollbar-color: rgba(16,185,129,0.2) transparent;
}
.scan-sug-item {
  padding: 11px 14px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.scan-sug-item:last-child { border-bottom: none; }
.scan-sug-item::before {
  content: '🍴';
  font-size: 12px;
  flex-shrink: 0;
  opacity: 0.6;
}
.scan-sug-item:hover { background: rgba(16,185,129,0.1); color: var(--green); }

/* ── Divider between buttons ── */
.scan-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* ── Add item button ── */
.scan-add-btn {
  width: 100%;
  padding: 13px 20px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1.5px dashed rgba(255,255,255,0.15);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.1px;
}
.scan-add-btn:hover {
  border-color: rgba(16,185,129,0.45);
  color: var(--green);
  background: rgba(16,185,129,0.05);
}

/* ── Save / Log Meal button ── */
.scan-save-btn {
  width: 100%;
  padding: 15px 20px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: #000;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: opacity 0.25s, transform 0.25s, box-shadow 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 28px rgba(16,185,129,0.3);
  letter-spacing: -0.2px;
}
.scan-save-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(16,185,129,0.45);
}
.scan-save-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Mobile responsive overrides ── */
@media(max-width:639px) {
  /* Scroll container: tighter padding, leave room for grab handle */
  .scan-modal-scroll { padding: 8px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }

  /* Upload area: smaller padding */
  .scan-upload-container { padding: 24px 12px; }
  .scan-upload-main-icon { font-size: 36px; }

  /* Item list: shorter on phones so buttons are always visible */
  .scan-items-container { max-height: 230px; }

  /* Macro grid: tighter, 13px font */
  .scan-macro-grid { gap: 6px; }
  .scan-macro-grid .scan-input {
    padding: 8px 4px;
    font-size: 13px;
  }

  /* Make inputs easier to tap on mobile */
  .scan-input { padding: 12px 14px; font-size: 15px; }
  .scan-input-name { font-size: 15px; }
  .scan-input-qty  { font-size: 14px; }

  /* Bigger tap target for remove button */
  .scan-remove-btn { width: 32px; height: 32px; font-size: 14px; }

  /* Save button safe-area inset for home bar */
  .scan-save-btn { padding: 16px 20px; font-size: 16px; }
}
