/* ============================================================
   Grapes NTA — dark theme on top of PinVideo tokens
   Reuses pv-* tokens; remaps surfaces/text to the dark-mode
   tokens (--pv-bg-video / --pv-bg-video-2 / --pv-white-*).
   ============================================================ */

:root {
  /* Re-map semantic tokens for dark mode */
  --bg-canvas:        #14131F;                 /* deeper page bg for contrast */
  --bg-surface:       var(--pv-bg-video);      /* #1B1A2A — cards */
  --bg-surface-2:     var(--pv-bg-video-2);    /* #212030 — toolbars, nested */
  --bg-surface-3:     #2A2940;                 /* hover / selected */
  --bg-input:         #15141F;
  --bg-overlay:       rgba(0,0,0,0.55);

  --fg-primary:       #FFFFFF;
  --fg-secondary:     var(--pv-gray-blue-main); /* #A1A4C4 */
  --fg-muted:         #6E6F8A;
  --fg-disabled:      rgba(255,255,255,0.30);
  --fg-on-grad:       #FFFFFF;

  --bd-soft:          rgba(255,255,255,0.06);
  --bd-default:       rgba(255,255,255,0.10);
  --bd-strong:        rgba(255,255,255,0.18);
  --bd-focus:         var(--pv-blue-main);

  /* Translucent surface accents — flip in light theme */
  --surf-1:           rgba(255,255,255,0.04);
  --surf-2:           rgba(255,255,255,0.06);
  --surf-3:           rgba(255,255,255,0.08);
  --surf-4:           rgba(255,255,255,0.12);
  --track:            rgba(255,255,255,0.06);
  --shimmer-a:        rgba(255,255,255,0.04);
  --shimmer-b:        rgba(255,255,255,0.10);
  --row-selected:     rgba(115,129,244,0.10);
  --chart-grid:       rgba(255,255,255,0.05);
  --chart-tip-translucent-bg: rgba(27, 26, 42, 0.18);
  --chart-tip-translucent-border: rgba(255, 255, 255, 0.16);

  /* Country choropleth */
  --country-map-ocean:  transparent;
  --country-map-empty:  rgba(161, 164, 196, 0.12);
  --country-map-tier-1: rgba(160, 175, 255, 0.30);
  --country-map-tier-2: rgba(126, 146, 248, 0.52);
  --country-map-tier-3: rgba(105, 122, 235, 0.72);
  --country-map-tier-4: rgba(82, 98, 210, 0.88);
  --country-map-tier-5: rgba(63, 74, 180, 0.96);
  --country-map-stroke:   rgba(8, 10, 22, 0.72);

  /* Status — keep brand reds/greens/yellows but tune yellow for dark */
  --st-success:       var(--pv-green-main);    /* #51D16D */
  --st-success-bg:    rgba(81,209,109,0.12);
  --st-warning:       #F0B400;                 /* readable on dark */
  --st-warning-bg:    rgba(240,180,0,0.14);
  --st-critical:      var(--pv-red-main);      /* #F04138 */
  --st-critical-bg:   rgba(240,65,56,0.14);
  --st-info:          var(--pv-blue-main);
  --st-info-bg:       rgba(115,129,244,0.14);

  /* Brand accent (kept from light mode) */
  --grad-primary:     var(--pv-gradient-primary);
  --accent:           var(--pv-blue-grad-to);  /* #6972F0 */
  --st-info-fg:       #A4ADFF;                 /* readable info text on dark */

  /* Compatibility aliases — pages historically used names that never
     existed in this app layer. Map them to the live semantic tokens so
     typography/surfaces don't silently fall back to browser defaults. */
  --bg-main:          var(--bg-canvas);
  --bg-secondary:     var(--bg-surface-2);
  --border-subtle:    var(--bd-soft);
  --fg-warning:       var(--st-warning);
  --surf-0:           var(--bg-surface);

  /* Type-scale aliases (PinVideo Figma names → declared pv tokens) */
  --pv-text-caption:         var(--pv-text-body-3);
  --pv-text-caption-1:       var(--pv-text-body-3);
  --pv-text-headline:        var(--pv-text-h1);
  --pv-text-headline-3-bold: var(--pv-text-h3);
  --pv-text-title-3:         var(--pv-text-h3);
  --pv-text-title-4:         var(--pv-text-h4);

  /* Control radii — snap UI to DS scale (was ad-hoc 7/10) */
  --radius-control:   var(--pv-radius-sm);   /* 8 — inputs, buttons */
  --radius-control-xs: var(--pv-radius-xs);  /* 4 — dense chips */

  /* Layout sizing */
  --sidebar-w:        248px;
  --sidebar-w-collapsed: 72px;
  --header-h:         64px;

  --theme-transition-duration: 0.35s;
  --theme-transition-easing: ease;
}

@media (prefers-reduced-motion: no-preference) {
  html.theme-transition,
  html.theme-transition *,
  html.theme-transition *::before,
  html.theme-transition *::after {
    transition:
      background-color var(--theme-transition-duration) var(--theme-transition-easing),
      color var(--theme-transition-duration) var(--theme-transition-easing),
      border-color var(--theme-transition-duration) var(--theme-transition-easing),
      box-shadow var(--theme-transition-duration) var(--theme-transition-easing),
      fill var(--theme-transition-duration) var(--theme-transition-easing),
      stroke var(--theme-transition-duration) var(--theme-transition-easing),
      outline-color var(--theme-transition-duration) var(--theme-transition-easing) !important;
  }

  html.theme-transition body,
  html.theme-transition .auth-screen,
  html.theme-transition .sidebar,
  html.theme-transition .header,
  html.theme-transition .main {
    transition:
      background var(--theme-transition-duration) var(--theme-transition-easing),
      background-color var(--theme-transition-duration) var(--theme-transition-easing),
      color var(--theme-transition-duration) var(--theme-transition-easing),
      border-color var(--theme-transition-duration) var(--theme-transition-easing),
      box-shadow var(--theme-transition-duration) var(--theme-transition-easing) !important;
  }
}

/* =====================================================
   LIGHT THEME — flip surfaces, text, borders, overlays.
   Keeps brand gradient, status colors, type scale, radii.
   ===================================================== */
[data-theme="light"] {
  --bg-canvas:        #ECEEF8;   /* slightly deeper than surface — gives separation */
  --bg-surface:       #FFFFFF;
  --bg-surface-2:     #F1F3FB;   /* pv-gray-blue-50 */
  --bg-surface-3:     #EAEDF8;
  --bg-input:         #FFFFFF;
  --bg-overlay:       rgba(30, 30, 30, 0.45);

  --fg-primary:       #1E1E1E;
  --fg-secondary:     #66667D;
  --fg-muted:         #A1A4C4;
  --fg-disabled:      #ACACB6;

  --bd-soft:          #EAEDF8;
  --bd-default:       #D7DBEF;
  --bd-strong:        #BDBCDB;

  --surf-1:           rgba(127, 127, 157, 0.05);
  --surf-2:           rgba(127, 127, 157, 0.09);
  --surf-3:           rgba(127, 127, 157, 0.13);
  --surf-4:           rgba(127, 127, 157, 0.18);
  --track:            rgba(127, 127, 157, 0.16);
  --shimmer-a:        rgba(127, 127, 157, 0.08);
  --shimmer-b:        rgba(127, 127, 157, 0.16);
  --row-selected:     rgba(115, 129, 244, 0.10);
  --chart-grid:       rgba(127, 127, 157, 0.14);
  --chart-tip-translucent-bg: rgba(255, 255, 255, 0.42);
  --chart-tip-translucent-border: rgba(189, 188, 219, 0.55);

  --country-map-ocean:  #FAF6F1;
  --country-map-empty:  #EDE4DA;
  --country-map-tier-1: #FFEBD4;
  --country-map-tier-2: #FFC894;
  --country-map-tier-3: #FFA54D;
  --country-map-tier-4: #F77800;
  --country-map-tier-5: #C45A00;
  --country-map-stroke: rgba(72, 42, 8, 0.72);

  --st-warning:       #D47F00;   /* darker yellow reads on light */
  --st-warning-bg:    rgba(212, 127, 0, 0.12);
  --st-info-bg:       rgba(115, 129, 244, 0.10);
  --st-info-fg:       #2A6FDB;
}
[data-theme="light"] body { background: var(--bg-canvas); }
[data-theme="light"] .sidebar { box-shadow: var(--pv-shadow-sidebar); border-right: 0; }
[data-theme="light"] .header { box-shadow: 0 1px 0 var(--bd-soft); }
[data-theme="light"] .nav-item--active {
  background: linear-gradient(180deg, rgba(126, 146, 248, 0.13) 0%, rgba(105, 114, 240, 0.13) 100%);
  color: var(--fg-primary);
}
[data-theme="light"] .nav-item--active .nav-item__icon { color: var(--pv-blue-grad-to); }
[data-theme="light"] .nav-sub--active { background: rgba(115, 129, 244, 0.10); color: var(--fg-primary); }
[data-theme="light"] .card { box-shadow: var(--pv-shadow-card); }
[data-theme="light"] .table-wrap, [data-theme="light"] .table-toolbar { box-shadow: var(--pv-shadow-card); }
[data-theme="light"] .badge--info { color: var(--st-info-fg); }
[data-theme="light"] .checkbox { background: var(--bg-surface); }
[data-theme="light"] .modal { box-shadow: var(--pv-shadow-popover); }

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--fg-primary);
  font: var(--pv-text-body-2);
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "tnum";
}
input, button, select, textarea { font-family: inherit; color: inherit; }

/* Scrollbars (subtle, on-brand) */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--surf-3);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--surf-4); background-clip: padding-box; }

/* ===================== App shell ===================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  grid-template-areas: "sidebar header" "sidebar main";
  height: 100vh;
  transition: grid-template-columns var(--pv-dur-base) var(--pv-ease-out);
}
.app[data-collapsed="true"] { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ===================== Sidebar ===================== */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-surface);
  border-right: 1px solid var(--bd-soft);
  display: flex;
  flex-direction: column;
  overflow: visible;
  position: relative;
  z-index: 20;
}
.sidebar__brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--bd-soft);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar__logo {
  width: 32px; height: 32px;
  border-radius: var(--radius-control);
  background: var(--grad-primary);
  color: var(--fg-on-grad);
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 16px -6px rgba(110,114,240,0.7);
}
.sidebar__wordmark {
  font: 800 17px/1 var(--pv-font-sans);
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.sidebar__wordmark-name { color: var(--fg-primary); }
.sidebar__wordmark-dot { color: var(--pv-red-main); }
.sidebar__wordmark .dot { width: 4px; height: 4px; border-radius: 999px; background: var(--pv-red-main); margin-left: 1px; display: inline-block; }
.sidebar__wordmark small {
  font: 700 10px/1 var(--pv-font-sans);
  letter-spacing: 0.12em;
  color: var(--fg-secondary);
  margin-left: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--surf-2);
}
.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 20px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-section { margin-top: 6px; }
.nav-section:first-child { margin-top: 0; }
.nav-section__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 10px 6px;
  cursor: pointer;
  user-select: none;
  color: var(--fg-muted);
}
.nav-section__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--fg-secondary);
}
.nav-section__head:hover { color: var(--fg-secondary); }
.nav-section__head--active { color: var(--fg-primary); }
.nav-section__label {
  flex: 1;
  font: var(--pv-text-body-3-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-section__chev {
  flex-shrink: 0;
  transition: transform var(--pv-dur-base) var(--pv-ease-out);
  color: var(--fg-muted);
}
.nav-section--open .nav-section__chev { transform: rotate(90deg); }
.nav-section__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--pv-dur-base) var(--pv-ease-out);
}
.nav-section--open .nav-section__body {
  max-height: 480px;
  padding-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--fg-secondary);
  cursor: pointer;
  font: var(--pv-text-body-2);
  user-select: none;
  transition: background var(--pv-dur-fast) var(--pv-ease-out), color var(--pv-dur-fast);
  white-space: nowrap;
  text-decoration: none;
}
a.nav-item:visited { color: var(--fg-secondary); }
a.nav-item--active:visited { color: var(--fg-primary); }
.nav-item__icon { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item__label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item__badge {
  font: var(--pv-text-body-3-bold);
  color: var(--fg-primary);
  background: var(--surf-4);
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 18px; text-align: center;
}
.nav-item:hover { background: var(--surf-1); color: var(--fg-primary); }
.nav-item--active {
  background: linear-gradient(180deg, rgba(126,146,248,0.18) 0%, rgba(105,114,240,0.18) 100%);
  color: var(--fg-primary);
  position: relative;
}
.nav-item--active::before {
  content: "";
  position: absolute;
  left: -12px; top: 8px; bottom: 8px; width: 3px;
  background: var(--grad-primary);
  border-radius: 0 4px 4px 0;
}
.nav-item--active .nav-item__icon { color: #B8C3FF; }

.nav-sub {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--fg-secondary);
  font: var(--pv-text-body-2);
  cursor: pointer;
  position: relative;
}
.nav-sub:hover { color: var(--fg-primary); background: var(--surf-1); }
.nav-sub--active { color: var(--fg-primary); background: rgba(115,129,244,0.12); }
.nav-sub--active::before {
  content: "";
  position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.app[data-collapsed="true"] .nav-item__label,
.app[data-collapsed="true"] .nav-section__label,
.app[data-collapsed="true"] .nav-section__chev,
.app[data-collapsed="true"] .nav-item__badge,
.app[data-collapsed="true"] .sidebar__wordmark,
.app[data-collapsed="true"] .nav-section__body { display: none; }
.app[data-collapsed="true"] .nav-item, .app[data-collapsed="true"] .nav-section__head { justify-content: center; padding: 9px 0; }
.app[data-collapsed="true"] .nav-section__head { display: none; }
.app[data-collapsed="true"] .sidebar__nav { padding: 14px 8px; }

.sidebar__footer {
  border-top: 1px solid var(--bd-soft);
  padding: 12px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  color: var(--fg-secondary);
  background: var(--bg-surface);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  position: relative;
  text-align: left;
  width: 100%;
}
.sidebar__footer:hover { color: var(--fg-primary); }
.sidebar__footer svg { transition: transform var(--pv-dur-base) var(--pv-ease-out); }
.app[data-collapsed="true"] .sidebar__footer svg { transform: rotate(180deg); }
.sidebar__footer-label { font: var(--pv-text-body-3-bold); white-space: nowrap; }
.sidebar__footer--collapsed { justify-content: center; }
.sidebar__footer--collapsed .sidebar__footer-label {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 10px;
  border: 1px solid var(--bd-default);
  border-radius: 6px;
  background: var(--bg-surface-3);
  color: var(--fg-primary);
  box-shadow: var(--pv-shadow-popover);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--pv-dur-fast);
  z-index: 30;
}
.sidebar__footer--collapsed:hover .sidebar__footer-label,
.sidebar__footer--collapsed:focus-visible .sidebar__footer-label { opacity: 1; }

/* ===================== Header ===================== */
.header {
  grid-area: header;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bd-soft);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 10;
  overflow: visible;
}
.header__breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--fg-secondary); font: var(--pv-text-body-2); white-space: nowrap; }
.header__breadcrumb .crumb-cur { color: var(--fg-primary); font-weight: 700; }
.header__breadcrumb .crumb-sep { color: var(--fg-muted); }

