:root {
  --bg: #F5F5F7;
  --white: #FFFFFF;
  --orange: #FF6B2B;
  --orange-s: #FF8C5A;
  --orange-bg: rgba(255, 107, 43, 0.08);
  --orange-bg2: rgba(255, 107, 43, 0.15);
  --dark: #1A1A2E;
  --text: #1A1A2E;
  --muted: #9B9BAD;
  --muted2: #C8C8D8;
  --border: rgba(0, 0, 0, 0.07);
  --green: #10B981;
  --blue: #6366F1;
  --red: #EF4444;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-o: 0 8px 24px rgba(255, 107, 43, 0.28);
  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --font-d: 'Plus Jakarta Sans', sans-serif;
  --font-b: 'DM Sans', sans-serif;
  --nav-h: 72px;
  --status-h: env(safe-area-inset-top, 0px);
}

#bg-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#app-wrap { position: relative; z-index: 1; height: 100%; overflow: hidden; }

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  font-size: 16px;
}

body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  overflow: hidden;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.15);
}

/* ===== SCREENS ===== */
.screen {
  position: absolute;
  inset: 0;
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + 20px);
  display: none;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: block;
  animation: slideIn 0.32s cubic-bezier(.4, 0, .2, 1);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-content .card {
  animation: cardIn 0.4s ease both;
}

.screen-content .card:nth-child(2) { animation-delay: 0.07s; }
.screen-content .card:nth-child(3) { animation-delay: 0.14s; }
.screen-content .card:nth-child(4) { animation-delay: 0.21s; }

.screen-content {
  padding: 0 18px;
  padding-top: calc(var(--status-h) + 16px);
}

