/* 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 { display: inline-block; vertical-align: middle; 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: 260px; 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); }
/* one-line filter bar made of blocks */
.filterbar { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; padding: 12px 16px; }
.fblock { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fblock > span { font-size: 11px; color: var(--muted); font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.fblock.grow { flex: 1 1 200px; }
.fblock select { min-width: 160px; width: auto; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--panel-solid); border: 1px solid var(--border-2); white-space: nowrap; }
.seg > button, .seg > a {
  all: unset; cursor: pointer; padding: 7px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); text-decoration: none !important;
}
.seg > button:hover, .seg > a:hover { color: var(--text); background: var(--panel-2); }
.seg > .on { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 560px) { .fblock, .fblock select { width: 100%; } .seg { overflow-x: auto; max-width: 100%; } }
.fblock.grow { flex: 1 1 160px; max-width: 360px; }
.fblock select { min-width: 140px; }
.subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; max-width: 900px; }
.subtitle:empty { display: none; }
.meta-line .badge { font-size: 11px; }
/* filter blocks stand on their own — no shared panel */
.filterbar { padding: 0; background: none; border: 0; }
/* each filter block on its own panel, separated by a gap */
.filterbar { gap: 12px; align-items: stretch; }
.filterbar > .fblock { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px 12px; justify-content: flex-end; }
.filterbar > .fblock.plain { background: none; border: 0; padding: 0; justify-content: flex-end; }
.filterbar > .fblock.plain .btn { min-height: 44px; }
.filterbar .fblock.grow { flex: 1 1 140px; max-width: 300px; }
.filterbar .fblock select { min-width: 130px; }