.header__search {
  flex: 1; max-width: 480px;
  position: relative;
}
.header__search input {
  width: 100%; height: 38px;
  background: var(--bg-input);
  border: 1px solid var(--bd-default);
  border-radius: 999px;
  padding: 0 14px 0 40px;
  color: var(--fg-primary);
  font: var(--pv-text-body-2);
  outline: none;
  transition: border-color var(--pv-dur-fast);
}
.header__search input::placeholder { color: var(--fg-muted); }
.header__search input:focus { border-color: var(--bd-focus); }
.header__search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--fg-muted); }
.header__search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font: var(--pv-text-body-3); color: var(--fg-muted);
  border: 1px solid var(--bd-default); border-radius: 6px;
  padding: 1px 6px;
  background: var(--surf-1);
}

.header__actions { display: flex; align-items: center; gap: 6px; margin-left: auto; overflow: visible; }
.header-filters {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}
.header-filters .time-pill,
.header-filters .direction-pill,
.header-filters .collector-pill {
  width: auto;
}
.icon-btn {
  width: 38px; height: 38px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--fg-secondary);
  cursor: pointer;
  display: grid; place-items: center;
  position: relative;
  transition: background var(--pv-dur-fast), color var(--pv-dur-fast), border-color var(--pv-dur-fast);
}
.icon-btn:hover { background: var(--surf-2); color: var(--fg-primary); }
.icon-btn--dot::after {
  content: ""; position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--st-critical);
  border: 2px solid var(--bg-surface);
}

/* Time filter pill */
.time-pill {
  display: flex; align-items: center; gap: 8px;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--bd-default);
  border-radius: 10px;
  color: var(--fg-primary);
  font: var(--pv-text-body-2);
  cursor: pointer;
  transition: border-color var(--pv-dur-fast);
}
.time-pill:hover { border-color: var(--bd-strong); }
.time-pill .live-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--st-success); box-shadow: 0 0 8px var(--st-success); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.35 } }
.time-pill__label {
  font: var(--pv-text-body-2-bold);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.time-pill__sep { color: var(--fg-muted); }
.time-pill__range { color: var(--fg-secondary); font-variant-numeric: tabular-nums; }
.time-pill--tz { min-width: 92px; justify-content: center; }

.period-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  min-width: 140px;
  max-width: 100%;
  padding: 0 10px;
  background: var(--bg-input);
  border: 1px solid var(--bd-default);
  border-radius: 10px;
  color: var(--fg-primary);
  font: var(--pv-text-body-2);
  cursor: pointer;
  transition: border-color var(--pv-dur-fast);
}
.period-select:hover { border-color: var(--bd-strong); }
.period-select__label {
  flex: 1;
  min-width: 0;
  text-align: left;
  font: var(--pv-text-body-2-bold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.time-filter--explorer {
  width: fit-content;
  max-width: 100%;
}
.time-filter__menu--explorer {
  padding: 8px;
  background: var(--bg-surface);
}

.timezone-filter { position: relative; }
.timezone-filter__menu { min-width: 280px; right: 0; left: auto; }
.timezone-filter__section { max-height: 360px; overflow: auto; }
.timezone-filter__hint {
  padding: 8px 12px 10px;
  color: var(--fg-muted);
  font: var(--pv-text-caption);
  border-bottom: 1px solid var(--bd-default);
}
.timezone-filter__option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.timezone-filter__option-label { font: var(--pv-text-body-2-bold); }
.timezone-filter__option-sub {
  color: var(--fg-muted);
  font: var(--pv-text-caption);
  font-variant-numeric: tabular-nums;
}

/* Direction filter — отдельная кнопка под периодом */
.direction-filter {
  position: relative;
  width: fit-content;
  max-width: 100%;
}
.direction-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  background: var(--bg-input);
  border: 1px solid var(--bd-default);
  border-radius: 10px;
  color: var(--fg-primary);
  font: var(--pv-text-body-3);
  cursor: pointer;
  transition: border-color var(--pv-dur-fast), background var(--pv-dur-fast);
}
.direction-pill:hover { border-color: var(--bd-strong); background: var(--surf-1); }

/* Collector filter */
.collector-filter {
  position: relative;
  width: fit-content;
  max-width: 100%;
}
.collector-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  max-width: 260px;
  padding: 0 10px;
  background: var(--bg-input);
  border: 1px solid var(--bd-default);
  border-radius: 10px;
  color: var(--fg-primary);
  font: var(--pv-text-body-3);
  cursor: pointer;
  transition: border-color var(--pv-dur-fast), background var(--pv-dur-fast);
}
.collector-pill:hover { border-color: var(--bd-strong); background: var(--surf-1); }
.collector-pill__label {
  font: var(--pv-text-body-2-bold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.collector-filter__menu > .time-filter__option {
  display: flex;
  align-items: center;
  gap: 8px;
}
.collector-filter__group + .collector-filter__group {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--bd-subtle);
}
.collector-filter__group {
  padding-left: 2px;
}
.collector-filter__location {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: var(--pv-text-body-3-bold);
  color: var(--fg-secondary);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.collector-filter__location:hover,
.collector-filter__location.is-active {
  background: var(--surf-1);
  color: var(--fg-primary);
}
.time-filter__option--nested {
  padding-left: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.time-filter__option--collector {
  margin-left: 18px;
  padding-left: 14px;
  border-left: 2px solid var(--bd-subtle);
  font: var(--pv-text-body-3);
}
.time-filter__option--collector.is-active {
  border-left-color: var(--accent, #6366f1);
}

.direction-pill__chips {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.direction-pill__chip {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  opacity: 0.22;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: opacity var(--pv-dur-fast), transform var(--pv-dur-fast);
}
.direction-pill__chip.is-on {
  opacity: 1;
  transform: scale(1.08);
}
.direction-pill__label {
  flex: 1;
  min-width: 0;
  text-align: left;
  font: var(--pv-text-body-3-bold);
  color: var(--fg-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.direction-filter--embedded,
.collector-filter--embedded {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  width: auto;
}
.direction-filter--chips {
  width: 100%;
}
.direction-filter__chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.direction-chip {
  padding: 4px 10px 4px 8px;
  font-size: 12px;
  gap: 6px;
}
.direction-chip__label {
  line-height: 1.2;
}
.direction-chip__remove {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.8;
  margin-left: 2px;
}
.direction-chip__remove:hover {
  opacity: 1;
}
.direction-filter__empty-hint {
  font: var(--pv-text-body-3);
  color: var(--fg-muted);
}
.direction-filter__add {
  position: relative;
}
.direction-filter__menu--portal {
  padding: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--bd-default);
  border-radius: 12px;
  box-shadow: var(--pv-shadow-popover);
}
.direction-picker-item {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--fg-primary);
  font: var(--pv-text-body-2);
  transition: background var(--pv-dur-fast), color var(--pv-dur-fast);
}
.direction-picker-item:hover:not(.is-disabled) {
  background: var(--surf-2);
}
.direction-picker-item.is-disabled {
  color: var(--fg-muted);
  cursor: default;
}
.explorer-filter-value-row .direction-filter--embedded {
  flex: 1 1 180px;
}
.direction-filter__menu,
.collector-filter__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 120;
  min-width: 248px;
  max-width: 320px;
  max-height: 360px;
  overflow: auto;
  padding: 6px;
  background: var(--bg-surface-2);
  border: 1px solid var(--bd-default);
  border-radius: 12px;
  box-shadow: var(--pv-shadow-popover);
}

.explorer-filters-panel {
  contain: none;
}

.explorer-filters-panel:has([aria-expanded="true"]) {
  z-index: 120;
}

.explorer-filters-panel .col:has([aria-expanded="true"]) {
  position: relative;
  z-index: 130;
}

.explorer-filters-panel__body {
  gap: 0;
}

.explorer-panel-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--bd-default);
}

.explorer-panel-section__head {
  font: var(--pv-text-body-3-bold);
  color: var(--fg-secondary);
}

.explorer-panel-section__empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font: var(--pv-text-body-3);
  color: var(--fg-muted);
  padding: 2px 0 4px;
}

.explorer-panel-section__add {
  display: flex;
  justify-content: flex-start;
  align-self: flex-start;
}

.explorer-filters-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--bd-default);
}

.explorer-filter-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  background: var(--surf-1);
  border: 1px solid var(--bd-soft);
  border-radius: 10px;
  container-type: inline-size;
}

.explorer-filter-row--warn {
  border-color: color-mix(in srgb, var(--st-warning) 55%, var(--bd-soft));
  background: color-mix(in srgb, var(--st-warning) 8%, var(--surf-1));
}

.explorer-filter-row__main {
  display: grid;
  grid-template-columns: 107px minmax(120px, 180px) minmax(120px, 148px) minmax(180px, 1fr) 26px;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.explorer-filter-row--first .explorer-filter-row__field,
.explorer-filter-row--first .explorer-filter-row__field-label {
  grid-column: 1 / 3;
}

.explorer-filter-row--first .explorer-filter-row__logic-placeholder {
  display: none;
}

.explorer-filter-row__logic,
.explorer-filter-row__logic-placeholder {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
}

.explorer-filter-row select.input {
  display: block;
  height: 32px;
  padding: 0 24px 0 8px;
  line-height: 30px;
  min-width: 0;
}

.explorer-filter-row select.input.explorer-filter-row__logic {
  min-width: 107px;
  padding: 0 26px 0 8px;
  font-size: 12px;
  text-align: left;
}

.explorer-filter-row__logic-placeholder {
  height: 1px;
}

.explorer-filter-row__field,
.explorer-filter-row__field-label {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.explorer-filter-row__field-label {
  font: var(--pv-text-body-2);
  color: var(--fg-primary);
  padding: 6px 8px;
}

.explorer-filter-row__op {
  grid-column: 3;
  grid-row: 1;
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  font-size: 12px;
}

.explorer-filter-row__value {
  grid-column: 4;
  grid-row: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.explorer-filter-row__value .explorer-filter-value-wrap,
.explorer-filter-row__value .explorer-entity-picker,
.explorer-filter-row__value .direction-filter--embedded,
.explorer-filter-row__value .collector-filter--embedded {
  flex: 1 1 auto;
  min-width: 0;
}

.explorer-filter-row__remove {
  grid-column: 5;
  grid-row: 1;
  width: 26px;
  height: 26px;
}

.explorer-filter-row__warn,
.explorer-filter-scope-hint {
  font: var(--pv-text-body-3);
  color: var(--fg-muted);
}

.explorer-filter-row__warn {
  color: var(--st-warning);
  padding-left: 2px;
}

.explorer-threshold-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.explorer-threshold-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  background: var(--surf-1);
  border: 1px solid var(--bd-soft);
  border-radius: 10px;
}

.explorer-threshold-row__main {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.explorer-threshold-row__agg {
  flex: 0 0 auto;
}

.explorer-threshold-row__agg button {
  padding: 6px 10px;
  font: var(--pv-text-body-3);
  white-space: nowrap;
}

.explorer-threshold-row__agg button.is-active {
  background: color-mix(in srgb, var(--accent) 20%, var(--surf-3));
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.explorer-threshold-row__metric {
  min-width: 180px;
  flex: 1 1 180px;
}

.explorer-threshold-row__op {
  min-width: 150px;
  flex: 0 0 150px;
}

.explorer-threshold-row__value {
  width: 88px;
  flex: 0 0 88px;
}

.explorer-threshold-row__unit,
.explorer-threshold-row__peak {
  min-width: 92px;
  flex: 0 0 92px;
}

.explorer-threshold-warning {
  font: var(--pv-text-body-3);
  color: var(--st-warning);
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--st-warning) 35%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--st-warning) 8%, transparent);
}

.explorer-threshold-feedback {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px 0;
}

.explorer-threshold-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.explorer-threshold-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--bd-soft);
  background: var(--surf-1);
  color: var(--fg-secondary);
  font: var(--pv-text-body-3);
  cursor: pointer;
}

.explorer-threshold-chip:hover {
  border-color: var(--bd-strong);
  color: var(--fg-primary);
}

.explorer-threshold-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--fg-secondary);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.explorer-filter-value-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.explorer-entity-picker {
  position: relative;
}

.explorer-entity-picker__clear {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 22px;
  height: 22px;
}

.explorer-entity-value__display {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  text-align: left;
  cursor: text;
  padding-right: 28px;
}

.explorer-entity-value__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: var(--pv-text-body-2);
  color: var(--fg-primary);
}

.explorer-entity-value__canonical {
  flex-shrink: 0;
  font: var(--pv-text-body-3);
  color: var(--fg-muted);
}

.explorer-entity-picker__menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-surface);
  border: 1px solid var(--bd-default);
  border-radius: 10px;
  z-index: 30;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--pv-shadow-popover);
}

.explorer-entity-picker__empty {
  padding: 10px;
  color: var(--fg-secondary);
  font: var(--pv-text-body-3);
}

.explorer-entity-picker__item {
  all: unset;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  cursor: pointer;
}

.explorer-entity-picker__item:hover {
  background: var(--surf-2);
}

.explorer-entity-picker__item-label {
  font: var(--pv-text-body-2);
  color: var(--fg-primary);
}

.explorer-entity-picker__item-sublabel {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}

.explorer-picker-group + .explorer-picker-group {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--bd-soft);
}

.explorer-picker-group__heading {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 4px 0 6px;
  padding: 6px 10px;
  font: var(--pv-text-body-3-bold);
  color: var(--fg-primary);
  background: var(--bg-surface-2);
  border-left: 3px solid var(--bd-strong);
  border-radius: 0 8px 8px 0;
  line-height: 1.35;
}

