:root {
  --bg: #0d1014; --panel: #151a21; --panel2: #1b222b; --line: #273040; --text: #e6e9ee; --muted: #8b95a5;
  --accent: #4c8dff; --p1: #e5484d; --p2: #f2883b; --p3: #e5c84a; --p4: #46a758; --ok: #46a758;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.err { color: var(--p1); min-height: 1.2em; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .3px; font-size: 17px; }
.brand.big { font-size: 26px; justify-content: center; }
.shield { width: 18px; height: 20px; background: var(--p1); clip-path: polygon(50% 0, 100% 18%, 100% 50%, 50% 100%, 0 50%, 0 18%); }
.brand.big .shield { width: 26px; height: 30px; }

.login { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 32px; display: grid; gap: 14px; text-align: center; }
.login-card label { text-align: left; }

label { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 7px; padding: 8px 10px; font: inherit; width: 100%; }
textarea { font-family: var(--mono); font-size: 12px; min-height: 120px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.check input { width: auto; }

.btn { border: 1px solid var(--line); background: var(--panel2); color: var(--text); padding: 8px 14px; border-radius: 7px; cursor: pointer; font: inherit; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--p1); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 28px; padding: 12px 24px; background: rgba(13,16,20,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav a { padding: 6px 12px; border-radius: 6px; color: var(--muted); cursor: pointer; text-decoration: none; font-weight: 500; }
nav a:hover { color: var(--text); }
nav a.active { color: var(--text); background: var(--panel2); }
.who { display: flex; gap: 10px; align-items: center; color: var(--muted); }

main { max-width: 1280px; margin: 0 auto; padding: 24px; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 18px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; cursor: pointer; }
.kpi .n { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi.p1 .n { color: var(--p1); } .kpi.p2 .n { color: var(--p2); }

.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--panel2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; border: 1px solid currentColor; white-space: nowrap; }
.pill.P1 { color: var(--p1); } .pill.P2 { color: var(--p2); } .pill.P3 { color: var(--p3); } .pill.P4 { color: var(--p4); }
.pill.kev { color: #fff; background: var(--p1); border-color: var(--p1); }
.pill.mal { color: #fff; background: #8e4ec6; border-color: #8e4ec6; }
.pill.neutral { color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--p1); } .dot.idle { background: var(--muted); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters > * { width: auto; min-width: 150px; }
.filters input { flex: 1; min-width: 220px; }

.vcard { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; }
.vcard.P1 { border-left-color: var(--p1); } .vcard.P2 { border-left-color: var(--p2); } .vcard.P3 { border-left-color: var(--p3); } .vcard.P4 { border-left-color: var(--p4); }
.vcard.closed { opacity: .55; }
.vhead { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.vhead .id { font-family: var(--mono); font-weight: 700; }
.vhead .spacer { flex: 1; }
.vhead select { width: auto; padding: 4px 8px; font-size: 12.5px; }
.vtitle { font-weight: 600; margin: 6px 0 2px; }
.vdesc { color: var(--muted); margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.vdesc.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.vmeta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.vmeta b { color: var(--text); font-weight: 600; }
.action { margin-top: 8px; font-size: 13px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--panel2); border: 1px solid var(--line); padding: 10px 18px; border-radius: 8px; transition: transform .25s; z-index: 20; }
.toast.show { transform: translateX(-50%) translateY(0); }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } .top { flex-wrap: wrap; gap: 10px; } }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 22px; width: min(520px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog form { display: grid; gap: 12px; }
