:root {
  --bg: #f1f2ee;
  --card: #ffffff;
  --ink: #16201d;
  --ink-2: #4a5552;
  --muted: #8a938f;
  --line: #e6e8e3;
  --brand: #1f3d36;
  --brand-2: #2b5247;
  --lime: #a8e05f;
  --lime-ink: #1f3d36;
  --sage: #4e8f7a;
  --amber: #e0a43a;
  --good: #2f8a4c;
  --good-bg: #e7f5e9;
  --warn: #b26a00;
  --warn-bg: #fff1dc;
  --bad: #c0392b;
  --bad-bg: #fdecea;
  --info: #2f6db2;
  --info-bg: #e8f0fb;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .04);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: inherit; }
button { font: inherit; }
.hidden { display: none !important; }

/* layout */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--card); padding: 22px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; padding: 4px 10px 22px; letter-spacing: -.3px; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; color: var(--lime); font-weight: 800; }
.nav-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; color: var(--ink-2); text-decoration: none; font-weight: 600; }
.nav a:hover { background: #f4f6f1; }
.nav a.active { background: var(--lime); color: var(--lime-ink); }
.nav svg { width: 19px; height: 19px; flex: none; }
.promo { margin-top: auto; background: var(--brand); color: #fff; border-radius: 20px; padding: 18px; position: relative; overflow: hidden; }
.promo::after { content: ""; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%; background: rgba(168, 224, 95, .18); }
.promo b { display: block; font-size: 15px; margin-bottom: 6px; }
.promo p { margin: 0 0 12px; font-size: 12px; color: #c9d6d1; line-height: 1.45; }
.promo .btn { background: var(--lime); color: var(--lime-ink); }

.main { padding: 22px 28px 40px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.topbar h1 { font-size: 26px; margin: 0; letter-spacing: -.4px; flex: 1; }
.topbar .sub { font-size: 13px; color: var(--muted); font-weight: 500; display: block; margin-top: 2px; letter-spacing: 0; }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 999px; padding: 10px 16px; width: 280px; color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; font: inherit; flex: 1; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; background: var(--card); border: 0; display: grid; place-items: center; cursor: pointer; position: relative; }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; background: var(--card); padding: 5px 14px 5px 5px; border-radius: 999px; cursor: pointer; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--lime); color: var(--lime-ink); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.user-chip b { display: block; font-size: 13px; }
.user-chip span { font-size: 11px; color: var(--muted); }

.test-banner { background: repeating-linear-gradient(135deg, #fff6e0, #fff6e0 10px, #ffefc7 10px, #ffefc7 20px); color: #7a4b00; border-radius: 14px; padding: 9px 14px; font-size: 12.5px; font-weight: 600; margin-bottom: 16px; display: flex; gap: 10px; align-items: center; }
.test-banner.replay { background: repeating-linear-gradient(135deg, #e8f0fb, #e8f0fb 10px, #dbe7f8 10px, #dbe7f8 20px); color: #1d4f8a; }

/* grid + cards */
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-hero { grid-template-columns: 1.25fr 1fr 1fr; }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.span2 { grid-column: span 2; }
.card { background: var(--card); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h3 { margin: 0; font-size: 16px; flex: 1; letter-spacing: -.2px; }
.card-h .hint { font-size: 12px; color: var(--muted); }
.hero { background: var(--brand); color: #fff; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; border: 36px solid rgba(168, 224, 95, .12); }
.hero .label { color: #b9cbc4; font-size: 13px; }
.hero .big { font-size: 34px; font-weight: 800; letter-spacing: -.8px; margin: 6px 0 2px; }
.hero .meta { color: #b9cbc4; font-size: 12.5px; }
.hero .row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; position: relative; }
.hero .btn.light { background: var(--lime); color: var(--lime-ink); }
.hero .btn.ghost { background: rgba(255, 255, 255, .1); color: #fff; }
.kpi .label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kpi .label .ic { width: 34px; height: 34px; border-radius: 12px; background: #f1f5ea; display: grid; place-items: center; color: var(--brand); }
.kpi .big { font-size: 28px; font-weight: 800; letter-spacing: -.6px; margin: 12px 0 6px; }
.kpi .foot { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.p-good { background: var(--good-bg); color: var(--good); }
.p-warn { background: var(--warn-bg); color: var(--warn); }
.p-bad { background: var(--bad-bg); color: var(--bad); }
.p-info { background: var(--info-bg); color: var(--info); }
.p-mute { background: #eff1ed; color: var(--ink-2); }
.p-lime { background: var(--lime); color: var(--lime-ink); }
.p-dark { background: var(--brand); color: #fff; }
.chg { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.chg.up { background: var(--good-bg); color: var(--good); }
.chg.down { background: var(--bad-bg); color: var(--bad); }

/* buttons + forms */
.btn { border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 700; cursor: pointer; background: var(--brand); color: #fff; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 13px; }
.btn:hover { filter: brightness(1.08); }
.btn.lime { background: var(--lime); color: var(--lime-ink); }
.btn.sec { background: #eef1ea; color: var(--ink); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
label.f { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
label.f input, label.f select, label.f textarea, .in { display: block; width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font: inherit; background: #fbfcfa; color: var(--ink); }
textarea { resize: vertical; }
.seg { display: inline-flex; background: #eef1ea; border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 13px; border-radius: 10px; font-weight: 700; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* tables */
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: #fafbf8; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.who { display: flex; align-items: center; gap: 10px; }
.who .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; background: #eef4e4; color: var(--brand); flex: none; }
.who b { display: block; font-size: 13.5px; }
.who span { font-size: 12px; color: var(--muted); }
.tbl-wrap { overflow-x: auto; }

/* misc */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.row { display: flex; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 0; background: var(--card); padding: 9px 16px; border-radius: 999px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.tabs button.on { background: var(--brand); color: #fff; }

/* verdict hero */
.verdict-big { font-size: 40px; font-weight: 800; letter-spacing: -1px; text-transform: uppercase; }
.vstat { background: rgba(255, 255, 255, .08); border-radius: 16px; padding: 12px 14px; min-width: 120px; }
.vstat span { font-size: 11.5px; color: #b9cbc4; display: block; }
.vstat b { font-size: 19px; }

/* reasons */
.reason { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; }
.reason:last-child { border-bottom: 0; }
.reason .n { width: 28px; height: 28px; border-radius: 9px; background: #eef1ea; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.reason .txt { font-size: 13.5px; line-height: 1.45; }
.reason .code { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.reason .src { color: var(--info); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.effect { width: 70px; height: 6px; background: #eef1ea; border-radius: 4px; overflow: hidden; margin-top: 10px; }
.effect i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }

/* feeds */
.feed { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed:last-child { border-bottom: 0; }
.feed .ic { width: 36px; height: 36px; border-radius: 12px; background: #f1f5ea; display: grid; place-items: center; font-weight: 800; font-size: 11px; color: var(--brand); flex: none; }
.feed .nm { flex: 1; min-width: 0; }
.feed .nm b { display: block; font-size: 13px; }
.feed .nm span { font-size: 11.5px; color: var(--muted); }
.spin { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* score bars */
.sbar { display: grid; grid-template-columns: 170px 1fr 60px; gap: 10px; align-items: center; font-size: 12.5px; padding: 5px 0; }
.sbar .track { height: 8px; background: #eef1ea; border-radius: 6px; overflow: hidden; display: flex; }
.sbar .track i { display: block; background: var(--lime); border-radius: 6px; }
.sbar .track i.neg { background: var(--bad); }

/* charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: inherit; fill: var(--muted); font-size: 11px; }
.chart .lbl { fill: var(--ink); font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; pointer-events: none; background: var(--brand); color: #fff; border-radius: 12px; padding: 8px 12px; font-size: 12px; z-index: 50; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); line-height: 1.5; }
.donut-wrap { display: grid; grid-template-columns: 170px 1fr; gap: 18px; align-items: center; }
.dl { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.dl:last-child { border-bottom: 0; }
.dl i { width: 10px; height: 10px; border-radius: 3px; }
.dl b { margin-left: auto; }

/* drawer + modal + toast */
.scrim { position: fixed; inset: 0; background: rgba(16, 26, 22, .35); z-index: 40; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(620px, 100vw); background: var(--card); z-index: 41; padding: 24px; overflow-y: auto; box-shadow: -10px 0 40px rgba(0, 0, 0, .12); }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); background: var(--card); border-radius: 22px; z-index: 41; padding: 24px; max-height: 90vh; overflow-y: auto; }
pre.json { background: #f7f8f5; border-radius: 14px; padding: 14px; font-size: 11.5px; overflow: auto; max-height: 60vh; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 60; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, .2); }
.toast.err { background: var(--bad); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); display: inline-block; box-shadow: 0 0 0 3px rgba(168, 224, 95, .3); }

/* cam */
.cam-sec { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.cam-sec.ok { border-color: #cfe9b0; background: #fbfdf7; }
.cam-sec h4 { margin: 0; font-size: 14px; flex: 1; }
.cam-sec .body { white-space: pre-wrap; font-size: 13px; line-height: 1.55; margin-top: 10px; }
.cam-sec textarea { width: 100%; min-height: 110px; margin-top: 10px; }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login .l { background: var(--brand); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login .l::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; border: 70px solid rgba(168, 224, 95, .12); }
.login .l h2 { font-size: 40px; letter-spacing: -1px; margin: 0 0 12px; max-width: 460px; }
.login .l p { color: #b9cbc4; max-width: 440px; line-height: 1.6; }
.login .r { padding: 56px; display: flex; flex-direction: column; justify-content: center; max-width: 620px; }
.ulist { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.ulist button { text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 12px 14px; cursor: pointer; }
.ulist button:hover { border-color: var(--lime); background: #fbfdf7; }
.ulist b { display: block; font-size: 13px; }
.ulist span { font-size: 11.5px; color: var(--muted); }

@media (max-width: 1200px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-hero, .g-main, .g3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .promo { display: none; }
  .main { padding: 16px; }
  .g2, .g4 { grid-template-columns: 1fr; }
  .search { display: none; }
  .login { grid-template-columns: 1fr; }
  .login .l, .login .r { padding: 28px 16px; }
  .donut-wrap { grid-template-columns: 1fr; }
  .sbar { grid-template-columns: 110px 1fr 50px; }
}

/* filter bars */
.tabs button .cnt { display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 4px; border-radius: 999px; background: #eef1ea; color: var(--ink-2); font-size: 11px; }
.tabs button.on .cnt { background: rgba(255, 255, 255, .18); color: #fff; }
.fbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.fbar .hint { margin-left: auto; }
.fsearch { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 12px; padding: 0 12px; height: 38px; flex: 1 1 220px; max-width: 320px; color: var(--muted); }
.fsearch input { border: 0; background: transparent; outline: none; font: inherit; color: var(--ink); width: 100%; }
.fsel { display: flex; align-items: center; gap: 6px; background: var(--bg); border-radius: 12px; padding: 0 4px 0 12px; height: 38px; font-size: 12px; color: var(--muted); font-weight: 600; }
.fsel select { border: 0; background: transparent; font: inherit; font-weight: 700; color: var(--ink); padding: 6px 4px; outline: none; cursor: pointer; }
@media (max-width: 700px) { .fsearch { max-width: none; } .fbar .hint { margin-left: 0; width: 100%; } }