@container (max-width: 600px) {
  .explorer-filter-row__main {
    grid-template-columns: 107px minmax(0, 1fr) 104px 26px;
  }

  .explorer-filter-row__field,
  .explorer-filter-row__field-label {
    grid-column: 2;
  }

  .explorer-filter-row--first .explorer-filter-row__field,
  .explorer-filter-row--first .explorer-filter-row__field-label {
    grid-column: 1 / 3;
  }

  .explorer-filter-row__op {
    grid-column: 3;
    grid-row: 1;
  }

  .explorer-filter-row__value {
    grid-column: 1 / 5;
    grid-row: 2;
  }

  .explorer-filter-row__remove {
    grid-column: 4;
    grid-row: 1;
  }
}

.time-filter {
  position: relative;
  width: fit-content;
  max-width: 100%;
}
.time-filter__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 248px;
  background: var(--bg-surface-2);
  border: 1px solid var(--bd-default);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--pv-shadow-popover);
}
.time-filter__menu--fixed {
  position: fixed;
  top: auto;
  left: auto;
  z-index: 1300;
  display: flex;
  flex-direction: column;
}
.time-filter__menu--fixed.time-filter__menu--scrollable {
  overflow: hidden;
}
.time-filter__menu--scrollable .time-filter__section--options {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.time-filter__section { display: flex; flex-direction: column; gap: 2px; }
.time-filter__section--directions { gap: 4px; }
.time-filter__divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--bd-default);
}
.time-filter__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 2px;
  font: var(--pv-text-body-3-bold);
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.time-filter__link {
  border: none;
  background: none;
  padding: 0;
  font: var(--pv-text-body-3);
  color: var(--pv-blue-main, #7381F4);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}
.time-filter__link:hover { text-decoration: underline; }
.time-filter__option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-secondary);
  font: var(--pv-text-body-2);
  cursor: pointer;
  transition: background var(--pv-dur-fast), color var(--pv-dur-fast);
}
.time-filter__option:hover { background: var(--surf-2); color: var(--fg-primary); }
.time-filter__option.is-active {
  background: rgba(115, 129, 244, 0.15);
  color: var(--fg-primary);
}
[data-theme="light"] .time-filter__option.is-active {
  color: var(--accent);
}
.time-filter__menu:has(.time-filter__custom) {
  min-width: 280px;
}
.time-filter__back {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-secondary);
  font: var(--pv-text-body-2);
  cursor: pointer;
  transition: background var(--pv-dur-fast), color var(--pv-dur-fast);
}
.time-filter__back:hover { background: var(--surf-2); color: var(--fg-primary); }
.time-filter__custom {
  flex-shrink: 0;
  padding: 6px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.time-filter__custom .field label {
  font: var(--pv-text-body-3-bold);
  color: var(--fg-secondary);
}
.time-filter__custom .input {
  height: 34px;
  padding: 0 10px;
  font: var(--pv-text-body-3);
}
.time-filter__custom input[type="datetime-local"] {
  color-scheme: dark;
}
[data-theme="light"] .time-filter__custom input[type="datetime-local"] {
  color-scheme: light;
}
.time-filter__custom-error {
  font: var(--pv-text-body-3);
  color: var(--st-critical);
  padding: 0 2px;
}
.time-filter__custom-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}
.direction-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font: var(--pv-text-body-2);
  color: var(--fg-secondary);
  transition: background var(--pv-dur-fast), color var(--pv-dur-fast);
}
.direction-option:hover { background: var(--surf-2); color: var(--fg-primary); }
.direction-option.is-on { color: var(--fg-primary); }
.direction-option input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--pv-blue-main, #7381F4);
  cursor: pointer;
  flex-shrink: 0;
}
.direction-option__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.direction-option__label { flex: 1; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: var(--surf-1);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--pv-dur-fast), border-color var(--pv-dur-fast);
}
.user-chip:hover { background: var(--surf-3); }
.user-chip__chev { color: var(--fg-muted); flex-shrink: 0; }
.user-chip__avatar { width: 30px; height: 30px; border-radius: 999px; object-fit: cover; }
.user-chip__avatar--text {
  display: grid;
  place-items: center;
  background: var(--grad-primary);
  color: var(--fg-on-grad);
  font: var(--pv-text-body-3-bold);
}
.user-chip__meta { display: flex; flex-direction: column; line-height: 1.1; }
.user-chip__name { font: var(--pv-text-body-3-bold); color: var(--fg-primary); }
.user-chip__role { font: var(--pv-text-body-3-light); color: var(--fg-secondary); font-size: 11px; }

.user-menu { position: relative; }
.user-menu__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(320px, calc(100vw - 32px));
  background: var(--bg-surface-2);
  border: 1px solid var(--bd-default);
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--pv-shadow-popover);
}
.user-menu__header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 4px 0;
}
.user-menu__name { font: var(--pv-text-body-2-bold); color: var(--fg-primary); }
.user-menu__username { font: var(--pv-text-body-3); color: var(--fg-secondary); }
.user-menu__pages {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 240px;
  overflow-y: auto;
  padding: 2px 0;
}
.user-menu__page {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 8px;
  border-radius: 8px;
}
.user-menu__page:hover { background: var(--surf-1); }
.user-menu__page-title { font: var(--pv-text-body-3-bold); color: var(--fg-primary); }
.user-menu__page-section { font: var(--pv-text-body-3); color: var(--fg-muted); font-size: 11px; }
.user-menu__empty {
  padding: 8px;
  color: var(--fg-secondary);
  font: var(--pv-text-body-3);
}
.user-menu__meta-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 4px 0;
}
.user-menu__meta-label {
  font: var(--pv-text-body-3-bold);
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}
.user-menu__meta-value { font: var(--pv-text-body-3); color: var(--fg-primary); }

/* ===================== Auth ===================== */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 20% 20%, rgba(115,129,244,0.22), transparent 32%),
    var(--bg-main);
}
.auth-card {
  width: min(440px, 100%);
}
.auth-card > .auth-card__theme.icon-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.auth-title {
  font: var(--pv-text-h2);
  color: var(--fg-primary);
}
.auth-subtitle {
  margin-top: 3px;
  font: var(--pv-text-body-2);
  color: var(--fg-secondary);
}
.form-error {
  padding: 10px 12px;
  border: 1px solid rgba(240,65,56,0.35);
  border-radius: var(--radius-control);
  background: var(--st-critical-bg);
  color: var(--st-critical);
  font: var(--pv-text-body-2);
}

/* ===================== Main ===================== */
.main {
  grid-area: main;
  overflow-x: clip;
  overflow-y: auto;
  padding: 24px 32px 48px;
  contain: layout style;
  min-width: 0;
}
.main__container { width: 100%; max-width: none; margin: 0; min-width: 0; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head__actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}
.page-head h1 { font: var(--pv-text-h1); color: var(--fg-primary); margin: 0 0 6px; }
.page-head p { color: var(--fg-secondary); font: var(--pv-text-body-2); }

/* ===================== Card ===================== */
.card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--bd-soft);
  border-radius: var(--pv-radius-xl);
  padding: 20px;
  contain: layout style;
}
.card:has(.dual-chart:hover) {
  z-index: 25;
}
.widget-load-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  font: 500 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
  opacity: 0.55;
  pointer-events: auto;
  user-select: none;
}
.card--pad-0 .widget-load-badge { top: 10px; right: 12px; }
.card--pad-sm .widget-load-badge { top: 10px; right: 12px; }
.card--pad-0 { padding: 0; }
.card--pad-sm { padding: 14px; }
.card__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.card__title { font: var(--pv-text-h4); color: var(--fg-primary); }
.card__sub { font: var(--pv-text-body-3); color: var(--fg-secondary); }
.card__tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* Summary stat cards (SumCard) */
.sum-card__label {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sum-card__value {
  font: 800 26px/1.1 var(--pv-font-sans);
  letter-spacing: -0.015em;
  margin-top: 6px;
  color: var(--fg-primary);
  font-variant-numeric: tabular-nums;
}
.sum-card__value--sm {
  font: var(--pv-text-h3);
  margin-top: 2px;
}
.sum-card__hint {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
  margin-top: 4px;
}

/* KPI tile */
.kpi {
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
}
.kpi__label { display: flex; align-items: center; gap: 6px; color: var(--fg-secondary); font: var(--pv-text-body-3); text-transform: uppercase; letter-spacing: 0.08em; }
.kpi__value { font: 800 28px/1.1 var(--pv-font-sans); letter-spacing: -0.015em; color: var(--fg-primary); font-variant-numeric: tabular-nums; }
.kpi__value small { font: 600 14px/1 var(--pv-font-sans); color: var(--fg-secondary); margin-left: 4px; letter-spacing: 0; }
.kpi__delta { font: var(--pv-text-body-3-bold); display: inline-flex; align-items: center; gap: 4px; }
.kpi__delta--up { color: var(--st-success); }
.kpi__delta--down { color: var(--st-critical); }
.kpi__spark { position: absolute; right: 0; top: 0; opacity: 0.9; }

/* Traffic stat tiles (dashboard KPI) */
.traffic-stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1100px) {
  .traffic-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .traffic-stat-grid {
    grid-template-columns: 1fr;
  }
}
.traffic-stat-tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.traffic-stat-tile__title {
  color: var(--fg-secondary);
  font: var(--pv-text-body-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.traffic-stat-tile__rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.traffic-stat-tile__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font: var(--pv-text-body-2);
}
.traffic-stat-tile__dir {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-secondary);
  flex-shrink: 0;
}
.traffic-stat-tile__swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.traffic-stat-tile__vals {
  text-align: right;
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Donut (protocols / services) */
.donut {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
  width: 100%;
}
.donut__chart {
  position: relative;
  flex-shrink: 0;
  width: clamp(120px, 42%, 220px);
  aspect-ratio: 1;
}
.donut--compact .donut__chart {
  width: clamp(96px, 36%, 160px);
}
.donut__svg {
  display: block;
  width: 100%;
  height: 100%;
}
.donut--compact {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.donut--compact .donut__chart {
  align-self: center;
}
.donut__legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.donut__legend--expanded {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}
.donut__legend-row--zero {
  opacity: 0.72;
}
.donut__legend-row--zero .donut__legend-label,
.donut__legend-row--zero .donut__legend-pct {
  color: var(--fg-muted);
}
.donut__legend-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 28px;
  height: 22px;
  margin-top: 2px;
  padding: 0;
  border: 1px solid var(--bd-soft);
  border-radius: 6px;
  background: var(--surf-1);
  color: var(--fg-secondary);
  cursor: pointer;
}
.donut__legend-toggle:hover {
  color: var(--fg-primary);
  border-color: var(--bd-strong);
}
.donut__legend-link {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.donut__legend-link:hover {
  color: #9eb0ff;
}

.other-ports-table {
  width: 100%;
  border-collapse: collapse;
  font: var(--pv-text-body-2);
}
.other-ports-table th {
  text-align: left;
  font: var(--pv-text-body-3-bold);
  color: var(--fg-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--bd-soft);
}
.other-ports-table th.num,
.other-ports-table td.num {
  text-align: right;
}
.other-ports-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--bd-soft);
  color: var(--fg-primary);
}
.other-ports-table tbody tr:last-child td {
  border-bottom: none;
}
.other-ports-table__state {
  padding: 24px;
  text-align: center;
  color: var(--fg-secondary);
  font: var(--pv-text-body-2);
}

.other-ports-modal__body {
  --other-ports-head-h: 29px;
  --other-ports-row-h: 27px;
  max-height: calc(var(--other-ports-head-h) + var(--other-ports-row-h) * 20);
  overflow-y: auto;
  margin: -6px 0;
}
.other-ports-modal__body .other-ports-table__state {
  padding: 16px;
}
.other-ports-modal__body .other-ports-table--compact {
  font: var(--pv-text-body-3);
}
.other-ports-modal__body .other-ports-table--compact th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-surface);
  padding: 6px 8px;
  font: var(--pv-text-body-3-bold);
  letter-spacing: 0.04em;
}
.other-ports-modal__body .other-ports-table--compact td {
  padding: 5px 8px;
  height: var(--other-ports-row-h);
  box-sizing: border-box;
}

.other-ports-inline {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--bd-soft);
  min-width: 0;
}
.other-ports-inline__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.other-ports-inline__title {
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
}
.other-ports-inline__sub {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
  margin-top: 2px;
}
.other-ports-inline__body {
  --other-ports-head-h: 29px;
  --other-ports-row-h: 27px;
  max-height: calc(var(--other-ports-head-h) + var(--other-ports-row-h) * 10);
  overflow-y: auto;
  border: 1px solid var(--bd-soft);
  border-radius: var(--pv-radius-md);
  background: var(--surf-1);
}
.other-ports-inline__body .other-ports-table__state {
  padding: 16px;
}
.other-ports-inline .other-ports-table {
  font: var(--pv-text-body-3);
}
.other-ports-inline .other-ports-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surf-1);
  padding: 6px 8px;
  font: var(--pv-text-body-3-bold);
  letter-spacing: 0.04em;
}
.other-ports-inline .other-ports-table td {
  padding: 5px 8px;
  height: var(--other-ports-row-h);
  box-sizing: border-box;
}

