/**
 * Atproo EDA AI v4 — Complete Design System
 * Premium · Dark · AI-Native
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ═══════════════════════════════════
   TOKENS
═══════════════════════════════════ */
:root {
  /* Backgrounds */
  --bg:    #0A0C12;
  --bg2:   #0F1218;
  --bg3:   #141820;
  --bg4:   #1A1F2E;
  --bg5:   #212840;

  /* Cards */
  --card:  rgba(255,255,255,.04);
  --card2: rgba(255,255,255,.07);
  --bd:    rgba(255,255,255,.07);
  --bd2:   rgba(255,255,255,.12);

  /* Brand */
  --teal:  #18E7B5;
  --teal2: #0BC99A;
  --blue:  #4FA8FF;
  --blue2: #2E8FE8;
  --pur:   #8B5CF6;
  --pink:  #EC4899;

  /* Utility */
  --green: #34D399;
  --or:    #F59E0B;
  --red:   #EF4444;
  --cyan:  #06B6D4;

  /* Text */
  --t1: #F0F4FF;
  --t2: #8899BB;
  --t3: #505878;

  /* Radii */
  --r:   20px;
  --r2:  16px;
  --r3:  12px;
  --r4:  8px;

  /* Transitions */
  --ease: cubic-bezier(.25,.46,.45,.94);
  --spring: cubic-bezier(.34,1.56,.64,1);

  /* Safe area */
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* ═══════════════════════════════════
   RESET
═══════════════════════════════════ */
*,*::before,*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--t1);
  height: 100%;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea { font-family: inherit; outline: none; }
a { cursor: pointer; text-decoration: none; }

::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 2px; }

/* ═══════════════════════════════════
   AMBIENT ORBS
═══════════════════════════════════ */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.orb1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(24,231,181,.07), transparent 70%);
  top: -150px; left: -100px;
}
.orb2 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(79,168,255,.05), transparent 70%);
  bottom: -200px; right: -150px;
}
.orb3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(139,92,246,.05), transparent 70%);
  top: 40%; left: 30%;
  animation: drift 14s ease-in-out infinite alternate;
}
@keyframes drift { 0% { transform: translate(0,0); } 100% { transform: translate(50px,-40px); } }

/* ═══════════════════════════════════
   UTILITIES
═══════════════════════════════════ */
.hidden { display: none !important; }
.grad-text {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ═══════════════════════════════════
   AUTH SCREEN
═══════════════════════════════════ */
.auth-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg3);
  border: 1px solid var(--bd);
  border-radius: 28px;
  padding: 32px 28px;
  position: relative;
  z-index: 1;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.auth-orb {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(24,231,181,.15), rgba(79,168,255,.1));
  border: 1px solid rgba(24,231,181,.2);
  display: flex; align-items: center; justify-content: center;
}
.auth-brand { font-size: 20px; font-weight: 900; color: var(--t1); }
.auth-sub   { font-size: 11px; font-weight: 600; color: var(--teal); letter-spacing: 1px; text-transform: uppercase; }
.auth-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -.5px;
  line-height: 1.2;
  margin-bottom: 10px;
}
.auth-desc {
  font-size: 13px;
  color: var(--t2);
  line-height: 1.6;
  margin-bottom: 24px;
}
.auth-tabs {
  display: flex;
  background: var(--bg4);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
  border: 1px solid var(--bd);
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 9px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--t3);
  cursor: pointer;
  transition: all .2s var(--ease);
}
.auth-tab.active {
  background: var(--bg2);
  color: var(--t1);
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }

/* Fields */
.field-wrap { display: flex; flex-direction: column; gap: 5px; }
.field-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--t2); }
.field-inp {
  background: var(--bg4);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--t1);
  font-size: 14px;
  transition: border-color .2s;
}
.field-inp:focus { border-color: rgba(24,231,181,.4); }
.field-inp::placeholder { color: var(--t3); }

.pw-strength { font-size: 11px; color: var(--teal); min-height: 16px; }
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--t2);
  cursor: pointer;
  line-height: 1.5;
}
.checkbox-row input { margin-top: 2px; accent-color: var(--teal); }

