* { box-sizing: border-box; }
    :root {
      --bg: linear-gradient(180deg, #eff8f1 0%, #f7fbf7 48%, #edf5f0 100%);
      --bg-glow-1: rgba(103, 181, 137, 0.22);
      --bg-glow-2: rgba(255, 219, 157, 0.18);
      --surface: rgba(255, 255, 255, 0.92);
      --surface-strong: rgba(255, 255, 255, 0.97);
      --surface-soft: #eef6f0;
      --surface-muted: #f5faf7;
      --text: #163b31;
      --muted: #5b766a;
      --border: rgba(42, 106, 80, 0.12);
      --border-strong: rgba(42, 106, 80, 0.22);
      --primary: #2d9968;
      --primary-strong: #1e7a52;
      --primary-soft: rgba(45, 153, 104, 0.12);
      --accent: #f2b85a;
      --warn: #d76d48;
      --shadow: 0 18px 45px rgba(21, 58, 44, 0.11);
      --shadow-soft: 0 10px 25px rgba(21, 58, 44, 0.06);
      --radius-xl: 28px;
      --radius-lg: 22px;
      --radius-md: 16px;
      --radius-sm: 12px;
      --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    }
    body.dark-mode {
      --bg: linear-gradient(180deg, #0d1615 0%, #11201d 50%, #0b1312 100%);
      --bg-glow-1: rgba(82, 177, 118, 0.2);
      --bg-glow-2: rgba(242, 184, 90, 0.08);
      --surface: rgba(17, 31, 28, 0.92);
      --surface-strong: rgba(21, 37, 34, 0.98);
      --surface-soft: rgba(25, 46, 41, 0.96);
      --surface-muted: rgba(18, 37, 32, 0.82);
      --text: #effaf3;
      --muted: #9cb9ac;
      --border: rgba(137, 205, 170, 0.12);
      --border-strong: rgba(137, 205, 170, 0.2);
      --primary: #65d08c;
      --primary-strong: #46b372;
      --primary-soft: rgba(101, 208, 140, 0.12);
      --accent: #e3b25b;
      --shadow: 0 18px 45px rgba(0, 0, 0, 0.26);
      --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.18);
    }
    body[data-theme="ocean"] {
      --bg: linear-gradient(180deg, #eaf6fb 0%, #f4fbff 48%, #e3f0f8 100%);
      --bg-glow-1: rgba(90, 168, 214, 0.22);
      --bg-glow-2: rgba(119, 215, 217, 0.14);
      --surface: rgba(255, 255, 255, 0.9);
      --surface-strong: rgba(255, 255, 255, 0.96);
      --surface-soft: #edf7fb;
      --surface-muted: #f4fbfe;
      --text: #17384b;
      --muted: #5b7789;
      --border: rgba(37, 101, 136, 0.12);
      --border-strong: rgba(37, 101, 136, 0.22);
      --primary: #2d88b7;
      --primary-strong: #17658e;
      --primary-soft: rgba(45, 136, 183, 0.12);
      --accent: #5dc4c8;
      --warn: #d06b56;
      --shadow: 0 18px 45px rgba(18, 58, 78, 0.1);
      --shadow-soft: 0 10px 25px rgba(18, 58, 78, 0.06);
    }
    body[data-theme="forest"] {
      --bg: linear-gradient(180deg, #edf5ee 0%, #f6faf5 46%, #e5eee6 100%);
      --bg-glow-1: rgba(83, 143, 98, 0.2);
      --bg-glow-2: rgba(179, 145, 88, 0.12);
      --surface: rgba(255, 255, 255, 0.9);
      --surface-strong: rgba(252, 253, 251, 0.97);
      --surface-soft: #eef5ed;
      --surface-muted: #f7faf5;
      --text: #22392b;
      --muted: #64786a;
      --border: rgba(52, 94, 64, 0.12);
      --border-strong: rgba(52, 94, 64, 0.2);
      --primary: #4f8d62;
      --primary-strong: #356848;
      --primary-soft: rgba(79, 141, 98, 0.12);
      --accent: #c49a5e;
      --warn: #b9654f;
      --shadow: 0 18px 45px rgba(27, 55, 36, 0.1);
      --shadow-soft: 0 10px 25px rgba(27, 55, 36, 0.06);
    }
    body[data-theme="dawn"] {
      --bg: linear-gradient(180deg, #fff2ec 0%, #fff8f4 48%, #fceee7 100%);
      --bg-glow-1: rgba(236, 137, 115, 0.18);
      --bg-glow-2: rgba(255, 199, 138, 0.18);
      --surface: rgba(255, 255, 255, 0.92);
      --surface-strong: rgba(255, 255, 255, 0.97);
      --surface-soft: #fff3ed;
      --surface-muted: #fff8f5;
      --text: #4a2a26;
      --muted: #82645c;
      --border: rgba(151, 86, 72, 0.12);
      --border-strong: rgba(151, 86, 72, 0.22);
      --primary: #df7f63;
      --primary-strong: #bd5d42;
      --primary-soft: rgba(223, 127, 99, 0.12);
      --accent: #f0b36a;
      --warn: #c85d4e;
      --shadow: 0 18px 45px rgba(87, 44, 36, 0.09);
      --shadow-soft: 0 10px 25px rgba(87, 44, 36, 0.05);
    }
    body[data-theme="paper"] {
      --bg: linear-gradient(180deg, #f4f2ee 0%, #faf8f5 50%, #efede8 100%);
      --bg-glow-1: rgba(117, 128, 138, 0.12);
      --bg-glow-2: rgba(194, 171, 136, 0.12);
      --surface: rgba(255, 255, 255, 0.9);
      --surface-strong: rgba(255, 255, 255, 0.96);
      --surface-soft: #f3f0eb;
      --surface-muted: #faf8f4;
      --text: #30363a;
      --muted: #6c7378;
      --border: rgba(95, 107, 118, 0.12);
      --border-strong: rgba(95, 107, 118, 0.2);
      --primary: #6f8797;
      --primary-strong: #516775;
      --primary-soft: rgba(111, 135, 151, 0.12);
      --accent: #c7a574;
      --warn: #b56552;
      --shadow: 0 18px 45px rgba(51, 57, 61, 0.08);
      --shadow-soft: 0 10px 25px rgba(51, 57, 61, 0.05);
    }
    html, body {
      margin: 0;
      min-height: 100%;
      background:
        radial-gradient(circle at top left, var(--bg-glow-1), transparent 30%),
        radial-gradient(circle at top right, var(--bg-glow-2), transparent 26%),
        var(--bg);
      color: var(--text);
      font-family: var(--font);
    }
    body::before {
      content: "";
      position: fixed;
      inset: 0;
      pointer-events: none;
      background-image: linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
      background-size: 28px 28px;
      mask-image: linear-gradient(180deg, rgba(0,0,0,0.14), transparent 78%);
      opacity: 0.28;
    }
    button, input, textarea, select { font: inherit; }
    button { cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease, color .18s ease, opacity .18s ease; }
    button:hover:not(:disabled) { transform: translateY(-1px); }
    button:disabled { cursor: not-allowed; opacity: 0.56; transform: none; }
    .page { width: min(100%, 1200px); margin: 0 auto; padding: 18px 14px 36px; position: relative; z-index: 1; }
    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow);
      backdrop-filter: blur(14px);
    }
    .hero, .panel, .auth-card { padding: 22px; }
    .hero {
      display: flex;
      gap: 18px;
      justify-content: space-between;
      align-items: stretch;
      position: relative;
      overflow: hidden;
      background:
        linear-gradient(135deg, rgba(255,255,255,0.84), rgba(255,255,255,0.68)),
        radial-gradient(circle at right top, var(--primary-soft), transparent 40%);
    }
    body.dark-mode .hero {
      background:
        linear-gradient(135deg, rgba(18,34,31,0.96), rgba(16,29,27,0.92)),
        radial-gradient(circle at right top, var(--primary-soft), transparent 42%);
    }
    .hero::after {
      content: "";
      position: absolute;
      right: -80px;
      top: -80px;
      width: 220px;
      height: 220px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(45,153,104,0.16), transparent 68%);
    }
    .hero > div:first-child,
    .hero-actions { position: relative; z-index: 1; }
    .hero-actions, .toolbar, .tab-row, .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
    .hero-main {
      display: flex;
      flex-direction: column;
      gap: 10px;
      flex: 1 1 auto;
      min-width: 0;
    }
    .screen-topbar {
      display: flex;
      justify-content: flex-end;
      margin-bottom: 10px;
      position: sticky;
      top: 10px;
      z-index: 5;
    }
    .screen-topbar-inner {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }
    .theme-modal {
      position: fixed;
      inset: 0;
      z-index: 30;
      display: grid;
      place-items: center;
      padding: 20px;
    }
    .theme-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(11, 20, 18, 0.38);
      backdrop-filter: blur(10px);
    }
    .theme-dialog {
      position: relative;
      z-index: 1;
      width: min(920px, 100%);
      padding: 22px;
      background: color-mix(in srgb, var(--surface-strong) 92%, transparent 8%);
    }
    .theme-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      gap: 14px;
    }
    .theme-option {
      padding: 14px;
      border-radius: 18px;
      border: 1px solid var(--border);
      background: linear-gradient(180deg, var(--surface-strong), color-mix(in srgb, var(--surface-soft) 78%, white 22%));
      color: var(--text);
      text-align: left;
      box-shadow: var(--shadow-soft);
      display: grid;
      gap: 10px;
    }
    .theme-option strong {
      font-size: 15px;
      letter-spacing: -0.02em;
    }
    .theme-option small {
      color: var(--muted);
      line-height: 1.6;
    }
    .theme-option.active {
      border-color: transparent;
      background: linear-gradient(135deg, var(--primary), var(--primary-strong));
      color: #fff;
      box-shadow: 0 18px 28px rgba(30, 122, 82, 0.18);
    }
    .theme-option.active small {
      color: rgba(255,255,255,0.84);
    }
    .theme-preview {
      display: block;
      height: 76px;
      border-radius: 14px;
      border: 1px solid rgba(255,255,255,0.4);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
    }
