/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:         #0D1B2A;
  --navy-2:       #1A2F45;
  --navy-3:       #243B55;
  --accent:       #2563EB;
  --accent-hover: #1D4ED8;
  --accent-light: #EFF6FF;
  --gold:         #F59E0B;
  --gold-light:   #FFFBEB;
  --green:        #10B981;
  --green-light:  #ECFDF5;
  --red:          #EF4444;
  --red-light:    #FEF2F2;
  --bg:           #F8F7F4;
  --surface:      #FFFFFF;
  --border:       rgba(0,0,0,0.07);
  --border-md:    rgba(0,0,0,0.14);
  --text:         #0D1B2A;
  --text-2:       #4B5563;
  --text-3:       #9CA3AF;
  --radius:       10px;
  --radius-lg:    14px;
  --shadow:       0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --sidebar-w:    240px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Layout ── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.5rem 1.25rem;
}
.sidebar-logo svg { flex-shrink: 0; }
.logo-wordmark { font-size: 17px; line-height: 1; }
.logo-name { font-weight: 700; color: #FFFFFF; }
.logo-ai { font-weight: 400; color: #2563EB; }

.sidebar-sep { background: rgba(255,255,255,0.06); height: 1px; margin: 0 1rem; }

.sidebar-nav { padding: 0.75rem 0.625rem; flex: 1; }
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  padding: 1rem 12px 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: rgba(255,255,255,0.55);
  transition: background 0.12s, color 0.12s;
  margin-bottom: 1px;
}
.nav-link svg { flex-shrink: 0; opacity: 0.5; transition: opacity 0.12s; }
.nav-link:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.85); }
.nav-link:hover svg { opacity: 1; }
.nav-link.active {
  background: rgba(37,99,235,0.2);
  color: #FFFFFF;
  border-left: 2px solid #2563EB;
  margin-left: -2px;
  padding-left: 14px;
}
.nav-link.active svg { opacity: 1; }

.sidebar-footer { padding: 1rem; }
.sidebar-footer-name { font-size: 11px; color: rgba(255,255,255,0.2); }
.sidebar-footer-url { font-size: 10px; color: rgba(255,255,255,0.15); margin-top: 2px; }

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Pages ── */
.page { display: none; padding: 2rem 2.25rem; max-width: 1100px; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-md);
  background: var(--surface);
  color: var(--text);
  transition: background 0.12s;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: var(--red-light); color: var(--red); border-color: var(--red); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 0.5px solid var(--border);
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 1rem 1.25rem; }

/* ── Stat Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 1.25rem; }
.stat-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.stat-label { font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ── Exercise Library ── */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filter-btn {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
}
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.exercise-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

.exercise-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
.exercise-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.1); transform: translateY(-2px); }

.exercise-video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.exercise-video-thumb iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
}
.exercise-video-thumb .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.15);
  opacity: 1;
  transition: opacity 0.2s;
}
.exercise-card.playing .play-overlay { opacity: 0; pointer-events: none; }
.play-btn-circle {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.92);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.exercise-card-body { padding: 12px 14px; }
.exercise-card-name { font-size: 14px; font-weight: 600; }
.exercise-card-muscle { font-size: 12px; color: var(--accent); font-weight: 500; margin-top: 2px; }
.exercise-card-secondary { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.exercise-card-tags { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }

/* ── Tags / Badges ── */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
}
.tag-blue { background: var(--accent-light); color: var(--accent); }
.tag-green { background: var(--green-light); color: var(--green); }
.tag-amber { background: var(--gold-light); color: #92400E; }
.tag-purple { background: var(--accent-light); color: var(--accent); }
.tag-gray { background: rgba(13,27,42,0.06); color: var(--text-2); }
.tag-pr { background: var(--gold-light); color: #92400E; font-size: 11px; padding: 2px 8px; }

/* ── Workout Logger ── */
.workout-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.25rem; align-items: start; }

.exercise-log-row {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 10px;
}
.exercise-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg);
}
.exercise-log-name { font-size: 14px; font-weight: 600; }
.exercise-log-muscle { font-size: 11px; color: var(--text-3); }

.sets-table { width: 100%; border-collapse: collapse; }
.sets-table th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  padding: 8px 14px;
  text-align: left;
  border-bottom: 0.5px solid var(--border);
}
.sets-table td { padding: 6px 14px; border-bottom: 0.5px solid var(--border); font-size: 13px; }
.sets-table tr:last-child td { border-bottom: none; }

