:root {
  --bg: #070808;
  --bg2: #101214;
  --card: #16181c;
  --card2: #1c1f24;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4efe6;
  --muted: #9a9388;
  --volt: #d8f25c;
  --volt-dim: rgba(216, 242, 92, 0.14);
  --warm: #e7b58a;
  --danger: #ff6b5a;
  --ok: #7ee0a3;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --rad: 22px;
  --font: "Manrope", "Segoe UI", system-ui, sans-serif;
  --display: "Unbounded", "Manrope", sans-serif;
  --tab: 86px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #050506; color: var(--text); font-family: var(--font); }
button, input, textarea, select { font-family: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { max-width: 100%; display: block; }
a { color: var(--volt); }

body {
  display: flex;
  justify-content: center;
  min-height: 100dvh;
}

#app {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (min-width: 560px) {
  body { padding: 28px 0; align-items: center; background:
    radial-gradient(1200px 600px at 50% -10%, #1a2210 0%, #050506 55%); }
  #app {
    min-height: 860px;
    height: min(920px, 100dvh - 40px);
    border-radius: 36px;
    box-shadow: var(--shadow), 0 0 0 8px #111, 0 0 0 9px #2a2a2a;
  }
}

.screen {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: calc(12px + var(--safe-t)) 16px calc(var(--tab) + var(--safe-b) + 12px);
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; flex-direction: column; }

/* ===== Onboarding ===== */
#onboard {
  position: absolute; inset: 0; z-index: 50;
  background: #070808;
  display: none;
  flex-direction: column;
}
#onboard.show { display: flex; }
.ob-hero {
  position: relative;
  height: 54%;
  min-height: 280px;
  overflow: hidden;
  flex-shrink: 0;
}
.ob-hero img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 18%;
  filter: saturate(1.05);
}
.ob-hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,8,8,0) 40%, #070808 96%);
}
.ob-mark {
  position: absolute; left: 20px; top: calc(14px + var(--safe-t)); z-index: 2;
  font-family: var(--display); letter-spacing: 0.28em; font-size: 12px; font-weight: 600;
  color: var(--volt);
}
.ob-body { padding: 8px 22px 24px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.ob-kicker { color: var(--volt); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700; }
.ob-title { font-family: var(--display); font-size: 32px; line-height: 1.1; font-weight: 700; }
.ob-sub { color: var(--muted); font-size: 15px; line-height: 1.45; }
.ob-steps { display: flex; gap: 6px; margin-top: 4px; }
.ob-dot { width: 7px; height: 7px; border-radius: 99px; background: #333; }
.ob-dot.on { width: 22px; background: var(--volt); }
.ob-actions { display: flex; gap: 10px; margin-top: auto; padding-bottom: var(--safe-b); }
.btn {
  flex: 1; height: 52px; border-radius: 16px;
  font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-volt { background: var(--volt); color: #111; }
.btn-ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn:active { transform: scale(0.98); }
.field {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.field label { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.field input, .field select, .field textarea {
  background: transparent; border: 0; outline: none; font-size: 16px; width: 100%;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 10px 14px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); font-size: 13px; font-weight: 600;
}
.chip.on { background: var(--volt); color: #111; border-color: var(--volt); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===== Home ===== */
.topbar {
  display: flex; align-items: center;
  margin-bottom: 10px;
}
.brand {
  font-family: var(--display); letter-spacing: 0.32em; font-size: 12px; color: var(--volt); font-weight: 600;
}
.clock { color: var(--muted); font-size: 12px; font-weight: 600; }
.spend {
  margin-left: auto; margin-right: 10px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
  color: #111; background: var(--volt); border-radius: 999px;
  padding: 4px 10px; white-space: nowrap;
}

.hero-card {
  position: relative;
  border-radius: 26px;
  overflow: hidden;
  height: 280px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.hero-card img { width: 100%; height: 100%; object-fit: cover; object-position: center 12%; }
.hero-card .veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05) 20%, rgba(7,8,8,0.92) 100%);
}
.hero-copy { position: absolute; left: 18px; right: 18px; bottom: 16px; }
.greet { font-size: 13px; color: var(--warm); font-weight: 600; letter-spacing: 0.04em; }
.hero-copy h1 { font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1.15; margin-top: 4px; }
.hero-copy p { color: #cfc6ba; font-size: 13px; margin-top: 6px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 10px 11px;
  text-align: center;
}
.ring {
  width: 58px; height: 58px; margin: 0 auto 8px; position: relative;
}
.ring svg { transform: rotate(-90deg); }
.ring .val {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
}
.metric .k { font-size: 11px; color: var(--muted); }
.metric .n { font-size: 13px; font-weight: 700; margin-top: 2px; }

.section-h {
  display: flex; align-items: center; justify-content: space-between;
  margin: 6px 2px 10px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.04em;
}
.section-h span { color: var(--muted); font-weight: 600; font-size: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--rad);
  padding: 14px;
  margin-bottom: 10px;
}
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row:first-child { padding-top: 0; }
.check {
  width: 22px; height: 22px; border-radius: 7px;
  border: 1.5px solid #3a3a3a; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.check.on { background: var(--volt); border-color: var(--volt); color: #111; }
.row .ttl { font-weight: 650; font-size: 14px; }
.row .sub { color: var(--muted); font-size: 12px; }
.prio-high .ttl { color: var(--warm); }

.quick {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px;
}
.qbtn {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  text-align: left;
  font-weight: 700; font-size: 13px;
}
.qbtn small { display: block; color: var(--muted); font-weight: 500; margin-top: 3px; }

.empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

/* ===== Chat ===== */
#screen-chat { padding-left: 0; padding-right: 0; }
.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 16px 10px;
}
.avatar-wrap {
  width: 52px; height: 52px; border-radius: 50%;
  padding: 2px;
  background: conic-gradient(from 200deg, var(--volt), #6a7a30, var(--volt));
  position: relative;
}
.avatar-wrap img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%;
  border-radius: 50%; border: 2px solid #070808; display: block;
}
.avatar-wrap.listening { animation: spin 2.4s linear infinite; }
.avatar-wrap.speaking { animation: pulse 1.2s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  50% { filter: drop-shadow(0 0 12px rgba(216,242,92,0.55)); transform: scale(1.04); }
}
.chat-head .who { font-family: var(--display); font-size: 16px; font-weight: 700; }
.chat-head .st { font-size: 12px; color: var(--muted); }
.chat-head .st.hot { color: var(--volt); }

.msgs {
  flex: 1; overflow: auto; padding: 8px 16px 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.bubble {
  max-width: 86%;
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 14.5px; line-height: 1.4;
  white-space: pre-wrap;
}
.bubble.user {
  align-self: flex-end;
  background: var(--volt);
  color: #14160d;
  border-bottom-right-radius: 6px;
  font-weight: 600;
}
.bubble.lexa {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}
.bubble.sys { align-self: center; background: transparent; color: var(--muted); font-size: 12px; }

.composer {
  display: flex; gap: 6px; align-items: flex-end;
  padding: 8px 12px 10px;
}
.composer input {
  flex: 1; height: 48px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line);
  padding: 0 14px; font-size: 16px; outline: none;
  min-width: 0;
}
.send, .icon-btn {
  width: 44px; height: 48px; border-radius: 14px;
  background: var(--card2); border: 1px solid var(--line);
  font-size: 18px; color: var(--text);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn svg { display: block; }
.attach-bar {
  display: flex; gap: 8px; padding: 0 16px 8px; overflow-x: auto;
}
.attach-bar.hidden { display: none; }
.att {
  position: relative; flex-shrink: 0;
  width: 64px; height: 64px; border-radius: 12px; overflow: hidden;
  background: var(--card); border: 1px solid var(--line);
  font-size: 10px; color: var(--muted);
  display: flex; align-items: flex-end; padding: 4px;
}
.att img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.att .x {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
  border-radius: 99px; background: #000c; font-size: 11px; z-index: 1;
}
.thumbs { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
.route-chip {
  align-self: flex-start;
  font-size: 10px; color: var(--muted); letter-spacing: 0.04em;
  margin: -4px 0 4px 6px; font-weight: 600;
}

.wave {
  height: 36px; display: none; align-items: flex-end; justify-content: center; gap: 3px;
  padding: 0 16px 6px;
}
.wave.on { display: flex; }
.wave i {
  width: 3px; background: var(--volt); border-radius: 2px;
  animation: bar 0.9s ease-in-out infinite;
  height: 8px;
}
.wave i:nth-child(2n) { animation-delay: 0.15s; }
.wave i:nth-child(3n) { animation-delay: 0.3s; }
@keyframes bar { 50% { height: 28px; } }

/* ===== Nutrition / Train / Me ===== */
.h1 { font-family: var(--display); font-size: 22px; font-weight: 700; margin: 4px 0 12px; }
.kcal-hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 12px;
}
.kcal-hero .big { font-family: var(--display); font-size: 36px; font-weight: 800; line-height: 1; }
.kcal-hero .big small { font-size: 14px; color: var(--muted); font-weight: 600; }
.macros { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.macro { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px; }
.bar { height: 6px; background: #262626; border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.bar > i { display: block; height: 100%; background: var(--volt); border-radius: 99px; }
.macro.p .bar > i { background: #7ec8ff; }
.macro.f .bar > i { background: var(--warm); }
.macro.c .bar > i { background: var(--volt); }

.water {
  display: flex; gap: 8px; align-items: center; margin-bottom: 12px;
}
.drop {
  flex: 1; height: 44px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
  font-weight: 700;
}
.drop:active { background: var(--volt-dim); }

.meal-type {
  font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
}

.photo-strip {
  height: 160px; border-radius: 22px; overflow: hidden; margin-bottom: 12px;
}
.photo-strip img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }

.fab-add {
  height: 48px; border-radius: 16px; background: var(--volt); color: #111;
  font-weight: 800; width: 100%; margin-top: 4px;
}

.mem-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 14px; margin-bottom: 8px;
}
.mem-item .kind { font-size: 11px; color: var(--volt); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }
.mem-item p { font-size: 14px; margin-top: 4px; line-height: 1.35; }

.settings-block h3 { font-size: 13px; color: var(--muted); margin: 16px 0 8px; letter-spacing: 0.08em; text-transform: uppercase; }

/* ===== Tab bar ===== */
#tabs {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(var(--tab) + var(--safe-b));
  padding: 8px 10px calc(10px + var(--safe-b));
  display: flex; align-items: flex-end; justify-content: space-around;
  background: linear-gradient(180deg, rgba(7,8,8,0), rgba(7,8,8,0.92) 28%, #0b0c0d 100%);
  z-index: 20;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #6f6a64; font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  padding-bottom: 4px;
}
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--text); }
.tab.on svg { stroke: var(--volt); }

.mic-tab {
  width: 68px; height: 68px; flex: 0 0 68px;
  margin-top: -28px;
  border-radius: 50%;
  padding: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  background: conic-gradient(from 140deg, var(--volt), #8aa33a, var(--volt));
  box-shadow: 0 10px 30px rgba(216, 242, 92, 0.22);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.mic-tab img {
  position: absolute;
  inset: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  object-fit: cover;
  object-position: 50% 42%;
  border-radius: 50%;
  border: 3px solid #070808;
  display: block;
}
.mic-tab.hot {
  animation: pulse 1s ease-in-out infinite;
}
.mic-tab .rec-dot {
  position: absolute; top: 4px; right: 4px; width: 10px; height: 10px;
  background: var(--danger); border-radius: 50%; display: none;
  box-shadow: 0 0 0 3px #070808;
}
.mic-tab.hot .rec-dot { display: block; }

/* modal */
.modal {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(0,0,0,0.55);
  display: none; align-items: flex-end; justify-content: center;
}
.modal.show { display: flex; }
.sheet {
  width: 100%; background: #14161a;
  border-radius: 24px 24px 0 0;
  padding: 16px 16px calc(20px + var(--safe-b));
  border: 1px solid var(--line);
}
.grab { width: 42px; height: 4px; background: #333; border-radius: 4px; margin: 0 auto 14px; }
.toast {
  position: absolute; left: 16px; right: 16px; top: calc(12px + var(--safe-t));
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; z-index: 60; display: none;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow);
}
.toast.show { display: block; }

.hidden { display: none !important; }

.install-banner {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 12px 14px; margin-bottom: 12px;
}
.install-banner p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.apk-card {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #1c2612 0%, #16181c 62%);
  border: 1px solid rgba(216, 242, 92, 0.32);
  border-radius: 20px;
  padding: 12px;
  margin-bottom: 14px;
  text-decoration: none;
  color: inherit;
}
.apk-card img {
  width: 52px; height: 52px; border-radius: 15px; flex-shrink: 0;
  object-fit: cover;
}
.apk-card strong {
  font-family: var(--display); font-size: 15px; font-weight: 700; display: block;
}
.apk-card p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.apk-dl {
  margin-left: auto;
  background: var(--volt); color: #111;
  font-weight: 800; font-size: 13px;
  padding: 11px 14px; border-radius: 12px;
  white-space: nowrap;
}
.apk-card:active { transform: scale(0.98); }
.how-call {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 14px; margin-bottom: 12px;
}
.how-call ol {
  margin: 8px 0 0 18px; color: var(--muted);
  font-size: 13px; line-height: 1.5;
}
.how-call b { color: var(--text); font-weight: 700; }
.hot-card .hit { margin-top: 10px; }
.hot-card .hit.overdue .ttl, .hot-card .hit.pay .ttl { color: var(--danger); }
.hot-card .hit.deadline .ttl { color: var(--volt); }
.deal-card {
  margin-top: 10px; padding: 10px 12px;
  background: #111; border: 1px solid rgba(216,242,92,0.25);
  border-radius: 14px; font-size: 13px;
}
.deal-card .k { color: var(--muted); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }
.deal-card .ttl { margin: 4px 0 6px; font-weight: 700; }
.deal-card .sub { color: var(--muted); font-size: 12px; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.action-bar a, .action-bar button {
  display: inline-block; padding: 8px 12px; border-radius: 999px;
  background: var(--volt); color: #111; font-size: 12px; font-weight: 700;
  text-decoration: none; border: 0; cursor: pointer;
}
.tiny { font-size: 12px; color: var(--muted); }
.danger { color: var(--danger); }

::-webkit-scrollbar { width: 0; height: 0; }
