/* Altibbi Compass — screenshot layout (full sidebar + overview hero) */

body { color: var(--ink); background: var(--bg); }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - 34px);
}

/* ── Sidebar ── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}
.sidebar-brand { padding: 4px 10px 24px; }
.brand-mark {
  display: block;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--brand);
  background: none;
  -webkit-text-fill-color: var(--brand);
}
.brand-sub {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 2px;
}
.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-2);
  font-weight: 600;
}
.nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  flex-shrink: 0;
}
.nav-item.active .nav-icon {
  background: rgba(0, 131, 143, 0.15);
  color: var(--brand);
}
.nav-text-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-text { font-size: 13px; font-weight: 600; line-height: 1.2; }
.nav-desc { font-size: 11px; color: var(--ink-3); font-weight: 400; line-height: 1.2; }
.nav-item.active .nav-desc { color: var(--brand-2); opacity: 0.75; }
.badge-count {
  margin-left: auto;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: none;
}
.sidebar-footer {
  margin-top: auto;
  padding: 14px 10px 8px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.45;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: blink 2s ease infinite;
}

/* Global filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 39;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  white-space: nowrap;
}
.fselect {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  min-width: 130px;
}
.filter-active-label {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
}
.subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-wrap: nowrap;
  position: sticky;
  top: 0;
  z-index: 40;
}
.filter-bar + .page-header { padding-top: 16px; }
.subheader-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1;
}
.property-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.dot-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-3);
}
.breadcrumb strong { color: var(--ink); font-weight: 700; }
.bc-sep { color: var(--ink-4); }
.subheader-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}
.through-chip {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.through-chip b { color: var(--ink); font-weight: 700; }
.refresh-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--ink-4) !important;
}

/* ── Page header ── */
.page-header {
  padding: 24px 28px 0;
  display: flex;
}
.page-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  background: none;
  -webkit-text-fill-color: var(--ink);
}
.header-tagline {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink-3);
}
.content { padding: 16px 28px 48px; }

/* ── Status / trust ── */
.status-bar {
  min-height: 28px;
  font-size: 12px;
  font-weight: 600;
  border-bottom: none;
}
.status-bar.demo { background: var(--amber-bg); color: var(--amber); }
.status-bar.live { background: var(--green-bg); color: var(--green); }
.trust-strip {
  background: rgba(0, 137, 123, 0.06);
  color: var(--green);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 16px;
  text-align: center;
  border-bottom: 1px solid rgba(0, 137, 123, 0.12);
}

/* ── Insight strip ── */
.insight-strip {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.insight-icon { font-size: 18px; line-height: 1; margin-top: 2px; }
.insight-strip p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.insight-strip strong.hl { color: var(--accent); font-weight: 700; }

/* ── Period metric cards ── */
.metric-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.metric-card {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.metric-card:hover { border-color: var(--brand-ring); }
.metric-card.active-window {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand-ring);
}
.metric-card.active-window .mc-val { color: var(--brand); }
.mc-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.mc-val {
  font-size: 24px;
  font-weight: 800;
  margin-top: 4px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.mc-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ── KPI hero ── */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 20px;
}
.hero-card::before { display: none; }
.aseg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}
.aseg .seg {
  padding: 20px 22px;
  border: none;
  border-right: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.aseg .seg:last-child { border-right: none; }
.aseg .seg:hover { background: var(--surface-2); }
.aseg .seg.sel { background: var(--brand-soft); }
.aseg .seg .k {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.aseg .seg .dot { width: 8px; height: 8px; border-radius: 50%; }
.aseg .seg .period-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-weight: 600;
}
.aseg .seg .v {
  font-size: 32px;
  font-weight: 800;
  margin-top: 6px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  background: none;
  -webkit-text-fill-color: var(--ink);
}
.aseg .seg.sel .v { color: var(--brand); -webkit-text-fill-color: var(--brand); }
.aseg .seg .d { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.aseg .seg .kpi-sub { font-size: 11px; color: var(--ink-4); margin-top: 4px; }
.abody { padding: 16px 20px 12px; }

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.chart-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.chart-hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-3);
  opacity: 0.85;
}
.metric-toggle {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px;
}
.metric-toggle button {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 4px;
  color: var(--ink-3);
  cursor: pointer;
}
.metric-toggle button.on {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-xs);
}
.compass-chart {
  position: relative;
  min-height: 220px;
  width: 100%;
  cursor: crosshair;
}
.compass-chart svg { display: block; width: 100%; height: 220px; }