.or-divider {
  text-align: center;
  position: relative;
  color: var(--t3);
  font-size: 12px;
}
.or-divider::before,.or-divider::after {
  content:'';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--bd);
}
.or-divider::before { left: 0; }
.or-divider::after  { right: 0; }

.social-row { display: flex; gap: 10px; }
.btn-social {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  background: var(--bg4);
  border: 1px solid var(--bd);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  transition: all .18s;
}
.btn-social:active { transform: scale(.96); }

/* ═══════════════════════════════════
   BUTTONS
═══════════════════════════════════ */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #000;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: all .2s var(--spring);
  box-shadow: 0 6px 24px rgba(24,231,181,.25);
}
.btn-primary:active { transform: scale(.97); }

.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #000;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}
.btn-primary-sm:active { transform: scale(.96); }

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: transparent;
  color: var(--t2);
  border: 1px solid var(--bd);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
}
.btn-ghost-block {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--t2);
  border: 1px solid var(--bd);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ultra {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--pur), var(--pink));
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.btn-danger-block {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px;
  background: rgba(239,68,68,.08);
  color: var(--red);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* ═══════════════════════════════════
   ONBOARDING
═══════════════════════════════════ */
.ob-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.ob-logo {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(24,231,181,.15), rgba(79,168,255,.1));
  border: 1px solid rgba(24,231,181,.2);
  display: flex; align-items: center; justify-content: center;
}
.ob-title { font-size: 22px; font-weight: 900; }
.ob-desc  { font-size: 13px; color: var(--t2); line-height: 1.6; margin-bottom: 18px; }
.ob-progress-wrap {
  height: 6px;
  background: var(--bg4);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 24px;
}
.ob-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  border-radius: 3px;
  transition: width .4s var(--ease);
}
.ob-content { margin-bottom: 24px; }
.ob-actions { display: flex; justify-content: space-between; gap: 12px; }

/* ═══════════════════════════════════
   APP LAYOUT
═══════════════════════════════════ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--bd);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.sb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 20px;
  border-bottom: 1px solid var(--bd);
}
.sb-orb {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(24,231,181,.15), rgba(79,168,255,.1));
  border: 1px solid rgba(24,231,181,.15);
  display: flex; align-items: center; justify-content: center;
}
.sb-brand { display: flex; flex-direction: column; }
.sb-name  { font-size: 15px; font-weight: 900; color: var(--t1); }
.sb-sub   { font-size: 10px; font-weight: 700; color: var(--teal); letter-spacing: 1px; text-transform: uppercase; }

.sb-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--t3);
  cursor: pointer;
  transition: all .18s;
  text-decoration: none;
}
.sb-item:hover  { color: var(--t2); background: var(--card); }
.sb-item.active { color: var(--teal); background: rgba(24,231,181,.08); }
.sb-ico { width: 18px; height: 18px; flex-shrink: 0; }

.sb-user {
  padding: 14px 16px;
  border-top: 1px solid var(--bd);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background .18s;
}
.sb-user:hover { background: var(--card); }
.sb-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pur), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.sb-info   { flex: 1; min-width: 0; }
.sb-uname  { font-size: 13px; font-weight: 700; color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-uplan  { font-size: 11px; color: var(--teal); font-weight: 600; }

/* ── MAIN WRAP ── */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── TOPBAR ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--bd);
  background: var(--bg2);
  flex-shrink: 0;
  z-index: 10;
}
.tb-mobile-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 900;
  color: var(--t1);
}
.tb-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tb-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--bd);
  color: var(--t2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .18s;
}
.tb-btn:active { transform: scale(.93); }
.tb-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pur), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff;
  cursor: pointer;
}

/* ── CONTENT ── */
.content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(72px + var(--safe-bot));
  scroll-behavior: smooth;
}

/* ── PAGES ── */
.page {
  display: none;
  padding: 20px 18px;
  max-width: 720px;
  margin: 0 auto;
  animation: pageIn .25s var(--ease);
}
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-header { margin-bottom: 18px; }
.page-title  { font-size: 24px; font-weight: 900; letter-spacing: -.5px; }

