/* EnFuse Fitness audit site: shared styles for the console (/) and the brief (/brief).
   Palette and type follow enfusefitness.com: plum #5b1a4e, mauve #b998b2, ink #272727,
   coral #f0523d, Futura (Jost stands in as the web font). */

:root {
  color-scheme: light;
  --plum: #5B1A4E;
  --plum-deep: #3A0F32;
  --plum-soft: #F3EAF1;
  --mauve: #B998B2;
  --mauve-ink: #7E5876;
  --ground: #F7F4F6;
  --surface: #FFFFFF;
  --surface-2: #FBF9FA;
  --ink: #272727;
  --muted: #6A636C;
  --rule: #E7E0E5;
  --rule-strong: #D6CBD3;
  --high: #C8412C;
  --high-soft: #FCEBE7;
  --med: #9A6A0C;
  --med-soft: #FBF2DE;
  --good: #357350;
  --good-soft: #E5F2EA;
  --idle: #7A7380;
  --idle-soft: #EFEBEE;
  --font: "Jost", "Futura", "Century Gothic", "Avenir Next", -apple-system, "Segoe UI", sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--plum); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [contenteditable]:focus-visible {
  outline: 2px solid var(--coral, #F0523D); outline-offset: 2px;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; text-wrap: balance; letter-spacing: -.005em; }
p { margin: 0; }

/* ---- Top ribbon + header band ---- */
.ribbon {
  display: block; text-align: center; background: var(--plum); color: #fff;
  font-size: 14px; font-weight: 500; padding: 9px 16px; text-decoration: underline; text-underline-offset: 3px;
  padding-top: calc(9px + env(safe-area-inset-top, 0px));
}
.ribbon:hover { background: #6A2360; }

.band {
  background: linear-gradient(160deg, var(--plum-deep) 0%, var(--plum) 70%, #6B2A5E 100%);
  color: #fff;
}
.band .in { max-width: 1120px; margin: 0 auto; padding-inline: 24px; padding-block: 36px 30px; display: grid; gap: 12px; }
.band.narrow .in { max-width: 860px; padding-block: 44px 36px; }
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: #E4D2E0;
}
.kicker::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--mauve); }
.band h1 { font-size: clamp(30px, 4.6vw, 44px); line-height: 1.08; font-weight: 600; }
.band .lede { color: #EADDE7; max-width: 64ch; font-size: 16px; }
.band .byline { font-size: 13px; color: #CDB5C7; }
.band .row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; }

.btn {
  appearance: none; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink);
  font: 500 14px/1 var(--font); padding: 10px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--mauve); }