.chart-point {
  cursor: pointer;
  outline: none;
}
.chart-point:focus-visible .chart-dot {
  stroke-width: 3;
  filter: drop-shadow(0 0 4px var(--brand));
}
.chart-point:hover .chart-dot,
.chart-point.selected .chart-dot {
  fill: var(--brand);
  stroke-width: 3;
}
.chart-point .chart-hit {
  pointer-events: all;
}

.chart-tooltip {
  position: absolute;
  z-index: 350;
  transform: translate(-50%, calc(-100% - 10px));
  min-width: 160px;
  max-width: min(280px, calc(100vw - 24px));
  padding: 12px 16px;
  background: var(--surface-solid, var(--surface));
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  pointer-events: none;
  animation: fadeUp 0.2s var(--ease);
}
.chart-tooltip-fixed {
  position: fixed;
  z-index: 350;
}
.chart-tooltip.below {
  transform: translate(-50%, 0);
}
.chart-tooltip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--surface-solid, var(--surface));
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.chart-tooltip.below::after {
  bottom: auto;
  top: -6px;
  border-right: none;
  border-bottom: none;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
}
.chart-tooltip-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.chart-tooltip-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.chart-tooltip-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.chart-tooltip-sub {
  font-size: 11px;
  color: var(--ink-2);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  line-height: 1.4;
}

.hero-card .abody,
.hero-card .compass-chart {
  overflow: visible;
}

/* ── Dashboard grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 0;
}
.panel-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.cap {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.panel-sections,
.panel-pages { grid-column: span 1; }

/* Content sections list */
.section-bars {
  padding: 10px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.section-card {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color var(--dur), background var(--dur), box-shadow var(--dur), transform var(--dur);
  animation: fadeUp 0.4s var(--ease) backwards;
}
.section-card:hover {
  border-color: color-mix(in srgb, var(--c) 35%, var(--line));
  background: color-mix(in srgb, var(--c) 5%, white);
  box-shadow: var(--shadow-xs);
  transform: translateY(-1px);
}
.section-card.active-section {
  border-color: color-mix(in srgb, var(--c) 50%, var(--line));
  background: color-mix(in srgb, var(--c) 8%, white);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 20%, transparent);
}
.section-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.section-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.section-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--c) 14%, white);
  border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
}
.section-labels { min-width: 0; }
.section-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.section-name-ar {
  display: block;
  font-size: 11px;
  font-family: var(--font-ar);
  color: var(--ink-3);
  margin-top: 2px;
  line-height: 1.3;
}
.section-card-stats {
  text-align: right;
  flex-shrink: 0;
}
.section-clicks {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.section-share {
  display: inline-block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, white);
  padding: 2px 8px;
  border-radius: 999px;
}
.section-bar-track {
  height: 5px;
  background: var(--line-2);
  border-radius: 999px;
  overflow: hidden;
}
.section-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 65%, white));
  transition: width 0.7s var(--ease);
}
.panel-sections .panel-top { padding-bottom: 4px; }

