/* ShimGym — styles */

:root {
  --ink: #1a1510;
  --paper: #faf6f0;
  --cream: #f7e8c8;
  --coral: #e85d4c;
  --coral-dark: #c94435;
  --teal: #2a9d8f;
  --teal-dark: #1f7a6f;
  --sand: #d4c4a8;
  --muted: #6b6358;
  --border: #e0d8cc;
  --success: #2a9d8f;
  --warning: #e9c46a;
  --danger: #e85d4c;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: system-ui, -apple-system, sans-serif;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(26, 21, 16, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100svh;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

a {
  color: var(--teal);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* Layout */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

.app-header {
  background: var(--ink);
  color: var(--cream);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 {
  font-size: 1.15rem;
  margin: 0;
  color: var(--cream);
}

.app-header .subtitle {
  font-size: 0.75rem;
  opacity: 0.7;
  font-family: var(--font-body);
  font-weight: normal;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.app-nav {
  display: flex;
  gap: 0.25rem;
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-tab {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.nav-tab:hover {
  background: rgba(26, 21, 16, 0.06);
  color: var(--ink);
}

.nav-tab.active {
  background: var(--ink);
  color: var(--cream);
}

.app-main {
  flex: 1;
  padding: 1rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.view { display: none; }
.view.active { display: block; }

/* Auth screen */
.auth-screen {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, var(--cream) 0%, var(--paper) 50%, #e8f4f2 100%);
}

.auth-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}

.auth-card h1 {
  text-align: center;
  margin-bottom: 0.25rem;
}

.auth-card .tagline {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.auth-tab {
  flex: 1;
  padding: 0.6rem;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
}

.auth-tab.active {
  background: var(--ink);
  color: var(--cream);
}

.auth-google-btn {
  margin-bottom: 0;
}

.auth-divider {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 1rem 0;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 1rem;
  background: white;
  color: var(--ink);
  transition: border-color 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.15);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.form-error {
  background: #fef2f0;
  color: var(--danger);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.btn-secondary {
  background: var(--ink);
  color: var(--cream);
}
.btn-secondary:hover { background: #2d2620; }

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: rgba(26, 21, 16, 0.04); }

.btn-teal {
  background: var(--teal);
  color: white;
}
.btn-teal:hover { background: var(--teal-dark); }

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

.btn-block { width: 100%; }

.app-toast {
  position: fixed;
  bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(22rem, calc(100vw - 2rem));
  background: var(--ink);
  color: var(--cream);
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  font-size: 0.875rem;
  line-height: 1.35;
  text-align: center;
  z-index: 300;
  box-shadow: var(--shadow);
  animation: toast-in 0.2s ease;
  pointer-events: none;
}

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

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.modal-actions-primary .btn {
  flex: 1;
}

.modal-actions-delete {
  color: var(--danger);
  border-color: var(--danger);
  align-self: flex-start;
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  width: 100%;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  background: transparent;
}

.modal-actions-delete:hover {
  background: rgba(232, 93, 76, 0.06);
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

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

.card-header h2,
.card-header h3 {
  margin: 0;
}

.session-complete-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Session */
.session-banner {
  background: linear-gradient(135deg, var(--teal), #21867a);
  color: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.session-banner.inactive {
  background: var(--sand);
  color: var(--ink);
}

.session-banner h2 {
  color: inherit;
  margin-bottom: 0.25rem;
}

.session-banner p {
  margin: 0;
  opacity: 0.85;
  font-size: 0.9rem;
}

/* Exercise list */
.exercise-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.exercise-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: white;
}

.exercise-item:hover {
  border-color: var(--teal);
  background: #f8fcfb;
}

.exercise-item.selected {
  border-color: var(--teal);
  background: #eef8f6;
}

.exercise-item .name {
  font-weight: 600;
}

.exercise-item .meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.exercise-item .badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--cream);
  color: var(--muted);
  white-space: nowrap;
}

.exercise-item-main {
  min-width: 0;
  flex: 1;
}

.exercise-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.exercise-item-actions .badge-total {
  min-width: 3.5rem;
  text-align: center;
}

.exercise-finish-btn {
  flex-shrink: 0;
}

/* Sets editor */
.sets-editor {
  margin-top: 0.5rem;
}

.sets-editor-header {
  display: grid;
  grid-template-columns: 3.25rem 4.75rem 4.75rem 2.25rem;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

.sets-editor-header.reps-only {
  grid-template-columns: 3.25rem 4.75rem 2.25rem;
}

.set-row {
  display: grid;
  grid-template-columns: 3.25rem 4.75rem 4.75rem 2.25rem;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.set-row.reps-only {
  grid-template-columns: 3.25rem 4.75rem 2.25rem;
}

.set-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.set-row-spacer {
  width: 2.25rem;
}

.set-row input[type="number"] {
  width: 4.75rem;
  max-width: 100%;
  padding: 0.5rem 0.55rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  text-align: center;
}

.set-row .remove-set {
  width: 2.25rem;
  min-width: 2.25rem;
  padding: 0.35rem 0;
}

.sets-editor-errors {
  background: #fef2f0;
  border: 1px solid rgba(232, 93, 76, 0.35);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.65rem;
  font-size: 0.85rem;
  color: var(--danger);
}

.sets-editor-errors ul {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
}

.sets-editor-errors li {
  margin: 0.1rem 0;
}

.set-input-error {
  border-color: var(--danger) !important;
  background: #fffaf9;
}

.missing-data-badge {
  background: #fef9ee;
  color: #b8860b;
}

.exercise-item--missing-data:not(.exercise-item--current) {
  border-color: rgba(184, 134, 11, 0.45);
  background: #fffdf8;
}

/* Difficulty pills */
.difficulty-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.difficulty-btn {
  flex: 1;
  padding: 0.5rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.difficulty-btn.easy.selected { border-color: var(--success); background: #eef8f6; color: var(--success); }
.difficulty-btn.ok.selected { border-color: var(--warning); background: #fef9ee; color: #b8860b; }
.difficulty-btn.hard.selected { border-color: var(--danger); background: #fef2f0; color: var(--danger); }

/* Recent exercises grid */
.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.recent-chip {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s;
  font-family: var(--font-body);
  color: var(--ink);
}

.recent-chip:hover {
  border-color: var(--teal);
}

.recent-chip .chip-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}

.recent-chip .chip-name {
  font-weight: 600;
  font-size: 0.85rem;
  min-width: 0;
}

.chip-difficulty {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.chip-difficulty--easy {
  background: #eef8f6;
  color: var(--success);
}

.chip-difficulty--ok {
  background: #fef9ee;
  color: #b8860b;
}

.chip-difficulty--hard {
  background: #fef2f0;
  color: var(--danger);
}

.recent-chip .chip-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Session history */
.session-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: white;
}

.session-card.open {
  border-left: 4px solid var(--teal);
  cursor: pointer;
}

.session-card.open:hover {
  border-color: var(--teal);
  background: #f8fcfb;
}

.session-card.current {
  border-left-width: 4px;
  border-left-color: var(--coral);
  background: linear-gradient(180deg, #eef8f6 0%, white 100%);
}

.active-badge {
  background: var(--teal);
  color: white;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.session-active-exercise {
  font-size: 0.85rem;
  color: var(--teal-dark);
  margin-top: 0.15rem;
}

.session-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.session-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.session-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  min-width: 0;
  flex: 1;
}

.session-date-text {
  font-weight: 600;
  font-family: var(--font-display);
  line-height: 1.35;
}

.session-card-actions {
  flex-shrink: 0;
  flex-wrap: nowrap;
}

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

.session-entries {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.session-entries--empty {
  font-style: italic;
}

@media (max-width: 420px) {
  .session-card-top {
    flex-direction: column;
    align-items: stretch;
  }

  .session-card-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Preferences */
.machine-defaults {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
}

.machine-defaults > label {
  margin-bottom: 0.5rem;
}

.default-fields {
  margin-bottom: 0;
}

.default-fields .form-group label {
  font-size: 0.7rem;
}

.default-kg-field.hidden {
  display: none;
}

.machine-readonly-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
}

#add-exercise-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.add-exercise-picker {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
}

#btn-add-exercise {
  margin-bottom: 0;
}

.active-session-card .session-summary-line {
  margin: 0.85rem 0 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

#done-exercises-section {
  margin-top: 0.25rem;
}

.session-exercises-toolbar {
  margin-bottom: 0.75rem;
}

.session-add-picker {
  margin-bottom: 0.75rem;
}

.edit-session-entry-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

#modal-edit-meta[hidden] {
  display: none;
}

#no-session-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.workout-action-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.workout-action-row .btn-block {
  flex: 1;
  width: auto;
}

.btn-voice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border: 2px solid var(--teal);
  background: white;
  color: var(--teal);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.btn-voice:hover {
  background: #eef8f6;
}

.btn-voice.listening {
  background: var(--coral);
  border-color: var(--coral);
  color: white;
  animation: voice-pulse 1.2s ease-in-out infinite;
}

.btn-voice-block {
  width: 100%;
  margin-top: 0.5rem;
}

.voice-icon {
  font-size: 1.1rem;
  line-height: 1;
}

@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 93, 76, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(232, 93, 76, 0); }
}

.active-session-card {
  border: 2px solid var(--teal);
  background: linear-gradient(180deg, #eef8f6 0%, white 40%);
}

.session-summary-line {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.exercise-item--current {
  border: 2px solid var(--teal);
  background: linear-gradient(180deg, #e8f6f3 0%, #ffffff 55%);
  box-shadow: 0 2px 8px rgba(45, 157, 143, 0.12), 0 0 0 3px rgba(45, 157, 143, 0.1);
}

.exercise-item--current .name {
  font-size: 0.95rem;
}

#current-exercise-section .exercise-item--current:hover {
  border-color: var(--teal-dark);
  background: linear-gradient(180deg, #dff0ec 0%, #ffffff 55%);
}

#current-exercise-section .exercise-item {
  cursor: pointer;
}

#current-exercise-section .exercise-item:not(.exercise-item--current):hover {
  border-color: var(--teal-dark);
  background: #f8fcfb;
}

#current-exercise-section .exercise-finish-btn {
  cursor: pointer;
}

#modal-setup-fields[hidden],
#modal-edit-fields[hidden] {
  display: none;
}

.machine-suggestions {
  position: fixed;
  z-index: 300;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(26, 21, 16, 0.12);
  max-height: 240px;
  overflow-y: auto;
}

.machine-suggestion {
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.machine-suggestion:hover,
.machine-suggestion.active {
  background: #eef8f6;
}

.machine-suggestion-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.machine-suggestion-meta {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.pref-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: white;
}

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

.pref-item-header .name {
  font-weight: 600;
}

.type-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  font-size: 0.75rem;
}

.type-toggle button {
  padding: 0.3rem 0.75rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

.type-toggle button.active {
  background: var(--ink);
  color: var(--cream);
}

/* Charts */
.chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.chart-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.chart-toggle button {
  padding: 0.4rem 0.85rem;
  border: none;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}

.chart-toggle button.active {
  background: var(--ink);
  color: var(--cream);
}

.machine-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.filter-chip {
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: white;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-chip.active {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}

.filter-chip.dimmed {
  opacity: 0.35;
}

.chart-container {
  position: relative;
  height: 280px;
  margin-bottom: 1.5rem;
}

.chart-container.tall {
  height: 360px;
}

/* Admin */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table th,
.admin-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.modal--admin {
  max-width: 640px;
}

.admin-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.admin-tab {
  padding: 0.45rem 0.85rem;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
}

.admin-tab.active {
  background: var(--ink);
  color: var(--cream);
}

.admin-exercises-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.admin-exercises-toolbar input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.admin-exercises-list {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.admin-exercise-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.admin-exercise-row:last-child {
  border-bottom: none;
}

.admin-exercise-row:hover {
  background: #f8fcfb;
}

.admin-exercise-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.admin-exercise-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.admin-exercises-empty {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
  padding: 1rem 0.85rem;
}

#admin-tab-users[hidden],
#admin-tab-exercises[hidden] {
  display: none;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}

.empty-state p {
  margin: 0 0 1rem;
}

#history-list:has(#btn-first-session) {
  max-width: 20rem;
  margin: 1.5rem auto 0;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 21, 16, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

#confirm-modal {
  z-index: 300;
}

.modal-confirm {
  max-width: 360px;
  padding: 1.25rem;
}

.modal-confirm p {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

#confirm-modal-ok {
  background: var(--danger);
  border-color: var(--danger);
}

#confirm-modal-ok:hover {
  filter: brightness(0.92);
}

.modal {
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(26, 21, 16, 0.2);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90svh;
  overflow-y: auto;
}

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

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0.25rem;
}

.user-badge {
  font-size: 0.8rem;
  color: var(--cream);
  opacity: 0.8;
}

.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  margin: 1.25rem 0 0.75rem;
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
