/* Momentum 3.2 — Spruce & Ivory (accepted design). Comfort and competence; WCAG 2.2 AA contrast. */
:root {
  --bg: #F7F4EE; --surface: #FFFDF9; --sunken: #EFEAE0; --border: #E5DED2; --text: #1E2422; --muted: #5D635E;
  --side: #1F302D; --side-raised: #2A3F3B; --side-border: #38504B; --side-text: #F2EFE8; --side-muted: #AFBDB8;
  --accent: #2D6B5E; --accent-hover: #245A4F; --accent-text: #245A4F; --accent-soft: #E2EEEA; --on-dark: #9AD5C4;
  --warn: #8A4B10; --warn-soft: #F7E7CF; --info: #2E5577; --info-soft: #E3EBF3; --danger: #9B2C2C; --danger-soft: #F6E1DC; --neutral-soft: #EFEAE0;
  --r-sm: 10px; --r: 14px; --r-lg: 20px; --pill: 999px;
  --font: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141A19; --surface: #1B2321; --sunken: #101514; --border: #2D3835; --text: #ECE9E2; --muted: #A5ADA8;
    --side: #0D1211; --side-raised: #1A2321; --side-border: #2A3532; --side-text: #ECE9E2; --side-muted: #9FAAA5;
    --accent-text: #8FCDBD; --accent-soft: #173330; --warn: #F2BC7A; --warn-soft: #38281A; --info: #A7C8E6; --info-soft: #1A2836;
    --danger: #F2A39C; --danger-soft: #3A1F1B; --neutral-soft: #242D2B; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; }
a { color: var(--accent-text); font-weight: 600; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 32px; line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar { flex: 1 1 248px; max-width: 100%; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; gap: 18px; padding: 22px 14px; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 36px; border-bottom: 1px solid var(--border); }
.content { padding: 28px 36px 56px; display: flex; flex-direction: column; gap: 24px; max-width: 1280px; width: 100%; }
@media (min-width: 900px) { .sidebar { flex: 0 0 248px; } }
@media (max-width: 640px) { .topbar, .content { padding-left: 16px; padding-right: 16px; } }

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; text-decoration: none; color: inherit; }
.brand-mark { width: 40px; height: 40px; border-radius: var(--r); background: var(--on-dark); color: var(--side); display: grid; place-items: center; }
.brand-name { font-size: 17px; font-weight: 700; color: var(--side-text); }
.brand-by { font-size: 11px; color: var(--side-muted); font-weight: 500; }
.ws-switch { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--side-border); background: var(--side-raised); }
.ws-switch select { background: transparent; color: var(--side-text); border: 0; font: inherit; font-weight: 700; padding: 0; min-height: 28px; width: 100%; }
.ws-switch select option { color: #1E2422; }
.ws-switch .eyebrow { color: var(--side-muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: var(--r-sm); text-decoration: none; color: var(--side-muted); font-weight: 500; }
.nav a:hover { color: var(--side-text); background: rgba(255,255,255,.04); }
.nav a.active { color: var(--side-text); background: var(--side-raised); font-weight: 700; box-shadow: inset 3px 0 0 var(--on-dark); }
.nav .count { margin-left: auto; font-family: var(--mono); font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--pill);
  display: inline-flex; align-items: center; justify-content: center; background: var(--on-dark); color: var(--side); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.ai-launch { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 18px; border-radius: var(--pill); border: 1px solid var(--side-border); color: var(--side-text); text-decoration: none; font-weight: 600; }
.ai-launch:hover { background: var(--side-raised); color: var(--side-text); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; color: var(--side-text); }
.avatar { width: 32px; height: 32px; border-radius: var(--pill); background: var(--side-raised); border: 1px solid var(--side-border); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.me a { color: var(--side-muted); font-weight: 500; font-size: 12px; text-decoration: none; }
.me a:hover { color: var(--side-text); text-decoration: underline; }
.env-tag { font-family: var(--mono); font-size: 10px; color: var(--side-muted); padding: 0 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: var(--pill); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--sunken); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.btn.primary:hover { background: var(--accent-hover); color: #FFFFFF; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent-text); }
.btn.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.search { flex: 1 1 280px; max-width: 520px; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 18px; border-radius: var(--pill);
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); }
label { font-weight: 600; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.hint { font-weight: 500; font-size: 12px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=datetime-local], input[type=date], input[type=time], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 14px; min-height: 44px; width: 100%; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
input.code { font-family: var(--mono); font-size: 22px; letter-spacing: .3em; text-align: center; }
.check { display: inline-flex; align-items: flex-start; gap: 8px; font-weight: 500; min-height: 32px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toggle { display: inline-flex; flex-wrap: wrap; padding: 4px; border-radius: var(--r-lg); background: var(--sunken); border: 1px solid var(--border); }
.toggle a { min-height: 36px; padding: 0 14px; border-radius: var(--pill); display: inline-flex; align-items: center; text-decoration: none; color: var(--muted); font-weight: 600; }
.toggle a.on { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.card.flush .card-head { padding: 18px 24px; border-bottom: 1px solid var(--border); }
.card.dark { background: var(--side); color: var(--side-text); border-color: var(--side); }
.card.dark .eyebrow, .card.dark .muted { color: var(--side-muted); }
.card.dark a { color: var(--on-dark); }
.card.soft { background: var(--accent-soft); border-color: transparent; }
.card.alert { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.lede { font-size: 15px; color: var(--muted); margin-top: 6px; max-width: 720px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.kpi .value { font-family: var(--mono); font-size: 32px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.kpi .note { font-size: 12px; font-weight: 600; color: var(--muted); }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > .wide { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.cols > .narrow { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row .title { font-weight: 700; font-size: 15px; }
.tile { width: 40px; height: 40px; flex: none; border-radius: var(--r); display: grid; place-items: center; }
.empty { padding: 28px 24px; color: var(--muted); text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.why { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 600; font-size: 13px; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.divider { height: 1px; background: var(--border); margin: 4px 0; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: var(--pill); white-space: nowrap; }
.tone-positive { background: var(--accent-soft); color: var(--accent-text); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-neutral { background: var(--neutral-soft); color: var(--muted); }
.tag { font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--sunken); color: var(--muted); border: 1px solid var(--border); }
.sync-pill { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: var(--pill); font-size: 12px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: var(--pill); background: currentColor; display: inline-block; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; align-items: flex-start; gap: 10px; min-height: 32px; }
.mark { width: 24px; height: 24px; border-radius: var(--pill); display: grid; place-items: center; flex: none; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--sunken); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--mono); }

.flashes { display: flex; flex-direction: column; gap: 8px; }
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--r); font-weight: 500; }
.bar { height: 8px; border-radius: var(--pill); background: var(--sunken); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: var(--pill); background: var(--accent); }
.bar.warn > span { background: var(--warn); }
.bar.stop > span { background: var(--danger); }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: var(--sunken); border-radius: var(--r-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.lane-head { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px; }
.deal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); font-weight: 500; }
.deal:hover { border-color: var(--accent); color: var(--text); }
.msg { border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.msg.in { background: var(--sunken); }
.pre { white-space: pre-wrap; font-family: var(--font); margin: 0; overflow-wrap: anywhere; }
.steps { display: flex; flex-direction: column; gap: 16px; }
.step { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; gap: 12px; background: var(--surface); }
.step-num { width: 28px; height: 28px; border-radius: var(--pill); background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 13px; font-family: var(--mono); }
.notice { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r); border: 1px dashed var(--border); color: var(--muted); font-size: 13px; }
.footer-preview { white-space: pre-wrap; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 10px; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 440px; }
details > summary { cursor: pointer; font-weight: 700; min-height: 36px; display: flex; align-items: center; }
