/* ═══════════════════════════════════════════════════════════
   MuscleAI — dark fitness theme
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #0d0f14;
  --card: #171a21;
  --card-2: #1c202b;
  --border: #232733;
  --border-soft: rgba(35, 39, 51, 0.6);
  --accent: #a3e635;
  --accent-2: #4ade80;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.22);
  --tr: 180ms ease;
  --sidebar-w: 244px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  background-image: radial-gradient(1100px 520px at 82% -12%, rgba(163, 230, 53, 0.055), transparent 62%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(163, 230, 53, 0.3); color: var(--text); }

a { color: var(--accent); text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2f3d; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #38404f; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Layout ─────────────────────────────────────────────── */

.layout { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #10131a 0%, #0d0f14 100%);
  border-right: 1px solid var(--border-soft);
  z-index: 100;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 28px 18px 20px;
}

.main { margin-left: var(--sidebar-w); min-width: 0; }

.content { max-width: 1200px; margin: 0 auto; padding: 34px 30px 72px; }

/* ── Sidebar nav ────────────────────────────────────────── */

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  padding: 4px 6px 26px;
}

.logo-accent { color: var(--accent); }

.nav { display: flex; flex-direction: column; gap: 6px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 500;
  font-size: 14.5px;
  transition: background var(--tr), color var(--tr);
}

.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }

.nav-item.active {
  background: rgba(163, 230, 53, 0.1);
  color: var(--accent);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.nav-icon { font-size: 17px; width: 22px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 16px 4px 4px;
  border-top: 1px solid var(--border-soft);
}

/* ── Mobile bottom nav ──────────────────────────────────── */

.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  background: rgba(13, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  grid-template-columns: repeat(6, 1fr);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}

.bottom-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 2px;
  border-radius: 10px;
  transition: color var(--tr), background var(--tr);
}

.bottom-item .nav-icon { font-size: 19px; width: auto; }

.bottom-item.active { color: var(--accent); }
.bottom-item:active { background: rgba(163, 230, 53, 0.08); }

/* ── Typography helpers ─────────────────────────────────── */

h1, h2, h3, h4 { line-height: 1.25; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.page-head h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  margin: 34px 0 16px;
  letter-spacing: -0.01em;
}

/* ── Cards & grids ──────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--tr);
}

.card:hover { border-color: var(--border); }

.card-title { font-size: 17px; font-weight: 700; margin-bottom: 14px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ── Buttons ────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--tr), border-color var(--tr), box-shadow var(--tr), transform var(--tr), color var(--tr);
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: #0d0f14; }
.btn-primary:hover:not(:disabled) {
  background: #b8ef4f;
  box-shadow: 0 6px 18px rgba(163, 230, 53, 0.22);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) { border-color: #3a4152; background: rgba(255, 255, 255, 0.03); }

.btn-danger {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.18); }

.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: var(--radius-sm); }

/* ── Forms ──────────────────────────────────────────────── */

.form-field { margin-bottom: 14px; }

.form-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.02em;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.input, .select {
  width: 100%;
  background: #10131a;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14.5px;
  transition: border-color var(--tr), box-shadow var(--tr);
}

.input::placeholder { color: #5a6276; }

.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(163, 230, 53, 0.15);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b93a7' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

input[type="date"].input { min-height: 46px; }

input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }

/* ── Badges ─────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(163, 230, 53, 0.12);
  color: var(--accent);
  border: 1px solid rgba(163, 230, 53, 0.25);
  white-space: nowrap;
}

/* ── Progress bars ──────────────────────────────────────── */

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #a3e635, #bdf25f);
  transition: width 0.5s ease;
}

.progress-fill.over { background: linear-gradient(90deg, #4ade80, #6ee7a0); }

.progress-sm .progress-track { height: 6px; }

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

.macro-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
}

.macro-nums { color: var(--muted); font-size: 13px; font-weight: 400; }

.macro-pct {
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  font-weight: 500;
}

.macro-pct.over { color: var(--accent-2); font-weight: 700; }

/* ── Empty states ───────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 44px 20px;
}

.empty-state .empty-emoji { font-size: 44px; margin-bottom: 14px; display: block; }

.empty-state p {
  color: var(--muted);
  max-width: 380px;
  margin: 0 auto 20px;
}

.empty-state.compact { padding: 28px 16px; }
.empty-state.compact .empty-emoji { font-size: 34px; }

/* ── Toasts ─────────────────────────────────────────────── */

#toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(340px, calc(100vw - 36px));
}