.light-preview { background: linear-gradient(135deg, #f6fbf7, #d9efe0 70%, #f1d69b); }
.dark-preview { background: linear-gradient(135deg, #15211f, #243d37 62%, #7bbf92); }
.ocean-preview { background: linear-gradient(135deg, #eef8fd, #cfe9f8 58%, #74d0d5); }
.forest-preview { background: linear-gradient(135deg, #f2f7f1, #dce9db 58%, #789b6d); }
.dawn-preview { background: linear-gradient(135deg, #fff7f2, #ffd9cc 58%, #f4b36d); }
.paper-preview { background: linear-gradient(135deg, #fbfaf7, #ece7de 58%, #9fb0ba); }
.glacier-preview { background: linear-gradient(135deg, #f3fbff, #d8edf7 58%, #8dc6dc); }
.matcha-preview { background: linear-gradient(135deg, #fbfcf6, #e7efd9 58%, #9fbf8d); }
.amber-preview { background: linear-gradient(135deg, #fff9ee, #f6e4c6 58%, #d8a55b); }
.slate-preview { background: linear-gradient(135deg, #f5f7fa, #dce3eb 58%, #7f93a8); }
    .micro-chip,
    .micro-btn {
      height: 32px;
      padding: 0 12px;
      border-radius: 999px;
      border: 1px solid var(--border);
      font-size: 12px;
      font-weight: 700;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      white-space: nowrap;
      box-shadow: var(--shadow-soft);
      backdrop-filter: blur(12px);
    }
    .micro-chip {
      background: color-mix(in srgb, var(--primary-soft) 82%, var(--surface-strong) 18%);
      color: var(--primary-strong);
    }
    .micro-btn {
      background: color-mix(in srgb, var(--surface-strong) 90%, transparent 10%);
      color: var(--text);
    }
    .picker-shell {
      position: relative;
    }
    .picker-btn {
      width: 100%;
      min-height: 54px;
      padding: 0 16px;
      border-radius: 18px;
      border: 1px solid var(--border-strong);
      background: linear-gradient(135deg, var(--surface-soft), color-mix(in srgb, var(--surface-strong) 62%, var(--surface-soft) 38%));
      color: var(--text);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      font-size: 15px;
      font-weight: 800;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.28);
    }
    .picker-btn::after {
      content: "▾";
      font-size: 14px;
      color: var(--muted);
      flex: 0 0 auto;
    }
    .picker-menu {
      position: absolute;
      top: calc(100% + 8px);
      left: 0;
      right: 0;
      display: grid;
      gap: 8px;
      padding: 10px;
      border-radius: 18px;
      border: 1px solid var(--border);
      background: color-mix(in srgb, var(--surface-strong) 92%, transparent 8%);
      box-shadow: var(--shadow);
      backdrop-filter: blur(12px);
      z-index: 8;
    }
    .picker-option {
      width: 100%;
      padding: 12px 14px;
      border-radius: 14px;
      border: 1px solid transparent;
      background: var(--surface-soft);
      color: var(--text);
      text-align: left;
      font-size: 14px;
      line-height: 1.5;
      font-weight: 700;
    }
    .picker-option small {
      display: block;
      margin-top: 3px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 600;
    }
    .picker-option.active {
      background: linear-gradient(135deg, var(--primary), var(--primary-strong));
      color: #fff;
      border-color: transparent;
    }
    .picker-option.active small { color: rgba(255,255,255,0.82); }
    .badge {
      display: inline-flex;
      align-items: center;
      padding: 7px 11px;
      border-radius: 999px;
      background: var(--primary-soft);
      color: var(--primary-strong);
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 0.02em;
    }
    .main { display: grid; gap: 18px; margin-top: 18px; }
    .panel {
      background: linear-gradient(180deg, var(--surface-strong), rgba(255,255,255,0.78));
    }
    body.dark-mode .panel {
      background: linear-gradient(180deg, var(--surface-strong), rgba(17,31,28,0.9));
    }
    .panel h2, .hero h1 { margin: 0; }
    .hero h1 {
      margin-top: 8px;
      font-size: clamp(26px, 5vw, 40px);
      line-height: 1.06;
      letter-spacing: -0.04em;
    }
    .panel h2 {
      font-size: 28px;
      line-height: 1.12;
      letter-spacing: -0.03em;
    }
    .auth-card h1 {
      margin: 14px 0 0;
      font-size: clamp(34px, 9vw, 60px);
      line-height: 1.04;
      letter-spacing: -0.05em;
    }
    .hero p, .panel p, .hint, .meta, .status {
      color: var(--muted);
      font-size: 13px;
      line-height: 1.68;
    }
    .field { display: grid; gap: 8px; }
    .grid-3, .grid-2, .history { display: grid; gap: 14px; }
    .input, textarea, select {
      width: 100%;
      padding: 15px 16px;
      border-radius: var(--radius-md);
      border: 1px solid var(--border);
      background: var(--surface-soft);
      color: var(--text);
      outline: none;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
      transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
    }
    .input:focus, textarea:focus, select:focus {
      border-color: rgba(45,153,104,0.4);
      box-shadow: 0 0 0 4px rgba(45,153,104,0.12);
      background: var(--surface-strong);
    }
    select.input,
    select {
      appearance: none;
      padding-right: 54px;
      font-weight: 700;
      background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%),
        linear-gradient(135deg, color-mix(in srgb, var(--surface-soft) 78%, white 22%), color-mix(in srgb, var(--surface-strong) 82%, var(--surface-soft) 18%));
      background-position:
        calc(100% - 22px) calc(50% - 2px),
        calc(100% - 16px) calc(50% - 2px),
        0 0;
      background-size:
        7px 7px,
        7px 7px,
        100% 100%;
      background-repeat: no-repeat;
      border-color: var(--border-strong);
      box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.32),
        0 10px 20px rgba(21, 58, 44, 0.05);
    }
    select.input:hover:not(:disabled),
    select:hover:not(:disabled) {
      border-color: rgba(45,153,104,0.28);
      background-image:
        linear-gradient(45deg, transparent 50%, var(--primary-strong) 50%),
        linear-gradient(135deg, var(--primary-strong) 50%, transparent 50%),
        linear-gradient(135deg, color-mix(in srgb, var(--surface-soft) 68%, white 32%), color-mix(in srgb, var(--surface-strong) 88%, var(--surface-soft) 12%));
    }
    textarea { min-height: 116px; resize: vertical; line-height: 1.7; }
    textarea:disabled, input:disabled, select:disabled {
      opacity: 1;
      background: color-mix(in srgb, var(--surface-soft) 84%, #cfd8d2 16%);
      color: color-mix(in srgb, var(--muted) 86%, #6f7a74 14%);
      border-style: dashed;
    }
    .btn, .ghost, .range-btn, .nav-btn, .secondary-btn, .tab {
      border-radius: 999px;
      border: 1px solid var(--border);
      background: var(--surface);
      color: var(--text);
      padding: 9px 14px;
      box-shadow: var(--shadow-soft);
      font-weight: 700;
    }
    .primary {
      background: linear-gradient(135deg, var(--primary), var(--primary-strong));
      color: #fff;
      border-color: transparent;
      box-shadow: 0 16px 28px rgba(30, 122, 82, 0.22);
    }
    .ghost, .secondary-btn, .nav-btn, .range-btn, .tab {
      background: color-mix(in srgb, var(--surface-strong) 80%, var(--surface-soft) 20%);
    }
    .secondary-btn { padding-inline: 14px; }
    .full { width: 100%; }
    .empty, .empty-box {
      min-height: 116px;
      border: 1px dashed var(--border-strong);
      border-radius: var(--radius-md);
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 16px;
      background:
        linear-gradient(135deg, color-mix(in srgb, var(--surface-soft) 90%, white 10%), color-mix(in srgb, var(--surface-soft) 76%, white 24%));
      color: var(--muted);
    }
    .score-chip {
      padding: 9px 15px;
      border-radius: 999px;
      background: linear-gradient(135deg, #f7d269, #efb24d);
      color: #412a00;
      font-weight: 900;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
    }
    .status { min-height: 22px; padding-top: 4px; }
    .status.error { color: var(--warn); }
    .hidden { display: none !important; }
    .date-nav {
      display: grid;
      grid-template-columns: 88px minmax(0, 1fr) 88px;
      gap: 10px;
      align-items: center;
      margin-bottom: 14px;
    }
    .date-pill {
      padding: 10px 14px;
      border-radius: 16px;
      border: 1px solid var(--border);
      background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--surface-soft) 55%, white 45%));
      text-align: center;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
    }
    .date-pill strong {
      display: block;
      font-size: clamp(17px, 3.5vw, 22px);
      letter-spacing: -0.03em;
    }
    .date-pill small { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; }
    .meal-card, .summary-card, .analysis-card, .feedback-card, .history-card, .inspector {
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      background: linear-gradient(180deg, var(--surface-strong), rgba(255,255,255,0.84));
      padding: 16px;
      box-shadow: var(--shadow-soft);
    }
    body.dark-mode .meal-card,
    body.dark-mode .summary-card,
    body.dark-mode .analysis-card,
    body.dark-mode .feedback-card,
    body.dark-mode .history-card,
    body.dark-mode .inspector {
      background: linear-gradient(180deg, var(--surface-strong), rgba(18,34,31,0.88));
    }
    .meal-card > .row:first-child,
    .analysis-card > .row:first-child,
    .feedback-card > .row:first-child {
      margin-bottom: 12px;
    }
    .meal-card strong,
    .analysis-card strong,
    .feedback-card strong,
    .summary-card strong,
    .history-card strong {
      letter-spacing: -0.02em;
    }
    .inspector {
      margin-bottom: 14px;
      background: linear-gradient(135deg, var(--primary-soft), transparent 70%), var(--surface-strong);
    }
    .profile-editor-shell {
      margin-bottom: 16px;
      padding: 18px 20px;
      border: 1px solid var(--border);
      background: linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 88%, white 12%), var(--surface-soft));
    }
    body.dark-mode .profile-editor-shell {
      background: linear-gradient(135deg, rgba(20,36,33,0.96), rgba(24,43,38,0.94));
    }
    .profile-grid {
      display: grid;
      gap: 14px;
    }
    .profile-actions {
      display: flex;
      gap: 12px;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      margin-top: 14px;
    }
    .profile-summary {
      color: var(--muted);
      font-size: 13px;
      line-height: 1.75;
      flex: 1 1 240px;
    }
    .profile-live-card {
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      background: linear-gradient(135deg, var(--surface-soft), color-mix(in srgb, var(--surface-strong) 72%, var(--surface-soft) 28%));
      padding: 14px 16px;
      box-shadow: var(--shadow-soft);
    }
    .profile-live-inline {
      margin-top: 14px;
    }
    .profile-live-card strong {
      display: block;
      font-size: 12px;
      letter-spacing: 0.02em;
      color: var(--muted);
    }
    .profile-live-value {
      margin-top: 6px;
      font-size: clamp(28px, 5vw, 36px);
      line-height: 1;
      font-weight: 900;
      letter-spacing: -0.04em;
    }
    .auth-action-row {
      display: flex;
      gap: 10px;
      align-items: center;
      flex-wrap: wrap;
    }
    .auth-action-row > .btn,
    .auth-action-row > .ghost {
      flex: 1 1 180px;
    }
    #authAccountStep,
    #authProfileStep {
      display: grid;
      gap: 14px;
    }
    .history-meals { display: grid; gap: 10px; margin-top: 12px; }
    .meal-item {
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: var(--surface-soft);
      padding: 12px;
      min-height: 92px;
    }
    .meal-item strong {
      display: block;
      margin-bottom: 6px;
      font-size: 13px;
      color: var(--muted);
    }
    .tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
    .tag {
      display: inline-flex;
      align-items: center;
      padding: 8px 11px;
      border-radius: 999px;
      background: var(--surface-soft);
      border: 1px solid var(--border);
      font-size: 12px;
    }
    .history-score {
      padding: 8px 12px;
      border-radius: 999px;
      background: var(--primary-soft);
      color: var(--primary-strong);
      font-size: 12px;
      font-weight: 800;
    }
    .history-card {
      position: relative;
      overflow: hidden;
    }
    .history-card::before {
      content: "";
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: 4px;
      background: linear-gradient(180deg, var(--primary), transparent);
      opacity: 0.6;
    }
    .auth-wrap {
      min-height: calc(100vh - 54px);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px 0;
    }
    .auth-card {
      width: min(100%, 520px);
      padding: 26px 22px 22px;
      position: relative;
      overflow: hidden;
      background:
        linear-gradient(135deg, rgba(255,255,255,0.96), rgba(244,251,246,0.92)),
        radial-gradient(circle at right top, rgba(45,153,104,0.12), transparent 38%);
    }
    .auth-card.register-profile-mode {
      width: min(100%, 560px);
      background:
        linear-gradient(135deg, rgba(255,255,255,0.98), rgba(246,251,248,0.95)),
        radial-gradient(circle at left top, rgba(45,153,104,0.08), transparent 42%);
    }
    body.dark-mode .auth-card {
      background:
        linear-gradient(135deg, rgba(17,31,28,0.98), rgba(20,36,33,0.94)),
        radial-gradient(circle at right top, rgba(101,208,140,0.12), transparent 42%);
    }
    .auth-card::after {
      content: "";
      position: absolute;
      inset: 0 auto auto 0;
      width: 100%;
      height: 4px;
      background: linear-gradient(90deg, var(--primary), var(--accent), transparent 72%);
    }
    .auth-card p { margin: 14px 0 0; font-size: 15px; line-height: 1.84; max-width: 26em; }
    .auth-profile-page {
      display: grid;
      gap: 10px;
      margin-bottom: 18px;
      padding-bottom: 14px;
      border-bottom: 1px solid var(--border);
    }
    .auth-profile-page h1 {
      margin: 0;
      font-size: clamp(30px, 7vw, 42px);
      line-height: 1.08;
      letter-spacing: -0.04em;
    }
    .auth-profile-page p {
      margin: 0;
      max-width: none;
      font-size: 14px;
      line-height: 1.85;
    }
    .auth-card .tab-row { margin: 22px 0 12px !important; padding: 4px; border-radius: 999px; background: var(--surface-soft); width: fit-content; }
    .auth-card .field label { font-size: 13px; font-weight: 800; }
    #authForm { grid-template-columns: 1fr !important; gap: 14px; }
    #authForm .full { width: 100%; }
    .tab { background: transparent; box-shadow: none; }
    .tab.active, .range-btn.active {
      background: linear-gradient(135deg, var(--primary), var(--primary-strong));
      color: #fff;
      border-color: transparent;
      box-shadow: 0 14px 24px rgba(30,122,82,0.18);
    }
    .analysis-content {
      white-space: pre-wrap;
      line-height: 1.9;
      margin-top: 10px;
      padding: 14px;
      border-radius: var(--radius-md);
      background: var(--surface-soft);
      min-height: 152px;
    }
    .summary-card {
      min-height: 168px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }
    .section-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 16px;
      flex-wrap: wrap;
    }
    .section-head p { margin: 6px 0 0; max-width: 34em; }
    .auth-points {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 16px;
    }
    .auth-point {
      padding: 8px 12px;
      border-radius: 999px;
      background: var(--surface-soft);
      border: 1px solid var(--border);
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
    }
    .metric-value {
      font-size: clamp(30px, 5vw, 42px);
      font-weight: 900;
      line-height: 1;
      letter-spacing: -0.04em;
      margin-top: 10px;
    }
    .summary-card .hint { font-size: 12px; }
    .toolbar { margin-bottom: 14px; }
    .nav-btn {
      min-width: 0;
      width: 88px;
      justify-content: center;
      display: inline-flex;
      padding-inline: 10px;
      white-space: nowrap;
    }
    input[type="range"] {
      width: 100%;
      margin-top: 14px;
      accent-color: var(--primary);
    }
    @media (min-width: 760px) {
      .main { grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); }
      .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .history-meals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }
    @media (max-width: 759px) {
      .page { padding-inline: 12px; }
      .hero { padding: 16px 16px 14px; gap: 12px; }
      .panel, .auth-card { padding: 18px; }
      .screen-topbar { top: 8px; margin-bottom: 8px; }
      .screen-topbar-inner { width: 100%; justify-content: flex-end; }
      .theme-dialog { padding: 18px; }
      .theme-grid { grid-template-columns: 1fr; }
      .date-nav { grid-template-columns: 74px minmax(0, 1fr) 74px; gap: 8px; }
      .date-pill { order: 0; padding: 9px 10px; }
      .date-pill strong { font-size: 16px; }
      .nav-btn { width: 74px; font-size: 13px; padding-inline: 6px; }
      .secondary-btn, .btn, .ghost { width: 100%; }
      .profile-actions { align-items: stretch; }
      .profile-actions > * { width: 100%; }
      .toolbar > * { flex: 1 1 calc(33.33% - 8px); justify-content: center; }
      .auth-card { width: 100%; }
      .auth-card.register-profile-mode { width: 100%; }
      .auth-card .tab-row { width: 100%; }
      .auth-profile-page { margin-bottom: 16px; }
      .auth-card .tab { flex: 1 1 0; text-align: center; }
    }

/* 2026 refresh */
body.modal-open {
  overflow: hidden;
}

.app-shell {
  display: grid;
  gap: 20px;
}

.auth-card {
  width: min(100%, 620px);
  padding: 28px 26px 24px;
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border-strong) 82%, white 18%);
  border-radius: 34px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 92%, white 8%), color-mix(in srgb, var(--surface-soft) 72%, white 28%)),
    radial-gradient(circle at right top, var(--primary-soft), transparent 44%);
  box-shadow: 0 28px 60px rgba(15, 46, 34, 0.12);
}

.auth-card.register-profile-mode {
  width: min(100%, 760px);
}

.auth-profile-page {
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 82%, white 18%);
}

.auth-profile-page h1 {
  font-size: clamp(34px, 7vw, 46px);
}

.profile-fields-grid {
  display: grid;
  gap: 14px;
}

.choice-grid {
  display: grid;
  gap: 12px;
}

.choice-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-pill {
  min-height: 88px;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid color-mix(in srgb, var(--border-strong) 76%, white 24%);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 84%, white 16%), color-mix(in srgb, var(--surface-soft) 86%, white 14%));
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.52);
  display: grid;
  gap: 6px;
  align-content: start;
}

.choice-pill strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.choice-pill small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.choice-pill.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary-strong) 90%, #173a2c 10%));
  color: #fff;
  box-shadow: 0 18px 28px rgba(30, 122, 82, 0.18);
}

.choice-pill.active small {
  color: rgba(255, 255, 255, 0.84);
}

.choice-pill-wide {
  min-height: 96px;
}

.auth-bmi-panel {
  margin-top: 4px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-soft) 84%, white 16%), color-mix(in srgb, var(--primary-soft) 36%, var(--surface-strong) 64%));
}

