:root {
  --void: #0A0B0C; --bg: #0C0D0F; --panel: #101214; --raise: #15171A; --gunmetal: #181A1D;
  --line: #24272B; --line-2: #33373C; --haze: #43484E; --muted: #8C8A85; --text-2: #C8C6C0; --bone: #ECEAE5;
  --accent: #FF5A1F; --accent-dim: rgba(255, 90, 31, .14); --ok: #7FB685; --warn: #E2B33C; --bad: #FF5A1F;
  --f-head: 'Archivo', system-ui, sans-serif; --f-body: 'Inter', system-ui, sans-serif; --f-mono: 'JetBrains Mono', ui-monospace, monospace;
  --r: 2px; --side: 216px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--void); color: var(--bone); font: 14px/1.45 var(--f-body); -webkit-font-smoothing: antialiased; }
a { color: var(--bone); text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--f-mono); }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.lbl { font: 500 10.5px/1.3 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
h1, h2, h3 { font-family: var(--f-head); font-weight: 500; letter-spacing: -.02em; margin: 0; }
h1 { font-size: 24px; }
h2 { font-size: 15px; letter-spacing: -.01em; }
p { margin: 0; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; padding: 14px 10px; gap: 18px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px; font: 500 12px var(--f-mono); letter-spacing: .14em; }
.brand svg { width: 20px; height: 20px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 10px; border-left: 2px solid transparent; color: var(--text-2); font-size: 13.5px; }
.nav a:hover { color: var(--bone); background: var(--raise); }
.nav a.on { color: var(--bone); border-left-color: var(--accent); background: var(--raise); }
.nav a .k { font: 10px var(--f-mono); color: var(--haze); width: 16px; }
.nav a .badge { margin-left: auto; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 8px 0; display: flex; flex-direction: column; gap: 8px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border: 1px solid var(--line-2); font: 500 10.5px var(--f-mono); }
.who .n { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { min-width: 0; }
.page { max-width: 1320px; padding: 22px 28px 64px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .crumb { margin-bottom: 6px; }
.page-head .crumb a { color: var(--muted); }
.page-head .crumb a:hover { color: var(--bone); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 28px; background: var(--accent-dim); border-bottom: 1px solid #5a2a1a; font-size: 13px; }
@media (max-width: 860px) { .banner { padding: 8px 16px; flex-wrap: wrap; } }

/* ---------- panels / grids ---------- */
.panel { background: var(--bg); border: 1px solid var(--line); min-width: 0; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); min-height: 44px; }
.panel-b { padding: 14px; }
.panel-b.flush { padding: 0; }
.empty { padding: 22px 14px; color: var(--muted); font-size: 13px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.kpi { background: var(--bg); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .v { font: 500 22px/1.1 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .v small { font-size: 12px; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi .d { font: 11px var(--f-mono); color: var(--muted); }
.dl { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 0; margin: 0; }
.dl dt, .dl dd { margin: 0; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.dl dt { color: var(--muted); padding-right: 14px; }
.dl dd { font-family: var(--f-mono); font-size: 12.5px; text-align: right; overflow-wrap: anywhere; }
.dl > :nth-child(-n+2) { border-top: 0; }

/* ---------- tables ---------- */
.tw { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th { font: 500 10.5px var(--f-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg); position: sticky; top: 0; }
.t td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.t tr:last-child td { border-bottom: 0; }
.t .r { text-align: right; }
.t td.r, .t td.n { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.t tbody tr.link { cursor: pointer; }
.t tbody tr.link:hover td { background: var(--raise); }
.t tfoot td { border-top: 1px solid var(--line-2); border-bottom: 0; color: var(--muted); }
.t .wrap { white-space: normal; }
.t.compact td, .t.compact th { padding: 6px 10px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 1px solid var(--line-2); background: var(--raise); color: var(--bone); font: 500 12.5px var(--f-body); cursor: pointer; border-radius: var(--r); white-space: nowrap; }
.btn:hover { border-color: var(--muted); color: var(--bone); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #0A0B0C; }
.btn.pri:hover { filter: brightness(1.08); color: #0A0B0C; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--bone); background: var(--raise); }
.btn.danger { background: transparent; border-color: #5a2a1a; color: var(--accent); }
.btn.sm { min-height: 26px; padding: 0 9px; font-size: 12px; }
.btn.lg { min-height: 42px; padding: 0 18px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span:first-child { font-size: 12px; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.in, select.in, textarea.in { width: 100%; min-height: 36px; padding: 7px 10px; background: var(--void); border: 1px solid var(--line-2); border-radius: var(--r); outline: none; font-size: 13.5px; }
textarea.in { min-height: 84px; resize: vertical; }
.in:focus { border-color: var(--accent); }
.in::placeholder { color: var(--haze); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form .full { grid-column: 1 / -1; }
.form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.err { color: var(--accent); font-size: 12.5px; min-height: 0; }
.err:empty { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 9px; border: 1px solid var(--line-2); font: 11.5px var(--f-mono); color: var(--text-2); border-radius: var(--r); white-space: nowrap; background: transparent; }
label.chip { cursor: pointer; user-select: none; }
label.chip input { position: absolute; opacity: 0; pointer-events: none; }
label.chip:has(input:checked) { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
label.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tag { display: inline-flex; align-items: center; min-height: 20px; padding: 0 7px; border: 1px solid var(--line-2); font: 10.5px var(--f-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); border-radius: var(--r); white-space: nowrap; }
.tag.accent { border-color: var(--accent); color: var(--accent); }
.tag.ok { border-color: #3d5a40; color: var(--ok); }
.tag.warn { border-color: #6b5520; color: var(--warn); }
.tag.dim { color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); }
.seg a, .seg button { min-height: 30px; padding: 0 12px; display: inline-flex; align-items: center; font-size: 12.5px; color: var(--text-2); background: transparent; border: 0; cursor: pointer; }
.seg > * + * { border-left: 1px solid var(--line-2) !important; }
.seg .on { background: var(--raise); color: var(--bone); box-shadow: inset 0 -2px 0 var(--accent); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-2); font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--bone); border-bottom-color: var(--accent); }
.tabs a .c { font: 10.5px var(--f-mono); color: var(--muted); margin-left: 6px; }
.bar { height: 4px; background: var(--gunmetal); position: relative; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--bone); }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li a { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 13px; }
.check-list li:first-child a { border-top: 0; }
.check-list .box { width: 14px; height: 14px; border: 1px solid var(--line-2); flex: none; display: grid; place-items: center; font-size: 10px; }
.check-list .done a { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--haze); }
.check-list .done .box { background: var(--accent); border-color: var(--accent); color: #0A0B0C; }

/* ---------- dialog / toast ---------- */
dialog { padding: 0; border: 1px solid var(--line-2); background: var(--bg); color: var(--bone); width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(5, 6, 7, .72); }
.dlg-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.dlg-b { padding: 16px; overflow: auto; max-height: calc(100vh - 170px); display: flex; flex-direction: column; gap: 14px; }
.dlg-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--raise); border: 1px solid var(--line-2); border-left: 2px solid var(--accent); padding: 10px 14px; font-size: 13px; max-width: 360px; }
.toast.err { border-left-color: var(--accent); color: var(--bone); }

/* ---------- auth / onboarding ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 480px); }
.auth-side { border-right: 1px solid var(--line); padding: 28px 36px; display: flex; flex-direction: column; justify-content: space-between; background: var(--bg); }
.auth-side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.auth-side li { display: grid; grid-template-columns: 38px 1fr; padding: 12px 0; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--text-2); }
.auth-side li .k { font: 11px var(--f-mono); color: var(--muted); padding-top: 2px; }
.auth-form { padding: 40px 44px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.auth-form form { display: flex; flex-direction: column; gap: 14px; }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.pw-meter i { height: 3px; background: var(--gunmetal); }
.pw-meter i.on { background: var(--accent); }
.onb { max-width: 820px; margin: 0 auto; padding: 32px 28px 64px; display: flex; flex-direction: column; gap: 20px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.steps div { display: flex; flex-direction: column; gap: 6px; }
.steps i { height: 3px; background: var(--gunmetal); display: block; }
.steps .on i, .steps .done i { background: var(--accent); }
.steps .done .lbl, .steps .on .lbl { color: var(--bone); }

/* ---------- charts ---------- */
.chart { display: block; width: 100%; height: auto; }
.chart text { font-family: var(--f-mono); font-size: 10px; fill: var(--muted); }
.chart .grid line { stroke: var(--line); }
.chart .axis { stroke: var(--line-2); }
.drop { border: 1px dashed var(--line-2); padding: 28px; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; text-align: center; background: var(--void); cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-dim); }
.heat td.c { text-align: right; font-family: var(--f-mono); font-size: 12px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font: 11px var(--f-mono); color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 6px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.cal > div { min-height: 96px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal .dow { min-height: 0; font: 10.5px var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .07em; padding: 7px 6px; }
.cal .d { font: 11px var(--f-mono); color: var(--muted); }
.cal .out { background: var(--void); }
.cal .out .d { color: var(--haze); }
.cal .today .d { color: var(--accent); }
.cal .ev { display: block; font-size: 11.5px; padding: 2px 5px; border-left: 2px solid var(--haze); background: var(--raise); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); cursor: pointer; }
.cal .ev.st-entered, .cal .ev.st-confirmed { border-left-color: var(--accent); color: var(--bone); }
.cal .ev.st-interested { border-left-color: var(--muted); }

@media (max-width: 1100px) { .g-main, .g3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 8px 12px; overflow-x: auto; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; }
  .nav a { border-left: 0; border-bottom: 2px solid transparent; }
  .nav a.on { border-bottom-color: var(--accent); }
  .nav a .k, .side-foot .who { display: none; }
  .side-foot { margin: 0; border: 0; padding: 0; }
  .page { padding: 16px 16px 48px; }
  .g2, .form, .form.three { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .auth-form { padding: 28px 16px; }
  .steps .lbl { display: none; }
}
