/* ============================================================
   VolumeLog — Main Stylesheet
   Uses CSS custom properties for light/dark theming.
   ============================================================ */

/* ── Google Fonts loaded via HTML ── */

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100dvh;
  transition: background 0.2s, color 0.2s;
}

/* ── CSS Custom Properties ─────────────────────────────── */
:root {
  /* Brand */
  --color-primary:       #6366F1;
  --color-primary-hover: #4F46E5;
  --color-primary-muted: #6366F115;

  /* Modality */
  --color-wl:  #8B5CF6;
  --color-gym: #06B6D4;
  --color-ae:  #10B981;

  /* Status */
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-danger:  #EF4444;

  /* Light mode tokens */
  --bg-base:    #F1F5F9;
  --bg-card:    #FFFFFF;
  --bg-sidebar: #0F172A;
  --bg-input:   #F8FAFC;
  --bg-hover:   #F1F5F9;

  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;
  --text-on-dark:   #F1F5F9;

  --border:       #E2E8F0;
  --border-focus: #6366F1;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.08);

  --sidebar-width: 220px;
  --bottom-nav-height: 64px;
  --radius:    10px;
  --radius-sm:  6px;
  --radius-lg: 16px;
}

[data-theme="dark"] {
  --bg-base:    #0B1120;
  --bg-card:    #131C2E;
  --bg-sidebar: #080E1A;
  --bg-input:   #1A2540;
  --bg-hover:   #1E293B;

  --text-primary:   #E2E8F0;
  --text-secondary: #94A3B8;
  --text-muted:     #475569;

  --border:    #1E293B;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
}

/* ── Auth Gate ─────────────────────────────────────────── */
#auth-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: var(--bg-sidebar);
  padding: 1.5rem;
}

.auth-card {
  background: #111827;
  border: 1px solid #1E293B;
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: #F1F5F9;
  margin-bottom: 0.5rem;
}

.auth-logo i { color: var(--color-primary); font-size: 1.8rem; }

.auth-subtitle {
  color: #64748B;
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

.auth-field {
  position: relative;
  margin-bottom: 1rem;
}

.auth-field i {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: #475569;
}

.auth-field input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background: #1E293B;
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  color: #F1F5F9;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

.auth-field input:focus { border-color: var(--color-primary); }

#auth-error {
  display: none;
  color: var(--color-danger);
  font-size: 0.8rem;
  margin-top: 0.75rem;
}

/* ── App Shell ─────────────────────────────────────────── */
#app {
  display: flex;
  min-height: 100dvh;
}

/* ── Sidebar ───────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  min-height: 100dvh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  padding: 1.25rem 0;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1.25rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-on-dark);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 0.75rem;
}

.sidebar-brand i { color: var(--color-primary); font-size: 1.3rem; }

.sidebar-nav { list-style: none; flex: 1; padding: 0 0.75rem; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  color: #64748B;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 0.15rem;
}

.nav-link i { font-size: 1rem; width: 1.1rem; text-align: center; }
.nav-link:hover { background: rgba(255,255,255,0.05); color: #94A3B8; }
.nav-link.active { background: rgba(99,102,241,0.15); color: #A5B4FC; }
.nav-link.active i { color: var(--color-primary); }

.sidebar-footer {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.25rem 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-icon-btn {
  background: transparent;
  border: none;
  color: #475569;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  transition: color 0.15s, background 0.15s;
}

.sidebar-icon-btn:hover { color: #94A3B8; background: rgba(255,255,255,0.05); }

/* ── Main content ──────────────────────────────────────── */
#main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2rem 2rem 4rem;
  min-width: 0;
}

