/* Shared brand colors; marketing keeps its own spacious layout. */
:root {
  --bg: #fafbf9;
  --panel: #ffffff;
  --panel-soft: #f0f4ef;
  --field: #ffffff;
  --image-bg: #f0f4f2;
  --ink: #182b28;
  --muted: #566762;
  --line: #dce3df;
  --accent: #216b57;
  --accent-soft: #e4efe7;
  --accent-ink: #245740;
  --on-accent: #ffffff;
  --topbar-bg: rgba(250, 251, 249, 0.96);
  --streak-bg: #f0f4e9;
  --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111816;
    --panel: #1b2420;
    --panel-soft: #202d25;
    --field: #151e19;
    --image-bg: #202d25;
    --ink: #edf3ed;
    --muted: #afbab3;
    --line: #33423a;
    --accent: #92cbb0;
    --accent-soft: #253d30;
    --accent-ink: #c3e4cf;
    --on-accent: #142c20;
    --topbar-bg: rgba(17, 24, 22, 0.96);
    --streak-bg: #202c20;
  }
}
.app-shell:not(.marketing-mode) { line-height: 1.5; }
.app-shell:not(.marketing-mode) main { max-width: 1240px; }
.app-shell:not(.marketing-mode) .topbar { padding-top: 18px; padding-bottom: 18px; }
.app-shell:not(.marketing-mode) h2 { font-size: 22px; font-weight: 600; line-height: 1.3; }
.app-shell:not(.marketing-mode) h3 { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.app-wordmark { margin: 0 0 4px; color: var(--muted); font-size: 15px; font-weight: 650; line-height: 1.3; }
.app-wordmark span { color: var(--accent); }
.eyebrow { font-size: 12px; font-weight: 600; text-transform: none; }
.app-shell:not(.marketing-mode) .muted { font-size: 14px; line-height: 1.55; }
.app-shell:not(.marketing-mode) .topbar > div { min-width: 0; }
.app-shell:not(.marketing-mode) .topbar-actions { align-items: center; }
button, input, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
button:disabled { cursor: default; }
#save-routine:disabled, #start-workout:disabled { opacity: 0.45; }
.back-button, .primary-button, .open-routine, .add-exercise-bottom,
.add-set, .add-logged-set, .save-workout-edit, .delete-workout-session,
.rename-ai-token, .revoke-ai-token { min-height: 42px; font-size: 14px; font-weight: 600; border-radius: 6px; }
.primary-button, .open-routine, .add-exercise-bottom, .save-workout-edit, .set-done.checked {
  color: var(--on-accent);
}
.primary-button:not(:disabled):hover, .open-routine:not(:disabled):hover,
.save-workout-edit:not(:disabled):hover { filter: brightness(0.94); }
.back-button:hover, .icon-button:hover, .edit-exercise:hover, .edit-workout-session:hover { background: var(--panel-soft); }
#sign-out { background: transparent; border-color: transparent; color: var(--muted); }
#sign-out:hover { color: var(--ink); background: var(--panel-soft); }
.workouts-grid { gap: 18px; }
.routine-library-heading { grid-column: 1 / -1; margin: 10px 0 -4px; }
.app-shell:not(.marketing-mode) .routine-library-heading { font-size: 17px; }
.calendar-panel { height: min(40svh, 330px); min-height: 280px; gap: 18px; }
.calendar-card { padding: 18px; gap: 12px; grid-template-rows: auto auto minmax(0, 1fr); }
.calendar-card h3 { font-size: 21px; }
.calendar-card .eyebrow { color: var(--muted); }
.calendar-weekdays span { font-size: 12px; font-weight: 500; }
.calendar-grid { align-content: stretch; }
.calendar-day { font-weight: 600; border-radius: 6px; }
a.calendar-day:hover { border-color: var(--accent); }
.calendar-day.today { box-shadow: inset 0 0 0 1px var(--accent); }
.view-history-button { min-height: 40px; font-size: 13px; font-weight: 600; }
.streak-counter { border-color: var(--line); align-content: center; gap: 16px; }
.streak-counter strong { font-size: 38px; font-weight: 550; font-variant-numeric: tabular-nums; }
.streak-counter > span { color: var(--muted); font-size: 13px; font-weight: 500; }
.workout-card { min-height: 238px; grid-template-rows: 1fr auto auto; gap: 18px; padding: 20px; }
.workout-card h3 { font-size: 21px; margin-top: 6px; margin-bottom: 8px; }
.edit-routine { float: right; margin: -6px -6px 8px 10px; }
.routine-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 18px; }
.routine-fields label { display: grid; align-content: start; gap: 8px; font-size: 14px; }
.routine-fields input, .routine-fields textarea { width: 100%; min-width: 0; box-sizing: border-box; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--ink); font: inherit; font-size: 16px; }
.routine-fields textarea { resize: vertical; }
.delete-routine { justify-self: start; margin-top: 12px; }
.workout-card .eyebrow { color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ai-routine-pill { font-weight: 600; font-size: 11px; padding: 4px 9px; margin-left: 0; line-height: 1.3; }
.workout-preview { min-height: 58px; }
.workout-preview img { width: 52px; height: 52px; }
.open-routine { background: var(--panel-soft); border: 1px solid var(--line); color: var(--ink); }
.open-routine:hover { border-color: var(--accent); }
.routine-summary-panel { padding: 0 0 18px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.summary-grid { gap: 0; }
.summary-grid div { border: 0; border-right: 1px solid var(--line); border-radius: 0; background: transparent; padding: 4px 18px; }
.summary-grid div:first-child { padding-left: 0; }
.summary-grid div:last-child { border: 0; }
.summary-grid span { font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-grid small { font-size: 12px; }
.workout-timer { font-weight: 600; font-variant-numeric: tabular-nums; border-radius: 6px; min-height: 42px; }
.exercise-card { padding: 20px; gap: 20px; }
.exercise-media { background: var(--image-bg); border: 0; }
.asset-name { font-size: 12px; margin-top: 4px; }
.instruction { font-size: 14px; }
.muscle-details { background: transparent; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; }
.muscle-details summary { padding-left: 0; font-weight: 500; font-size: 13px; }
.muscle-row { background: transparent; border: 0; padding: 6px 0; }
.muscle-row strong { font-weight: 600; }
.sets-head, .day-edit-head { font-weight: 500; text-transform: none; }
.sets-head, .set-row { min-width: 0; grid-template-columns: 28px 40px 82px minmax(64px, 1fr) minmax(64px, 1fr) 34px; gap: 8px; }
.set-index, .day-edit-set > span { font-weight: 550; font-variant-numeric: tabular-nums; }
.set-row input, .day-edit-set input { min-height: 42px; font-size: 16px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.prev-button { min-height: 42px; font-size: 13px; font-weight: 550; padding: 6px; border-radius: 6px; }
.prev-button:disabled { background: transparent; border-color: transparent; }
.set-done { width: 36px; height: 40px; border-radius: 6px; font-size: 16px; }
.set-done:not(.checked) { color: var(--muted); }
.remove-set, .remove-logged-set { width: 32px; height: 40px; border: 0; background: transparent; font-size: 18px; font-weight: 500; }
.add-set, .add-logged-set { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.add-exercise-bottom { min-height: 48px; background: var(--panel-soft); border: 1px dashed var(--line); color: var(--accent); }
.add-exercise-bottom:hover, .add-set:hover, .add-logged-set:hover { border-color: var(--accent); }
.icon-button, .edit-exercise, .edit-workout-session { width: 40px; height: 40px; border-radius: 6px; font-weight: 600; flex-shrink: 0; }
.day-detail-card { border: 0; padding: 0; border-radius: 0; background: transparent; }
.day-detail-list article { padding: 20px; gap: 20px; background: var(--panel); }
.day-edit-exercise { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 18px 0 0; background: transparent; }
.day-edit-exercise-header h3 { font-size: 17px; }
.day-edit-exercise-header .muted { white-space: nowrap; }
.day-detail-actions { justify-content: flex-start; }
.day-edit-set input:disabled { opacity: 1; color: var(--ink); background: transparent; border-color: transparent; }
.exercise-modal, .edit-modal, .ai-modal { padding: 24px; box-shadow: 0 16px 60px #0003; }
.modal-header { margin-bottom: 16px; }
.modal-header h2 { font-size: 22px; font-weight: 600; }
.modal-header .eyebrow { color: var(--muted); }
.search-mode-button, .ai-mode-toggle button { font-weight: 600; min-height: 42px; font-size: 14px; }
.search-wrap input, .ai-token-name-field input, .auth-form input { min-height: 44px; font-size: 16px; }
.search-result { min-height: 64px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 14px 4px; }
.search-result:hover { background: var(--panel-soft); }
.search-result strong { font-weight: 600; font-size: 15px; }
.search-result span { font-size: 13px; margin-top: 4px; }
.edit-action { background: transparent; padding: 16px; }
.edit-action strong { font-size: 15px; font-weight: 600; }
.edit-action span { margin-top: 5px; font-size: 13px; line-height: 1.5; }
.ai-access-copy, .secret-box, .connection-box, .token-list { border: 0; border-radius: 0; background: transparent; padding: 12px 0; }
.connection-box, .token-list { border-top: 1px solid var(--line); }
.ai-token-name-field span, .connection-box span, .token-row small { text-transform: none; font-weight: 500; font-size: 13px; }
.ai-token-name-field small { font-weight: 400; font-size: 12px; }
.ai-token-name-field > span { line-height: 1.7; }
.token-list-header strong { font-weight: 600; }
.token-list-header span { font-size: 12px; font-weight: 600; }
.token-row { padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.token-row strong { font-weight: 600; }
.rename-ai-token, .revoke-ai-token { font-size: 13px; }
.secret-box textarea { font-size: 14px; }
.auth-card { box-shadow: none; }
.auth-form label span { font-weight: 500; text-transform: none; }
.status { font-size: 14px; line-height: 1.6; }
.sync-status { grid-column: 1 / -1; }
@media (max-width: 920px) {
  .calendar-panel { height: auto; min-height: 0; }
  .calendar-card { min-height: 230px; }
  .streak-counter { gap: 6px 18px; align-content: center; }
}
@media (max-width: 560px) {
  .routine-fields { grid-template-columns: minmax(0, 1fr); }
  .app-shell:not(.marketing-mode) .topbar { gap: 14px; padding: 16px 12px; }
  .app-shell:not(.marketing-mode) .topbar-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; width: 100%; }
  .app-shell:not(.marketing-mode) .topbar-actions button { font-size: 13px; padding: 10px 8px; min-height: 44px; white-space: nowrap; }
  .app-shell:not(.marketing-mode) .topbar:has(.routine-actions) { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .app-shell:not(.marketing-mode) .topbar:has(.routine-actions) > div:not(.routine-actions) { grid-column: 1 / -1; grid-row: 1; }
  .app-shell:not(.marketing-mode) .topbar:has(.routine-actions) > .back-button { justify-self: start; }
  .routine-actions { gap: 8px; }
  .workout-timer { padding: 9px 8px; min-width: 60px; }
  .calendar-card { padding: 14px; min-height: 0; gap: 10px; }
  .calendar-card h3 { font-size: 20px; }
  .calendar-weekdays span { font-size: 11px; }
  .calendar-grid, .calendar-weekdays { gap: 5px; }
  .calendar-day { height: 44px; }
  .streak-counter { min-height: 88px; padding: 14px; }
  .streak-counter strong { font-size: 29px; }
  .workout-card { min-height: 216px; padding: 18px; }
  .exercise-card { grid-template-columns: 76px minmax(0, 1fr); padding: 12px; gap: 14px 12px; }
  .exercise-media { width: 76px; min-height: 76px; max-height: 76px; }
  .exercise-media img { max-height: 76px; }
  .exercise-title-row h3 { font-size: 17px; }
  .edit-exercise { width: 36px; height: 40px; }
  .muscle-details summary { min-height: 42px; padding-left: 0; }
  .sets-head, .set-row { grid-template-columns: 20px 32px 50px minmax(40px, 1fr) minmax(40px, 1fr) 26px; gap: 5px; }
  .sets-head { font-size: 10px; }
  .set-row { padding: 7px 0; }
  .set-done { width: 32px; height: 40px; }
  .prev-button { font-size: 11px; padding: 4px 2px; }
  .set-row input { padding: 8px 4px; font-size: 16px; }
  .remove-set, .remove-logged-set { width: 26px; height: 40px; }
  .day-detail-list article { padding: 14px; }
  .day-edit-exercise { padding: 16px 0 0; }
  .day-edit-set input { font-size: 16px; }
  .day-edit-exercise-header h3 { font-size: 16px; }
  .exercise-modal, .edit-modal, .ai-modal { padding: 16px; }
  .modal-header h2 { font-size: 20px; }
  .token-row { flex-wrap: wrap; gap: 12px; }
  .token-actions { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .streak-flame, .streak-flame::before, .streak-flame::after, .streak-flame span { animation: none; }
}