.country-heatmap-tools {
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.seg--compact button {
  padding: 4px 8px;
  font: var(--pv-text-body-3-bold);
  min-width: 0;
}
.country-heatmap-hint {
  margin: -4px 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(240, 180, 0, 0.12);
  border: 1px solid rgba(240, 180, 0, 0.28);
  color: var(--fg-secondary);
  font: var(--pv-text-body-3);
}

.country-choropleth__state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  color: var(--fg-secondary);
  font: var(--pv-text-body-2);
}
.country-choropleth__map-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border-radius: 10px;
  background: var(--country-map-ocean, transparent);
}
[data-theme="light"] .country-choropleth__map-wrap {
  border: 1px solid var(--bd-default);
}
.country-choropleth__map-wrap.is-zoomed {
  cursor: grab;
}
.country-choropleth__map-wrap.is-dragging {
  cursor: grabbing;
}
.country-choropleth__zoom-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.country-choropleth__zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--bd-default);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--fg-primary);
  font: var(--pv-text-body-2-bold);
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--pv-shadow-popover);
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}
.country-choropleth__zoom-btn:hover:not(:disabled) {
  background: var(--bg-surface-2);
  border-color: var(--bd-strong, var(--bd-default));
}
.country-choropleth__zoom-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.country-choropleth--large .country-choropleth__map-wrap {
  aspect-ratio: auto;
  height: min(58vh, 560px);
}
.country-map-modal__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.country-map-modal__body .country-choropleth {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.country-map-modal__body .country-choropleth--large {
  flex: 1;
}
.country-choropleth__svg {
  display: block;
  width: 100%;
  height: 100%;
}
.country-choropleth__country {
  stroke: var(--country-map-stroke);
  stroke-width: 0.65px;
  vector-effect: non-scaling-stroke;
  paint-order: fill stroke;
  transition: fill 0.15s ease, opacity 0.15s ease;
  cursor: default;
}
[data-theme="light"] .country-choropleth__country {
  stroke-width: 0.75px;
}
.country-choropleth__country:hover {
  opacity: 0.92;
  filter: brightness(1.08);
}
.country-choropleth__tooltip {
  position: fixed;
  z-index: 1200;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  min-width: 180px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--bd-default);
  box-shadow: var(--pv-shadow-popover);
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}
.country-choropleth__tooltip-title {
  margin-bottom: 6px;
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
}
.country-choropleth__tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}
.country-choropleth__legend {
  margin-top: 10px;
  gap: 10px 14px;
  align-items: center;
  flex-wrap: wrap;
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}
.country-choropleth__legend-tier {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.country-choropleth__legend-tier--high {
  flex: 1 1 160px;
  gap: 8px;
  min-width: 140px;
}
.country-choropleth__legend-unknown-meta {
  color: var(--fg-muted);
  font: var(--pv-text-body-3);
}
.country-choropleth__legend-label {
  white-space: nowrap;
}
.country-choropleth__legend-unknown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.country-choropleth__legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.country-choropleth__legend-swatch--unknown {
  background: repeating-linear-gradient(
    -45deg,
    rgba(127, 127, 157, 0.45),
    rgba(127, 127, 157, 0.45) 3px,
    rgba(90, 90, 110, 0.45) 3px,
    rgba(90, 90, 110, 0.45) 6px
  );
}
[data-theme="light"] .country-choropleth__legend-swatch--unknown {
  background: repeating-linear-gradient(
    -45deg,
    #EDE4DA,
    #EDE4DA 3px,
    #C9BDB0 3px,
    #C9BDB0 6px
  );
}

/* Top talkers — tools top-right; badge offset so it does not cover tabs */
.card--top-talkers.card--pad-0 .card__head {
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--bd-soft);
}
.card--top-talkers .card__head > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}
.card--top-talkers .card__sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card--top-talkers .card__tools {
  flex: 0 0 auto;
  margin-left: auto;
  padding-right: 44px;
}
.top-talkers-tools {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.top-talkers-tools .seg {
  flex: 0 0 auto;
}
.card--top-talkers.card--pad-0 .widget-load-badge {
  top: 14px;
  right: 14px;
}

.talker-table-state {
  text-align: center;
  color: var(--fg-secondary);
  padding: 24px;
}
.table--top-talkers .talker-row {
  cursor: pointer;
}
.table--top-talkers .talker-row:hover td {
  background: var(--surf-1);
}
.table--top-talkers .talker-row--expanded td {
  background: var(--surf-1);
}
.talker-row__rank {
  color: var(--fg-muted);
  font: var(--pv-text-body-3-bold);
}
.talker-row__volume {
  text-align: right;
  font: var(--pv-text-body-2-bold);
  white-space: nowrap;
}
.talker-main-cell {
  min-width: 0;
  max-width: 100%;
}
.talker-main-cell__primary {
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.talker-main-cell__primary--wrap {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.talker-main-cell__sub {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.talker-main-cell--pair-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.talker-pair-side {
  min-width: 0;
}
.talker-pair-arrow-row {
  font: var(--pv-text-body-3);
  color: var(--fg-tertiary, var(--fg-secondary));
  line-height: 1;
  padding-left: 2px;
}
.talker-row__geo {
  width: 72px;
  min-width: 72px;
}
.talker-row__geo--pair {
  width: 96px;
  min-width: 96px;
}

.table--top-talkers {
  table-layout: fixed;
  width: 100%;
}
.table--top-talkers th,
.table--top-talkers td {
  padding: 10px 12px;
  vertical-align: top;
}
.table--top-talkers .talker-col-rank {
  width: 36px;
  padding-left: 10px;
  padding-right: 6px;
}
.table--top-talkers .talker-col-endpoint {
  width: auto;
  min-width: 0;
}
.table--top-talkers .talker-col-geo {
  width: 10%;
  min-width: 0;
  max-width: 88px;
}
.table--top-talkers .talker-col-geo.talker-row__geo--pair {
  max-width: 112px;
}
.table--top-talkers .talker-col-volume {
  width: 96px;
  text-align: right;
}
.table--top-talkers .talker-col-share {
  width: 72px;
  text-align: right;
}
.table--top-talkers .talker-row__geo {
  min-width: 0;
}
.table--top-talkers td.talker-row__geo:not(.talker-col-geo) {
  width: 10%;
  max-width: 88px;
}
.table--top-talkers td.talker-row__geo--pair:not(.talker-col-geo) {
  max-width: 112px;
}
.table--top-talkers td.talker-row__geo {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card--top-talkers .table--top-talkers th.talker-col-volume,
.card--top-talkers .table--top-talkers td.talker-row__volume {
  padding-left: 18px;
}
.card--top-talkers .table--top-talkers .talker-col-endpoint {
  width: auto;
  max-width: none;
  padding-right: 6px;
}

.page-top-talkers {
  width: 100%;
}
.top-talkers-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 320px);
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}
.top-talkers-panels > .card {
  min-width: 0;
}
.top-talkers-filters {
  flex-wrap: wrap;
  gap: 18px;
}
.top-talkers-table-wrap {
  min-width: 0;
  max-width: 100%;
}
.card--top-talkers-full .card__tools {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  padding-right: 44px;
}
.card--top-talkers-full .card__tools .input-wrap {
  width: 100%;
  max-width: 240px;
}
.top-bar-row__head {
  margin-bottom: 4px;
  font: var(--pv-text-body-2);
  min-width: 0;
}
.top-bar-row__rank {
  width: 22px;
  flex-shrink: 0;
  font: var(--pv-text-body-3-bold);
  color: var(--fg-muted);
}
.top-bar-row__label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.top-bar-row__metric {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: var(--pv-text-body-2-bold);
  text-align: right;
}
.top-bar-row__track {
  height: 8px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}
.top-bar-row__fill {
  height: 100%;
  border-radius: 999px;
}

@media (max-width: 1100px) {
  .top-talkers-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .main {
    padding: 16px 20px 32px;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 16px 16px 28px;
  }

  .page-top-talkers .table--top-talkers .talker-col-asn {
    display: none;
  }
}
.talker-main-cell__geo {
  font-size: 16px;
}
.talker-main-cell__geo--pair {
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
}
.talker-pair-arrow {
  white-space: nowrap;
}

.table--recent-flows {
  table-layout: fixed;
}
.table--recent-flows th,
.table--recent-flows td {
  padding: 9px 10px;
}
.table--recent-flows .recent-flows__time-col { width: 92px; }
.table--recent-flows .recent-flows__meta-col { width: 118px; }
.table--recent-flows .recent-flows__proto-col { width: 68px; }
.table--recent-flows .recent-flows__bytes-col { width: 92px; text-align: right; }
.table--recent-flows .recent-flows__asn-col,
.table--recent-flows .recent-flows__asn-cell {
  width: 148px;
}
.table--recent-flows .recent-flows__time {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
  white-space: nowrap;
}
.table--recent-flows .recent-flows__asn {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-secondary);
  font: var(--pv-text-caption);
}
.recent-flows__asn-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.recent-flows__asn-line {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-secondary);
  font: var(--pv-text-caption);
  line-height: 1.25;
}
.table--recent-flows .recent-flows__bytes {
  text-align: right;
  white-space: nowrap;
  font: var(--pv-text-body-3-bold);
}
.table--recent-flows .recent-flows__bytes small {
  display: block;
  margin-top: 2px;
  color: var(--fg-muted);
  font: var(--pv-text-caption);
}
.recent-flow-endpoints {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.recent-flow-endpoint {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-flow-endpoint__ip {
  font: var(--pv-text-body-3-bold);
  color: var(--fg-primary);
}
.recent-flow-endpoint__port {
  color: var(--fg-secondary);
}
.recent-flow-endpoint__label {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg-muted);
  font: var(--pv-text-caption);
}
.recent-flow-arrow {
  color: var(--fg-muted);
  text-align: center;
}
.recent-flow-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.recent-flow-meta__vlan,
.recent-flow-meta__geo {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-flow-meta__vlan {
  color: var(--fg-secondary);
  font: var(--pv-text-caption);
}
.recent-flow-meta__geo {
  color: var(--fg-primary);
  font: var(--pv-text-body-3);
}
.recent-flow-meta__arrow {
  margin: 0 3px;
  color: var(--fg-muted);
}

/* Recent flows — заголовок + тулбар; бейдж загрузки не перекрывает контролы */
.card--recent-flows.card--pad-0 .card__head {
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--bd-soft);
}
.card--recent-flows .card__head > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}
.card--recent-flows .card__sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card--recent-flows .card__tools {
  flex: 0 0 auto;
  margin-left: auto;
  padding-right: 44px;
}
.card--recent-flows.card--pad-0 .widget-load-badge {
  top: 14px;
  right: 14px;
}

/* Explorer Flows — таблица результатов */
.card--explorer-results.card--pad-0 .card__head {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin: 0;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--bd-soft);
}
.card--explorer-results .card__head > div:first-child {
  flex: 1 1 280px;
  min-width: 0;
}
.card--explorer-results .card__sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card--explorer-results .card__tools {
  flex: 1 1 420px;
  margin-left: auto;
  min-width: 0;
  max-width: 100%;
}
.explorer-results-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}
.explorer-results-tools__cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}
.explorer-results-tools__limit-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  max-width: 100%;
}
.explorer-results-tools__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
}
.card--explorer-results .table-wrap {
  border: none;
  border-radius: 0;
  overflow-x: auto;
}
.card--explorer-results .table {
  width: max-content;
}
.card--explorer-results .table th,
.card--explorer-results .table td {
  overflow: hidden;
  vertical-align: middle;
}
.card--explorer-results .explorer-col-dim {
  width: 240px;
  max-width: 280px;
  min-width: 120px;
}
.card--explorer-results .table--resizable .explorer-col-dim {
  width: auto;
  max-width: none;
  min-width: 0;
}
.card--explorer-results .explorer-col-dim .explorer-dim-cell {
  max-width: 100%;
}
.card--explorer-results .explorer-col-metric,
.card--explorer-results .explorer-col-pct,
.card--explorer-results .explorer-col-metric-extra {
  white-space: nowrap;
}
.card--explorer-results .explorer-col-actions {
  min-width: 248px;
  width: 248px;
  white-space: nowrap;
  overflow: visible;
  vertical-align: middle;
  container-type: inline-size;
  container-name: explorer-actions;
}
.card--explorer-results .table td.explorer-col-actions,
.card--explorer-results .table th.explorer-col-actions {
  overflow: visible;
}
.card--explorer-results .explorer-col-actions .explorer-row-actions__label--full {
  display: none;
}
.card--explorer-results .explorer-col-actions .explorer-row-actions__label--short {
  display: inline;
}
.explorer-dim-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.explorer-dim-cell__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 4px;
}
.explorer-dim-cell__main {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.explorer-dim-cell__filter {
  all: unset;
  cursor: pointer;
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
}
.explorer-dim-cell__filter:hover {
  color: var(--accent, #7E92F8);
}
.overflow-text {
  display: block;
  min-width: 0;
  max-width: 100%;
}
.overflow-text--middle {
  display: flex;
  align-items: baseline;
  min-width: 0;
  max-width: 100%;
}
.overflow-text__start,
.overflow-text__end,
.overflow-text__value {
  min-width: 0;
}
.overflow-text__value--clip {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.overflow-text__value--wrap {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
.overflow-text--middle .overflow-text__start {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.overflow-text--middle .overflow-text__end {
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
  text-align: left;
  max-width: 50%;
}
.overflow-text--expand,
.overflow-text--expand-open {
  display: flex;
  align-items: flex-start;
  gap: 2px;
}
.card--explorer-results .table-foot {
  border-radius: 0;
}
.card--explorer-results .table tbody tr.is-dynamics-active {
  background: rgba(126, 146, 248, 0.06);
}
.card--explorer-results .table tbody tr.is-dynamics-active:hover {
  background: rgba(126, 146, 248, 0.1);
}
.explorer-results-layout {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.explorer-results-chart {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--bd-soft);
  min-width: 0;
}

/* Explorer Flows — столбчатая визуализация */
.explorer-bars__row {
  min-width: 0;
  container-type: inline-size;
  container-name: explorer-actions;
}
.explorer-bars__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 4px;
}
.explorer-bars__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.explorer-bars__label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
}
.explorer-bars__value {
  flex: 0 0 auto;
  font: var(--pv-text-body-2-bold);
  color: var(--fg-secondary);
  text-align: right;
  white-space: nowrap;
}
.explorer-bars__track {
  height: 14px;
  background: var(--track);
  border-radius: 4px;
  overflow: hidden;
  margin-left: 18px;
}
.explorer-bars__fill {
  height: 100%;
  border-radius: 4px;
}

.explorer-analysis-panels {
  position: relative;
  min-width: 0;
}

.explorer-refreshing-data {
  padding: 40px;
  text-align: center;
  color: var(--fg-secondary);
  font: var(--pv-text-body-2);
  animation: explorer-refreshing-pulse 2.5s ease-in-out infinite;
}

@keyframes explorer-refreshing-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.explorer-analysis-panel {
  min-width: 0;
}

.explorer-analysis-panel[hidden] {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.explorer-analysis-panel:not([hidden]) {
  position: relative;
  z-index: 1;
}

.explorer-analysis-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.explorer-filter-mode-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 6px 8px;
}

.explorer-analysis-tabs--compact button {
  gap: 0;
  min-width: 34px;
  padding: 6px 10px;
  justify-content: center;
}

.explorer-filter-templates-menu {
  min-width: 0;
}

.explorer-visual-limit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.explorer-visual-limit__main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.explorer-visual-limit__summary {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
  white-space: nowrap;
}

.explorer-visual-limit__seg {
  flex-wrap: wrap;
}

.explorer-row-actions {
  display: inline-flex;
  align-items: center;
  gap: clamp(2px, 1.2cqw, 6px);
  flex-wrap: nowrap;
  max-width: 100%;
  min-width: 0;
}
.explorer-bars__row .explorer-row-actions {
  margin-top: 6px;
}
.explorer-row-actions__btn {
  flex: 0 0 auto;
  min-width: 0;
  padding: clamp(1px, 0.4cqw, 2px) clamp(4px, 1.8cqw, 8px);
  font-size: clamp(8px, 2.8cqw, 11px);
  line-height: 1.25;
}
.explorer-row-actions__label--short {
  display: none;
}
@container explorer-actions (max-width: 320px) {
  .explorer-row-actions__label--full {
    display: none;
  }
  .explorer-row-actions__label--short {
    display: inline;
  }
  .explorer-row-actions__btn {
    padding: clamp(1px, 0.35cqw, 2px) clamp(3px, 1.4cqw, 6px);
    font-size: clamp(8px, 3.2cqw, 10px);
  }
}
@container explorer-actions (max-width: 220px) {
  .explorer-row-actions {
    gap: 2px;
  }
  .explorer-row-actions__btn {
    padding: 1px 3px;
    font-size: clamp(7px, 3.6cqw, 9px);
  }
}

.explorer-dynamics-chart {
  width: 100%;
  min-width: 0;
  flex-shrink: 0;
}

.explorer-dynamics-chart .dual-chart {
  width: 100%;
  max-width: 100%;
  padding-left: 2px;
}

.explorer-dynamics-chart .dual-chart__svg {
  overflow: visible;
}

.explorer-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  overflow: visible;
}
.explorer-lines__row {
  min-width: 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--bd-soft);
}
.explorer-lines__row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.explorer-lines__head {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  margin-bottom: 6px;
}
.explorer-lines__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.explorer-lines__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
}
.explorer-lines__value,
.explorer-lines__pct {
  font: var(--pv-text-body-2-bold);
  color: var(--fg-secondary);
  white-space: nowrap;
}
.explorer-lines__pct {
  min-width: 52px;
  text-align: right;
}
.explorer-lines__chart-wrap {
  min-width: 0;
}
.explorer-lines__empty {
  min-height: 196px;
  display: grid;
  place-items: center;
  color: var(--fg-secondary);
  font: var(--pv-text-body-3);
  background: var(--surf-1);
  border-radius: 8px;
}
.explorer-lines__chart {
  min-width: 0;
}
.explorer-lines__legend {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 14px;
  margin-bottom: 0;
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}
.explorer-lines__legend-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.explorer-lines__legend-summary {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}
.explorer-lines__legend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--bd-soft);
  border-radius: 6px;
  background: var(--surf-1);
  font: var(--pv-text-body-3-bold);
  color: var(--fg-secondary);
  cursor: pointer;
}
.explorer-lines__legend-toggle:hover {
  color: var(--fg-primary);
  border-color: var(--bd-strong);
}
.explorer-lines__legend-item {
  align-items: flex-start;
  max-width: min(100%, 280px);
  min-width: 0;
}
.explorer-lines__legend-swatch {
  width: 12px;
  height: 2px;
  margin-top: 0.55em;
}
.explorer-lines__legend-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
  line-height: 1.35;
}
.explorer-lines__legend-value {
  display: block;
}
.explorer-lines__legend-arrow {
  color: var(--fg-tertiary);
}

