/* Chalupka Hub — one stylesheet, design tokens in :root. Dark only (it is an admin panel). */
@font-face {
  font-family: 'Unageo';
  src: url('fonts/Unageo-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #0c0c0e;
  --surface: #141418;
  --surface-2: #1b1b21;
  --surface-3: #23232b;
  --line: #2a2a33;
  --line-soft: #1f1f26;
  --text: #ece8e1;
  --muted: #8f8b96;
  --faint: #5d5a64;
  --accent: #f2b84b;
  --accent-ink: #1a1408;
  --ok: #5bd69a;
  --warn: #f2b84b;
  --bad: #ff5f61;
  --info: #7aa7ff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .35);
  --sidebar: 236px;
  --font: 'Unageo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: .98rem; }
p { margin: 0; }
.mono { font-family: var(--mono); font-size: .86em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--faint); letter-spacing: .3em; text-transform: uppercase; font-size: .8rem; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; border-right: 1px solid var(--line-soft); background: linear-gradient(180deg, #111115, #0c0c0e); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: .95rem; }
.brand b { display: block; font-size: .95rem; }
.brand span { display: block; font-size: .72rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-size: .93rem; }
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.on { color: var(--text); background: var(--surface-2); }
.nav a .ico { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav a .count { margin-left: auto; background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: .7rem; font-weight: 700; padding: 1px 7px; }
.nav-sep { height: 1px; background: var(--line-soft); margin: 10px 8px; }
.nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: var(--faint); padding: 8px 11px 4px; }
.side-foot { margin-top: auto; padding: 12px 10px 0; font-size: .78rem; color: var(--faint); display: grid; gap: 8px; }
.main { min-width: 0; padding: 26px clamp(16px, 3vw, 38px) 60px; max-width: 1380px; width: 100%; margin-inline: auto; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { color: var(--muted); margin-top: 4px; font-size: .92rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; padding: 12px 16px; background: rgba(12,12,14,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-soft); }
  .main { padding: 18px 16px 50px; }
}

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.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); }
.stack { display: grid; gap: 16px; }
@media (max-width: 1100px) { .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 680px) { .g2, .g3 { grid-template-columns: 1fr; } }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; display: block; min-width: 0; }
a.kpi:hover { border-color: var(--line); background: var(--surface-2); }
.kpi .label { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.kpi .value { font-size: 1.6rem; font-weight: 650; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.kpi.warn .value { color: var(--warn); }
.kpi.bad .value { color: var(--bad); }
.kpi.ok .value { color: var(--ok); }

/* tags, dots */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--faint); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(91,214,154,.14); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px rgba(255,95,97,.16); }
.dot.warn { background: var(--warn); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.tag.ok { color: var(--ok); background: rgba(91,214,154,.1); }
.tag.warn { color: var(--warn); background: rgba(242,184,75,.1); }
.tag.bad { color: var(--bad); background: rgba(255,95,97,.12); }
.tag.info { color: var(--info); background: rgba(122,167,255,.1); }
.grade { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; font-weight: 750; font-size: .95rem; background: var(--surface-3); }
.grade.A { color: var(--ok); background: rgba(91,214,154,.12); }
.grade.B { color: #a6e07a; background: rgba(166,224,122,.1); }
.grade.C { color: var(--warn); background: rgba(242,184,75,.12); }
.grade.D, .grade.F { color: var(--bad); background: rgba(255,95,97,.12); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }

/* lists */
.list { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-top: 1px solid var(--line-soft); min-width: 0; }
.row:first-child { border-top: 0; }
.row.click { cursor: pointer; border-radius: 8px; padding-inline: 8px; margin-inline: -8px; }
.row.click:hover { background: var(--surface-2); }
.row .title { font-weight: 550; }
.row.unread .title::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 2px; }
.empty { color: var(--faint); padding: 22px 4px; text-align: center; font-size: .9rem; }

table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

/* project cards */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pcard { position: relative; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px; text-decoration: none; display: grid; gap: 12px; overflow: hidden; min-width: 0; }
.pcard::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c, var(--accent)); opacity: .85; }
.pcard:hover { border-color: var(--line); }
.pcard .top { display: flex; align-items: center; gap: 10px; }
.pcard .name { font-weight: 650; }
.pcard .meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.pcard .mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pcard .mini div { background: var(--surface-2); border-radius: 8px; padding: 7px 9px; min-width: 0; }
.pcard .mini b { display: block; font-size: 1.05rem; }
.pcard .mini span { display: block; font-size: .68rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* forms */
label.f { display: grid; gap: 6px; font-size: .82rem; color: var(--muted); min-width: 0; }
input, select, textarea { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text); outline: none; width: 100%; min-width: 0; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242,184,75,.14); }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
.form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface-3); border: 1px solid var(--line); color: var(--text); border-radius: var(--radius-sm); padding: 9px 15px; cursor: pointer; text-decoration: none; font-size: .9rem; font-weight: 550; white-space: nowrap; }
.btn:hover { border-color: #3a3a45; background: #2a2a33; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 11px; font-size: .82rem; }
.btn:disabled { opacity: .55; cursor: default; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { background: none; border: 0; padding: 6px 12px; border-radius: 7px; color: var(--muted); cursor: pointer; font-size: .85rem; }
.seg button.on { background: var(--surface-3); color: var(--text); }
.msg { font-size: .86rem; min-height: 1.2em; }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--ok); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 50% -10%, rgba(242,184,75,.08), transparent 60%), var(--bg); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line-soft); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 18px; }
.auth-card.wide { width: min(560px, 100%); }
.auth-card .brand { padding: 0; }
.qr { background: #fff; border-radius: 12px; padding: 12px; width: 220px; height: 220px; margin: 0 auto; display: grid; place-items: center; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { font-family: var(--mono); letter-spacing: .12em; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; text-align: center; word-break: break-all; font-size: .9rem; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: var(--mono); background: var(--surface-2); border-radius: 10px; padding: 12px; }
.code-input { font-size: 1.5rem; letter-spacing: .4em; text-align: center; font-family: var(--mono); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 100; padding: 16px; backdrop-filter: blur(3px); }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); display: grid; gap: 16px; }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.x { background: none; border: 0; color: var(--muted); font-size: 1.4rem; cursor: pointer; line-height: 1; padding: 2px 6px; }