/* Market / countries / devices */
.market-hero {
  margin: 8px 16px 0;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  border: 1px solid rgba(0, 131, 143, 0.15);
}
.market-hero .name { font-size: 12px; color: var(--ink-3); }
.market-hero .val { font-size: 24px; font-weight: 800; color: var(--ink); }
.market-hero .hero-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
#countriesList { padding-bottom: 8px; }
#pagesPreview { padding: 4px 8px 12px; }
.brow .lab { color: var(--ink); }
.brow .num { color: var(--ink); }
.brow:hover { background: var(--surface-2); }

.device-grid { padding: 8px 16px 16px; }
.device-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.preview-row:hover { background: var(--surface-2); transform: none; }

/* Range pills + sync */
.range-pills {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
}
.rpill {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  background: transparent;
  border: none;
  cursor: pointer;
}
.rpill.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-xs); }
.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--brand) !important;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: none;
  animation: none !important;
}
.refresh-btn .refresh-icon { width: 16px; height: 16px; }
.evidence {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.evidence.observed { background: var(--green-bg); color: var(--green); }
.evidence.live { background: var(--brand-soft); color: var(--brand); border: 1px solid rgba(0, 131, 143, 0.2); }
.evidence.estimated { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(245, 124, 0, 0.25); }
.evidence.demo { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); }

/* Tables / misc screens */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.data-table th { background: var(--surface-2); color: var(--ink-3); }
.data-table td { color: var(--ink); border-bottom: 1px solid var(--line-2); }
.data-table tr.clickable:hover { background: var(--brand-soft); }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.searchbox input { border: none; outline: none; background: transparent; font: inherit; width: 100%; color: var(--ink); }
.tselect { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.empty-state, .empty-cell { color: var(--ink-3); text-align: center; padding: 24px; }

/* ── Split-screen page detail ── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}
.workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}
/* ── Centered detail modal ── */
body.modal-open {
  overflow: hidden;
}

.sheet-scrim {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  z-index: 400;
  transition: opacity 0.28s var(--ease);
}
.sheet-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 401;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.detail-modal.open {
  pointer-events: auto;
  opacity: 1;
}
.detail-modal[hidden] {
  display: none !important;
}

.detail-modal-dialog {
  width: min(640px, 100%);
  max-height: min(88vh, 840px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 28px 80px rgba(15, 23, 42, 0.24),
    0 12px 32px rgba(15, 23, 42, 0.12);
  transform: scale(0.92) translateY(16px);
  transition: transform 0.34s cubic-bezier(0.34, 1.25, 0.64, 1);
  overflow: hidden;
}
.detail-modal.open .detail-modal-dialog {
  transform: scale(1) translateY(0);
}

.detail-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 22px 18px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--sheet-accent, var(--brand)) 14%, var(--surface)) 0%,
    var(--surface) 55%
  );
  position: relative;
}
.detail-modal-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--sheet-accent, var(--brand));
  border-radius: 20px 20px 0 0;
}

.detail-modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
}

.detail-modal-head-text {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.detail-modal-head-text .sheet-kicker {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sheet-accent, var(--brand));
  margin-bottom: 6px;
}

.detail-modal-head-text h2 {
  margin: 0;
  font-size: clamp(18px, 4vw, 22px);
  font-weight: 800;
  font-family: var(--font-ar);
  line-height: 1.35;
  color: var(--ink);
  word-break: break-word;
}

.detail-modal-close {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.detail-modal-close:hover {
  background: var(--surface);
  color: var(--ink);
  transform: scale(1.05);
}

.detail-modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  background: var(--surface);
}