/* ═══════════════════════════════════
   HOME PAGE
═══════════════════════════════════ */
.hero-section { margin-bottom: 22px; }
.hero-greeting { font-size: 13px; font-weight: 600; color: var(--teal); margin-bottom: 4px; }
.hero-title    { font-size: 26px; font-weight: 900; letter-spacing: -.5px; line-height: 1.2; margin-bottom: 4px; }
.hero-sub      { font-size: 13px; color: var(--t2); }

/* Scan CTA */
.scan-cta-card {
  position: relative;
  background: linear-gradient(135deg, rgba(24,231,181,.1), rgba(79,168,255,.08));
  border: 1px solid rgba(24,231,181,.2);
  border-radius: var(--r);
  padding: 22px 20px;
  cursor: pointer;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  transition: transform .2s var(--spring), box-shadow .2s;
}
.scan-cta-card:active { transform: scale(.98); }
.scan-cta-glow {
  position: absolute;
  top: -30px; right: -30px;
  width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(24,231,181,.2), transparent 70%);
  pointer-events: none;
}
.scan-cta-label { font-size: 10px; font-weight: 700; color: var(--teal); letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 4px; }
.scan-cta-title { font-size: 20px; font-weight: 900; margin-bottom: 4px; }
.scan-cta-desc  { font-size: 12px; color: var(--t2); margin-bottom: 14px; line-height: 1.5; }
.scan-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #000;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}
.scan-cta-icon { font-size: 52px; }

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.qa-item {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--r3);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
}
.qa-item:active { transform: scale(.94); background: var(--card2); }
.qa-ico   { font-size: 24px; margin-bottom: 6px; }
.qa-label { font-size: 11px; font-weight: 700; color: var(--t2); }

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  margin-top: 20px;
}
.section-title { font-size: 14px; font-weight: 800; color: var(--t1); }
.section-link  { font-size: 12px; font-weight: 600; color: var(--teal); }

/* Mode pills */
.mode-scroller {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.mode-scroller::-webkit-scrollbar { display: none; }
.mpill {
  padding: 8px 14px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--bd);
  background: var(--card);
  color: var(--t3);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .18s;
}
.mpill.active, .mpill.on {
  background: rgba(24,231,181,.1);
  border-color: rgba(24,231,181,.3);
  color: var(--teal);
}
.mpill:active { transform: scale(.94); }

/* Home recent */
.home-recent { display: flex; flex-direction: column; gap: 8px; }
.empty-state-sm {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--r3);
  font-size: 12px;
  color: var(--t3);
}
.empty-ico { font-size: 20px; }

/* ═══════════════════════════════════
   SCAN PAGE
═══════════════════════════════════ */
.camera-viewport {
  position: relative;
  background: #000;
  border-radius: var(--r);
  overflow: hidden;
  aspect-ratio: 4/3;
  max-height: 420px;
  margin-bottom: 14px;
}
.cam-video    { width: 100%; height: 100%; object-fit: cover; display: none; }
.cam-canvas   { display: none; }
.prev-img     { width: 100%; height: 100%; object-fit: cover; }

/* Scan overlay */
.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.scan-frame {
  width: 210px;
  height: 210px;
  position: relative;
}
.sf-corner {
  position: absolute;
  width: 30px; height: 30px;
  border-color: var(--teal);
  border-style: solid;
}
.sf-tl { top: 0; left: 0; border-width: 3px 0 0 3px; border-radius: 6px 0 0 0; }
.sf-tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 6px 0 0; }
.sf-bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-radius: 0 0 0 6px; }
.sf-br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-radius: 0 0 6px 0; }
.scan-beam {
  position: absolute;
  left: 5%; right: 5%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
  top: 50%;
  box-shadow: 0 0 14px var(--teal);
  animation: beamScan 2s ease-in-out infinite;
}
@keyframes beamScan { 0%,100% { top: 5%; } 50% { top: 90%; } }
.scan-hint {
  margin-top: 14px;
  font-size: 12px;
  color: rgba(255,255,255,.7);
  font-weight: 600;
}

/* Live badge */
.live-pill {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(239,68,68,.9);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: 50px;
  display: none;
  align-items: center;
  gap: 5px;
  letter-spacing: 1px;
}
.live-dot {
  width: 6px; height: 6px;
  background: #fff;
  border-radius: 50%;
  animation: blink .8s infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .2; } }

