/* ==========================================================================
   TRAIN-STACK MODERN DESIGN SYSTEM (PROJECT-ASSISTANT / INSTITUTIONAL BENTO)
   ========================================================================== */

:root {
  /* Deep Obsidian & Institutional Slate/Zinc Palette */
  --bg-main: #080c14;
  --bg-card: #0f172a;
  --bg-card-hover: #1e293b;
  --bg-sidebar: #0b0f19;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(56, 189, 248, 0.3);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Controlled Institutional Accents */
  --color-cyan: #38bdf8;
  --color-cyan-glow: rgba(56, 189, 248, 0.15);
  --color-purple: #818cf8;
  --color-purple-glow: rgba(129, 140, 248, 0.15);
  --color-green: #10b981;
  --color-green-glow: rgba(16, 185, 129, 0.15);
  --color-rose: #f43f5e;
  --color-rose-glow: rgba(244, 63, 94, 0.15);
  --color-amber: #f59e0b;

  /* Subtle Professional Gradients */
  --gradient-cyan-purple: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  --gradient-green-cyan: linear-gradient(135deg, #10b981 0%, #0284c7 100%);
  --gradient-rose-purple: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);

  /* UI Tokens */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-full: 9999px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-family-title: 'Outfit', 'Inter', sans-serif;
}

/* Reset & Global */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-family-body);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Container Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding-left: 6px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--color-cyan);
}

.brand-text h1 {
  font-family: var(--font-family-title);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-text h1 span {
  color: var(--color-cyan);
}

.badge-v {
  font-size: 10px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: var(--color-cyan);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
  display: inline-block;
  margin-top: 2px;
}

/* Navigation Menu */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-family-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
  position: relative;
}

.nav-btn i {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

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

.nav-btn.active {
  color: var(--text-main);
  background: rgba(0, 242, 254, 0.08);
  border-color: rgba(0, 242, 254, 0.2);
  font-weight: 600;
}

.nav-btn.active i {
  color: var(--color-cyan);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-rose);
  box-shadow: 0 0 10px var(--color-rose);
  margin-left: auto;
  animation: pulse-live 1.5s infinite;
}

@keyframes pulse-live {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(0.9); opacity: 1; }
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
}

.git-status-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.git-status-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.git-status-header i {
  color: var(--color-cyan);
}

.git-repo-name {
  font-weight: 600;
  font-size: 13px;
  margin-top: 4px;
  color: var(--text-main);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
}

.status-indicator.ready {
  color: var(--color-green);
}

/* Main Content Layout */
.main-content {
  margin-left: 270px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-header {
  height: 72px;
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: rgba(11, 15, 23, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  width: 340px;
  transition: var(--transition-fast);
}

.header-search i {
  color: var(--text-muted);
}

.header-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 14px;
  width: 100%;
}

.header-search:focus-within {
  border-color: var(--color-cyan);
  box-shadow: 0 0 15px var(--color-cyan-glow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  padding: 6px 14px 6px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-rose-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

/* Content Body */
.content-body {
  padding: 32px 36px;
}

.view-section {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.view-section.active {
  display: block;
}

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

.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.section-title {
  font-family: var(--font-family-title);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.date-badge {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-cyan);
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-card);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-color-hover);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5);
}

.stat-card.glow-cyan:hover,
.stat-card.glow-purple:hover,
.stat-card.glow-green:hover,
.stat-card.glow-rose:hover {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5);
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.glow-cyan .stat-icon { background: rgba(56, 189, 248, 0.1); color: var(--color-cyan); }
.glow-purple .stat-icon { background: rgba(129, 140, 248, 0.1); color: var(--color-purple); }
.glow-green .stat-icon { background: rgba(16, 185, 129, 0.1); color: var(--color-green); }
.glow-rose .stat-icon { background: rgba(244, 63, 94, 0.1); color: var(--color-rose); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-family: var(--font-family-title);
  font-size: 22px;
  font-weight: 700;
  margin: 2px 0;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  font-size: 11px;
  font-weight: 500;
}

.text-success { color: var(--color-green); }
.text-cyan { color: var(--color-cyan); }
.text-rose { color: var(--color-rose); }
.text-purple { color: var(--color-purple); }

/* Layout Grid Systems */
.dashboard-grid, .analytics-grid, .settings-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.grid-col-12 { grid-column: span 12; }
.grid-col-8 { grid-column: span 8; }
.grid-col-6 { grid-column: span 6; }
.grid-col-4 { grid-column: span 4; }

/* Cards Base (Bento Box Architecture) */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-family: var(--font-family-title);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header.border-cyan { border-top: 2px solid var(--color-cyan); }
.card-header.border-purple { border-top: 2px solid var(--color-purple); }
.card-header.border-green { border-top: 2px solid var(--color-green); }

.card-body {
  padding: 20px;
  flex: 1;
}

/* Buttons System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-family-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
}

.btn-primary {
  background: #0284c7;
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #fff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover {
  background: #0369a1;
  border-color: var(--color-cyan);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--color-cyan);
  color: var(--color-cyan);
  background: rgba(56, 189, 248, 0.05);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
}

.btn-danger:hover {
  background: #f43f5e;
  color: #fff;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.btn-success:hover {
  background: #10b981;
  color: #080c14;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
  border-radius: var(--radius-md);
}

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

.btn-xs {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: var(--radius-sm);
}

/* Stacks List & Cards */
.stacks-preview-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stack-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.stack-item-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.stack-item-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stack-category-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(0, 242, 254, 0.1);
  color: var(--color-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.stack-info h4 {
  font-size: 16px;
  font-weight: 600;
}

.stack-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Stacks Grid View */
.stacks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.stack-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-fast);
  position: relative;
}

