:root {
  color-scheme: dark;
  --bg: #0c0c0c;
  --panel: #161616;
  --field: #111111;
  --hover: #242424;
  --line: #363636;
  --muted: #aeaeae;
  --ink: #f2f2ef;
  --action: #e5e5e2;
  --radius: 6px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  font-size: 16px;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { touch-action: manipulation; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; min-height: 44px; padding: 12px 18px; border: 1px solid transparent; border-radius: var(--radius); background: var(--action); color: #111; font-size: 14px; font-weight: 600; line-height: 1.3; transition: background-color 160ms ease-out, border-color 160ms ease-out; }
button:hover { background: #fff; }
button:active { background: #c7c7c7; }
button:disabled { cursor: wait; opacity: .55; }
button.secondary, button.ghost, .small-button { color: var(--ink); border-color: var(--line); background: transparent; }
button.secondary:hover, button.ghost:hover { background: var(--hover); border-color: #777; }
button.danger { background: var(--action); color: #111; border-color: var(--action); }
button.text-button { background: transparent; color: var(--ink); padding: 12px 0; text-decoration: underline; text-underline-offset: 4px; }
button.icon-button { display: grid; place-items: center; flex-shrink: 0; min-width: 44px; padding: 10px; background: transparent; color: var(--muted); }
button.icon-button:hover { background: var(--hover); color: var(--ink); }
.icon { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
a { color: var(--ink); text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
::selection { background: #ddd; color: #111; }
input, select, textarea { width: 100%; min-width: 0; min-height: 46px; padding: 11px 12px; color: var(--ink); background: var(--field); border: 1px solid #505050; border-radius: var(--radius); caret-color: #fff; }
input:hover, select:hover, textarea:hover { border-color: #808080; }
input::placeholder, textarea::placeholder { color: #969696; opacity: 1; }
textarea { resize: vertical; min-height: 88px; }
input[type=checkbox] { accent-color: var(--action); width: 22px; height: 22px; min-height: 22px; margin: 0; }
input[type=number] { appearance: textfield; -moz-appearance: textfield; }
input::-webkit-inner-spin-button { appearance: none; }
input[type=date] { font-variant-numeric: tabular-nums; }
label { display: block; color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.5; }
label input, label select, label textarea { margin-top: 8px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: 40px; font-weight: 400; letter-spacing: -.025em; line-height: 1.15; margin-bottom: 10px; }
h2 { font-size: 20px; font-weight: 500; line-height: 1.3; letter-spacing: -.02em; }
h3 { font-size: 16px; font-weight: 600; line-height: 1.4; }
p { line-height: 1.6; }
small, .muted { color: var(--muted); }
.hidden { display: none !important; }
.skip { position: fixed; top: -100px; left: 12px; z-index: 99; padding: 12px; background: var(--action); color: #111; }
.skip:focus { top: 8px; }
.header { max-width: 1120px; min-height: 88px; padding: 0 40px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.brand-lockup { min-width: 0; padding-block: 12px; }
.brand { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; color: var(--ink); font-size: 15px; text-decoration: none; font-weight: 600; }
.brand img { display: block; width: 36px; height: auto; }
.brand-status { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-left: 48px; }
.space-status, .preview-badge { color: var(--muted); font-size: 11px; line-height: 1.5; }
.preview-badge { letter-spacing: .06em; }
.avatar { min-width: 44px; flex-shrink: 0; padding: 10px; background: transparent; color: var(--ink); border-color: #626262; border-radius: var(--radius); }
.avatar:hover { background: var(--hover); }
.notice { max-width: 960px; margin: 20px auto 0; padding: 12px 16px; background: var(--panel); border: 1px solid #626262; border-radius: var(--radius); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.notice.is-error { border-color: #aaa; }
main { max-width: 1040px; margin: 0 auto; padding: 40px 40px 80px; min-height: 75vh; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-heading > div { min-width: 0; }
.page-heading p { max-width: 65ch; margin-bottom: 0; font-size: 14px; color: var(--muted); }
.page-heading:has(+ .log-layout) { max-width: 780px; margin-inline: auto; }
.session-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.session-count strong { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.navigation { display: flex; gap: 32px; max-width: 1040px; padding: 0 40px; margin: auto; }
.navigation button { border-radius: 0; background: transparent; color: var(--muted); padding: 18px 0 14px; border-bottom: 1px solid transparent; font-weight: 500; }
.navigation button:hover { color: var(--ink); }
.navigation button[aria-current=page] { color: var(--ink); border-bottom-color: var(--ink); }
.panel { padding: 24px 0; border-top: 1px solid var(--line); }
.log-layout { max-width: 780px; margin-inline: auto; }
.workout-editor { padding: 0; }
.workout-lists { padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.workout-lists .button-row { margin-top: 12px; }
.workout-lists p { margin: 12px 0 0; max-width: 65ch; color: var(--muted); font-size: 13px; }
.session-meta { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 28px 0 20px; }
.section-label, .tag { color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.5; }
.section-heading h2 { color: var(--ink); font-size: 16px; margin: 0; }
.empty-log { padding: 24px 0 28px; }
.empty-log h3 { margin-bottom: 8px; }
.empty-log p { color: var(--muted); font-size: 14px; max-width: 52ch; margin: 0; }
.exercise-card { margin-bottom: 24px; padding: 20px; background: var(--panel); border-radius: var(--radius); min-width: 0; }
.exercise-top { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.exercise-top label { flex: 1; min-width: 0; }
.exercise-top select { font-weight: 600; margin: 0; }
.exercise-options { margin-bottom: 16px; }
.exercise-options label { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 12px; align-items: center; }
.exercise-options select { margin: 0; font-size: 14px; }
.previous { margin-bottom: 20px; padding: 0 0 16px; border-bottom: 1px solid var(--line); color: #c3c3c3; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.previous strong { color: var(--ink); font-weight: 500; }
.previous .target { display: block; color: var(--muted); margin-top: 6px; }
.sets-header, .set-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr) 52px 44px; align-items: center; gap: 12px; }
.sets-header { margin-bottom: 8px; color: var(--muted); font-size: 11px; text-align: center; }
.sets-header > span:nth-child(4) { white-space: nowrap; }
.set-row { margin-bottom: 12px; }
.set-number { text-align: center; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.set-row input { margin-top: 0; padding: 11px 6px; text-align: center; font-size: 18px; font-variant-numeric: tabular-nums; }
.set-row .warmup { display: grid; place-items: center; min-height: 46px; cursor: pointer; }
.bodyweight-value { text-align: center; color: var(--muted); font-size: 14px; }
.add-set { width: 100%; margin-top: 4px; }
.add-exercise { width: 100%; background: transparent; color: var(--ink); border-color: #777; }
.add-exercise:hover { background: var(--hover); }
.custom-entry { margin-top: 12px; }
summary { cursor: pointer; min-height: 44px; padding: 12px 0; font-size: 14px; color: var(--ink); line-height: 1.5; }
.custom-entry summary { color: var(--muted); }
.custom-entry .inline-fields { display: flex; gap: 12px; margin: 8px 0 12px; }
.inline-fields input { min-width: 0; }
.inline-fields button { flex-shrink: 0; }
.custom-entry p { font-size: 13px; color: var(--muted); margin-bottom: 0; max-width: 65ch; }
.notes-label { margin: 24px 0; }
.save-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding-top: 24px; }
.save-bar p { font-size: 12px; color: var(--muted); margin: 0; }
.save-bar button { white-space: nowrap; }
.save-bar .button-row { justify-content: flex-end; }
.error { color: var(--ink); font-size: 14px; line-height: 1.6; margin: 16px 0 0; overflow-wrap: anywhere; }
.error:not(:empty) { border: 1px solid #888; border-radius: var(--radius); background: var(--panel); padding: 12px; }
.error:empty { display: none; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; }
.filters { display: flex; gap: 20px; align-items: end; flex-wrap: wrap; margin-bottom: 24px; }
.filters label { flex: 1; min-width: 160px; }
.segmented { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.segmented button { padding: 12px 16px; color: var(--muted); border-radius: 0; background: transparent; overflow-wrap: anywhere; }
.segmented button:hover { color: var(--ink); background: var(--panel); }
.segmented button.active { color: var(--ink); border-bottom-color: var(--ink); }
.privacy-note { font-size: 13px; color: var(--muted); margin-bottom: 24px; max-width: 75ch; }
.history-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; align-items: start; }
.workout { min-width: 0; }
.workout-top { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.workout-top > div { min-width: 0; }
.workout h2 { font-size: 22px; margin: 8px 0 0; overflow-wrap: anywhere; }
.workout time { color: var(--muted); font-size: 13px; }
.workout .tag { white-space: nowrap; font-size: 11px; }
.workout-exercise { margin-top: 24px; }
.workout-exercise h3 { margin-bottom: 4px; overflow-wrap: anywhere; }
.mode-tag { color: var(--muted); font-size: 12px; }
.set-pills { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
.set-pill { color: var(--ink); font-size: 13px; line-height: 1.6; font-variant-numeric: tabular-nums; }
.set-pill.warm { color: var(--muted); }
.workout-notes { color: var(--muted); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 20px 0 0; }
.workout-actions { display: flex; gap: 12px; margin-top: 24px; }
.workout-actions button { font-size: 13px; }
.empty-state { padding: 40px 0; border-top: 1px solid var(--line); grid-column: 1 / -1; }
.empty-state h2 { margin-bottom: 12px; }
.empty-state p { color: var(--muted); font-size: 14px; max-width: 65ch; margin-bottom: 24px; }
.chart-panel { margin-bottom: 24px; }
.chart-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.chart-heading h2 { font-size: 18px; margin-bottom: 8px; overflow-wrap: anywhere; }
.chart-heading p { font-size: 13px; color: var(--muted); max-width: 65ch; }
.chart-unit { color: var(--muted); font-size: 11px; white-space: nowrap; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-family: inherit; font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--line); }
.chart .series-line { fill: none; stroke: var(--action); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .series-dot { fill: var(--bg); stroke: var(--action); stroke-width: 2; cursor: pointer; }
.chart .point-hit { fill: transparent; cursor: pointer; }
.chart .point-hit:focus, .chart .point-hit:hover { fill: #ffffff18; outline: none; stroke: #fff; stroke-width: 1.5; }
.chart-tooltip { background: var(--panel); border-radius: var(--radius); padding: 12px 16px; font-size: 13px; line-height: 1.6; min-height: 44px; margin-top: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chart-tooltip:empty { visibility: hidden; }
.chart-caption { font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.progress-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin: 28px 0; border-block: 1px solid var(--line); }
.metric { padding: 20px 0; border: 0; }
.metric .section-label { margin-bottom: 10px; }
.metric strong { font-size: 28px; font-weight: 500; font-variant-numeric: tabular-nums; }
.metric p:last-child { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.comparison { margin-bottom: 28px; font-size: 14px; line-height: 1.7; max-width: 75ch; }
.target-settings { margin-top: 24px; }
.target-settings p { font-size: 13px; color: var(--muted); max-width: 65ch; }
.range-fields { display: grid; grid-template-columns: 1fr 1fr auto; gap: 16px; align-items: end; }
.session-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 13px; font-variant-numeric: tabular-nums; }
.session-table th, .session-table td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.session-table th { color: var(--muted); font-weight: 500; }
.session-table caption { text-align: left; color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 12px; }
.table-scroll { overflow-x: auto; }
.auth-layout { max-width: 420px; margin: 24px auto 0; }
.auth-panel { border: 0; padding: 0; }
.auth-emblem { display: block; width: 112px; height: auto; margin-bottom: 24px; }
.auth-panel p { color: var(--muted); font-size: 14px; }
.auth-panel label { margin-top: 24px; }
.auth-panel .field-help { margin: 8px 0 0; font-size: 12px; }
.auth-panel button[type=submit] { width: 100%; margin-top: 28px; }
.auth-footnote { border-top: 1px solid var(--line); padding-top: 24px; margin-top: 32px; font-size: 12px !important; }
.loading { padding: 24px 0; color: var(--muted); font-size: 14px; }
dialog { width: 460px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 48px); padding: 28px; color: var(--ink); background: var(--panel); border: 1px solid #626262; border-radius: 8px; }
dialog::backdrop { background: #000b; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.dialog-head h2 { margin: 0; }
dialog p { color: var(--muted); font-size: 14px; }
dialog .section-label { margin: 24px 0 12px; }
dialog .button-row a { display: inline-flex; min-height: 44px; align-items: center; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; }
.invite-output { margin-top: 16px; }
.invite-output input { font-size: 13px; margin-bottom: 12px; }
.invite-output small { display: block; margin-top: 12px; line-height: 1.6; }
.people-list { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.person-pill { font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.account-divider { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 650px) {
  input, select, textarea { font-size: 16px; }
  .workout-lists button { font-size: 16px; }
  .exercise-options select, .invite-output input { font-size: 16px; }
  .header { min-height: 76px; padding: 0 20px; }
  .brand { font-size: 14px; }
  main { padding: 28px 20px calc(104px + env(safe-area-inset-bottom)); }
  h1 { font-size: 34px; }
  .notice { margin: 16px 20px 0; font-size: 13px; }
  .page-heading { gap: 12px; margin-bottom: 28px; }
  .page-heading p { font-size: 13px; }
  .session-count { max-width: 72px; white-space: normal; font-size: 11px; text-align: right; line-height: 1.6; }
  .navigation { position: fixed; z-index: 10; inset: auto 0 0; max-width: none; gap: 0; padding: 0 12px env(safe-area-inset-bottom); background: var(--bg); border-top: 1px solid #505050; }
  .navigation button { flex: 1; min-height: 64px; padding: 14px 4px; border-bottom: 0; border-top: 2px solid transparent; font-size: 13px; }
  .navigation button[aria-current=page] { border-top-color: var(--ink); }
  .session-meta { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 12px; padding-bottom: 24px; }
  .session-meta input { padding: 11px 8px; }
  .session-meta label { font-size: 12px; }
  .section-heading { margin-top: 24px; }
  .exercise-card { padding: 16px 12px; margin-inline: -8px; }
  .exercise-top { gap: 4px; }
  .exercise-top select { padding-left: 10px; }
  .exercise-options label { grid-template-columns: 76px minmax(0, 1fr); gap: 8px; font-size: 12px; }
  .sets-header, .set-row { grid-template-columns: 20px minmax(0, 1fr) minmax(0, 1fr) 44px 44px; gap: 6px; }
  .sets-header { font-size: 11px; }
  .previous { font-size: 13px; }
  .save-bar { gap: 12px; align-items: stretch; flex-direction: column; }
  .save-bar .button-row { justify-content: flex-start; }
  .save-bar button { padding-inline: 14px; }
  .custom-entry .inline-fields { gap: 8px; flex-wrap: wrap; }
  .custom-entry .inline-fields input { flex: 1 1 160px; }
  .history-list { grid-template-columns: 1fr; }
  .filters { gap: 16px 12px; }
  .filters label { min-width: calc(50% - 6px); }
  .filters label:first-child { flex-basis: 100%; }
  .filters select { padding-inline: 8px; }
  .progress-summary { gap: 20px; margin: 24px 0; }
  .metric .section-label, .metric p:last-child { font-size: 12px; }
  .metric strong { font-size: 26px; }
  .chart-heading { gap: 12px; }
  .chart-unit { font-size: 11px; }
  .chart text { font-size: 12px; }
  .chart-tooltip { padding: 12px; }
  .range-fields { grid-template-columns: 1fr 1fr; gap: 12px; }
  .range-fields button { grid-column: 1 / -1; }
  .auth-layout { margin-top: 12px; }
  dialog { padding: 20px; }
}

@media (max-width: 360px) {
  .session-meta { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}

/* Profile records extend the approved flat monochrome application. */
.record-fields, .profile-comparison { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
.records-section { border-top:1px solid var(--line); margin-top:32px; padding-top:24px; }
.record-form { margin-top:24px; padding:20px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.record-form label { display:flex; flex-direction:column; gap:8px; margin-bottom:16px; }
.record-form fieldset { min-width:0; border:1px solid var(--line); margin:16px 0; padding:12px; }
.record-form fieldset[hidden] { display:none; }
.weekday-fields { display:flex; flex-wrap:wrap; gap:8px 16px; }
.weekday-fields label, .record-form .confirm-record { flex-direction:row; align-items:center; min-height:44px; margin:0; }
.time-field { display:flex; align-items:center; gap:12px; }
.time-field label { flex:1; min-width:0; }
.time-field input { width:100%; min-width:0; }
.substance-plan, .dose-event { padding:20px 0; border-bottom:1px solid var(--line); }
.substance-plan h4, .dose-event h3 { font-size:18px; margin:0 0 8px; }
.substance-plan p, .dose-event p, .schedule-day p { margin:8px 0; }
.schedule-day { padding:12px 0; }
.schedule-day ul { padding-left:20px; }
.schedule-day li { margin-bottom:12px; }
.schedule-day button { margin-top:8px; }
.record-notes { white-space:pre-wrap; }
.ped-plans { padding-left:16px; border-left:1px solid var(--line); }
.comparison-profile { min-width:0; padding:16px 0; }
.comparison-profile p { overflow-wrap:anywhere; }
.comparison-chart { margin:24px 0; }
.comparison-dashed { stroke-dasharray:7 5; }
#records-content, #matched-comparison, .substance-plan { overflow-wrap:anywhere; }
#records-content .button-row { flex-wrap:wrap; }
#records-content input, #records-content select, #records-content textarea { min-width:0; max-width:100%; }
@media (max-width:650px) {
  .navigation { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); }
  .navigation button { padding-left:4px; padding-right:4px; font-size:14px; }
  .record-fields, .profile-comparison { grid-template-columns:1fr; gap:8px; }
  #records-content input:not([type=checkbox]), #records-content select, #records-content textarea { font-size:16px; }
}

.record-form legend { max-width:100%; white-space:normal; line-height:1.5; }
.record-form .confirm-record input { flex-shrink:0; }
#records-content a.button { display:inline-flex; align-items:center; min-height:44px; padding:12px 18px; border:1px solid var(--line); border-radius:var(--radius); font-size:14px; }
#records-content a.button:hover { background:var(--hover); border-color:#777; }
@media (max-width:360px) {
  .time-field { flex-wrap:wrap; gap:0; margin-bottom:16px; }
  .time-field label { flex-basis:100%; }
}