/* Placeholder */
.cam-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
}
.cam-ph-ico   { font-size: 60px; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.cam-ph-title { font-size: 16px; font-weight: 800; }
.cam-ph-sub   { font-size: 12px; color: var(--t3); }

/* AI thinking */
.ai-thinking-bar {
  position: absolute;
  bottom: 12px; left: 12px; right: 12px;
  background: rgba(0,0,0,.8);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(24,231,181,.2);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--teal);
  font-weight: 700;
}
.think-dots { display: flex; gap: 3px; }
.think-dots span {
  width: 5px; height: 5px;
  background: var(--teal);
  border-radius: 50%;
  animation: td .9s infinite;
}
.think-dots span:nth-child(2) { animation-delay: .15s; }
.think-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes td { 0%,80%,100% { transform: scale(.4); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* Capture button */
.capture-row { text-align: center; margin-bottom: 14px; }
.capture-btn {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: transparent;
  border: 3px solid rgba(255,255,255,.5);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s var(--spring);
  margin: 0 auto;
}
.capture-btn:active { transform: scale(.88); }
.capture-inner {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}

/* Scan controls */
.scan-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.sc-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 8px;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--t2);
  cursor: pointer;
  transition: all .18s;
}
.sc-btn:active { transform: scale(.95); }
.sc-btn.sc-primary {
  background: rgba(24,231,181,.08);
  border-color: rgba(24,231,181,.25);
  color: var(--teal);
}
.sc-btn.active {
  border-color: rgba(239,68,68,.4);
  background: rgba(239,68,68,.06);
  color: var(--red);
}

/* AI Loader */
.ai-loader {
  display: none;
  text-align: center;
  padding: 32px 20px;
}
.ai-loader.on { display: block; }
.loader-ring {
  width: 60px; height: 60px;
  position: relative;
  margin: 0 auto 16px;
}
.lr-track {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--bg4);
}
.lr-spin {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--teal);
  border-right-color: var(--blue);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-title { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.loader-step  { font-size: 12px; color: var(--t3); }

/* Live AI Panel */
.live-ai-panel {
  background: var(--bg3);
  border: 1px solid var(--bd);
  border-radius: var(--r2);
  padding: 18px;
  margin-bottom: 14px;
}
.lap-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 12px;
}
.lap-dot {
  width: 8px; height: 8px;
  background: var(--teal);
  border-radius: 50%;
  animation: blink .8s infinite;
}
.lap-food { font-size: 22px; font-weight: 900; margin-bottom: 14px; line-height: 1.2; }
.lap-macros { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.lap-mac {
  background: var(--bg4);
  border-radius: 12px;
  padding: 12px;
}
.lm-label { font-size: 11px; color: var(--t3); margin-bottom: 4px; }
.lm-val   { font-size: 18px; font-weight: 900; }
.lap-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--t2);
  margin-bottom: 6px;
}
.lap-score-val  { font-weight: 800; color: var(--teal); }
.lap-score-bar  { height: 8px; background: var(--bg4); border-radius: 4px; overflow: hidden; }
.lap-score-fill { height: 100%; background: linear-gradient(90deg, var(--teal), var(--blue)); transition: width .4s; }

/* Scan Result */
#scanResult { animation: pageIn .3s var(--ease); }

/* Result hero (reused from old) */
.result-hero {
  background: linear-gradient(135deg, rgba(24,231,181,.06), rgba(79,168,255,.05));
  border: 1px solid rgba(24,231,181,.15);
  border-radius: var(--r2);
  padding: 18px;
  margin-bottom: 14px;
}
.result-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.result-img { width: 80px; height: 80px; border-radius: 16px; object-fit: cover; flex-shrink: 0; }
.result-name { font-size: 20px; font-weight: 900; letter-spacing: -.5px; line-height: 1.2; }
.result-desc { font-size: 12px; color: var(--t2); margin-top: 3px; line-height: 1.5; }
.result-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