/* ── Pages ─────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── Page header ───────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.page-title-group h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.2rem;
}

.page-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── Period selector ───────────────────────────────────── */
.period-selector {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.period-btn {
  background: transparent;
  border: none;
  padding: 0.45rem 0.9rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.period-btn:hover { color: var(--text-secondary); }
.period-btn.active { background: var(--color-primary); color: #fff; }

/* ── Day filter ────────────────────────────────────────── */
.day-filter-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  color: var(--text-muted);
}

.day-filter-wrap input[type="date"] {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

/* ── Stats grid ────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid transparent;
  transition: transform 0.15s;
}

.stat-card:hover { transform: translateY(-1px); }

.stat-card.stat-wl      { border-left-color: var(--color-wl); }
.stat-card.stat-gym     { border-left-color: var(--color-gym); }
.stat-card.stat-ae      { border-left-color: var(--color-ae); }
.stat-card.stat-sessions{ border-left-color: var(--color-primary); }

.stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.stat-wl      .stat-icon { background: #8B5CF615; color: var(--color-wl); }
.stat-gym     .stat-icon { background: #06B6D415; color: var(--color-gym); }
.stat-ae      .stat-icon { background: #10B98115; color: var(--color-ae); }
.stat-sessions .stat-icon{ background: var(--color-primary-muted); color: var(--color-primary); }

.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: 0.75rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; white-space: nowrap; font-family: 'JetBrains Mono', monospace; }
.stat-unit  { font-size: 0.7rem; color: var(--text-muted); }

.stat-card-filterable { align-items: flex-start; }

.stat-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.6rem;
}

.stat-filter-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.15rem 0.55rem;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.stat-filter-btn:hover { color: var(--text-secondary); border-color: var(--text-muted); }
.stat-filter-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* ── Chart cards ───────────────────────────────────────── */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.chart-full { width: 100%; }

.charts-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.charts-row-3 .chart-card { margin-bottom: 0; }

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.chart-title   { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.chart-subtitle{ font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; margin-bottom: 1rem; }

.chart-canvas-wrap { position: relative; }
.chart-tall   { height: 240px; }
.chart-medium { height: 280px; }
.chart-square { height: 220px; }

/* ── Modality legend ───────────────────────────────────── */
.modality-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 0.2rem;
}

.legend-dot.wl  { background: var(--color-wl); }
.legend-dot.gym { background: var(--color-gym); }
.legend-dot.ae  { background: var(--color-ae); }

/* ── Weekly Focus ──────────────────────────────────────── */
.weekly-focus-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.weekly-focus-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.weekly-focus-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
}

.focus-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.focus-chip {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  min-width: 140px;
  flex: 1;
  max-width: 220px;
}

.focus-chip i {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.focus-chip-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.focus-chip-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.focus-chip-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.focus-chip.focus-critical {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.25);
}

.focus-chip.focus-critical i { color: var(--color-danger); }

.focus-chip.focus-low {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.25);
}

.focus-chip.focus-low i { color: var(--color-warning); }

.focus-all-good {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--color-success);
  font-size: 0.875rem;
  font-weight: 500;
}

.focus-all-good i { font-size: 1.1rem; }

.focus-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0 1rem;
}

/* ── Analysis section ──────────────────────────────────── */
.analysis-section {
  margin-top: 0.5rem;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title i { color: var(--color-primary); }

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

.bias-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.85rem;
  line-height: 1.4;
}

.bias-card i { font-size: 1rem; flex-shrink: 0; margin-top: 0.1rem; }
.bias-card p { color: var(--text-secondary); margin: 0; }

.bias-card.alert-gap {
  background: #FEF3C710;
  border-color: #F59E0B30;
}

.bias-card.alert-gap i { color: var(--color-warning); }

.bias-card.alert-imbalance {
  background: #FEE2E210;
  border-color: #EF444430;
}

.bias-card.alert-imbalance i { color: var(--color-danger); }

.bias-card.alert-positive {
  background: #D1FAE510;
  border-color: #10B98130;
}

.bias-card.alert-positive i { color: var(--color-success); }

/* ── Stat breakdown panel ──────────────────────────────── */
.stat-wl,
.stat-gym {
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.stat-wl:hover,
.stat-gym:hover { border-color: var(--color-primary); }

.stat-card-active {
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
}

.stat-breakdown {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding: 0 1.5rem;
  transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.25s ease;
}

.stat-breakdown.open {
  max-height: 600px;
  opacity: 1;
  padding: 1.25rem 1.5rem;
}

.stat-breakdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-breakdown-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-breakdown-rows { display: flex; flex-direction: column; }

.breakdown-row {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--border);
}

.breakdown-row:first-child { border-top: none; }

.breakdown-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.breakdown-bar-wrap {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 99px;
  overflow: hidden;
}

.breakdown-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.breakdown-value {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  white-space: nowrap;
  text-align: right;
  min-width: 80px;
}

/* ── Session history ────────────────────────────────────── */
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sessions-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
  text-align: center;
}

.sessions-empty i { font-size: 2rem; }
.sessions-empty p { font-size: 0.9rem; }

.session-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.session-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.session-card-header:hover { background: var(--bg-hover); }

.session-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.session-date {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.session-name {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.session-card-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.session-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.session-chevron { color: var(--text-muted); font-size: 0.85rem; }

.session-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s ease, background 0.15s ease;
}

.session-delete-btn:hover {
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.08);
}

.session-entries {
  border-top: 1px solid var(--border);
  padding: 0.25rem 1.25rem 1rem;
}

