:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --side: #0b1f33;
  --side-ink: #c9d6e3;
  --accent: #1b8fd1;
  --accent-ink: #ffffff;
  --accent-soft: #e6f3fb;
  --danger: #c0262d;
  --ok: #15803d;
  --crit: #7030a0; --crit-bg: #efe7f6;
  --high: #e11d48; --high-bg: #fdecef;
  --med: #d97706;  --med-bg: #fff4e5;
  --low: #15803d;  --low-bg: #eaf7ee;
  --radius: 10px;
  --font: "Noto Sans Georgian", "BPG Arial", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1520; --panel: #142030; --ink: #e6edf5; --ink-2: #c4d0dc; --muted: #8a9bb0;
    --line: #22324a; --line-2: #2e425e; --side: #08111c; --accent-soft: #11314a;
    --crit-bg: #2a1c38; --high-bg: #3a1720; --med-bg: #3a2a12; --low-bg: #12301f;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 2px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0; }
h3 { font-size: 13px; margin: 0 0 8px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }

/* layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 17px; padding: 4px 10px 18px; }
.brand:hover { text-decoration: none; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { color: var(--side-ink); padding: 7px 10px; border-radius: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.side nav a.on { background: rgba(27,143,209,.22); color: #fff; }
.navlabel { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6f8399; padding: 14px 10px 4px; }
.me { border-top: 1px solid rgba(255,255,255,.08); padding: 14px 10px 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.me .who { display: flex; flex-direction: column; color: #fff; }
.me .who span { color: #6f8399; font-size: 12px; text-transform: capitalize; }
.me a, .linkbtn { color: var(--side-ink); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-align: left; }
.linkbtn:hover { color: #fff; text-decoration: underline; }
.main { padding: 26px 32px 60px; max-width: 1320px; width: 100%; }
.bare { min-height: 100vh; display: grid; place-items: center; padding: 16px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 10px; }
.section-head .actions { display: flex; gap: 6px; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.crumbs span { margin: 0 4px; color: var(--line-2); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card.narrow { max-width: 520px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .actions, .finding-head .actions { display: flex; gap: 6px; align-items: center; }
.big { font-size: 26px; font-weight: 700; color: var(--ink-2); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.split-wide { grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }

/* forms */
.field { margin-bottom: 14px; }
.label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: var(--ink-2); }
.input { width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--panel); color: var(--ink); font: inherit; }
textarea.input { resize: vertical; line-height: 1.55; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
select.multi { min-height: 110px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.error { font-size: 12.5px; color: var(--danger); margin-top: 4px; }
.has-error .input { border-color: var(--danger); }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.hint-box { background: var(--accent-soft); border-radius: 7px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .input { width: auto; flex: 1; min-width: 160px; }
.report-actions { gap: 10px; }
.report-actions .label { margin: 0; }
.inline-form .input.date { flex: 0 0 auto; width: 170px; min-width: 0; }
.row-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--panel); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg); border-color: var(--line); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 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.compact td { padding: 6px 10px; }
.table tr.dim td { opacity: .55; }
.table tr.warnrow td { background: var(--high-bg); }
.w-bar { width: 180px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; max-width: 640px; }

/* pills & chips */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.pill-on { background: var(--low-bg); color: var(--low); border-color: transparent; }
.pill-off { background: var(--high-bg); color: var(--high); border-color: transparent; }
.pill-admin { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip { display: inline-block; padding: 1px 8px; margin: 0 4px 3px 0; border-radius: 6px; background: var(--accent-soft); font-size: 12px; }
.list { list-style: none; padding: 0; margin: 0 0 12px; }
.list li { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); gap: 8px; }

/* severity */
.sev { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; vertical-align: middle; }
.sev-critical { background: var(--crit-bg); color: var(--crit); }
.sev-high { background: var(--high-bg); color: var(--high); }
.sev-medium { background: var(--med-bg); color: var(--med); }
.sev-low { background: var(--low-bg); color: var(--low); }
.sev-bg-critical { background: var(--crit); } .sev-bg-high { background: var(--high); }
.sev-bg-medium { background: #f59e0b; } .sev-bg-low { background: #16a34a; }
.sev-tint-critical { background: var(--crit-bg); --c: var(--crit); }
.sev-tint-high { background: var(--high-bg); --c: var(--high); }
.sev-tint-medium { background: var(--med-bg); --c: var(--med); }
.sev-tint-low { background: var(--low-bg); --c: var(--low); }
.sevbar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--line); margin-top: 12px; }
.w-bar .sevbar { margin-top: 6px; }
.sevbar .seg { display: block; width: 0; }
.sevcounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sevcount { border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; }
.sevcount .n { font-size: 22px; font-weight: 700; color: var(--c); line-height: 1.2; }
.sevcount .l { font-size: 12px; color: var(--c); font-weight: 600; }
.sevgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sevcol { border-radius: 8px; padding: 12px; }
.sevcol h3 { color: var(--c); }
.sevcol .row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 3px 0; }
.sevcol .row strong { color: var(--c); }
.verdict-fail { color: var(--danger); } .verdict-partial { color: var(--med); } .verdict-pass { color: var(--ok); }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 10px; }
.charts img { width: 100%; height: auto; background: #fff; border-radius: 8px; border: 1px solid var(--line); }

/* findings */
.finding-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.finding-head h2 { font-size: 16px; }
.meta { margin: 4px 0 12px; font-size: 12.5px; }
.kv { margin-bottom: 12px; }
.kv > strong { display: block; font-size: 13px; margin-bottom: 3px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.pre.rec { color: #d01c1c; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.shots figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.shots img { width: 100%; height: 160px; object-fit: cover; object-position: top; border-radius: 7px; border: 1px solid var(--line); background: #fff; }
.shots figcaption { font-size: 12px; color: var(--muted); }
.note { white-space: pre-wrap; }

/* flash */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--panel); }
.flash-success { border-color: transparent; background: var(--low-bg); color: var(--low); }
.flash-error { border-color: transparent; background: var(--high-bg); color: var(--high); }
.flash-info { background: var(--accent-soft); border-color: transparent; }
.warn { color: var(--med); margin: 12px 0 0; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; }

/* login / errors */
.login { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 30px 28px; }
.login-logo { width: 190px; height: auto; display: block; margin: 0 auto 16px; }
.login h1 { text-align: center; }
.login > p { text-align: center; margin: 0 0 22px; }
.empty-state { text-align: center; padding: 60px 16px; }
.empty-state .code { font-size: 54px; font-weight: 800; color: var(--line-2); }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .main { padding: 18px 16px 40px; }
  .split, .split-wide, .grid-2, .grid-3, .charts { grid-template-columns: 1fr; }
  .sevgrid, .sevcounts { grid-template-columns: repeat(2, 1fr); }
  .table { display: block; overflow-x: auto; }
}

/* company parts */
.part { margin-bottom: 26px; }
.part-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  border-left: 4px solid var(--accent); padding: 2px 0 2px 12px; margin: 6px 0 12px; }
.part-head h2 { font-size: 17px; }
.part-head .actions { display: flex; gap: 6px; align-items: center; }