/* Health score badges */
.hs-badge {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 20px;
  font-weight: 900;
  text-align: center;
  line-height: 1;
  flex-shrink: 0;
}
.hs-Ap { background: rgba(24,231,181,.15); color: var(--teal); border: 1px solid rgba(24,231,181,.3); }
.hs-A  { background: rgba(52,211,153,.1);  color: var(--green); border: 1px solid rgba(52,211,153,.2); }
.hs-B  { background: rgba(245,158,11,.1);  color: var(--or); border: 1px solid rgba(245,158,11,.2); }
.hs-C  { background: rgba(249,115,22,.1);  color: #f97316; border: 1px solid rgba(249,115,22,.2); }
.hs-D  { background: rgba(239,68,68,.1);   color: var(--red); border: 1px solid rgba(239,68,68,.2); }

/* Macros grid */
.macros-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin: 14px 0; }
.mac { background: var(--bg3); border-radius: 12px; padding: 12px; }
.mac-ico  { font-size: 18px; margin-bottom: 5px; }
.mac-val  { font-size: 20px; font-weight: 900; letter-spacing: -.5px; line-height: 1; }
.mac-unit { font-size: 10px; color: var(--t2); }
.mac-name { font-size: 9px; color: var(--t3); text-transform: uppercase; letter-spacing: .8px; margin-top: 3px; }
.mac-bar  { height: 3px; background: var(--bg4); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.mac-fill { height: 100%; border-radius: 2px; }

/* Scores */
.scores-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.score-item  { background: var(--bg3); border-radius: 12px; padding: 12px; }
.score-name  { font-size: 11px; color: var(--t3); margin-bottom: 6px; font-weight: 600; }
.score-bar-wrap { height: 6px; background: var(--bg4); border-radius: 3px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 3px; transition: width 1s var(--ease); }
.score-val  { font-size: 12px; font-weight: 700; margin-top: 5px; }

/* Action row */
.action-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.action-btn {
  flex: 1;
  min-width: 90px;
  padding: 12px 10px;
  background: var(--bg3);
  border: 1px solid var(--bd);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--t2);
  cursor: pointer;
  text-align: center;
  transition: all .18s;
}
.action-btn:active { transform: scale(.95); }
.action-btn.pri { background: rgba(24,231,181,.08); border-color: rgba(24,231,181,.25); color: var(--teal); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 50px; font-size: 11px; font-weight: 700; }
.b-green { background: rgba(24,231,181,.1); color: var(--teal); border: 1px solid rgba(24,231,181,.2); }
.b-blue  { background: rgba(79,168,255,.1); color: var(--blue); border: 1px solid rgba(79,168,255,.2); }
.b-or    { background: rgba(245,158,11,.1); color: var(--or);   border: 1px solid rgba(245,158,11,.2); }
.b-red   { background: rgba(239,68,68,.1);  color: var(--red);  border: 1px solid rgba(239,68,68,.2); }
.b-pur   { background: rgba(139,92,246,.1); color: var(--pur);  border: 1px solid rgba(139,92,246,.2); }

