/* Almond panel — 8px grid, 36px controls, one type scale. */
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --surface-3: #eef0f3;
  --border: #e2e5e9;
  --border-strong: #cfd4da;
  --text: #16181d;
  --text-2: #4b5260;
  --text-3: #7a818d;
  --accent: #d97706;
  --accent-ink: #ffffff;
  --accent-soft: #fdf2e3;
  --link: #1f6feb;
  --good: #0ca30c;
  --good-soft: #e6f6e6;
  --good-ink: #0a6b0a;
  --warn: #fab219;
  --warn-soft: #fff5dc;
  --warn-ink: #8a5a00;
  --bad: #d03b3b;
  --bad-soft: #fcebeb;
  --bad-ink: #a42828;
  --info-soft: #e8f1fd;
  --info-ink: #1c5cab;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --grid: #eceef1;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --radius: 8px;
  --radius-sm: 6px;
  --ctl: 36px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1c2027;
    --surface-3: #242932;
    --border: #2a2f38;
    --border-strong: #3a414d;
    --text: #eef1f5;
    --text-2: #b4bbc6;
    --text-3: #858d9a;
    --accent: #f59e0b;
    --accent-ink: #1a1204;
    --accent-soft: #2d2210;
    --link: #58a6ff;
    --good-soft: #10261a;
    --good-ink: #5fd35f;
    --warn-soft: #2b2310;
    --warn-ink: #f5c451;
    --bad-soft: #2d1414;
    --bad-ink: #f08a8a;
    --info-soft: #132338;
    --info-ink: #7fb3f5;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --grid: #232830;
    --shadow: none;
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #171a20;
  --surface-2: #1c2027;
  --surface-3: #242932;
  --border: #2a2f38;
  --border-strong: #3a414d;
  --text: #eef1f5;
  --text-2: #b4bbc6;
  --text-3: #858d9a;
  --accent: #f59e0b;
  --accent-ink: #1a1204;
  --accent-soft: #2d2210;
  --link: #58a6ff;
  --good-soft: #10261a;
  --good-ink: #5fd35f;
  --warn-soft: #2b2310;
  --warn-ink: #f5c451;
  --bad-soft: #2d1414;
  --bad-ink: #f08a8a;
  --info-soft: #132338;
  --info-ink: #7fb3f5;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --grid: #232830;
  --shadow: none;
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font: 14px/20px var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------ layout */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px; margin-bottom: 16px; font-weight: 700; font-size: 16px; }
.brand-mark { width: 24px; height: 24px; border-radius: 6px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); font-size: 13px; font-weight: 800; }
.brand small { font-weight: 500; color: var(--text-3); font-size: 12px; margin-left: auto; }
.nav-group { margin-bottom: 16px; }
.nav-label { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 0 8px; margin-bottom: 4px; }
.nav a {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active .ico { color: var(--accent); }
.ico { width: 16px; height: 16px; flex: none; }
.nav .count { margin-left: auto; font-size: 12px; color: var(--text-3); }
.sidebar-foot { margin-top: auto; padding: 8px; font-size: 12px; color: var(--text-3); display: grid; gap: 8px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 56px; padding: 0 24px;
  display: flex; align-items: center; gap: 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 16px; line-height: 24px; font-weight: 650; }
.topbar .spacer { flex: 1; }
.pulse { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.pulse i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.pulse.off i { background: var(--text-3); box-shadow: none; }
/* Below 1600px it fills the pane like before; on wide/ultra-wide monitors it
   used to just hug the left edge of the remaining space next to the sidebar
   once capped at max-width — center it there instead. */
.content { padding: 24px; display: grid; gap: 24px; align-content: start; max-width: 1600px; width: 100%; margin: 0 auto; }

/* ------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-h h2 { font-size: 14px; line-height: 20px; font-weight: 650; }
.card-h .sub { font-size: 12px; color: var(--text-3); }
.card-h .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-b { padding: 16px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 24px; }
.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)); }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* ------------------------------------------------ stat tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.tile .label { font-size: 12px; line-height: 16px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.tile .value { font-size: 24px; line-height: 32px; font-weight: 650; margin-top: 8px; font-variant-numeric: tabular-nums; }
.tile .foot { font-size: 12px; line-height: 16px; color: var(--text-3); margin-top: 4px; }
.key { width: 10px; height: 10px; border-radius: 2px; flex: none; display: inline-block; }
.k1 { background: var(--series-1); } .k2 { background: var(--series-2); } .k3 { background: var(--series-3); }

/* ------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--ctl); padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 500 13px/1 var(--sans); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.icon { width: var(--ctl); padding: 0; }
.btn.sm.icon { width: 28px; }

input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  height: var(--ctl); padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 13px/20px var(--sans); min-width: 0; width: 100%;
}
textarea { height: auto; min-height: 120px; padding: 8px 10px; font-family: var(--mono); font-size: 12.5px; resize: vertical; }
select { padding-right: 28px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; }
input.sm, select.sm { height: 28px; font-size: 12px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .lbl { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12px; line-height: 16px; color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-height: 20px; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 10px; background: var(--border-strong); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }
.switch .t { display: grid; gap: 2px; }
.switch .t b { font-weight: 600; font-size: 13px; }
.switch .t span { font-size: 12px; line-height: 16px; color: var(--text-3); }

/* settings rows */
.setting { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: center; padding: 16px; border-top: 1px solid var(--border); }
.setting:first-child { border-top: 0; }
.setting .t b { display: block; font-weight: 600; font-size: 13px; }
.setting .t span { display: block; font-size: 12px; line-height: 16px; color: var(--text-3); margin-top: 2px; }
.setting .c { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }

/* segmented */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; height: var(--ctl); }
.seg button { border: 0; background: var(--surface); color: var(--text-2); padding: 0 12px; font: 500 13px/1 var(--sans); cursor: pointer; border-left: 1px solid var(--border-strong); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--surface-3); color: var(--text); font-weight: 600; }
.seg.sm { height: 28px; } .seg.sm button { font-size: 12px; padding: 0 10px; }