.stack-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-cyan);
  box-shadow: 0 10px 30px rgba(0, 242, 254, 0.15);
}

.stack-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
}

.badge-cyan { background: rgba(0, 242, 254, 0.12); color: var(--color-cyan); }
.badge-purple { background: rgba(127, 0, 255, 0.12); color: var(--color-purple); }
.badge-green { background: rgba(0, 245, 160, 0.12); color: var(--color-green); }

.exercise-mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0;
}

.exercise-tag {
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.stack-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  margin-top: 12px;
}

/* Filter Chips */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.filter-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-chip:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.filter-chip.active {
  background: var(--color-cyan);
  color: #0b0f17;
  font-weight: 700;
  border-color: var(--color-cyan);
}

/* Live Workout View Styles */
.workout-dashboard-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.workout-timer-display {
  display: flex;
  gap: 20px;
}

.timer-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  min-width: 130px;
}

.timer-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.timer-value {
  font-family: var(--font-family-title);
  font-size: 24px;
  font-weight: 800;
  color: var(--color-cyan);
}

.timer-box.rest-glow {
  border-color: var(--color-rose);
  box-shadow: 0 0 15px var(--color-rose-glow);
}

.timer-box.rest-glow .timer-value {
  color: var(--color-rose);
}

/* Exercises Live Container */
.exercises-live-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.exercise-live-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.exercise-live-card h4 {
  font-family: var(--font-family-title);
  font-size: 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sets-table {
  width: 100%;
  border-collapse: collapse;
}

.sets-table th {
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sets-table td {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.set-row-completed {
  opacity: 0.6;
  background: rgba(0, 245, 160, 0.04);
}

.input-set {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  width: 75px;
  font-size: 14px;
  text-align: center;
}

.input-set:focus {
  border-color: var(--color-cyan);
  outline: none;
}

/* Checkbox Custom styling */
.custom-checkbox {
  display: inline-block;
  position: relative;
  padding-left: 28px;
  cursor: pointer;
  user-select: none;
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 22px;
  width: 22px;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: var(--transition-fast);
}

.custom-checkbox:hover input ~ .checkmark {
  border-color: var(--color-cyan);
}

.custom-checkbox input:checked ~ .checkmark {
  background-color: var(--color-green);
  border-color: var(--color-green);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
  display: block;
}

.custom-checkbox .checkmark:after {
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid #0b0f17;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Supps View */
.supps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.supp-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.supp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.supp-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.supp-item-checked {
  background: rgba(0, 245, 160, 0.03);
  border-color: rgba(0, 245, 160, 0.2);
}

.supp-item-checked .supp-info strong {
  text-decoration: line-through;
  color: var(--text-muted);
}

.supp-info strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.supp-info span {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
}

.supp-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.supp-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

.supp-action-btn:hover {
  color: var(--color-cyan);
}

.supp-action-btn.delete:hover {
  color: var(--color-rose);
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-variant-numeric: tabular-nums;
}

.badge-1rm {
  background: rgba(255, 0, 127, 0.12);
  border: 1px solid rgba(255, 0, 127, 0.3);
  color: var(--color-rose);
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
}

.pr-exercise-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

/* Empty State Card */
.empty-state-card {
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 60px 40px;
  text-align: center;
}

.empty-icon {
  font-size: 56px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* Modal Overlay & Card */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-family-body);
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--color-cyan);
  box-shadow: 0 0 10px var(--color-cyan-glow);
}

.form-row {
  display: flex;
  gap: 16px;
}

.col-6 { flex: 1; }

.input-readonly {
  background: rgba(255, 255, 255, 0.02) !important;
  color: var(--text-muted) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.alert-info {
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.2);
  color: var(--text-main);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--color-cyan);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 25px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s forwards;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Utilities */
.flex-gap { display: flex; gap: 12px; }
.justify-center { justify-content: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.text-center { text-align: center; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.my-4 { margin-top: 16px; margin-bottom: 16px; }
.divider { border: none; border-bottom: 1px solid var(--border-color); }

/* Modal Sizing Extensions */
.modal-card-lg {
  max-width: 780px;
}

.modal-card-xl {
  max-width: 1060px;
  width: 95%;
}

/* Search Bar Styling */
.search-input-wrap {
  position: relative;
  width: 100%;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 42px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-main) !important;
  font-size: 14px !important;
}

.search-input:focus {
  border-color: var(--color-cyan) !important;
  box-shadow: 0 0 12px var(--color-cyan-glow) !important;
}

.filter-bar-scrollable {
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

/* Matrix Cards Grid */
.matrix-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
  max-height: 54vh;
  overflow-y: auto;
  padding-right: 4px;
}

.matrix-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: var(--transition-fast);
}

.matrix-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(0, 242, 254, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.matrix-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.matrix-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.matrix-card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-muscle {
  background: rgba(0, 242, 254, 0.12);
  color: var(--color-cyan);
  border: 1px solid rgba(0, 242, 254, 0.25);
}

.badge-equip {
  background: rgba(127, 0, 255, 0.12);
  color: #c084fc;
  border: 1px solid rgba(127, 0, 255, 0.25);
}

.badge-difficulty {
  background: rgba(0, 245, 160, 0.12);
  color: var(--color-green);
  border: 1px solid rgba(0, 245, 160, 0.25);
}

.matrix-card-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.matrix-card-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.matrix-card-tips {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
}

/* Template Cards Grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  max-height: 56vh;
  overflow-y: auto;
  padding-right: 4px;
}

.template-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: var(--transition-fast);
}

.template-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-cyan-purple);
  opacity: 0.7;
}

.template-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(127, 0, 255, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.template-card-header h4 {
  font-family: var(--font-family-title);
  font-size: 18px;
  margin-bottom: 6px;
  color: #fff;
}

.template-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.template-exercises-preview {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.template-exercises-preview li {
  display: flex;
  justify-content: space-between;
  color: var(--text-main);
}

.template-exercises-preview li span.sets-reps {
  color: var(--color-cyan);
  font-weight: 600;
}

/* Live Workout Session Progress Bar Card */
.workout-progress-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  min-width: 280px;
  flex: 1;
  margin: 0 20px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.workout-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.workout-progress-bar-fill {
  height: 100%;
  background: var(--gradient-cyan-purple);
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px var(--color-cyan-glow);
}

.timer-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 4px;
}

.sound-pill {
  font-size: 10px;
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.25);
  border-radius: var(--radius-full);
  padding: 2px 6px;
  color: var(--color-cyan);
  font-weight: 600;
}

.rest-timer-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  justify-content: center;
}