.screen-topbar {
  justify-content: flex-start;
  margin-bottom: 0;
  top: 12px;
}

.screen-topbar-inner {
  padding: 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 72%, white 28%);
  background: color-mix(in srgb, var(--surface-strong) 86%, transparent 14%);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.app-hero {
  padding: 26px 8px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.app-hero::after {
  right: -20px;
  top: -48px;
  width: 180px;
  height: 180px;
  opacity: 0.72;
}

.app-main {
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  align-items: start;
}

.panel {
  padding: 22px 22px 24px;
  border-radius: 30px;
  border: 1px solid color-mix(in srgb, var(--border) 86%, white 14%);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 92%, white 8%), color-mix(in srgb, var(--surface-muted) 94%, white 6%));
  box-shadow: 0 20px 36px rgba(18, 58, 44, 0.06);
}

.panel::before {
  content: "";
  display: block;
  width: 120px;
  height: 3px;
  border-radius: 999px;
  margin-bottom: 18px;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--accent) 70%, white 30%), transparent 92%);
}

.section-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, white 22%);
}

.meal-card,
.summary-card,
.analysis-card,
.feedback-card,
.history-card,
.inspector,
.score-panel,
.section-surface {
  border: 1px solid color-mix(in srgb, var(--border) 82%, white 18%);
  border-radius: 22px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 90%, white 10%), color-mix(in srgb, var(--surface-soft) 92%, white 8%));
  box-shadow: none;
}