.explorer-time-chart {
  overflow: visible;
}
.explorer-time-chart .dual-chart {
  width: 100%;
}
.explorer-time-chart .dual-chart__svg {
  overflow: visible;
}

.explorer-donut {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 24px;
  align-items: flex-start;
  min-width: 0;
}
.explorer-donut__viz {
  flex: 0 0 auto;
}
.explorer-donut__chart {
  position: relative;
  flex-shrink: 0;
}
.explorer-donut__center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  padding: 28px;
  text-align: center;
}
.explorer-donut__center-main {
  font: 800 22px/1.1 var(--pv-font-sans);
  letter-spacing: -0.015em;
  color: var(--fg-primary);
}
.explorer-donut__center-sub {
  margin-top: 6px;
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.explorer-donut__rows {
  flex: 1 1 280px;
  min-width: 0;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  padding-right: 2px;
}
.explorer-donut__head,
.explorer-donut__row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) minmax(88px, auto) minmax(56px, auto);
  gap: 8px;
  align-items: center;
}
.explorer-donut__head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0 6px 6px;
  margin-bottom: 2px;
  font: var(--pv-text-body-3-bold);
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  background: var(--bg-surface);
}
.explorer-donut__head span:nth-child(1) {
  grid-column: 2;
}
.explorer-donut__row {
  margin: 0 -6px;
  padding: 5px 6px;
  border-radius: 8px;
  font: var(--pv-text-body-3);
  transition: opacity 0.12s ease, background 0.12s ease;
  cursor: default;
}
.explorer-donut__row--active {
  background: rgba(126, 146, 248, 0.16);
}
.explorer-donut__row--dim {
  opacity: 0.38;
}
.explorer-donut__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  transition: box-shadow 0.12s ease;
}
.explorer-donut__row--active .explorer-donut__swatch {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}
.explorer-donut__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-primary);
}
.explorer-donut__metric {
  color: var(--fg-primary);
  white-space: nowrap;
  text-align: right;
}
.explorer-donut__pct {
  color: var(--fg-secondary);
  white-space: nowrap;
  text-align: right;
}
.explorer-donut__row--active .explorer-donut__metric,
.explorer-donut__row--active .explorer-donut__pct {
  color: var(--fg-primary);
}
@media (max-width: 760px) {
  .explorer-donut__viz {
    width: 100%;
    display: flex;
    justify-content: center;
  }
}

.explorer-sankey {
  min-width: 0;
}
.explorer-sankey svg {
  display: block;
}

.talker-detail-pair {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 0;
}
.talker-detail-pair .talker-detail-section {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--bd-soft);
  border-radius: 10px;
  background: var(--surf-2);
}
.talker-detail-pair .talker-detail-section__title {
  margin: 0;
  padding: 8px 12px;
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--surf-3);
  border-bottom: 1px solid var(--bd-soft);
  border-left: 3px solid var(--accent);
  box-shadow: inset 0 -1px 0 rgba(126, 146, 248, 0.12);
}
.talker-detail-pair .talker-detail-grid {
  padding: 10px 12px 6px;
}
.talker-detail-section {
  margin: 0;
}
.talker-detail-section__title {
  margin: 0 0 8px;
  font: var(--pv-text-body-3-bold);
  color: var(--fg-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.talker-row-detail td {
  padding: 0 16px 14px;
  background: var(--surf-1);
  border-bottom: 1px solid var(--bd-soft);
}
.talker-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 20px;
  margin: 0;
  padding: 12px 0 4px;
}
.talker-detail-item {
  margin: 0;
}
.talker-detail-item dt {
  font: var(--pv-text-body-3-bold);
  color: var(--fg-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 2px;
}
.talker-detail-item dd {
  margin: 0;
  font: var(--pv-text-body-2);
  color: var(--fg-primary);
  word-break: break-word;
}

.country-rank-list__items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.country-rank-list--expanded .country-rank-list__items {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}
.country-rank-list__row--zero .country-rank-list__label,
.country-rank-list__row--zero .country-rank-list__pct {
  color: var(--fg-muted);
}
.country-rank-list__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.country-rank-list__flag {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}
.country-rank-list__label {
  flex: 1;
  font: var(--pv-text-body-2);
  color: var(--fg-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.country-rank-list__pct {
  font: var(--pv-text-body-2-bold);
  min-width: 56px;
  text-align: right;
}
.country-rank-list__track {
  height: 6px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}
.country-rank-list__fill {
  height: 100%;
  background: linear-gradient(90deg, #7E92F8, #6972F0);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.country-rank-list__row--zero .country-rank-list__fill {
  background: var(--fg-muted);
  opacity: 0.25;
}
.country-rank-list__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 10px;
  padding: 6px 10px;
  border: 1px solid var(--bd-soft);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--fg-secondary);
  font: var(--pv-text-body-3-bold);
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.country-rank-list__toggle:hover {
  color: var(--fg-primary);
  border-color: var(--bd-default);
  background: var(--surf-2);
}

.donut__segment {
  transition: opacity 0.12s ease, stroke-width 0.12s ease;
}
.donut__segment-hit {
  cursor: pointer;
}
.donut__legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 -6px;
  padding: 3px 6px;
  border-radius: 6px;
  transition: opacity 0.12s ease, background 0.12s ease;
}
.donut__legend-row--active {
  background: rgba(126, 146, 248, 0.16);
}
.donut__legend-row--dim {
  opacity: 0.38;
}
.donut__legend-row--active .donut__legend-pct {
  color: var(--fg-primary);
}
.donut__legend-row--active .donut__legend-swatch {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}
.donut__legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
  transition: box-shadow 0.12s ease;
}
.donut__legend-label {
  flex: 1;
  font: var(--pv-text-body-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.donut__legend-pct {
  font: var(--pv-text-body-3-bold);
  color: var(--fg-primary);
  flex-shrink: 0;
}

/* Split card: protocols | services */
@property --dash-right-split {
  syntax: '<number>';
  inherits: true;
  initial-value: 0.333333;
}

.dashboard-chart-row {
  display: flex;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 16px;
  min-width: 0;
  --dash-right-split: 0.333333;
  transition:
    --dash-right-split var(--pv-dur-base) var(--pv-ease-out),
    gap var(--pv-dur-base) var(--pv-ease-out);
}
.dashboard-chart-row--trend {
  gap: 0;
}
.dashboard-chart-row.is-dragging {
  transition: none;
}
.dashboard-chart-row.is-snapping {
  transition: none;
}
.dashboard-chart-row__pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.dashboard-chart-row__pane--main {
  flex: calc(1 - var(--dash-right-split)) 1 0;
}
.dashboard-chart-row__pane--distribution {
  flex: var(--dash-right-split) 1 0;
}
.dashboard-chart-row--share .dashboard-chart-row__pane--main {
  flex: 2 1 0;
}
.dashboard-chart-row--share .dashboard-chart-row__pane--distribution {
  flex: 1 1 0;
}
.dashboard-chart-row__pane > .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dashboard-chart-row__pane > .card .distribution-split,
.dashboard-chart-row__pane > .card .dual-chart--fluid {
  flex: 1;
  min-height: 0;
}
.dashboard-chart-row.is-dragging .dual-chart--fluid,
.dashboard-chart-row.is-dragging .category-trend__chart {
  pointer-events: none;
}
.dashboard-chart-row__splitter {
  flex: 0 0 10px;
  width: 10px;
  margin: 0 -3px;
  cursor: col-resize;
  position: relative;
  z-index: 2;
  touch-action: none;
  align-self: stretch;
  opacity: 1;
  overflow: hidden;
  transition:
    flex-basis var(--pv-dur-base) var(--pv-ease-out),
    width var(--pv-dur-base) var(--pv-ease-out),
    opacity var(--pv-dur-base) var(--pv-ease-out);
}
.dashboard-chart-row--share .dashboard-chart-row__splitter {
  flex: 0 0 0;
  width: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.dashboard-chart-row.is-dragging .dashboard-chart-row__splitter {
  transition: none;
}
.dashboard-chart-row__splitter::before {
  content: '';
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 1px;
  background: var(--bd-default);
  transition: background var(--pv-dur-fast) var(--pv-ease-out);
}
.dashboard-chart-row__splitter:hover::before,
.dashboard-chart-row.is-dragging .dashboard-chart-row__splitter::before {
  background: var(--accent);
}
.dashboard-chart-row.is-dragging .dashboard-chart-row__splitter {
  cursor: col-resize;
}
.distribution-split {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.distribution-split__divider {
  height: 1px;
  background: var(--bd-soft);
  flex-shrink: 0;
}
.distribution-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.distribution-pane__head {
  min-width: 0;
}
.distribution-pane__content {
  min-width: 0;
}
.distribution-pane--centered .distribution-pane__head {
  text-align: center;
}
.distribution-pane--centered .distribution-pane__content {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.distribution-pane--centered .distribution-pane__content > .donut {
  flex: 0 1 auto;
  max-width: min(100%, 520px);
}
.distribution-pane--centered .distribution-pane__content > .category-trend {
  width: 100%;
  max-width: 720px;
}
.distribution-pane--centered .distribution-pane__content > .distribution-pane__loading,
.distribution-pane--centered .distribution-pane__content > .other-ports-table__state {
  width: 100%;
}
.distribution-split--solo .distribution-pane--centered {
  width: 100%;
}
.distribution-split--solo-trend .distribution-pane__content > .category-trend {
  width: 100%;
  max-width: none;
}
.distribution-pane__title {
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
}
.distribution-pane__sub {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
  margin-top: 2px;
}
.distribution-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.distribution-card__title {
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
}
.distribution-card__switch {
  flex-shrink: 0;
}
.distribution-pane__loading {
  display: grid;
  place-items: center;
  min-height: 190px;
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}
.category-trend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.category-trend__chart {
  position: relative;
}
.category-trend__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}
.category-trend__legend-item {
  font: var(--pv-text-body-3);
}
.category-trend__empty {
  display: grid;
  place-items: center;
  min-height: 190px;
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}
.category-trend__tip {
  max-width: 220px;
}

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 18px;
  border: 1px solid var(--bd-default);
  background: transparent;
  color: var(--fg-primary);
  border-radius: var(--radius-control);
  font: var(--pv-text-button-s);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--pv-dur-fast), border-color var(--pv-dur-fast), color var(--pv-dur-fast);
}
.btn:hover { background: var(--surf-2); border-color: var(--bd-strong); }
.btn:disabled, .btn.is-disabled { color: var(--fg-disabled); cursor: default; }
.btn:disabled:hover, .btn.is-disabled:hover { background: transparent; border-color: var(--bd-default); }
.btn--primary {
  background: var(--grad-primary);
  border: 0;
  color: var(--fg-on-grad);
  box-shadow: 0 8px 22px -10px rgba(110,114,240,0.7);
}
.btn--primary:hover { filter: brightness(1.06); background: var(--grad-primary); border: 0; }
.btn--ghost { border-color: transparent; }
.btn--danger { color: var(--st-critical); border-color: rgba(240,65,56,0.30); }
.btn--danger:hover { background: var(--st-critical-bg); border-color: rgba(240,65,56,0.50); }
.btn--sm { height: 30px; padding: 0 12px; font: var(--pv-text-button-xs); border-radius: var(--radius-control); }
.btn--xs { height: 24px; padding: 0 10px; font: var(--pv-text-button-xs); border-radius: var(--radius-control-xs); }
.btn--icon-only { padding: 0; width: 38px; }
.btn--sm.btn--icon-only { width: 30px; }
/* Textual CTA — same visual language as .link-btn */
.btn--link {
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  box-shadow: none;
  text-align: left;
}
.btn--link:hover {
  background: none;
  border: 0;
  text-decoration: underline;
  color: var(--accent);
}

/* ===================== Badge / pill ===================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font: var(--pv-text-body-3-bold);
  font-size: 11px;
  background: var(--surf-3);
  color: var(--fg-primary);
  white-space: nowrap;
}
.badge--success { background: var(--st-success-bg); color: var(--st-success); }
.badge--warning { background: var(--st-warning-bg); color: var(--st-warning); }
.badge--critical { background: var(--st-critical-bg); color: var(--st-critical); }
.badge--info { background: var(--st-info-bg); color: var(--st-info-fg); }
.badge--neutral { background: var(--surf-2); color: var(--fg-secondary); }
.badge__dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surf-2);
  color: var(--fg-secondary);
  font: var(--pv-text-body-3);
  font-size: 11px;
}

/* ===================== Inputs ===================== */
.input {
  display: flex; align-items: center; gap: 8px;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--bd-default);
  border-radius: var(--radius-control);
  color: var(--fg-primary);
  font: var(--pv-text-body-2);
  outline: none;
  transition: border-color var(--pv-dur-fast);
  width: 100%;
}
.input::placeholder { color: var(--fg-muted); }
.input:focus, .input:focus-within { border-color: var(--bd-focus); }
.input--with-icon { padding-left: 38px; }
.input-wrap { position: relative; }
.input-wrap > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--fg-muted); pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font: var(--pv-text-body-3-bold); color: var(--fg-secondary); }
.field .hint { font: var(--pv-text-body-3); color: var(--fg-muted); }

/* Segmented control */
.seg { display: inline-flex; background: var(--bg-input); border: 1px solid var(--bd-default); border-radius: var(--radius-control); padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent;
  color: var(--fg-secondary);
  height: 30px; padding: 0 12px;
  border-radius: 8px;
  font: var(--pv-text-body-3-bold);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--pv-dur-fast), color var(--pv-dur-fast);
}
.seg button:hover { color: var(--fg-primary); }
.seg button.is-active { background: var(--surf-3); color: var(--fg-primary); }