.toast {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.45;
  animation: toast-in 0.25s ease;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.toast-success { border-left-color: var(--accent-2); background: rgba(74, 222, 128, 0.08); }
.toast.toast-error { border-left-color: var(--danger); background: rgba(248, 113, 113, 0.08); }
.toast.toast-info { border-left-color: var(--accent); }

.toast.removing { opacity: 0; transform: translateX(16px); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

/* ── Dashboard ──────────────────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
  padding: 34px 30px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #1a1f2c 0%, var(--card) 60%);
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(620px 260px at 85% 0%, rgba(163, 230, 53, 0.16), transparent 65%);
  pointer-events: none;
}

.hero-title { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.hero-date { color: var(--muted); margin-top: 8px; }

.stat-card { display: flex; flex-direction: column; }
.stat-emoji { font-size: 26px; }
.stat-value { font-size: 22px; font-weight: 800; margin-top: 8px; letter-spacing: -0.01em; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.quote-card .quote-text {
  font-size: 15px;
  line-height: 1.65;
  font-style: italic;
  margin-top: 10px;
}

.delta { font-size: 13.5px; font-weight: 600; margin-top: 6px; }
.delta.up { color: var(--accent-2); }
.delta.down { color: #7dd3fc; }
.delta.flat { color: var(--muted); }

.mini-ex-list { list-style: none; margin: 0 0 18px; }

.mini-ex-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: #10131a;
  border: 1px solid var(--border-soft);
  margin-bottom: 7px;
  font-size: 14px;
}

.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Training page ──────────────────────────────────────── */

.gen-panel { margin-bottom: 24px; }

.day-card { margin-bottom: 20px; }

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.day-head .card-title { margin-bottom: 4px; }

.ex-list { list-style: none; }

.ex-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: #10131a;
  border: 1px solid var(--border-soft);
  margin-bottom: 8px;
}

.ex-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ex-name { font-weight: 600; }

.ex-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ex-sets { font-weight: 700; color: var(--accent); }

/* Workout logging */
.logging-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.logging-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }

.logging-volume {
  font-size: 17px;
  font-weight: 800;
  color: var(--accent);
  padding: 9px 16px;
  border-radius: 12px;
  background: rgba(163, 230, 53, 0.1);
  border: 1px solid rgba(163, 230, 53, 0.25);
}

.ex-card { margin-bottom: 16px; }

.ex-card .ex-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.set-row {
  display: grid;
  grid-template-columns: 88px 1fr 1fr 36px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.set-num { color: var(--muted); font-size: 13px; font-weight: 500; }

.set-remove {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.set-remove:hover {
  color: #ff6b6b;
  border-color: #ff6b6b;
  background: rgba(255, 107, 107, 0.08);
}

.ex-target {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
  margin-left: auto;
  white-space: nowrap;
}

.add-set-btn {
  margin-top: 10px;
}

.logging-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13.5px;
}
.logging-meta .input {
  width: 90px;
  padding: 8px 10px;
}

.logging-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* History */
.history-item {
  padding: 0;
  overflow: hidden;
  margin-bottom: 12px;
}

.history-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 15px 18px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  cursor: pointer;
  text-align: left;
  transition: background var(--tr);
}

.history-head:hover { background: rgba(255, 255, 255, 0.025); }

.history-date { color: var(--muted); font-size: 13px; min-width: 74px; }
.history-title { font-weight: 600; }
.history-meta { margin-left: auto; }

.history-detail { padding: 2px 18px 14px; }

.history-set {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 12px;
  border-radius: 8px;
  background: #10131a;
  margin-bottom: 6px;
  font-size: 13.5px;
}

.history-actions { padding: 0 18px 16px; display: flex; justify-content: flex-end; }

/* ── Nutrition page ─────────────────────────────────────── */

.target-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.target-chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: #10131a;
  border: 1px solid var(--border);
}

