/* console.css - the owner console, in the Clubhouse Calm system.
 *
 * Its own file rather than a corner of styles.css: the console is a separate
 * page with a separate audience, and nothing a coach sees should change
 * because the owner's tables did. The tokens are the app's, so the two read
 * as one product. */

@font-face { font-family: Archivo; font-weight: 400; font-display: swap; src: url('/fonts/archivo-400.woff2') format('woff2'); }
@font-face { font-family: Archivo; font-weight: 600; font-display: swap; src: url('/fonts/archivo-600.woff2') format('woff2'); }
@font-face { font-family: Archivo; font-weight: 700; font-display: swap; src: url('/fonts/archivo-700.woff2') format('woff2'); }
@font-face { font-family: Archivo; font-weight: 800; font-display: swap; src: url('/fonts/archivo-800.woff2') format('woff2'); }

:root {
  --ground: #F6F5F3; --panel: #FFFFFF; --sunken: #F0EFEC; --line: rgba(31,29,28,.08); --line-2: rgba(31,29,28,.12);
  --ink: #1F1D1C; --text-2: #4A4644; --muted: #66625F;
  --green: #1D7A1D; --green-press: #155C15; --green-tint: #E8F3E8; --green-2: #5FA862; --green-3: #9CCB9C; --green-4: #C8E3C8;
  --blue: #2F6FB3; --blue-tint: #E6EEF8; --blue-ink: #1F4F86;
  --red: #B8232F; --red-tint: #FBEAEC; --red-ink: #9A1C27;
  --amber: #C27C0E; --amber-tint: #FDF1DC; --amber-ink: #7A4F00;
  --shadow: 0 1px 2px rgba(31,29,28,.04), 0 6px 24px rgba(31,29,28,.05);
  --r-sm: 6px; --r-ctl: 10px; --r-md: 14px; --r-lg: 20px; --pill: 999px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); }
