:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --line: #e4e7ec;
  --text: #0f172a;
  --text-2: #4b5563;
  --muted: #8a94a6;
  --accent: #1487bb;         /* NK blue (κείμενο/κουμπιά) */
  --accent-2: #1a9fd6;
  --blocked: #1a9fd6;        /* το φίλτρο "δουλεύει" = NK μπλε */
  --blocked-soft: #d3eef9;
  --allowed: #c3cad6;        /* ουδέτερο γκρι */
  --security: #e34948;
  --policy: #eb6834;
  --ads: #1baf7a;
  --denylist: #4a3aa7;
  --other: #9aa3b2;
  --ok: #008300;
  --warn: #eda100;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 6px 20px -8px rgba(15,23,42,.10);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f141c; --surface: #171d27; --surface-2: #1d2432; --line: #2a3242;
    --text: #f1f4f9; --text-2: #c3c9d4; --muted: #7f8a9c;
    --accent: #4fb3e6; --accent-2: #5fc0ee; --blocked: #3aa9de; --blocked-soft: #163a4f;
    --allowed: #3a4658; --security: #e66767; --policy: #d95926; --ads: #199e70; --denylist: #9085e9; --other: #55607a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f141c; --surface: #171d27; --surface-2: #1d2432; --line: #2a3242;
    --text: #f1f4f9; --text-2: #c3c9d4; --muted: #7f8a9c;
    --accent: #4fb3e6; --accent-2: #5fc0ee; --blocked: #3aa9de; --blocked-soft: #163a4f;
    --allowed: #3a4658; --security: #e66767; --policy: #d95926; --ads: #199e70; --denylist: #9085e9; --other: #55607a;
    --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
b { font-weight: 650; }

