:root {
  --bg: #0e0a16; --panel: #161021; --raised: #1d1530; --field: #120d1b;
  --line: #2d2342; --line-strong: #43345f;
  --accent: #7c4ddb; --accent-hover: #6a3ec7; --accent-dark: #3b2170; --accent-soft: #a68be6; --accent-pale: #d9cdf5;
  --text: #efebf7; --muted: #9c93b3; --faint: #665d7c;
  --danger: #e0475f; --warning: #e0a347; --success: #3fbf8f; --teal: #4fc4b4;
  --shadow: 0 0.6rem 1.8rem rgba(0,0,0,.45);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: Manrope, system-ui, sans-serif; font-size: 15px; }
a { color: var(--accent-soft); text-decoration: none; }
a:hover { color: var(--accent-pale); }
h1, h2, h3 { font-weight: 800; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.num, td, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; word-break: break-all; }
.label { text-transform: uppercase; font-size: .68rem; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
svg.i { width: 1.05em; height: 1.05em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.15em; }

/* layout */
.top { display: flex; align-items: center; gap: 1.5rem; padding: .9rem 1.5rem; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: .7rem; }
.brand img { width: 34px; height: 34px; }
.brand b { display: block; font-weight: 800; letter-spacing: -0.01em; }
.brand small { display: block; font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.nav { display: flex; gap: .3rem; flex: 1; }
.nav a { padding: .5rem .85rem; border-radius: .6rem; color: var(--muted); font-weight: 700; font-size: .9rem; }
.nav a:hover { color: var(--text); background: var(--raised); }
.nav a.on { color: var(--text); background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); }
.who { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .88rem; }
main { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }
.grid { display: grid; gap: 1rem; }
.cols-2 { grid-template-columns: 380px 1fr; align-items: start; }
@media (max-width: 960px) { .cols-2 { grid-template-columns: 1fr; } .nav { display: none; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: .9rem; padding: 1.2rem; box-shadow: var(--shadow); }
.card > h2 { margin-bottom: .9rem; display: flex; align-items: center; gap: .5rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.sp { flex: 1; }
.stack { display: grid; gap: .7rem; }

/* inputs */
input, select, textarea { width: 100%; background: var(--field); border: 1px solid var(--line); color: var(--text); border-radius: .6rem; padding: .65rem .8rem; font: inherit; outline: none; transition: border-color .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.field { display: grid; gap: .35rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 0; border-radius: .6rem; padding: .65rem 1rem; font: inherit; font-weight: 700; cursor: pointer; background: var(--accent); color: #fff; transition: background .15s; white-space: nowrap; }
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: var(--raised); color: var(--faint); cursor: default; }
.btn.ghost { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { background: var(--line); }
.btn.sm { padding: .4rem .65rem; font-size: .82rem; }
.btn.icon { padding: .5rem; aspect-ratio: 1; }
.btn.block { width: 100%; }
.hold { position: relative; overflow: hidden; background: var(--raised); color: var(--danger); box-shadow: inset 0 0 0 1px var(--line); }
.hold:hover { background: var(--raised); }
.hold i { position: absolute; inset: 0; width: 0; background: var(--danger); transition: none; }
.hold span { position: relative; }
.hold.go i { width: 100%; transition: width 1.1s linear; }
.hold.go { color: #fff; }

/* chips + badges */
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .55rem; border-radius: .4rem; background: var(--raised); border: 1px solid var(--line); font-size: .76rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.chip svg { color: var(--accent-soft); }
.sev { display: inline-block; padding: .18rem .5rem; border-radius: .4rem; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.sev.severe { background: rgba(224,71,95,.16); color: var(--danger); }
.sev.warning { background: rgba(224,163,71,.15); color: var(--warning); }
.sev.info { background: var(--raised); color: var(--muted); }
.verdict { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .75rem; border-radius: .5rem; font-weight: 800; font-size: .85rem; }
.verdict.detected { background: var(--danger); color: #fff; }
.verdict.suspicious { background: var(--warning); color: #1a1205; }
.verdict.clean { background: var(--success); color: #06150f; }
.verdict.waiting, .verdict.scanning { background: var(--raised); color: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--line); }
.verdict.expired, .verdict.failed { background: var(--raised); color: var(--faint); box-shadow: inset 0 0 0 1px var(--line); }

/* tables */
.tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: .7rem; max-height: 640px; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { position: sticky; top: 0; background: var(--raised); text-align: left; padding: .6rem .75rem; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 800; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; white-space: nowrap; }
td { padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(124,77,219,.06); }
tr.click { cursor: pointer; }
td.hit { color: var(--danger); font-weight: 700; }
.empty { padding: 2rem; text-align: center; color: var(--faint); }

/* PIN box */
.pinbox { background: var(--field); border: 1px solid var(--line-strong); border-radius: .8rem; padding: 1rem; text-align: center; }
.pin { font-family: ui-monospace, Consolas, monospace; font-size: 2.1rem; font-weight: 800; letter-spacing: .25em; color: var(--accent-pale); }

/* report */
.rhead { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin-top: 1rem; }
.stat { background: var(--raised); border: 1px solid var(--line); border-radius: .7rem; padding: .7rem .85rem; }
.stat b { display: block; font-size: 1.05rem; font-weight: 800; margin-top: .2rem; word-break: break-word; }
.stat b.severe { color: var(--danger); } .stat b.warning { color: var(--warning); } .stat b.ok { color: var(--success); }
.finding { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: .7rem; background: var(--raised); }
.finding.severe { border-left: 3px solid var(--danger); } .finding.warning { border-left: 3px solid var(--warning); } .finding.info { border-left: 3px solid var(--line-strong); }
.finding h3 { font-size: .95rem; }
.finding p { margin: .25rem 0 0; color: var(--muted); font-size: .87rem; }
.finding .ev { margin-top: .4rem; }
.cat { margin: 1.1rem 0 .5rem; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: .6rem; margin-bottom: .9rem; }
.tabs button { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 700; font-size: .86rem; padding: .45rem .75rem; border-radius: .5rem; cursor: pointer; }
.tabs button:hover { color: var(--text); background: var(--raised); }
.tabs button.on { background: var(--accent); color: #fff; }
.tabs button small { opacity: .7; margin-left: .3rem; }
.notice { padding: .8rem 1rem; border-radius: .7rem; background: var(--raised); border: 1px solid var(--line); color: var(--muted); font-size: .86rem; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth .card { width: 100%; max-width: 400px; }
.auth .brand { margin-bottom: 1.4rem; }
.err { color: var(--danger); font-size: .86rem; min-height: 1.2em; }

.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sp .8s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }
.fade { animation: fd .25s var(--ease); }
@keyframes fd { from { opacity: 0; transform: translateY(4px); } }

.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translate(-50%, 1rem); background: var(--raised); border: 1px solid var(--line-strong); padding: .7rem 1.1rem; border-radius: .6rem; font-weight: 700; opacity: 0; pointer-events: none; transition: all .25s var(--ease); box-shadow: var(--shadow); z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { color: var(--danger); }
.switch { width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; cursor: pointer; border: 0; padding: 0; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: left .2s var(--ease); }
.switch.on { background: var(--accent); }
.switch.on::after { left: 19px; background: #fff; }

/* ---- v2: archive, decisions, notes, compare, modal ---- */
a.stat { color: inherit; transition: border-color .15s; }
a.stat:hover { border-color: var(--line-strong); color: inherit; }
.cols-2r { grid-template-columns: 1fr 380px; align-items: start; }
.cols-2e { grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 960px) { .cols-2r, .cols-2e { grid-template-columns: 1fr; } }
.filters { display: grid; grid-template-columns: 1fr 170px 160px 150px 150px auto; gap: .6rem; align-items: center; }
@media (max-width: 960px) { .filters { grid-template-columns: 1fr 1fr; } }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; }
.pager:empty { display: none; }
.seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: .25rem; background: var(--field); border: 1px solid var(--line); border-radius: .6rem; padding: .25rem; }
.seg button { background: none; border: 0; color: var(--muted); font: inherit; font-size: .8rem; font-weight: 700; padding: .5rem .2rem; border-radius: .45rem; cursor: pointer; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); background: var(--raised); }
.seg button.on { background: var(--accent); color: #fff; }
.seg button.on.clean { background: var(--success); color: #06150f; }
.seg button.on.watch { background: var(--teal); color: #061513; }
.seg button.on.warn { background: var(--warning); color: #1a1205; }
.seg button.on.ban { background: var(--danger); color: #fff; }
.seg button.on[data-d=""] { background: var(--raised); color: var(--text); }
.dec { display: inline-block; padding: .18rem .5rem; border-radius: .4rem; font-size: .74rem; font-weight: 800; background: var(--raised); border: 1px solid var(--line); }
.dec.clean { color: var(--success); } .dec.watch { color: var(--teal); } .dec.warn { color: var(--warning); } .dec.ban { color: #fff; background: var(--danger); border-color: var(--danger); }
.note { background: var(--raised); border: 1px solid var(--line); border-radius: .7rem; padding: .6rem .8rem; font-size: .88rem; }
.note .row { gap: .5rem; }
.note-text { white-space: pre-wrap; margin-top: .3rem; color: var(--text); word-break: break-word; }
textarea { resize: vertical; min-height: 70px; }
.rel { background: var(--raised); border: 1px solid var(--line); border-radius: .7rem; padding: .6rem .8rem; }
.notice.warn { color: var(--warning); border-color: rgba(224,163,71,.4); }
.changed { color: var(--accent-soft); font-weight: 700; }
.cmp-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; margin-top: .7rem; }
.cmp-arrow { color: var(--accent-soft); font-size: 1.4rem; }
.modal { position: fixed; inset: 0; background: rgba(8,5,13,.72); display: grid; place-items: center; z-index: 40; padding: 1rem; }
.modal .card { width: 100%; max-width: 480px; }
.finding > div:last-child { flex-wrap: wrap; gap: .35rem; }

/* ---- v3: verdict reason, 6 decisions ---- */
.seg { grid-template-columns: repeat(3, 1fr); }
.seg button.on.appeal { background: var(--accent-soft); color: #120d1b; }
.dec.appeal { color: var(--accent-soft); }
.reason { margin-top: .9rem; padding: .65rem .85rem; border-radius: .6rem; background: var(--raised); border: 1px solid var(--line); font-size: .88rem; color: var(--muted); }
.reason.detected { border-color: rgba(224,71,95,.45); color: var(--text); }
.reason.suspicious { border-color: rgba(224,163,71,.45); }
.reason svg { color: var(--accent-soft); }
.reason.detected svg { color: var(--danger); } .reason.suspicious svg { color: var(--warning); }

/* tall modals (detection editor) scroll inside the overlay */
.modal { overflow-y: auto; place-items: start center; }
.modal .card { margin: 2rem 0; }
