/* =============================================
   SETTINGS PAGE
   ============================================= */
.settings-page {
  background: var(--color-bg);
  min-height: 100vh;
}

.settings-wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.settings-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.settings-page-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-text);
}

/* Preview card */
.settings-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.settings-preview-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.settings-preview-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.settings-preview-identity {
  flex: 1;
  min-width: 0;
}

.settings-preview-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-preview-email {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-preview-meta {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
}

/* Section blocks */
.settings-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.settings-block:last-child { margin-bottom: 0; }

.settings-block-danger {
  border-color: #fca5a5;
}

.settings-block-header {
  margin-bottom: 14px;
}

.settings-block-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}

.settings-block-help {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 4px 0 0;
}

/* Form */
.settings-form {
  display: grid;
  gap: 12px;
}

.settings-field {
  display: grid;
  gap: 6px;
}

.settings-field-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.settings-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Linked account row */
.settings-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.settings-info-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.settings-info-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.settings-info-content {
  flex: 1;
  min-width: 0;
}

.settings-info-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.settings-info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 2px;
  word-break: break-all;
}

.settings-info-tag {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Quick links */
.settings-link-list {
  display: grid;
  gap: 8px;
}

.settings-link-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.settings-link-row:hover {
  background: var(--color-surface-2);
  border-color: #d1d5db;
}

.settings-link-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.settings-link-content {
  flex: 1;
  min-width: 0;
}

.settings-link-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.settings-link-help {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.settings-link-chevron {
  font-size: 22px;
  color: var(--color-text-muted);
  line-height: 1;
}

/* Sign out / delete buttons */
.settings-signout-btn {
  background: #fff;
  color: var(--color-danger);
  border: 1px solid #fca5a5 !important;
}

.settings-signout-btn:hover {
  background: #fef2f2;
}

.settings-delete-btn {
  background: var(--color-danger);
  color: #fff;
  border: 1px solid var(--color-danger) !important;
}

.settings-delete-btn:hover {
  background: #b91c1c;
  border-color: #b91c1c !important;
}

.settings-delete-btn:disabled {
  background: #fca5a5;
  border-color: #fca5a5 !important;
  cursor: not-allowed;
}

/* Delete modal */
.delete-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.delete-modal {
  width: 100%;
  max-width: 460px;
  background: var(--color-surface);
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  box-shadow: 0 24px 48px rgba(0,0,0,0.2);
  overflow: hidden;
}

.delete-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #fca5a5;
  background: #fef2f2;
}

.delete-modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #991b1b;
}

.delete-modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: #991b1b;
  cursor: pointer;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 6px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-modal-close:hover {
  background: rgba(153,27,27,0.08);
}

.delete-modal-body {
  padding: 18px;
}

.delete-modal-body p {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--color-text);
}

.delete-modal-warning {
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  color: #991b1b !important;
  font-size: 13px !important;
}

.delete-modal-list {
  margin: 0 0 14px;
  padding-left: 20px;
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.delete-modal-confirm-label {
  display: block;
  margin: 14px 0 6px;
  font-size: 13px;
  color: var(--color-text);
}

#delete-modal-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  font-family: 'Consolas', 'Menlo', monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  background: #fef2f2;
  color: var(--color-text);
  box-sizing: border-box;
  outline: none;
}

#delete-modal-input:focus {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(220,38,38,0.12);
}

.delete-modal-progress {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'Consolas', 'Menlo', monospace;
  color: var(--color-text-muted);
  white-space: pre-line;
  max-height: 160px;
  overflow-y: auto;
}

.delete-modal-progress.error {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.delete-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 18px;
  border-top: 1px solid #fca5a5;
  background: var(--color-bg);
}

/* Settings toast */
.settings-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  z-index: 1300;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--color-success);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.settings-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.settings-toast.error {
  background: var(--color-danger);
}

@media (max-width: 640px) {
  .settings-wrap {
    padding: 20px 14px 40px;
  }
}

