/* ============================================================
   The Iron Console — Strength Tracker design system
   Retheme by editing the :root tokens, same as the diet tracker.
   ============================================================ */
:root {
  /* surfaces — deep blue-slate, not pure black */
  --bg: #0F141B;
  --bg-grad: radial-gradient(1200px 600px at 78% -10%, #16202B 0%, #0F141B 55%);
  --surface: #161E28;
  --surface-2: #1D2733;
  --surface-3: #243040;
  --line: #26313F;
  --line-strong: #33445A;

  /* ink */
  --ink: #EAF1F8;
  --ink-dim: #9FB0C2;
  --muted: #64748B;

  /* signal: cool primary + warm PR highlight = the identity */
  --accent: #37C4EC;
  --accent-2: #1FA8D6;
  --accent-soft: rgba(55, 196, 236, .13);
  --gold: #ECB74E;
  --gold-soft: rgba(236, 183, 78, .14);
  --good: #57D08A;
  --bad: #EA6A5C;

  /* muscle groups */
  --g-chest: #F2724B;
  --g-back: #37C4EC;
  --g-legs: #A98BEA;
  --g-shoulders: #ECB74E;
  --g-arms: #57D08A;
  --g-core: #EC6394;
  --g-cardio: #3FE0C4;
  --g-other: #8EA0B2;

  --radius: 13px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0,0,0,.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.28);
  --rail: 232px;

  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--body); color: var(--ink);
  background: var(--bg-grad), var(--bg); background-attachment: fixed;
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: .2px; line-height: 1.05; margin: 0; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--accent-soft); }

/* numerals: tabular so columns line up */
.num, .data-table td, .stat-value, .load { font-variant-numeric: tabular-nums; }

/* ---------- layout: nav rail + main ---------- */
.app { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; padding: 22px 14px;
  background: linear-gradient(180deg, #131B24, #0E141B);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 20px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #05222C;
  font-family: var(--display); font-weight: 700; font-size: 21px; box-shadow: 0 4px 14px rgba(55,196,236,.35);
}
.brand-name { font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: .4px; }
.brand-name small { display: block; font-family: var(--body); font-weight: 500; font-size: 10.5px; letter-spacing: 1.6px; color: var(--muted); text-transform: uppercase; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--ink-dim); cursor: pointer; font-weight: 500; font-size: 14.5px; border: 1px solid transparent;
  transition: background .14s, color .14s;
}
.nav-link .ic { width: 20px; text-align: center; font-size: 16px; opacity: .9; }
.nav-link:hover { background: var(--surface); color: var(--ink); }
.nav-link.active { background: var(--accent-soft); color: var(--ink); border-color: rgba(55,196,236,.25); }
.nav-link.active .ic { color: var(--accent); opacity: 1; }
.rail-foot { margin-top: auto; font-size: 11px; color: var(--muted); padding: 12px 12px 0; border-top: 1px solid var(--line); }
.rail-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 6px; }
.rail-foot .dot.mock { background: var(--gold); }