/* ===================== Table ===================== */
.table-wrap { overflow: auto; border-radius: var(--pv-radius-xl); border: 1px solid var(--bd-soft); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font: var(--pv-text-body-2); background: var(--bg-surface); }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--bd-soft); vertical-align: middle; }
.table thead th {
  font: var(--pv-text-body-3-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-secondary);
  background: var(--surf-1);
  user-select: none;
  white-space: nowrap;
}
.table-wrap .table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.table thead th .sort { color: var(--fg-muted); margin-left: 4px; display: inline-block; vertical-align: middle; }
.table thead th.is-sorted { color: var(--fg-primary); }
.table tbody tr { transition: background var(--pv-dur-fast); }
.table tbody tr:hover { background: var(--surf-1); }
.table tbody tr.is-selected { background: var(--row-selected); }
.table tbody tr.is-pinned { background: var(--surf-1); color: var(--fg-secondary); }
.table tbody tr.is-pinned td { border-top: 1px solid var(--bd-default); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num { font-variant-numeric: tabular-nums; }
.table td.actions { width: 1%; white-space: nowrap; }
.table--resizable {
  table-layout: fixed;
}
.table--resizable th,
.table--resizable td {
  box-sizing: border-box;
}
.table .col-resize {
  position: absolute;
  top: 4px;
  right: 0;
  bottom: 4px;
  width: 14px;
  cursor: col-resize;
  opacity: 0.72;
  touch-action: none;
  z-index: 2;
  border-radius: 4px;
  transition: opacity var(--pv-dur-fast), background var(--pv-dur-fast);
}
.table .col-resize::after {
  content: '';
  position: absolute;
  top: 25%;
  right: 5px;
  width: 3px;
  height: 50%;
  min-height: 16px;
  border-radius: 3px;
  background: var(--fg-muted);
  box-shadow: 3px 0 0 color-mix(in srgb, var(--fg-muted) 65%, transparent);
}
.table thead th:hover .col-resize,
.table .col-resize:hover,
.table .col-resize:active {
  opacity: 1;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}
.table .col-resize:hover::after,
.table .col-resize:active::after {
  background: var(--accent);
  box-shadow: 3px 0 0 color-mix(in srgb, var(--accent) 70%, transparent);
}

.table-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--bd-soft);
  border-bottom: 0;
  border-radius: var(--pv-radius-xl) var(--pv-radius-xl) 0 0;
}
.table-toolbar + .table-wrap { border-radius: 0 0 var(--pv-radius-xl) var(--pv-radius-xl); border-top: 0; }
.table-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surf-1);
  border-top: 1px solid var(--bd-soft);
  color: var(--fg-secondary);
  font: var(--pv-text-body-3);
}
.table-foot__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
}
.table-foot__meta {
  padding-top: 8px;
  border-top: 1px solid var(--bd-soft);
  flex-wrap: wrap;
}

/* Row checkbox */
.checkbox {
  width: 16px; height: 16px;
  display: inline-grid; place-items: center;
  background: var(--bg-input);
  border: 1px solid var(--bd-strong);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox.is-checked { background: var(--grad-primary); border-color: transparent; color: var(--fg-on-grad); }
.checkbox.is-indet { background: var(--grad-primary); border-color: transparent; color: var(--fg-on-grad); }
.checkbox.is-disabled { opacity: 0.45; cursor: default; pointer-events: none; }

/* Status indicator dot+label */
.status { display: inline-flex; align-items: center; gap: 8px; }
.status__dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.status--ok .status__dot { background: var(--st-success); box-shadow: 0 0 8px rgba(81,209,109,0.6); }
.status--warn .status__dot { background: var(--st-warning); box-shadow: 0 0 8px rgba(240,180,0,0.55); }
.status--err .status__dot { background: var(--st-critical); box-shadow: 0 0 8px rgba(240,65,56,0.55); }
.status--idle .status__dot { background: var(--fg-muted); }
.status--ok { color: var(--st-success); }
.status--warn { color: var(--st-warning); }
.status--err { color: var(--st-critical); }

/* Mini bar (cpu/mem/disk) */
.minibar {
  height: 6px; min-width: 60px; background: var(--track);
  border-radius: 999px; overflow: hidden; position: relative;
}
.minibar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--pv-blue-grad-from), var(--pv-blue-grad-to));
  border-radius: 999px;
}
.minibar.warn > span { background: linear-gradient(90deg, #F0B400, #E59A00); }
.minibar.crit > span { background: linear-gradient(90deg, #F04138, #C2322B); }

/* ===================== Modal ===================== */
.modal-mask {
  position: fixed; inset: 0; background: var(--bg-overlay);
  display: grid; place-items: center;
  z-index: 1000;
  padding: 24px;
  animation: fade .15s ease-out;
}
html.modal-open #root {
  content-visibility: hidden;
  contain: strict;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--bd-default);
  border-radius: var(--pv-radius-lg);
  width: 560px; max-width: 92vw;
  max-height: 86vh;
  display: flex; flex-direction: column;
  box-shadow: var(--pv-shadow-popover);
  animation: pop .2s var(--pv-ease-out);
}
.modal--lg { width: 760px; }
.modal--xl { width: 960px; }
.modal--map {
  width: min(1180px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
}
.modal--map .modal__body {
  overflow: hidden;
  padding: 16px 22px 22px;
}
@keyframes pop { from { transform: translateY(8px); opacity: 0 } to { transform: none; opacity: 1 } }
.modal__head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--bd-soft); }
.modal__title { font: var(--pv-text-h2); color: var(--fg-primary); }
.modal__sub { font: var(--pv-text-body-3); color: var(--fg-secondary); margin-top: 2px; }
.modal__body { padding: 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal__foot { padding: 16px 22px; border-top: 1px solid var(--bd-soft); display: flex; justify-content: flex-end; gap: 8px; }

/* Side panel */
.side-panel-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}
.side-panel-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  animation: fade .15s ease-out;
}
.side-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 540px; max-width: 96vw;
  background: var(--bg-surface);
  border-left: 1px solid var(--bd-default);
  display: flex; flex-direction: column;
  z-index: 1;
  pointer-events: auto;
  box-shadow: -24px 0 60px rgba(0,0,0,0.4);
  animation: slide-in .25s var(--pv-ease-out);
}
@keyframes slide-in { from { transform: translateX(100%) } to { transform: none } }
.side-panel__head { padding: 18px 22px; border-bottom: 1px solid var(--bd-soft); display: flex; align-items: center; gap: 12px; }
.side-panel__body { padding: 22px; overflow-y: auto; flex: 1; }
.side-panel__foot { padding: 14px 22px; border-top: 1px solid var(--bd-soft); display: flex; justify-content: space-between; gap: 8px; }

/* ===================== Toast ===================== */
.toast-stack { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 1500; pointer-events: none; }
.toast-stack .toast { pointer-events: auto; }
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  min-width: 320px;
  max-width: 420px;
  padding: 12px 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--bd-default);
  border-radius: 12px;
  box-shadow: var(--pv-shadow-popover);
  animation: slide-in-up .25s var(--pv-ease-out);
}
@keyframes slide-in-up { from { transform: translateY(20px); opacity: 0 } to { transform: none; opacity: 1 } }
.toast__icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.toast--success .toast__icon { background: var(--st-success-bg); color: var(--st-success); }
.toast--error .toast__icon { background: var(--st-critical-bg); color: var(--st-critical); }
.toast--info .toast__icon { background: var(--st-info-bg); color: var(--st-info-fg); }
.toast__body { flex: 1; }
.toast__title { font: var(--pv-text-body-2-bold); color: var(--fg-primary); }
.toast__desc { font: var(--pv-text-body-3); color: var(--fg-secondary); margin-top: 2px; }