/* ===== TOP BAR ===== */
.topbar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  z-index: 90;
  padding: calc(var(--status-h) + 14px) 18px 14px;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.topbar.glass {
  background: rgba(245, 245, 247, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.topbar > div:first-child {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start !important;
  text-align: left !important;
}

.topbar > div:first-child > * {
  text-align: left !important;
  align-self: flex-start !important;
}

.topbar-title h2 {
  font-family: var(--font-d);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.5px;
}

.topbar-title p {
  font-size: 0.72rem;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 20px 0;
}

.page-header > div:first-child { flex: 1; }

.page-title {
  font-family: var(--font-d);
  font-size: 2rem;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -1px;
  line-height: 1.1;
  text-align: left;
}

.page-subtitle {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 3px;
  text-align: left;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: 14px;
  transition: all 0.25s cubic-bezier(.4, 0, .2, 1);
  color: var(--muted);
}

.nav-btn:active { transform: scale(0.88); }
.nav-btn.active { color: var(--orange); }

.nav-btn svg {
  width: 23px;
  height: 23px;
  transition: all 0.25s;
}

.nav-btn.active svg { transform: scale(1.15) translateY(-1px); }

.nav-btn span {
  font-size: 0.58rem;
  font-family: var(--font-d);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all 0.2s;
}

.nav-dot {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: transparent;
  transition: all 0.3s;
  margin-top: 1px;
}

.nav-btn.active .nav-dot { background: var(--orange); }

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.03);
  border: 1.5px solid rgba(0, 0, 0, 0.13);
  margin-bottom: 14px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.card:active {
  transform: scale(0.99);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.card-orange {
  background: linear-gradient(145deg, var(--orange) 0%, #FF9A6C 100%);
  border-radius: var(--radius);
  padding: 20px;
  color: white;
  box-shadow: 0 10px 32px rgba(255, 107, 43, 0.35);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  margin-bottom: 14px;
}

.card-dark {
  background: linear-gradient(145deg, #1A1A2E, #2D2D44);
  border-radius: var(--radius);
  padding: 20px;
  color: white;
  margin-bottom: 14px;
  box-shadow: 0 10px 32px rgba(26, 26, 46, 0.28);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
}

/* ===== TYPOGRAPHY ===== */
.label {
  font-size: 0.65rem;
  font-family: var(--font-d);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.big-num {
  font-family: var(--font-d);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--dark);
  line-height: 1;
}

.big-num.orange { color: var(--orange); }

.card-title {
  font-family: var(--font-d);
  font-size: 1rem;
  font-weight: 800;
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  text-align: left;
  letter-spacing: -0.2px;
}

.section-label {
  font-family: var(--font-d);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 16px 0 8px;
}

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.65rem;
  font-family: var(--font-d);
  font-weight: 700;
}

.badge-o { background: var(--orange-bg2); color: var(--orange); }
.badge-g { background: rgba(16, 185, 129, 0.12); color: var(--green); }
.badge-b { background: rgba(99, 102, 241, 0.1); color: var(--blue); }
.badge-red { background: rgba(239, 68, 68, 0.12); color: var(--red); }

/* ===== BUTTONS ===== */
.btn {
  border: none;
  cursor: pointer;
  font-family: var(--font-d);
  font-weight: 700;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--orange);
  color: white;
  padding: 14px 20px;
  border-radius: 50px;
  font-size: 0.9rem;
  box-shadow: var(--shadow-o);
  width: 100%;
}

.btn-dark {
  background: var(--dark);
  color: white;
  padding: 14px 20px;
  border-radius: 50px;
  font-size: 0.9rem;
  width: 100%;
}

.btn-ghost {
  background: var(--bg);
  color: var(--dark);
  padding: 12px 18px;
  border-radius: 50px;
  font-size: 0.85rem;
  border: 1.5px solid var(--border);
}

.btn-sm {
  padding: 6px 10px;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 700;
  width: auto !important;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
  color: var(--dark);
}

.icon-btn.orange { background: var(--orange-bg); color: var(--orange); }
.icon-btn:active { transform: scale(0.92); }

/* ===== RING ===== */
.ring-wrap {
  position: relative;
  width: 130px;
  height: 130px;
  margin: 0 auto;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-center .val {
  font-family: var(--font-d);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--dark);
}

.ring-center .sub {
  font-size: 0.6rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ===== MACRO BARS ===== */
.macro-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.macro-row:last-child { margin-bottom: 0; }

.mdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mname {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  width: 65px;
}

.mbar-wrap {
  flex: 1;
  height: 7px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.mbar {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}

.mval {
  font-family: var(--font-d);
  font-size: 0.75rem;
  font-weight: 700;
  width: 36px;
  text-align: right;
}

/* ===== STAT ROW ===== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stat-box {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: left;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  border: 1.5px solid rgba(0, 0, 0, 0.13);
}

.stat-val {
  font-family: var(--font-d);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.5px;
}

.stat-lbl {
  font-size: 0.6rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* ===== LIST ITEMS ===== */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--white);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(.4,0,.2,1);
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.card .list-item {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.11);
  border-radius: 0;
  box-shadow: none;
  margin-bottom: 0;
  padding: 12px 4px;
}

.card .list-item:last-child {
  border-bottom: none;
}

.list-item:active {
  transform: scale(0.98);
  background: var(--orange-bg);
}

.list-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.list-name {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-d);
  color: var(--dark);
}

.list-sub {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 1px;
}

.list-right {
  margin-left: auto;
  text-align: right;
}

.list-val {
  font-family: var(--font-d);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--orange);
}

/* ===== INPUTS ===== */
.input-label {
  font-size: 0.68rem;
  font-family: var(--font-d);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 5px;
  display: block;
}

.input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid rgba(26, 26, 46, 0.08);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  color: var(--dark);
  font-family: var(--font-b);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
}

.input:focus {
  border-color: var(--orange);
  background: white;
  box-shadow: 0 0 0 3px var(--orange-bg2);
}

.input-group { margin-bottom: 12px; }
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===== TABS ===== */
.tabs {
  display: flex;
  background: var(--bg);
  border-radius: 50px;
  padding: 3px;
  margin-bottom: 14px;
}