/* =============================================
   ADMIN PAGE
   ============================================= */
.admin-page {
  background: var(--color-bg);
  min-height: 100vh;
}

.admin-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.admin-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-text);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.admin-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.admin-stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.1;
}

.admin-stat-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.admin-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.admin-search {
  flex: 1 1 220px;
}

.admin-sort {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-sort-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.admin-status-text {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.admin-user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.admin-user-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  border-color: #d1d5db;
}

.admin-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.admin-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-user-identity {
  flex: 1;
  min-width: 0;
}

.admin-user-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-email {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.admin-user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 6px;
}

.admin-meta-item {
  font-size: 12px;
  color: var(--color-text-muted);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.admin-meta-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
}

.admin-status-badge {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.admin-status-badge--today    { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.admin-status-badge--active   { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.admin-status-badge--idle     { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }
.admin-status-badge--inactive { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }

.admin-empty {
  text-align: center;
  padding: 32px 16px;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: 14px;
}

@media (max-width: 640px) {
  .admin-wrap {
    padding: 20px 14px 40px;
  }

  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-user-meta {
    display: none;
  }
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #f7f8fa;
  --color-surface: #ffffff;
  --color-surface-2: #f0f2f5;
  --color-border: #e5e7eb;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-accent: #2563eb;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --font-base: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.06);
  --nav-height: 60px;
}

html, body {
  height: 100%;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.6;
}

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

ul {
  list-style: none;
}

/* =============================================
   UTILITY
   ============================================= */
.hidden {
  display: none !important;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

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

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-google {
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 15px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}

.btn-google:hover {
  background: var(--color-surface-2);
}

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

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* =============================================
   AUTH SCREEN
   ============================================= */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--color-bg);
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 48px 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow);
}

.logo {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 8px;
}

.tagline {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.auth-error {
  margin-top: 16px;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  color: #b91c1c;
  font-size: 13px;
  text-align: left;
  word-break: break-word;
}

/* =============================================
   APP LAYOUT
   ============================================= */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =============================================
   NAVBAR
   ============================================= */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.nav-logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-text);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  color: var(--color-text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.nav-link.active {
  background: var(--color-surface-2);
  color: var(--color-primary);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
}

.user-name {
  font-size: 14px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* =============================================
   NAV AVATAR DROPDOWN
   ============================================= */
.nav-avatar-wrap {
  position: relative;
  margin-left: auto;
}

.nav-avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.nav-avatar-btn:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.nav-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nav-avatar-initial {
  line-height: 1;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 300;
  overflow: hidden;
  animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nav-dropdown-header {
  padding: 12px 14px;
}

.nav-dropdown-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-dropdown-email {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-dropdown-divider {
  height: 1px;
  background: var(--color-border);
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}

.nav-dropdown-item:hover {
  background: var(--color-surface-2);
}

.nav-dropdown-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.nav-dropdown-item--danger {
  color: var(--color-danger);
}

.nav-dropdown-item--danger svg {
  color: var(--color-danger);
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}

/* =============================================
   PAGES
   ============================================= */
.page {
  animation: fadeIn 0.2s ease;
}

.page h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 24px;
}

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

.coming-soon {
  color: var(--color-text-muted);
  font-style: italic;
}

/* =============================================
   STATS GRID
   ============================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
}

.stat-label {
  font-size: 13px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =============================================
   WORKOUT LIST
   ============================================= */

.workout-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.workout-list .empty-state {
  color: var(--color-text-muted);
  font-style: italic;
  padding: 16px 0;
}

/* =============================================
   DASHBOARD GRID & CARDS
   ============================================= */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 8px;
}

.dashboard-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  min-width: 0; /* prevent grid blowout */
  overflow: hidden;
}

.dashboard-card--wide {
  grid-column: 1 / -1;
}

.dashboard-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.card-title-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: none;
  letter-spacing: 0;
}

/* =============================================
   DASHBOARD LISTS
   ============================================= */
.dash-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-list-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.dash-list-name {
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-list-value {
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}

.dash-list-sub {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* =============================================
   MUSCLE BREAKDOWN
   ============================================= */
.muscle-breakdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.muscle-row {
  display: grid;
  grid-template-columns: 100px 1fr 38px 60px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.muscle-name {
  font-weight: 600;
  color: var(--color-text);
}

.muscle-bar-wrap {
  background: var(--color-surface-2);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}

.muscle-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: 99px;
  transition: width 0.6s ease;
  min-width: 4px;
}

.muscle-pct {
  font-weight: 700;
  color: var(--color-primary);
  text-align: right;
}

.muscle-sets {
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: right;
}

/* =============================================
   DASHBOARD CHARTS
   ============================================= */
.dash-chart-wrap {
  position: relative;
  height: 220px;
}

.dash-chart-wrap--tall {
  height: 280px;
}

/* =============================================
   HEATMAP
   ============================================= */
.heatmap-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

.heatmap {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  min-width: 100%;
}

.heatmap-months {
  display: flex;
  padding-left: 28px; /* matches day-label width */
  margin-bottom: 2px;
  position: relative;
  height: 16px;
}

.heatmap-month-label {
  font-size: 10px;
  color: var(--color-text-muted);
  font-weight: 600;
  height: 12px;
  line-height: 12px;
  white-space: nowrap;
}

.heatmap-daylabel-spacer {
  width: 28px;
  flex-shrink: 0;
}

.heatmap-grid {
  display: flex;
  gap: 3px;
}

.heatmap-dayLabels {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 28px;
  flex-shrink: 0;
}

.heatmap-day-label {
  height: 12px;
  font-size: 10px;
  color: var(--color-text-muted);
  line-height: 12px;
  text-align: right;
  padding-right: 4px;
}

.heatmap-week {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.heatmap-cell--empty {
  background: var(--color-surface-2);
}

.heatmap-cell--active {
  background: #2563eb;
}

.heatmap-cell--future {
  background: transparent;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding-left: 28px;
}

.heatmap-legend-label {
  font-size: 11px;
  color: var(--color-text-muted);
}

@media (max-width: 640px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .dashboard-card {
    padding: 14px;
  }

  .dashboard-card--wide {
    grid-column: 1;
  }

  .muscle-row {
    grid-template-columns: 80px 1fr 32px;
  }

  .muscle-sets {
    display: none;
  }

  .dash-chart-wrap {
    height: 180px;
  }

  .dash-list-item {
    grid-template-columns: 1fr auto;
  }

  .dash-list-sub {
    display: none;
  }
}

/* =============================================
   INPUTS
   ============================================= */
.input {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 14px;
  padding: 8px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

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

.input::placeholder {
  color: var(--color-text-muted);
}

.input-sm {
  padding: 5px 8px;
  font-size: 13px;
  width: 80px;
}

/* Remove number input spinners */
.input[type="number"]::-webkit-inner-spin-button,
.input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

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

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  font-size: 14px;
  font-weight: 500;
  pointer-events: all;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.toast--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.toast--info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

.toast-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
  padding: 0 2px;
  flex-shrink: 0;
}

.toast-close:hover {
  opacity: 1;
}

/* =============================================
   EDIT MODE BANNER
   ============================================= */
.edit-mode-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #1e40af;
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-link:hover {
  color: var(--color-primary-hover);
}

/* =============================================
   LOG WORKOUT PAGE
   ============================================= */
.log-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.log-header h2 {
  margin-bottom: 0;
}

.log-meta {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
}

.exercise-search-section {
  margin-bottom: 20px;
}

.exercise-search-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.search-wrap {
  position: relative;
  max-width: 480px;
}

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s;
}

.suggestion-item:hover {
  background: var(--color-surface-2);
}

.suggestion-name {
  font-size: 14px;
  color: var(--color-text);
}

.suggestion-muscle {
  font-size: 12px;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 8px;
}

.exercises-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.exercise-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
}

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

.exercise-card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  margin-right: 10px;
}

.exercise-card-muscle {
  font-size: 12px;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 8px;
}

.sets-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.sets-header {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 32px;
  gap: 8px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.set-row {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 32px;
  gap: 8px;
  align-items: center;
}

.set-num {
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: center;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: none;
  font-size: 18px;
  padding: 2px 6px;
  line-height: 1;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--color-danger);
}

.btn-ghost:disabled {
  opacity: 0.2;
  cursor: default;
}

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

.btn-danger:hover {
  background: var(--color-danger);
  color: #fff;
}

.log-empty-state {
  color: var(--color-text-muted);
  font-style: italic;
  padding: 24px 0;
  text-align: center;
}

/* =============================================
   DASHBOARD RECENT WORKOUTS
   ============================================= */
.workout-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.workout-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.workout-date {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* =============================================
   HISTORY PAGE
   ============================================= */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  gap: 16px;
}

.history-item-header:hover {
  background: var(--color-surface-2);
}

.history-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.history-item-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}

.history-item-date {
  font-size: 13px;
  color: var(--color-text-muted);
}

.history-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.history-badge {
  font-size: 12px;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 8px;
  white-space: nowrap;
}

.history-chevron {
  font-size: 20px;
  color: var(--color-text-muted);
  transition: transform 0.2s;
  line-height: 1;
}

.history-item.expanded .history-chevron {
  transform: rotate(90deg);
}

.history-item-body {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid var(--color-border);
}

.history-item.expanded .history-item-body {
  display: block;
}

.history-item--highlight {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
  background: #fffbeb;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.history-item {
  transition: border-color 0.6s ease, box-shadow 0.6s ease, background 0.6s ease;
}

.history-notes {
  font-size: 14px;
  color: var(--color-text-muted);
  font-style: italic;
  padding: 12px 0 8px;
}

.history-exercises {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 14px;
}

.history-exercise-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.history-exercise-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.history-exercise-muscle {
  font-size: 12px;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 8px;
}

.history-sets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-set-pill {
  font-size: 12px;
  color: var(--color-primary);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 3px 10px;
}

.empty-state {
  color: var(--color-text-muted);
  font-style: italic;
  padding: 16px 0;
}

/* =============================================
   PROGRESS PAGE
   ============================================= */
.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.progress-header h2 {
  margin-bottom: 0;
}

.progress-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* PR Banner */
.pr-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #78350f;
}

