/* fitapp — dark theme, palette locked to the phone PDF (BUILD-PLAN). */

:root {
  --bg: #0d0e0f;
  --card: #22292d;
  --band: #283840;
  --accent: #c97052;
  --accent-dim: #9c5840;
  --text: #e1e2e3;
  --muted: #8a939b;
  --ok: #7ba86f;
  --warn: #d9a441;
  --err: #c9584f;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 14px 40px;
}

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

/* ---- nav ---- */
.topnav {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 2px solid var(--band);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topnav .brand { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.topnav .brand span { color: var(--accent); }
.topnav .links { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.topnav .links a {
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 8px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.topnav .links a:hover, .topnav .links a.active { color: var(--text); background: var(--band); }

/* ---- cards ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--band);
  padding: 14px 16px;
  margin: 12px 0;
}
.card h2 { margin: 0 0 8px; font-size: 1.05rem; }
.card h2 .ord { color: var(--muted); font-weight: 400; margin-right: 6px; }

.muted { color: var(--muted); }
.accent { color: var(--accent); }
.error { color: var(--err); }
code { background: var(--band); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }

/* ---- chips ---- */
.chip {
  display: inline-block;
  background: var(--band);
  color: var(--text);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.85rem;
  margin: 2px 4px 2px 0;
  white-space: nowrap;
}
.chip.load { color: var(--accent); font-weight: 600; }
.chip.warn { color: var(--warn); }
.chip.ok { color: var(--ok); }

/* ---- banner ---- */
.banner {
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 12px 0;
  background: var(--band);
  border-left: 4px solid var(--accent);
}
.banner.warn { border-left-color: var(--warn); }
.banner.err { border-left-color: var(--err); }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--band); }
th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--card); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- forms & buttons ---- */
input, select, button, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--band);
  border-radius: 8px;
  padding: 10px 12px;
}
input:focus, select:focus { outline: 2px solid var(--accent-dim); }
input[type="number"] { font-variant-numeric: tabular-nums; }
button {
  background: var(--accent);
  color: #14100e;
  font-weight: 700;
  border: none;
  min-height: 44px;
  padding: 10px 18px;
  cursor: pointer;
}
button:active { transform: translateY(1px); }
button.secondary { background: var(--band); color: var(--text); }
button:disabled { opacity: 0.5; cursor: default; }

form.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---- login ---- */
.login-body { display: grid; place-items: center; min-height: 100dvh; }
.login-card {
  background: var(--card);
  border: 1px solid var(--band);
  border-radius: var(--radius);
  padding: 28px;
  width: min(92vw, 360px);
  text-align: center;
}
.login-card h1 { margin: 0 0 2px; font-size: 1.8rem; }
.login-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.login-card input { width: 100%; text-align: center; }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 18px 0 26px;
}

/* ---- charts & gifs ---- */
svg.chart { width: 100%; height: auto; display: block; }
.chart-card { padding: 10px 8px 6px; }
img.gif { max-width: 100%; border-radius: 8px; margin-top: 8px; }
ul.tight { margin: 6px 0 0; padding-left: 18px; }
ul.tight li { margin: 2px 0; font-size: 0.9rem; }
.small { font-size: 0.85rem; }
pre.report { white-space: pre-wrap; font-size: 0.88rem; background: var(--bg); border-radius: 8px; padding: 10px; overflow-x: auto; }

/* ---- session player ---- */
.clockbar {
  position: sticky; top: 56px; z-index: 9;
  display: flex; align-items: center; gap: 12px;
  background: var(--band); border-radius: var(--radius);
  padding: 8px 14px; margin: 10px 0;
  font-variant-numeric: tabular-nums;
}
.clockbar #session-clock { font-size: 1.25rem; font-weight: 700; }
.clockbar.warn { border-left: 4px solid var(--warn); }
.clockbar.over { border-left: 4px solid var(--err); background: #3a2523; }
.clockbar input[type="date"] { margin-left: auto; min-height: 36px; padding: 6px 8px; }

.setrow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  padding: 6px 0; border-bottom: 1px solid var(--band);
}
.setrow:last-child { border-bottom: none; }
.setno {
  color: var(--muted); min-width: 18px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.setrow input, .setrow select { min-height: 40px; padding: 6px 8px; }
.setrow input[type="number"] { width: 74px; }
.setrow input.w-kg { width: 66px; }
.setrow select.w-side { width: auto; }
.setrow input.w-rir { width: 58px; }
.setrow input.w-rir.dim { opacity: 0.6; }
.setrow input.w-wr { width: 50px; }
.setrow input.w-tempo { width: 76px; }
.setrow input.w-clean { width: 64px; }
.setrow input.w-notes { flex: 1 1 120px; min-width: 100px; }

.rest-btn { min-height: 36px; padding: 4px 12px; font-size: 0.85rem; }

.restbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  background: var(--accent); color: #14100e; font-weight: 700;
  font-size: 1.2rem; padding: 14px;
  font-variant-numeric: tabular-nums;
  z-index: 20;
}
.restbar button { background: #14100e; color: var(--text); min-height: 34px; }

.savebar {
  display: flex; gap: 10px; margin: 16px 0 80px;
}
.savebar .primary { flex: 1; font-size: 1.1rem; min-height: 52px; }
.btn-like {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #14100e; font-weight: 700;
  border-radius: 8px; padding: 10px 18px; min-height: 44px; flex: 1;
}
.btn-like.secondary-like { background: var(--band); color: var(--text); }

.player-daylinks { margin-top: 6px; }
.player-daylinks .chip { background: var(--card); }
.start-btn { display: inline-flex; margin-top: 8px; text-decoration: none; }
.min-link { display: inline-block; margin-top: 8px; }

/* ---- metrics form & day C ---- */
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.mgrid label, form.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
form.stack > label { margin-top: 4px; }
.setrow .w-min { width: 70px; } .setrow .w-sec { width: 62px; }
.setrow .w-hr { width: 76px; }

/* ---- music player ---- */
.player-controls { position: sticky; top: 56px; z-index: 9; }
#now { margin: 0 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctlrow { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0; }
.ctlrow .primary { font-size: 1.3rem; min-width: 64px; min-height: 52px; }
.ctlrow .secondary { min-width: 52px; min-height: 48px; font-size: 1.05rem; }
#shuffle.on { background: var(--accent); color: #14100e; }
.seekrow input[type="range"] { flex: 1; }
.seekrow span { font-variant-numeric: tabular-nums; font-size: 0.85rem; white-space: nowrap; }
.pickrow { flex-wrap: wrap; }
ol.playlist { margin: 0; padding: 0; list-style: none; }
ol.playlist li {
  padding: 10px 8px; border-bottom: 1px solid var(--band);
  cursor: pointer; min-height: 40px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
ol.playlist li.playing { color: var(--accent); font-weight: 600; }
audio { display: none; }