.target-chip b { color: var(--text); font-weight: 700; }

.search-wrap { position: relative; }

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
}

.search-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background var(--tr);
}

.search-item:hover { background: rgba(163, 230, 53, 0.08); }
.search-item .search-item-macros { color: var(--muted); font-size: 12px; white-space: nowrap; }
.search-item.search-empty { cursor: default; color: var(--muted); }
.search-item.search-empty:hover { background: none; }

.custom-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  cursor: pointer;
  margin: 2px 0 14px;
  user-select: none;
}

.custom-toggle input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Diary */
.diary-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.diary-nav .card-title { margin: 0; }

.diary-nav .input[type="date"] { width: auto; min-height: 40px; padding: 8px 12px; }

.meal-group { margin-bottom: 22px; }
.meal-group:last-child { margin-bottom: 0; }

.meal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.meal-title { font-weight: 700; font-size: 15px; }
.meal-total { color: var(--muted); font-size: 12.5px; }

.food-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #10131a;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.food-name { font-weight: 600; font-size: 14px; }
.food-macros { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.diary-total {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.diary-total .total-nums { font-weight: 700; }

/* Charts */
.chart-wrap { position: relative; height: 280px; }

.chart-empty {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 20px;
}

.chart-empty.show { display: flex; }

/* ── Progress page ──────────────────────────────────────── */

.table { width: 100%; border-collapse: collapse; font-size: 14px; }

.table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }

.table .td-actions { text-align: right; white-space: nowrap; }

/* ── Coach page ─────────────────────────────────────────── */

.chat {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 60vh;
  min-height: 340px;
  overflow-y: auto;
  padding: 8px 4px;
}

.bubble {
  max-width: 82%;
  font-size: 14.5px;
  line-height: 1.6;
  word-break: break-word;
}

.bubble-user {
  align-self: flex-end;
  background: rgba(163, 230, 53, 0.13);
  border: 1px solid rgba(163, 230, 53, 0.28);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 16px 16px 4px 16px;
}

.bubble-coach {
  align-self: flex-start;
  display: flex;
  gap: 10px;
  max-width: 88%;
}

.avatar {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(163, 230, 53, 0.14);
  border: 1px solid rgba(163, 230, 53, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.bubble-text {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 11px 16px;
  border-radius: 16px 16px 16px 4px;
}

.typing { align-self: flex-start; display: flex; gap: 10px; align-items: center; }
.typing .bubble-text { color: var(--muted); font-style: italic; }

.typing .dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 1px;
  border-radius: 50%;
  background: var(--muted);
  animation: dot-bounce 1.2s infinite ease-in-out;
}

.typing .dots span:nth-child(2) { animation-delay: 0.15s; }
.typing .dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--tr), color var(--tr), background var(--tr);
}

.chip:hover { border-color: var(--accent); color: var(--accent); background: rgba(163, 230, 53, 0.06); }

.chat-input-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.chat-input-row .input { flex: 1; }

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 1149px) and (min-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 899px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .content { padding: 24px 16px 110px; }
  .bottom-nav { display: grid; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .set-row { grid-template-columns: 70px 1fr 1fr 32px; gap: 6px; }
  .hero-title { font-size: 26px; }
  .page-head h1 { font-size: 26px; }
  .diary-nav { gap: 8px; }
  .diary-nav .input[type="date"] { flex: 1; min-width: 130px; }
  .history-meta { margin-left: 0; width: 100%; }
  .bubble { max-width: 92%; }
  .bubble-coach { max-width: 96%; }
  .chart-wrap { height: 240px; }
}

/* ── Профил (settings) ───────────────────────────────────── */

.page-head-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.targets-list {
  list-style: none;
}

.target-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 11px 14px;
  background: #10131a;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
}

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

.target-row b { color: var(--accent); font-weight: 700; }

.profile-card-body {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.profile-card-emoji { font-size: 34px; line-height: 1; }

.profile-card-body > div { flex: 1 1 220px; min-width: 0; }

.profile-card-body .card-title { margin-bottom: 6px; }

/* ── Смяна на упражнение ─────────────────────────────────── */

.swap-btn {
  padding: 5px 10px;
  font-size: 12.5px;
  border-color: var(--border-soft);
  color: var(--muted);
  border-radius: 8px;
}

.swap-btn:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(163, 230, 53, 0.06);
}