.band .btn { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.28); }
.band .btn:hover { background: rgba(255,255,255,.16); }
.btn.primary { background: var(--plum); color: #fff; border-color: var(--plum); }
.btn.ghost { border-style: dashed; color: var(--muted); background: transparent; }
.btn.ghost:hover { color: var(--plum); border-color: var(--plum); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- Tabs nav (console) ---- */
.tabs {
  position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.94);
  backdrop-filter: saturate(150%) blur(8px); -webkit-backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.tabs .in { max-width: 1120px; margin: 0 auto; padding-inline: 12px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs .in::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 14px 12px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--plum); }
.tabs a.on { color: var(--plum); border-bottom-color: var(--plum); }

/* ---- Console layout ---- */
.console { max-width: 1120px; margin: 0 auto; padding-inline: 24px; padding-block: 8px 56px; }
.block { padding-top: 40px; display: grid; gap: 16px; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.block-head h2 { font-size: 24px; line-height: 1.2; color: var(--plum-deep); }
.block-head p { color: var(--muted); max-width: 72ch; font-size: 15px; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.panel.pad { padding: 18px; }
.hint { font-size: 13px; color: var(--muted); }
.honest {
  font-size: 14px; color: var(--ink); background: var(--plum-soft); border-left: 3px solid var(--mauve);
  border-radius: 0 10px 10px 0; padding: 12px 14px;
}
.honest b { color: var(--plum); }

/* Snapshot cards */
.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1060px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; display: grid; gap: 4px; align-content: start; border-top: 3px solid var(--tone, var(--rule)); }
.card .lbl { font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.card .num { font-size: 32px; line-height: 1.05; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.card .num small { font-size: 16px; color: var(--muted); font-weight: 400; }
.card .sub { font-size: 13px; color: var(--muted); line-height: 1.4; }
.tone-high { --tone: var(--high); }
.tone-med { --tone: var(--med); }
.tone-good { --tone: var(--good); }
.tone-plum { --tone: var(--plum); }

/* Tables */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
.console table { min-width: 720px; }
#fixes table { min-width: 1000px; }
#fixes th.w-phase { width: 72px; } #fixes th.w-who { width: 118px; } #fixes th.w-status { width: 138px; } #fixes th.w-effort { width: 104px; } #fixes th.w-pri { width: 96px; }
#goals th.w-better { width: 110px; } #goals th.w-dead { width: 160px; } #goals th.w-st { width: 120px; }
textarea.cell { display: block; overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-top: 1px solid var(--rule); vertical-align: middle; }
thead th { border-top: 0; font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.group td { background: var(--plum-soft); color: var(--plum); font-weight: 600; font-size: 13px; letter-spacing: .02em; }
.tbl-foot { padding: 12px; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Editable cells */
.cell {
  width: 100%; min-width: 0; border: 1px solid transparent; background: transparent; color: inherit;
  font: inherit; padding: 6px 8px; border-radius: 6px;
}
.cell:hover { border-color: var(--rule); background: var(--surface-2); }
.cell:focus { border-color: var(--mauve); background: #fff; outline: none; box-shadow: 0 0 0 3px var(--plum-soft); }
.cell.num { text-align: right; font-variant-numeric: tabular-nums; }
textarea.cell { resize: vertical; min-height: 34px; line-height: 1.4; }
select.cell { cursor: pointer; }
.del {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  width: 28px; height: 28px; border-radius: 6px; font-size: 18px; line-height: 1;
}
.del:hover { background: var(--high-soft); color: var(--high); }

/* Status pills */
.pill { display: inline-block; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--idle-soft); color: var(--idle); }
.pill.high { background: var(--high-soft); color: var(--high); }
.pill.med { background: var(--med-soft); color: var(--med); }
.pill.low { background: var(--idle-soft); color: var(--idle); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.plum { background: var(--plum-soft); color: var(--plum); }
select.status-todo { color: var(--idle); }
select.status-doing { color: var(--med); font-weight: 500; }
select.status-done { color: var(--good); font-weight: 600; }
tr.is-done .fix-title textarea { text-decoration: line-through; text-decoration-color: var(--mauve); color: var(--muted); }

/* Progress bars */
.prog { display: grid; gap: 6px; }
.prog-row { display: grid; grid-template-columns: 180px 1fr 70px; gap: 12px; align-items: center; font-size: 14px; }
.bar { height: 10px; border-radius: 999px; background: var(--idle-soft); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--plum), #8B4F7F); border-radius: 999px; }
@media (max-width: 560px) { .prog-row { grid-template-columns: 1fr 60px; } .prog-row .bar { grid-column: 1 / -1; grid-row: 2; } }

/* Charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 12px; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); padding: 14px 18px 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.legend i.dash { width: 16px; height: 0; border-top: 2px dashed; border-radius: 0; vertical-align: 3px; }

/* Roadmap */
.phases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 860px) { .phases { grid-template-columns: 1fr; } }
.phase { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 10px; align-content: start; }
.phase h3 { font-size: 17px; color: var(--plum-deep); }
.phase .when { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--mauve-ink); font-weight: 500; }
.phase ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14px; }
.phase li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: baseline; }
.phase li::before { content: ""; width: 10px; height: 10px; border-radius: 3px; border: 1.5px solid var(--mauve); transform: translateY(1px); }
.phase li.done::before { background: var(--good); border-color: var(--good); }
.phase li.doing::before { background: var(--med-soft); border-color: var(--med); }
.phase li.done { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--mauve); }

/* Import dialog */
dialog { border: 1px solid var(--rule); border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px)); color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgba(40, 10, 34, .45); }
dialog .in { padding: 20px; display: grid; gap: 12px; }
dialog h3 { font-size: 18px; }
dialog textarea { width: 100%; min-height: 140px; font: 13px/1.4 ui-monospace, "SF Mono", Menlo, monospace; border: 1px solid var(--rule-strong); border-radius: 8px; padding: 10px; }
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--plum-deep); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(58, 15, 50, .25); z-index: 50;
}
.update-bar { background: var(--med-soft); color: var(--ink); border-bottom: 1px solid #EBDDB8; font-size: 14px; }
.update-bar .in { max-width: 1120px; margin: 0 auto; padding: 10px 24px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }

/* ---- Brief (document) ---- */
.doc { max-width: 860px; margin: 0 auto; padding-inline: 24px; padding-block: 8px 64px; }
.agenda { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); border-radius: var(--radius); padding: 16px 20px; margin-top: 8px; max-width: 640px; }
.agenda b { display: block; font-weight: 600; margin-bottom: 6px; }
.agenda ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.agenda a { color: #fff; }
.part { padding-top: 52px; display: grid; gap: 16px; }
.part > .no { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--mauve-ink); }
.part > h2 { font-size: 30px; line-height: 1.15; color: var(--plum-deep); margin-top: -8px; }
.part h3 { font-size: 19px; line-height: 1.3; color: var(--ink); padding-top: 12px; }
.part p { max-width: 68ch; }
.part ul.list { margin: 0; padding-left: 20px; display: grid; gap: 6px; max-width: 68ch; }
.doc table { font-size: 14px; }
.doc td, .doc th { vertical-align: top; padding: 10px 12px; }
.doc td:first-child { font-weight: 600; }
.talk {
  background: var(--plum); color: #fff; border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 6px; max-width: 700px;
}
.talk .lbl { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #E4C9DE; }
.talk p { color: #FBF3F9; }
.finding { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 12px; }
.finding h3 { padding-top: 0; }
.finding .head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; justify-content: space-between; }
.fx { display: grid; grid-template-columns: 110px 1fr; gap: 8px 16px; margin: 0; }
.fx dt { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--mauve-ink); padding-top: 4px; }
.fx dd { margin: 0; }
.fx ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
@media (max-width: 580px) { .fx { grid-template-columns: 1fr; gap: 2px; } .fx dd { margin-bottom: 8px; } }
.hl-bad { color: var(--high); font-weight: 600; }
.hl-good { color: var(--good); font-weight: 600; }
code { font: .88em ui-monospace, "SF Mono", Menlo, monospace; background: var(--plum-soft); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere; }
.sources { font-size: 13px; color: var(--muted); display: grid; gap: 6px; }
.sources ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* ---- Footer ---- */
.foot { border-top: 1px solid var(--rule); color: var(--muted); font-size: 13px; background: var(--surface); }
.foot .in { max-width: 1120px; margin: 0 auto; padding-inline: 24px; padding-block: 20px calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.foot a { color: var(--muted); }

@media (max-width: 640px) {
  .band .in, .console, .doc, .foot .in { padding-inline: 16px; }
  .block-head h2 { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

@media print {
  .ribbon, .tabs, .btns, .btn, .del, .tbl-foot, .update-bar { display: none !important; }
  body { background: #fff; }
  .band { background: #fff; color: var(--ink); border-bottom: 2px solid var(--plum); }
  .band .lede, .band .byline, .kicker { color: var(--muted); }
  .agenda { border-color: var(--rule); }
  .agenda a { color: var(--plum); }
  .talk { background: var(--plum-soft); color: var(--ink); }
  .talk p { color: var(--ink); }
  .talk .lbl { color: var(--plum); }
  .finding, .card, .phase, tr { break-inside: avoid; }
}
.doc td:first-child { min-width: 140px; }
