/* Krunc Growth Engine dashboard. No inline styles anywhere: the CSP is style-src 'self'. */
:root {
  --bg: #0d1017; --panel: #151a24; --panel-2: #1b2130; --line: #262d3d; --text: #e6e9f0; --muted: #8b93a7;
  --accent: #7c5cff; --accent-2: #9b83ff; --ok: #2fbf71; --warn: #e5a23c; --bad: #ef5b5b; --info: #4aa3ff;
  --radius: 10px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 13px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .nowrap { white-space: nowrap; } .center { text-align: center; }
.lead { color: var(--muted); max-width: 80ch; margin: 0 0 16px; }

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100%; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 13px; letter-spacing: .12em; padding: 4px 8px 16px; }
.brand:hover { text-decoration: none; }
.brand-center { justify-content: center; padding-bottom: 20px; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #c05cff); font-weight: 800; letter-spacing: 0; }
.nav-group { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin: 16px 8px 6px; }
.nav-link { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 7px; color: var(--text); }
.nav-link:hover { background: var(--panel-2); text-decoration: none; }
.nav-link.is-active { background: rgba(124, 92, 255, .18); color: #fff; }
.nav-link.is-planned { color: var(--muted); }

.main { min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.top-right { display: flex; align-items: center; gap: 12px; }
.who { color: var(--text); }
.content { padding: 24px; max-width: 1280px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.card.narrow { max-width: 560px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { font-size: 34px; font-weight: 700; line-height: 1.2; margin: 6px 0 2px; }
.kpi-value.is-empty { color: var(--muted); }
.kpi-note { color: var(--muted); font-size: 12px; }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; color: var(--text); display: block; }
.stat:hover { text-decoration: none; }
.stat b { display: block; font-size: 20px; } .stat span { color: var(--muted); font-size: 12px; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .w-status { width: 22px; }
.row-planned td { opacity: .6; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-bad { background: var(--bad); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.tag-ok { color: var(--ok); border-color: rgba(47, 191, 113, .4); }
.tag-info { color: var(--info); border-color: rgba(74, 163, 255, .4); }
.tag-warning { color: var(--warn); border-color: rgba(229, 162, 60, .45); }
.tag-critical { color: var(--bad); border-color: rgba(239, 91, 91, .5); }
.tag-muted { color: var(--muted); border-color: var(--line); }
.tag-phase { color: var(--muted); border-color: var(--line); border-style: dashed; }
.pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); }
.pill-ok { color: var(--muted); } .pill-warn { color: var(--warn); border-color: rgba(229, 162, 60, .5); }

.btn { display: inline-block; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 7px 14px; font: inherit; cursor: pointer; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-danger { color: var(--bad); } .btn-danger:hover { border-color: var(--bad); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.inline { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.stack { display: grid; gap: 12px; }
.form-narrow { max-width: 520px; margin-top: 14px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 6px; }
input[type=text], input[type=email], input[type=password], select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; font: inherit; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field-error { color: var(--bad); font-size: 12px; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.row-form { display: inline-flex; gap: 6px; align-items: center; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.list.bullets { list-style: disc; padding-left: 20px; }
.code { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.code-error { border-color: rgba(239, 91, 91, .4); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs-page { margin-bottom: 16px; }
.tab { padding: 5px 12px; border-radius: 7px; color: var(--muted); border: 1px solid transparent; }
.tab:hover { text-decoration: none; color: var(--text); }
.tab.is-active { color: var(--text); background: var(--panel-2); border-color: var(--line); }

.flash, .notice { border: 1px solid var(--line); border-left-width: 3px; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; background: var(--panel); }
.flash-success { border-left-color: var(--ok); } .flash-error { border-left-color: var(--bad); } .flash-info { border-left-color: var(--info); }
.notice-planned { border-left-color: var(--warn); } .notice-secret { border-left-color: var(--accent); }
.secret { font-size: 15px; user-select: all; }

.auth-body { display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.auth-title { margin-bottom: 4px; }
.error-code { font-size: 56px; font-weight: 800; color: var(--muted); }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .kpis, .grid-2, .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table { display: block; overflow-x: auto; }
}
@media (max-width: 560px) { .kpis, .grid-2 { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; } }