.swap-panel {
  width: 100%;
  margin-top: 8px;
  padding: 10px 4px 4px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.swap-option {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--tr), border-color var(--tr), color var(--tr);
}

.swap-option:hover {
  background: rgba(163, 230, 53, 0.08);
  border-color: rgba(163, 230, 53, 0.25);
  color: var(--accent);
}

/* ── AI тренировка ───────────────────────────────────────── */

#ai-training-view {
  border-left: 4px solid var(--accent);
  margin-bottom: 24px;
}

.ai-training-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.ai-training-head .card-title { margin-bottom: 0; }

.ai-ex-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.ai-weight-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.02em;
}

.ai-ex-card .set-weight { max-width: 220px; }

/* ═══════════════════════════════════════════════════════════
   v2.2 Design polish — добавя върху базовите стилове
   ═══════════════════════════════════════════════════════════ */

/* Карти: лек lift при hover за усещане за интерактивност */
.card {
  transition: border-color var(--tr), box-shadow var(--tr), transform var(--tr);
}
.card:hover {
  border-color: #2d3344;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  transform: translateY(-2px);
}

/* Основен бутон: градиент + по-меко сияние */
.btn-primary {
  background: linear-gradient(135deg, #a3e635 0%, #7fd43a 55%, #4ade80 100%);
  color: #0d0f14;
  box-shadow: 0 4px 14px rgba(163, 230, 53, 0.18);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #b4ef4d 0%, #8fdd45 55%, #5ce68a 100%);
  box-shadow: 0 8px 24px rgba(163, 230, 53, 0.32);
}

/* Достъпност: видим фокус само при клавиатурна навигация */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Фон: втори мек glow долу вляво за дълбочина */
body {
  background-image:
    radial-gradient(1100px 520px at 82% -12%, rgba(163, 230, 53, 0.055), transparent 62%),
    radial-gradient(900px 480px at 6% 108%, rgba(74, 222, 128, 0.04), transparent 60%);
}

/* Hero: по-богат градиент и по-силен accent glow */
.hero {
  background:
    radial-gradient(720px 300px at 88% -10%, rgba(163, 230, 53, 0.2), transparent 62%),
    linear-gradient(135deg, #1b2130 0%, #141821 55%, var(--card) 100%);
  border: 1px solid rgba(163, 230, 53, 0.12);
}
.hero::after {
  background: radial-gradient(520px 220px at 90% 8%, rgba(163, 230, 53, 0.14), transparent 65%);
}
.hero-title {
  font-size: 34px;
  background: linear-gradient(120deg, #f2f4f9 20%, #d6f7a8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--text);
}

/* Прогрес барове: мек glow на запълването */
.progress-fill {
  background: linear-gradient(90deg, #a3e635, #c8f36e);
  box-shadow: 0 0 12px rgba(163, 230, 53, 0.35);
}
.progress-fill.over {
  background: linear-gradient(90deg, #4ade80, #7cf0a6);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.35);
}

/* Онбординг CTA: акцентна рамка, за да привлича вниманието */
.profile-card.onboard {
  position: relative;
  border: 1px solid rgba(163, 230, 53, 0.35);
  background:
    radial-gradient(480px 220px at 92% 0%, rgba(163, 230, 53, 0.1), transparent 60%),
    var(--card);
}
.profile-card.onboard::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg, rgba(163, 230, 53, 0.55), rgba(74, 222, 128, 0.15) 55%, transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.profile-card.onboard .profile-card-emoji { font-size: 40px; }

/* По-големи статистики на dashboard-а */
.stat-value { font-size: 24px; }
.stat-emoji { font-size: 28px; }

/* Намалено движение за потребители, които го предпочитат */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ═══════════════════════════════════════════════════════════
   v2.3 — Смяна на упражнение: табове (Същата група / Всички / AI)
   ═══════════════════════════════════════════════════════════ */

/* Swap tabs */
.swap-tabs {
  display: flex;
  gap: 4px;
  background: #10131a;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 10px;
}

.swap-tab {
  flex: 1;
  padding: 7px 10px;
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--tr), color var(--tr);
}

.swap-tab:hover { color: var(--text); }

.swap-tab.active {
  background: rgba(163, 230, 53, 0.14);
  color: var(--accent);
}

.swap-body { min-height: 40px; }

.swap-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.swap-all-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.swap-ai-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.swap-ai-card {
  border: 1px solid var(--border-soft);
  background: #10131a;
  border-radius: 12px;
  padding: 12px 14px;
}

.swap-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.swap-ai-name { font-weight: 700; font-size: 14px; }

.swap-ai-reason {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
}

@media (max-width: 899px) {
  .swap-filters { grid-template-columns: 1fr; }
}

.swap-ai-request {
  width: 100%;
  resize: vertical;
  min-height: 52px;
  margin-bottom: 10px;
  font-family: inherit;
  line-height: 1.5;
}

/* Поле за prompt към AI тренировката (header на /training) */
.ai-training-box {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ai-training-box .ai-training-prompt {
  width: 300px;
  padding: 10px 14px;
  font-size: 13.5px;
}
@media (max-width: 899px) {
  .ai-training-box {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .ai-training-box .ai-training-prompt { width: 100%; }
}

/* v3.7 — сила по упражнение */
.strength-head { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.strength-stats { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.strength-stats .stat-chip { background:#171a21; border:1px solid #232733; border-radius:10px; padding:8px 14px; font-size:13px; color:#8b93a7; }
.strength-stats .stat-chip b { color:#e8eaf0; }
/* v3.7 — таймер за почивка */
.rest-timer { display:flex; align-items:center; gap:8px; margin-top:12px; padding:10px 12px; background:#171a21; border:1px solid #232733; border-radius:12px; }
.rest-count { font-size:22px; font-weight:800; color:#a3e635; min-width:44px; text-align:center; font-variant-numeric:tabular-nums; }
.rest-count.running { animation:pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.55;} }
/* v3.7 — месечен календар */
.cal-nav { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; flex-wrap:wrap; }
.cal-nav > div { display:flex; align-items:center; gap:10px; }
.cal-title { font-weight:700; color:#e8eaf0; min-width:120px; text-align:center; }
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.cal-week { color:#8b93a7; font-size:11px; text-align:center; text-transform:capitalize; padding:4px 0; }
.cal-day { aspect-ratio:1; display:flex; align-items:center; justify-content:center; background:#171a21; border:1px solid #232733; border-radius:10px; font-size:13px; color:#e8eaf0; }
.cal-day.empty { background:transparent; border-color:transparent; }
.cal-day.trained { background:rgba(163,230,53,.18); border-color:#a3e635; color:#a3e635; font-weight:700; cursor:pointer; }
.cal-day.today { outline:2px solid #4ade80; outline-offset:-1px; }
/* v3.7 — хранене: седмично обобщение + AI план */
.weekly-table { width:100%; border-collapse:collapse; font-size:13px; }
.weekly-table th, .weekly-table td { padding:8px 10px; text-align:right; border-bottom:1px solid #232733; white-space:nowrap; }
.weekly-table th:first-child, .weekly-table td:first-child { text-align:left; }
.weekly-table .over { color:#f87171; font-weight:600; }
.weekly-table tr.avg-row td { border-top:2px solid #232733; font-weight:700; color:#a3e635; }
.ai-meal-form { display:flex; gap:10px; margin-bottom:16px; flex-wrap:wrap; }
.ai-meal-form .input { flex:1; min-width:220px; }
.meal-plan-title { font-weight:700; color:#a3e635; margin-bottom:14px; }
.meal-block { border:1px solid #232733; border-radius:12px; padding:14px; margin-bottom:12px; background:#171a21; }
.meal-block h3 { font-size:15px; margin:0 0 10px; color:#e8eaf0; }
.meal-block .table { margin-bottom:8px; }
.meal-block .meal-total { font-size:12px; color:#8b93a7; }
.meal-plan-grand { display:flex; gap:16px; flex-wrap:wrap; margin-top:4px; font-size:14px; color:#8b93a7; }
.meal-plan-grand b { color:#e8eaf0; }