/* ------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: sticky; top: 0; z-index: 1; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; height: 44px; }
tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--surface-2); }
tbody tr.sel td { background: var(--accent-soft); }
td .sub { display: block; font-size: 12px; line-height: 16px; color: var(--text-3); }
.td-actions { display: flex; gap: 4px; justify-content: flex-end; }
table.compact td { height: 36px; padding: 6px 12px; }
.empty { padding: 40px 16px; text-align: center; color: var(--text-3); }

/* ------------------------------------------------ badges */
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.b-pass, .b-allow, .b-solved { background: var(--good-soft); color: var(--good-ink); }
.b-block, .b-ban { background: var(--bad-soft); color: var(--bad-ink); }
.b-challenge { background: var(--warn-soft); color: var(--warn-ink); }
.b-log { background: var(--info-soft); color: var(--info-ink); }
.b-active { background: var(--good-soft); color: var(--good-ink); }
.b-pending { background: var(--warn-soft); color: var(--warn-ink); }
.cc { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 20px; padding: 0 6px; border-radius: 4px; background: var(--surface-3); font: 600 11px/1 var(--mono); color: var(--text-2); }
.st { font: 600 12.5px/1 var(--mono); }
.st-2 { color: var(--good-ink); } .st-3 { color: var(--info-ink); } .st-4 { color: var(--warn-ink); } .st-5 { color: var(--bad-ink); }

/* proxy cloud toggle */
.cloud { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font: 600 12px/1 var(--sans); color: var(--text-3); }
.cloud svg { width: 16px; height: 16px; }
.cloud.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); color: var(--accent); }
.cloud:disabled { cursor: default; opacity: .55; }

/* ------------------------------------------------ notices */
.note { display: flex; gap: 12px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.note b { color: var(--text); }
.note.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.note.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.note.good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 40%, var(--border)); }
.note.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--link) 35%, var(--border)); }
.note .ico { margin-top: 2px; }

