/* ============================================================
   Intelligence Sidebar — Everflow-style left nav
   ============================================================ */

#intel-sidebar {
  transition: transform 0.2s ease;
}

/* Mobile: off-canvas slide-in */
@media (max-width: 1023px) {
  #sidebar-toggle {
    display: block !important;
  }
  #intel-layout {
    display: block;
  }
  #intel-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 208px;
    z-index: 60;
    transform: translateX(-100%);
  }
  #intel-sidebar.open {
    transform: translateX(0);
  }
  #intel-content {
    width: 100%;
  }
  #sidebar-backdrop {
    display: none;
  }
  #sidebar-backdrop.open {
    display: block;
  }
}

/* Desktop: always visible, hamburger hidden */
@media (min-width: 1024px) {
  #sidebar-toggle {
    display: none !important;
  }
  #sidebar-backdrop {
    display: none !important;
  }
}

/* Nav items */
.nav-item {
  user-select: none;
}
.nav-item.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.nav-item:not(.active):hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Section labels */
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
  padding: 16px 16px 4px;
}

/* ============================================================
   Collapsible Sidebar
   ============================================================ */

#intel-sidebar {
  transition: width 0.2s ease;
  display: flex;
  flex-direction: column;
}

#intel-sidebar > nav {
  flex: 1;
  overflow-y: auto;
}

/* Collapsed state */
#intel-sidebar.collapsed {
  width: 48px;
  overflow: hidden;
}

#intel-sidebar.collapsed .nav-item {
  padding-left: 14px;
  padding-right: 14px;
  justify-content: center;
}

#intel-sidebar.collapsed .nav-item-label {
  display: none;
}

#intel-sidebar.collapsed .nav-section-label {
  visibility: hidden;
  height: 12px;
  padding: 4px 0 0;
}

#intel-sidebar.collapsed .nav-item svg {
  opacity: 1;
}

/* Collapse toggle button */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.15s;
  background: none;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  width: 100%;
}

.sidebar-collapse-btn:hover {
  color: #fff;
}

/* Tooltip on hover when collapsed */
#intel-sidebar.collapsed .nav-item {
  position: relative;
}

#intel-sidebar.collapsed .nav-item:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  background: #1a1a2e;
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  pointer-events: none;
}

/* ============================================================
   Searchable Dropdown
   ============================================================ */

.search-dropdown {
  position: relative;
}

.search-dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: 0;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: none;
}

.search-dropdown-list.open {
  display: block;
}

.search-dropdown-list .dd-option {
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-dropdown-list .dd-option:hover {
  background: #f1f5f9;
}

.search-dropdown-list .dd-option.selected {
  background: #eff6ff;
  color: #1e40af;
}

/* ============================================================
   Panel table — sticky first column
   ============================================================ */

/* Phase 021a/M17 — `table-layout: fixed` on the 3 EF panel tables.
   Under the default `table-layout: auto`, the inline `width:160px` on
   the .panel-table-name <td> is a HINT the browser may ignore when
   sizing columns to fit content. Safari + Chrome both have quirks
   where `min-width: 0` on flex children inside auto-layout cells does
   not always activate `overflow: auto`. Switching the panel tables to
   `table-layout: fixed` makes the column widths deterministic — the
   first row's td widths set the column widths for the whole table.
   NOT applied to .responsive-table broadly: the Report view's table
   has 18 numeric columns that benefit from auto-sizing. */
.panel-scroll-table {
  table-layout: fixed;
}

.panel-table-name {
  position: sticky;
  left: 0;
  background: inherit;
  z-index: 5;
}

tr:hover .panel-table-name {
  background: #eff6ff;
}

tr.bg-blue-50 .panel-table-name {
  background: #eff6ff;
}

/* Phase 021a/M17 — inner-scroll for long entity names per operator
   2026-05-23. Cell width is fixed (~200px); the .panel-name-scroll
   container holds the name button and scrolls horizontally within
   the cell when the name overflows. Thin scrollbar in WebKit so the
   row doesn't look heavy; auto-hide when content fits.
   Hover the cell to read the full name (title attribute on td). */
.panel-name-scroll {
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}
.panel-name-scroll::-webkit-scrollbar {
  height: 4px;
}
.panel-name-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.5); /* slate-400/50 */
  border-radius: 2px;
}
.panel-name-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* Phase 021a/M19 — Detailed Report group column. Hoisted from 4× inline
   styles per steelman P1 #3. Column width is declared structurally in
   the table's <colgroup> in admin/intelligence.html (so even a wrapper-
   less cell — empty-state colspan, cost-breakdown subrow — can't break
   the column). The cell + inner div carry the geometry rules here.
   Sub-rows use a slightly narrower inner div + margin-left to preserve
   the M17-style indent for child rows. */
.report-name-cell {
  width: 200px;
  min-width: 200px;
  max-width: 200px;
}
.report-name-cell > .panel-name-scroll {
  width: 200px;
}
.report-name-cell-sub > .panel-name-scroll {
  width: 184px;
  margin-left: 16px;
}

