/* ABM Analytics — UI. Dark is the default; light is a full theme, not an inversion. */
:root {
  color-scheme: dark;
  --bg: #060a13;
  --bg-2: #0a1020;
  --grid: rgba(56, 189, 248, .045);
  --panel: rgba(13, 20, 36, .78);
  --panel-solid: #0d1424;
  --panel-2: rgba(22, 32, 54, .7);
  --border: rgba(148, 163, 184, .13);
  --border-2: rgba(148, 163, 184, .22);
  --text: #e6edf7;
  --text-2: #a3b0c6;
  --muted: #6b7a93;
  --accent: #22d3ee;
  --accent-2: #8b5cf6;
  --accent-ink: #04121a;
  --glow: 0 0 0 1px rgba(34, 211, 238, .25), 0 8px 40px -12px rgba(34, 211, 238, .35);
  --good: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --info: #60a5fa;
  /* chart series — validated (dataviz validator) against --panel-solid */
  --series-1: #1a9fc4;
  --series-2: #d95926;
  --series-3: #9085e9;
  --chart-grid: rgba(148, 163, 184, .12);
  --radius: 14px;
  --sidebar-w: 268px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f8;
  --bg-2: #e6ecf5;
  --grid: rgba(14, 116, 144, .06);
  --panel: rgba(255, 255, 255, .86);
  --panel-solid: #ffffff;
  --panel-2: rgba(241, 245, 250, .9);
  --border: rgba(15, 23, 42, .09);
  --border-2: rgba(15, 23, 42, .16);
  --text: #0b1220;
  --text-2: #475569;
  --muted: #7b8798;
  --accent: #0891b2;
  --accent-2: #7c3aed;
  --accent-ink: #ffffff;
  --glow: 0 0 0 1px rgba(8, 145, 178, .25), 0 8px 30px -14px rgba(8, 145, 178, .4);
  --good: #059669;
  --bad: #dc2626;
  --warn: #b45309;
  --info: #2563eb;
  --series-1: #0e8fb3;
  --series-2: #eb6834;
  --series-3: #6250d6;
  --chart-grid: rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(139, 92, 246, .12), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, .10), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, auto, 32px 32px, 32px 32px;
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px; z-index: 40;
  background: linear-gradient(180deg, rgba(10, 16, 32, .92), rgba(6, 10, 19, .96));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(14px);
  overflow-y: auto;
}
:root[data-theme="light"] .sidebar { background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(244,247,252,.97)); }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 14px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a; font-weight: 800; font-family: var(--mono); font-size: 15px;
  box-shadow: 0 0 24px -4px rgba(34, 211, 238, .6);
}
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--muted); font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; }

.me {
  display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border);
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: radial-gradient(circle at 30% 30%, rgba(34,211,238,.35), rgba(139,92,246,.35));
  border: 1px solid var(--border-2); font-weight: 700; font-size: 14px;
}
.me-name { font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; border: 1px solid var(--border-2); color: var(--text-2); white-space: nowrap;
}
.badge.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.badge.violet { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); background: color-mix(in srgb, var(--accent-2) 10%, transparent); }
.badge.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.badge.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }

.nav-title {
  font-size: 11px; font-family: var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); padding: 14px 10px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-link.active {
  color: var(--text); background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, var(--accent-2) 10%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.nav-link.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-org {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--text);
}
.nav-org .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.nav-sub { padding-left: 10px; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.nav-link.danger { color: var(--bad); }
.nav-link button, button.nav-link { all: unset; display: flex; align-items: center; gap: 12px; width: 100%; cursor: pointer; }

.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; min-height: 64px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 20px; }
.crumb { font-size: 12px; color: var(--muted); font-family: var(--mono); letter-spacing: .04em; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-2);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }
.content { padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 20px; }

/* ---------- panels ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(10px); position: relative;
}
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; flex-wrap: wrap; }
.card-h h2 { font-size: 15px; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 16px 20px 20px; }
.grid { display: grid; gap: 20px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

/* KPI tiles */
.kpi { padding: 18px 20px; overflow: hidden; }
.kpi::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: .8;
}
.kpi-label { font-size: 12px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.kpi-label svg { width: 16px; height: 16px; color: var(--accent); }
.kpi-value { font-family: var(--mono); font-size: 28px; font-weight: 600; margin-top: 8px; letter-spacing: -.02em; line-height: 1.15; }
.kpi-unit { font-size: 13px; color: var(--muted); margin-left: 4px; font-weight: 500; }
.kpi-delta { margin-top: 8px; font-size: 12px; font-family: var(--mono); display: flex; align-items: center; gap: 6px; color: var(--muted); }
.kpi-delta .up { color: var(--good); }
.kpi-delta .down { color: var(--bad); }

.chart { width: 100%; height: 320px; }
.chart.tall { height: 420px; }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 11px; color: var(--muted); font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  font: inherit; color: var(--text); background: var(--panel-solid); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 9px 12px; min-height: 40px; outline: none; width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
input[type=date] { color-scheme: inherit; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--panel-solid);
  color: var(--text-2); cursor: pointer; font: inherit; font-size: 12px; font-weight: 500;
}
.chip:hover { color: var(--text); }
.chip.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