.pr-banner-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

/* Chart */
.progress-chart-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.progress-empty {
  color: var(--color-text-muted);
  font-style: italic;
  padding: 32px 0;
  text-align: center;
}

/* PR Section */
.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 12px;
}

.pr-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pr-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  flex-wrap: wrap;
}

.pr-row--latest {
  border-color: #fcd34d;
  background: #fffbeb;
}

.pr-row-date {
  color: var(--color-text-muted);
  min-width: 120px;
}

.pr-row-set {
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
}

.pr-row-1rm {
  color: var(--color-primary);
  font-weight: 600;
}

.pr-row-badge {
  font-size: 11px;
  font-weight: 700;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  border-radius: 4px;
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =============================================
   RESPONSIVE
   ============================================= */
/* =============================================
   MOBILE BOTTOM TAB BAR
   ============================================= */
.mobile-tabs {
  display: none;
}

@media (max-width: 640px) {
  .mobile-tabs {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    height: 60px;
  }

  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .mobile-tab svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
  }

  .mobile-tab.active {
    color: var(--color-primary);
  }

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

  .nav-links {
    display: none;
  }

  .user-name {
    display: none;
  }

  .navbar {
    padding: 0 16px;
  }

  .main-content {
    padding: 16px 12px;
    padding-bottom: 80px; /* clear the tab bar */
    overflow-x: hidden;
  }

  .log-meta {
    grid-template-columns: 1fr;
  }

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

  .history-item-meta .history-badge {
    display: none;
  }

  .progress-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .progress-controls {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .progress-controls .input {
    width: 100%;
  }
}