/* Phase 021a/M20 — panel-header spinner during cross-filter in-flight.
   Per operator 2026-05-24: skeleton-on-body is too quiet a cue; the
   spinner sits next to the panel title (Offers/Partners/Advertisers)
   so the operator sees AT A GLANCE which panels are working. Visible
   via toggling the inline `hidden` attribute from intelligence.js when
   state.panelLoading[panel] changes. */
.panel-loading-spinner {
  display: inline-flex;
  align-items: center;
}
.panel-loading-spinner[hidden] {
  display: none;
}
/* M20 steelman P2 #1 — only animate when the operator has not
   requested reduced motion. Reduced-motion users still see the spinner
   element (so they know loading is in progress) — it just doesn't spin. */
@media (prefers-reduced-motion: no-preference) {
  .panel-loading-spinner {
    animation: panel-spin 0.9s linear infinite;
  }
}
@keyframes panel-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Phase 021a/M20 — visual distinction between client-side search
   filter (Type in the search box → instant text-match) and cross-
   filter (click row / select dropdown → backend re-fetch). The
   active-filter chip already carries the cross-filter affordance;
   this pill surfaces the search-filter state inline near the search
   input so the operator can tell the two apart. Slate-toned (vs the
   blue chip) so they read as DIFFERENT kinds of "filtered". */
.panel-search-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  margin-top: 4px;
  background: rgba(241, 245, 249, 1); /* slate-100 */
  border: 1px solid rgba(203, 213, 225, 1); /* slate-300 */
  border-radius: 9999px;
  font-size: 10px;
  color: rgb(71, 85, 105); /* slate-600 */
}
.panel-search-pill[hidden] {
  display: none;
}
.panel-search-pill button {
  color: rgb(100, 116, 139); /* slate-500 */
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0 0 0 2px;
}
.panel-search-pill button:hover {
  color: rgb(15, 23, 42); /* slate-900 */
}

/* ============================================================
   Pacing progress bars
   ============================================================ */

.pacing-bar {
  height: 8px;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.pacing-bar-bg {
  height: 8px;
  border-radius: 4px;
  background: #e2e8f0;
}

/* ── Chart Hover Tooltip ──────────────────────────────────── */
#chart-tooltip {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  overflow: hidden;
  font-size: 11px;
  line-height: 1.4;
}
#chart-tooltip .tt-header {
  background: #1e293b;
  color: #fff;
  padding: 5px 10px;
  font-weight: 600;
  font-size: 10px;
}
#chart-tooltip .tt-body {
  padding: 6px 10px;
}
#chart-tooltip table { border-collapse: collapse; width: 100%; }
#chart-tooltip th {
  color: #94a3b8;
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  padding: 0 6px 3px 0;
  text-align: right;
}
#chart-tooltip th:first-child { text-align: left; }
#chart-tooltip td { padding: 2px 6px 2px 0; white-space: nowrap; }
#chart-tooltip td:first-child { font-weight: 500; }
#chart-tooltip td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
#chart-tooltip .tt-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
#chart-tooltip .tt-prev { color: #94a3b8; }

/* ── Report Filter Menu ───────────────────────────────────── */
#report-filter-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 60;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 150px;
  font-size: 12px;
}
#report-filter-menu:not(.hidden) { display: block; }
.filter-dim-item {
  padding: 7px 12px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.filter-dim-item:hover { background: #f1f5f9; }
.filter-dim-item:first-child { border-radius: 6px 6px 0 0; }
.filter-dim-item:last-child { border-radius: 0 0 6px 6px; }
.filter-submenu {
  position: absolute;
  top: -1px;
  left: 100%;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 220px;
  max-height: 300px;
  display: none;
  flex-direction: column;
}
.filter-dim-item:hover > .filter-submenu,
.filter-submenu:hover { display: flex; }
.filter-submenu-search {
  padding: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.filter-submenu-search input {
  width: 100%;
  padding: 5px 8px;
  font-size: 11px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  outline: none;
}
.filter-submenu-search input:focus { border-color: #93c5fd; }
.filter-entity-list {
  overflow-y: auto;
  max-height: 240px;
  padding: 4px 0;
}
.filter-entity-option {
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-entity-option:hover { background: #f8fafc; }
.filter-entity-option .fe-check {
  width: 14px; height: 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 10px;
  color: transparent;
}
.filter-entity-option.selected .fe-check {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

/* Filter Pills */
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  font-size: 10px;
  font-weight: 500;
  background: #eff6ff;
  color: #1e40af;
  border-radius: 9999px;
  border: 1px solid #bfdbfe;
  white-space: nowrap;
}
.filter-pill-dim {
  color: #64748b;
  font-weight: 400;
  margin-right: 2px;
}
.filter-pill-remove {
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  color: #3b82f6;
  font-weight: 700;
  margin-left: 2px;
}
.filter-pill-remove:hover { color: #1d4ed8; }

/* ═══════════════════════════════════════════════════════════════
   Mobile/responsive styles → see intelligence-responsive.css
   Column priority system, touch targets, chart sizing, sticky columns
   are all in the dedicated responsive file, not here.
   See also: admin/ARCHITECTURE.md for the full system overview.
   ═══════════════════════════════════════════════════════════════ */