/* Recipe cards */
.recipe-cards { display: flex; flex-direction: column; gap: 10px; }
.recipe-card {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--r3);
  padding: 14px;
  cursor: pointer;
  transition: all .2s;
}
.recipe-card:active { transform: scale(.98); }
.rc-top  { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rc-ico  { font-size: 28px; }
.rc-name { font-size: 15px; font-weight: 800; }
.rc-cal  { font-size: 12px; color: var(--or); font-weight: 600; }
.rc-steps{ font-size: 12px; color: var(--t2); line-height: 1.6; }

/* Menu items */
.menu-items { display: flex; flex-direction: column; gap: 8px; }
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--r3);
  padding: 13px;
}
.mi-left { display: flex; align-items: center; gap: 10px; }
.mi-rank { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
.mi-rank.best  { background: rgba(24,231,181,.15); color: var(--teal); border: 1px solid rgba(24,231,181,.3); }
.mi-rank.mid   { background: rgba(245,158,11,.15); color: var(--or); }
.mi-rank.worst { background: rgba(239,68,68,.12);  color: var(--red); }
.mi-name  { font-size: 13px; font-weight: 700; }
.mi-cal   { font-size: 12px; color: var(--t3); }
.mi-score { font-size: 14px; font-weight: 800; }

/* ═══════════════════════════════════
   AI COACH PAGE
═══════════════════════════════════ */
.voice-card {
  background: linear-gradient(135deg, rgba(139,92,246,.08), rgba(236,72,153,.05));
  border: 1px solid rgba(139,92,246,.2);
  border-radius: var(--r2);
  padding: 22px;
  text-align: center;
  margin-bottom: 18px;
}
.vc-header  { margin-bottom: 14px; }
.vc-status  { font-size: 12px; color: var(--t2); font-weight: 600; }
.mic-ring {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pur), var(--pink));
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  margin: 0 auto 12px;
  box-shadow: 0 8px 28px rgba(139,92,246,.4);
  transition: all .2s var(--spring);
}
.mic-ring:active, .mic-ring.recording { transform: scale(.93); }
.mic-ring.recording {
  animation: micPulse 1s ease-in-out infinite;
  background: linear-gradient(135deg, var(--red), #ff6b35);
}
@keyframes micPulse {
  0%,100% { box-shadow: 0 8px 28px rgba(239,68,68,.4); }
  50%      { box-shadow: 0 8px 44px rgba(239,68,68,.7); }
}
.vc-text { font-size: 13px; color: var(--t2); font-style: italic; }

/* Chat */
.chat-container {
  background: var(--bg3);
  border: 1px solid var(--bd);
  border-radius: var(--r2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 440px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}
.chat-messages::-webkit-scrollbar { width: 2px; }

.msg { display: flex; gap: 8px; align-items: flex-start; }
.msg.msg-user { flex-direction: row-reverse; }

.msg-av {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.msg-ai   .msg-av { background: linear-gradient(135deg, var(--teal), var(--blue)); }
.msg-user .msg-av { background: rgba(255,255,255,.08); }

.msg-bubble {
  max-width: 80%;
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.6;
}
.msg-ai   .msg-bubble { background: var(--bg4); border: 1px solid var(--bd); border-radius: 18px 18px 18px 5px; }
.msg-user .msg-bubble { background: linear-gradient(135deg, rgba(24,231,181,.14), rgba(79,168,255,.1)); border: 1px solid rgba(24,231,181,.2); border-radius: 18px 18px 5px 18px; }

.chat-suggestions {
  display: flex;
  gap: 6px;
  padding: 0 14px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.chat-suggestions::-webkit-scrollbar { display: none; }
.sug-pill {
  padding: 7px 13px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(79,168,255,.07);
  border: 1px solid rgba(79,168,255,.15);
  color: var(--blue);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .18s;
}
.sug-pill:active { transform: scale(.94); }

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--bd);
  flex-shrink: 0;
}
.cib-voice {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--bd);
  color: var(--t2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.cib-inp {
  flex: 1;
  background: var(--bg4);
  border: 1px solid var(--bd);
  border-radius: 50px;
  padding: 10px 15px;
  color: var(--t1);
  font-size: 13px;
}
.cib-inp:focus { border-color: rgba(24,231,181,.3); }
.cib-inp::placeholder { color: var(--t3); }
.cib-send {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  border: none;
  color: #000;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(24,231,181,.3);
}
.cib-send:active { transform: scale(.9); }

.type-dots { display: flex; gap: 3px; padding: 3px 0; }
.type-dots span { width: 5px; height: 5px; background: var(--t2); border-radius: 50%; animation: td .9s infinite; }
.type-dots span:nth-child(2) { animation-delay: .15s; }
.type-dots span:nth-child(3) { animation-delay: .3s; }

/* ═══════════════════════════════════
   HISTORY PAGE
═══════════════════════════════════ */
.hist-search-row { margin-bottom: 16px; }
.hist-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 10px 14px;
}
.hist-search input {
  flex: 1;
  background: none;
  border: none;
  color: var(--t1);
  font-size: 14px;
}
.hist-search input::placeholder { color: var(--t3); }
.hist-search svg { color: var(--t3); flex-shrink: 0; }

.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--r3);
  padding: 12px;
  cursor: pointer;
  transition: all .18s;
}
.hist-item:active { transform: scale(.98); }
.hist-thumb {
  width: 52px; height: 52px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg4);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.hist-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hist-info { flex: 1; min-width: 0; }
