/* Alpha Protocol — gold on black. One stylesheet, mobile-first breakpoints at 1100 and 820px. */
:root {
  --bg: #0B0A08; --side: #0E0D0A; --card: #15130F; --card2: #1A1712; --sunk: #0B0A08;
  --line: #2B2720; --line2: #221F19; --ink: #F2EDE3; --muted: #A39B8B;
  --gold: #D4AF37; --gold-hi: #F0CF5E; --gold-dim: #5C4C1C; --gold-bg: #16130A;
  --champ: #EFE3C2; --steel: #7E9CC0; --bronze: #B4783A; --stone: #8A8274;
  --warn: #E8684A; --warn-bg: #1F1410; --warn-line: #4A2A20; --warn-ink: #F0A28E;
  --r: 18px; --font: 'Archivo', system-ui, -apple-system, sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.4; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hi); }
code { font-family: var(--mono); font-size: .9em; background: var(--card2); padding: 1px 6px; border-radius: 6px; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 800; font-stretch: 115%; }
h3 { font-size: 15px; font-weight: 700; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.gold { color: var(--gold); }
.warn { color: var(--warn); }
.mt { margin-top: 14px; }
.mt-s { margin-top: 6px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hide { display: none !important; }

/* ---------- shell */
.shell { display: flex; min-height: 100vh; }
.side { flex: none; width: 248px; display: flex; flex-direction: column; gap: 4px; padding: 28px 16px 24px; border-right: 1px solid var(--line); background: var(--side); }
.logo { padding: 0 8px 26px; }
.logo-in { display: inline-flex; align-items: center; gap: 10px; }
.logo-t { display: flex; flex-direction: column; line-height: 1; }
.logo-t b { font-size: 17px; font-weight: 900; font-stretch: 125%; letter-spacing: .04em; color: var(--ink); }
.logo-t small { font-size: 9px; font-weight: 700; letter-spacing: .32em; color: var(--gold); margin-top: 3px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.side-link:hover { color: var(--ink); background: var(--card); }
.side-link.on { color: var(--gold); background: #1D1A15; }
.side-sep { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 16px 12px 4px; }
.side-log { margin-top: 16px; }
.main { flex: 1; min-width: 0; padding: 32px 40px 56px; }
.wrap { max-width: 1160px; margin: 0 auto; }
.logo-m { display: none; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.bottom { display: none; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; color: var(--muted); background: var(--card); border: 1px solid var(--line); }

/* ---------- page + grid */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin-top: 6px; font-size: 40px; font-weight: 900; font-stretch: 125%; letter-spacing: -.02em; }
.page-head-r { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.s-3 { grid-column: span 3; } .s-4 { grid-column: span 4; } .s-5 { grid-column: span 5; } .s-6 { grid-column: span 6; }
.s-7 { grid-column: span 7; } .s-8 { grid-column: span 8; } .s-12 { grid-column: span 12; }
.slot-cell { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.slot-cell > .card { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; }
.card-gold { background: var(--gold-bg); border-color: var(--gold-dim); }
.card-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.card-sunk { background: var(--sunk); border: 1px solid var(--line2); border-radius: 14px; padding: 14px; }
.label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.label-gold { color: var(--gold); }
.stat { font-size: 34px; font-weight: 700; letter-spacing: -.03em; margin-top: 6px; }
.stat-xl { font-family: var(--mono); font-size: 56px; font-weight: 700; letter-spacing: -.04em; color: var(--gold); line-height: 1; }
.sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.empty { color: var(--muted); font-size: 14px; padding: 14px 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; background: var(--gold-bg); border: 1px solid var(--gold-dim); font-size: 14px; }
.flash-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.progress { height: 6px; background: var(--line); border-radius: 3px; margin-top: 12px; overflow: hidden; }
.progress > span { display: block; height: 6px; background: var(--gold); border-radius: 3px; transition: width .2s; }
.kv { display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line2); font-size: 14px; }
.kv > div > span:first-child { color: var(--muted); }
.kv > div > span:last-child { font-family: var(--mono); font-weight: 700; text-align: right; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.stats > div { background: var(--sunk); border-radius: 12px; padding: 12px; }
.stats small { display: block; font-size: 11px; color: var(--muted); }
.stats b { display: block; font-family: var(--mono); font-size: 17px; margin-top: 4px; }

/* ---------- buttons, chips, forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--gold-dim); background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn:hover { border-color: var(--gold); color: var(--ink); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #0B0A08; font-weight: 800; }
.btn-gold:hover { background: var(--gold-hi); color: #0B0A08; }
.btn-ghost { border-color: var(--line); color: var(--muted); }
.btn-warn { border-color: var(--warn-line); color: var(--warn-ink); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 600; background: transparent; cursor: pointer; }
.chip.on, .chip:has(input:checked) { background: var(--gold); border-color: var(--gold); color: #0B0A08; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip-gold { border-color: var(--gold-dim); color: var(--gold); }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); flex-wrap: wrap; }
.seg a, .seg label { min-height: 36px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.seg a.on, .seg label:has(input:checked) { background: var(--gold); color: #0B0A08; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
input, select, textarea { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--sunk); color: var(--ink); font: inherit; font-size: 15px; color-scheme: dark; }
textarea { padding: 12px 14px; min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; accent-color: var(--gold); }
.check-label { flex-direction: row; align-items: center; gap: 12px; font-size: 14px; color: var(--ink); min-height: 44px; cursor: pointer; }
.scale { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 4px; }
.scale label { min-height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: #221F19; color: var(--muted); font-family: var(--mono); font-weight: 700; cursor: pointer; }
.scale label:has(input:checked) { background: var(--gold); color: #0B0A08; }
.scale input { position: absolute; opacity: 0; pointer-events: none; }

/* ---------- lists, tables */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0; border-bottom: 1px solid var(--line2); color: var(--ink); }
a.list-row:hover { color: var(--gold); }
.list-row small { color: var(--muted); }
.tbl-wrap { overflow-x: auto; margin-top: 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 10px 12px 0; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--mono); }
.tbl tr:hover td { background: #17150F; }
.tag { flex: none; font-family: var(--mono); font-size: 10px; padding: 3px 7px; border-radius: 5px; background: #221F19; color: var(--muted); }
.tag-pin { color: var(--gold); } .tag-supp { color: var(--champ); } .tag-vital { color: var(--warn); } .tag-log { color: var(--gold); } .tag-habit { color: var(--muted); }

/* ---------- checklist */
.checklist { display: flex; flex-direction: column; margin-top: 4px; }
.check-form { margin: 0; }
.check-item { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 0; background: transparent; border: 0; border-bottom: 1px solid var(--line2); color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.check-item .box { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 2px solid #4A443A; display: flex; align-items: center; justify-content: center; color: transparent; }
.check-item.done .box { background: var(--gold); border-color: var(--gold); color: #0B0A08; }
.check-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.check-text b { font-size: 14px; font-weight: 600; }
.check-text small { font-size: 12px; color: var(--muted); margin-top: 2px; }
.check-item.done .check-text b { color: var(--muted); text-decoration: line-through; }

/* ---------- tiles (quick log) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.tile { min-height: 80px; padding: 10px 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--card2); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 600; text-align: center; }
.tile:hover { border-color: var(--gold-dim); color: var(--ink); }
.tile-code { font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 5px; background: var(--sunk); }

/* ---------- modules */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.mod { flex-direction: row; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--sunk); cursor: pointer; color: var(--ink); }
.mod.on, .mod:has(input:checked) { border-color: var(--gold-dim); background: var(--gold-bg); }
.mod-body { display: flex; flex-direction: column; gap: 4px; }
.mod-body b { font-size: 14px; }
.mod-body small { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ---------- charts */
svg.chart { display: block; width: 100%; }
.xlabels { position: relative; height: 16px; margin-top: 6px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.xlabels span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.xlabels span:first-child { transform: none; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 92px minmax(0, 1fr) 104px; gap: 12px; align-items: center; font-size: 13px; }
.hbar-l { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.hbar-l i { width: 8px; height: 8px; border-radius: 2px; }
.hbar-t { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.hbar-t span { display: block; height: 8px; border-radius: 4px; }
.hbar-v { font-size: 12px; text-align: right; color: var(--muted); }
.stack-cols { display: flex; gap: 6px; min-width: 480px; }
.stack-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.stack-bar { display: flex; flex-direction: column-reverse; gap: 1px; border-radius: 4px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.stack-bar span { display: block; }
.stack-lbl { font-size: 10px; color: var(--muted); text-align: center; }
.stack-tot { font-size: 11px; font-weight: 700; text-align: center; }
.range { position: relative; display: block; height: 8px; border-radius: 4px; background: var(--line2); min-width: 120px; }
.range-band { position: absolute; top: 0; bottom: 0; left: 20%; width: 60%; border-radius: 4px; background: #3A342A; }
.range-dot { position: absolute; top: -3px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; border: 3px solid var(--card); }

/* ---------- week strip */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px 8px; border-radius: 12px; background: var(--card2); border: 1px solid var(--card2); }
.day.today { background: var(--gold-bg); border-color: var(--gold-dim); }
.day-h { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.day.today .day-h { color: var(--gold); }
.sess { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 8px; background: var(--sunk); border: 1px solid var(--line2); color: var(--ink); }
.sess.plan { border-style: dashed; border-color: var(--gold); }
.sess.missed { opacity: .5; text-decoration: line-through; }
.sess b { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.sess b i { width: 7px; height: 7px; border-radius: 2px; }
.sess small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- login */
.login { max-width: 420px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 20px; }
.login-logo { display: flex; justify-content: center; }

/* ---------- responsive */
@media (max-width: 1100px) {
  .s-4, .s-5, .s-7, .s-8 { grid-column: span 12; }
  .s-3 { grid-column: span 6; }
}
@media (max-width: 820px) {
  .side { display: none; }
  .main { padding: 18px 16px 116px; }
  .logo-m { display: flex; }
  .s-6 { grid-column: span 12; }
  .page-head h1 { font-size: 32px; }
  .week { grid-template-columns: minmax(0, 1fr); }
  .stat-xl { font-size: 48px; }
  .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(84px + env(safe-area-inset-bottom)); padding: 10px 4px env(safe-area-inset-bottom); background: var(--side); border-top: 1px solid var(--line); justify-content: space-around; align-items: flex-start; }
  .bottom-link { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 60px; min-height: 44px; color: var(--muted); font-size: 10px; font-weight: 600; }
  .bottom-link.on { color: var(--gold); }
  .bottom-log { width: 54px; height: 54px; margin-top: -6px; border-radius: 18px; background: var(--gold); color: #0B0A08; display: flex; align-items: center; justify-content: center; }
  .hbar { grid-template-columns: 76px minmax(0, 1fr) 92px; }
}

/* ---------- coach */
.reasons { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.reasons li { display: flex; gap: 10px; }
.reasons i { flex: none; width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; background: var(--gold); }
.reasons i.warn { background: var(--warn); }
.reasons i.info { background: var(--steel); }
details summary::-webkit-details-marker { color: var(--gold); }
.coach-h { font-size: clamp(20px, 2.2vw + 10px, 28px); line-height: 1.15; margin-top: 12px; font-stretch: 112%; }