/* ===================== Misc utilities ===================== */
.grid { display: grid; gap: 16px; }
.grid--mb { margin-bottom: 16px; }
.grid--gap-sm { gap: 12px; }
.grid--gap-xs { gap: 10px; }
.grid--1col { grid-template-columns: 1fr; }
.grid--2col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4col { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--2-1 { grid-template-columns: 2fr 1fr; }
.grid--12-1 { grid-template-columns: 1.2fr 1fr; }
.grid--auto-fill { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.grid--auto-fit-sm { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.grid--4col-fit { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
.grid--auto-fit-md { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid--stretch { align-items: stretch; }
.grid--stretch > .card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.grid--stretch > .card .distribution-split,
.grid--stretch > .card .dual-chart--fluid {
  flex: 1;
  min-height: 0;
}
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.mono {
  font-family: var(--pv-font-mono);
  font-variant-numeric: tabular-nums;
}
.muted { color: var(--fg-secondary); }
.divider { height: 1px; background: var(--bd-soft); }
.hr-v { width: 1px; height: 22px; background: var(--bd-default); }
.skel { background: linear-gradient(90deg, var(--shimmer-a), var(--shimmer-b), var(--shimmer-a)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

/* Empty state */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  color: var(--fg-secondary);
  text-align: center;
}
.empty__icon { width: 56px; height: 56px; border-radius: 14px; background: var(--surf-1); display: grid; place-items: center; color: var(--fg-muted); margin-bottom: 4px; }

/* Tooltip */
.tt { position: relative; }
.tt::after {
  content: attr(data-tt);
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  padding: 5px 9px;
  background: var(--bg-surface-3);
  border: 1px solid var(--bd-default);
  border-radius: 6px;
  font: var(--pv-text-body-3);
  color: var(--fg-primary);
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity var(--pv-dur-fast);
  z-index: 30;
}
.header__actions .tt::after { z-index: 40; }
.tt:hover::after { opacity: 1; }

/* Dashboard chart legend — toggle series visibility */
.chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  margin: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: opacity var(--pv-dur-fast), color var(--pv-dur-fast);
}
.chart-legend__item:hover { color: var(--fg-primary); }
.chart-legend__item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.chart-legend__item.is-off {
  opacity: 0.45;
  text-decoration: line-through;
  color: var(--fg-muted);
}
.chart-legend__item.is-off:hover {
  opacity: 0.65;
  color: var(--fg-secondary);
}
.chart-legend__swatch {
  display: inline-block;
  border-radius: 2px;
  flex-shrink: 0;
}
.chart-legend__meta {
  margin-left: auto;
}

.chart-data-until {
  margin-top: 6px;
  text-align: right;
  color: var(--fg-secondary);
  font: var(--pv-text-caption-1);
}

.dual-chart {
  position: relative;
  width: 100%;
  cursor: crosshair;
  overflow: visible;
}
.dual-chart--fluid,
.category-trend__chart.dual-chart--fluid {
  height: auto;
  min-height: var(--chart-min-h, 280px);
  aspect-ratio: var(--chart-aspect, 800 / 280);
  max-height: min(56vh, 560px);
}
.dual-chart:hover {
  z-index: 10;
}
.dual-chart--selectable {
  cursor: col-resize;
}
.dual-chart--dragging {
  user-select: none;
}
.dual-chart__selection {
  position: absolute;
  top: 0;
  bottom: 28px;
  z-index: 2;
  pointer-events: none;
  background: rgba(126, 146, 248, 0.18);
  border-left: 1px solid rgba(126, 146, 248, 0.65);
  border-right: 1px solid rgba(126, 146, 248, 0.65);
}
.time-pill--reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 0 12px;
  height: 36px;
  border: 1px solid var(--bd-strong);
  border-radius: 999px;
  background: var(--bg-surface-2);
  color: var(--fg-secondary);
  font: var(--pv-text-body-3-bold);
  cursor: pointer;
}
.time-pill--reset:hover {
  color: var(--fg-primary);
  border-color: var(--accent);
}
.dual-chart__svg {
  width: 100%;
  height: 100%;
  display: block;
}
.dual-chart__y-axis-title {
  position: absolute;
  left: 0;
  top: var(--dual-chart-pad-t, 6%);
  bottom: var(--dual-chart-pad-b, 9%);
  width: var(--dual-chart-y-title-w, 3.5%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
}
.dual-chart__y-axis-title-inner {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: pre-line;
  text-align: center;
  font-family: Mulish, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: var(--fg-muted);
}
.dual-chart__y-axis-title-inner::first-line {
  color: var(--fg-secondary);
}
.dual-chart__tip {
  position: absolute;
  top: 8px;
  z-index: 100;
  pointer-events: none;
  padding: 8px 10px;
  min-width: 148px;
  background: var(--bg-surface-3);
  border: 1px solid var(--bd-strong);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  font: var(--pv-text-body-3);
  color: var(--fg-primary);
}
.dual-chart__tip-time {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--bd-soft);
  font: var(--pv-text-body-3-bold);
  color: var(--fg-secondary);
}
.dual-chart__tip-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 6px 8px;
  margin-top: 4px;
}
.dual-chart__tip-swatch {
  width: 10px;
  height: 3px;
  border-radius: 2px;
}
.dual-chart__tip-label {
  color: var(--fg-secondary);
}
.dual-chart__tip-val {
  font: var(--pv-text-body-3-bold);
  color: var(--fg-primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 4.5em;
}
.dual-chart__tip-hint {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--bd-soft);
  font: var(--pv-text-body-3);
  font-size: 10px;
  line-height: 1.35;
  color: var(--fg-muted);
  text-align: center;
}
.dual-chart__tip--rich {
  min-width: 210px;
}
.dual-chart__tip--opaque {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .dual-chart__tip--opaque {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}
.dual-chart__tip--translucent {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}
.dual-chart__tip--toggle {
  top: auto;
  bottom: 34px;
  pointer-events: auto;
  cursor: pointer;
}
.dual-chart__tip--translucent .dual-chart__tip-time,
.dual-chart__tip--translucent .dual-chart__tip-label,
.dual-chart__tip--translucent .dual-chart__tip-val,
.dual-chart__tip--translucent .dual-chart__tip-meta,
.dual-chart__tip--translucent .dual-chart__tip-hint {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
[data-theme="light"] .dual-chart__tip--translucent .dual-chart__tip-time,
[data-theme="light"] .dual-chart__tip--translucent .dual-chart__tip-label,
[data-theme="light"] .dual-chart__tip--translucent .dual-chart__tip-val,
[data-theme="light"] .dual-chart__tip--translucent .dual-chart__tip-meta,
[data-theme="light"] .dual-chart__tip--translucent .dual-chart__tip-hint {
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85);
}
.dual-chart__tip-meta {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--bd-soft);
  font: var(--pv-text-body-3);
  color: var(--fg-muted);
  white-space: nowrap;
}

/* DNS queries page */
.dns-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  gap: 12px 16px;
  align-items: end;
}
.dns-filters__group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.dns-filters__group--actions {
  justify-content: flex-end;
  align-self: end;
}
.dns-filters__label {
  font: var(--pv-text-body-3-bold);
  color: var(--fg-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
[data-theme="light"] .dns-filters .input {
  background: #F7F8FC;
  border-color: var(--bd-strong);
}
[data-theme="light"] .dns-filters .input:hover {
  border-color: #9699BD;
}
[data-theme="light"] .dns-filters .input:focus {
  background: var(--bg-input);
  border-color: var(--bd-focus);
  box-shadow: 0 0 0 3px rgba(115, 129, 244, 0.20);
}
.dns-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.dns-card-head__title {
  font: var(--pv-text-h4);
  color: var(--fg-primary);
}
.dns-card-head__sub {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
  margin-top: 2px;
}
.dns-chart-card {
  margin-bottom: 16px;
}
.dns-chart-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.dns-chart-card__titles {
  min-width: 0;
}
.dns-chart-card__title {
  font: var(--pv-text-h4);
  color: var(--fg-primary);
}
.dns-chart-card__sub {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
  margin-top: 2px;
}
.dns-chart-card__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-bottom: 8px;
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}
.dns-chart-card__swatch {
  width: 12px;
  height: 2px;
}
.dns-chart-card__hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font: var(--pv-text-body-3);
  color: var(--fg-muted);
}
.dns-chart-card__plot,
.dns-chart-card__state {
  min-height: 320px;
}
.dns-chart-card__state.skeleton {
  height: 320px;
  min-height: 320px;
}
@media (max-width: 900px) {
  .dns-chart-card__head {
    flex-wrap: wrap;
  }
  .dns-chart-card__legend {
    gap: 4px 10px;
  }
}
@media (max-width: 600px) {
  .dns-chart-card__hint {
    align-items: flex-start;
    line-height: 1.4;
  }
  .dual-chart__tip-meta {
    white-space: normal;
  }
}

.monitoring-page__layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.monitoring-page__head-actions {
  gap: 8px;
}
.monitoring-page__params-skeleton {
  height: 220px;
}
.monitoring-param-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.monitoring-param-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-surface-2);
  color: var(--fg-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.monitoring-param-list__item:hover {
  border-color: var(--accent);
}
.monitoring-param-list__item.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-surface-2));
}
.monitoring-param-list__label {
  font-weight: 600;
  line-height: 1.35;
}
.monitoring-page__main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.monitoring-page__period-head,
.monitoring-page__chart-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.monitoring-page__period-title,
.monitoring-page__chart .card__title {
  font-weight: 600;
}
.monitoring-page__period-sub {
  margin-top: 4px;
  color: var(--fg-muted);
  font-size: var(--pv-text-sm);
}
.monitoring-page__period-fields {
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.monitoring-page__period-actions {
  gap: 8px;
}
.monitoring-page__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-muted);
  font-size: var(--pv-text-sm);
}
.monitoring-page__legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}
.monitoring-page__chart-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--fg-muted);
  font-size: var(--pv-text-sm);
}
.monitoring-page__chart-skeleton {
  height: 320px;
}
.monitoring-page__chart-plot {
  min-height: 320px;
}
.monitoring-page__chart .dual-chart__svg text {
  font-size: 11px;
  fill: var(--fg-secondary);
}
.monitoring-page__chart .dual-chart__y-axis-title-inner {
  font-size: 15px;
  color: var(--fg-secondary);
}
.monitoring-page__chart .dual-chart__y-axis-title-inner::first-line {
  color: var(--fg-primary);
}
.monitoring-page__chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 16px;
  align-items: start;
}
.monitoring-page__bounds-skeleton {
  height: 180px;
}
.monitoring-page__bounds-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.monitoring-page__bounds-actions {
  display: flex;
  gap: 8px;
}
.monitoring-page__bounds-meta {
  color: var(--fg-muted);
  font-size: var(--pv-text-sm);
  line-height: 1.4;
}
.monitoring-page__bounds-error {
  color: var(--st-critical);
  font-size: var(--pv-text-sm);
  line-height: 1.45;
}
.monitoring-page__deviations-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.monitoring-page__deviations-skeleton {
  height: 240px;
}
.header-bell-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: auto;
  min-width: 38px;
  height: 38px;
  padding: 4px 6px;
}
.header-bell-btn--has-badge {
  height: auto;
  min-height: 38px;
  padding-bottom: 3px;
}
.header-bell-badge {
  position: static;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--st-critical);
  color: var(--fg-on-grad);
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
@media (max-width: 960px) {
  .monitoring-page__layout {
    grid-template-columns: 1fr;
  }
  .monitoring-page__chart-layout {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .monitoring-page__period-head,
  .monitoring-page__chart-legend {
    flex-direction: column;
    align-items: flex-start;
  }
  .monitoring-page__period-actions {
    width: 100%;
  }
}
@property --dns-left-split {
  syntax: '<number>';
  inherits: true;
  initial-value: 0.333333;
}
@property --dns-mid-split {
  syntax: '<number>';
  inherits: true;
  initial-value: 0.333333;
}
@property --dns-right-split {
  syntax: '<number>';
  inherits: true;
  initial-value: 0.333333;
}

.dns-tops-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 16px;
  min-width: 0;
  --dns-left-split: 0.333333;
  --dns-mid-split: 0.333333;
  --dns-right-split: 0.333333;
  transition:
    --dns-left-split var(--pv-dur-base) var(--pv-ease-out),
    --dns-mid-split var(--pv-dur-base) var(--pv-ease-out),
    --dns-right-split var(--pv-dur-base) var(--pv-ease-out);
}
.dns-tops-row.is-dragging {
  transition: none;
}
.dns-tops-row.is-snapping {
  transition: none;
}
.dns-tops-row__pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.dns-tops-row__pane--clients {
  flex: var(--dns-left-split) 1 0;
}
.dns-tops-row__pane--domains {
  flex: var(--dns-mid-split) 1 0;
}
.dns-tops-row__pane--servers {
  flex: var(--dns-right-split) 1 0;
}
.dns-tops-row__pane > .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.dns-tops-row.is-dragging .dns-top-card .table-wrap {
  pointer-events: none;
}
.dns-tops-row__splitter {
  flex: 0 0 10px;
  width: 10px;
  margin: 0 -3px;
  cursor: col-resize;
  position: relative;
  z-index: 2;
  touch-action: none;
  align-self: stretch;
  overflow: hidden;
  transition:
    flex-basis var(--pv-dur-base) var(--pv-ease-out),
    width var(--pv-dur-base) var(--pv-ease-out);
}
.dns-tops-row.is-dragging .dns-tops-row__splitter {
  transition: none;
}
.dns-tops-row__splitter::before {
  content: '';
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 1px;
  background: var(--bd-default);
  transition: background var(--pv-dur-fast) var(--pv-ease-out);
}
.dns-tops-row__splitter:hover::before,
.dns-tops-row.is-dragging .dns-tops-row__splitter::before {
  background: var(--accent);
}
.dns-top-card__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 8px;
  flex-shrink: 0;
}
.dns-hide-resolvers {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
  cursor: pointer;
  user-select: none;
}
.dns-hide-resolvers input {
  margin: 0;
}
.dns-explorer-page .page-head {
  margin-bottom: 12px;
}
.dns-explorer-suggest {
  min-width: 0;
  flex: 1 1 auto;
}
.dns-explorer-suggest .input {
  width: 100%;
}
.dns-explorer-results.card--explorer-results .table-wrap {
  width: 100%;
}
.dns-explorer-results.card--explorer-results .table {
  width: 100%;
}
.dns-ip-cell {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.dns-ip-cell__badge {
  flex-shrink: 0;
}
.dns-top-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  contain: none;
  overflow: visible;
}
.dns-top-card > .dns-card-head {
  flex-shrink: 0;
}
.dns-top-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}
.dns-top-card .table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  max-height: none;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}
.dns-top-card .table {
  width: max-content;
  min-width: 100%;
}
.dns-top-card .table th,
.dns-top-card .table td {
  white-space: nowrap;
}
/* Без sticky: заголовки остаются над данными в потоке таблицы, без наложения при прокрутке */
.dns-top-card .table-wrap .table thead th {
  position: static;
  top: auto;
  z-index: auto;
  box-shadow: none;
}
.dns-top-card .table-foot {
  flex-shrink: 0;
}
.dns-table-domain {
  display: inline-block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.dns-top-card .dns-table-domain {
  max-width: none;
  min-width: 160px;
}
.dns-error-pct {
  font-variant-numeric: tabular-nums;
}
.dns-error-pct--warning {
  color: var(--st-warning);
  font-weight: 600;
}
.dns-error-pct--critical {
  color: var(--st-critical);
  font-weight: 600;
}
.table tbody tr.dns-row--warning {
  background: var(--st-warning-bg);
}
.table tbody tr.dns-row--critical {
  background: var(--st-critical-bg);
}
.table tbody tr.dns-row--warning:hover {
  background: color-mix(in srgb, var(--st-warning-bg) 70%, var(--surf-1));
}
.table tbody tr.dns-row--critical:hover {
  background: color-mix(in srgb, var(--st-critical-bg) 70%, var(--surf-1));
}
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.link-btn:hover {
  text-decoration: underline;
}

.dns-recent-card__body {
  min-width: 0;
}
.dns-recent-card .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.dns-recent-card .table {
  width: max-content;
  min-width: 100%;
}
.dns-recent-card .table th,
.dns-recent-card .table td {
  white-space: nowrap;
}
.dns-recent-card .table td:has(.dns-recent-domain),
.dns-recent-card .table td:has(.dns-recent-answers) {
  white-space: normal;
  max-width: 280px;
}
.dns-recent-time {
  font-variant-numeric: tabular-nums;
}
.dns-recent-ip {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}
.dns-recent-domain,
.dns-recent-answers {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.dns-recent-badge .badge {
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, currentColor 38%, transparent);
  font: var(--pv-text-body-3-bold);
  letter-spacing: 0.02em;
  text-transform: none;
}
.dns-recent-badge .badge--success {
  background: rgba(81, 209, 109, 0.18);
  color: #7BEA93;
}
.dns-recent-badge .badge--info {
  background: rgba(126, 146, 248, 0.20);
  color: #C0C9FF;
}
.dns-recent-badge .badge--warning {
  background: rgba(240, 180, 0, 0.18);
  color: #FFD45C;
}
.dns-recent-badge .badge--critical {
  background: rgba(240, 65, 56, 0.20);
  color: #FF847D;
}
.dns-recent-badge .badge--neutral {
  background: var(--surf-3);
  color: var(--fg-secondary);
}
[data-theme="light"] .dns-recent-badge .badge--success {
  background: #E3F7E8;
  color: #187A33;
}
[data-theme="light"] .dns-recent-badge .badge--info {
  background: #E8ECFF;
  color: #315EC5;
}
[data-theme="light"] .dns-recent-badge .badge--warning {
  background: #FFF2D6;
  color: #8A5300;
}
[data-theme="light"] .dns-recent-badge .badge--critical {
  background: #FDE7E5;
  color: #B42318;
}
[data-theme="light"] .dns-recent-badge .badge--neutral {
  background: #EAEDF8;
  color: #55566C;
}
@media (max-width: 960px) {
  .dns-recent-card .table td:has(.dns-recent-domain),
  .dns-recent-card .table td:has(.dns-recent-answers) {
    max-width: 200px;
  }
  .dns-recent-domain,
  .dns-recent-answers {
    max-width: 180px;
  }
}

@media (max-width: 960px) {
  .dns-tops-row {
    flex-direction: column;
    gap: 16px;
  }
  .dns-tops-row__pane--clients,
  .dns-tops-row__pane--domains,
  .dns-tops-row__pane--servers {
    flex: 0 0 auto;
    width: 100%;
  }
  .dns-tops-row__splitter {
    display: none;
  }
  .dns-filters {
    grid-template-columns: 1fr 1fr;
  }
  .dns-filters__group--actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .dns-filters {
    grid-template-columns: 1fr;
  }
}

/* Collector status tree */
.status-tree {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.status-tree__block {
  overflow: hidden;
}
.status-tree__head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.status-tree__head:hover .status-tree__title {
  color: var(--fg-primary);
}
.status-tree__head-main {
  flex: 1;
  min-width: 0;
}
.status-tree__title {
  display: block;
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
}
.status-tree__meta {
  display: block;
  margin-top: 2px;
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}
.status-tree__section {
  margin-left: 18px;
  padding-left: 12px;
  border-left: 1px solid var(--bd-default);
}
.status-tree__head--collector {
  margin-top: 8px;
}
.status-tree__table-wrap {
  margin: 8px 0 4px 18px;
  overflow-x: auto;
}
.status-tree__table th.num,
.status-tree__table td.num {
  text-align: right;
  white-space: nowrap;
}

.observations-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.obs-tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.obs-tile--expanded {
  grid-column: 1 / -1;
}
.obs-tile__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.obs-tile__title {
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
}
.obs-tile__desc {
  margin-top: 2px;
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}
.obs-tile__sub {
  margin-top: 2px;
  font: var(--pv-text-body-3);
  color: var(--fg-muted);
}
.obs-tile__tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.obs-tile__expand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--bd-default);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--fg-primary);
  font: var(--pv-text-body-3-bold);
  cursor: pointer;
  transition: border-color var(--pv-dur-fast), background var(--pv-dur-fast);
}
.obs-tile__expand:hover {
  border-color: var(--bd-strong);
  background: var(--surf-2);
}
.obs-tile__icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--fg-secondary);
  cursor: pointer;
  transition: background var(--pv-dur-fast), color var(--pv-dur-fast), border-color var(--pv-dur-fast);
}
.obs-tile__icon:hover {
  background: var(--surf-2);
  color: var(--fg-primary);
}
.obs-tile__icon--danger:hover {
  background: var(--st-critical-bg);
  color: var(--st-critical);
  border-color: rgba(240, 65, 56, 0.35);
}
.obs-tile__lookback.seg {
  height: 32px;
  align-items: center;
}
.obs-tile__lookback.seg button {
  height: 26px;
  padding: 0 8px;
}
.obs-tile__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.obs-tile__meta {
  color: var(--fg-muted);
  font: var(--pv-text-body-3);
}
.obs-tile__footer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.obs-tile__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.obs-tile__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--bd-soft);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--fg-secondary);
  font: var(--pv-text-body-3);
  cursor: pointer;
  transition: border-color var(--pv-dur-fast), background var(--pv-dur-fast), color var(--pv-dur-fast), opacity var(--pv-dur-fast);
}
.obs-tile__chip:hover {
  border-color: var(--bd-strong);
  color: var(--fg-primary);
}
.obs-tile__chip.is-active,
.obs-tile__chip.is-solo {
  border-color: var(--bd-strong);
  background: var(--surf-3, var(--surf-2));
  color: var(--fg-primary);
  font: var(--pv-text-body-3-bold);
}
.obs-tile__chip.is-off {
  opacity: 0.4;
}
.obs-tile__chip-swatch {
  width: 10px;
  height: 2px;
  border-radius: 1px;
  flex-shrink: 0;
}
.obs-tile__chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.obs-tile__row--other {
  color: var(--fg-secondary);
}
.obs-tile__row--pick {
  cursor: pointer;
}
.obs-tile__row--pick:hover td {
  background: var(--surf-2);
}
.obs-tile__row--focus td {
  background: var(--surf-3, var(--surf-2));
}