.tab {
  flex: 1;
  padding: 8px;
  border-radius: 50px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-d);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.active {
  background: var(--white);
  color: var(--dark);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ===== WATER ===== */
.glasses-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.glass {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.glass.on { background: rgba(99, 162, 255, 0.15); animation: fillWater 0.4s ease-out; }
.glass.off { background: var(--bg); opacity: 0.35; }
.glass:active { transform: scale(0.85); }
@keyframes fillWater {
  from { transform: scale(0.8); opacity: 0.5; }
  to { transform: scale(1); opacity: 1; }
}

/* ===== EXERCISES ===== */
.ex-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.ex-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  border: 1.5px solid rgba(0, 0, 0, 0.13);
  transition: all 0.2s;
  text-align: center;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.ex-card.sel { border-color: var(--orange); background: var(--orange-bg); }
.ex-card:active { transform: scale(0.96); }

.ex-icon { font-size: 1.6rem; margin-bottom: 4px; }
.ex-name { font-size: 0.78rem; font-weight: 700; font-family: var(--font-d); color: var(--dark); }
.ex-group { font-size: 0.6rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* ===== SET ROW ===== */
.set-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--bg);
  border-radius: var(--radius-xs);
  margin-bottom: 6px;
}

.set-input {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 6px;
  color: var(--dark);
  font-family: var(--font-d);
  font-size: 0.85rem;
  font-weight: 700;
  width: 58px;
  text-align: center;
  outline: none;
}

.set-input:focus { border-color: var(--orange); }
.set-lbl { font-size: 0.62rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }

/* ===== TIMER ===== */
.timer-big {
  font-family: var(--font-d);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--orange);
  letter-spacing: -3px;
  text-align: center;
  line-height: 1;
}

.timer-ring {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 16px;
}

.timer-ring svg { transform: rotate(-90deg); }
.timer-ring-val { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ===== PHOTO GRID ===== */
.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.photo-slot {
  aspect-ratio: 3/4;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px dashed var(--muted2);
  transition: all 0.2s;
  overflow: hidden;
  position: relative;
}

.photo-slot:active { border-color: var(--orange); }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot-lbl { font-size: 0.75rem; font-family: var(--font-d); font-weight: 700; color: var(--muted); margin-top: 6px; }
.photo-slot .overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent); display: flex; align-items: flex-end; padding: 8px; }
.photo-slot .overlay span { color: white; font-size: 0.7rem; font-family: var(--font-d); font-weight: 700; }

/* ===== SHEETS ===== */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.sheet-overlay.show { display: flex; }

.sheet {
  background: var(--white);
  border-radius: 28px 28px 0 0;
  padding: 16px;
  width: 100%;
  max-width: 430px;
  max-height: 88vh;
  overflow-y: auto;
  animation: sheetUp 0.3s cubic-bezier(.4, 0, .2, 1);
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--muted2);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.sheet-title {
  font-family: var(--font-d);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== CAMERA ===== */
#scanner-container {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: #000;
  margin-bottom: 12px;
}

#scanner-container video { width: 100%; height: 100%; object-fit: cover; }
#scanner-container canvas { position: absolute; inset: 0; }

.scan-frame {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scan-frame::before {
  content: '';
  width: 60%;
  aspect-ratio: 1;
  border: 3px solid var(--orange);
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
}

/* ===== ONBOARDING ===== */
.ob-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  overflow-y: auto;
  display: none;
  align-items: center;
  justify-content: center;
}

.ob-screen.show { display: flex; }
.ob-wrap { padding: 24px 20px; width: 100%; max-width: 430px; }
.ob-logo { font-family: var(--font-d); font-size: 2.5rem; font-weight: 800; color: var(--orange); letter-spacing: -1.5px; }
.ob-sub { color: var(--muted); font-size: 0.9rem; margin: 4px 0 24px; }
.ob-prog { display: flex; gap: 5px; margin-bottom: 28px; }
.ob-dot { height: 4px; border-radius: 2px; flex: 1; background: var(--muted2); transition: background 0.3s; }
.ob-dot.on { background: var(--orange); }
.ob-step { display: none; }
.ob-step.active { display: block; }
.ob-h { font-family: var(--font-d); font-size: 1.5rem; font-weight: 800; color: var(--dark); margin-bottom: 4px; }
.ob-p { color: var(--muted); font-size: 0.85rem; margin-bottom: 20px; }

.goal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }

.goal-card {
  background: var(--white);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 20px 14px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.goal-card.sel { border-color: var(--orange); background: var(--orange-bg); }
.goal-card:active { transform: scale(0.97); }
.goal-em { font-size: 2.5rem; margin-bottom: 8px; }
.goal-n { font-family: var(--font-d); font-size: 0.9rem; font-weight: 800; color: var(--dark); }
.goal-d { font-size: 0.7rem; color: var(--muted); margin-top: 3px; }

.tdee-card {
  background: linear-gradient(135deg, var(--orange), #FF9A6C);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: white;
  margin-bottom: 16px;
  box-shadow: var(--shadow-o);
}

.tdee-n { font-family: var(--font-d); font-size: 3.5rem; font-weight: 800; letter-spacing: -2px; }
.tdee-l { font-size: 0.75rem; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.1em; }

/* ===== AI SHEET ===== */
.ai-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
  z-index: 250;
  display: none;
}

.ai-overlay.show { display: block; }

.ai-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: 75vh;
  background: var(--white);
  border-radius: 28px 28px 0 0;
  display: flex;
  flex-direction: column;
  z-index: 251;
  animation: sheetUp 0.3s ease;
}

.ai-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--orange), #FF9A6C);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.ai-head-info h4 { font-family: var(--font-d); font-size: 0.88rem; font-weight: 800; color: var(--dark); }
.ai-head-info p { font-size: 0.68rem; color: var(--green); font-weight: 600; }

.ai-msgs { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }

.msg { max-width: 82%; padding: 10px 13px; font-size: 0.83rem; line-height: 1.5; font-family: var(--font-b); }

.msg.user {
  background: var(--orange);
  color: white;
  align-self: flex-end;
  border-radius: 18px 18px 4px 18px;
  font-weight: 500;
  box-shadow: 0 3px 10px rgba(255, 107, 43, 0.25);
}

.msg.ai { background: var(--bg); color: var(--dark); align-self: flex-start; border-radius: 18px 18px 18px 4px; }

.ai-chips { display: flex; gap: 6px; padding: 8px 14px; overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.ai-chips::-webkit-scrollbar { display: none; }

.ai-chip {
  white-space: nowrap;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--dark);
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: var(--font-d);
  font-weight: 700;
  flex-shrink: 0;
}

.ai-chip:active { background: var(--orange-bg); border-color: var(--orange); color: var(--orange); }

.ai-row {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

.ai-input {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid transparent;
  border-radius: 50px;
  padding: 10px 14px;
  color: var(--dark);
  font-family: var(--font-b);
  font-size: 0.85rem;
  outline: none;
}

.ai-input:focus { border-color: var(--orange); background: white; }

/* ===== FAB ===== */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + 12px);
  right: 16px;
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: var(--orange);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-o);
  z-index: 80;
  transition: all 0.2s;
}

.fab:active { transform: scale(0.92); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  top: calc(var(--status-h) + 60px);
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: var(--dark);
  color: white;
  padding: 10px 18px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-family: var(--font-d);
  font-weight: 700;
  z-index: 400;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: var(--orange); }
.toast.err { background: var(--red); }

/* ===== PROGRESS BAR ===== */
.prog-bar-wrap { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.prog-bar { height: 100%; border-radius: 4px; transition: width 1s ease; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--muted2); border-radius: 2px; }
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.tab.sm { padding: 6px 12px; font-size: 0.75rem; border-radius: 50px; background: var(--bg); border: 1.5px solid var(--border); color: var(--muted); font-weight: 700; white-space: nowrap; cursor: pointer; transition: all 0.2s; }
.tab.sm.active { background: var(--orange); border-color: var(--orange); color: white; box-shadow: var(--shadow-o); }

/* DARK MODE */
body.dark {
  --bg: #000000;
  --white: #121212;
  --dark: #FFFFFF;
  --text: #E0E0E0;
  --muted: #888888;
  --muted2: #333333;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
body.dark .card, body.dark .topbar, body.dark .glass {
  background: rgba(30, 30, 30, 0.7);
  border-color: rgba(255, 255, 255, 0.08);
}
body.dark .input {
  background: #1E1E1E;
  color: white;
  border-color: #333;
}
body.dark .tab:not(.active) {
  background: #1A1A1A;
  color: #888;
}
body.dark .list-item {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}