/* multiselect dropdown */
.ms { position: relative; min-width: 200px; }
.ms-btn { text-align: left; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.ms-btn .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ms-pop {
  position: absolute; z-index: 50; top: calc(100% + 6px); left: 0; width: max(100%, 300px); max-height: 360px;
  display: none; flex-direction: column; background: var(--panel-solid); border: 1px solid var(--border-2);
  border-radius: 12px; box-shadow: 0 20px 50px -10px rgba(0,0,0,.5); overflow: hidden;
}
.ms.open .ms-pop { display: flex; }
.ms-pop input[type=text] { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
.ms-list { overflow-y: auto; padding: 6px; }
.ms-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.ms-item:hover { background: var(--panel-2); }
.ms-foot { display: flex; gap: 8px; padding: 8px; border-top: 1px solid var(--border); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border-2); background: var(--panel-solid); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { border-color: var(--accent); }
.btn svg { width: 16px; height: 16px; }
.btn.primary {
  color: var(--accent-ink); border: 0;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 50%, var(--accent-2)));
  box-shadow: var(--glow);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: default; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th {
  text-align: left; font-size: 11px; font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.t td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.t .r { text-align: right; }
.t td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-cell { position: relative; }
.bar-cell .bar { position: absolute; left: 0; top: 6px; bottom: 6px; border-radius: 0 4px 4px 0; background: color-mix(in srgb, var(--series-1) 18%, transparent); }
.bar-cell span { position: relative; }

/* ---------- forms / admin ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--border-2); transition: .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + i { background: var(--accent); box-shadow: 0 0 12px -2px var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.org-block { border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); }
.org-block.on { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.org-block-h { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.org-block-b { padding: 0 16px 16px; display: none; flex-direction: column; gap: 16px; }
.org-block.on .org-block-b { display: flex; }
.sub-title { font-size: 11px; font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.rls-box { border: 1px dashed var(--border-2); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.rls-values { display: none; }
.rls-row.on .rls-values { display: block; }
.values-list { max-height: 220px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-solid); }
.hint { font-size: 12px; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.flash { padding: 12px 16px; border-radius: 12px; border: 1px solid; font-weight: 500; display: flex; gap: 10px; align-items: center; word-break: break-word; }
.flash.success { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 8%, transparent); }
.flash.error { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.flash.warning { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.flash .mono { color: var(--text); }

.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 12px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.status.success { color: var(--good); }
.status.failed, .status.timeout { color: var(--bad); }
.status.running, .status.queued { color: var(--info); }
.status.running::before { animation: pulse 1.2s infinite; }
.status.cancelled, .status.none { color: var(--muted); }
@keyframes pulse { 50% { opacity: .3; } }
pre.log {
  margin: 0; padding: 16px; max-height: 520px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.55;
  background: #03060c; color: #c7d2e4; border-radius: 10px; border: 1px solid var(--border); white-space: pre-wrap; word-break: break-word;
}
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.loading { position: relative; }
.loading::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 8%, transparent), transparent);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; pointer-events: none;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.error-box { padding: 16px 20px; color: var(--bad); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 420px; padding: 34px 30px 30px; box-shadow: var(--glow); }
.login-card h1 { font-size: 24px; margin-top: 22px; }
.login-card .brand { padding: 0; }
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.login-foot { margin-top: 22px; font-size: 11px; font-family: var(--mono); color: var(--muted); letter-spacing: .06em; text-align: center; }
.scanline { height: 1px; margin: 22px 0 0; background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: .6; }

.scrim { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.5); }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 40px; gap: 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 19px; }
  .chart { height: 260px; }
  .ms { min-width: 0; width: 100%; }
  .filters .field { flex: 1 1 140px; }
  .topbar h1 { font-size: 17px; }
  .hide-sm { display: none !important; }
  .card-h, .card-b { padding-left: 14px; padding-right: 14px; }
}

/* theme toggle + org switcher */
.theme-toggle { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--border); }
.theme-toggle button {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.theme-toggle button svg { width: 15px; height: 15px; }
.theme-toggle button:hover { color: var(--text); }
.theme-toggle button.on { background: var(--panel-solid); color: var(--text); box-shadow: 0 0 0 1px var(--border-2), 0 0 14px -6px var(--accent); }
.theme-toggle button.on svg { color: var(--accent); }
.org-switch {
  display: inline-flex; align-items: center; gap: 8px; padding: 0 4px 0 12px; height: 40px; border-radius: 10px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 14%, transparent), color-mix(in srgb, var(--accent-2) 10%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.org-switch svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.org-switch select { border: 0; background: transparent; min-height: 36px; padding: 0 8px; font-weight: 600; width: auto; max-width: 220px; box-shadow: none; }
.org-switch select option { background: var(--panel-solid); }
@media (max-width: 560px) {
  .theme-toggle button span { display: none; }
  .org-switch { padding-left: 8px; }
  .org-switch select { max-width: 120px; }
}

/* report sections & pivot tables */
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.section-title {
  margin-top: 8px; padding: 12px 18px; border-radius: 12px; font-weight: 700; font-size: 15px; letter-spacing: .01em;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, var(--panel)), color-mix(in srgb, var(--accent-2) 12%, var(--panel)));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
table.pivot { font-size: 12.5px; }
.pivot th { white-space: nowrap; }
.pivot td:first-child { white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; position: sticky; left: 0; background: var(--panel-solid); z-index: 1; }
.pivot tr.grp td { font-weight: 700; background: color-mix(in srgb, var(--accent) 7%, var(--panel-solid)); }
.pivot tr.grp td:first-child { background: color-mix(in srgb, var(--accent) 7%, var(--panel-solid)); }
.pivot tr.sub td:first-child { padding-left: 38px; color: var(--text-2); }
.pivot tfoot td { font-weight: 700; border-top: 2px solid var(--border-2); background: var(--panel-2); }
.pivot .tw {
  all: unset; cursor: pointer; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 8px; border-radius: 5px;
  border: 1px solid var(--border-2); font-family: var(--mono); font-size: 12px; line-height: 1; color: var(--accent);
}
.pivot td.pct.good { color: var(--good); background: color-mix(in srgb, var(--good) 10%, transparent); }
.pivot td.pct.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.pivot td.pct.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }
select { min-width: 180px; }
@media (max-width: 1400px) { .g-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .g-5 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 960px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topbar > div:nth-child(2) { flex: 1 1 calc(100% - 60px); }
  .topbar-actions { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .crumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .filters select, .filters .field { min-width: 0; }
  .filters select { width: 100%; }
  .org-switch { flex: 1 1 140px; }
  .org-switch select { max-width: none; width: 100%; }
}

/* inline icons inside text */
.hint svg, .badge svg, .sub-title svg, .field > span svg, .flash svg, .chips svg { width: 14px; height: 14px; flex: none; vertical-align: -2px; }
.me > div:last-child { min-width: 0; }
.me .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.status.warning { color: var(--warn); }
/* rendered markdown */
.md { line-height: 1.6; color: var(--text-2); }
.md h1, .md h2, .md h3 { color: var(--text); margin: 18px 0 8px; font-size: 16px; }
.md h1 { font-size: 18px; margin-top: 0; }
.md p, .md ul, .md ol { margin: 0 0 10px; }
.md code { font-family: var(--mono); font-size: 12px; background: var(--panel-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; color: var(--text); }
.md pre { background: #03060c; padding: 12px; border-radius: 10px; overflow: auto; }
.md pre code { background: none; border: 0; padding: 0; color: #c7d2e4; }
.md table { border-collapse: collapse; margin: 8px 0 12px; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md strong { color: var(--text); }
.back-btn { font-size: 18px; line-height: 1; text-decoration: none !important; flex: none; }
.back-btn[href=""] { display: none; }
tr.row-link { cursor: pointer; }
tr.row-link:hover td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
/* profile */
a.me { text-decoration: none !important; color: inherit; transition: border-color .15s; }
a.me:hover, a.me.active { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.theme-card { display: flex; flex-direction: column; gap: 8px; align-items: center; cursor: pointer; padding: 10px; border-radius: 12px; border: 1px solid var(--border-2); font-weight: 600; font-size: 13px; }
.theme-card.on { border-color: var(--accent); box-shadow: var(--glow); }
.theme-card input { display: none; }
.theme-preview { width: 100%; height: 64px; border-radius: 8px; display: grid; grid-template-columns: 1fr 3fr; grid-template-rows: 1fr 1fr; gap: 4px; padding: 6px; }
.theme-preview i { border-radius: 4px; }
.theme-preview i:first-child { grid-row: span 2; }
.theme-preview.dark { background: #060a13; } .theme-preview.dark i { background: #16203a; } .theme-preview.dark i:nth-child(2) { background: #22d3ee; }
.theme-preview.light { background: #eef2f8; } .theme-preview.light i { background: #fff; } .theme-preview.light i:nth-child(2) { background: #0891b2; }
.theme-preview.system { background: linear-gradient(135deg, #060a13 50%, #eef2f8 50%); } .theme-preview.system i { background: color-mix(in srgb, #8b5cf6 40%, transparent); }
/* order reconciliation */
table.recon th.side-h { text-align: center; color: var(--text-2); border-bottom: 1px solid var(--border-2); }
table.recon td { font-size: 12.5px; }
table.recon tr.recon-row { cursor: pointer; }
table.recon tr.recon-row:hover td, table.recon tr.recon-row.open td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
table.recon td.empty-side { text-align: center; color: var(--muted); background: repeating-linear-gradient(45deg, transparent 0 6px, color-mix(in srgb, var(--bad) 6%, transparent) 6px 12px); }
table.recon td:nth-child(5) { border-right: 1px solid var(--border-2); }
table.recon tr.recon-detail > td { background: var(--panel-2); padding: 14px 16px; }
table.lines td, table.lines th { font-size: 12px; padding: 7px 10px; }
table.lines tr.diff td { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--text); }
.status.running { color: var(--info); }