.meal-card,
.feedback-card,
.analysis-card,
.summary-card,
.history-card,
.inspector {
  position: relative;
  overflow: hidden;
}

.meal-card::before,
.feedback-card::before,
.analysis-card::before,
.summary-card::before,
.history-card::before,
.inspector::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--primary), transparent 85%);
  opacity: 0.7;
}

.score-panel {
  margin-top: 10px;
  padding: 14px;
}

.analysis-stack,
.history-section {
  display: grid;
  gap: 14px;
}

.history-section {
  margin-top: 18px;
}

.history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-card {
  padding: 16px 16px 16px 18px;
}

.history-card::before {
  left: 0;
  width: 4px;
}

.tag {
  background: color-mix(in srgb, var(--surface-soft) 72%, white 28%);
}

.overlay-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px 20px;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 20, 18, 0.42);
  backdrop-filter: blur(12px);
}

.sheet-dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  border-radius: 30px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, white 22%);
  background: color-mix(in srgb, var(--surface-strong) 92%, white 8%);
  box-shadow: 0 30px 60px rgba(11, 30, 23, 0.2);
}

.dialog-head {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, white 22%);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--surface-strong) 92%, white 8%);
  z-index: 2;
}

.dialog-head.compact {
  margin-bottom: 18px;
}

.dialog-head h2 {
  margin: 8px 0 0;
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: -0.04em;
}

.dialog-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  padding-right: 4px;
}

.theme-option {
  min-height: 212px;
  padding: 16px;
  border-radius: 24px;
}

.password-dialog {
  width: min(560px, 100%);
}

.password-form {
  display: grid;
  gap: 14px;
}

.password-actions {
  margin-top: 6px;
}

.profile-editor-shell {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.profile-editor-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.profile-editor-header h2 {
  margin: 10px 0 0;
  font-size: clamp(34px, 5vw, 46px);
  letter-spacing: -0.05em;
}

.profile-editor-header p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.profile-editor-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-shell {
  border: 1px solid color-mix(in srgb, var(--border) 82%, white 18%);
  border-radius: 30px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 94%, white 6%), color-mix(in srgb, var(--surface-muted) 94%, white 6%));
  box-shadow: 0 18px 34px rgba(16, 46, 35, 0.08);
  overflow: hidden;
}

.settings-block {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.settings-block + .settings-block {
  border-top: 1px solid color-mix(in srgb, var(--border) 78%, white 22%);
}

.settings-block-head h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.settings-block-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.profile-status {
  margin-top: 14px;
}

#appShell.profile-mode .screen-topbar,
#appShell.profile-mode .app-hero,
#appShell.profile-mode .app-main {
  display: none;
}
@media (min-width: 760px) {
  .profile-fields-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 759px) {
  .auth-card,
  .auth-card.register-profile-mode {
    width: 100%;
    padding: 22px 18px 20px;
    border-radius: 28px;
  }

  .choice-grid,
  .choice-grid-2,
  .theme-grid,
  .app-main,
  .profile-fields-grid {
    grid-template-columns: 1fr;
  }

  .screen-topbar {
    top: 8px;
  }

  .screen-topbar-inner {
    width: 100%;
    justify-content: flex-end;
  }

  .overlay-modal {
    align-items: stretch;
    padding: 12px;
  }

  .sheet-dialog {
    width: 100%;
    max-height: none;
    padding: 18px;
    border-radius: 24px;
  }

  .dialog-head {
    position: static;
  }

  .theme-option {
    min-height: 188px;
  }

  .profile-editor-header {
    display: grid;
  }

  .profile-editor-actions {
    justify-content: stretch;
  }

  .profile-editor-actions > * {
    width: 100%;
  }

  .settings-block {
    padding: 18px;
  }

  .panel {
    padding: 18px;
    border-radius: 24px;
  }

  .app-hero {
    padding: 14px 0 2px;
  }
}
.picker-btn::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  flex: 0 0 auto;
}

.overlay-modal {
  overflow-y: auto;
}


.screen-topbar {
  justify-content: center;
}

.screen-topbar-inner {
  width: min(100%, 820px);
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.screen-topbar-inner > .micro-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 40px;
  padding: 0 16px;
  justify-content: center;
  text-align: center;
  font-size: 14px;
}

.admin-picker-shell .picker-btn {
  min-height: 56px;
  justify-content: center;
}

.admin-picker-dialog {
  width: min(760px, 100%);
  display: grid;
  gap: 16px;
}

.admin-picker-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, white 20%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-soft) 88%, white 12%), color-mix(in srgb, var(--surface-strong) 92%, white 8%));
}

.admin-picker-summary strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.admin-picker-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-height: min(48vh, 420px);
  overflow: auto;
  padding-right: 4px;
}

.admin-picker-option {
  min-height: 92px;
  padding: 16px;
  border-radius: 20px;
  display: grid;
  gap: 6px;
  align-content: start;
}

.admin-picker-option span {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.admin-picker-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.admin-picker-page {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 759px) {
  .screen-topbar-inner {
    width: 100%;
    gap: 8px;
    flex-wrap: wrap;
  }

  .screen-topbar-inner > .micro-btn {
    flex: 1 1 calc(50% - 4px);
  }

  .admin-picker-list {
    grid-template-columns: 1fr;
    max-height: none;
  }

  .admin-picker-summary,
  .admin-picker-footer {
    grid-template-columns: 1fr;
    display: grid;
  }
}


.register-flow-stage {
  display: grid;
  gap: 16px;
}

.settings-page-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 64px);
}

.settings-sidebar {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px 16px;
  border-radius: 28px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, white 20%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 92%, white 8%), color-mix(in srgb, var(--surface-soft) 88%, white 12%));
  box-shadow: 0 20px 36px rgba(18, 58, 44, 0.08);
}

.settings-close {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent 12%);
  color: var(--text);
}

.settings-sidebar-brand {
  display: grid;
  gap: 8px;
}

.settings-sidebar-brand strong {
  font-size: 28px;
  letter-spacing: -0.04em;
}

.settings-sidebar-brand p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.settings-nav {
  display: grid;
  gap: 8px;
}

.settings-nav-btn {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
}

.settings-nav-btn.active {
  background: color-mix(in srgb, var(--primary-soft) 72%, var(--surface-strong) 28%);
  border-color: color-mix(in srgb, var(--border-strong) 80%, white 20%);
  color: var(--primary-strong);
}