.hist-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-date { font-size: 11px; color: var(--t3); margin-top: 2px; }
.hist-right { text-align: right; flex-shrink: 0; }
.hist-cal   { font-size: 14px; font-weight: 800; color: var(--or); }
.hist-del {
  font-size: 14px;
  color: var(--t3);
  padding: 4px;
  cursor: pointer;
  margin-top: 2px;
  display: block;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
}
.empty-ico   { font-size: 48px; margin-bottom: 14px; }
.empty-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.empty-sub   { font-size: 13px; color: var(--t2); }

/* ═══════════════════════════════════
   PROFILE PAGE
═══════════════════════════════════ */
.prof-card {
  background: linear-gradient(135deg, rgba(24,231,181,.06), rgba(139,92,246,.05));
  border: 1px solid var(--bd);
  border-radius: var(--r2);
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
}
.prof-av-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 12px;
}
.prof-av {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pur), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800; color: #fff;
  box-shadow: 0 8px 24px rgba(139,92,246,.3);
}
.prof-av-edit {
  position: absolute;
  bottom: 0; right: -2px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg4);
  border: 2px solid var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  cursor: pointer;
}
.prof-name { font-size: 22px; font-weight: 900; margin-bottom: 4px; }
.prof-plan {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(245,158,11,.12), rgba(236,72,153,.08));
  color: var(--or);
  border: 1px solid rgba(245,158,11,.2);
  margin-bottom: 18px;
}
.prof-stats { display: flex; align-items: center; justify-content: center; gap: 0; }
.ps-item { text-align: center; padding: 0 20px; }
.ps-val  { font-size: 24px; font-weight: 900; }
.ps-label{ font-size: 11px; color: var(--t3); margin-top: 2px; }
.ps-div  { width: 1px; height: 28px; background: var(--bd); }

/* BMI card */
.bmi-card { background: var(--bg3); border: 1px solid var(--bd); border-radius: var(--r2); padding: 16px; margin-bottom: 8px; }
.bmi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.bmi-num  { font-size: 64px; font-weight: 900; letter-spacing: -3px; line-height: 1; text-align: center; margin: 14px 0 6px; }
.bmi-scale{ display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 10px 0 4px; }
.bmi-seg  { flex: 1; }
.bmi-lbls { display: flex; justify-content: space-between; font-size: 9px; color: var(--t3); margin-bottom: 12px; }