/* ------------------------------------------------ bar list (top lists) */
.bars { display: grid; }
.bars .it { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; height: 36px; padding: 0 16px; border-top: 1px solid var(--border); cursor: default; }
.bars .it:first-child { border-top: 0; }
.bars .it .fill { position: absolute; left: 0; top: 4px; bottom: 4px; background: color-mix(in srgb, var(--series-1) 12%, transparent); border-radius: 0 4px 4px 0; pointer-events: none; }
.bars .it .fill.bad { background: color-mix(in srgb, var(--series-2) 16%, transparent); }
.bars .it > span { position: relative; min-width: 0; }
.bars .it .v { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-2); }
.bars .it.link { cursor: pointer; }
.bars .it.link:hover { background: var(--surface-2); }

/* ------------------------------------------------ chart */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { fill: var(--text-3); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .s1 { stroke: var(--series-1); } .chart .s2 { stroke: var(--series-2); } .chart .s3 { stroke: var(--series-3); }
.chart .a1 { fill: var(--series-1); opacity: .1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .d1 { fill: var(--series-1); } .chart .d2 { fill: var(--series-2); } .chart .d3 { fill: var(--series-3); }
.chart .xhair { stroke: var(--border-strong); stroke-width: 1; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.tip { position: absolute; pointer-events: none; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 8px 10px; font-size: 12px; line-height: 18px; min-width: 150px; }
.tip .th { font-weight: 600; margin-bottom: 4px; color: var(--text); }
.tip .tr { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; color: var(--text-2); }
.tip .tr b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ------------------------------------------------ live */
.live-table td { height: 36px; padding: 6px 12px; font-size: 12.5px; }
.live-table tr.fresh td { animation: fresh 1.2s ease-out; }
@keyframes fresh { from { background: var(--accent-soft); } to { background: transparent; } }
.path { font-family: var(--mono); font-size: 12px; max-width: 420px; }

/* drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(8, 10, 14, .35); z-index: 50; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); border-left: 1px solid var(--border); z-index: 51; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.drawer-h { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.drawer-h h3 { font-size: 15px; font-weight: 650; }
.drawer-b { padding: 16px; overflow-y: auto; display: grid; gap: 16px; align-content: start; }
.kv { display: grid; grid-template-columns: 128px minmax(0, 1fr); column-gap: 16px; row-gap: 8px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { word-break: break-word; }
.pre { font-family: var(--mono); font-size: 12px; line-height: 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; white-space: pre-wrap; word-break: break-all; }
.actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.actions-grid .btn { justify-content: flex-start; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 10, 14, .45); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(820px, 100%); }
.modal-h { display: flex; align-items: center; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.modal-h h3 { font-size: 15px; font-weight: 650; }
.modal-h .btn { margin-left: auto; }
.modal-b { padding: 16px; display: grid; gap: 16px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }

/* toast */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: grid; gap: 8px; }
.toast { min-width: 260px; max-width: 420px; padding: 12px 16px; border-radius: var(--radius); background: var(--text); color: var(--bg); font-size: 13px; box-shadow: var(--shadow-lg); }
.toast.err { background: var(--bad); color: #fff; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs a { height: 40px; display: inline-flex; align-items: center; padding: 0 12px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* filter bar */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters > * { width: auto; }
.filters input[type=text], .filters input[type=search] { width: 168px; }
.filters select { width: 152px; }

/* conditions builder */
.cond { display: grid; grid-template-columns: 160px 120px 140px minmax(0, 1fr) 36px; gap: 8px; align-items: center; }
.cond.nokey { grid-template-columns: 160px 140px minmax(0, 1fr) 36px; }

/* login — bespoke dark scene, independent of the admin's light/dark setting */
.login {
  position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(120% 100% at 50% -10%, #121826 0%, #05070d 55%, #030408 100%);
  overflow: hidden; isolation: isolate;
}
.login-bg { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; }
.login-grid {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 0%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 0%, transparent 75%);
}
.login-aurora { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.login-aurora i { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; will-change: transform; }
.login-aurora i:nth-child(1) { width: 46vw; height: 46vw; left: -12vw; top: -16vw; background: radial-gradient(circle, rgba(245,165,36,.5), transparent 65%); animation: loginDrift1 24s ease-in-out infinite alternate; }
.login-aurora i:nth-child(2) { width: 42vw; height: 42vw; right: -14vw; top: -10vw; background: radial-gradient(circle, rgba(79,124,255,.4), transparent 65%); animation: loginDrift2 28s ease-in-out infinite alternate; }
.login-aurora i:nth-child(3) { width: 40vw; height: 40vw; left: 28vw; bottom: -20vw; background: radial-gradient(circle, rgba(45,212,255,.22), transparent 65%); animation: loginDrift3 32s ease-in-out infinite alternate; }
@keyframes loginDrift1 { to { transform: translate(6vw, 5vw) scale(1.12); } }
@keyframes loginDrift2 { to { transform: translate(-6vw, 7vw) scale(.92); } }
@keyframes loginDrift3 { to { transform: translate(-5vw, -6vw) scale(1.15); } }
.login-card {
  position: relative; z-index: 1; width: min(360px, 100%); padding: 2px; border-radius: 22px;
  background: linear-gradient(160deg, rgba(255,210,122,.35), rgba(255,255,255,.05) 40%, rgba(45,212,255,.22));
  box-shadow: 0 30px 90px -30px rgba(0,0,0,.65);
  animation: loginCardIn .6s cubic-bezier(.2,.7,.2,1);
}
@keyframes loginCardIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.login-form {
  display: grid; gap: 14px; padding: 40px 32px; border-radius: 21px;
  background: linear-gradient(180deg, rgba(17,21,32,.92), rgba(9,11,17,.96));
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.login-pass {
  height: 52px; padding: 0 16px; border-radius: 13px; font: 16px/1 var(--sans); letter-spacing: .02em;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.12); color: #eef2f8;
  outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
.login-pass::placeholder { color: #6b7484; }
.login-pass:focus { border-color: rgba(245,165,36,.6); background: rgba(255,255,255,.06); box-shadow: 0 0 0 4px rgba(245,165,36,.14); }
.login-form .field input {
  height: 44px; padding: 0 14px; border-radius: 11px; font: 15px/1 var(--sans);
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.12); color: #eef2f8; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.login-form .field input:focus { border-color: rgba(245,165,36,.55); box-shadow: 0 0 0 4px rgba(245,165,36,.12); }
.login-btn {
  height: 50px; border-radius: 13px; font-size: 15.5px; font-weight: 650; letter-spacing: -.005em; border: 0; cursor: pointer;
  color: #1a1203; background: linear-gradient(135deg, #ffd27a, #f5a524 45%, #ff6a1a);
  box-shadow: 0 14px 34px -10px rgba(245,165,36,.6), inset 0 1px 0 rgba(255,255,255,.4);
  position: relative; overflow: hidden; transition: transform .25s, box-shadow .25s, opacity .2s;
}
.login-btn::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.5) 50%, transparent 65%);
  transform: translateX(-120%); animation: loginSheen 4.5s ease-in-out infinite;
}
@keyframes loginSheen { 0%, 60% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 18px 40px -10px rgba(245,165,36,.75), inset 0 1px 0 rgba(255,255,255,.4); }
.login-btn:disabled { opacity: .6; cursor: default; transform: none; }
.login-form .note.bad { background: rgba(208,59,59,.14); border-color: rgba(208,59,59,.4); color: #ffb3ab; }
@media (prefers-reduced-motion: reduce) {
  .login-aurora i, .login-card, .login-btn::after { animation: none; }
}
@media (max-width: 420px) {
  .login-form { padding: 32px 22px; }
}

.ns-box { display: grid; gap: 8px; }
.ns-box .ns { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 40px; padding: 0 8px 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-family: var(--mono); font-size: 13px; }

@media (max-width: 1100px) {
  .g4, .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: minmax(0, 1fr); }
}
.seg button, .switch .t b, .pulse, .topbar h1 { white-space: nowrap; }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  /* Sidebar becomes one horizontally scrolling strip. */
  .sidebar {
    position: sticky; top: 0; z-index: 30; height: 56px; flex-direction: row; align-items: center;
    gap: 4px; padding: 0 16px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--border);
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar .nav-label, .sidebar-foot, .brand small { display: none; }
  .brand { height: 32px; margin: 0 8px 0 0; padding: 0; flex: none; }
  .nav-group { display: contents; }
  .nav { display: contents; }
  .nav a { flex: none; white-space: nowrap; }
  .topbar { position: static; height: auto; min-height: 56px; flex-wrap: wrap; row-gap: 8px; padding: 12px 16px; }
  .topbar .spacer { display: none; }
  .topbar h1 { flex: 1 0 100%; }
  .g2, .g4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 16px; gap: 16px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .setting { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .setting .c { justify-content: flex-start; }
  .setting .c input[type=text] { width: 100% !important; }
  .cond, .cond.nokey { grid-template-columns: minmax(0, 1fr); }
  .card-h { flex-wrap: wrap; }
  .card-h .right { margin-left: 0; flex-wrap: wrap; }
  .filters > * { flex: 1 1 140px; width: auto !important; }
  .kv { grid-template-columns: 104px minmax(0, 1fr); }
  .actions-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- işlem kaydı / oto savunma ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.good { background: var(--good-soft); color: var(--good-ink); }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip.bad { background: var(--bad-soft); color: var(--bad-ink); height: auto; min-height: 26px; padding: 4px 10px; white-space: normal; }
.seg-n { margin-left: 6px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.seg button.on .seg-n { color: var(--text-2); }
.card-h.wrap { flex-wrap: wrap; }
.jr-sec { display: flex; align-items: baseline; gap: 12px; margin-top: 8px; }
.jr-sec h2 { font-size: 15px; font-weight: 650; }
.jr-sec .sub { font-size: 12px; color: var(--text-3); }
.journal { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.journal > .card { border: 0; box-shadow: none; }
.jr-day { position: sticky; top: 0; z-index: 1; padding: 8px 16px; font-size: 12px; font-weight: 650; color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--border); text-transform: capitalize; }
.jr-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.jr-row:last-child { border-bottom: 0; }
.jr-row.k-auto { box-shadow: inset 3px 0 0 var(--warn); }
.jr-time { font-size: 12px; color: var(--text-3); padding-top: 2px; }
.jr-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jr-top b { font-size: 13.5px; }
.jr-top .sub { font-size: 12px; color: var(--text-3); }
.jr-detail { margin-top: 6px; font-size: 13px; color: var(--text-2); white-space: pre-line; line-height: 1.55; }
.jr-more { margin-top: 8px; font-size: 12.5px; }
.jr-more summary { cursor: pointer; color: var(--link); }
.jr-kv { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); grid-template-columns: 190px minmax(0, 1fr); }
.jr-list { display: flex; flex-wrap: wrap; gap: 4px; }
.jr-h4 { font-size: 12.5px; font-weight: 650; color: var(--text-2); margin-bottom: 8px; }
.jr-ul { padding-left: 18px; font-size: 13px; color: var(--text-2); }
.jr-types { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 0; }
details.incident > summary { list-style: none; cursor: pointer; flex-wrap: wrap; }
details.incident > summary::-webkit-details-marker { display: none; }
details.incident[open] > summary { border-bottom-color: transparent; }
details.incident.live { border-color: color-mix(in srgb, var(--bad) 55%, var(--border)); }
.incident .jr-types { padding-bottom: 12px; }
.timeline { list-style: none; display: grid; gap: 8px; border-left: 2px solid var(--border-strong); padding-left: 14px; margin-left: 4px; }
.timeline li { display: grid; grid-template-columns: 70px 150px minmax(0, 1fr); gap: 10px; font-size: 13px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.timeline .t { color: var(--text-3); font-size: 12px; }
.sentinel-live { border-color: color-mix(in srgb, var(--bad) 55%, var(--border)); }
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 60%, transparent); animation: pdot 1.6s infinite; flex: none; }
@keyframes pdot { 70%, 100% { box-shadow: 0 0 0 10px transparent; } }
@media (max-width: 760px) {
  .jr-row { grid-template-columns: 1fr; gap: 4px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .jr-kv { grid-template-columns: 1fr; }
}

details.sentinel-live > summary{list-style:none;cursor:pointer}
details.sentinel-live > summary::-webkit-details-marker{display:none}
.num.bad{color:var(--bad-ink)}

/* saldırı olayı özeti — kopyalanabilir not */
.assess-pre {
  margin-top: 10px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7; color: var(--text-2); white-space: pre-wrap; word-break: break-word;
  max-height: 420px; overflow-y: auto;
}