.settings-logout {
  margin-top: auto;
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 22%, transparent 78%);
  background: color-mix(in srgb, var(--surface-strong) 82%, transparent 18%);
}

.settings-content-shell {
  display: grid;
}

.settings-panel-view {
  display: grid;
  gap: 18px;
  align-content: start;
}

.settings-panel-head {
  display: grid;
  gap: 10px;
}

.settings-panel-head h2 {
  margin: 0;
  font-size: clamp(32px, 5vw, 44px);
  letter-spacing: -0.05em;
}

.settings-panel-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
  max-width: 42rem;
}

.settings-theme-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

#settingsPasswordPanel .btn,
#settingsAdminPanel .picker-btn {
  width: fit-content;
  min-width: 220px;
}

#settingsAdminPanel .inspector {
  margin-bottom: 0;
}

@media (max-width: 959px) {
  .settings-page-shell {
    grid-template-columns: 1fr;
  }

  .settings-sidebar {
    position: static;
  }
}

@media (max-width: 759px) {
  .settings-page-shell {
    min-height: auto;
  }

  .settings-sidebar {
    padding: 16px;
    border-radius: 24px;
  }

  .settings-nav {
    grid-template-columns: 1fr 1fr;
  }

  .settings-logout {
    width: 100%;
  }

  .settings-panel-head h2 {
    font-size: 30px;
  }

  .settings-theme-grid {
    grid-template-columns: 1fr;
  }
}


.auth-progress {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, white 20%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 92%, white 8%), color-mix(in srgb, var(--surface-soft) 88%, white 12%));
}

.auth-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-progress-top strong {
  font-size: 13px;
  letter-spacing: -0.01em;
}

.auth-progress-top span {
  color: var(--muted);
  font-size: 13px;
}

.auth-progress-track {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.auth-progress-segment {
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-soft) 72%, #ccd9d1 28%);
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.auth-progress-segment.active {
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
}

.auth-progress-segment.current {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-soft) 88%, transparent 12%);
  transform: scaleY(1.12);
}


.profile-editor-shell {
  position: fixed;
  inset: 0;
  z-index: 32;
  margin: 0;
  padding: 22px 20px;
  width: 100%;
  max-width: none;
  overflow: auto;
  border: 0;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--primary-soft) 88%, transparent 12%), transparent 28%),
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 18%, transparent 82%), transparent 24%),
    var(--bg);
  box-shadow: none;
}

.profile-editor-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(247, 251, 248, 0.82);
  backdrop-filter: blur(10px);
  z-index: -1;
}

body.dark-mode .profile-editor-shell::before {
  background: rgba(9, 15, 14, 0.82);
}

.settings-page-shell {
  width: min(1180px, 100%);
  min-height: calc(100vh - 44px);
  margin: 0 auto;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
}

.settings-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: calc(100vh - 44px);
  padding: 22px 18px;
  border-radius: 30px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 94%, white 6%), color-mix(in srgb, var(--surface-soft) 90%, white 10%));
  box-shadow: 0 24px 46px rgba(18, 58, 44, 0.12);
}

.settings-close {
  width: fit-content;
  min-width: 72px;
  height: 48px;
  padding: 0 16px;
  border-radius: 18px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.settings-sidebar-brand {
  gap: 10px;
  padding: 6px 4px 2px;
}

.settings-sidebar-brand .badge {
  width: fit-content;
}

.settings-sidebar-brand strong {
  font-size: clamp(30px, 4vw, 38px);
}

.settings-nav {
  gap: 10px;
}

.settings-nav-btn {
  min-height: 52px;
  padding: 0 16px;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
}

.settings-nav-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--surface-soft) 78%, white 22%);
}

.settings-nav-btn.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 82%, white 18%), color-mix(in srgb, var(--surface-strong) 88%, var(--primary-soft) 12%));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}

.settings-content-shell {
  min-height: calc(100vh - 44px);
}

.settings-panel-view {
  min-height: calc(100vh - 44px);
  padding: 28px 30px;
  border-radius: 32px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, white 18%);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 96%, white 4%), color-mix(in srgb, var(--surface-muted) 94%, white 6%));
  box-shadow: 0 24px 46px rgba(18, 58, 44, 0.1);
}

.settings-panel-head {
  padding-bottom: 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, white 22%);
}

.settings-panel-head .badge {
  width: fit-content;
}

.settings-shell {
  border-radius: 28px;
  box-shadow: 0 14px 30px rgba(16, 46, 35, 0.06);
}

.settings-block {
  gap: 18px;
}

.settings-theme-grid .theme-option {
  min-height: 184px;
}

#settingsPasswordPanel .btn,
#settingsAdminPanel .picker-btn {
  width: 100%;
  min-width: 0;
}

#settingsAdminPanel .settings-shell,
#settingsPasswordPanel .settings-shell,
#settingsThemePanel .settings-shell,
#settingsProfilePanel .settings-shell {
  overflow: hidden;
}

@media (max-width: 959px) {
  .profile-editor-shell {
    padding: 16px 14px;
  }

  .settings-page-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .settings-sidebar {
    position: static;
    min-height: auto;
    padding: 14px;
    gap: 14px;
  }

  .settings-sidebar-brand {
    gap: 6px;
    padding: 0;
  }

  .settings-sidebar-brand p {
    display: none;
  }

  .settings-nav {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .settings-content-shell,
  .settings-panel-view {
    min-height: auto;
  }

  .settings-panel-view {
    padding: 22px 18px;
    border-radius: 28px;
  }
}

@media (max-width: 759px) {
  .profile-editor-shell {
    padding: 0;
    background: var(--bg);
  }

  .profile-editor-shell::before {
    display: none;
  }

  .settings-page-shell {
    width: 100%;
    gap: 0;
  }

  .settings-sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 14px 14px 12px;
    background: color-mix(in srgb, var(--surface-strong) 92%, transparent 8%);
    backdrop-filter: blur(14px);
  }

  .settings-close {
    min-width: 64px;
    height: 44px;
    padding: 0 14px;
    border-radius: 16px;
  }

  .settings-sidebar-brand .badge {
    display: none;
  }

  .settings-sidebar-brand strong {
    font-size: 28px;
  }

  .settings-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    grid-template-columns: none;
  }

  .settings-nav::-webkit-scrollbar {
    display: none;
  }

  .settings-nav-btn {
    min-width: max-content;
    padding: 0 14px;
    min-height: 42px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--border) 78%, white 22%);
    background: color-mix(in srgb, var(--surface-soft) 84%, white 16%);
  }

  .settings-logout {
    margin-top: 2px;
    width: fit-content;
    min-width: max-content;
    background: transparent;
  }

  .settings-content-shell {
    padding: 10px 14px 18px;
  }

  .settings-panel-view {
    padding: 18px 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .settings-panel-head {
    padding: 0 4px 14px;
    border-bottom: 0;
  }

  .settings-panel-head .badge {
    display: inline-flex;
  }

  .settings-shell {
    border-radius: 26px;
    box-shadow: 0 16px 34px rgba(18, 58, 44, 0.08);
  }

  .settings-block {
    padding: 20px 18px;
  }
}