/* Subscription cards */
.sub-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.sub-card {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--r2);
  padding: 18px;
  position: relative;
}
.sub-card.sub-featured {
  border-color: rgba(24,231,181,.3);
  background: rgba(24,231,181,.04);
}
.sub-badge {
  position: absolute;
  top: -10px; right: 16px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #000;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 11px;
  border-radius: 50px;
}
.sub-top   { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sub-name  { font-size: 17px; font-weight: 900; }
.sub-price { font-size: 22px; font-weight: 900; }
.sub-price span { font-size: 12px; font-weight: 400; color: var(--t3); }
.sub-feats { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.sf-item {
  font-size: 12px;
  color: var(--t2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sf-item::before { content: '✓'; color: var(--teal); font-weight: 800; font-size: 11px; }

/* ═══════════════════════════════════
   SETTINGS PAGE
═══════════════════════════════════ */
.settings-group { margin-bottom: 20px; }
.sg-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
  padding-left: 4px;
}
.set-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: 14px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background .18s;
}
.set-item:active { background: var(--card2); }
.si-left { display: flex; align-items: center; gap: 12px; }
.si-icon { font-size: 18px; }
.si-title{ font-size: 14px; font-weight: 600; }
.si-sub  { font-size: 11px; color: var(--t3); margin-top: 1px; }
.si-arrow{ font-size: 18px; color: var(--t3); }
.danger-item:active { background: rgba(239,68,68,.05); }

/* Toggle */
.toggle {
  width: 46px; height: 26px;
  background: var(--bg4);
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background .2s;
  border: 1px solid var(--bd2);
  flex-shrink: 0;
}
.toggle.on { background: var(--teal); }
.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: left .2s;
  box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.toggle.on::after { left: 22px; }

.app-version {
  text-align: center;
  font-size: 11px;
  color: var(--t3);
  padding: 20px 0 40px;
}

/* API info box */
.api-info-box {
  background: rgba(245,158,11,.05);
  border: 1px solid rgba(245,158,11,.15);
  border-radius: 12px;
  padding: 13px;
  font-size: 12px;
  color: var(--t2);
  line-height: 1.7;
  margin-top: 14px;
}

/* ═══════════════════════════════════
   BOTTOM NAV
═══════════════════════════════════ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: rgba(10,12,18,.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--bd);
  padding: 8px 0 calc(8px + var(--safe-bot));
  z-index: 100;
  justify-content: space-around;
}
.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--t3);
  padding: 4px 0;
  cursor: pointer;
  transition: color .18s;
}
.bn-item.active { color: var(--teal); }
.bn-ico { width: 22px; height: 22px; }
.bn-lbl { font-size: 10px; font-weight: 700; }

/* ═══════════════════════════════════
   MODAL
═══════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(12px);
  z-index: 500;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.on { display: flex; }
.modal-sheet {
  background: var(--bg3);
  border-radius: 26px 26px 0 0;
  width: 100%;
  max-width: 520px;
  padding: 20px 22px calc(28px + var(--safe-bot));
  border-top: 1px solid var(--bd2);
  position: relative;
  animation: slideUp .3s var(--ease);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.modal-drag {
  width: 40px; height: 4px;
  background: var(--bd2);
  border-radius: 2px;
  margin: 0 auto 18px;
}
.modal-x {
  position: absolute;
  top: 18px; right: 18px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--bd);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--t2);
  font-size: 14px;
}
.modal-title { font-size: 18px; font-weight: 900; margin-bottom: 8px; }
.modal-desc  { font-size: 13px; color: var(--t2); line-height: 1.6; margin-bottom: 16px; }

/* ═══════════════════════════════════
   TOAST
═══════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 22px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 700;
  z-index: 9999;
  opacity: 0;
  transition: all .3s var(--spring);
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-ok  { background: rgba(24,231,181,.95); color: #000; box-shadow: 0 8px 24px rgba(24,231,181,.4); }
.toast-err { background: rgba(239,68,68,.95);  color: #fff; box-shadow: 0 8px 24px rgba(239,68,68,.4); }
.toast-inf { background: rgba(79,168,255,.95); color: #fff; box-shadow: 0 8px 24px rgba(79,168,255,.4); }

/* ═══════════════════════════════════
   MINI INPUT (shared with old code)
═══════════════════════════════════ */
.mini-inp {
  flex: 1;
  background: var(--bg4);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--t1);
  font-size: 14px;
}
.mini-inp:focus { border-color: rgba(24,231,181,.4); }
.mini-inp::placeholder { color: var(--t3); }
.card {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--r3);
  padding: 16px;
  transition: all .2s;
  margin-bottom: 10px;
}
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ═══════════════════════════════════
   RESPONSIVE
═══════════════════════════════════ */

/* Desktop: sidebar + no bottom nav */
@media (min-width: 769px) {
  body { overflow: hidden; }
  .sidebar      { display: flex; }
  .bottom-nav   { display: none !important; }
  .tb-mobile-logo { display: none; }
  .content { padding-bottom: 24px; }
  .chat-container { height: 500px; }
  .camera-viewport { max-height: 480px; }
  .page { padding: 24px 28px; }
  .topbar { display: none; }
}

/* Mobile: no sidebar, show bottom nav */
@media (max-width: 768px) {
  body { overflow: hidden; position: fixed; width: 100%; height: 100%; }
  .sidebar      { display: none !important; }
  .bottom-nav   { display: flex; }
  .content { padding-bottom: calc(80px + var(--safe-bot)); }
  .chat-container { height: 380px; }
  .macros-grid { grid-template-columns: repeat(3,1fr); }
  .sub-cards { grid-template-columns: 1fr; }
  .toast { bottom: calc(76px + var(--safe-bot)); }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
  .quick-actions { grid-template-columns: repeat(4,1fr); }
}

/* Small phones */
@media (max-width: 380px) {
  .auth-card { padding: 24px 18px; }
  .auth-title { font-size: 24px; }
  .macros-grid { grid-template-columns: 1fr 1fr; }
  .scan-cta-icon { font-size: 38px; }
}

/* Safe areas */
@supports (padding: env(safe-area-inset-bottom)) {
  .bottom-nav {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
  .topbar {
    padding-top: max(12px, env(safe-area-inset-top));
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