.detail-modal-body .detail-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.detail-modal-body .detail-card {
  padding: 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.detail-modal-body .detail-card:hover {
  border-color: color-mix(in srgb, var(--sheet-accent, var(--brand)) 35%, var(--line));
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.detail-modal-body .detail-card .dk {
  font-size: 10px;
  letter-spacing: 0.06em;
}

.detail-modal-body .detail-card .dv {
  font-size: 22px;
  margin-top: 6px;
}

.detail-modal-body .url-breadcrumb {
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--line);
}

.detail-modal-body .sheet-section {
  padding: 16px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 12px;
}
.detail-modal-body .sheet-section:last-child {
  margin-bottom: 0;
}

.detail-modal-body .opp-alert {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: var(--red-bg);
  border: 1px solid rgba(229, 57, 53, 0.22);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}
.detail-modal-body .opp-alert strong {
  color: var(--red);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (max-width: 560px) {
  .detail-modal-dialog {
    max-height: 92vh;
    border-radius: 16px;
  }
  .detail-modal-body .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-modal-header {
    padding: 18px 16px 14px;
  }
  .detail-modal-body {
    padding: 16px;
  }
}

.data-table tr.selected,
.preview-row.selected,
.opp-card.selected {
  background: var(--brand-soft) !important;
  box-shadow: inset 3px 0 0 var(--brand);
}
.data-table tr.selected td { background: transparent; }

/* Opportunities */
.queue-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.stat-chip {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  min-width: 120px;
}
.stat-chip.accent { border-color: rgba(0, 131, 143, 0.25); background: var(--brand-soft); }
.stat-chip.warn { border-color: rgba(229, 57, 53, 0.2); background: var(--red-bg); }
.stat-chip .n {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stat-chip.accent .n { color: var(--brand); }
.stat-chip.warn .n { color: var(--red); }
.stat-chip .l {
  font-size: 10px;
  color: var(--ink-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}
#queueGroups {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.opp-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--dur), background var(--dur), box-shadow var(--dur), transform var(--dur);
  animation: fadeUp 0.35s var(--ease) backwards;
  position: relative;
  overflow: hidden;
}
.opp-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--c, var(--red));
  opacity: 0.85;
}
.opp-card.severity-high::before { background: var(--red); }
.opp-card.severity-medium::before { background: var(--amber); }
.opp-card.severity-low::before { background: var(--ink-4); }
.opp-card:hover {
  border-color: color-mix(in srgb, var(--c) 35%, var(--line));
  background: var(--surface-2);
  box-shadow: var(--shadow-xs);
  transform: translateY(-1px);
}
.opp-card.selected {
  border-color: color-mix(in srgb, var(--c) 50%, var(--line));
  background: color-mix(in srgb, var(--c) 6%, white);
  box-shadow: inset 3px 0 0 var(--c);
}
.opp-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--c) 14%, white);
  border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
}
.opp-body { flex: 1; min-width: 0; }
.opp-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-ar);
  line-height: 1.35;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.opp-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.opp-evidence {
  font-size: 12px;
  color: var(--ink-3);
}
.opp-delta {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.opp-delta.dn {
  color: var(--red);
  background: var(--red-bg);
  border-color: rgba(229, 57, 53, 0.2);
}
.opp-delta.up {
  color: var(--green);
  background: var(--green-bg);
  border-color: rgba(0, 137, 123, 0.2);
}



/* Legacy sheet rules — detail modal uses compass.css .detail-modal */
/* Mobile */
.mobile-top {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 35, 50, 0.4);
  z-index: 45;
}
body.nav-open .scrim { display: block; }

.stat-val.loading-pulse { color: var(--ink-4); animation: pulse 1.5s ease infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes spin { to { transform: rotate(360deg); } }
.refresh-btn.spinning .refresh-icon { animation: spin 0.8s linear infinite; }
.chart-path { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: drawLine 1s ease forwards; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }

@media (max-width: 1100px) {
  .metric-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .metric-row { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { padding: 10px 16px; }
  .filter-active-label { width: 100%; margin-left: 0; margin-top: 4px; }
}
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform var(--dur);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  .mobile-top { display: flex; }
  .subheader {
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 10px;
  }
  .subheader-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .through-chip { font-size: 11px; }
  .page-header { padding: 16px 16px 0; }
  .content { padding: 12px 16px 40px; }
  .metric-row { grid-template-columns: 1fr 1fr; }
}
