/* GG Domenai — operator panel design system */
:root {
  --bg: #f6f7f9; --bg-2: #eef0f4; --panel: #ffffff; --panel-2: #f9fafb;
  --line: #e4e7ec; --line-2: #d0d5dd;
  --text: #101828; --text-2: #475467; --text-3: #98a2b3;
  --brand: #4f46e5; --brand-2: #6366f1; --brand-soft: #eef2ff;
  --ok: #059669; --ok-soft: #ecfdf5; --warn: #d97706; --warn-soft: #fffbeb;
  --err: #dc2626; --err-soft: #fef2f2; --hot: #e11d48; --hot-soft: #fff1f2;
  --violet: #7c3aed; --violet-soft: #f5f3ff; --slate-soft: #f2f4f7;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 32px -8px rgba(16,24,40,.18);
  --radius: 12px; --radius-sm: 8px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --side: 232px;
}
[data-theme="dark"] {
  --bg: #0b0d12; --bg-2: #11141b; --panel: #141821; --panel-2: #181d27;
  --line: #232937; --line-2: #2e3646;
  --text: #e6e9ef; --text-2: #a3abbb; --text-3: #6b7486;
  --brand: #818cf8; --brand-2: #a5b4fc; --brand-soft: rgba(129,140,248,.12);
  --ok: #34d399; --ok-soft: rgba(52,211,153,.12); --warn: #fbbf24; --warn-soft: rgba(251,191,36,.12);
  --err: #f87171; --err-soft: rgba(248,113,113,.12); --hot: #fb7185; --hot-soft: rgba(251,113,133,.14);
  --violet: #a78bfa; --violet-soft: rgba(167,139,250,.13); --slate-soft: rgba(148,163,184,.1);
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 16px 40px -10px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 var(--sans); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: -.01em; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 16px; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #ec4899); color: #fff; font-weight: 800; font-size: 13px;
  box-shadow: 0 6px 16px -6px var(--brand);
}
.logo b { display: block; font-size: 14px; }
.logo small { color: var(--text-3); font-size: 11.5px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; text-decoration: none; transition: background .12s, color .12s;
}
.nav a:hover { background: var(--bg-2); color: var(--text); }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
.nav a .count { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.nav a.on .count { color: var(--brand); }
.nav-sep { height: 1px; background: var(--line); margin: 12px 8px; }
.nav-label { padding: 6px 10px; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px 6px 0; }
.conn { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.main { min-width: 0; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 16px 28px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.top .sub { color: var(--text-3); font-size: 13px; }
.content { padding: 24px 28px 60px; max-width: 1480px; }
.icon { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 14px; height: 14px; }

/* ---------- cards & kpis ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-b { padding: 16px 18px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.g-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1180px) { .g-2, .g-3 { grid-template-columns: 1fr; } }
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .lbl { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.kpi .val { font-size: 28px; font-weight: 700; letter-spacing: -.03em; margin-top: 6px; line-height: 1.1; }
.kpi .hint { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.kpi.hot { border-color: color-mix(in srgb, var(--hot) 45%, var(--line)); }
.kpi.hot .val { color: var(--hot); }
.kpi.ok .val { color: var(--ok); }
.kpi .glow { position: absolute; inset: auto -40px -60px auto; width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, var(--hot-soft), transparent 70%); }

/* ---------- badges, chips, dots ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.st-unknown { background: var(--slate-soft); color: var(--text-2); }
.st-active { background: var(--brand-soft); color: var(--brand); }
.st-expired { background: var(--warn-soft); color: var(--warn); }
.st-quarantine { background: color-mix(in srgb, #f97316 14%, transparent); color: #ea580c; }
[data-theme="dark"] .st-quarantine { color: #fb923c; }
.st-releasing { background: var(--hot-soft); color: var(--hot); border-color: color-mix(in srgb, var(--hot) 35%, transparent); }
.st-releasing::before { animation: pulse 1.2s infinite; }
.st-caught { background: var(--ok-soft); color: var(--ok); }
.st-lost { background: var(--slate-soft); color: var(--text-3); text-decoration: line-through; }
.st-blocked, .st-paused { background: var(--slate-soft); color: var(--text-3); }
.st-verify { background: var(--violet-soft); color: var(--violet); }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.8); opacity: .35; } }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px;
  background: var(--bg-2); color: var(--text-2); border: 1px solid var(--line); text-decoration: none; cursor: pointer; }
.chip:hover { border-color: var(--line-2); color: var(--text); text-decoration: none; }
.chip.on { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; cursor: default; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.err { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.as { display: inline-flex; align-items: center; gap: 8px; min-width: 74px; }
.as b { font-variant-numeric: tabular-nums; width: 22px; text-align: right; }
.as i { display: block; height: 6px; border-radius: 3px; background: var(--bg-2); width: 46px; overflow: hidden; }
.as i span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--brand), #ec4899); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font: 500 13.5px var(--sans);
  cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--bg-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.btn.hot { background: var(--hot); border-color: var(--hot); color: #fff; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.icon-only { width: 34px; padding: 0; justify-content: center; }
.btn[disabled], .btn.htmx-request { opacity: .6; pointer-events: none; }
input[type=text], input[type=number], input[type=password], input[type=email], select, textarea {
  height: 34px; padding: 0 11px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--panel); color: var(--text); font: 13.5px var(--sans); outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; font-family: var(--mono); font-size: 13px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=number] { width: 92px; }
.search { position: relative; }
.search .icon { position: absolute; left: 10px; top: 9px; color: var(--text-3); }
.search input { padding-left: 33px; width: 260px; }
.kbd { font: 11px var(--mono); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--text-3); }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { display: none; }
.switch i { width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(16px); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
.t th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3);
  padding: 10px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.t th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.t th a.on { color: var(--brand); }
.t td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t td.mono, .t td.right, .t td.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
.t tbody tr { transition: background .1s; }
.t tbody tr:hover { background: var(--panel-2); }
.t tbody tr:last-child td { border-bottom: none; }
.t tr.clickable { cursor: pointer; }
.t .domain { font-family: var(--mono); font-weight: 600; font-size: 13px; color: var(--text); }
.t .domain:hover { color: var(--brand); text-decoration: none; }
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty .icon { width: 34px; height: 34px; margin-bottom: 8px; stroke-width: 1.4; }
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
#catalog-body.htmx-request, #targets-body.htmx-request { opacity: .55; transition: opacity .15s; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-2); border-radius: 10px; border: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 7px; color: var(--text-2); font-weight: 500; font-size: 13px; display: flex; gap: 7px; align-items: center; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.tabs a .n { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tabs a.hot .n { color: var(--hot); font-weight: 700; }

/* ---------- windows, progress, countdown ---------- */
.cd { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }
.cd.live { color: var(--hot); font-weight: 600; }
.bar { height: 6px; border-radius: 3px; background: var(--bg-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.bar.hot > span { background: linear-gradient(90deg, #f97316, var(--hot)); }
.budget .bar { height: 8px; }
.win { display: flex; flex-direction: column; gap: 4px; min-width: 190px; }
.win .when { font-size: 12.5px; }

/* ---------- lifecycle stepper ---------- */
.stepper { display: flex; align-items: flex-start; gap: 0; padding: 6px 4px; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; gap: 8px; }
.step::before { content: ""; position: absolute; top: 15px; left: -50%; right: 50%; height: 2px; background: var(--line-2); z-index: 0; }
.step:first-child::before { display: none; }
.step .c { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--panel);
  border: 2px solid var(--line-2); color: var(--text-3); z-index: 1; font-weight: 700; font-size: 12px; }
.step.done .c { background: var(--brand); border-color: var(--brand); color: #fff; }
.step.done::before, .step.cur::before { background: var(--brand); }
.step.cur .c { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 5px var(--brand-soft); }
.step.cur.hot .c { border-color: var(--hot); color: var(--hot); box-shadow: 0 0 0 5px var(--hot-soft); }
.step.win-ok .c { background: var(--ok); border-color: var(--ok); color: #fff; box-shadow: 0 0 0 5px var(--ok-soft); }
.step.win-lost .c { background: var(--text-3); border-color: var(--text-3); color: #fff; }
.step b { font-size: 13px; }
.step small { color: var(--text-3); font-size: 12px; }

/* ---------- facts & timeline ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1px; background: var(--line); border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.fact { background: var(--panel); padding: 12px 14px; }
.fact .k { font-size: 12px; color: var(--text-3); }
.fact .v { font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 4px 0; }
.timeline li { display: grid; grid-template-columns: 18px 1fr auto; gap: 12px; padding: 9px 18px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 26px; top: 26px; bottom: -9px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .tdot { width: 10px; height: 10px; border-radius: 50%; margin: 5px 4px 0; background: var(--line-2); z-index: 1; }
.timeline .k-state .tdot { background: var(--brand); }
.timeline .k-catch .tdot { background: var(--ok); }
.timeline .k-error .tdot { background: var(--err); }
.timeline .k-check .tdot { background: var(--hot); }
.timeline .msg { font-size: 13.5px; }
.timeline .meta { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; align-items: baseline; padding: 9px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.feed li:last-child { border-bottom: none; }
.feed .when { color: var(--text-3); font-size: 12px; min-width: 64px; }
.feed .d { font-family: var(--mono); font-weight: 600; }

/* ---------- toasts & modal ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 11px 14px;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); animation: tin .2s ease-out; font-weight: 500; }
.toast.warn { border-left-color: var(--warn); } .toast.err { border-left-color: var(--err); } .toast.hot { border-left-color: var(--hot); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; z-index: 90; background: rgba(6,8,12,.55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 24px; }
.modal { width: min(1000px, 100%); max-height: 88vh; overflow: auto; background: var(--panel); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
pre.xml { margin: 0; padding: 14px 16px; background: var(--panel-2); border-radius: var(--radius-sm); border: 1px solid var(--line);
  font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-all; max-height: 360px; overflow: auto; }

/* ---------- misc ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid; }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert.err { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.alert.info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.spark polyline { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .area { fill: url(#sg); stroke: none; }
.armed { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
.armed.on { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: linear-gradient(90deg, var(--ok-soft), var(--panel) 60%); }
.armed .big { font-weight: 650; font-size: 15px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--brand-soft), transparent), var(--bg); }
.login .card { width: 380px; padding: 28px; }
.login input { width: 100%; height: 40px; }
.login .btn { width: 100%; justify-content: center; height: 40px; margin-top: 14px; }
.theme-btn { cursor: pointer; }
.sep { width: 1px; height: 22px; background: var(--line); }

/* language switch */
.langs { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; }
.langs a { padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--text-3); text-decoration: none; }
.langs a:hover { color: var(--text); text-decoration: none; }
.langs a.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
