/* Shared styles for the logging pages. Tokens match the dashboard. */
:root {
  --bg: #f6f7f8; --panel: #ffffff; --line: #e1e4e8; --line-soft: #eceef1;
  --fg: #16191d; --fg-2: #4d5560; --fg-3: #7b838e;
  --s1: #2a78d6; --s2: #eb6834; --good: #1c7c3c; --warn: #b3470f; --bad: #c62f2f;
  --chip: #eef3fa; --input: #ffffff;
  --display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #121417; --panel: #1a1d21; --line: #2c3137; --line-soft: #23272c;
  --fg: #f2f4f6; --fg-2: #b9c0c8; --fg-3: #8a929c;
  --s1: #3987e5; --s2: #d95926; --good: #4cbb6f; --warn: #f08a4b; --bad: #ef6b6b; --chip: #1f2a38; --input: #15181b;
  color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #121417; --panel: #1a1d21; --line: #2c3137; --line-soft: #23272c;
  --fg: #f2f4f6; --fg-2: #b9c0c8; --fg-3: #8a929c;
  --s1: #3987e5; --s2: #d95926; --good: #4cbb6f; --warn: #f08a4b; --bad: #ef6b6b; --chip: #1f2a38; --input: #15181b;
  color-scheme: dark }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; line-height: 1.5; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 20px 16px 72px; display: grid; gap: 22px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: .01em; margin: 0; text-wrap: balance; }
h1 { font-size: 2.2rem; line-height: 1; text-transform: uppercase; }
h2 { font-size: 1.35rem; text-transform: uppercase; }
h3 { font-size: 1.05rem; text-transform: uppercase; }
.eyebrow { font-family: var(--display); font-size: .8rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-3); }
.note { color: var(--fg-3); font-size: .86rem; margin: 0; }
.num { font-variant-numeric: tabular-nums; }
a { color: var(--s1); }

/* top navigation */
.topnav { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topnav .in { max-width: 1120px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; min-height: 50px; }
.topnav .brand { font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: .04em; text-transform: uppercase; color: var(--fg); text-decoration: none; margin-right: auto; }
.topnav nav { display: flex; gap: 2px; flex-wrap: wrap; }
.topnav nav a { color: var(--fg-2); text-decoration: none; font-weight: 600; padding: 12px 10px; border-bottom: 2px solid transparent; }
.topnav nav a:hover { color: var(--fg); }
.topnav nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--s1); }
.topnav .subnav { border-top: 1px solid var(--line-soft); }
.topnav .subnav nav { max-width: 1120px; margin: 0 auto; padding: 0 16px; display: flex; gap: 2px; }
.topnav .subnav nav a { padding: 8px 10px; font-size: .9rem; }

.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 12px; align-content: start; min-width: 0; }

/* controls */
.btn { font: inherit; font-weight: 600; font-size: .92rem; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--chip); }
.btn.primary { background: var(--s1); border-color: var(--s1); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.small { font-size: .82rem; padding: 4px 10px; }
.btn.icon { padding: 4px 8px; font-size: .9rem; color: var(--fg-3); border-color: transparent; background: transparent; }
.btn.icon:hover { color: var(--fg); background: var(--chip); }
.btn:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--fg); background: var(--input); border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; min-width: 0; }
@media (min-width: 700px) { input, select, textarea { font-size: .95rem; } }
textarea { resize: vertical; min-height: 64px; width: 100%; }
label.field { display: grid; gap: 3px; font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3); font-family: var(--display); }
label.field > input, label.field > select, label.field > textarea { text-transform: none; letter-spacing: 0; font-family: var(--body); font-weight: 400; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px 12px; }
.fields .wide { grid-column: span 2; }
@media (max-width: 420px) { .fields .wide { grid-column: 1 / -1; } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions .spacer { flex: 1; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-2); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--s1); }
.pill.cardio::before { background: var(--s2); }
.tag { font-size: .72rem; background: var(--chip); color: var(--fg-2); border-radius: 4px; padding: 1px 7px; white-space: nowrap; }

/* lists */
.list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.list .item { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 2px 14px; align-items: center; padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft); cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; font: inherit; color: inherit; }
.list .item:last-child { border-bottom: 0; }
.list .item:hover { background: var(--chip); }
.list .item[aria-current="true"] { background: var(--chip); box-shadow: inset 3px 0 0 var(--s1); }
.list .date { font-family: var(--display); font-weight: 600; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.list .name { font-weight: 600; min-width: 0; }
.list .meta { color: var(--fg-2); font-size: .86rem; display: flex; gap: 12px; flex-wrap: wrap; justify-content: end; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .list .item { grid-template-columns: 1fr; } .list .meta { justify-content: start; } }

table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { font-family: var(--display); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: .78rem; color: var(--fg-3); white-space: nowrap; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 8px;
  font-weight: 600; z-index: 50; box-shadow: 0 6px 20px rgb(0 0 0 / .2); max-width: calc(100vw - 32px); }
.toast.error { background: var(--bad); color: #fff; }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; background: var(--panel); color: var(--fg); width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog .dhead { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
dialog .dhead h2 { flex: 1; }
dialog .dbody { padding: 14px 16px 18px; display: grid; gap: 12px; }
.empty { color: var(--fg-3); font-size: .9rem; padding: 10px 0; }
.error-text { color: var(--bad); font-size: .88rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- what a workout / exercise works (shared by Workouts, Calendar, Exercises) ---------- */
.targets { display: grid; gap: 10px; }
.tg-focus { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.tg-focus b { font-family: var(--display); font-size: 1.05rem; text-transform: uppercase; letter-spacing: .02em; }
.tg-focus .note { font-size: .82rem; }
.tg-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 24px; }
.tg-h { font-family: var(--display); font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); margin: 0 0 4px; }
.bars { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.bars li { display: grid; grid-template-columns: minmax(90px, 11em) minmax(0, 1fr) 3.2em; gap: 8px; align-items: center; font-size: .86rem; }
.bars .lab { color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .track { height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.bars .track { display: block; }
.bars .fill { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; min-width: 2px; }
.bars .val { color: var(--fg-2); text-align: right; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.chip { font-size: .8rem; background: var(--chip); color: var(--fg-2); border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.chip.eq { background: transparent; border: 1px solid var(--line); }
.lvl { font-size: .78rem; font-weight: 600; border-radius: 5px; padding: 0 6px; border: 1px solid var(--line); color: var(--fg-2); white-space: nowrap; }
.lvl.high { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.ex-targets { font-size: .82rem; color: var(--fg-3); display: flex; flex-wrap: wrap; gap: 2px 10px; }
.ex-targets a { color: var(--fg-3); }
.ex-targets b { color: var(--fg-2); font-weight: 600; }