/* ── Loading & error ───────────────────────────────────── */
.loading-bar {
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.loading-bar-inner {
  height: 100%;
  background: var(--color-primary);
  width: 40%;
  animation: loadSlide 1.2s ease-in-out infinite;
}

@keyframes loadSlide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.error-banner {
  background: #FEE2E210;
  border: 1px solid #EF444430;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--color-danger);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

/* ── Logger ────────────────────────────────────────────── */
.logger-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 800px;
}

.logger-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.card-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.session-meta-row,
.movement-search-row {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

/* ── Form fields ───────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field-group.flex-grow { flex: 1; min-width: 150px; }
.field-group.full-width { width: 100%; }

.field-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.optional { text-transform: none; letter-spacing: 0; color: var(--text-muted); font-weight: 400; }

.input-field {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  width: 100%;
}

.input-field:hover:not(:focus) {
  border-color: var(--text-muted);
}

.input-field:focus {
  border-color: var(--color-primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.select-field { cursor: pointer; }

.fields-row {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin: 1.25rem 0 0;
  padding: 1.25rem;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.fields-row .field-group { flex: 1; min-width: 110px; }

.movement-fields-area { margin-top: 0; }

.volume-preview {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
  min-height: 1.75rem;
  margin: 1rem 0 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Pending rounds ────────────────────────────────────── */
.pending-rounds {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  margin: 0.75rem 0 0;
}

.pending-rounds-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.pending-rounds-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#pending-rounds-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pending-round-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.round-number {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  white-space: nowrap;
  min-width: 50px;
}

.round-detail {
  flex: 1;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

/* ── Entry actions row ─────────────────────────────────── */
.entry-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  align-items: center;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.2rem 0;
  transition: color 0.15s;
}

.btn-text:hover { color: var(--color-danger); }

.volume-preview:not(:empty)::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
}

/* ── Entries table ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin-bottom: 1.25rem; }

.entries-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.entries-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.entries-table td {
  padding: 0.75rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.entries-table tbody tr:last-child td { border-bottom: none; }
.entries-table tbody tr:hover { background: var(--bg-hover); }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem !important;
  font-size: 0.875rem;
}

.font-mono { font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; }
.text-muted { color: var(--text-muted); font-size: 0.82rem; }

.save-row { display: flex; justify-content: flex-end; }

/* ── Buttons ───────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.25rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-full { width: 100%; justify-content: center; }
.btn-save { min-width: 150px; justify-content: center; }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.25rem;
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover { background: var(--bg-hover); }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: color 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
}

.btn-icon:hover { color: var(--color-danger); background: rgba(239,68,68,0.08); }

/* ── Modality tags ─────────────────────────────────────── */
.modality-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.4rem;
}

.modality-tag.weightlifting { background: #8B5CF615; color: var(--color-wl); }
.modality-tag.gymnastics    { background: #06B6D415; color: var(--color-gym); }
.modality-tag.aerobic       { background: #10B98115; color: var(--color-ae); }

/* ── Movements page ────────────────────────────────────── */
.movements-list { display: flex; flex-direction: column; gap: 1.5rem; }

.movement-group {}

.movement-group-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.modality-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.modality-dot.weightlifting { background: var(--color-wl); }
.modality-dot.gymnastics    { background: var(--color-gym); }
.modality-dot.aerobic       { background: var(--color-ae); }

.count-badge {
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  letter-spacing: 0;
}

.movement-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.6rem;
}

.movement-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  transition: border-color 0.15s, transform 0.1s;
}

.movement-card:hover { border-color: var(--color-primary); transform: translateY(-1px); }

.movement-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.movement-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.unit-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.custom-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-muted);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.movement-parts { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.part-tag {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.open { display: flex; }

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-md);
  max-height: 90dvh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h2 { font-size: 1rem; font-weight: 600; }

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--color-primary);
  width: 14px;
  height: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* ── Toast notifications ───────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  max-width: 320px;
}

.toast.visible { opacity: 1; transform: translateY(0); }
.toast-success i { color: var(--color-success); }
.toast-error   i { color: var(--color-danger); }

/* ── Spinner ───────────────────────────────────────────── */
.spinner-row { display: flex; justify-content: center; padding: 3rem; }

.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Bottom nav (mobile only) ──────────────────────────── */
#bottom-nav { display: none; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  #sidebar { display: none; }

  #main-content {
    margin-left: 0;
    padding: 1.25rem 1rem calc(var(--bottom-nav-height) + 1rem);
  }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }

  .stat-value { font-size: 1.1rem; }

  .page-header { flex-direction: column; }

  .period-selector, .day-filter-wrap { align-self: flex-start; }

  #bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-sidebar);
    border-top: 1px solid rgba(255,255,255,0.06);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
  }

  .bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    color: #475569;
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0.5rem;
    flex: 1;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
  }

  .bottom-nav-link i { font-size: 1.2rem; }
  .bottom-nav-link.active { color: #A5B4FC; }
  .bottom-nav-link:hover  { color: #94A3B8; }

  .logger-layout { gap: 1rem; }

  .session-meta-row,
  .movement-search-row { flex-direction: column; }

  .charts-row-3 { gap: 1rem; }

  .chart-tall, .chart-square, .chart-medium { height: 200px; }

  #toast-container { bottom: calc(var(--bottom-nav-height) + 1rem); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .movement-cards { grid-template-columns: 1fr; }
  .fields-row { flex-direction: column; }
}