/* toast */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 200; max-width: calc(100vw - 32px); }
.toast { background: var(--surface-3); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: .88rem; box-shadow: var(--shadow); }
.toast.err { border-color: rgba(255,95,97,.5); }

/* charts */
.chart { width: 100%; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--line-soft); }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-tip { position: fixed; pointer-events: none; background: var(--surface-3); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: .8rem; z-index: 300; box-shadow: var(--shadow); white-space: nowrap; }
.spark { width: 100%; height: 34px; display: block; }
.bar-track { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 99px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; color: var(--muted); cursor: pointer; white-space: nowrap; font-size: .92rem; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs button .count { background: var(--surface-3); border-radius: 99px; padding: 0 7px; font-size: .72rem; margin-left: 5px; }

/* inbox */
.inbox { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.inbox .reader { position: sticky; top: 20px; }
@media (max-width: 960px) { .inbox { grid-template-columns: 1fr; } .inbox .reader { position: static; } }
.msg-body { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border-radius: 10px; padding: 14px; font-size: .92rem; max-height: 60vh; overflow-y: auto; }
.timeline .row { align-items: flex-start; }
.sev { width: 4px; align-self: stretch; border-radius: 4px; background: var(--line); flex: none; }
.sev.notice { background: var(--accent); }
.sev.alert { background: var(--bad); }
.findings .row { align-items: flex-start; }

/* icons everywhere default to text size */
.ico { width: 18px; height: 18px; flex: none; }
.btn .ico { width: 16px; height: 16px; }
.pcard .meta { align-items: center; }
.pcard { align-content: start; }
.side-foot .btn { justify-content: flex-start; }
.shell > div { min-width: 0; }
@media (max-width: 680px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .kpi .value { font-size: 1.3rem; } .page-head h1 { font-size: 1.35rem; } }
