:root {
  --green: #16a34a;
  --green-dark: #15803d;
  --green-light: #dcfce7;
  --green-soft: #f0fdf4;
  --bg: #f6f8f4;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --danger: #dc2626;
  --warn: #d97706;
  --info: #2563eb;
  --protein: #2563eb;
  --fat: #f59e0b;
  --carb: #a855f7;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .16);
  --nav-h: 64px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green-dark); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Boot ---------- */
.boot-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.boot-logo { font-size: 48px; animation: pulse 1.2s ease-in-out infinite; }
.boot-title { font-weight: 800; font-size: 22px; color: var(--green-dark); }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: .8 } 50% { transform: scale(1.1); opacity: 1 } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; line-height: 1.2; transition: transform .08s, background .15s, box-shadow .15s;
  user-select: none; -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(22, 163, 74, .28); }
@media (hover: hover) and (pointer: fine) { .btn-primary:hover { background: var(--green-dark); } }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
@media (hover: hover) and (pointer: fine) { .btn-secondary:hover { background: #f9fafb; } }
.btn-ghost { background: transparent; color: var(--green-dark); }
@media (hover: hover) and (pointer: fine) { .btn-ghost:hover { background: var(--green-soft); } }
.btn-danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.btn-dark { background: #111827; color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 24px; font-size: 17px; border-radius: 16px; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn-icon { padding: 10px; border-radius: 12px; }
.btn .spinner { width: 16px; height: 16px; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(22, 163, 74, .12); }
.textarea { min-height: 96px; resize: vertical; }
.input-unit { position: relative; }
.input-unit .input { padding-right: 48px; }
.input-unit span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.field-error { color: var(--danger); font-size: 13px; }

/* ---------- Cards & layout ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card-lg { border-radius: var(--radius-lg); padding: 22px; }
.card-soft { background: var(--green-soft); box-shadow: none; border: 1px solid var(--green-light); }
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; }
.page { padding: 16px 0 calc(var(--nav-h) + var(--sab) + 24px); }
.page-title { font-size: 24px; font-weight: 800; margin-bottom: 14px; }
.section-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--green-light); color: var(--green-dark); font-size: 13px; font-weight: 600; }
.chip.warn { background: #fef3c7; color: #92400e; }
.chip.danger { background: #fee2e2; color: #991b1b; }
.chip.info { background: #dbeafe; color: #1e40af; }
.chip.gray { background: #f3f4f6; color: #374151; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--green); color: #fff; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .emoji { width: 40px; height: 40px; border-radius: 12px; background: var(--green-soft); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.clickable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.clickable:active { opacity: .7; }
.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.alert-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-success { background: var(--green-soft); color: var(--green-dark); border: 1px solid var(--green-light); }
.pre { white-space: pre-wrap; word-break: break-word; }

/* ---------- Spinner / skeleton ---------- */
.spinner { width: 28px; height: 28px; border: 3px solid rgba(22, 163, 74, .2); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
.btn-primary .spinner { border-color: rgba(255,255,255,.35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg) } }
.loading-block { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 0; color: var(--muted); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: calc(12px + var(--sat)); left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #111827; color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg); animation: toast-in .2s ease-out; pointer-events: auto; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--green-dark); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17, 24, 39, .55); z-index: 900; display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease-out; backdrop-filter: blur(2px); }
.modal { background: var(--surface); width: 100%; max-width: 520px; border-radius: 24px 24px 0 0; padding: 20px 20px calc(20px + var(--sab)); max-height: 92vh; overflow: auto; animation: slide-up .22s ease-out; }
.modal-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }
.modal-title { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { border-radius: 24px; padding: 24px; }
  .modal-handle { display: none; }
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes slide-up { from { transform: translateY(30px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---------- Landing ---------- */
.landing { background: linear-gradient(180deg, #ecfdf3 0%, var(--bg) 480px); min-height: 100vh; }
.landing-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; color: var(--green-dark); }
.logo img { width: 32px; height: 32px; border-radius: 9px; }
.hero { display: grid; gap: 18px; padding: 4px 0 40px; align-items: start; }
.hero-copy h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.hero-copy h1 span { color: var(--green); }
.hero-copy .hero-sub { font-size: 15px; color: var(--muted); margin-top: 8px; }
.hero-extra { order: 3; }
.hero-extra > p { font-size: 16px; color: var(--muted); max-width: 520px; }
@media (min-width: 760px) {
  .hero { grid-template-columns: 1fr minmax(360px, 460px); grid-template-rows: auto 1fr; gap: 12px 32px; padding: 30px 0 60px; }
  .hero-copy { grid-column: 1; grid-row: 1; }
  .hero-extra { grid-column: 1; grid-row: 2; order: 0; }
  .quiz { grid-column: 2; grid-row: 1 / span 2; }
  .hero-copy h1 { font-size: clamp(32px, 4vw, 46px); }
  .hero-copy .hero-sub { font-size: 17px; margin-top: 12px; }
}
.hero-points { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero-trust { display: flex; gap: 14px; margin-top: 18px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.hero-trust b { color: var(--text); }

/* Quiz */
.quiz { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 20px; border: 1px solid #e6f4ea; position: relative; overflow: hidden; }
.quiz::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--green), #4ade80); }
.quiz-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 13px; color: var(--muted); font-weight: 600; }
.progress { height: 6px; background: #eef2ee; border-radius: 3px; overflow: hidden; margin-bottom: 18px; }
.progress > div { height: 100%; background: var(--green); border-radius: 3px; transition: width .3s ease; }
.quiz h3 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.quiz .hint { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.options { display: grid; gap: 10px; }
.options.two { grid-template-columns: 1fr 1fr; }
.option { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); text-align: left; transition: all .12s; width: 100%; -webkit-tap-highlight-color: transparent; }
.option:active { transform: scale(.985); }
@media (hover: hover) and (pointer: fine) { .option:hover { border-color: #bbf7d0; background: var(--green-soft); } }
.option.selected { border-color: var(--green); background: var(--green-soft); box-shadow: 0 0 0 3px rgba(22, 163, 74, .12); }
.option .emoji { font-size: 22px; width: 32px; text-align: center; flex-shrink: 0; }
.option .t { font-weight: 600; font-size: 15px; }
.option .d { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.wish-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.wish-chip { padding: 8px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--text); transition: all .12s; -webkit-tap-highlight-color: transparent; }
.wish-chip.on { background: var(--green-light); border-color: var(--green); color: var(--green-dark); }
.wish-chip:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .wish-chip:hover { border-color: #bbf7d0; background: var(--green-soft); } }
.quiz-actions { display: flex; gap: 10px; margin-top: 16px; }
.quiz-actions .btn-primary { flex: 1; }
.fields-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.code-input { letter-spacing: 8px; text-align: center; font-size: 24px; font-weight: 700; }

/* Landing sections */
.section { padding: 36px 0; }
.section h2 { font-size: 26px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.02em; }
.section .lead { color: var(--muted); margin-bottom: 22px; max-width: 620px; }
.features { display: grid; gap: 14px; }
@media (min-width: 700px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .features { grid-template-columns: repeat(4, 1fr); } }
.feature { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.feature .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--green-soft); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 12px; }
.feature h3 { font-size: 16px; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: 14px; }
.steps { display: grid; gap: 14px; counter-reset: step; }
@media (min-width: 700px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { position: relative; padding: 18px 18px 18px 58px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 16px; top: 16px; width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.step h3 { font-size: 16px; margin-bottom: 4px; }
.step p { color: var(--muted); font-size: 14px; }
.plans { display: grid; gap: 14px; }
@media (min-width: 800px) { .plans { grid-template-columns: repeat(3, 1fr); align-items: stretch; } }
.plan { background: var(--surface); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow); border: 1.5px solid var(--line); display: flex; flex-direction: column; gap: 10px; position: relative; }
.plan.featured { border-color: var(--green); background: linear-gradient(180deg, #f0fdf4, #fff); }
.plan .badge { position: absolute; top: -10px; left: 20px; }
.plan .name { font-weight: 700; font-size: 15px; color: var(--muted); }
.plan .price { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.plan .price small { font-size: 15px; color: var(--muted); font-weight: 600; }
.plan ul { margin: 4px 0 8px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.plan li::before { content: '✓'; color: var(--green); font-weight: 800; margin-right: 8px; }
.plan .btn { margin-top: auto; }
.faq details { background: var(--surface); border-radius: 14px; padding: 4px 16px; box-shadow: var(--shadow); margin-bottom: 10px; }
.faq summary { padding: 12px 0; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq summary::after { content: '+'; color: var(--green); font-size: 20px; font-weight: 700; }
.faq details[open] summary::after { content: '–'; }
.faq details p { padding: 0 0 14px; color: var(--muted); font-size: 14px; }
.landing-footer { padding: 30px 0 40px; color: var(--muted); font-size: 13px; text-align: center; }
.landing-footer a { margin: 0 8px; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(246, 248, 244, .92); backdrop-filter: blur(10px); padding: calc(10px + var(--sat)) 0 10px; }
.topbar .container { display: flex; align-items: center; gap: 10px; }
.topbar h1 { font-size: 20px; font-weight: 800; flex: 1; }
.back-btn { width: 36px; height: 36px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: flex; justify-content: space-around; padding: 6px 4px calc(6px + var(--sab)); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); font-weight: 600; padding: 4px 8px; border-radius: 10px; min-width: 56px; }
.bottom-nav a .ic { font-size: 22px; line-height: 1; }
.bottom-nav a.active { color: var(--green-dark); }
.bottom-nav a.scan-btn .ic { width: 48px; height: 48px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; margin-top: -22px; box-shadow: 0 6px 16px rgba(22, 163, 74, .4); font-size: 24px; border: 3px solid var(--bg); }

/* Dashboard */
.ring-wrap { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 132px; height: 132px; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-bg { fill: none; stroke: #eef2ee; stroke-width: 11; }
.ring .ring-fg { fill: none; stroke: var(--green); stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring .ring-fg.over { stroke: var(--warn); }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-text b { font-size: 26px; font-weight: 800; line-height: 1; }
.ring-text span { font-size: 12px; color: var(--muted); margin-top: 4px; }
.macros { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.macro .lbl { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.macro .lbl span:last-child { color: var(--muted); font-weight: 500; }
.macro .bar { height: 7px; background: #eef2ee; border-radius: 4px; overflow: hidden; }
.macro .bar > div { height: 100%; border-radius: 4px; transition: width .5s; }
.macro.p .bar > div { background: var(--protein); }
.macro.f .bar > div { background: var(--fat); }
.macro.c .bar > div { background: var(--carb); }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-action { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; border: 1px solid transparent; }
.quick-action:active { border-color: var(--green); }
.quick-action .ic { font-size: 26px; }
.quick-action b { font-size: 15px; }
.quick-action span { font-size: 12px; color: var(--muted); }
.meal { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.meal:last-child { border-bottom: 0; }
.meal .thumb { width: 48px; height: 48px; border-radius: 12px; background: var(--green-soft); object-fit: cover; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.meal .info { flex: 1; min-width: 0; }
.meal .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.meal .info span { font-size: 12.5px; color: var(--muted); }
.meal .kcal { font-weight: 700; white-space: nowrap; }
.kbju-inline { display: flex; gap: 10px; font-size: 12.5px; color: var(--muted); }
.kbju-inline b { color: var(--text); }

/* Scan */
.tabs { display: flex; background: #eef2ee; border-radius: 12px; padding: 4px; gap: 4px; }
.tabs button { flex: 1; padding: 10px; border-radius: 9px; border: 0; background: transparent; font-weight: 600; color: var(--muted); }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dropzone { border: 2px dashed #bbf7d0; border-radius: var(--radius-lg); background: var(--green-soft); padding: 28px 16px; text-align: center; cursor: pointer; transition: background .15s; }
@media (hover: hover) and (pointer: fine) { .dropzone:hover { background: #e7fbee; } }
.dropzone .ic { font-size: 42px; margin-bottom: 8px; }
.dropzone b { display: block; font-size: 16px; }
.dropzone span { color: var(--muted); font-size: 13px; }
.preview { position: relative; border-radius: var(--radius-lg); overflow: hidden; max-height: 360px; background: #000; }
.preview img { width: 100%; height: 100%; max-height: 360px; object-fit: contain; }
.preview .remove { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; border: 0; width: 34px; height: 34px; border-radius: 50%; font-size: 18px; }
.scan-photo { width: 100%; max-height: 300px; object-fit: cover; border-radius: var(--radius); }
.kbju-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kbju-cell { background: var(--bg); border-radius: 12px; padding: 10px 6px; text-align: center; }
.kbju-cell b { display: block; font-size: 18px; font-weight: 800; }
.kbju-cell span { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kbju-cell.k b { color: var(--green-dark); } .kbju-cell.p b { color: var(--protein); } .kbju-cell.f b { color: var(--fat); } .kbju-cell.c b { color: var(--carb); }
.ingredient { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ingredient:last-child { border-bottom: 0; }
.ingredient .n { font-weight: 600; }
.ingredient .w { color: var(--muted); font-size: 12.5px; }
.ingredient .v { color: var(--muted); font-size: 12.5px; white-space: nowrap; text-align: right; }
.ingredient .v b { color: var(--text); font-size: 14px; }
.health { display: flex; align-items: center; gap: 10px; }
.health .dots { display: flex; gap: 3px; }
.health .dots i { width: 14px; height: 6px; border-radius: 3px; background: #e5e7eb; }
.health .dots i.on { background: var(--green); }
.health .dots i.on.mid { background: var(--warn); }
.health .dots i.on.low { background: var(--danger); }
.advice-box { background: var(--green-soft); border: 1px solid var(--green-light); border-radius: 14px; padding: 14px; font-size: 14.5px; }
.advice-box b { display: block; margin-bottom: 4px; color: var(--green-dark); }

/* Chat */
.chat { display: flex; flex-direction: column; min-height: calc(100vh - 70px - var(--sat)); }
.chat-messages { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 8px 0 12px; }
.msg { max-width: 86%; padding: 11px 14px; border-radius: 18px; font-size: 15px; white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.msg.user { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 6px; }
.msg.bot { align-self: flex-start; background: var(--surface); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.msg.typing { color: var(--muted); font-style: italic; }
.chat-suggestions { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.chat-suggestions::-webkit-scrollbar { display: none; }
.chat-suggestions button { flex-shrink: 0; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.chat-input { position: sticky; bottom: calc(var(--nav-h) + var(--sab)); background: var(--bg); padding: 8px 0 10px; display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea { flex: 1; min-height: 46px; max-height: 140px; border-radius: 22px; padding: 12px 16px; resize: none; }
.chat-input .send { width: 46px; height: 46px; border-radius: 50%; padding: 0; flex-shrink: 0; font-size: 20px; }

/* History */
.day-card { display: flex; align-items: center; gap: 14px; }
.day-card .date { width: 54px; text-align: center; background: var(--green-soft); border-radius: 12px; padding: 8px 4px; }
.day-card .date b { display: block; font-size: 20px; line-height: 1; }
.day-card .date span { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.day-card .bar { height: 6px; background: #eef2ee; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.day-card .bar > div { height: 100%; background: var(--green); }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-day { text-align: center; padding: 8px 2px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); font-size: 11px; color: var(--muted); }
.week-day b { display: block; font-size: 14px; color: var(--text); }
.week-day.has { background: var(--green-soft); }
.week-day.today { outline: 2px solid var(--green); }

/* Profile */
.profile-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.profile-row:last-child { border-bottom: 0; }
.profile-row .k { color: var(--muted); font-size: 14px; }
.profile-row .v { font-weight: 600; text-align: right; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.menu-item:last-child { border-bottom: 0; }
.menu-item .ic { width: 36px; height: 36px; border-radius: 10px; background: var(--green-soft); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.menu-item .t { flex: 1; font-weight: 600; font-size: 15px; }
.menu-item .arrow { color: var(--muted); }

/* Install guide */
.install-steps { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.install-step { display: flex; gap: 12px; align-items: flex-start; background: var(--bg); border-radius: 12px; padding: 12px; }
.install-step .n { width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.install-step p { font-size: 14px; }
.install-step .ico { display: inline-block; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 13px; }

/* Plan result */
.result-hero { background: linear-gradient(135deg, var(--green) 0%, #22c55e 100%); color: #fff; border-radius: var(--radius-lg); padding: 22px; }
.result-hero h2 { font-size: 22px; margin-bottom: 4px; }
.result-hero p { opacity: .9; font-size: 14px; }
.result-kbju { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.result-kbju div { background: rgba(255,255,255,.16); border-radius: 12px; padding: 10px 6px; text-align: center; }
.result-kbju b { display: block; font-size: 20px; font-weight: 800; }
.result-kbju span { font-size: 11px; opacity: .9; text-transform: uppercase; letter-spacing: .04em; }
.advices li { margin-bottom: 8px; }
.offer { border: 2px solid var(--green); background: var(--surface); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-lg); position: relative; }
.offer .badge { position: absolute; top: -11px; left: 18px; }
.offer .big-price { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.offer .big-price small { font-size: 16px; color: var(--muted); font-weight: 600; }

/* Admin */
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.admin-tabs button { flex-shrink: 0; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13px; }
.admin-tabs button.active { background: var(--text); color: #fff; border-color: var(--text); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; font-weight: 800; }
.stat span { font-size: 12px; color: var(--muted); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); border-radius: 12px; overflow: hidden; }
.table th, .table td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.table th { background: #f9fafb; color: var(--muted); font-weight: 600; font-size: 12px; }
.table tr:last-child td { border-bottom: 0; }
@media (hover: hover) and (pointer: fine) { .table tr.clickable:hover td { background: var(--green-soft); } }

/* Empty state */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .ic { font-size: 44px; margin-bottom: 8px; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* Desktop tweaks for app */
@media (min-width: 900px) {
  .app-shell .container { max-width: 720px; }
}