/* ---------- Header ---------- */
.top { display: flex; align-items: center; gap: 22px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.brand .logo { height: 30px; width: auto; display: block; }
.brand-nk { color: var(--accent); }
.logo-lg { height: 56px; width: auto; }
.theme-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.theme-btn:hover { color: var(--text); }
.theme-btn .i-moon { display: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: block; }
:root[data-theme="dark"] .theme-btn .i-sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-btn .i-moon { display: block; } :root:not([data-theme="light"]) .theme-btn .i-sun { display: none; } }
.theme-btn.floating { position: fixed; top: 16px; right: 16px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { color: var(--text-2); text-decoration: none; padding: 7px 12px; border-radius: 8px; font-size: .95rem; }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--blocked-soft); color: var(--accent); font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--text-2); font-size: .92rem; }
.client-pick select { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.client-name { font-weight: 600; color: var(--text); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 24px 40px; }
.foot { max-width: 1180px; margin: 0 auto; padding: 14px 24px 30px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .85rem; }

/* ---------- Cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.card.narrow { max-width: 460px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.kpis { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
@media (max-width: 980px) { .grid.kpis { grid-template-columns: 1fr 1fr; } .grid.two { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid.kpis { grid-template-columns: 1fr; } .top { flex-wrap: wrap; } .who { margin-left: 0; width: 100%; } .wrap { padding: 16px; } }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.range { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.range button { font: inherit; font-size: .9rem; border: 0; background: transparent; color: var(--text-2); padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.range button.on { background: var(--accent); color: #fff; font-weight: 600; }

/* ---------- KPI ---------- */
.kpi { display: flex; flex-direction: column; gap: 4px; position: relative; }
.kpi-label { color: var(--text-2); font-size: .9rem; }
.kpi-value { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-sub { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: 6px; }
.kpi-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 8px; }
.kpi-icon svg { width: 22px; height: 22px; fill: #fff; }
.kpi-icon.sec { background: var(--security); }
.kpi-icon.pol { background: var(--policy); }
.kpi-icon.byp { background: var(--denylist); }
.kpi-icon.byp svg circle { stroke: #fff; stroke-width: 0; }
.gauge-card { flex-direction: row; align-items: center; gap: 18px; }
.gauge-wrap { flex: 0 0 210px; }
.kpi-side { display: flex; flex-direction: column; gap: 3px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.allowed, .sw.allowed { background: var(--allowed); }
.dot.blocked, .sw.blocked { background: var(--blocked); }
#gauge { width: 100%; height: auto; }
.g-track { fill: none; stroke: var(--blocked-soft); stroke-width: 16; stroke-linecap: round; }
.g-fill { fill: none; stroke: var(--blocked); stroke-width: 16; stroke-linecap: round; stroke-dasharray: 251.3; stroke-dashoffset: 251.3; transition: stroke-dashoffset .9s cubic-bezier(.2,.7,.2,1); }
.g-value { font-size: 30px; font-weight: 700; text-anchor: middle; fill: var(--text); letter-spacing: -.02em; }
.g-label { font-size: 12px; text-anchor: middle; fill: var(--muted); }

/* ---------- Charts ---------- */
.legend { display: flex; gap: 14px; color: var(--text-2); font-size: .85rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart { width: 100%; height: 240px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart rect.allowed { fill: var(--allowed); }
.chart rect.blocked { fill: var(--blocked); }
.chart .hit { fill: transparent; }
.chart .hit:hover ~ rect, .chart g:hover rect { filter: brightness(.92); }

.donut-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
#donut { width: 170px; height: 170px; flex: 0 0 auto; }
#donut circle.seg { fill: none; stroke-width: 18; transition: stroke-width .15s; cursor: default; }
#donut circle.seg:hover { stroke-width: 22; }
#donut .d-val { font-size: 20px; font-weight: 700; text-anchor: middle; fill: var(--text); }
#donut .d-lab { font-size: 8.5px; text-anchor: middle; fill: var(--muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; min-width: 200px; }
.donut-legend li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; font-size: .92rem; }
.donut-legend .sw { border-radius: 50%; }
.donut-legend .n { font-variant-numeric: tabular-nums; font-weight: 600; }
.donut-legend .p { color: var(--muted); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.c-security { background: var(--security); stroke: var(--security); }
.c-policy { background: var(--policy); stroke: var(--policy); }
.c-ads { background: var(--ads); stroke: var(--ads); }
.c-denylist { background: var(--denylist); stroke: var(--denylist); }
.c-other { background: var(--other); stroke: var(--other); }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: .92rem; align-items: center; }
.bars .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.bars .tag { font-size: .72rem; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; }
.bars .n { font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 600; }
.bars .track { display: block; grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bars .fill { display: block; height: 100%; background: var(--blocked); border-radius: 4px; width: 0; transition: width .7s cubic-bezier(.2,.7,.2,1); }
.bars .fill.c-security { background: var(--security); }
.bars .fill.c-policy { background: var(--policy); }
.bars .fill.c-ads { background: var(--ads); }
.bars .fill.c-denylist { background: var(--denylist); }
.bars .fill.c-other { background: var(--other); }
.bars .empty { color: var(--muted); font-size: .9rem; }

.explain h2 { margin-bottom: 12px; }
.explain-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.explain-grid p { margin: 4px 0 0; color: var(--text-2); font-size: .9rem; }
@media (max-width: 980px) { .explain-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .explain-grid { grid-template-columns: 1fr; } }

.tip { position: fixed; pointer-events: none; background: var(--text); color: var(--surface); padding: 7px 10px; border-radius: 8px; font-size: .82rem; z-index: 20; white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.tip b { color: inherit; }

/* ---------- Forms / tables ---------- */
.form { display: grid; gap: 12px; max-width: 460px; }
label { display: grid; gap: 5px; font-size: .9rem; color: var(--text-2); }
input, select { font: inherit; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
input:focus, select:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; border-color: transparent; }
.btn { font: inherit; font-size: .92rem; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.danger { color: var(--security); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: .82rem; }
.btn.wide { width: 100%; }
.alert { background: color-mix(in srgb, var(--security) 12%, var(--surface)); color: var(--security); border: 1px solid color-mix(in srgb, var(--security) 35%, var(--surface)); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .92rem; }
.alert.ok { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--surface)); }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl td.c { text-align: center; }
.tbl input { padding: 6px 8px; width: 100%; min-width: 84px; }
.tbl input[type=checkbox] { width: auto; min-width: 0; }
.tbl td.actions { white-space: nowrap; }
.tbl td.actions > * { margin-right: 4px; }
.tbl tr.new td { background: var(--surface-2); }
.inline { display: inline-flex; gap: 4px; align-items: center; }
.inline input { width: 110px; }
.pill { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.pill.ok { color: var(--ok); }
.pill.off { color: var(--muted); }
.pill.warn { color: var(--warn); }

/* ---------- Login ---------- */
.login-body { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% -10%, var(--blocked-soft), transparent), var(--bg); padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 30px 30px 22px; box-shadow: var(--shadow); }
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.login-brand h1 { font-size: 1.35rem; }
.login-brand p { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.login-card form { display: grid; gap: 14px; }
.login-foot { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: .8rem; }