body { font-family: Archivo, system-ui, sans-serif; color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--green); }
a:hover { color: var(--green-press); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */

.shell { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: stretch; align-content: flex-start; }
.side { flex: 1 1 232px; max-width: 232px; padding: 20px 14px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 28px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; text-decoration: none; color: inherit; }
.tile { width: 34px; height: 34px; background: #201E1D; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 9px; line-height: 1.02; flex: 0 0 auto; }
.tile i { font-style: normal; color: #3FB83F; }
.brand strong { display: block; font-size: 15px; }
.brand span { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: var(--r-ctl); color: var(--text-2); font-size: 14px; text-decoration: none; white-space: nowrap; }
.nav a:hover { background: var(--sunken); color: var(--ink); }
.nav a.on { background: var(--green-tint); color: var(--green); font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: 0 0 auto; }
.badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--pill); background: var(--sunken); color: var(--ink); font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; }
.badge.hot { background: var(--red-tint); color: var(--red-ink); }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; border-radius: var(--pill); background: var(--green); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.side-foot .who { min-width: 0; flex: 1 1 auto; }
.side-foot strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot button { background: none; border: 0; padding: 0; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline; }
.burger { display: none; }

main { flex: 999 1 560px; min-width: 0; padding: 32px clamp(16px, 3vw, 40px) 64px; }
.page { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }

@media (max-width: 1023px) {
  .side { max-width: none; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .burger { order: 2; display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--r-ctl); background: transparent; cursor: pointer; }
  .burger:hover, .side.open .burger { background: var(--sunken); }
  .burger .x { display: none; } .side.open .burger .x { display: block; } .side.open .burger .bars { display: none; }
  .nav { order: 3; display: none; flex-basis: 100%; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
  .side.open .nav { display: flex; }
  .nav a { min-height: 48px; font-size: 15px; }
  .side-foot { order: 4; display: none; }
  .side.open .side-foot { display: flex; flex-basis: 100%; margin-top: 6px; }
}
@media (max-width: 599px) { .side { padding: 8px 12px; } }

/* ---------- page parts ---------- */

.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.head .eyebrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
h1 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
h2 { margin: 0; font-size: 16px; font-weight: 700; }
h3 { margin: 0; font-size: 15px; }
.chip { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--pill); background: var(--sunken); color: var(--ink); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.chip.live { background: var(--green-tint); color: var(--green-press); }
.chip.warn { background: var(--amber-tint); color: var(--amber-ink); }
.chip.bad { background: var(--red-tint); color: var(--red-ink); }
.chip.info { background: var(--blue-tint); color: var(--blue-ink); }
.chip.ok { background: var(--green-tint); color: var(--green-press); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.btn { min-height: 44px; padding: 0 18px; border-radius: var(--r-ctl); border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; text-decoration: none; background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn:hover { background: var(--sunken); color: var(--ink); }
.btn.primary { background: var(--green); color: #fff; box-shadow: none; }
.btn.primary:hover { background: var(--green-press); color: #fff; }
.btn.tonal { background: var(--green-tint); color: var(--green); box-shadow: none; }
.btn.danger { background: var(--red); color: #fff; box-shadow: none; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--green); font-weight: 600; cursor: pointer; font-size: 14px; }

.card { background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.pad { padding: 24px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row > .wide { flex: 2 1 560px; min-width: 0; }
.row > .narrow { flex: 1 1 300px; min-width: 0; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.note { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; border-radius: var(--r-md); display: flex; flex-direction: column; gap: 4px; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi strong { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; }
.kpi small { font-size: 12px; font-weight: 600; color: var(--text-2); }
.kpi small.up { color: var(--green); } .kpi small.down { color: var(--red-ink); }

.story { background: var(--ink); color: #fff; padding: 28px; border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 10px; }
.story .eyebrow { font-size: 13px; font-weight: 600; color: #9FD69F; letter-spacing: .02em; }
.story p { margin: 0; font-size: clamp(20px, 2.4vw, 30px); line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; max-width: 980px; }
.story em { font-style: normal; color: #9FD69F; }
.story small { font-size: 13px; color: #CFCBC8; }

.today { padding: 20px 24px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.pillink { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: var(--pill); font-size: 14px; font-weight: 600; text-decoration: none; background: var(--sunken); color: var(--ink); }
.pillink.bad { background: var(--red-tint); color: var(--red-ink); }
.pillink.warn { background: var(--amber-tint); color: var(--amber-ink); }
.pillink.ok { background: var(--green-tint); color: var(--green); }
.pillink svg { width: 16px; height: 16px; }

.chapter { display: flex; align-items: baseline; gap: 14px; margin-top: 12px; }
.chapter b { font-size: 13px; color: var(--green); }
.chapter h2 { font-size: 24px; font-weight: 750; letter-spacing: -0.01em; }

/* ---------- charts ---------- */

.bars { display: flex; align-items: flex-end; gap: 6px; border-bottom: 1px solid var(--line-2); }
.bars > div { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; min-width: 0; }
.bars .bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--green-3); min-height: 2px; }
.bars .bar.now { background: var(--green); }
.bars .lbl { font-size: 11px; color: var(--muted); font-weight: 600; }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.hbar { display: grid; grid-template-columns: minmax(110px, 170px) 1fr 86px; gap: 12px; align-items: center; font-size: 14px; }
.hbar .track { height: 14px; border-radius: 4px; background: var(--sunken); }
.hbar .fill { height: 14px; border-radius: 4px; background: var(--green); }
.hbar .fill.blue { background: var(--blue); }
.hbar .fill.ink { background: var(--text-2); }
.hbar .val { text-align: right; }
.funnel .track { height: 28px; border-radius: var(--r-sm); }
.funnel .fill { height: 28px; border-radius: var(--r-sm); background: var(--green-2); }
.funnel .fill.last { background: var(--green); }
.heat { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 13px; min-width: 380px; }
.heat th { font-weight: 600; color: var(--muted); padding: 4px; }
.heat th[scope=row] { text-align: left; font-weight: 500; color: var(--ink); white-space: nowrap; }
.heat td { text-align: center; height: 34px; border-radius: var(--r-sm); font-weight: 600; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend i { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
.big { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.empty-chart { padding: 26px; border-radius: var(--r-md); background: var(--sunken); color: var(--text-2); font-size: 14px; text-align: center; }

/* ---------- tables ---------- */

.tablecard { overflow: hidden; }
.tablebar { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); align-items: center; }
.search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: var(--r-ctl); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--muted); }
.search input { border: 0; outline: none; background: transparent; font-size: 14px; width: 100%; color: var(--ink); }
.fsel { font-size: 14px; min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-ctl); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-2); }
.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid rgba(31,29,28,.06); white-space: nowrap; vertical-align: middle; }
.tbl tbody tr:hover td { background: #FAF9F7; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl .two { display: flex; flex-direction: column; }
.tbl .two small { font-size: 12px; color: var(--muted); }
.tbl a.strong { font-weight: 600; color: var(--ink); text-decoration: none; }
.tbl a.strong:hover { text-decoration: underline; }
.tbl .wrap { white-space: normal; min-width: 200px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; padding: 3px 8px; border-radius: var(--r-sm); background: var(--sunken); }
.dot { width: 8px; height: 8px; border-radius: var(--pill); display: inline-block; flex: 0 0 auto; }
.tfoot { padding: 14px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.steps { display: inline-flex; gap: 4px; }
.steps i { width: 18px; height: 6px; border-radius: var(--pill); background: #E3E1DE; }
.steps i.on { background: var(--green); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { font-size: 14px; font-weight: 600; min-height: 40px; padding: 0 16px; border: 0; border-radius: var(--pill); cursor: pointer; background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; }
.tab span { opacity: .75; font-weight: 500; }

/* ---------- switches, notices ---------- */

.sw { position: relative; width: 52px; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.sw .track { position: absolute; left: 4px; top: 11px; width: 44px; height: 22px; border-radius: var(--pill); background: #D6D3CF; transition: background .15s; }
.sw .knob { position: absolute; top: 14px; left: 7px; width: 16px; height: 16px; border-radius: var(--pill); background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.sw[aria-checked="true"] .track { background: var(--green); }
.sw[aria-checked="true"] .knob { left: 29px; }
.confirm { padding: 22px 24px; display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: center; box-shadow: 0 0 0 2px var(--green), 0 10px 32px rgba(31,29,28,.10); }
.confirm.bad { box-shadow: 0 0 0 2px var(--red), 0 10px 32px rgba(31,29,28,.10); }
.confirm > div:first-child { flex: 1 1 420px; display: flex; flex-direction: column; gap: 6px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: var(--r-md); background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2); max-width: calc(100vw - 32px); }
.toast.bad { background: var(--red-ink); }
.notice { padding: 14px 18px; border-radius: var(--r-md); background: var(--sunken); color: var(--text-2); font-size: 14px; }
.notice.warn { background: var(--amber-tint); color: var(--amber-ink); }

/* ---------- risk ---------- */

.segs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.seg { text-align: left; border: 0; cursor: pointer; border-radius: var(--r-md); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; background: var(--panel); box-shadow: var(--shadow); }
.seg[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: none; }
.seg strong { font-size: 26px; font-weight: 750; }
.seg span { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.riskrow { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.riskrow:last-child { border-bottom: 0; }
.riskrow .who { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.riskrow .move { flex: 1 1 220px; min-width: 0; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.riskrow .move b { font-size: 12px; color: var(--muted); }

/* ---------- support ---------- */

.tk { width: 100%; text-align: left; border: 0; cursor: pointer; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--line); background: var(--panel); }
.tk[aria-pressed="true"] { background: var(--green-tint); }
.bubble { max-width: 82%; display: flex; flex-direction: column; gap: 4px; }
.bubble div { padding: 12px 14px; border-radius: var(--r-md); background: var(--sunken); font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; }
.bubble.me div { background: var(--green); color: #fff; }
.bubble small { font-size: 12px; color: var(--muted); }
.bubble.me small { text-align: right; }
textarea.input, input.input { width: 100%; padding: 12px 14px; border: 0; border-radius: var(--r-md); background: var(--ground); box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; resize: vertical; }
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; align-items: start; }
.idea { border-radius: var(--r-md); padding: 14px; display: flex; gap: 12px; align-items: flex-start; }
.vote { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 52px; min-height: 52px; border: 0; border-radius: var(--r-ctl); cursor: pointer; background: var(--sunken); flex: 0 0 auto; font-weight: 700; }

/* ---------- team detail ---------- */

dl.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.journey { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.journey li { display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding-bottom: 14px; }
.journey .dot { margin-top: 5px; width: 10px; height: 10px; box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--line); }

/* ---------- sign in ---------- */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate .card { width: 100%; max-width: 400px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.gate label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.gate input { min-height: 46px; padding: 0 14px; border: 0; border-radius: var(--r-ctl); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 15px; }
.gate .err { color: var(--red-ink); font-size: 14px; min-height: 1.2em; margin: 0; }
.loading { min-height: 60vh; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--green-tint); border-top-color: var(--green); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ---- the drill editor ---------------------------------------------------- */
/* The one form here with real content in it. Every other input on this page is
   a filter over a table; these are the drill itself, so they get room to be
   read rather than being squeezed beside a result count. */
.dlink { color: inherit; text-decoration: none; }
.dlink:hover { color: var(--green); text-decoration: underline; }

.dgrid { gap: 16px; }
.dfld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dfld > span { font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); }
.dfld > span em { font-weight: 500; letter-spacing: 0; text-transform: none; }
/* Name, Set up and How it runs are the long ones and get the whole width; the
   short three sit on one line until the screen cannot hold them. */
.drow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .drow { grid-template-columns: 1fr; } }
.dfld .fsel { width: 100%; }

/* The diagram section is App.Canvas.panel and styles itself from pitch.css -
   the wrapper that used to be here capped it at 640px and rounded the pitch,
   so the console's drawing was a different size and shape from the app's. */
