:root {
  --bg: #F4F1E9;
  --surface: #FFFFFF;
  --surface-2: #EEE9DD;
  --surface-3: #E6E0D2;
  --ink: #18201B;
  --ink-2: #5A645D;
  --ink-3: #8C948E;
  --line: #E2DCCE;
  --brand: #2B5741;
  --brand-2: #3D7458;
  --brand-ink: #FFFFFF;
  --brand-soft: #DDE9E0;
  --accent: #C6E06A;
  --warm: #DD7A4E;
  --warm-soft: #F7E1D5;
  --ok: #3B8A5A;
  --warn: #B9772A;
  --warn-soft: #F6E9D3;
  --danger: #C0463D;
  --shadow: 0 1px 2px rgba(24, 32, 27, .04), 0 8px 28px rgba(24, 32, 27, .07);
  --radius: 20px;
  --radius-s: 12px;
  --font-display: "Fraunces", Georgia, serif;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1311;
    --surface: #161C18;
    --surface-2: #1D2520;
    --surface-3: #252F29;
    --ink: #ECF0EC;
    --ink-2: #A1ABA3;
    --ink-3: #6E7871;
    --line: #28312B;
    --brand: #9FD3AF;
    --brand-2: #B7E2C4;
    --brand-ink: #0D1A12;
    --brand-soft: #1E3027;
    --accent: #C6E06A;
    --warm: #EE936B;
    --warm-soft: #3A2419;
    --warn-soft: #33281A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1311; --surface: #161C18; --surface-2: #1D2520; --surface-3: #252F29;
  --ink: #ECF0EC; --ink-2: #A1ABA3; --ink-3: #6E7871; --line: #28312B;
  --brand: #9FD3AF; --brand-2: #B7E2C4; --brand-ink: #0D1A12; --brand-soft: #1E3027;
  --warm: #EE936B; --warm-soft: #3A2419; --warn-soft: #33281A;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; letter-spacing: -.01em; margin: 0; }
p { margin: 0; }
svg { flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 24px; border-radius: 999px;
  background: var(--brand); color: var(--brand-ink);
  font-weight: 600; letter-spacing: .01em;
  transition: transform .15s ease, opacity .15s ease, background .2s;
}
.btn:hover { background: var(--brand-2); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft { background: var(--surface-2); color: var(--ink); }
.btn.soft:hover { background: var(--surface-3); }
.btn.small { height: 38px; padding: 0 16px; font-size: 14px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center;
  color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Auth / onboarding shell ---------- */
.split { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.split-art { display: none; }
.split-main { display: flex; flex-direction: column; min-height: 100vh; padding: 20px 16px 24px; }
@media (min-width: 960px) {
  .split { grid-template-columns: 44% 1fr; }
  .split-art {
    display: flex; flex-direction: column; justify-content: space-between;
    position: sticky; top: 0; height: 100vh; padding: 48px;
    background: #1F4532; color: #F4F1E9; overflow: hidden;
  }
  .split-main { padding: 40px 64px; }
}
.art-quote { font-family: var(--font-display); font-size: 40px; line-height: 1.1; font-weight: 400; max-width: 14ch; position: relative; z-index: 1; }
.art-quote em { font-style: italic; color: var(--accent); }
:root[data-theme="dark"] .art-quote em, .split-art .art-quote em { color: var(--accent); }
.art-foot { font-size: 14px; opacity: .8; max-width: 36ch; position: relative; z-index: 1; }
.art-rings { position: absolute; right: -140px; bottom: -140px; width: 520px; height: 520px; opacity: .18; }

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.split-art .brand-mark { background: var(--accent); color: #18201B; }

.center-col { width: 100%; max-width: 520px; margin: 0 auto; flex: 1; display: flex; flex-direction: column; }

/* Login */
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 24px 0; }
.login h1 { font-size: 40px; line-height: 1.05; }
.login .lead { color: var(--ink-2); font-size: 16px; max-width: 40ch; }
.code-input {
  width: 100%; height: 64px; border-radius: 16px; border: 1.5px solid var(--line);
  background: var(--surface); padding: 0 20px; font-size: 20px; letter-spacing: .18em;
  text-transform: uppercase; font-weight: 600; outline: none; transition: border-color .2s, box-shadow .2s;
}
.code-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.code-input.err { border-color: var(--danger); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.err-msg { color: var(--danger); font-size: 14px; min-height: 20px; }
.hint { font-size: 13px; color: var(--ink-3); display: flex; gap: 8px; align-items: center; }
.hint code { background: var(--surface-2); padding: 2px 8px; border-radius: 6px; color: var(--ink); font-weight: 600; font-family: inherit; letter-spacing: .05em; }

/* Onboarding */
.ob-top { display: flex; align-items: center; gap: 12px; height: 44px; }
.progress { flex: 1; height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s cubic-bezier(.2,.8,.2,1); }
.ob-count { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.ob-body { flex: 1; padding: 28px 0 24px; animation: rise .35s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ob-kicker { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--warm); margin-bottom: 10px; }
.ob-title { font-size: 32px; line-height: 1.12; margin-bottom: 10px; }
.ob-sub { color: var(--ink-2); margin-bottom: 28px; max-width: 46ch; }
.ob-nav { display: flex; gap: 12px; padding-top: 8px; position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding-bottom: 4px; }
.ob-nav .btn:last-child { flex: 1; }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input {
  height: 56px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface);
  padding: 0 18px; font-size: 17px; outline: none; width: 100%; transition: border-color .2s, box-shadow .2s;
}
.input::-webkit-outer-spin-button, .input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.input-unit { position: relative; }
.input-unit .input { padding-right: 56px; }
.input-unit span { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 15px; pointer-events: none; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big-input { font-family: var(--font-display); font-size: 28px; height: 72px; }

.choices { display: grid; gap: 10px; }
.choices.cols-2 { grid-template-columns: 1fr 1fr; }
.choice {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%;
  padding: 16px 18px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface);
  transition: border-color .15s, background .15s, transform .1s;
}
.choice:hover { border-color: var(--ink-3); }
.choice:active { transform: scale(.99); }
.choice.on { border-color: var(--brand); background: var(--brand-soft); }
.choice .c-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); }
.choice.on .c-ico { background: var(--brand); color: var(--brand-ink); }
.choice .c-txt { flex: 1; }
.choice .c-t { font-weight: 600; display: block; }
.choice .c-d { font-size: 13px; color: var(--ink-2); display: block; margin-top: 2px; }
.choice .c-check { width: 22px; height: 22px; border-radius: 99px; border: 1.5px solid var(--line); display: grid; place-items: center; color: transparent; }
.choice.on .c-check { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.seg { display: flex; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; height: 44px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--ink-2); transition: background .15s, color .15s; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 500; transition: all .15s; user-select: none;
}
.chip:hover { border-color: var(--ink-3); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip.love { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip.no { background: transparent; border-color: var(--line); color: var(--ink-3); text-decoration: line-through; }
.chip .dot { width: 6px; height: 6px; border-radius: 9px; background: currentColor; opacity: .6; }

.pref-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-bottom: 20px; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; }
.pref-legend b { font-weight: 600; color: var(--ink); }
.pref-group { margin-bottom: 22px; }
.pref-group h4 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; }

.note {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; font-size: 14px;
  background: var(--brand-soft); color: var(--ink);
}
.note svg { color: var(--brand); margin-top: 1px; }
.note.warn { background: var(--warn-soft); }
.note.warn svg { color: var(--warn); }
.note b { font-weight: 600; }

.pace-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-top: 4px; }

/* Analyzing */
.analyzing { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 24px; }
.pulse { width: 96px; height: 96px; border-radius: 99px; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand); position: relative; }
.pulse::before, .pulse::after { content: ""; position: absolute; inset: 0; border-radius: 99px; border: 2px solid var(--brand); opacity: 0; animation: ring 1.8s ease-out infinite; }
.pulse::after { animation-delay: .9s; }
@keyframes ring { 0% { transform: scale(.9); opacity: .6; } 100% { transform: scale(1.6); opacity: 0; } }
.analyzing ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; text-align: left; }
.analyzing li { display: flex; align-items: center; gap: 10px; color: var(--ink-3); transition: color .3s; font-size: 15px; }
.analyzing li.done { color: var(--ink); }
.analyzing li .tick { width: 22px; height: 22px; border-radius: 99px; border: 1.5px solid var(--line); display: grid; place-items: center; color: transparent; transition: all .3s; }
.analyzing li.done .tick { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; }
.plan-grid > *, .results-grid > *, .prof-grid > *, .shop-grid > * { min-width: 0; }
.sidebar { display: none; }
.main { padding: 16px 16px 104px; max-width: 1180px; width: 100%; margin: 0 auto; }
.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 22px; padding: 6px; box-shadow: var(--shadow);
}
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; border-radius: 16px; font-size: 11px; font-weight: 600; color: var(--ink-3); }
.tabbar button.on { color: var(--brand); background: var(--brand-soft); }
@media (min-width: 960px) {
  .app { grid-template-columns: 248px minmax(0, 1fr); }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh;
    padding: 28px 18px; border-right: 1px solid var(--line); background: var(--surface);
  }
  .sidebar .brand { padding: 0 10px 26px; }
  .sidebar nav { display: grid; gap: 4px; }
  .sidebar nav button { display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 14px; border-radius: 12px; font-weight: 500; color: var(--ink-2); text-align: left; }
  .sidebar nav button:hover { background: var(--surface-2); color: var(--ink); }
  .sidebar nav button.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
  .side-user { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
  .tabbar { display: none; }
  .main { padding: 36px 48px 64px; }
}
.avatar { width: 38px; height: 38px; border-radius: 99px; background: var(--warm); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.side-user .u-n { font-weight: 600; font-size: 14px; }
.side-user .u-g { font-size: 12px; color: var(--ink-2); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .eyebrow { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.page-head h1 { font-size: 30px; line-height: 1.1; }
@media (min-width: 960px) { .page-head h1 { font-size: 38px; } }
.mobile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
@media (min-width: 960px) { .mobile-top { display: none; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h3 { font-size: 19px; margin-bottom: 4px; }
.card .muted { color: var(--ink-2); font-size: 14px; }

/* Day strip */
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 20px; }
.day {
  min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 0; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
  transition: all .15s;
}
.day .d-w { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.day .d-n { font-family: var(--font-display); font-size: 22px; }
.day.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.day.on .d-w { color: var(--bg); opacity: .7; }

.plan-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .plan-grid { grid-template-columns: 1fr 340px; align-items: start; } }

.day-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 20px; }
.day-sum > div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-width: 0; }
.day-sum .k { font-size: 11px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-sum .v { font-family: var(--font-display); font-size: 18px; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-sum .v small { font-family: var(--font); font-size: 11px; color: var(--ink-3); margin-left: 2px; }
@media (min-width: 600px) { .day-sum { gap: 8px; } .day-sum > div { padding: 12px 14px; border-radius: 16px; } .day-sum .k { font-size: 12px; } .day-sum .v { font-size: 22px; } }
.bar { height: 4px; background: var(--surface-3); border-radius: 9px; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 9px; background: var(--brand); }

.timeline { position: relative; display: grid; gap: 14px; }
.meal { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 10px; }
@media (min-width: 600px) { .meal { grid-template-columns: 58px minmax(0, 1fr); gap: 14px; } }
.meal-time { text-align: right; padding-top: 16px; }
.meal-time b { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 500; font-variant-numeric: tabular-nums; }
.meal-time span { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.meal-card {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 12px;
  transition: transform .15s, box-shadow .2s, border-color .2s;
}
.meal-card:hover { box-shadow: var(--shadow); border-color: transparent; transform: translateY(-1px); }
.thumb { width: 64px; height: 64px; border-radius: 14px; position: relative; overflow: hidden; display: grid; place-items: center; background: hsl(var(--h) 48% 90%); }
.thumb .plate { width: 74%; aspect-ratio: 1; border-radius: 50%; background: #FBFAF6; padding: 9%; box-shadow: 0 4px 10px rgba(0,0,0,.10), inset 0 0 0 1px rgba(0,0,0,.04); }
.thumb .plate i { display: block; width: 100%; height: 100%; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255,255,255,.5); }
.thumb.big { width: 100%; height: 100%; border-radius: 0; }
.thumb.big .plate { width: auto; height: 76%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .thumb { background: hsl(var(--h) 24% 20%); } :root:not([data-theme="light"]) .thumb .plate { background: #2A322D; } }
:root[data-theme="dark"] .thumb { background: hsl(var(--h) 24% 20%); }
:root[data-theme="dark"] .thumb .plate { background: #2A322D; }
.mobile-only { margin-bottom: 8px; }
@media (min-width: 960px) { .mobile-only { display: none; } }
.meal-info .tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--warm); }
.meal-info h3 { font-size: 17px; line-height: 1.25; margin: 2px 0 6px; font-family: var(--font); font-weight: 600; letter-spacing: 0; }
.meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 99px; background: var(--surface-2); font-size: 11px; font-weight: 600; color: var(--ink-2); }
.badge.train { background: var(--warm-soft); color: var(--warm); }
.badge.batch { background: var(--brand-soft); color: var(--brand); }

.fast-line { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); padding: 12px 16px; border-radius: 14px; border: 1px dashed var(--line); margin-left: 60px; }
@media (min-width: 600px) { .fast-line { margin-left: 72px; } }

.aside-stack { display: grid; gap: 16px; }

/* Rings */
.macro-ring { display: flex; align-items: center; gap: 18px; }
.ring { width: 112px; height: 112px; border-radius: 99px; display: grid; place-items: center; flex-shrink: 0; }
.ring > div { width: 84px; height: 84px; border-radius: 99px; background: var(--surface); display: grid; place-items: center; text-align: center; }
.ring b { font-family: var(--font-display); font-size: 22px; font-weight: 500; line-height: 1; display: block; }
.ring small { font-size: 11px; color: var(--ink-3); }
.legend { display: grid; gap: 8px; font-size: 14px; flex: 1; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* Stats (results) */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.stat .k { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.stat .v { font-family: var(--font-display); font-size: 32px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .v small { font-family: var(--font); font-size: 14px; color: var(--ink-3); margin-left: 3px; }
.stat .s { font-size: 13px; font-weight: 600; }
.stat.hero { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); grid-column: span 2; }
.stat.hero .k, .stat.hero .v small { color: inherit; opacity: .75; }
.s.good { color: var(--ok); } .s.mid { color: var(--warn); } .s.bad { color: var(--danger); }
.scale { position: relative; height: 8px; border-radius: 9px; margin: 8px 0 2px; background: linear-gradient(90deg, #8BB8D9 0 14%, #5FA878 14% 40%, #E3B04B 40% 60%, #DD7A4E 60% 100%); }
.scale i { position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 99px; background: var(--surface); border: 3px solid var(--ink); transform: translate(-50%, -50%); }

.results-grid { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 16px; }
@media (min-width: 900px) { .results-grid { grid-template-columns: 1fr 1fr; } }
.kv { display: grid; gap: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv > div:last-child { border-bottom: 0; }
.kv span { color: var(--ink-2); }
.kv b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.sched { display: grid; gap: 0; }
.sched > div { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sched > div:last-child { border-bottom: 0; }
.sched b { font-family: var(--font-display); font-weight: 500; font-size: 18px; width: 58px; font-variant-numeric: tabular-nums; }
.sched span { color: var(--ink-2); font-size: 14px; }

/* Sheet / modal */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(10, 14, 12, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  background: var(--bg); width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto;
  border-radius: 28px 28px 0 0; animation: slide .3s cubic-bezier(.2,.8,.2,1);
}
@keyframes slide { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 760px) { .overlay { align-items: center; padding: 24px; } .sheet { border-radius: 28px; max-height: 88vh; } }
.sheet-hero { position: relative; height: 180px; overflow: hidden; }
.sheet-hero svg { width: 100%; height: 100%; }
.sheet-close { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 99px; background: rgba(255,255,255,.9); color: #18201B; display: grid; place-items: center; }
.sheet-body { padding: 22px 20px 28px; }
@media (min-width: 760px) { .sheet-body { padding: 26px 32px 32px; } }
.sheet-body h2 { font-size: 28px; line-height: 1.15; margin: 4px 0 12px; }
.macros-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0 24px; }
.macros-row > div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.macros-row b { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 500; }
.macros-row span { font-size: 12px; color: var(--ink-2); }
.sec-t { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 12px; margin: 24px 0 12px; }
.sheet { overflow-x: hidden; }
.macros-row > div { min-width: 0; }
.ing .q { white-space: nowrap; }
.sec-t h4 { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); }
.ing { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.ing li { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 15px; }
.ing li:last-child { border-bottom: 0; }
.ing .q { margin-left: auto; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.ing .q small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.hand-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; color: var(--brand); flex-shrink: 0; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; display: grid; gap: 14px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 32px 1fr; gap: 12px; font-size: 15px; }
.steps li::before { content: counter(s); width: 32px; height: 32px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.steps li p { padding-top: 5px; }
.why { padding: 16px 18px; border-radius: 16px; background: var(--brand-soft); font-size: 15px; display: flex; gap: 12px; }
.why svg { color: var(--brand); margin-top: 2px; }
.alt-list { display: grid; gap: 10px; }

.portion-seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; }
.portion-seg button { height: 34px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.portion-seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Shopping */
.shop-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .shop-grid { grid-template-columns: 1fr 1fr; } }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; }
.shop-item:last-child { border-bottom: 0; }
.box { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--ink-3); display: grid; place-items: center; color: transparent; flex-shrink: 0; transition: all .15s; }
.shop-item.done .box { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.shop-item.done .n { text-decoration: line-through; color: var(--ink-3); }
.shop-item .n { flex: 1; }
.shop-item .q { color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }

/* Profile */
.prof-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .prof-grid { grid-template-columns: 1fr 1fr; } }
.portion-cards { display: grid; gap: 10px; }

.hand-guide { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .hand-guide { grid-template-columns: repeat(4, 1fr); } }
.hand-guide > div { background: var(--surface-2); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.hand-guide b { color: var(--ink); font-size: 14px; }
.hand-guide .hand-ico { background: var(--surface); }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 99px; font-size: 14px; font-weight: 500; animation: rise .25s; box-shadow: var(--shadow); }
@media (min-width: 960px) { .toast { bottom: 32px; } }

.spacer { height: 16px; }

/* =========================================================
   Camada visual extra — profundidade, textura e movimento
   ========================================================= */
body {
  background:
    radial-gradient(900px 520px at 105% -8%, color-mix(in srgb, var(--brand) 13%, transparent), transparent 70%),
    radial-gradient(760px 480px at -12% 108%, color-mix(in srgb, var(--warm) 10%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .05; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::before { mix-blend-mode: screen; opacity: .035; } }
#app { position: relative; z-index: 1; }
.sidebar { background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

h1 em, h2 em { font-style: italic; color: var(--brand); font-weight: 400; }
.login h1 em { color: var(--warm); }

.btn:not(.soft):not(.ghost) {
  background-image: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,0));
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 6px 18px color-mix(in srgb, var(--brand) 28%, transparent);
}
.card, .stat, .day-sum > div { box-shadow: 0 1px 2px rgba(24,32,27,.03); }
.card { transition: box-shadow .2s, transform .2s; }

/* ---------- Cartão de boas-vindas ---------- */
.hero-card {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 20px; border-radius: 26px; margin-bottom: 18px;
  background:
    radial-gradient(420px 220px at 85% 0%, rgba(198,224,106,.22), transparent 70%),
    linear-gradient(135deg, #24503A 0%, #1A3B2B 100%);
  color: #F4F1E9; box-shadow: 0 14px 40px rgba(26, 59, 43, .28);
}
.hero-rings { position: absolute; right: -90px; top: -110px; width: 340px; height: 340px; opacity: .14; color: #F4F1E9; pointer-events: none; }
.hero-txt { position: relative; min-width: 0; }
.hero-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .7; margin-bottom: 6px; }
.hero-card h1 { font-size: 30px; line-height: 1.08; margin-bottom: 8px; color: #F4F1E9; }
.hero-card h1 em { color: var(--accent); }
.hero-card p { font-size: 14px; opacity: .85; max-width: 46ch; }
.hero-card p b { font-weight: 600; color: var(--accent); }
.hero-ring { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.hero-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hero-ring circle { fill: none; stroke-width: 6; }
.hero-ring .trk { stroke: rgba(255,255,255,.14); }
.hero-ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.hero-ring > div { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.hero-ring b { font-family: var(--font-display); font-size: 20px; font-weight: 500; line-height: 1; }
.hero-ring span { font-size: 10px; opacity: .7; text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
@media (min-width: 960px) {
  .hero-card { padding: 30px 34px; border-radius: 30px; }
  .hero-card h1 { font-size: 40px; }
  .hero-card p { font-size: 15px; }
  .hero-ring { width: 104px; height: 104px; }
  .hero-ring b { font-size: 24px; }
  .hero-rings { width: 460px; height: 460px; right: -120px; top: -170px; }
}

.plan-toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.plan-toolbar .days { margin-bottom: 0; }
.plan-toolbar .portion-seg { align-self: flex-start; }
@media (min-width: 960px) { .plan-toolbar { flex-direction: row; align-items: center; } .plan-toolbar .days { flex: 1; } }

.day { position: relative; padding-bottom: 14px; }
.day:hover:not(.on) { border-color: var(--ink-3); }
.day.today:not(.on) .d-n { color: var(--brand); }
.d-dot { position: absolute; bottom: 6px; left: 50%; width: 5px; height: 5px; border-radius: 9px; transform: translateX(-50%); background: transparent; }
.d-dot.train { background: var(--warm); }

/* ---------- Linha temporal ---------- */
.timeline { --tcol: 50px; --tgap: 10px; }
@media (min-width: 600px) { .timeline { --tcol: 58px; --tgap: 14px; } }
.timeline::before {
  content: ""; position: absolute; top: 26px; bottom: 34px; left: calc(var(--tcol) + var(--tgap) / 2 - 1px); width: 2px;
  background: repeating-linear-gradient(to bottom, var(--line) 0 6px, transparent 6px 11px);
}
.meal { position: relative; }
.meal::before {
  content: ""; position: absolute; z-index: 1; top: 22px; left: calc(var(--tcol) + var(--tgap) / 2 - 5px);
  width: 10px; height: 10px; border-radius: 99px; background: var(--bg); border: 2px solid var(--ink-3);
}
.meal-time { padding-right: 8px; }
.meal.is-next::before { background: var(--warm); border-color: var(--warm); box-shadow: 0 0 0 5px color-mix(in srgb, var(--warm) 22%, transparent); }
.meal.is-done::before { background: var(--brand); border-color: var(--brand); }
.meal.is-next .meal-card { border-color: color-mix(in srgb, var(--warm) 55%, var(--line)); box-shadow: 0 10px 30px color-mix(in srgb, var(--warm) 14%, transparent); }
.meal.is-done .meal-card { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.meal.is-done .meal-info h3 { color: var(--ink-2); }
.meal.is-done .thumb { filter: saturate(.55); opacity: .75; }
.next-pill { display: inline-block; margin-right: 8px; padding: 1px 7px; border-radius: 99px; background: var(--warm); color: #fff; font-size: 10px; letter-spacing: .06em; }

.meal-card { grid-template-columns: 64px minmax(0, 1fr) auto; cursor: pointer; }
.meal-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.done-btn {
  width: 34px; height: 34px; border-radius: 99px; border: 1.5px solid var(--line); display: grid; place-items: center;
  color: transparent; align-self: center; transition: all .2s;
}
.done-btn:hover { border-color: var(--brand); color: var(--brand); }
.meal.is-done .done-btn { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }

/* ---------- Pratos com profundidade ---------- */
.thumb {
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.55), transparent 55%),
    hsl(var(--h) 48% 88%);
}
.thumb .plate {
  background: radial-gradient(circle at 35% 28%, #FFFFFF 0%, #F3EFE6 62%, #E6E0D3 100%);
  box-shadow: 0 6px 14px rgba(40,30,20,.16), 0 1px 0 rgba(255,255,255,.8) inset, 0 -2px 4px rgba(0,0,0,.06) inset;
}
.thumb .plate i { position: relative; overflow: hidden; box-shadow: inset 0 2px 6px rgba(0,0,0,.22); }
.thumb .plate i::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.42), transparent 42%),
    radial-gradient(rgba(255,255,255,.22) 1px, transparent 1.6px) 0 0 / 5px 5px,
    radial-gradient(rgba(0,0,0,.10) 1px, transparent 1.6px) 2px 3px / 7px 7px;
}
.thumb.big {
  background:
    repeating-radial-gradient(circle at 50% 55%, transparent 0 34px, rgba(255,255,255,.28) 34px 35px),
    radial-gradient(circle at 30% 10%, rgba(255,255,255,.5), transparent 60%),
    hsl(var(--h) 46% 84%);
}
.thumb.big .plate { box-shadow: 0 18px 40px rgba(40,30,20,.25), 0 1px 0 rgba(255,255,255,.8) inset; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .thumb { background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.07), transparent 55%), hsl(var(--h) 24% 19%); }
  :root:not([data-theme="light"]) .thumb .plate { background: radial-gradient(circle at 35% 28%, #3A443E, #262E29 80%); }
  :root:not([data-theme="light"]) .thumb.big { background: repeating-radial-gradient(circle at 50% 55%, transparent 0 34px, rgba(255,255,255,.05) 34px 35px), hsl(var(--h) 24% 17%); }
}
.sheet-hero { height: 210px; }

/* ---------- Ecrã de entrada (telemóvel) ---------- */
.mobile-hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 20px 20px 26px; margin-bottom: 4px;
  background: radial-gradient(360px 200px at 90% 0%, rgba(198,224,106,.22), transparent 70%), linear-gradient(135deg, #24503A, #1A3B2B);
  color: #F4F1E9;
}
.mobile-hero .brand-mark { background: var(--accent); color: #18201B; }
.mobile-hero .art-quote { font-size: 30px; margin-top: 44px; }
.mobile-hero .hero-rings { right: -110px; top: -100px; }
.art-quote em { color: var(--accent); font-style: italic; }

/* ---------- Movimento ---------- */
#app.anim .ob-body, #app.anim .page-head, #app.anim .hero-card { animation: rise .5s cubic-bezier(.2,.8,.2,1) both; }
#app.anim .meal { animation: rise .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(80ms + var(--i, 0) * 60ms); }
#app.anim .stat, #app.anim .results-grid > .card, #app.anim .shop-grid > .card, #app.anim .aside-stack > * { animation: rise .55s cubic-bezier(.2,.8,.2,1) both; }
#app.anim .stat:nth-child(2), #app.anim .results-grid > .card:nth-child(2), #app.anim .aside-stack > *:nth-child(2) { animation-delay: 70ms; }
#app.anim .stat:nth-child(3), #app.anim .results-grid > .card:nth-child(3), #app.anim .aside-stack > *:nth-child(3) { animation-delay: 140ms; }
#app.anim .results-grid > .card:nth-child(4) { animation-delay: 210ms; }
#app.anim .ring { animation: spinIn .9s cubic-bezier(.2,.8,.2,1) both; }
@keyframes spinIn { from { transform: rotate(-120deg) scale(.85); opacity: 0; } }
#app:not(.anim) .ob-body { animation: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.meal-card { grid-template-columns: 64px minmax(0, 1fr); position: relative; }
.meal-info { padding-right: 34px; }
.done-btn { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; background: var(--surface); }
.hide-m { display: none; }
@media (min-width: 600px) { .hide-m { display: inline; } }
.timeline { --tcol: 48px; --tgap: 18px; }
@media (min-width: 600px) { .timeline { --tcol: 58px; --tgap: 22px; } }
.meal { grid-template-columns: var(--tcol) minmax(0, 1fr); gap: var(--tgap); }
.meal-time { padding-right: 0; }
.meal-time b { font-size: 17px; }
@media (min-width: 600px) { .meal-time b { font-size: 19px; } }
.fast-line { margin-left: calc(var(--tcol) + var(--tgap)); }
@media (max-width: 599px) { .meal-card { grid-template-columns: 56px minmax(0, 1fr); gap: 12px; padding: 10px; } .meal-card .thumb { width: 56px; height: 56px; } .meta { gap: 4px 10px; } }

/* =========================================================
   Check-in, progresso, Chef IA, instalação
   ========================================================= */
.tabbar { grid-template-columns: repeat(5, 1fr); }
.tabbar button { font-size: 10.5px; }
.muted-s { font-size: 12px; color: var(--ink-3); }
.sec-h { font-size: 24px; margin: 28px 0 14px; }

/* Escalas 1–5 */
.scale5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.scale5 button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); transition: all .15s; }
.scale5 button b { font-family: var(--font-display); font-size: 18px; font-weight: 500; }
.scale5 button span { font-size: 10.5px; color: var(--ink-3); text-align: center; line-height: 1.2; }
.scale5 button.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.scale5 button.on span { color: inherit; opacity: .85; }
.seg button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }

/* Resultado do check-in */
.ck-kcal { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); margin: 6px 0 16px; color: var(--ink-3); }
.ck-kcal div { text-align: center; }
.ck-kcal span { display: block; font-size: 12px; color: var(--ink-2); }
.ck-kcal b { font-family: var(--font-display); font-size: 30px; font-weight: 500; color: var(--ink); }
.ck-kcal div:last-of-type b { color: var(--brand); }
.ck-kcal small { width: 100%; text-align: center; font-size: 12px; margin-top: -6px; }
.ck-msgs { display: grid; gap: 10px; }
.ck-msg { display: flex; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.ck-msg .c-ico, .install-card .c-ico, .ck-banner .c-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.ck-msg b { display: block; margin-bottom: 2px; }
.ck-msg p { font-size: 14px; color: var(--ink-2); }

/* Cartão de check-in no progresso */
.ck-hero { flex-wrap: wrap; }
.ck-hero .ck-btn { background: var(--accent); color: #18201B; box-shadow: none; position: relative; }
.ck-hero .ck-btn:hover { background: #d4ea85; }
.ck-hero:not(.due) { background: linear-gradient(135deg, #2B4A3B, #1E3529); }
.ck-banner {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; margin: -6px 0 16px;
  padding: 12px 14px; border-radius: 18px; background: var(--warm-soft); border: 1px solid color-mix(in srgb, var(--warm) 35%, transparent); color: var(--ink);
}
.ck-banner > span:nth-child(2) { flex: 1; }
.ck-banner b { display: block; }
.ck-banner > span:nth-child(2) span { font-size: 13px; color: var(--ink-2); }
.ck-banner .c-ico { background: var(--warm); color: #fff; }

/* Gráfico de peso */
.wchart { width: 100%; height: auto; display: block; overflow: visible; }
.wchart text { font-size: 11px; fill: var(--ink-3); font-family: var(--font); }
.wchart .grid { stroke: var(--line); stroke-width: 1; }
.wchart .goal { stroke: var(--warm); stroke-width: 1.5; stroke-dasharray: 5 5; }
.wchart .goal-t { fill: var(--warm); font-weight: 600; }
.wchart .ln { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.wchart .pt { fill: var(--surface); stroke: var(--brand); stroke-width: 2; }
.wchart .pt.last { fill: var(--brand); }
.chart-empty { display: grid; place-items: center; gap: 8px; padding: 40px 16px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line); border-radius: 16px; }
.ck-list { display: grid; }
.ck-row { display: grid; grid-template-columns: 64px 1fr auto auto; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); text-align: left; }
.ck-row:last-child { border-bottom: 0; }
.ck-date { font-size: 13px; color: var(--ink-2); }
.ck-tags { display: flex; gap: 4px; }
.ck-tags span { font-size: 11px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); border-radius: 6px; padding: 2px 5px; }
@media (max-width: 420px) { .ck-tags { display: none; } .ck-row { grid-template-columns: 64px 1fr auto; } }

/* Chef IA */
.chat { padding: 0; display: flex; flex-direction: column; height: calc(100vh - 260px); min-height: 420px; overflow: hidden; }
@media (min-width: 960px) { .chat { height: calc(100vh - 220px); } }
.chat-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.chat-empty { margin: auto; text-align: center; max-width: 520px; padding: 10px 0; }
.chat-empty h3 { font-size: 24px; margin: 12px 0 4px; }
.chef-av { width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; background: linear-gradient(135deg, #24503A, #1A3B2B); color: var(--accent); }
.chef-av.big { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto; }
.msg { display: flex; gap: 10px; max-width: 100%; }
.msg.me { justify-content: flex-end; }
.msg.me > div { background: var(--brand); color: var(--brand-ink); padding: 10px 14px; border-radius: 18px 18px 4px 18px; max-width: 80%; white-space: pre-wrap; }
.msg.ai > div { background: var(--surface-2); padding: 12px 16px; border-radius: 4px 18px 18px 18px; max-width: calc(100% - 40px); }
.md p + p, .md p + ul, .md p + ol, .md ul + p, .md ol + p { margin-top: 8px; }
.md h4 { margin: 10px 0 6px; font-family: var(--font-display); font-size: 18px; font-weight: 500; }
.md h4:first-child { margin-top: 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 20px; }
.md li { margin: 3px 0; }
.typing { display: flex; gap: 5px; padding: 16px 18px !important; }
.typing i { width: 7px; height: 7px; border-radius: 9px; background: var(--ink-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-in { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-in textarea { flex: 1; resize: none; border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; background: var(--bg); outline: none; font-size: 15px; line-height: 1.4; max-height: 160px; }
.chat-in textarea:focus { border-color: var(--brand); }
.chat-in .btn { width: 48px; height: 48px; padding: 0; flex-shrink: 0; }
.chat .chip { height: auto; min-height: 36px; padding: 8px 14px; text-align: left; }
.ai-card { padding: 16px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.ai-card .typing { padding: 4px 0 10px !important; }

/* Instalar */
.install-card { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.install-card > div { flex: 1; min-width: 200px; }
body.offline .mobile-top::after, body.offline .sidebar .brand::after { content: "offline"; margin-left: 8px; font-family: var(--font); font-size: 11px; font-weight: 600; color: var(--warn); background: var(--warn-soft); padding: 2px 8px; border-radius: 99px; }
.thumb.photo { background: hsl(var(--h) 30% 85%); }
.thumb.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