/* calm mobile reading refresh */
:root {
  --bg: linear-gradient(180deg, #e9f4ff 0%, #f6fbff 18%, #fbfcfe 42%, #ffffff 100%);
  --bg-glow-1: rgba(83, 170, 255, 0.18);
  --bg-glow-2: rgba(167, 214, 255, 0.16);
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-soft: #f6f8fb;
  --surface-muted: #fafbfd;
  --text: #233445;
  --muted: #6c7b8c;
  --border: rgba(130, 153, 178, 0.15);
  --border-strong: rgba(130, 153, 178, 0.24);
  --primary: #35a0ff;
  --primary-strong: #1c83e6;
  --primary-soft: rgba(53, 160, 255, 0.12);
  --accent: #b8d9f4;
  --warn: #c87979;
  --shadow: 0 16px 40px rgba(60, 84, 110, 0.08);
  --shadow-soft: 0 10px 24px rgba(60, 84, 110, 0.05);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 20px;
  --radius-sm: 16px;
}

body[data-theme="light"] {
  --bg: linear-gradient(180deg, #e9f4ff 0%, #f6fbff 18%, #fbfcfe 42%, #ffffff 100%);
  --primary: #35a0ff;
  --primary-strong: #1c83e6;
  --primary-soft: rgba(53, 160, 255, 0.12);
}

body[data-theme="dark"] {
  --bg: linear-gradient(180deg, #eef5fb 0%, #f7fbff 24%, #ffffff 100%);
  --bg-glow-1: rgba(109, 150, 199, 0.15);
  --bg-glow-2: rgba(179, 208, 231, 0.12);
  --surface: rgba(247, 251, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --surface-soft: #f3f7fb;
  --surface-muted: #f8fbfd;
  --text: #243647;
  --muted: #6d7c89;
  --border: rgba(132, 153, 173, 0.16);
  --border-strong: rgba(132, 153, 173, 0.24);
  --primary: #4a9ae8;
  --primary-strong: #2d7fd0;
  --primary-soft: rgba(74, 154, 232, 0.12);
  --shadow: 0 16px 40px rgba(60, 84, 110, 0.08);
  --shadow-soft: 0 10px 24px rgba(60, 84, 110, 0.05);
}

body[data-theme="ocean"] {
  --bg: linear-gradient(180deg, #eaf6fb 0%, #f8fcff 28%, #ffffff 100%);
  --primary: #4599c7;
  --primary-strong: #2a7ca8;
  --primary-soft: rgba(69, 153, 199, 0.12);
}

body[data-theme="forest"] {
  --bg: linear-gradient(180deg, #eef7f1 0%, #f8fbf8 26%, #ffffff 100%);
  --primary: #5e9a76;
  --primary-strong: #43785b;
  --primary-soft: rgba(94, 154, 118, 0.12);
}

body[data-theme="dawn"] {
  --bg: linear-gradient(180deg, #fff3ec 0%, #fffbf8 28%, #ffffff 100%);
  --primary: #df9d7a;
  --primary-strong: #c17b58;
  --primary-soft: rgba(223, 157, 122, 0.12);
}

body[data-theme="paper"] {
  --bg: linear-gradient(180deg, #f2efe8 0%, #faf8f3 26%, #ffffff 100%);
  --primary: #8d9fb0;
  --primary-strong: #6f8495;
  --primary-soft: rgba(141, 159, 176, 0.12);
}

body[data-theme="glacier"] {
  --bg: linear-gradient(180deg, #eff8fd 0%, #f7fbfe 28%, #ffffff 100%);
  --primary: #78b7d1;
  --primary-strong: #5699b6;
  --primary-soft: rgba(120, 183, 209, 0.12);
}

body[data-theme="matcha"] {
  --bg: linear-gradient(180deg, #f3f8ef 0%, #fafcf7 28%, #ffffff 100%);
  --primary: #88ac73;
  --primary-strong: #6f915c;
  --primary-soft: rgba(136, 172, 115, 0.12);
}

body[data-theme="amber"] {
  --bg: linear-gradient(180deg, #fff6ea 0%, #fffbf5 28%, #ffffff 100%);
  --primary: #d49a52;
  --primary-strong: #b67d38;
  --primary-soft: rgba(212, 154, 82, 0.14);
}

body[data-theme="slate"] {
  --bg: linear-gradient(180deg, #eef3f8 0%, #f8fafc 28%, #ffffff 100%);
  --primary: #7e93a9;
  --primary-strong: #617589;
  --primary-soft: rgba(126, 147, 169, 0.12);
}

html,
body {
  background:
    radial-gradient(circle at top center, rgba(112, 184, 255, 0.22), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0)),
    var(--bg);
}

body::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.32) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.18;
}

.page {
  width: min(100%, 480px);
  padding: 14px 14px 108px;
}

.app-shell {
  gap: 14px;
}

.screen-topbar {
  top: 10px;
  margin-bottom: 0;
}

.screen-topbar-inner {
  width: 100%;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 10px 24px rgba(82, 106, 129, 0.08);
  backdrop-filter: blur(18px);
}

.micro-btn {
  min-width: 68px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(149, 170, 195, 0.22);
  color: var(--text);
  box-shadow: none;
}

.app-hero {
  padding: 18px 18px 12px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(233, 244, 255, 0.95), rgba(255, 255, 255, 0.92) 72%),
    radial-gradient(circle at top right, rgba(53, 160, 255, 0.16), transparent 38%);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.app-hero::after {
  right: -36px;
  top: -36px;
  width: 156px;
  height: 156px;
  background: radial-gradient(circle, rgba(53, 160, 255, 0.14), transparent 70%);
}

.app-hero .badge {
  background: rgba(255, 255, 255, 0.7);
  color: var(--primary-strong);
}

.app-hero h1 {
  margin-top: 10px;
  font-size: clamp(28px, 8vw, 36px);
  letter-spacing: -0.05em;
}

.app-hero p {
  max-width: none;
  font-size: 14px;
  line-height: 1.85;
}

.app-main {
  display: grid;
  gap: 14px;
}

.app-view {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 18px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(250, 252, 255, 0.96)),
    radial-gradient(circle at top right, rgba(53, 160, 255, 0.06), transparent 35%);
  box-shadow: var(--shadow);
}

.panel::before {
  width: 86px;
  margin-bottom: 16px;
  background: linear-gradient(90deg, rgba(53, 160, 255, 0.55), rgba(184, 217, 244, 0.16), transparent 96%);
}

.section-head {
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 22px;
  letter-spacing: -0.04em;
}

.section-head p {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.8;
}

.date-nav {
  grid-template-columns: 76px minmax(0, 1fr) 76px;
  padding: 6px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(175, 194, 214, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.date-pill {
  border-radius: 20px;
  background: rgba(245, 249, 253, 0.95);
  border: 1px solid rgba(175, 194, 214, 0.12);
  box-shadow: none;
}

.date-pill-button {
  width: 100%;
  padding: 8px 10px;
  appearance: none;
  cursor: pointer;
  text-align: center;
}

.date-pill-button:hover:not(:disabled) {
  background: rgba(239, 246, 252, 0.98);
}

.date-pill-button:focus-visible {
  outline: 0;
  border-color: rgba(53, 160, 255, 0.32);
  box-shadow: 0 0 0 3px rgba(53, 160, 255, 0.08);
}

.calendar-dialog {
  width: min(100%, 408px);
  padding: 16px;
}

.calendar-dialog .dialog-head {
  display: none;
}

.calendar-shell {
  display: grid;
  gap: 10px;
  padding-top: 0;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 76px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(238, 246, 255, 0.94), rgba(255, 255, 255, 0.98) 72%),
    radial-gradient(circle at top right, rgba(53, 160, 255, 0.12), transparent 46%);
  border: 1px solid rgba(175, 194, 214, 0.14);
}

.calendar-toolbar strong {
  text-align: center;
  font-size: 17px;
  letter-spacing: -0.03em;
}

.calendar-nav-btn {
  min-height: 38px;
  padding: 0 8px;
  font-size: 14px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays {
  padding: 2px 4px 0;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.calendar-day {
  min-height: 42px;
  border: 1px solid rgba(175, 194, 214, 0.16);
  border-radius: 14px;
  background: rgba(247, 249, 252, 0.96);
  color: var(--text);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}

.calendar-day:hover:not(:disabled):not(.is-selected) {
  background: rgba(239, 246, 252, 0.98);
  border-color: rgba(53, 160, 255, 0.2);
}

.calendar-day.is-blank {
  visibility: hidden;
  pointer-events: none;
}

.calendar-day.is-disabled {
  opacity: 0.34;
  cursor: not-allowed;
}

.calendar-day.is-today {
  border-color: rgba(53, 160, 255, 0.28);
  color: var(--primary-strong);
}

.calendar-day.is-selected {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 20px rgba(53, 160, 255, 0.18);
}

.calendar-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding-top: 4px;
}

.calendar-actions .btn,
.calendar-actions .ghost,
.calendar-actions .secondary-btn {
  min-height: 42px;
  padding: 0 8px;
  font-size: 14px;
  border-radius: 16px;
}

@media (max-width: 640px) {
  .calendar-toolbar {
    grid-template-columns: 64px minmax(0, 1fr) 64px;
  }

  .calendar-day {
    min-height: 40px;
    border-radius: 13px;
  }

  .calendar-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .calendar-actions .btn,
  .calendar-actions .ghost,
  .calendar-actions .secondary-btn {
    min-height: 40px;
    font-size: 13px;
  }
}

.nav-btn,
.range-btn,
.secondary-btn,
.ghost,
.tab,
.btn {
  min-height: 44px;
  border-radius: 18px;
  border-color: rgba(152, 173, 194, 0.18);
}

.primary {
  background: linear-gradient(135deg, #55b1ff, #358fe9);
  box-shadow: 0 10px 22px rgba(53, 160, 255, 0.18);
}

.secondary-btn,
.ghost,
.range-btn,
.nav-btn,
.tab {
  background: rgba(247, 249, 252, 0.96);
}

.danger-btn {
  min-height: 46px;
  border-radius: 18px;
  border: 1px solid rgba(212, 153, 153, 0.16);
  background: linear-gradient(180deg, #fff5f5, #fff0f0);
  color: #9d5f5f;
  box-shadow: none;
  font-weight: 700;
}

.grid-3,
.grid-2,
.editing-grid,
.analysis-stack,
.stats-grid,
.history-section,
.me-action-group {
  display: grid;
  gap: 14px;
}

.meal-card,
.summary-card,
.analysis-card,
.feedback-card,
.history-card,
.reading-note-card {
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(164, 183, 205, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 252, 0.96)),
    radial-gradient(circle at top right, rgba(53, 160, 255, 0.05), transparent 38%);
  box-shadow: var(--shadow-soft);
}

.reading-note-card {
  background:
    linear-gradient(180deg, rgba(248, 245, 238, 0.96), rgba(255, 255, 255, 0.96)),
    radial-gradient(circle at top right, rgba(53, 160, 255, 0.06), transparent 38%);
}

.reading-note-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.analysis-content,
.me-reading-content {
  margin-top: 12px;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(210, 216, 224, 0.22);
  background:
    linear-gradient(180deg, rgba(248, 245, 238, 0.92), rgba(255, 255, 255, 0.92)),
    radial-gradient(circle at top, rgba(184, 217, 244, 0.12), transparent 48%);
  font-size: 14px;
  line-height: 1.95;
  color: #364556;
  min-height: 0;
}

.input,
textarea,
select {
  border-radius: 20px;
  border-color: rgba(159, 177, 197, 0.18);
  background: rgba(248, 250, 252, 0.96);
  box-shadow: none;
}

.input:focus,
textarea:focus,
select:focus {
  border-color: rgba(53, 160, 255, 0.28);
  box-shadow: 0 0 0 4px rgba(53, 160, 255, 0.08);
  background: #ffffff;
}

textarea {
  min-height: 124px;
}

.empty,
.empty-box {
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.98));
}

.score-chip {
  background: linear-gradient(135deg, #eaf5ff, #dceeff);
  color: #2f6e9d;
  box-shadow: none;
}

.history-card::before {
  width: 3px;
  background: linear-gradient(180deg, rgba(53, 160, 255, 0.72), transparent);
}

.history-score,
.tag,
.micro-chip {
  background: rgba(235, 244, 252, 0.92);
  color: #45759a;
  border-color: rgba(160, 183, 206, 0.18);
}

.metric-value {
  font-size: clamp(28px, 8vw, 36px);
}

.me-overview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.me-summary-card {
  min-height: 156px;
}

.me-action-group .full {
  width: 100%;
}

.floating-nav {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100vw - 28px), 428px);
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 36px rgba(72, 95, 119, 0.14);
  backdrop-filter: blur(18px);
  z-index: 22;
}

body.auth-mode .floating-nav {
  display: none !important;
}

.floating-nav-btn {
  min-height: 52px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  display: grid;
  gap: 2px;
  justify-items: center;
  align-content: center;
  box-shadow: none;
}

.floating-nav-btn .floating-nav-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.floating-nav-btn small {
  font-size: 10px;
}

.floating-nav-btn.active {
  background: linear-gradient(180deg, rgba(233, 244, 255, 0.98), rgba(255, 255, 255, 0.98));
  color: var(--primary-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.overlay-modal {
  padding: 14px;
  align-items: end;
}

#datePickerModal {
  align-items: center;
  justify-items: center;
}

.sheet-dialog,
.theme-dialog,
.password-dialog,
.admin-picker-dialog {
  width: min(100%, 452px);
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 42px rgba(72, 95, 119, 0.16);
  backdrop-filter: blur(18px);
}

.dialog-head {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(191, 204, 218, 0.18);
}

.profile-editor-shell {
  position: fixed;
  inset: 0;
  z-index: 26;
  padding: 14px;
  display: grid;
  place-items: end center;
  background: rgba(235, 242, 250, 0.44);
  backdrop-filter: blur(14px);
}

#appShell.profile-mode .screen-topbar {
  display: flex !important;
}

#appShell.profile-mode .app-hero {
  display: flex !important;
}

#appShell.profile-mode .app-main {
  display: grid !important;
}

.settings-page-shell {
  width: min(100%, 452px);
  max-height: calc(100vh - 28px);
  overflow: auto;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 20px 46px rgba(72, 95, 119, 0.16);
}

.settings-sidebar {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid rgba(191, 204, 218, 0.18);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
}

.settings-content-shell {
  min-height: auto;
}

.settings-panel-view {
  min-height: auto;
}

@media (min-width: 560px) {
  .page {
    padding-top: 22px;
  }

  .grid-2.stats-grid,
  .me-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 559px) {
  .page {
    width: 100%;
  }

  .grid-2.stats-grid,
  .me-overview-grid {
    grid-template-columns: 1fr;
  }
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app-view:not(.hidden) {
  animation: app-view-rise 0.28s ease both;
}

.panel-editor {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 252, 255, 0.98)),
    radial-gradient(circle at top right, rgba(53, 160, 255, 0.08), transparent 34%);
}

.panel-history {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(251, 251, 249, 0.98)),
    radial-gradient(circle at top right, rgba(128, 173, 148, 0.08), transparent 34%);
}

.panel-me {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 247, 242, 0.98)),
    radial-gradient(circle at top right, rgba(240, 182, 143, 0.08), transparent 34%);
}

.summary-card {
  display: grid;
  gap: 14px;
  align-content: space-between;
}

.summary-card .hint {
  line-height: 1.7;
}

.meal-card textarea,
#badHabits {
  line-height: 1.9;
  padding: 15px 16px;
}

.analysis-card,
.feedback-card,
.summary-card,
.history-card,
.meal-card,
.reading-note-card {
  position: relative;
  overflow: hidden;
}

.analysis-card::after,
.feedback-card::after,
.summary-card::after,
.history-card::after,
.meal-card::after,
.reading-note-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 34%);
}