.set-number { width: 32px; height: 32px; border-radius: 50%; background: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text-2); }
.set-number.done { background: var(--green-light); color: var(--green); }

.set-input {
  width: 70px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 0.5px solid var(--border-md);
  font-size: 13px;
  text-align: center;
  background: var(--bg);
}
.set-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.check-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-3);
  transition: all 0.12s;
}
.check-btn.done { background: var(--green-light); border-color: var(--green); color: var(--green); }

.add-set-row { padding: 8px 14px; }

/* ── Video Panel ── */
.video-panel { position: sticky; top: 1.75rem; }
.video-embed {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--accent-light);
  margin-bottom: 10px;
}
.video-embed iframe { width: 100%; height: 100%; border: none; }
.video-exercise-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.video-exercise-muscle { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.video-instructions { font-size: 12px; color: var(--text-2); line-height: 1.6; }
.video-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  background: var(--bg);
  border: 0.5px dashed var(--border-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 13px;
  margin-bottom: 10px;
}

/* ── Recent Workouts List ── */
.workout-list { display: flex; flex-direction: column; gap: 8px; }
.workout-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: box-shadow 0.12s;
}
.workout-item:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.07); }
.workout-item-info { flex: 1; }
.workout-item-name { font-size: 14px; font-weight: 500; }
.workout-item-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.workout-item-volume { font-size: 13px; font-weight: 600; color: var(--accent); }

/* ── PR Toast ── */
.pr-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--gold-light);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #92400E;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 999;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s;
  pointer-events: none;
}
.pr-toast.show { opacity: 1; transform: translateY(0); }

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 0.5px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-2);
}
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 0.5px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Form elements ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.form-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  border: 0.5px solid var(--border-md);
  font-size: 14px;
  background: var(--bg);
}
.form-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }

/* ── AI Banner ── */
.ai-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0D1B2A 0%, #1e3a5f 100%);
  border: 1px solid rgba(37,99,235,0.3);
  margin-bottom: 1.25rem;
}
.ai-icon {
  width: 38px; height: 38px;
  background: rgba(37,99,235,0.25);
  border: 1px solid rgba(37,99,235,0.4);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ai-text { flex: 1; }
.ai-badge {
  display: inline-block;
  background: rgba(37,99,235,0.2);
  color: #2563EB;
  border: 1px solid rgba(37,99,235,0.3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 6px;
}
.ai-title { font-size: 15px; font-weight: 700; color: #FFFFFF; }
.ai-sub { font-size: 12px; color: rgba(255,255,255,0.55); margin-top: 2px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .workout-layout { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .video-panel { position: static; }
}

/* ── Utility ── */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.hidden { display: none !important; }
.text-muted { color: var(--text-3); font-size: 12px; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-3); }
.empty-state p { margin-top: 8px; font-size: 14px; }

/* ── Progress Page ── */
.progress-layout { display: flex; flex-direction: column; gap: 1rem; max-width: 800px; }
#progress-content { display: flex; flex-direction: column; gap: 1rem; }
#progress-charts { display: flex; flex-direction: column; gap: 1rem; }
.progress-stats { grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 0; }
.chart-wrap { position: relative; height: 260px; }
.chart-wrap.is-loading { opacity: 0.35; transition: opacity 0.15s; pointer-events: none; }

/* ── Rest Timer ── */
.rest-timer {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  z-index: 150;
  background: var(--surface);
  border-top: 0.5px solid var(--border);
  box-shadow: 0 -2px 14px rgba(0,0,0,0.06);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.rest-timer.show { transform: translateY(0); }

/* Progress bar shrinks from the right (fill anchored left, drains as time elapses) */
.rest-timer-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: var(--accent);
  transition: width 0.25s linear, background 0.2s;
}
.rest-timer-bar.low { background: var(--red); }

.rest-timer-content { padding: 12px 20px; }
.rest-timer-main { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.rest-timer-info { display: flex; flex-direction: column; min-width: 110px; }
.rest-timer-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.rest-timer-exercise { font-size: 14px; font-weight: 600; color: var(--text); }

.rest-timer-count {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  min-width: 72px;
  transition: color 0.2s;
}
.rest-timer-count.low { color: var(--red); }

.rest-timer-opts { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }
.rest-opt {
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
}
.rest-opt:hover { background: var(--bg); }
.rest-opt.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.rest-timer-actions { display: flex; gap: 6px; margin-left: auto; }

.rest-timer-done-msg {
  display: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--green);
  text-align: center;
  padding: 6px 0;
}
.rest-timer.done .rest-timer-main { display: none; }
.rest-timer.done .rest-timer-done-msg { display: block; }

/* Keep page content clear of the fixed bar while it's visible */
body.rest-active { padding-bottom: 86px; }

@media (max-width: 900px) {
  .rest-timer { left: 0; }
}

/* ── AI Trainer ── */
.ai-tabs {
  display: flex;
  gap: 2px;
  background: var(--border);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 1.5rem;
  width: fit-content;
}
.ai-tab {
  padding: 7px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.ai-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ai-stats-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.ai-stats-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* Chat bubbles */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 1rem;
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
}
.chat-bubble-wrap { display: flex; flex-direction: column; }
.chat-bubble-wrap.user { align-items: flex-end; }
.chat-bubble-wrap.assistant { align-items: flex-start; }
.chat-sender {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 3px;
  padding: 0 4px;
}
.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
}
.chat-bubble.user {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
  background: var(--surface);
  color: var(--text);
  border: 0.5px solid var(--border-md);
  border-bottom-left-radius: 4px;
}
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 4px 2px;
}
.typing-dots span {
  width: 7px; height: 7px;
  background: var(--text-3);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Image upload drop zone */
.upload-zone {
  border: 2px dashed var(--border-md);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 1rem;
}
.upload-zone:hover { border-color: var(--accent); background: var(--accent-light); }
.upload-zone.has-image { border-style: solid; border-color: var(--accent); }

/* Shimmer loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, rgba(0,0,0,0.04) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-line.wide { width: 100%; }
.skeleton-line.medium { width: 65%; }
.skeleton-line.short { width: 35%; }
.skeleton-block { height: 80px; width: 100%; margin-bottom: 12px; }

/* Program day cards */
.program-day-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 12px;
}
.program-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg);
  border-bottom: 0.5px solid var(--border);
}
.program-day-name { font-size: 15px; font-weight: 700; }
.program-day-focus { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Trend indicators */
.trend-up { color: var(--green); font-size: 12px; font-weight: 600; }
.trend-down { color: var(--red); font-size: 12px; font-weight: 600; }
.trend-neutral { color: var(--text-3); font-size: 12px; }

/* Stats mini grid */
.stats-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 1rem;
}
.stats-mini-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.stats-mini-label { font-size: 10px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.stats-mini-value { font-size: 20px; font-weight: 700; color: var(--text); margin-top: 2px; }

/* Chat input area */
.chat-input-area {
  border-top: 0.5px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-textarea {
  flex: 1;
  resize: none;
  border: 0.5px solid var(--border-md);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  background: var(--bg);
}
.chat-textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.chat-send-btn {
  width: 38px; height: 38px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s;
}
.chat-send-btn:hover { background: var(--accent-hover); }

/* AI banners / notices */
.ai-banner-warn {
  background: var(--gold-light);
  border: 1px solid var(--gold);
  color: #92400E;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 1rem;
  max-width: 620px;
}
.ai-success { color: var(--green); font-size: 13px; font-weight: 600; }
.ai-error-banner {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  background: var(--red-light);
  border: 1px solid var(--red);
  color: #991B1B;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 1000;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s;
  pointer-events: none;
  max-width: 360px;
}
.ai-error-banner.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .ai-stats-layout { grid-template-columns: 1fr; }
}

/* ── Auth ── */
.app-shell { display: none; }
body.authed .app-shell { display: flex; }
body.authed #auth-screen { display: none; }

#auth-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #0D1B2A 0%, #1e3a5f 100%);
}
.auth-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  width: 100%;
  max-width: 380px;
  padding: 2rem 1.75rem;
}
.auth-logo { display: flex; align-items: center; gap: 10px; }
.auth-tagline { font-size: 13px; color: var(--text-3); margin: 6px 0 1.5rem; }
.auth-error {
  background: var(--red-light);
  border: 1px solid var(--red);
  color: #991B1B;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 1rem;
}
.auth-toggle { margin-top: 1rem; font-size: 13px; color: var(--text-2); text-align: center; }
.auth-toggle a { color: var(--accent); font-weight: 600; cursor: pointer; }

/* Sidebar account / logout */
.sidebar-account { font-size: 12px; color: rgba(255,255,255,0.55); word-break: break-all; }
.sidebar-logout {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
}
.sidebar-logout:hover { color: rgba(255,255,255,0.8); }