.main { padding: 30px 40px 80px; max-width: 1180px; width: 100%; }
.page { display: none; animation: fade .28s ease; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 11px; letter-spacing: 2.4px; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: 6px; }
.page-head h1 { font-size: 40px; }
.page-head p { color: var(--ink-dim); margin: 6px 0 0; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.card-head h2, .card-head h3 { font-size: 21px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- stat tiles ---------- */
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c, var(--accent)); }
.stat .stat-label { font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat .stat-value { font-family: var(--display); font-weight: 700; font-size: 38px; line-height: 1; margin-top: 8px; }
.stat .stat-value small { font-family: var(--body); font-size: 14px; font-weight: 600; color: var(--ink-dim); margin-left: 4px; }
.stat .stat-sub { font-size: 12.5px; color: var(--ink-dim); margin-top: 6px; }
.stat .trend.up { color: var(--good); } .stat .trend.down { color: var(--bad); }

/* ---------- hero (Today) ---------- */
.hero {
  background: linear-gradient(135deg, #182430, #12191F);
  border: 1px solid var(--line-strong); border-radius: 18px; padding: 26px 28px; position: relative; overflow: hidden;
}
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%); pointer-events: none; }
.hero .eyebrow { color: var(--accent); font-size: 11px; letter-spacing: 2.4px; text-transform: uppercase; font-weight: 600; }
.hero h2 { font-size: 34px; margin: 6px 0 4px; }
.hero .sub { color: var(--ink-dim); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer; transition: transform .08s, background .14s, border-color .14s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #06222C; }
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn-gold { background: linear-gradient(135deg, var(--gold), #d59e34); border-color: transparent; color: #2A1E05; }
.btn-ghost { background: transparent; }
.btn-lg { padding: 14px 26px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-danger { color: var(--bad); border-color: rgba(234,106,92,.4); }
.btn-danger:hover { background: rgba(234,106,92,.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { background: transparent; border: none; color: var(--ink-dim); cursor: pointer; padding: 6px; border-radius: 8px; font-size: 15px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--c, var(--accent));
  background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 34%, transparent);
}
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--ink-dim); }
.badge.gold { background: var(--gold-soft); color: var(--gold); }
.badge.good { background: rgba(87,208,138,.15); color: var(--good); }
.badge.pr { background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(236,183,78,.4); }

/* ---------- generated session plates ---------- */
.plate {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 0 16px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 10px; position: relative; transition: border-color .14s, transform .1s;
}
.plate:hover { border-color: var(--line-strong); }
.plate .rail-c { position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 4px; background: var(--c); }
.plate .p-name { font-weight: 600; font-size: 15.5px; }
.plate .p-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.plate .p-load { text-align: right; }
.plate .p-load .load { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; }
.plate .p-load .load small { font-family: var(--body); font-size: 13px; font-weight: 600; color: var(--ink-dim); }
.plate .p-load .p-sets { font-size: 12px; color: var(--muted); margin-top: 2px; }
.plate .p-why { grid-column: 2 / 4; font-size: 12.5px; color: var(--accent); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.plate.pr-plate { border-color: rgba(236,183,78,.4); }

/* ---------- data table ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover, .data-table tr.click:hover { background: var(--surface-2); cursor: pointer; }
.data-table .r { text-align: right; }

/* ---------- set logger rows ---------- */
.set-row { display: grid; grid-template-columns: 34px 1fr 1fr 44px 40px; gap: 8px; align-items: center; padding: 6px 0; }
.set-row .setn { font-family: var(--display); font-weight: 700; color: var(--muted); text-align: center; font-size: 16px; }
.set-row input { width: 100%; }
.set-row.done { opacity: .62; }
.set-row .check { width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid var(--line-strong); background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.set-row .check.on { background: var(--good); border-color: var(--good); color: #06251A; }

/* ---------- inputs ---------- */
input, select, textarea {
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ink);
  border-radius: 9px; padding: 9px 11px; font-size: 14px; font-family: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.mini, .set-row input { padding: 7px 9px; text-align: center; font-variant-numeric: tabular-nums; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-dim); margin: 0 0 6px; letter-spacing: .3px; }
.field { margin-bottom: 15px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- progress bar ---------- */
.progress-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--c, var(--accent)); transition: width .5s ease; }

/* ---------- video embed ---------- */
.video { position: relative; aspect-ratio: 16/9; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- alerts / empty / spinner ---------- */
.alert { padding: 12px 14px; border-radius: 10px; font-size: 13.5px; }
.alert-error { background: rgba(234,106,92,.12); color: #f3a99f; border: 1px solid rgba(234,106,92,.3); }
.alert-info { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(55,196,236,.3); }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-mark { font-size: 34px; opacity: .5; margin-bottom: 8px; }
.empty h3 { font-size: 20px; color: var(--ink-dim); margin-bottom: 6px; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 12px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(6,10,14,.72); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal.open { display: flex; animation: fade .18s; }
.modal-box { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; box-shadow: var(--shadow); }
.modal-box.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.modal-head h3 { font-size: 22px; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: var(--surface); }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--surface-3); color: var(--ink); border: 1px solid var(--line-strong); padding: 12px 20px; border-radius: 11px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow); z-index: 90; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { border-color: rgba(234,106,92,.5); }
.toast-info { border-color: rgba(55,196,236,.5); }

/* ---------- misc utilities ---------- */
.flex { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.text-muted { color: var(--muted); }
.text-dim { color: var(--ink-dim); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.right { text-align: right; } .center { text-align: center; }
.small { font-size: 12.5px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: none; background: transparent; color: var(--ink-dim); padding: 6px 13px; border-radius: 7px; font-weight: 600; font-size: 13px; cursor: pointer; }
.seg button.active { background: var(--accent-soft); color: var(--accent); }
canvas { max-width: 100%; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  :root { --rail: 0px; }
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; bottom: 0; top: auto; height: auto; width: 100%; flex-direction: row; z-index: 50;
    padding: 8px; gap: 2px; border-right: none; border-top: 1px solid var(--line); overflow-x: auto; }
  .brand, .rail-foot { display: none; }
  .nav-link { flex-direction: column; gap: 3px; font-size: 10px; padding: 7px 10px; flex: 1; white-space: nowrap; }
  .nav-link .ic { font-size: 18px; }
  .main { padding: 20px 16px 90px; }
  .page-head h1 { font-size: 30px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .row-2 { grid-template-columns: 1fr; }
  .set-row { grid-template-columns: 28px 1fr 1fr 40px 36px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