/* ---------- readability pass (v18): proportional tabular digits, sentence-case labels, calmer tables ---------- */
:root { --muted: #8392ab; --text-2: #b4c0d3; }
:root[data-theme="light"] { --muted: #64748b; --text-2: #3f4b5e; }
.num, .t td.num, .kpi-value, .kpi-delta { font-family: var(--font); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.kpi-value { font-weight: 700; letter-spacing: -.01em; }
.t th, .field > span, .fblock > span, .sub-title, .crumb {
  font-family: var(--font); text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; color: var(--text-2);
}
.crumb { font-weight: 500; color: var(--muted); }
.t th { padding: 10px 12px; vertical-align: bottom; line-height: 1.25; }
.t th.r { text-align: right; }
table.pivot { font-size: 13px; }
.pivot td { padding: 8px 12px; }
.pivot th { white-space: normal; min-width: 92px; background: var(--panel-solid); position: sticky; top: 0; z-index: 2; border-bottom: 2px solid var(--border-2); }
.pivot th:first-child { left: 0; z-index: 3; min-width: 200px; }
.pivot tr.grp td { font-weight: 700; color: var(--text); background: color-mix(in srgb, var(--accent) 11%, var(--panel-solid)); border-top: 1px solid var(--border-2); }
.pivot tr.grp td:first-child { background: color-mix(in srgb, var(--accent) 11%, var(--panel-solid)); }
.pivot tr.sub td { color: var(--text); }
.pivot tr.sub td:first-child { padding-left: 40px; color: var(--text); }
.pivot tr.sub2 td:first-child { padding-left: 66px; color: var(--text-2); }
.pivot tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, var(--panel-solid)); }
.pivot td.pct { font-weight: 600; color: var(--text); }
.pivot td.pct.good { color: #fff; background: #1e8a4c; }
.pivot td.pct.warn { color: #fff; background: #a37a12; }
.pivot td.pct.bad  { color: #fff; background: #b33a3a; }
:root[data-theme="light"] .pivot td.pct { color: #0b1220; }
:root[data-theme="light"] .pivot td.pct.good { background: #bbf7d0; }
:root[data-theme="light"] .pivot td.pct.warn { background: #fef08a; }
:root[data-theme="light"] .pivot td.pct.bad  { background: #fecaca; }
.pivot td.neg { color: var(--bad); }
.pivot .tw { font-family: var(--font); font-weight: 700; }
.section-title {
  background: none; border: 0; border-left: 4px solid var(--accent); border-radius: 0; padding: 4px 0 4px 14px;
  font-size: 18px; font-weight: 700; margin-top: 18px;
}
.tabs-sub { display: flex; gap: 6px; flex-wrap: wrap; }
.kpi-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.funnel-row { display: grid; grid-template-columns: 160px 1fr; gap: 10px; align-items: center; margin: 6px 0; }
.funnel-bar { height: 30px; white-space: nowrap; overflow: hidden; border-radius: 6px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; margin: 0 auto; }
.scroll-y { max-height: 560px; overflow: auto; }
:root { --series-4: #3fae6a; --series-5: #d4a72c; --series-6: #d64f86; --series-7: #5b8def; --series-8: #8d99ae; }
:root[data-theme="light"] { --series-4: #2f8f55; --series-5: #b8860b; --series-6: #c03a74; --series-7: #3b6fd8; --series-8: #6b7280; }
/* report pages */
#report { display: flex; flex-direction: column; gap: 18px; }
.rsec { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 90px; }
.rsec.busy .vbody { opacity: .55; transition: opacity .2s; }
.rgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rgrid > .plain-card { background: none; border: 0; backdrop-filter: none; }
.rgrid > .plain-card > .card-b { padding: 0; }
@media (max-width: 1100px) { .rgrid > [style*="span 1"] { grid-column: span 2 !important; } }
.range { display: flex; align-items: center; gap: 6px; }
.range input { width: 150px; }
.sec-nav { display: flex; gap: 6px; flex-wrap: wrap; position: sticky; top: 72px; z-index: 5; padding: 6px; border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); }
.sec-nav a { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); text-decoration: none; white-space: nowrap; }
.sec-nav a:hover { background: var(--panel-2); color: var(--text); }
.scroll-y { max-height: 72vh; overflow: auto; }
.tbl-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.tbl-search { max-width: 320px; }
.pivot.flat td:first-child { position: static; }
.pivot.flat td { white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
.tw-sp { display: inline-block; width: 26px; }
.kpi-value.t-good { color: var(--good); } .kpi-value.t-warn { color: var(--warn); } .kpi-value.t-bad { color: var(--bad); }
.vnote:empty { display: none; }
.vnote { margin-top: 8px; }
@media (max-width: 960px) { .sec-nav { top: 118px; overflow-x: auto; flex-wrap: nowrap; } .range input { width: 100%; } .range { width: 100%; } }
.pivot tr.pct-row td { border-top: 2px solid var(--border-2); font-weight: 600; }
/* collapsible sidebar */
.sidebar, .main { transition: width .22s ease, margin-left .22s ease; }
.side-toggle svg { transition: transform .22s ease; }
@media (min-width: 961px) {
  .side-mini { --sidebar-w: 76px; }
  .side-mini .sidebar { padding-left: 12px; padding-right: 12px; overflow-x: hidden; }
  .side-mini .sidebar .nav-link { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
  .side-mini .sidebar .nav-link > span, .side-mini .brand > div:last-child, .side-mini .me > div:last-child { display: none; }
  .side-mini .nav-title { font-size: 0; height: 1px; margin: 10px 4px; padding: 0; background: var(--border); }
  .side-mini .me { justify-content: center; padding: 8px 0; }
  .side-mini .brand { justify-content: center; }
  .side-mini .side-toggle svg { transform: rotate(180deg); }
}
@media (max-width: 960px) { .side-toggle { display: none !important; } }
/* fit-to-screen tables and full screen cards */
.pivot td, .pivot th { padding: 6px 8px; }
.pivot th { font-size: .92em; min-width: 0; max-width: 130px; hyphens: auto; }
.pivot th:first-child { min-width: 0; max-width: none; }
.pivot td:first-child { max-width: 240px; }
.pivot td.num { white-space: nowrap; }
.card-h .right .icon-btn { width: 32px; height: 32px; }
.card-h .right .icon-btn svg { width: 15px; height: 15px; }
.card.fs { position: fixed; inset: 0; z-index: 200; border-radius: 0; margin: 0; overflow: auto; background: var(--panel-solid);
  display: flex; flex-direction: column; }
.card.fs > .card-b { flex: 1; }
.card.fs .scroll-y { max-height: none; }
.card.fs .chart, .card.fs .vbody[style*="height"] { height: calc(100vh - 110px) !important; }
body.has-fs { overflow: hidden; }
.kpi-row .kpi { padding-left: 76px; min-height: 92px; }
.kpi-row .kpi::after { display: none; }
.kpi-ic { position: absolute; left: 16px; top: 18px; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  color: var(--ic); background: color-mix(in srgb, var(--ic) 16%, transparent); }
.kpi-ic svg { width: 22px; height: 22px; }
.kpi-row .kpi-value { font-size: 24px; margin-top: 4px; }
.sidebar { gap: 2px; }
.sidebar .nav-link { padding: 8px 12px; }
.sidebar .nav-title { margin-top: 10px; }
.card.fs .pivot td { padding-top: .3em; padding-bottom: .3em; }
.card.fs .pivot .tw { width: 1.3em; height: 1.3em; }
.drill { display: inline-flex; gap: 4px; align-items: center; margin-right: 6px; flex-wrap: wrap; }
/* layout fixes: KPI values and the sidebar never wrap */
.kpi-value { white-space: nowrap; font-size: clamp(18px, 1.6vw, 24px) !important; }
.kpi-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar { overflow-x: hidden; }
.sidebar .nav-link > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* PDF (print) */
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  :root { --bg: #fff; }
  html, body { background: #fff !important; }
  .sidebar, .scrim, .topbar-actions, .back-btn, .sec-nav, .card-h .right, .tbl-tools input, .btn.more, .menu-btn { display: none !important; }
  .main { margin-left: 0 !important; }
  .topbar { position: static !important; border: 0; backdrop-filter: none; background: none !important; }
  .content { padding: 0 !important; gap: 10px; }
  .card { break-inside: avoid; backdrop-filter: none; box-shadow: none; }
  .scroll-y { max-height: none !important; overflow: visible !important; }
  .table-wrap { overflow: visible !important; }
  .pivot th { position: static !important; }
  table.pivot { font-size: 8.5px !important; width: 100%; }
  .rsec { break-before: auto; }
  body.print-one .rsec, body.print-one .topbar, body.print-one .hint:not(.vnote) { display: none !important; }
  body.print-one .rsec:has(.print-me) { display: flex !important; }
  body.print-one .rsec:has(.print-me) > *:not(.rgrid), body.print-one .rgrid > .card:not(.print-me) { display: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* compact page header: first filters next to the title */
.topbar { padding-top: 10px; padding-bottom: 10px; align-items: center; }
.topbar .subtitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 560px; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
.top-filters { display: contents; }
.filterbar.compact { gap: 8px; align-items: flex-end; flex-wrap: nowrap; }
.filterbar.compact > .fblock { background: none; border: 0; padding: 0; gap: 3px; }
.filterbar.compact > .fblock > span { font-size: 11px; color: var(--muted); }
.filterbar.compact input[type=date], .filterbar.compact select { min-height: 38px; padding: 6px 10px; font-size: 13px; }
.filterbar.compact .range input { width: 132px; }
.filterbar.compact .fblock select { min-width: 120px; max-width: 170px; }
.filterbar.compact .fblock.grow { flex: 0 1 auto; }
.content { padding-top: 16px; gap: 14px; }
#report { gap: 14px; }
.rsec { gap: 12px; }
.kpi-row { gap: 12px; }
.kpi-row .kpi { padding: 12px 14px 12px 68px; min-height: 76px; }
.kpi-ic { left: 14px; top: 16px; width: 40px; height: 40px; }
.kpi-row .kpi-value { margin-top: 2px; }
.rsec > .vnote, .rgrid .plain-card .vnote { margin-top: 4px; }
@media (max-width: 960px) { .filterbar.compact { flex-wrap: wrap; } .top-filters { display: block; width: 100%; } }
.sec-head { display: flex; align-items: flex-end; gap: 10px 20px; flex-wrap: wrap; margin-top: 10px; }
.sec-head .section-title { margin: 0 auto 4px 0; font-size: 17px; }
.sec-head .filterbar.compact { flex-wrap: wrap; justify-content: flex-end; }
.topbar-actions .filterbar.compact { flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.topbar-actions { flex-wrap: nowrap; }
.org-switch select { max-width: 150px; }
.topbar > div:nth-child(3) { flex: 1 1 auto; min-width: 180px; }
@media (max-width: 1280px) { .topbar-actions { flex-wrap: wrap; } }
/* sticky table header: nothing may scroll above it */
.card-b.scroll-y { padding-top: 0; margin-top: 12px; }
.scroll-y .pivot thead th { position: sticky; top: 0; z-index: 4; background: var(--panel-solid); box-shadow: 0 1px 0 var(--border-2); }
.scroll-y .pivot thead th:first-child { left: 0; z-index: 5; }
.tbl-tools { position: sticky; left: 0; }
.plain-card.with-filters { display: flex; gap: 12px; align-items: stretch; }
.plain-card.with-filters > .card-b { flex: 1; min-width: 0; }
.kpi-filters { flex: none; padding: 10px 14px; display: flex; align-items: center; }
.kpi-filters .filterbar.compact { flex-direction: column; align-items: stretch; gap: 6px; flex-wrap: nowrap; }
.kpi-filters .range { flex-direction: column; align-items: stretch; gap: 4px; }
.kpi-filters .range > span { display: none; }
.kpi-filters .range input { width: 150px; min-height: 30px !important; padding: 3px 8px !important; }
.kpi-filters select { min-height: 30px !important; padding: 3px 8px !important; }
@media (max-width: 960px) { .plain-card.with-filters { flex-direction: column; } .kpi-filters .range { flex-direction: row; } }
.kpi-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi-row .kpi { padding: 12px 10px 12px 60px; min-width: 0; }
.kpi-ic { left: 12px; width: 38px; height: 38px; }
.kpi-row .kpi-value { font-size: clamp(16px, 1.3vw, 22px) !important; overflow: hidden; text-overflow: ellipsis; }
/* assistant */
.ai-wrap { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; height: calc(100vh - 130px); }
.ai-list { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.ai-chat { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-size: 13px; font-weight: 500; }
.ai-chat:hover { background: var(--panel-2); text-decoration: none; } .ai-chat.on { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text); }
.ai-usage { padding: 6px 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.ai-bar { height: 6px; border-radius: 4px; background: var(--panel-2); margin-top: 6px; overflow: hidden; } .ai-bar i { display: block; height: 100%; background: var(--accent); }
.ai-main { display: flex; flex-direction: column; min-height: 0; }
.ai-msgs { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; line-height: 1.5; font-size: 14px; }
.ai-msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.ai-msg.bot { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ai-msg pre, .ai-tool pre { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; background: var(--panel-solid); border: 1px solid var(--border); border-radius: 8px; padding: 8px; max-height: 320px; overflow: auto; margin: 6px 0 0; }
.ai-msg ul { margin: 4px 0; padding-left: 20px; }
.ai-tool { align-self: flex-start; font-size: 12px; color: var(--muted); max-width: 90%; }
.ai-tool summary { cursor: pointer; }
.ai-note { align-self: center; font-size: 12px; color: var(--warn); text-align: center; }
.ai-input { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); }
.ai-input textarea { flex: 1; resize: none; min-height: 48px; }
.ai-foot { display: flex; align-items: center; gap: 8px; padding: 0 14px 10px; }
.ai-dots::after { content: "…"; animation: aidots 1.2s infinite steps(4); display: inline-block; width: 1em; overflow: hidden; vertical-align: bottom; }
@keyframes aidots { 0% { width: 0 } 100% { width: 1em } }
pre.diff ins { color: var(--good); text-decoration: none; } pre.diff del { color: var(--bad); text-decoration: none; }
@media (max-width: 960px) { .ai-wrap { grid-template-columns: 1fr; height: auto; } .ai-list { max-height: 180px; } .ai-msgs { min-height: 50vh; } }
.ai-t { width: auto; margin: 6px 0; font-size: 13px; } .ai-t td, .ai-t th { padding: 4px 10px; }
/* a wide answer table never widens the chat: it wraps, and scrolls inside its own bubble only if it must (22.10) */
.ai-msgs { overflow-x: hidden; } .ai-msg, .ai-tool, .ai-note { flex-shrink: 0; } .ai-msg { overflow-wrap: anywhere; }
.ai-msg .ai-t { display: block; max-width: 100%; overflow-x: auto; }
.ai-panel .ai-t { font-size: 12.5px; } .ai-panel .ai-t td, .ai-panel .ai-t th { padding: 4px 6px; white-space: normal; }
/* assistant side panel (right) */
:root { --ai-w: 390px; }
.ai-panel { position: fixed; top: 0; right: 0; bottom: 0; width: var(--ai-w); z-index: 45; display: flex; flex-direction: column;
  background: var(--panel-solid); border-left: 1px solid var(--border); transform: translateX(100%); transition: transform .22s ease; }
.ai-open .ai-panel { transform: none; box-shadow: -20px 0 50px -30px rgba(0,0,0,.5); }
@media (min-width: 1200px) { .ai-open .main { margin-right: var(--ai-w); } }
.main { transition: margin .22s ease; }
.ai-ph { display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px; border-bottom: 1px solid var(--border); }
.ai-logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.ai-logo svg { width: 20px; height: 20px; }
.busy .ai-logo { animation: aipulse 1.2s ease-in-out infinite; }
@keyframes aipulse { 50% { transform: scale(.9); opacity: .75; } }
.ai-title { font-weight: 700; font-size: 15px; }
.ai-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ai-sub i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.busy .ai-sub i { background: var(--warn); }
.ai-tools { margin-left: auto; display: flex; gap: 4px; }
.ai-tools .icon-btn { width: 32px; height: 32px; font-size: 15px; text-decoration: none; }
.ai-panel .ai-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-panel .ai-msg { max-width: 92%; font-size: 13.5px; }
.ai-panel .ai-msg ol { margin: 6px 0; padding-left: 20px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 0; }
.ai-chips button { all: unset; cursor: pointer; font-size: 12px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border-2); color: var(--text-2); }
.ai-chips button:hover { border-color: var(--accent); color: var(--text); }
.ai-pin { display: flex; gap: 8px; align-items: flex-end; margin: 10px 14px 4px; padding: 6px; border: 1px solid var(--border-2); border-radius: 14px; background: var(--panel-2); }
.ai-pin textarea { border: 0; background: none; box-shadow: none !important; resize: none; min-height: 38px; max-height: 140px; padding: 8px; font-size: 14px; }
.ai-send { all: unset; cursor: pointer; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 50%, var(--accent-2))); flex: none; }
.ai-send svg { width: 18px; height: 18px; } .ai-send[disabled] { opacity: .5; cursor: default; }
.ai-usage-txt { padding: 0 16px 10px; font-size: 11px; }
@media print { .ai-panel { display: none !important; } .ai-open .main { margin-right: 0 !important; } }
.kpi-row .kpi-value { text-overflow: clip; font-size: clamp(15px, 1.2vw, 22px) !important; }
.ai-open .kpi-row { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.ai-open .kpi-row .kpi { padding-left: 54px; }
.ai-open .kpi-row .kpi-ic { width: 32px; height: 32px; left: 11px; }
.ai-open .kpi-row .kpi-value { font-size: clamp(14px, .95vw, 20px) !important; }
.ai-open .kpi-row .kpi-label { font-size: 11px; }
.ai-open .kpi-row .kpi { padding-left: 12px; padding-right: 8px; }
.ai-open .kpi-row .kpi-ic { display: none; }
.ai-open .kpi-row .kpi-value { font-size: clamp(14px, 1.05vw, 20px) !important; }
.ai-pin, .ai-input { flex-wrap: wrap; position: relative; }
.ai-thumbs { flex-basis: 100%; display: flex; gap: 6px; padding: 2px 4px; }
.ai-thumb { position: relative; width: 64px; height: 48px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-2); }
.ai-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ai-thumb button { all: unset; cursor: pointer; position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; font-size: 9px;
  display: grid; place-items: center; background: rgba(0,0,0,.65); color: #fff; }
.ai-attach { all: unset; cursor: pointer; width: 36px; height: 40px; display: grid; place-items: center; color: var(--muted); flex: none; align-self: flex-end; }
.ai-attach:hover { color: var(--accent); } .ai-attach svg { width: 19px; height: 19px; }
.ai-shot { display: block; max-width: 100%; max-height: 220px; border-radius: 8px; margin-bottom: 6px; border: 1px solid rgba(255,255,255,.25); }
.ai-panel.drag, .ai-main.drag { outline: 2px dashed var(--accent); outline-offset: -6px; }
.ai-pin textarea, .ai-input textarea { flex: 1; min-width: 0; }
.brand-row { display: flex; align-items: center; gap: 8px; }
.brand-row .brand { flex: 1; min-width: 0; }
.brand-row .side-toggle { width: 32px; height: 32px; flex: none; }
.brand-row .side-toggle svg { width: 16px; height: 16px; }
@media (min-width: 961px) {
  .side-mini .brand-row { flex-direction: column; gap: 10px; }
  .side-mini .brand-row .brand { flex: none; }
}

/* «Скрипты»: Airflow-like grid of the last runs */
.run-grid { display: flex; gap: 2px; }
.gc { display: inline-block; width: 11px; height: 11px; border-radius: 2px; background: var(--border); flex: none; }
a.gc:hover { outline: 2px solid var(--text); outline-offset: 1px; }
.gc.success { background: #16a34a; } .gc.failed { background: #dc2626; } .gc.timeout { background: #ea580c; }
.gc.running, .gc.queued { background: #2563eb; animation: pulse 1.2s infinite; } .gc.cancelled { background: #9ca3af; }
.gc.warning, .gc.warn { background: #eab308; }
.grid-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.grid-legend .gc { margin-left: 8px; }
.jobs-t td { vertical-align: middle; padding-top: 5px; padding-bottom: 5px; line-height: 1.3; }
.jobs-t .switch { transform: scale(.8); }
.jobs-t .btn.sm { padding: 4px 8px; }

/* ---------- ChatGPT-like layout: sidebar with its own head (logo + collapse), one top line per page ---------- */
.ab-mark { height: 26px; padding: 0 7px; border-radius: 7px; display: grid; place-items: center; font: 800 12px var(--mono); flex: none;
  color: #04121a; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.sidebar { padding-top: 0; }
.side-head { position: sticky; top: 0; z-index: 2; margin: 0 -14px 4px; padding: 10px 10px 10px 18px; min-height: 52px;
  background: rgb(9, 14, 28); border-bottom: 1px solid var(--border); }
:root[data-theme="light"] .side-head { background: #fff; }
.side-head .brand { padding: 0; gap: 9px; text-decoration: none !important; color: inherit; }
.side-head .brand-name { font-size: 15px; }
.side-head .side-toggle { width: 32px; height: 32px; border: 0; background: none; }
.side-head .side-toggle:hover { background: var(--panel-2); }
.side-mini .side-head { margin: 0 -12px 4px; padding: 10px 0; flex-direction: column; gap: 6px; }
.side-mini .side-head .brand-name { display: none; }
/* the page top line: title on the left; page actions, AI, organization, profile on the right */
.topbar { min-height: 52px; padding-top: 6px !important; padding-bottom: 6px !important; }
.topbar h1 { font-size: 18px; line-height: 1.2; }
.topbar .crumb { font-size: 11px; }
.topbar .back-btn { width: 32px; height: 32px; }
.ab-right { display: flex; align-items: center; gap: 8px; padding-left: 8px; margin-left: 4px; border-left: 1px solid var(--border); }
.ab-right svg { width: 16px; height: 16px; }
.ab-ai { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 9px; text-decoration: none !important;
  color: #fff; font-weight: 600; font-size: 13px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.ab-ai:hover, .ai-open .ab-ai, .ab-ai.on { filter: brightness(1.12); box-shadow: 0 0 14px -4px var(--accent); }
.ab-count { background: #fff; color: #0b1424; border-radius: 999px; font-size: 11px; padding: 0 6px; line-height: 16px; }
.ab-org { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 4px 0 10px; border-radius: 9px;
  background: var(--panel-2); border: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.ab-org > span { padding-right: 8px; }
.ab-org svg { color: var(--accent); }
.ab-org select { all: unset; cursor: pointer; padding: 0 22px 0 2px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a96a8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 4px center / 14px no-repeat; }
.ab-org select option { color: #111; background: #fff; }
.ab-me { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 14px; text-decoration: none !important;
  color: #fff; background: #1d6f87; flex: none; }
.ab-me:hover, .ab-me.on { background: #2389a6; }
@media (max-width: 960px) {
  .ab-org select { max-width: 120px; }
  .ab-right { border-left: 0; padding-left: 0; margin-left: 0; }
}
@media print { .ab-right { display: none !important; } }
/* one header strip: the sidebar head and the page top line share the background, no dividing line */
:root { --head-bg: rgb(9, 14, 28); }
:root[data-theme="light"] { --head-bg: #fff; }
.side-head { background: var(--head-bg); border-bottom: 0; min-height: 56px; }
.topbar { background: var(--head-bg) !important; backdrop-filter: none; border-bottom: 0; min-height: 56px; }
/* «Скачать» → PowerPoint / PDF */
.dl-pop { right: 0; left: auto; width: 270px; padding: 6px; }
.dl-item { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.dl-item:hover { background: var(--panel-2); }
.dl-item span { display: flex; flex-direction: column; line-height: 1.25; }
.dl-item small { color: var(--muted); font-size: 12px; }
.dl-ic { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 11px; flex: none; }
.dl-ic.pptx { background: #c4462b; font-size: 15px; } .dl-ic.pdf { background: #d6312b; }
/* top line: no divider, evenly spaced buttons */
.ab-right { border-left: 0; padding-left: 0; margin-left: 0; }

/* ---------- tables (Power BI-like matrix): light-blue header and groups, «+» boxes, pastel % cells ---------- */
:root { --tb-head: #e6eefb; --tb-grp: #eef4fd; --tb-line: #e3e8f0; --tb-plus: #2563eb;
        --pc-good: #d3f4dd; --pc-warn: #fbf1c2; --pc-bad: #fbdcdc; --pc-ink: #1f2937; }
:root:not([data-theme="light"]) { --tb-head: #16233a; --tb-grp: #121d31; --tb-line: #1e2a40; --tb-plus: #5b9dff;
        --pc-good: rgba(34,197,94,.22); --pc-warn: rgba(234,179,8,.22); --pc-bad: rgba(239,68,68,.24); --pc-ink: var(--text); }
table.pivot { border-collapse: separate; border-spacing: 0; }
.pivot td, .pivot th { border-bottom: 1px solid var(--tb-line); }
.pivot td + td, .pivot th + th { border-left: 1px solid var(--tb-line); }
.pivot th, .scroll-y .pivot thead th { background: var(--tb-head) !important; color: var(--text); font-weight: 700; text-align: center; vertical-align: middle;
  border-bottom: 1px solid var(--tb-line); box-shadow: none; padding-top: 9px; padding-bottom: 9px; }
.pivot th:first-child { text-align: left; }
.pivot td { padding-top: 7px; padding-bottom: 7px; }
.pivot td.num { font-variant-numeric: tabular-nums; }
.pivot tr.grp td, .pivot tr.grp td:first-child { background: var(--tb-grp); font-weight: 700; border-top: 0; }
.pivot tbody tr:hover td { background: color-mix(in srgb, var(--tb-plus) 7%, var(--panel-solid)); }
.pivot tr.grp:hover td { background: color-mix(in srgb, var(--tb-plus) 10%, var(--tb-grp)); }
.pivot td .nil { color: var(--muted); }
/* toggles: chevron for an open level, «+» in a blue box for a closed one */
.pivot .tw { width: 18px; height: 18px; border-radius: 4px; margin-right: 10px; vertical-align: -3px; font: 700 15px/1 var(--font);
  color: var(--tb-plus); border: 1.5px solid var(--tb-plus); background: transparent; }
.pivot .tw.open { border-color: transparent; color: var(--text-2); }
.pivot .tw svg { width: 16px; height: 16px; }
.pivot .tw:hover { background: color-mix(in srgb, var(--tb-plus) 12%, transparent); }
/* % cells: the whole cell is tinted */
.pivot td.pct, :root[data-theme="light"] .pivot td.pct { color: var(--pc-ink); font-weight: 600; }
.pivot td.pct.good, :root[data-theme="light"] .pivot td.pct.good { background: var(--pc-good); color: var(--pc-ink); }
.pivot td.pct.warn, :root[data-theme="light"] .pivot td.pct.warn { background: var(--pc-warn); color: var(--pc-ink); }
.pivot td.pct.bad,  :root[data-theme="light"] .pivot td.pct.bad  { background: var(--pc-bad);  color: var(--pc-ink); }
.pivot tfoot td { background: var(--tb-head); border-top: 0; }

/* ---------- «Период» box: same size and look as a KPI tile, dates «от — до» on one line ---------- */
.plain-card.with-filters { align-items: stretch; }
.kpi-filters { padding: 18px 20px; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 0; }
.kpi-filters .filterbar.compact { gap: 0; }
.kpi-filters .fblock > span:first-child { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi-filters .range { flex-direction: row; align-items: center; gap: 6px; margin-top: 8px; }
.kpi-filters .range > span { display: inline; }
.kpi-filters .range input { width: 128px; }
/* period tile: like a KPI tile; «от — до» in a popover */
.plain-card.with-filters, .kpi-filters { overflow: visible; }
.kpi-filters { position: relative; padding: 18px 20px; min-width: 0; }
.period-btn { all: unset; cursor: pointer; display: flex; align-items: center; gap: 8px; margin-top: 8px; font: 600 15px var(--mono);
  color: var(--text); white-space: nowrap; border-bottom: 1px dashed var(--border-2); padding-bottom: 2px; }
.period-btn:hover { color: var(--accent); border-bottom-color: var(--accent); }
.period-btn svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.kpi-filters .range.period-pop { display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; margin: 0;
  padding: 12px; gap: 8px; align-items: center; background: var(--panel-solid); border: 1px solid var(--border-2); border-radius: 12px;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,.35); }
.kpi-filters.open .range.period-pop { display: flex; }
.kpi-filters .range.period-pop input { width: 140px; }
.pivot tfoot td:first-child { background: var(--tb-head); }
.period-btn { font: 700 15px var(--font); letter-spacing: -.01em; }
.plain-card.with-filters { position: relative; z-index: 6; }
.kpi-filters { flex: 0 0 auto; }
#downloadMenu { min-width: 0; }
/* period tile: «от — до» side by side inside the tile, same height as the KPI tiles */
.kpi-filters .range, .kpi-filters .range.period-pop { display: flex; position: static; flex-direction: row; align-items: center; gap: 6px;
  margin-top: 8px; padding: 0; background: none; border: 0; box-shadow: none; }
.kpi-filters .range > span { display: inline; }
.kpi-filters .range input, .kpi-filters .range.period-pop input { width: 122px; font-size: 13px; min-height: 32px !important; padding: 3px 6px !important; }
/* KPI values stay whole next to the wider period tile */
.with-filters .kpi-row { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.with-filters .kpi-row .kpi { padding: 12px 10px 12px 54px; }
.with-filters .kpi-ic { left: 12px; top: 18px; width: 32px; height: 32px; border-radius: 9px; }
.with-filters .kpi-ic svg { width: 17px; height: 17px; }
.with-filters .kpi-row .kpi-value { font-size: clamp(15px, 1.35vw, 25px); white-space: nowrap; }
.with-filters .kpi-row .kpi-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-filters { padding: 18px 16px; }
.kpi-filters .range input, .kpi-filters .range.period-pop input { width: 116px; }
@media (max-width: 1700px) {
  .with-filters .kpi-ic { display: none; }
  .with-filters .kpi-row .kpi { padding-left: 14px; }
  .with-filters .kpi-row .kpi-value { font-size: clamp(15px, 1.3vw, 24px); }
}
.kpi-filters { padding: 12px 16px; justify-content: center; }
.kpi-filters .range { margin-top: 6px; }
.kpi-filters .range input, .kpi-filters .range.period-pop input { min-height: 30px !important; }
.with-filters .kpi-row { align-items: stretch; }
.kpi-filters { align-self: flex-start; padding: 10px 16px; min-height: 80px; box-sizing: border-box; }
.with-filters .kpi-row .kpi { min-height: 80px; box-sizing: border-box; }
/* hover hints for column / KPI names */
[data-tip] { cursor: help; }
th[data-tip] { text-decoration: underline dotted color-mix(in srgb, var(--text-2) 55%, transparent); text-underline-offset: 3px; }
.tip-box { position: fixed; z-index: 100; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.45; white-space: pre-line;
  color: #f1f5f9; background: #111827; box-shadow: 0 12px 30px -10px rgba(0,0,0,.45); pointer-events: none; }
/* chart totals line */
.ctot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: -4px 0 10px; font-size: 13px; color: var(--text-2); }
.ctot b { color: var(--text); font-weight: 700; margin-left: 2px; }
.ctot i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.ctot-h { font-weight: 600; color: var(--text); }
/* chart cards: «График / Таблица» */
.view-seg button { padding: 4px 10px; font-size: 12px; }
.card .vtable { display: none; }
.card.as-table .vtable { display: block; }
.card.as-table .vbody.chart { position: absolute !important; left: -99999px; width: 100%; }
.card.as-table .card-b { position: relative; }
@media print { .view-seg { display: none !important; } }
/* period tile: no dash between the dates, narrower tile → wider KPI tiles */
.kpi-filters .range > span { display: none !important; }
.kpi-filters .range { gap: 6px; }
.kpi-filters { padding-left: 12px; padding-right: 12px; }
.kpi-filters .range input, .kpi-filters .range.period-pop input { width: 112px; padding: 3px 5px !important; }
.kpi-filters .range input[type=date] { width: 112px !important; min-width: 0 !important; flex: none; }

/* ---------- light theme background: soft blue–lavender gradient, no grid; glassy sidebar/header, white cards ---------- */
:root[data-theme="light"] body {
  background-color: #eef3fb;
  background-image:
    radial-gradient(900px 600px at 100% 0%, rgba(167, 139, 250, .16), transparent 62%),
    radial-gradient(1000px 700px at 0% 100%, rgba(56, 189, 248, .14), transparent 60%),
    radial-gradient(800px 500px at 55% 45%, rgba(255, 255, 255, .55), transparent 70%),
    linear-gradient(160deg, #f4f7fd 0%, #eaf1fb 45%, #eef0fb 100%);
  background-size: auto; background-attachment: fixed;
}
:root[data-theme="light"] { --head-bg: rgba(244, 248, 254, .93); }
:root[data-theme="light"] .sidebar { background: rgba(255, 255, 255, .5); border-right: 0; backdrop-filter: blur(16px); }
:root[data-theme="light"] .side-head { background: transparent; }
:root[data-theme="light"] .topbar { backdrop-filter: blur(14px); }
:root[data-theme="light"] .card { background: #fff; border-color: rgba(214, 224, 240, .7);
  box-shadow: 0 1px 2px rgba(16, 38, 84, .04), 0 10px 28px -12px rgba(30, 64, 140, .14); backdrop-filter: none; }
:root[data-theme="light"] .card.plain-card { background: transparent; border: 0; box-shadow: none; }
:root[data-theme="light"] .kpi-row .kpi, :root[data-theme="light"] .kpi-filters { background: #fff; }
/* sidebar stands out from the page: solid white with a soft edge shadow */
:root[data-theme="light"] .sidebar { background: rgba(255, 255, 255, .94); border-right: 1px solid rgba(206, 218, 238, .9);
  box-shadow: 4px 0 24px -12px rgba(30, 64, 140, .18); }
:root[data-theme="light"] .side-head { background: rgba(255, 255, 255, .94); }
/* stronger lavender in the page gradient; thicker sidebar divider */
:root[data-theme="light"] body {
  background-image:
    radial-gradient(1000px 700px at 100% 0%, rgba(167, 139, 250, .30), transparent 62%),
    radial-gradient(900px 650px at 45% 110%, rgba(196, 181, 253, .26), transparent 65%),
    radial-gradient(1000px 700px at 0% 100%, rgba(56, 189, 248, .12), transparent 60%),
    linear-gradient(160deg, #f3f5fd 0%, #ebeffb 45%, #eeeafb 100%);
}
:root[data-theme="light"] .sidebar { border-right: 2px solid #c9d3e6; }
/* light theme: tinted sidebar; the page top line separated by a line and a soft shadow */
:root[data-theme="light"] .sidebar { background: linear-gradient(180deg, #eceefd 0%, #e7ecfb 55%, #ece8fb 100%); border-right: 2px solid #c9d0e8; }
:root[data-theme="light"] .side-head { background: #eceefd; }
:root[data-theme="light"] .sidebar .nav-link:hover { background: rgba(255, 255, 255, .6); }
:root[data-theme="light"] .sidebar .nav-link.active { background: #fff; }
:root[data-theme="light"] .topbar { background: rgba(255, 255, 255, .96) !important; border-bottom: 2px solid #d3daea;
  box-shadow: 0 6px 18px -12px rgba(30, 64, 140, .25); }
/* sidebar and top line: one tone, a few shades lighter than the page background */
:root[data-theme="light"] { --chrome-bg: #f6f7fe; }
:root[data-theme="light"] .sidebar, :root[data-theme="light"] .side-head { background: var(--chrome-bg); }
:root[data-theme="light"] .topbar { background: var(--chrome-bg) !important; }
:root[data-theme="light"] .sidebar .nav-link.active { background: #fff; }
:root[data-theme="light"] .sidebar .nav-link:hover { background: #eceffc; }
/* sidebar and top line: white */
:root[data-theme="light"] { --chrome-bg: #ffffff; }
:root[data-theme="light"] .sidebar .nav-link.active { background: #eef1fd; }
:root[data-theme="light"] .sidebar .nav-link:hover { background: #f3f5fd; }
/* section title as a Power BI-like banner across the page; the section filters on the line below */
.sec-head { flex-wrap: wrap; row-gap: 12px; }
.sec-head .section-title { flex: 1 0 100%; margin: 26px 0 0; padding: 12px 20px; border: 0; border-radius: 12px; text-align: center;
  font-size: 24px; font-weight: 800; letter-spacing: .01em; color: #fff; background: linear-gradient(90deg, #1e2a52, #27356a 50%, #1e2a52);
  box-shadow: 0 10px 26px -14px rgba(20, 30, 80, .55); }
.sec-head .filterbar { margin-left: 0; justify-content: flex-start; }
:root:not([data-theme="light"]) .sec-head .section-title { background: linear-gradient(90deg, #17224a, #22306a 50%, #17224a); }
@media (max-width: 960px) { .sec-head .section-title { font-size: 18px; padding: 10px 14px; } }
/* section banner in the site's blue–violet */
.sec-head .section-title, :root:not([data-theme="light"]) .sec-head .section-title {
  background: linear-gradient(90deg, #2563eb 0%, #4f46e5 50%, #7c3aed 100%); box-shadow: 0 10px 26px -14px rgba(79, 70, 229, .6); }

/* section filters: one white card, labels above, big rounded controls with chevrons, a calendar icon on dates */
.sec-head .filterbar { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 18px; padding: 12px 18px 14px;
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 1px 2px rgba(16,38,84,.04), 0 10px 26px -16px rgba(30,64,140,.2); }
.sec-head .filterbar .fblock { flex: 1 1 180px; min-width: 160px; max-width: 280px; gap: 6px; }
.sec-head .filterbar .fblock > span:first-child { font-size: 14px; font-weight: 500; color: var(--text-2); text-transform: none; letter-spacing: 0; }
.sec-head .filterbar select, .sec-head .filterbar input[type=date] { height: 42px; min-height: 42px !important; border-radius: 12px !important;
  border: 1px solid var(--border-2); background-color: var(--panel-solid); font-size: 14px; font-weight: 500; }
.sec-head .filterbar select { appearance: none; -webkit-appearance: none; padding: 0 36px 0 14px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; }
.sec-head .filterbar input[type=date] { position: relative; width: 100%; padding: 0 12px 0 40px !important; cursor: pointer;
  background: color-mix(in srgb, var(--sel, #2f6fe4) 7%, var(--panel-solid)) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e3a8a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") no-repeat 13px center / 18px;
  border-color: color-mix(in srgb, #2f6fe4 35%, var(--border-2)); }
.sec-head .filterbar input[type=date]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; opacity: 0; cursor: pointer; }
.sec-head .filterbar .range { gap: 8px; }
.sec-head .filterbar .range input[type=date] { width: 150px; }
.sec-head .filterbar .fblock:has(.range) { max-width: 360px; flex-basis: 320px; }
:root:not([data-theme="light"]) .sec-head .filterbar select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.sec-head .filterbar.compact, .sec-head .filterbar { justify-content: flex-start !important; }
.sec-head .filterbar .fblock { flex: 1 1 200px; max-width: 300px; }
/* section banner: no fill, a brand-gradient border (the AI button colours), gradient text */
.sec-head .section-title, :root:not([data-theme="light"]) .sec-head .section-title {
  position: relative; background: none; box-shadow: none; color: #4338ca; isolation: isolate; }
.sec-head .section-title::before { content: ""; position: absolute; inset: 0; border-radius: 12px; padding: 2px; pointer-events: none;
  background: linear-gradient(90deg, #2563eb, #4f46e5 50%, #7c3aed);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.sec-head .section-title { background-image: linear-gradient(90deg, #2563eb, #4f46e5 50%, #7c3aed); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; }
:root:not([data-theme="light"]) .sec-head .section-title { background-image: linear-gradient(90deg, #60a5fa, #818cf8 50%, #a78bfa); }
:root .sec-head .section-title, :root:not([data-theme="light"]) .sec-head .section-title {
  -webkit-background-clip: text !important; background-clip: text !important; -webkit-text-fill-color: transparent; }
/* section banner: white fill, black text, brand-gradient border */
:root .sec-head .section-title, :root:not([data-theme="light"]) .sec-head .section-title {
  background: #fff !important; -webkit-background-clip: border-box !important; background-clip: border-box !important;
  -webkit-text-fill-color: #0b1220; color: #0b1220; }

/* ===================== phones ===================== */
@media (max-width: 700px) {
  .content { padding: 12px 12px 40px; gap: 12px; }
  /* top line: title row + one scrollable row of buttons; scrolls away with the page */
  .topbar { position: static !important; flex-wrap: wrap; gap: 8px; padding: 8px 12px !important; min-height: 0; }
  .topbar .crumb { display: none; }
  .topbar h1 { font-size: 17px; }
  .topbar > div:nth-child(3) { flex: 1 1 auto; min-width: 0; }
  .topbar .menu-btn, .topbar .back-btn { width: 36px; height: 36px; }
  .topbar-actions { flex: 1 0 100%; order: 3; justify-content: flex-start; flex-wrap: nowrap !important; overflow-x: auto; gap: 6px; padding-bottom: 2px; }
  .topbar-actions .btn, .topbar-actions .seg > button { min-height: 34px; padding: 4px 10px; font-size: 13px; }
  .ab-right { margin-left: auto; gap: 6px; }
  .ab-ai, .ab-me, .ab-org { height: 34px; }
  .ab-me { width: 34px; }
  .ab-org select { max-width: 110px; }
  /* period tile full width, dates side by side */
  .plain-card.with-filters { flex-direction: column; }
  .kpi-filters { width: 100%; min-height: 0; }
  .kpi-filters .range { width: 100%; }
  .kpi-filters .range input[type=date] { flex: 1 1 0; width: auto !important; min-width: 0 !important; }
  /* KPI tiles: two per row, compact */
  .with-filters .kpi-row, .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  .kpi-row .kpi, .with-filters .kpi-row .kpi { padding: 10px 12px !important; min-height: 0 !important; }
  .kpi-row .kpi-ic { display: none; }
  .kpi-row .kpi-label { font-size: 12px; }
  .kpi-row .kpi-value { font-size: 18px !important; }
  /* cards and their header controls */
  .card-h { padding: 12px 12px 0; gap: 8px; }
  .card-h h2 { font-size: 14px; flex: 1 1 100%; }
  .card-h .right { margin-left: 0; flex-wrap: wrap; gap: 6px; }
  .card-h .right .btn.sm, .card-h .right .seg > button { padding: 4px 8px; font-size: 12px; }
  .card-b { padding: 10px 12px 12px; }
  /* section titles and filters: two filters per row */
  .sec-head .section-title { font-size: 17px; padding: 9px 12px; margin-top: 16px; }
  .sec-head .filterbar { padding: 10px 12px 12px; gap: 8px 10px; }
  .sec-head .filterbar .fblock { flex: 1 1 calc(50% - 10px) !important; min-width: 0 !important; max-width: none !important; }
  .sec-head .filterbar .fblock:has(input[type=date]) { flex-basis: 100% !important; }
  .sec-head .filterbar .fblock > span:first-child { font-size: 12px; }
  .sec-head .filterbar select, .sec-head .filterbar input[type=date] { height: 38px; min-height: 38px !important; font-size: 13px; }
  .sec-head .filterbar .range input[type=date] { width: auto; flex: 1 1 0; min-width: 0; }
  /* tables: smaller and denser, scroll sideways with the name column fixed */
  table.pivot { font-size: 11.5px !important; }
  .pivot td, .pivot th { padding: 5px 7px; }
  .pivot td:first-child { max-width: 150px; }
  .pivot .tw { width: 16px; height: 16px; margin-right: 6px; font-size: 13px; }
  .pivot tr.sub td:first-child { padding-left: 22px; }
  .pivot tr.sub2 td:first-child { padding-left: 34px; }
  .ai-panel { width: 100vw; }
}
@media (max-width: 700px) {
  .topbar-actions > * { flex: none; }
  .topbar-actions .seg { display: inline-flex; }
}
@media (max-width: 700px) {
  .sec-head, .sec-head > * { min-width: 0; max-width: 100%; }
  .sec-head .filterbar { width: 100%; }
  .sec-head .filterbar .fblock:has(.range), .sec-head .filterbar .fblock:has(.seg) { flex-basis: 100% !important; }
  .sec-head .filterbar .range { display: flex; width: 100%; }
  .sec-head .filterbar .range input[type=date] { flex: 1 1 0 !important; width: 0 !important; min-width: 0 !important; padding-left: 34px !important; background-position: 10px center !important; }
  .sec-head .filterbar .seg { max-width: 100%; overflow-x: auto; }
  .sec-head .filterbar select { width: 100%; }
}
@media (max-width: 700px) {
  #topFilters:empty { display: none !important; }
  .topbar-actions #downloadMenu, .topbar-actions .ms { width: auto !important; min-width: 0 !important; }
}

/* «Скрипты»: 7 larger squares + last-run column */
.jobs-t .run-grid { gap: 4px; }
.jobs-t .run-grid .gc { width: 20px; height: 20px; border-radius: 4px; }
.jobs-t td.last-run { white-space: nowrap; }
.jobs-t td.last-run a { font-weight: 600; color: var(--text); }

/* CRM Sync: «Сопоставления» and client hints */
.client-hint { margin-top: 6px; font-size: 14px; line-height: 1.45; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); color: var(--text); border: 1px solid var(--border-2); }
.client-hint.muted { color: var(--text-2, var(--text)); }
.client-hint b { color: var(--accent); }
.client-hint svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.map-t tr.map-missing td { background: color-mix(in srgb, var(--bad, #dc2626) 8%, transparent); }
.map-t tr.map-empty td { color: var(--text-3, #8a94a6); }
.map-filter { height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); width: 200px; }

/* «Интеграции»: one table, groups as separator rows, fixed columns so every group lines up */
.ints-t { table-layout: fixed; width: 100%; min-width: 1060px; }
.ints-t col.c-name { width: 30%; } .ints-t col.c-on { width: 64px; } .ints-t col.c-grid { width: 200px; }
.ints-t col.c-last { width: 21%; } .ints-t col.c-state { width: 16%; } .ints-t col.c-next { width: 104px; }
.ints-t td.mono { white-space: nowrap; } .ints-t col.c-act { width: 84px; }
.ints-t td { overflow: hidden; }
.ints-t td.nm a, .ints-t td.nm .muted, .ints-t .ell { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ints-t td.nm a { font-weight: 600; } .ints-t td.nm .muted { font-size: 12px; }
.ints-t tr.grp td { background: var(--surface-2, rgba(127,127,127,.06)); font-size: 13px; padding-top: 10px; padding-bottom: 10px; white-space: nowrap; text-overflow: ellipsis; }
.ints-t tbody + tbody tr.grp td { border-top: 8px solid var(--surface, transparent); }
.ints-t tr.off td:not(:nth-child(2)) { opacity: .55; }
.bot-state { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 13px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.bot-state.up { background: rgba(22,163,74,.12); color: var(--good); } .bot-state.down { background: rgba(220,38,38,.12); color: var(--bad); }
.recon .ex-form { margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.recon .ex-btn { opacity: .55; } .recon tr:hover .ex-btn { opacity: 1; }
.prob-count { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 13px; font-size: 13px; font-weight: 600; white-space: nowrap; background: rgba(22,163,74,.12); color: var(--good); }
.prob-count.has { background: rgba(234,88,12,.12); color: var(--warn); }

/* report filters: multi-select (checkbox list with search) styled like the select it replaces */
.rms { min-width: 170px; }
.rms .ms-btn { font: inherit; color: var(--text); background: var(--panel-solid); border: 1px solid var(--border-2); border-radius: 10px;
  padding: 0 12px; min-height: 38px; width: 100%; }
.rms.has .ms-btn { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.rms .ms-pop { z-index: 60; }
.rms .ms-item { font-size: 13px; }

/* names in report tables that set the section filter on click */
.xf { cursor: pointer; border-bottom: 1px dashed transparent; }
.xf:hover { color: var(--accent); border-bottom-color: currentColor; }
.xf.on { color: var(--accent); font-weight: 700; border-bottom: 1px solid currentColor; }
.sw-row { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.sw-item { display: flex; gap: 12px; align-items: center; }
.run-chart { width: 100%; overflow: hidden; }
.run-chart .rc-grid { stroke: var(--border); stroke-width: 1; }
.run-chart .rc-limit { stroke: #eab308; stroke-width: 1.5; stroke-dasharray: 5 4; }
.run-chart .rc-ax { fill: var(--muted); font-size: 11px; font-family: inherit; }
.run-chart rect:hover { opacity: .8; }
.run-chart .rc-date { font-size: 10px; opacity: .8; }

/* section banner («Детальный отчёт по продажам» …): a plain card like the charts — card background, theme text */
.sec-head .section-title, :root .sec-head .section-title, :root:not([data-theme="light"]) .sec-head .section-title {
  background: var(--panel-solid) !important; background-image: none !important; color: var(--text) !important;
  -webkit-text-fill-color: currentColor !important; -webkit-background-clip: border-box !important; background-clip: border-box !important;
  border: 1px solid var(--border) !important; box-shadow: 0 1px 2px rgba(16,38,84,.04), 0 10px 26px -16px rgba(30,64,140,.2) !important;
  border-radius: 16px; text-align: center; font-size: 23px; font-weight: 800; padding: 14px 20px; }
.sec-head .section-title::before { display: none !important; }
/* light theme: the banner text is a soft slate, not pure black */
:root[data-theme="light"] .sec-head .section-title { color: #334155 !important; }
/* button filters (seg) take their own width and never overlap the next filter; buttons wrap on narrow screens */
.sec-head .filterbar .fblock:has(.seg) { flex: 0 1 auto; max-width: 100%; min-width: 0; }
.sec-head .filterbar .seg { flex-wrap: wrap; max-width: 100%; height: auto; }

/* ======================================================================================================
   «Строгая» тема (data-look="strict" on top of the light theme): business look for finance —
   neutral greys, one navy accent, no gradients / glow / page grid, small radii, flat cards, Excel-like chart colours.
   ====================================================================================================== */
:root[data-look="strict"] {
  --bg: #f3f4f6; --bg-2: #f3f4f6; --grid: transparent;
  --panel: #ffffff; --panel-solid: #ffffff; --panel-2: #f6f7f9;
  --border: #dfe2e7; --border-2: #c9ced6;
  --text: #1f2933; --text-2: #4b5563; --muted: #6b7280;
  --accent: #1f3a5f; --accent-2: #1f3a5f; --accent-ink: #ffffff;
  --glow: none;
  --good: #2e7d4f; --bad: #b42318; --warn: #9a6700; --info: #1f3a5f;
  --series-1: #1f4e79; --series-2: #a5a5a5; --series-3: #9dc3e6;
  --series-4: #c55a11; --series-5: #548235; --series-6: #7f6000; --series-7: #5b7fa6; --series-8: #7f7f7f;
  --chart-grid: #e5e7eb;
  --radius: 6px;
}
:root[data-look="strict"] body, :root[data-look="strict"][data-theme="light"] body { background: var(--bg) !important; background-image: none !important; }
:root[data-look="strict"] .sidebar, :root[data-look="strict"][data-theme="light"] .sidebar { background: #ffffff !important; border-right: 1px solid var(--border) !important; box-shadow: none; }
:root[data-look="strict"] .side-head { background: #ffffff; }
:root[data-look="strict"] .card, :root[data-look="strict"] .sec-head .filterbar, :root[data-look="strict"] .sec-head .section-title {
  backdrop-filter: none !important; box-shadow: none !important; border-radius: var(--radius) !important; }
:root[data-look="strict"] .kpi::after, :root[data-look="strict"] .scanline, :root[data-look="strict"] .loading::after { display: none !important; }
/* monochrome navigation and controls */
:root[data-look="strict"] .nav-link.active { background: #eef1f5 !important; color: var(--accent) !important; box-shadow: none !important; }
:root[data-look="strict"] .nav-link.active::before { background: var(--accent) !important; box-shadow: none !important; }
:root[data-look="strict"] .btn.primary, :root[data-look="strict"] .ab-ai, :root[data-look="strict"] .ab-mark, :root[data-look="strict"] .brand-mark,
:root[data-look="strict"] .ai-logo, :root[data-look="strict"] .avatar {
  background: var(--accent) !important; background-image: none !important; color: #fff !important; box-shadow: none !important; filter: none !important; }
:root[data-look="strict"] .btn, :root[data-look="strict"] .chip, :root[data-look="strict"] .seg, :root[data-look="strict"] .seg button,
:root[data-look="strict"] input, :root[data-look="strict"] select, :root[data-look="strict"] .ms-btn, :root[data-look="strict"] .badge,
:root[data-look="strict"] .ab-org, :root[data-look="strict"] .ab-ai { border-radius: 4px !important; box-shadow: none !important; }
:root[data-look="strict"] .seg button.on, :root[data-look="strict"] .chip.on { background: var(--accent) !important; color: #fff !important; }
:root[data-look="strict"] .org-switch { background: #fff !important; background-image: none !important; }
/* KPI tiles: one neutral icon colour, values in ink, no coloured glow */
:root[data-look="strict"] .kpi-ic { --ic: #1f3a5f !important; color: #1f3a5f !important; background: #eef1f5 !important; border-radius: 4px !important; }
/* section banners: plain, smaller, uppercase like a report section header */
:root[data-look="strict"] .sec-head .section-title { font-size: 16px !important; font-weight: 700 !important; letter-spacing: .06em; text-transform: uppercase;
  color: #1f3a5f !important; text-align: left !important; padding: 12px 18px !important; }
/* tables: zebra-free, quiet header, muted % tints */
:root[data-look="strict"] .pivot th, :root[data-look="strict"] table.t th { background: #f3f4f6 !important; color: #374151 !important; }
:root[data-look="strict"] .pivot tr.grp td { background: #f6f7f9 !important; }
:root[data-look="strict"] .pivot td.pct.good { background: #e6f2ea !important; color: #1e5a36 !important; }
:root[data-look="strict"] .pivot td.pct.warn { background: #fbf3dc !important; color: #6b4c00 !important; }
:root[data-look="strict"] .pivot td.pct.bad { background: #f7e2e0 !important; color: #8a1c12 !important; }
/* run grid squares and statuses: same meaning, calmer tones */
:root[data-look="strict"] .gc.success { background: #4a8c62; } :root[data-look="strict"] .gc.failed { background: #b42318; }
:root[data-look="strict"] .gc.warn, :root[data-look="strict"] .gc.warning { background: #c9a227; }
/* theme preview card on the profile page */
.theme-preview.strict { background: #f3f4f6; border: 1px solid #c9ced6; } .theme-preview.strict i { background: #1f3a5f; }
:root[data-look="strict"] .sec-head .filterbar input[type=date], :root[data-look="strict"] input[type=date] {
  background-color: #ffffff !important; border-color: var(--border-2) !important; }
:root[data-look="strict"] .rms.has .ms-btn { border-color: var(--accent) !important; box-shadow: none !important; }

/* ======================================================================================================
   «Классическая (Power BI)» (data-look="pbi" on top of the light theme): like the old Power BI report —
   white page, navy section bars with bold white text, navy table headers, bright red / yellow / green % cells,
   charts: last year navy, plan yellow, fact green; visuals framed with a thin dark rounded border.
   ====================================================================================================== */
:root[data-look="pbi"] {
  --bg: #ffffff; --bg-2: #ffffff; --grid: transparent;
  --panel: #ffffff; --panel-solid: #ffffff; --panel-2: #f2f3f7;
  --border: #2b2b2b; --border-2: #9aa0ad;
  --text: #111827; --text-2: #3b4252; --muted: #6b7280;
  --accent: #232c5c; --accent-2: #232c5c; --accent-ink: #ffffff; --glow: none;
  --good: #2e8b3e; --bad: #c62828; --warn: #a37a00; --info: #232c5c;
  --series-1: #5aa83e; --series-2: #ffd447; --series-3: #252e63;
  --series-4: #e0603a; --series-5: #3f8fd2; --series-6: #8d6cc0; --series-7: #2e9e9e; --series-8: #7f7f7f;
  --chart-grid: #ececec; --radius: 18px;
}
:root[data-look="pbi"] body, :root[data-look="pbi"][data-theme="light"] body { background: #ffffff !important; background-image: none !important; }
:root[data-look="pbi"] .sidebar, :root[data-look="pbi"][data-theme="light"] .sidebar { background: #ffffff !important; border-right: 1px solid #d8dbe3 !important; }
:root[data-look="pbi"] .side-head { background: #ffffff; }
:root[data-look="pbi"] .card { backdrop-filter: none !important; box-shadow: none !important; border: 1px solid #2b2b2b !important; }
:root[data-look="pbi"] .kpi::after, :root[data-look="pbi"] .scanline { display: none !important; }
:root[data-look="pbi"] .kpi-row .card.kpi, :root[data-look="pbi"] .plain-card .card { border-color: transparent !important; }
:root[data-look="pbi"] .kpi-value { font-size: 25px !important; white-space: nowrap; font-weight: 400 !important; color: #111 !important; }
:root[data-look="pbi"] .kpi-ic { display: none !important; }
:root[data-look="pbi"] .card-h h2 { font-size: 17px; font-weight: 700; text-align: center; flex: 1; }
:root[data-look="pbi"] .sec-head .section-title { background: #232c5c !important; color: #ffffff !important; border: 0 !important;
  border-radius: 0 !important; font-size: 30px !important; font-weight: 800 !important; text-align: center !important; text-transform: none !important; }
:root[data-look="pbi"] .sec-head .filterbar { border: 0 !important; box-shadow: none !important; }
:root[data-look="pbi"] .pivot th, :root[data-look="pbi"] table.t th { background: #232c5c !important; color: #ffffff !important; font-weight: 700 !important; }
:root[data-look="pbi"] .pivot tr.grp td { background: #3d4778 !important; color: #ffffff !important; font-weight: 700 !important; }
:root[data-look="pbi"] .pivot td { border-color: #c9ccd6 !important; }
:root[data-look="pbi"] .pivot td.pct.good { background: #a8f0a8 !important; color: #111 !important; }
:root[data-look="pbi"] .pivot td.pct.warn { background: #ffff8a !important; color: #111 !important; }
:root[data-look="pbi"] .pivot td.pct.bad { background: #ef9a9a !important; color: #111 !important; }
:root[data-look="pbi"] .nav-link.active { background: #e9ebf3 !important; color: #232c5c !important; box-shadow: none !important; }
:root[data-look="pbi"] .nav-link.active::before { background: #232c5c !important; box-shadow: none !important; }
:root[data-look="pbi"] .btn.primary, :root[data-look="pbi"] .ab-ai, :root[data-look="pbi"] .ab-mark, :root[data-look="pbi"] .brand-mark,
:root[data-look="pbi"] .ai-logo, :root[data-look="pbi"] .seg button.on, :root[data-look="pbi"] .chip.on {
  background: #232c5c !important; background-image: none !important; color: #fff !important; box-shadow: none !important; filter: none !important; }
:root[data-look="pbi"] .sec-head .filterbar input[type=date] { background-color: #fff !important; }
.theme-preview.pbi { background: #ffffff; border: 1px solid #2b2b2b; } .theme-preview.pbi i:nth-child(1) { background: #252e63; }
.theme-preview.pbi i:nth-child(2) { background: #ffd447; } .theme-preview.pbi i:nth-child(3) { background: #5aa83e; }

/* ======================================================================================================
   «Saber» (data-look="saber" on top of the dark theme): the Saber Energy Drink can — black, brushed gold / copper
   accent, thin gold lines; charts: fact gold, plan red, last year green (the can colours).
   ====================================================================================================== */
:root[data-look="saber"] {
  --bg: #050505; --bg-2: #0a0a0a; --grid: transparent;
  --panel: rgba(17, 16, 14, .92); --panel-solid: #11100e; --panel-2: rgba(32, 28, 22, .85);
  --border: rgba(232, 163, 61, .16); --border-2: rgba(232, 163, 61, .32);
  --text: #f4efe6; --text-2: #c9bda6; --muted: #8b8070;
  --accent: #e8a33d; --accent-2: #c46a1f; --accent-ink: #120c03;
  --glow: 0 0 0 1px rgba(232, 163, 61, .3), 0 8px 34px -12px rgba(232, 163, 61, .45);
  --good: #3fb46a; --bad: #e5484d; --warn: #f0b429; --info: #e8a33d;
  --series-1: #e8a33d; --series-2: #d23a2c; --series-3: #2f9a52;
  --series-4: #f3d27a; --series-5: #9c6b2f; --series-6: #c9bda6; --series-7: #7c2a20; --series-8: #6b6b6b;
  --chart-grid: rgba(232, 163, 61, .10);
}
:root[data-look="saber"] body { background: #050505 !important;
  background-image: radial-gradient(1100px 520px at 80% -8%, rgba(232, 163, 61, .14), transparent 60%),
                    radial-gradient(900px 500px at -5% 105%, rgba(196, 106, 31, .10), transparent 60%) !important; }
:root[data-look="saber"] .sidebar { background: linear-gradient(180deg, #0b0a08, #050505) !important; border-right: 1px solid rgba(232, 163, 61, .22) !important; }
:root[data-look="saber"] .side-head { background: #0b0a08 !important; }
:root[data-look="saber"] .brand-mark, :root[data-look="saber"] .ab-mark, :root[data-look="saber"] .ab-ai, :root[data-look="saber"] .ai-logo,
:root[data-look="saber"] .btn.primary, :root[data-look="saber"] .seg button.on, :root[data-look="saber"] .chip.on {
  background: linear-gradient(135deg, #f3c26b, #e8a33d 45%, #b8691f) !important; color: #120c03 !important; }
:root[data-look="saber"] .ab-count { background: #120c03; color: #f3c26b; }
:root[data-look="saber"] .kpi::after { background: linear-gradient(90deg, transparent, #e8a33d, transparent) !important; opacity: .9; }
:root[data-look="saber"] .kpi-ic { --ic: #e8a33d !important; color: #e8a33d !important; }
:root[data-look="saber"] .nav-link.active { background: rgba(232, 163, 61, .10) !important; color: #f3c26b !important; }
:root[data-look="saber"] .nav-link.active::before { background: #e8a33d !important; box-shadow: 0 0 10px #e8a33d !important; }
:root[data-look="saber"] .sec-head .section-title { color: #f3c26b !important; text-transform: uppercase; letter-spacing: .12em;
  font-size: 18px !important; border: 1px solid rgba(232, 163, 61, .35) !important;
  background: linear-gradient(90deg, rgba(232, 163, 61, .04), rgba(232, 163, 61, .12), rgba(232, 163, 61, .04)) !important; }
:root[data-look="saber"] .pivot th, :root[data-look="saber"] table.t th { background: #1a160f !important; color: #f3c26b !important; }
:root[data-look="saber"] .pivot tr.grp td { background: #17140e !important; color: #f4efe6 !important; }
:root[data-look="saber"] .rms.has .ms-btn { border-color: #e8a33d !important; box-shadow: 0 0 0 1px #e8a33d inset !important; }
.theme-preview.saber { background: #050505; border: 1px solid #e8a33d; } .theme-preview.saber i:nth-child(1) { background: #e8a33d; }
.theme-preview.saber i:nth-child(2) { background: #d23a2c; } .theme-preview.saber i:nth-child(3) { background: #2f9a52; }
/* report tables: column resize handle on the right edge of every header */
.pivot thead th .col-rsz { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 3; }
.pivot thead th .col-rsz:hover, body.col-resizing .pivot thead th .col-rsz { background: color-mix(in srgb, var(--accent) 45%, transparent); }
body.col-resizing, body.col-resizing * { cursor: col-resize !important; user-select: none !important; }
/* «Классическая»: section bars with rounded corners like the cards */
:root[data-look="pbi"] .sec-head .section-title { border-radius: 14px !important; }
/* equipment map */
.eq-map { border-radius: 10px; overflow: hidden; z-index: 0; }
.eq-map .leaflet-control-layers { font: 12px var(--font); line-height: 1.7; }
.eq-map .leaflet-popup-content { font: 13px/1.45 var(--font); }
:root[data-theme="dark"] .eq-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
.nav-new { margin-left: auto; font-style: normal; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 1px 7px; border-radius: 999px; color: #fff; background: #16a34a; line-height: 16px; }
.side-mini .nav-new { display: none; }
/* «новое» badge: the logo gradient on light themes; a glowing outline of the same gradient on dark themes */
.nav-new { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
:root[data-theme="dark"] .nav-new { background: rgba(255,255,255,.04); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent); box-shadow: 0 0 10px -2px var(--accent); }
:root[data-look="saber"] .nav-new { color: #f3c26b; border-color: rgba(232,163,61,.7); box-shadow: 0 0 10px -2px #e8a33d; }
:root[data-look="strict"] .nav-new, :root[data-look="pbi"] .nav-new { background: var(--accent); }
/* KPI tiles: titles and notes wrap inside the tile instead of running out of it */
.kpi-label, .with-filters .kpi-row .kpi-label { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; line-height: 1.3; }
.kpi-value { overflow-wrap: anywhere; }
.kpi-delta { white-space: normal; overflow-wrap: anywhere; }

/* data bars inside table cells (col.bar) */
td.bar-cell { position: relative; }
td.bar-cell i { position: absolute; left: 0; top: 18%; bottom: 18%; background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 0 4px 4px 0; }
td.bar-cell span { position: relative; font-weight: 600; }

/* compact report pages (Report(compact=True)): less air, larger numbers, readable 13–14 px tables */
.rep-compact .rgrid { gap: 12px !important; }
.rep-compact .rsec { margin-bottom: 4px; }
.rep-compact .card-h { padding: 12px 16px 4px !important; min-height: 0; }
.rep-compact .card-h h2 { font-size: 15px !important; }
.rep-compact .card-b { padding: 8px 16px 12px !important; }
.rep-compact .sec-head { margin-bottom: 10px; gap: 10px; }
.rep-compact .sec-head .section-title { margin-top: 14px !important; padding: 9px 16px !important; font-size: 18px !important; }
.rep-compact .sec-head .filterbar { padding: 8px 14px 10px !important; gap: 6px 14px !important; }
.rep-compact .sec-head .filterbar .fblock > span:first-child { font-size: 12px !important; }
.rep-compact .sec-head .filterbar select, .rep-compact .sec-head .filterbar input[type=date], .rep-compact .rms .ms-btn { height: 36px !important; min-height: 36px !important; }
.rep-compact .kpi-row { gap: 12px !important; }
.rep-compact .kpi { padding: 12px 14px 12px 60px !important; min-height: 0 !important; }
.rep-compact .kpi-ic { width: 36px !important; height: 36px !important; left: 12px !important; top: 14px !important; }
.rep-compact .kpi-label { font-size: 12.5px !important; font-weight: 600; }
.rep-compact .kpi-value { font-size: 26px !important; line-height: 1.15; margin-top: 2px; }
.rep-compact .kpi-delta { font-size: 12px !important; margin-top: 2px; }
.rep-compact table.pivot { font-size: 13.5px; }
.rep-compact table.pivot td, .rep-compact table.pivot th { padding-top: 6px !important; padding-bottom: 6px !important; }
.rep-compact .vnote { font-size: 12px; margin-top: 4px; }
.rep-compact .funnel-row { grid-template-columns: 190px 1fr; margin: 8px 0; }
.rep-compact .funnel-bar { height: 34px; font-size: 14px; }
.rep-compact .kpi { padding: 12px 14px !important; }
.rep-compact .kpi-ic { display: none !important; }
.rep-compact .kpi-value { font-size: 24px !important; white-space: nowrap; }
/* half-width tables of compact pages: do not shrink the font below 12.5 px — scroll sideways instead */
.rep-compact table.pivot.flat { font-size: 13px !important; }
.rep-compact table.pivot.flat td { white-space: normal; }
.rep-compact table.pivot.flat td:first-child { max-width: 160px; }
.rep-compact .funnel-row { grid-template-columns: 170px 1fr; margin: 5px 0; }
.rep-compact .funnel-bar { height: 28px; font-size: 13px; }
/* horizontal stacked bars of a half-width chart: scroll inside the card instead of a very tall card */
/* quick period buttons under a date range */
.rpresets { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.rpresets button { font: inherit; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border-2); background: transparent; color: var(--text-2); cursor: pointer; }
.rpresets button:hover { color: var(--text); border-color: var(--accent); }
.rpresets button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
/* date filters: «Период» (from — to) or «День» (row of days) — the inactive one is dimmed */
.fmode { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.fmode input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.fb-range.inactive .range { opacity: .4; }
.dsrow { flex: 1 1 100% !important; display: flex; align-items: center; gap: 8px; min-width: 0; padding-top: 4px; }
.dsrow:not(.active) .ds-days, .dsrow:not(.active) .ds-month { opacity: .45; }
.dsrow .fmode { font-size: 13px; color: var(--text-2); flex: none; }
.ds-month { display: flex; align-items: center; gap: 4px; flex: none; font-size: 13px; }
.ds-month b { min-width: 104px; text-align: center; }
.ds-month button, .ds-scroll { font: inherit; border: 1px solid var(--border-2); background: transparent; color: var(--text-2); border-radius: 8px; padding: 4px 9px; cursor: pointer; flex: none; }
.ds-scroll { font-size: 11px; }
.ds-days { display: flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
.ds-days::-webkit-scrollbar { display: none; }
.ds-days button { font: inherit; font-size: 13px; font-weight: 600; flex: 0 0 38px; padding: 3px 0 4px; border-radius: 8px; border: 1px solid var(--border-2);
  background: var(--panel-solid); color: var(--text); cursor: pointer; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.ds-days button small { font-size: 9.5px; font-weight: 500; color: var(--muted); }
.ds-days button.sun { color: var(--bad); }
.ds-days button.today { border-color: var(--accent); }
.ds-days button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ds-days button.on small { color: inherit; opacity: .8; }
.ds-days button:disabled { opacity: .3; cursor: default; }
.ds-days button:not(:disabled):hover { border-color: var(--accent); }
.sec-head, .sec-head .filterbar, .rsec { min-width: 0; max-width: 100%; }
.sec-head .filterbar .dsrow { max-width: 100% !important; width: 100%; overflow: hidden; }
.dsrow .ds-days { width: 0; }
/* one row of filters on a normal screen: selects shrink down to 130 px before wrapping */
.sec-head .filterbar .fblock:not(.fb-range):not(:has(.seg)) { flex: 1 1 140px !important; min-width: 130px !important; max-width: 240px !important; }
.sec-head .filterbar .fb-range { flex: 0 0 auto !important; max-width: none !important; }
.sec-head .filterbar .fb-range .range input[type=date] { width: 140px; }
.sec-head .filterbar .rms { min-width: 0 !important; width: 100%; }
/* all list filters stay in the first row next to the period: they share the remaining width (down to 96 px each) */
.sec-head .filterbar .fblock:not(.fb-range):not(:has(.seg)) { flex: 1 1 0 !important; min-width: 96px !important; max-width: 260px !important; }
.sec-head .filterbar .fb-range .range input[type=date] { width: 132px; }
.sec-head .filterbar .fblock > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-head .filterbar .rms .ms-btn .label { min-width: 0; }
.sec-head .filterbar .fb-range .range input[type=date] { width: 142px; padding-left: 34px !important; padding-right: 6px !important; background-position: 10px center !important; }
.sec-head .filterbar .fblock:has(.range) { flex: 0 0 auto !important; max-width: none !important; min-width: 0 !important; }
.sec-head .filterbar .fblock:has(.range) .range input[type=date] { width: 142px; padding-left: 34px !important; padding-right: 6px !important; background-position: 10px center !important; }

/* «День агента» */
.ad-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-bottom: 10px; font-size: 14px; }
.ad-legend { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: 12px; color: var(--text-2); }
.ad-legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.dot.o, .ad-pin.o { background: #16a34a; } .dot.n, .ad-pin.n { background: #94a3b8; } .dot.s, .ad-pin.s { background: #dc2626; }
.ad-wrap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 960px) { .ad-wrap { grid-template-columns: 1fr; } }
.ad-map { height: 640px; border-radius: 10px; overflow: hidden; z-index: 0; }
.ad-pin { width: 26px; height: 26px; border-radius: 50%; color: #fff; font: 700 12px/26px var(--font); text-align: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.ad-feed { height: 640px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.ad-item { display: flex; gap: 10px; padding: 10px; border: 1px solid var(--border); border-left: 4px solid #94a3b8; border-radius: 10px; background: var(--panel-solid); cursor: pointer; }
.ad-item.has-o { border-left-color: #16a34a; } .ad-item.sus { border-left-color: #dc2626; }
.ad-item.hl { box-shadow: 0 0 0 2px var(--accent); }
.ad-num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--panel-2); font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.ad-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.ad-row1 { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ad-amt { margin-left: auto; font-weight: 700; color: var(--good); } .ad-noorder { margin-left: auto; color: var(--muted); font-size: 12px; }
.ad-client { font-weight: 600; }
.ad-flags { color: var(--bad); font-size: 12px; font-weight: 600; }
.ad-comment, .ad-nophoto { font-size: 12px; }
.ad-photos { display: flex; gap: 6px; flex-wrap: wrap; }
.ad-photos img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; cursor: zoom-in; border: 1px solid var(--border); }
.ad-review { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.ad-review .rv { font-weight: 700; } .ad-review .rv.ok { color: var(--good); } .ad-review .rv.bad { color: var(--bad); }
#lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.85); display: none; place-items: center; cursor: zoom-out; }
#lightbox.on { display: grid; } #lightbox img { max-width: 94vw; max-height: 94vh; border-radius: 8px; }
:root[data-theme="dark"] .ad-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }

/* dashboard widgets: rings (donut gauges) and segmented progress bars */
.rings { display: flex; flex-wrap: wrap; justify-content: space-around; gap: 14px 10px; padding: 4px 0; }
.ring { display: flex; flex-direction: column; align-items: center; width: 132px; text-align: center; }
.ring svg { width: 116px; height: 116px; }
.ring-bg { fill: none; stroke: color-mix(in srgb, var(--text) 9%, transparent); stroke-width: 9; }
.ring-fg { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.ring-val { fill: var(--text); font: 800 21px var(--font); text-anchor: middle; }
.ring-sub2 { fill: var(--muted); font: 600 10px var(--font); text-anchor: middle; }
.ring-t { margin-top: 4px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); }
.ring-sub { font-size: 11.5px; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.prog { display: flex; flex-direction: column; gap: 9px; padding: 2px 0; }
.prog-row { display: grid; grid-template-columns: minmax(90px, 180px) 1fr 74px; gap: 12px; align-items: center; }
.prog-t { font-size: 12.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.prog-bar { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; }
.prog-bar i { height: 16px; border-radius: 2px; background: color-mix(in srgb, var(--text) 8%, transparent); }
.prog-v { text-align: right; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
:root[data-look="strict"] .ring-fg, :root[data-look="pbi"] .ring-fg, :root[data-look="strict"] .prog-bar i, :root[data-look="pbi"] .prog-bar i { filter: none !important; box-shadow: none !important; }
.ring { width: 116px; } .ring svg { width: 100px; height: 100px; }
.rings { gap: 10px 6px; }

/* compact dashboard pages (Report(compact=True)): dense 6-column grid, smaller cards, rings and bars */
.rgrid.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .rgrid.g6 > .card { grid-column: span 6 !important; } }
.rep-compact .rsec { margin-bottom: 14px; }
.rep-compact .rgrid.g6 > .card .card-h { padding: 10px 14px 0; gap: 8px; }
.rep-compact .rgrid.g6 > .card .card-h h2 { font-size: 13px; }
.rep-compact .rgrid.g6 > .card .card-b { padding: 8px 14px 12px; }
.rep-compact .rgrid.g6 > .card .card-h .right .icon-btn { width: 28px; height: 28px; }
.rep-compact .rgrid.g6 > .card .card-h .right .btn.sm { padding-top: 3px; padding-bottom: 3px; }
.rep-compact .rings { gap: 8px 4px; padding: 0; }
.rep-compact .ring { width: 104px; }
.rep-compact .ring svg { width: 78px; height: 78px; }
.rep-compact .ring-bg, .rep-compact .ring-fg { stroke-width: 8; }
.rep-compact .ring-val { font-size: 20px; }
.rep-compact .ring-t { font-size: 10.5px; margin-top: 2px; }
.rep-compact .ring-sub { font-size: 10.5px; line-height: 1.25; }
.rep-compact .prog { gap: 5px; }
.rep-compact .prog-row { grid-template-columns: minmax(80px, 150px) 1fr 58px; gap: 8px; }
.rep-compact .prog-t { font-size: 11px; }
.rep-compact .prog-bar { gap: 2px; }
.rep-compact .prog-bar i { height: 11px; }
.rep-compact .prog-v { font-size: 12.5px; }
.rep-compact .rgrid.g6 .kpi-row { gap: 8px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.rep-compact .rgrid.g6 .kpi-row .kpi { padding: 9px 10px 9px 52px; min-height: 62px; }
.rep-compact .rgrid.g6 .kpi-ic { left: 10px; top: 12px; width: 32px; height: 32px; }
.rep-compact .rgrid.g6 .kpi-ic svg { width: 17px; height: 17px; }
.rep-compact .rgrid.g6 .kpi-label { font-size: 11px; }
.rep-compact .rgrid.g6 .kpi-row .kpi-value { font-size: clamp(14px, 1.1vw, 19px) !important; }
.rep-compact .rgrid.g6 .kpi-delta { margin-top: 3px; font-size: 11px; }

/* CRM Sync «Действия» card */
.act-t tr.grp td { border-top: 2px solid var(--border-2); }
.act-t .seg > button { padding: 4px 10px; font-size: 12px; }
.start-date { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.start-date input[type=date] { min-height: 30px; padding: 3px 8px; }
.start-date.badge { gap: 6px; padding-top: 2px; padding-bottom: 2px; }
.start-date.badge input[type=date] { min-height: 26px; padding: 1px 6px; font-size: 12px; }
.start-date.badge .btn.sm { padding: 2px 8px; }
.ints-t tr.sys-head td { padding-top: 16px; border-top: 2px solid var(--border-2); font-size: 12.5px; }
.grp-tgl svg { transition: transform .15s ease; }
.grp-tgl.closed svg { transform: rotate(-90deg); }

/* tree tables: colour scale cells (PBI) keep dark ink on their light fill in every theme */
.pivot td.heat, :root[data-look] .pivot td.heat { color: #111 !important; font-weight: 600; }
.pivot tbody tr:hover td.heat { filter: brightness(.95); }
/* an expanded group below the top level gets a light subtotal shade */
.pivot tr.sub-open td { font-weight: 700; background: color-mix(in srgb, var(--accent) 6%, var(--panel-solid)); }
/* CRM Sync page: the next run shows seconds — keep the column wide enough, never cut it */
.ints-t col.c-next { width: 140px; }
.ints-t td.mono { overflow: visible; text-overflow: clip; }
/* CRM Sync «Проблемы»: search box and sortable headers */
.iss-search { display: flex; align-items: center; gap: 8px; }
.iss-search input { width: 280px; max-width: 100%; height: 36px; }
.iss-search a { text-decoration: none; padding: 0 4px; }
.th-sort { color: inherit; text-decoration: none; white-space: nowrap; }
.th-sort:hover, .th-sort.on { color: var(--text); }
@media (max-width: 560px) { .iss-search, .iss-search input { width: 100%; } }
/* user access: hide blocks of pages */
.hide-blocks { border: 1px solid var(--border-2); border-radius: 10px; padding: 6px 10px; margin-bottom: 6px; }
.hide-blocks summary { cursor: pointer; font-weight: 600; }
.hide-blocks .hb-sec { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.hide-blocks .hb-sec > div { flex-basis: 100%; }