@media (max-width: 960px) {
  .observations-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px) {
  .grid--2-1,
  .grid--12-1 {
    grid-template-columns: 1fr;
  }
  .dashboard-chart-row {
    flex-direction: column;
    gap: 16px;
  }
  .dashboard-chart-row__pane--main,
  .dashboard-chart-row__pane--distribution {
    flex: 0 0 auto;
    width: 100%;
  }
  .dashboard-chart-row__splitter {
    display: none;
  }
}

@media (max-width: 1100px) {
  .grid--3col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .grid--2col,
  .grid--4col {
    grid-template-columns: 1fr;
  }
  .grid--4col-fit {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
}

@media (max-width: 720px) {
  .grid--3col {
    grid-template-columns: 1fr;
  }
}

/* Responsive: collapse sidebar under 1280px automatically */
@media (max-width: 1280px) {
  .app:not([data-collapsed="true"]) { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
  .app:not([data-collapsed="true"]) .sidebar__wordmark,
  .app:not([data-collapsed="true"]) .nav-item__label,
  .app:not([data-collapsed="true"]) .nav-section__label,
  .app:not([data-collapsed="true"]) .nav-section__chev,
  .app:not([data-collapsed="true"]) .nav-item__badge,
  .app:not([data-collapsed="true"]) .nav-section__body,
  .app:not([data-collapsed="true"]) .nav-section__head { display: none; }
}

/* Interface roles */
.ir-sum-card__label { font: var(--pv-text-body-3); color: var(--fg-secondary); }
.ir-sum-card__value { font: var(--pv-text-headline-3-bold); margin-top: 4px; }
.ir-sum-card__hint { font: var(--pv-text-body-3); color: var(--fg-secondary); margin-top: 4px; }
.field-hint { font: var(--pv-text-body-3); color: var(--fg-secondary); margin-top: 4px; }
.field-error { color: var(--st-critical); font: var(--pv-text-body-3); margin-top: 4px; }
.ir-traffic-toolbar .seg button { padding: 4px 10px; font: var(--pv-text-body-3); }
.ir-compare-matrix-wrap { overflow-x: auto; }
.ir-compare-matrix { width: 100%; font: var(--pv-text-body-3); }
.ir-compare-matrix th, .ir-compare-matrix td { padding: 8px 10px; text-align: center; border: 1px solid var(--border-subtle); }
.ir-compare-matrix th:first-child { text-align: left; }
.ir-matrix-cell--match { background: rgba(26, 127, 55, 0.12); }
.ir-matrix-cell--mismatch { background: rgba(183, 129, 3, 0.12); }
.ir-matrix-cell--unknown { background: var(--surf-2); color: var(--fg-secondary); }
.ir-matrix-cell__pct { font-size: 11px; color: var(--fg-secondary); }
.ir-coverage-warn {
  padding: 10px 12px;
  border-radius: var(--radius-control);
  background: var(--st-warning-bg);
  color: var(--st-warning);
  font: var(--pv-text-body-3);
}
.tc-choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tc-choice-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--bd-default);
  background: var(--bg-surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.tc-choice-item:hover:not(.is-disabled) {
  border-color: var(--bd-strong, var(--bd-default));
}
.tc-choice-item.is-selected {
  border-color: var(--accent, #3b82f6);
  background: rgba(59, 130, 246, 0.08);
}
.tc-choice-item.is-disabled {
  cursor: default;
  opacity: 0.75;
}
.tc-choice-item input[type="radio"] {
  flex: 0 0 auto;
  margin: 3px 0 0;
}
.tc-choice-item__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.tc-choice-item__label {
  font: var(--pv-text-body-2);
  color: var(--fg-primary);
}
.tc-impact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 12px;
  color: var(--fg-secondary);
  font: var(--pv-text-body-3);
}
.ir-bulk-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--bd-default);
  background: var(--bg-surface-2);
  color: var(--fg-secondary);
  font: var(--pv-text-body-3);
}
.ir-bulk-hint p {
  margin: 0;
  flex: 1 1 220px;
  color: var(--fg-secondary);
}
.ir-bulk-panel {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--bd-default));
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-surface-2));
  color: var(--fg-secondary);
}
.ir-bulk-panel__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.ir-bulk-panel__title {
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
}
.ir-bulk-panel__count {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}
.ir-bulk-panel__count b {
  color: var(--fg-primary);
}
.ir-bulk-panel__actions {
  gap: 8px;
  flex-wrap: wrap;
}
.ir-port-filters .field label { font: var(--pv-text-body-3); }
.ir-list-hint {
  margin: 0 0 12px;
  color: var(--fg-secondary);
  font: var(--pv-text-body-3);
}
.ir-status-badge--not_started { }
.ir-status-badge--partial { }
.ir-status-badge--done { }

/* ============== Completeness modal (collectors) ============== */
.completeness-pct-btn {
  all: unset;
  cursor: pointer;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 6px 2px 4px;
  margin: -2px -6px -2px -4px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.completeness-pct-btn:hover {
  background: var(--surf-2);
  border-color: var(--bd-default);
}
.completeness-pct-btn:hover .completeness-pct-value,
.completeness-pct-btn:hover .completeness-pct-muted {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.completeness-pct-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.completeness-pct-chevron {
  flex: 0 0 auto;
  color: var(--fg-muted);
  opacity: 0.55;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.completeness-pct-btn:hover .completeness-pct-chevron {
  opacity: 1;
  transform: translateX(1px);
}
.completeness-pct-value {
  font: var(--pv-text-body-2-bold);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}
.completeness-pct-green { color: var(--st-healthy); }
.completeness-pct-yellow { color: var(--st-warning); }
.completeness-pct-red { color: var(--st-critical); }
.completeness-pct-muted {
  color: var(--fg-muted);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}

.completeness-tone-green { color: var(--st-healthy); }
.completeness-tone-yellow { color: var(--st-warning); }
.completeness-tone-red { color: var(--st-critical); }
.completeness-tone-unknown { color: var(--fg-muted); }

.completeness-modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.completeness-modal-section-title {
  margin: 0 0 10px;
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
}
.completeness-verdict-headline {
  font: var(--pv-text-title-4);
  color: var(--fg-primary);
  margin-bottom: 6px;
}
.completeness-verdict-line {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
  line-height: 1.45;
}

.completeness-funnel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--bd-default);
  border-radius: 10px;
  background: var(--surf-2);
}
.completeness-funnel-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.completeness-funnel-line-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.completeness-funnel-line--loss {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding-left: 16px;
  font: var(--pv-text-body-3);
  color: var(--st-warning);
}
.completeness-funnel-line--exclusion {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding-left: 16px;
  font: var(--pv-text-body-3);
}
.completeness-funnel-label {
  font: var(--pv-text-body-2-bold);
  color: var(--fg-primary);
}
.completeness-funnel-source,
.completeness-funnel-note {
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}
.completeness-funnel-pct {
  font: var(--pv-text-body-3-bold);
}
.completeness-funnel-link {
  border: none;
  background: none;
  padding: 0;
  font: var(--pv-text-body-3);
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}
.completeness-aggregation {
  margin-top: 10px;
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}

.completeness-loss-breakdown {
  margin-top: 12px;
}
.completeness-loss-breakdown__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--bd-default);
  border-radius: 8px;
  background: var(--surf-1);
  color: var(--fg-primary);
  font: var(--pv-text-body-3-bold);
  cursor: pointer;
  text-align: left;
}
.completeness-loss-breakdown__toggle:hover {
  background: var(--surf-2);
}
.completeness-loss-breakdown__body {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--bd-default);
  border-radius: 10px;
  background: var(--surf-2);
}
.completeness-loss-breakdown__section + .completeness-loss-breakdown__section {
  margin-top: 14px;
}
.completeness-loss-breakdown__section-title {
  margin-bottom: 6px;
  font: var(--pv-text-body-3-bold);
  color: var(--fg-primary);
}
.completeness-loss-table {
  width: 100%;
  border-collapse: collapse;
  font: var(--pv-text-body-3);
}
.completeness-loss-table th {
  padding: 4px 8px 6px 0;
  text-align: left;
  color: var(--fg-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--bd-default);
}
.completeness-loss-table td {
  padding: 6px 8px 6px 0;
  vertical-align: top;
  border-bottom: 1px solid color-mix(in srgb, var(--bd-default) 55%, transparent);
}
.completeness-loss-table__value,
.completeness-loss-table__pct {
  white-space: nowrap;
}
.completeness-loss-table__note {
  color: var(--fg-secondary);
  line-height: 1.35;
}
.completeness-loss-row--unconfirmed td,
.completeness-loss-row--loss td {
  color: var(--st-warning);
}
.completeness-verdict-block {
  margin-top: 8px;
}
.completeness-loss-row--critical td {
  color: var(--st-critical);
}
.completeness-loss-row--result td {
  color: var(--st-healthy);
  font-weight: 600;
}
.completeness-loss-row--sum td {
  font-weight: 600;
}

.completeness-modal-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 720px) {
  .completeness-modal-cards {
    grid-template-columns: 1fr;
  }
}
.completeness-metric-card {
  padding: 12px 14px;
  border: 1px solid var(--bd-default);
  border-radius: 10px;
  background: var(--surf-2);
}
.completeness-metric-card-title {
  font: var(--pv-text-body-2-bold);
  margin-bottom: 10px;
}
.completeness-metric-card-grid {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.completeness-metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font: var(--pv-text-body-3);
}
.completeness-metric-row dt {
  color: var(--fg-secondary);
}
.completeness-metric-row dd {
  margin: 0;
  font: var(--pv-text-body-3-bold);
  color: var(--fg-primary);
}

.completeness-history-loading,
.completeness-history-empty {
  padding: 16px;
  text-align: center;
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}
.completeness-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  font: var(--pv-text-body-3);
  color: var(--fg-secondary);
}

.impersonation-banner {
  position: fixed;
  top: var(--header-h);
  left: var(--sidebar-w);
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--st-warning) 16%, var(--bg-surface));
  border-bottom: 1px solid color-mix(in srgb, var(--st-warning) 35%, transparent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.app[data-collapsed="true"] .impersonation-banner {
  left: var(--sidebar-w-collapsed);
}
.impersonation-banner__content {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  font: var(--pv-text-body-3-bold);
  color: var(--fg-primary);
}
.impersonation-banner__meta {
  font: var(--pv-text-caption-1);
  color: var(--fg-secondary);
}
.app[data-cabinet="1"] .main {
  /* leave room for fixed impersonation banner when present */
}
.app[data-cabinet="1"]:has(.impersonation-banner) .main {
  padding-top: 44px;
}
.cabinet-dns-warning {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--st-warning) 40%, transparent);
  background: color-mix(in srgb, var(--st-warning) 10%, var(--bg-surface));
  color: var(--fg-primary);
  font: var(--pv-text-body-3);
}
.cabinet-data-meta {
  margin-top: 8px;
}