.history {
  display: grid;
  gap: 12px;
}

.history-card {
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.history-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(72, 95, 119, 0.1);
}

.floating-nav-btn.active small {
  color: rgba(47, 110, 157, 0.82);
}

.screen-topbar-inner > .micro-btn {
  backdrop-filter: blur(14px);
}

.me-reading-content,
.analysis-content {
  letter-spacing: 0.01em;
}

@keyframes app-view-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* settings refresh */
.profile-editor-shell {
  padding: 16px;
  overflow-y: auto;
  align-items: center;
}

.settings-page-shell {
  position: relative;
  width: min(100%, 560px);
  min-height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  overflow: hidden;
  padding: 22px 18px 86px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-radius: 32px;
}

.settings-shell-head {
  display: grid;
  gap: 8px;
  padding-right: 44px;
}

.settings-shell-head .badge {
  width: fit-content;
}

.settings-shell-head strong {
  font-size: clamp(28px, 6vw, 34px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.settings-shell-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.settings-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-strong) 90%, white 10%);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}

.settings-nav.settings-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-nav-grid .settings-nav-btn {
  min-height: 48px;
  justify-content: center;
  text-align: center;
  padding: 10px 12px;
}

.settings-content-shell {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 0 22px;
}

.settings-panel-view {
  min-height: auto;
  flex: 1 1 auto;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.settings-panel-head {
  padding: 2px 4px 14px;
  border-bottom: 0;
}

.settings-shell,
#settingsThemePanel .settings-shell,
#settingsProfilePanel .settings-shell,
#settingsPasswordPanel .settings-shell,
#settingsAdminPanel .settings-shell {
  overflow: visible !important;
  border-radius: 28px;
}

.settings-block {
  padding: 20px 18px;
}

.me-action-group {
  grid-template-columns: 1fr;
}

.me-action-group .btn,
.me-action-group .secondary-btn {
  width: 100%;
}

.settings-theme-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px;
}

.settings-theme-grid .theme-option {
  min-height: 196px;
  padding: 14px;
  align-content: start;
}

.theme-palette {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.theme-palette i {
  display: block;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.45);
}