/* Flash Animation when Rest Timer finishes */
@keyframes restFinishFlash {
  0% { box-shadow: 0 0 30px rgba(0, 245, 160, 0.8); border-color: #00f5a0; transform: scale(1.03); }
  50% { box-shadow: 0 0 15px rgba(0, 245, 160, 0.4); border-color: #00f5a0; transform: scale(1.0); }
  100% { box-shadow: 0 0 30px rgba(0, 245, 160, 0.8); border-color: #00f5a0; transform: scale(1.03); }
}

.rest-timer-finished {
  animation: restFinishFlash 0.8s ease-in-out 3;
}

/* Workout Summary Modal Styles */
.trophy-badge-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto;
  border-radius: 50%;
  background: rgba(255, 184, 0, 0.12);
  border: 2px solid rgba(255, 184, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #ffb800;
  box-shadow: 0 0 25px rgba(255, 184, 0, 0.3);
}

.summary-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.summary-stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.stat-box-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.stat-box-val {
  font-family: var(--font-family-title);
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.summary-exercises-list {
  display: flex;
  flex-direction: column;
}

.summary-ex-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.summary-ex-row:last-child {
  border-bottom: none;
}

/* ==========================================================================
   PRE-APP AUTH GATEWAY SCREEN (POCKETID ACCESS GUARD)
   ========================================================================== */
.auth-gateway-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, rgba(56, 189, 248, 0.04) 0%, #080c14 70%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  padding: 20px;
}

.gateway-card {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.06);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  max-width: 500px;
  width: 100%;
  text-align: center;
  animation: fadeIn 0.3s ease-out;
}

.gateway-icon-wrap {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.1);
}

.gateway-shield {
  font-size: 30px;
  color: var(--color-cyan);
}

.gateway-header h2 {
  font-family: var(--font-family-title);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.gateway-header h2 span {
  color: var(--color-cyan);
}

.badge-compliance {
  display: inline-block;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: var(--color-cyan);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 16px;
}

.gateway-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  text-align: left;
}

.gateway-desc strong {
  color: #f1f5f9;
}

.gateway-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  text-align: left;
}

.gateway-feat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.gateway-feat-item i {
  font-size: 14px;
  width: 18px;
  text-align: center;
}

.gateway-actions .btn-lg {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  background: #0284c7;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.25);
}

.gateway-footer {
  margin-top: 16px;
  color: var(--text-muted);
}

.gateway-footer code {
  color: var(--color-cyan);
  background: rgba(0, 242, 254, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}