.theme-option[data-theme="light"] .palette-a { background: #35a0ff; }
.theme-option[data-theme="light"] .palette-b { background: #e9f4ff; }
.theme-option[data-theme="light"] .palette-c { background: #ffffff; }
.theme-option[data-theme="dark"] .palette-a { background: #2d7fd0; }
.theme-option[data-theme="dark"] .palette-b { background: #eef5fb; }
.theme-option[data-theme="dark"] .palette-c { background: #f7fbff; }
.theme-option[data-theme="ocean"] .palette-a { background: #4599c7; }
.theme-option[data-theme="ocean"] .palette-b { background: #d7eef9; }
.theme-option[data-theme="ocean"] .palette-c { background: #ffffff; }
.theme-option[data-theme="forest"] .palette-a { background: #5e9a76; }
.theme-option[data-theme="forest"] .palette-b { background: #e7f2ea; }
.theme-option[data-theme="forest"] .palette-c { background: #ffffff; }
.theme-option[data-theme="dawn"] .palette-a { background: #df9d7a; }
.theme-option[data-theme="dawn"] .palette-b { background: #fff2ea; }
.theme-option[data-theme="dawn"] .palette-c { background: #ffffff; }
.theme-option[data-theme="paper"] .palette-a { background: #8d9fb0; }
.theme-option[data-theme="paper"] .palette-b { background: #f1ede6; }
.theme-option[data-theme="paper"] .palette-c { background: #ffffff; }
.theme-option[data-theme="glacier"] .palette-a { background: #78b7d1; }
.theme-option[data-theme="glacier"] .palette-b { background: #e7f4fb; }
.theme-option[data-theme="glacier"] .palette-c { background: #ffffff; }
.theme-option[data-theme="matcha"] .palette-a { background: #88ac73; }
.theme-option[data-theme="matcha"] .palette-b { background: #eff5e6; }
.theme-option[data-theme="matcha"] .palette-c { background: #ffffff; }
.theme-option[data-theme="amber"] .palette-a { background: #d49a52; }
.theme-option[data-theme="amber"] .palette-b { background: #fff2dd; }
.theme-option[data-theme="amber"] .palette-c { background: #ffffff; }
.theme-option[data-theme="slate"] .palette-a { background: #7e93a9; }
.theme-option[data-theme="slate"] .palette-b { background: #e9eef4; }
.theme-option[data-theme="slate"] .palette-c { background: #ffffff; }

@media (max-width: 640px) {
  .profile-editor-shell {
    padding: 0;
    align-items: end;
  }

  .settings-page-shell {
    width: 100%;
    max-height: 100vh;
    min-height: 100vh;
    border-radius: 28px 28px 0 0;
    padding: 18px 14px 82px;
  }

  .settings-shell-head {
    padding-right: 46px;
  }

  .settings-nav.settings-nav-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}


/* me page refresh */
.me-section-head {
  margin-bottom: 12px;
}

.me-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: stretch;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid rgba(164, 183, 205, 0.18);
  background:
    linear-gradient(135deg, rgba(238, 247, 255, 0.96), rgba(255, 255, 255, 0.98) 68%),
    radial-gradient(circle at top right, rgba(53, 160, 255, 0.16), transparent 42%);
  box-shadow: var(--shadow-soft);
}

.me-hero-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.me-hero-name {
  margin: 0;
  font-size: clamp(28px, 7vw, 36px);
  letter-spacing: -0.05em;
  line-height: 1.02;
}

.me-hero-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.me-hero-side {
  min-width: 108px;
  display: grid;
  gap: 8px;
  align-content: space-between;
  justify-items: end;
  text-align: right;
}

.me-theme-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.me-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

#openThemeFromMeBtn {
  display: none !important;
}

.me-quick-card {
  min-height: 152px;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(164, 183, 205, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 253, 0.98)),
    radial-gradient(circle at top right, rgba(53, 160, 255, 0.08), transparent 42%);
  display: grid;
  align-content: space-between;
  justify-items: start;
  gap: 10px;
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.me-quick-card-primary {
  background:
    linear-gradient(135deg, rgba(53, 160, 255, 0.14), rgba(255, 255, 255, 0.98) 68%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 253, 0.98));
}

.me-quick-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(235, 244, 252, 0.92);
  color: #45759a;
  font-size: 11px;
  font-weight: 800;
}

.me-quick-card strong {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.me-quick-card small {
  color: var(--muted);
  line-height: 1.7;
  font-size: 12px;
}

.me-detail-grid {
  display: grid;
  gap: 12px;
}

.me-focus-card {
  min-height: 0;
  gap: 10px;
}

.me-focus-text {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.me-reading-card {
  background:
    linear-gradient(180deg, rgba(247, 243, 236, 0.98), rgba(255, 255, 255, 0.98)),
    radial-gradient(circle at top right, rgba(53, 160, 255, 0.05), transparent 42%);
}

.me-reading-card .micro-chip {
  background: rgba(245, 236, 223, 0.9);
  color: #8b6d45;
}

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

  .me-hero-side {
    justify-items: start;
    text-align: left;
  }

  .me-quick-grid {
    grid-template-columns: 1fr;
  }

  .me-quick-card {
    min-height: 132px;
  }

  .me-focus-text {
    font-size: 22px;
  }
}


/* record page refresh */
.record-shell {
  display: grid;
  gap: 14px;
}

.record-overview-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 28px;
  border: 1px solid rgba(164, 183, 205, 0.18);
  background:
    linear-gradient(135deg, rgba(238, 247, 255, 0.96), rgba(255, 255, 255, 0.98) 68%),
    radial-gradient(circle at top right, rgba(53, 160, 255, 0.14), transparent 42%);
  box-shadow: var(--shadow-soft);
}

.record-overview-copy {
  display: grid;
  gap: 8px;
}

.record-overview-copy .badge {
  width: fit-content;
}

.record-overview-copy strong {
  font-size: 22px;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.record-overview-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.record-meal-grid {
  gap: 12px;
}

.record-detail-grid {
  gap: 12px;
}

.record-analysis-stack {
  gap: 12px;
}

.record-meal-grid .meal-card {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.record-meal-grid .meal-card .row {
  align-items: center;
}

.record-meal-grid .meal-card strong {
  font-size: 18px;
}

.record-meal-grid .meal-card .hint {
  line-height: 1.6;
}

.record-meal-grid .meal-card textarea {
  min-height: 132px;
}

.record-detail-grid .feedback-card,
.record-analysis-stack .analysis-card {
  padding: 18px;
}

.record-analysis-stack .analysis-card {
  min-height: 0;
}

.record-analysis-stack .analysis-card .analysis-content {
  margin-top: 10px;
}

@media (max-width: 640px) {
  .record-overview-copy strong {
    font-size: 20px;
  }

  .record-meal-grid,
  .record-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* layout corrections */
.screen-topbar,
.app-hero {
  display: none !important;
}

.app-hero .badge {
  display: none;
}

.page {
  width: min(100%, 1200px);
  padding: 18px 14px 36px;
}

.screen-topbar {
  top: 12px;
  margin-bottom: 0;
  justify-content: flex-start;
}

.screen-topbar-inner {
  width: auto;
  justify-content: flex-start;
}

.app-shell {
  gap: 20px;
}

.settings-nav.settings-nav-grid {
  display: flex !important;
  flex-wrap: nowrap;
  gap: 12px;
  overflow: visible;
  padding-bottom: 0;
  align-items: flex-start;
  height: auto;
}

.settings-nav-grid .settings-nav-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 48px;
  min-height: 48px;
  padding: 0 14px;
  font-size: 15px;
  border-radius: 999px !important;
  border: 1px solid color-mix(in srgb, var(--border) 78%, white 22%);
  background: color-mix(in srgb, var(--surface-soft) 84%, white 16%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  align-self: flex-start;
}

.settings-nav-grid .settings-nav-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--surface-soft) 84%, white 16%);
}

.settings-nav-grid .settings-nav-btn.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 82%, white 18%), color-mix(in srgb, var(--surface-strong) 88%, var(--primary-soft) 12%));
  border-color: color-mix(in srgb, var(--border-strong) 80%, white 20%);
  color: var(--primary-strong);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}

.panel-me {
  display: grid;
  gap: 16px;
  align-content: start;
}

.me-quick-grid,
.me-detail-grid {
  margin-top: 4px;
}

.settings-logout {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 12px;
  width: auto;
  z-index: 10;
  margin: 0;
  height: 44px;
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  border-color: rgba(225, 188, 188, 0.22);
  background: linear-gradient(180deg, rgba(255, 247, 247, 0.96), rgba(255, 240, 240, 0.94));
  box-shadow:
    0 18px 34px rgba(232, 146, 148, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 0 0 1px rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(18px);
}

@media (max-width: 640px) {
  .page {
    width: min(100%, 480px);
    padding: 14px 14px 108px;
  }

  .screen-topbar-inner {
    width: 100%;
    justify-content: flex-start;
  }

  .settings-nav.settings-nav-grid {
    gap: 10px;
  }

  .settings-nav-grid .settings-nav-btn {
    height: 46px;
    min-height: 46px;
    padding: 0 8px;
    font-size: 12px;
  }

  .settings-logout {
    height: 42px;
    min-height: 42px;
    left: 14px;
    right: 14px;
    bottom: 10px;
  }
}

/* review page refresh */
.review-shell {
  display: grid;
  gap: 14px;
}

.review-overview-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 28px;
  border: 1px solid rgba(164, 183, 205, 0.18);
  background:
    linear-gradient(135deg, rgba(241, 248, 242, 0.98), rgba(255, 255, 255, 0.98) 68%),
    radial-gradient(circle at top right, rgba(128, 173, 148, 0.14), transparent 42%);
  box-shadow: var(--shadow-soft);
}

.review-overview-copy {
  display: grid;
  gap: 8px;
}

.review-overview-copy .badge {
  width: fit-content;
}

.review-overview-copy strong {
  font-size: 22px;
  letter-spacing: -0.04em;
  line-height: 1.18;
}

.review-overview-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.review-range-group {
  gap: 8px;
}

.review-range-group .range-btn {
  min-width: 70px;
}

.review-stats-grid {
  gap: 12px;
}

.review-summary-card {
  min-height: 0;
}

.review-history-section {
  gap: 12px;
}

.review-history-head {
  align-items: end;
}

.review-history-head > div {
  display: grid;
  gap: 8px;
}

.review-history-head .badge {
  width: fit-content;
}

.review-history-list {
  gap: 14px;
}

.history-card {
  display: grid;
  gap: 14px;
  padding: 18px 18px 18px 20px;
}

.history-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.history-card-heading {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.history-date {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.history-habit-note {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(241, 247, 242, 0.94);
  color: #5f816a;
  font-size: 11px;
  font-weight: 800;
}

.history-meals {
  display: grid;
  gap: 10px;
}

.history-note {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(247, 243, 236, 0.96), rgba(255, 255, 255, 0.98)),
    radial-gradient(circle at top right, rgba(184, 217, 244, 0.08), transparent 44%);
  border: 1px solid rgba(206, 198, 187, 0.24);
}

.history-note strong {
  font-size: 13px;
  color: #7a6751;
}

.history-note p {
  margin: 0;
  line-height: 1.8;
  color: var(--text);
}

@media (max-width: 640px) {
  .review-overview-copy strong {
    font-size: 20px;
  }

  .review-range-group {
    justify-content: flex-start;
  }

  .review-range-group .range-btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }

  .history-card-top {
    flex-direction: column;
    align-items: stretch;
  }

  .history-score {
    width: fit-content;
  }
}

body[data-native-shell="android-app"] .page {
  width: 100%;
  max-width: none;
  padding: 0 0 108px;
}

body[data-native-shell="android-app"] .app-shell {
  gap: 0;
}
