/* ── PartnerIndex design system ── */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --navy:       #0F3D3E;
  --indigo:     #0F766E;
  --indigo-dark:#115E59;
  --paper:      #F5F4EE;
  --surface:    #FFFFFF;
  --surface-2:  #FAF9F4;
  --ink:        #131316;
  --ink-2:      #3A3550;
  --ink-3:      #8A8A95;
  --hair:       rgba(8,61,62,0.10);
  --success:    #1E9A6A;
  --warn:       #C77A2A;
  --danger:     #C74E3A;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-ui:      'Manrope', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Mono', monospace;
  --radius:     6px;
  --radius-lg:  10px;
  --sidebar-w:  200px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font-ui); background: var(--paper); color: var(--ink); font-size: 14px; line-height: 1.5; }

/* ── App shell ── */
.app-shell { display: flex; min-height: 100vh; }
.page-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── Sidebar ── */
.sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--surface); border-right: 0.5px solid var(--hair); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; border-bottom: 0.5px solid var(--hair); }
.sidebar-brand img { width: 26px; height: 26px; border-radius: 5px; object-fit: cover; object-position: center; flex-shrink: 0; }
.sidebar-brand-name { font-family: var(--font-ui); font-size: 13px; font-weight: 700; color: var(--navy); letter-spacing: -0.01em; }
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-bottom { padding: 8px 0 12px; }
.sidebar-link { display: flex; align-items: center; gap: 8px; padding: 7px 16px; font-size: 12px; font-weight: 500; color: var(--ink-2); text-decoration: none; border-radius: 0; transition: background 0.1s, color 0.1s; }
.sidebar-link svg { opacity: 0.5; flex-shrink: 0; }
.sidebar-link:hover { background: var(--paper); color: var(--indigo); }
.sidebar-link:hover svg { opacity: 0.8; }
.sidebar-link.active { color: var(--indigo); font-weight: 600; background: rgba(15,118,110,0.06); }
.sidebar-link.active svg { opacity: 1; }
.sidebar-section { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); padding: 10px 16px 4px; }
.sidebar-divider { border: none; border-top: 0.5px solid var(--hair); margin: 4px 16px; }

/* ── Page header ── */
.page-header { padding: 32px 32px 0; }
.page-eyebrow { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.page-title { font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.2rem); color: var(--ink); line-height: 1.15; margin-bottom: 6px; }
.page-sub { font-size: 13px; color: var(--ink-3); max-width: 680px; }

/* ── Main content ── */
main { padding: 24px 32px; flex: 1; }

/* ── Panels ── */
.panel { background: var(--surface); border: 0.5px solid var(--hair); border-radius: var(--radius-lg); margin-bottom: 20px; overflow: hidden; }
.panel-header { padding: 14px 20px; border-bottom: 0.5px solid var(--hair); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.panel-title { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.panel-body { padding: 20px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 0.5px solid var(--hair); margin-bottom: 20px; }
.tab { padding: 10px 18px; font-size: 13px; font-weight: 500; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -0.5px; transition: color 0.15s, border-color 0.15s; }
.tab:hover { color: var(--indigo); }
.tab.active { color: var(--indigo); border-bottom-color: var(--indigo); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Data table ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead tr { background: var(--indigo); }
.data-table thead th { padding: 10px 14px; text-align: left; font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #e0e7ff; border: none; white-space: nowrap; }
.data-table tbody tr { border-bottom: 0.5px solid var(--hair); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody td { padding: 10px 14px; color: var(--ink-2); vertical-align: top; }
.data-table tbody tr:hover { background: var(--surface-2); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); font-family: var(--font-ui); font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; line-height: 1; transition: background 0.12s, border-color 0.12s; text-decoration: none; }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-primary { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.btn-primary:hover { background: var(--indigo-dark); border-color: var(--indigo-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--ink-2); border-color: var(--hair); }
.btn-secondary:hover { border-color: var(--indigo); color: var(--indigo); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #a83d2c; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #157a52; border-color: #157a52; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: none; background: transparent; color: var(--ink-3); cursor: pointer; border-radius: 4px; font-size: 14px; line-height: 1; transition: background 0.12s, color 0.12s; }
.btn-icon:hover { background: var(--paper); color: var(--ink); }
.btn-icon.btn-icon-danger:hover { background: rgba(199,78,58,0.1); color: var(--danger); }
.review-chip { background: rgba(199,122,42,0.1); color: #b56a10; font-family: var(--font-mono); font-size: 10px; font-weight: 700; padding: 6px 12px; border-radius: 99px; border: none; cursor: pointer; letter-spacing: 0.04em; }
.row-chev { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-right: 6px; color: var(--ink-3); cursor: pointer; border-radius: 3px; transition: transform 0.15s, color 0.15s; flex-shrink: 0; vertical-align: middle; background: transparent; border: none; padding: 0; }
.row-chev:hover { color: var(--indigo); background: rgba(15,118,110,0.06); }
.row-chev.open { transform: rotate(90deg); color: var(--indigo); }
.row-chev svg { width: 10px; height: 10px; }

/* Canonical detail panel layout used in row-expand views (partner_audit_tool, partner_registry, etc.) */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.detail-section h4 { font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.detail-section .row { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; padding: 3px 0; border-bottom: 0.5px dashed var(--hair); }
.detail-section .row:last-child { border-bottom: none; }
.detail-section .row .lbl { color: var(--ink-3); font-family: var(--font-mono); font-size: 10px; }
.detail-section .row .val { color: var(--ink); font-family: var(--font-mono); font-weight: 700; }
.detail-section .empty { font-size: 11px; color: var(--ink-4); font-style: italic; }
.detail-loading { text-align: center; padding: 20px; color: var(--ink-3); font-size: 12px; }
.detail-actions { margin-top: 14px; padding-top: 12px; border-top: 0.5px solid var(--hair); display: flex; gap: 8px; flex-wrap: wrap; }
.detail-llm-mini { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.detail-llm-mini .platform-icon { width: 18px; height: 18px; }
.detail-llm-mini-name { font-family: var(--font-ui); font-size: 12px; font-weight: 600; color: var(--ink); flex: 1; }
.detail-llm-mini-score { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--indigo); }
.review-chip:hover { background: rgba(199,122,42,0.18); }

/* ── Form inputs ── */
input[type=text], input[type=email], input[type=number], input[type=password], select, textarea {
  font-family: var(--font-ui); font-size: 13px; color: var(--ink);
  background: var(--surface); border: 0.5px solid var(--hair);
  border-radius: var(--radius); padding: 7px 10px; width: 100%;
  transition: border-color 0.12s;
}
input[type=text]:focus, input[type=email]:focus, input[type=number]:focus, input[type=password]:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--indigo); box-shadow: 0 0 0 2px rgba(15,118,110,0.12);
}
label { font-size: 12px; font-weight: 600; color: var(--ink-2); display: block; margin-bottom: 4px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-row input, .filter-row select { width: auto; min-width: 140px; }
.actions-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.mapper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.mapper-field { display: flex; flex-direction: column; gap: 4px; }
.mapper-field label { font-size: 11px; }

/* ── Badges / tags ── */
.tier-badge { display: inline-block; font-family: var(--font-mono); font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 99px; letter-spacing: 0.04em; }
.tier-emerging  { background: rgba(30,154,106,0.1);  color: var(--success); }
.tier-resilient { background: rgba(199,122,42,0.1);  color: var(--warn); }
.tier-atrisk    { background: rgba(199,78,58,0.1);   color: var(--danger); }
.tier-none      { background: var(--surface-2); color: var(--ink-3); }
.platform-tag { display: inline-block; font-family: var(--font-mono); font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: rgba(15,118,110,0.08); color: var(--indigo-dark); }
.domain-tag { display: inline-block; font-size: 12px; color: var(--ink-2); background: var(--surface-2); border: 0.5px solid var(--hair); border-radius: 4px; padding: 1px 7px; margin: 1px 2px 1px 0; }
.domain-tag.primary { border-color: rgba(15,118,110,0.3); color: var(--indigo); }
.domain-tag .rm { background: none; border: none; cursor: pointer; color: var(--ink-3); font-size: 10px; margin-left: 3px; padding: 0; line-height: 1; }
.domain-tag .rm:hover { color: var(--danger); }
.aff-id-row { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 20px; border-radius: var(--radius); font-size: 13px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 9999; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

/* ── Confirm overlay ── */
#confirmOverlay { display: none; position: fixed; inset: 0; background: rgba(8,61,62,0.4); z-index: 500; align-items: center; justify-content: center; }
#confirmOverlay.show, #confirmOverlay[style*="flex"] { display: flex; }
.confirm-box { background: var(--surface); border-radius: var(--radius-lg); padding: 28px; max-width: 420px; width: 100%; box-shadow: 0 8px 32px rgba(8,61,62,0.18); }
.confirm-box h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; color: var(--ink); }
.confirm-box p { font-size: 13px; color: var(--ink-3); line-height: 1.6; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Info/warning/success boxes ── */
.info-box    { background: rgba(15,118,110,0.05); border: 0.5px solid rgba(15,118,110,0.2); border-radius: var(--radius); padding: 12px 14px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.warning-box { background: rgba(199,122,42,0.06); border: 0.5px solid rgba(199,122,42,0.25); border-radius: var(--radius); padding: 12px 14px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.success-box { background: rgba(30,154,106,0.06); border: 0.5px solid rgba(30,154,106,0.25); border-radius: var(--radius); padding: 12px 14px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 10px; justify-content: center; margin-top: 14px; font-size: 12px; color: var(--ink-3); }

/* ── Search dropdown ── */
.search-wrap { position: relative; display: inline-block; }
.search-dropdown { position: fixed; background: var(--surface); border: 0.5px solid var(--hair); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(8,61,62,0.12); z-index: 200; display: none; max-height: 220px; overflow-y: auto; min-width: 280px; }
.search-dropdown.open { display: block; }
.search-opt { padding: 9px 14px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.search-opt:hover { background: var(--paper); color: var(--indigo); }
.search-opt.new { color: var(--indigo); font-weight: 600; font-size: 12px; }
.search-opt span { display: block; font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* ── Detail panel ── */
.detail-row td { padding: 0 !important; }
.detail-panel { padding: 20px 24px; background: var(--surface-2); border-top: 0.5px solid var(--hair); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.detail-section-title { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.add-domain-row { display: flex; gap: 6px; align-items: center; margin-top: 10px; }
.add-domain-row input { flex: 1; }

/* ── Preview table ── */
.preview-table { border-collapse: collapse; font-size: 12px; min-width: 300px; }
.preview-table th { padding: 6px 10px; background: var(--indigo); color: #e0e7ff; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; text-align: left; }
.preview-table td { padding: 5px 10px; border-bottom: 0.5px solid var(--hair); }
.preview-table tr:last-child td { border-bottom: none; }

footer { background: var(--surface-2); border-top: 0.5px solid var(--hair); color: var(--ink-3); text-align: center; padding: 20px 24px; font-size: 11px; font-family: var(--font-mono); letter-spacing: 0.04em; }

/* ── Audit summary cards ── */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.summary-card { border: 0.5px solid var(--hair); border-radius: var(--radius-lg); padding: 14px 16px; background: var(--surface); text-align: center; }
.sum-label { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.sum-value { font-family: var(--font-display); font-size: 26px; font-weight: 400; color: var(--ink); }

/* ── Audit scoring table ── */
.score-table { width:100%; border-collapse:collapse; font-size:13px; }
.score-table thead tr { background:var(--indigo); }
.score-table thead th { padding:10px 12px; text-align:left; font-family:var(--font-mono); font-size:9px; font-weight:600; letter-spacing:0.1em; text-transform:uppercase; color:#e0e7ff; white-space:nowrap; border:none; }
.score-table thead th:nth-child(4), .score-table thead th:nth-child(5), .score-table thead th:nth-child(6), .score-table thead th:nth-child(7) { text-align:center; }
.score-table tbody tr { border-bottom:0.5px solid var(--hair); }
.score-table tbody tr:last-child { border-bottom:none; }
.score-table tbody td { padding:10px 12px; vertical-align:middle; color:var(--ink); }
.score-table tbody td:nth-child(4), .score-table tbody td:nth-child(5), .score-table tbody td:nth-child(6), .score-table tbody td:nth-child(7) { text-align:center; }
.score-table tbody tr.scored-row { background:rgba(15,118,110,0.03); }
.score-table tbody tr:hover { background:var(--surface-2); }

.score-input { width:64px; padding:5px 8px; border:0.5px solid var(--hair); border-radius:4px; font-family:var(--font-mono); font-size:12px; text-align:center; background:var(--surface); color:var(--ink); -moz-appearance:textfield; }
.score-input:focus { outline:none; border-color:var(--indigo); box-shadow:0 0 0 2px rgba(15,118,110,0.12); }
.score-input.auto-filled { border-color:rgba(15,118,110,0.4); color:var(--indigo); background:rgba(15,118,110,0.04); }
.score-input::-webkit-inner-spin-button, .score-input::-webkit-outer-spin-button { opacity:1; }

.wscore { display:inline-block; font-family:var(--font-mono); font-size:12px; font-weight:600; padding:2px 8px; border-radius:4px; }
.wscore-empty    { color:var(--ink-3); }
.wscore-emerging { color:var(--success); background:rgba(30,154,106,0.08); }
.wscore-resilient{ color:var(--warn);   background:rgba(199,122,42,0.08); }
.wscore-atrisk   { color:var(--danger); background:rgba(199,78,58,0.08); }

.yt-chip { display:inline-flex; align-items:center; gap:4px; font-family:var(--font-mono); font-size:11px; color:var(--ink-2); }
.weight-badge { display:inline-block; font-family:var(--font-mono); font-size:10px; font-weight:600; color:var(--indigo); }

.sortable { cursor:pointer; user-select:none; }
.sortable:hover { background:rgba(255,255,255,0.1); }
.sort-asc::after  { content:' ↑'; opacity:0.7; }
.sort-desc::after { content:' ↓'; opacity:0.7; }

/* ── Audit rubric table ── */
.rubric-table { width:100%; border-collapse:collapse; font-size:12px; }
.rubric-table th { padding:8px 10px; background:var(--surface-2); border:0.5px solid var(--hair); font-family:var(--font-mono); font-size:9px; font-weight:600; letter-spacing:0.08em; text-transform:uppercase; color:var(--ink-3); text-align:center; }
.rubric-table th:first-child { text-align:left; }
.rubric-table td { padding:10px; border:0.5px solid var(--hair); vertical-align:top; text-align:center; color:var(--ink-2); line-height:1.4; }
.rubric-table td:first-child { text-align:left; min-width:160px; }
.rubric-table td:nth-child(2) { text-align:center; }

/* Users page */
.role-group-label { font-family:var(--font-mono); font-size:9px; font-weight:600; letter-spacing:0.12em; text-transform:uppercase; color:var(--ink-3); padding:16px 0 8px; border-bottom:0.5px solid var(--hair); margin-bottom:4px; }
.user-card { padding:16px 0; border-bottom:0.5px solid var(--hair); display:flex; flex-direction:column; gap:10px; }
.user-card:last-child { border-bottom:none; }
.user-card-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.user-card-name { font-size:14px; font-weight:600; color:var(--ink); margin-bottom:2px; }
.user-card-email { font-size:12px; color:var(--ink-3); font-family:var(--font-mono); margin-bottom:4px; }
.user-card-meta { font-size:11px; color:var(--ink-3); }
.role-badge { display:inline-block; font-family:var(--font-mono); font-size:10px; font-weight:600; padding:2px 8px; border-radius:99px; }
.role-admin { background:rgba(15,118,110,0.1); color:var(--indigo); }
.role-manager { background:rgba(30,154,106,0.1); color:var(--success); }
.role-user { background:var(--surface-2); color:var(--ink-3); border:0.5px solid var(--hair); }

/* Query registry */
.hidden { display: none !important; }
.tier-high { background:rgba(30,154,106,0.1); color:var(--success); }
.tier-mid  { background:rgba(199,122,42,0.1); color:var(--warn); }
.tier-low  { background:rgba(199,78,58,0.1);  color:var(--danger); }

/* Dashboard */
.dash-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:12px; }
.dash-card { background:var(--surface); border:0.5px solid var(--hair); border-radius:var(--radius-lg); padding:18px 20px; }
.dash-label { font-family:var(--font-mono); font-size:9px; font-weight:600; letter-spacing:0.1em; text-transform:uppercase; color:var(--ink-3); margin-bottom:8px; }
.dash-value { font-family:var(--font-display); font-size:28px; color:var(--ink); line-height:1; }
.dash-value-sm { font-family:var(--font-mono); font-size:14px; font-weight:600; color:var(--ink); line-height:1.3; }

/* -- Mobile nav -- */
.mobile-nav-bar { display:none; }
.sidebar-overlay { display:none; }
@media (max-width: 768px) {
  :root { --sidebar-w: 240px; }
  .app-shell { flex-direction: column; }
  .mobile-nav-bar { display:flex; align-items:center; gap:10px; padding:12px 16px; background:var(--surface); border-bottom:0.5px solid var(--hair); position:sticky; top:0; z-index:300; height:52px; }
  .mobile-nav-bar .sidebar-brand-name { font-size:13px; font-weight:700; color:var(--navy); letter-spacing:-0.01em; }
  .mobile-nav-bar img { width:26px; height:26px; border-radius:5px; object-fit:cover; flex-shrink:0; }
  .hamburger-btn { margin-left:auto; background:none; border:none; cursor:pointer; padding:6px; color:var(--ink-2); display:flex; align-items:center; justify-content:center; border-radius:var(--radius); }
  .hamburger-btn:hover { background:var(--paper); }
  .sidebar-overlay.open { display:block; }
  .sidebar { position:fixed; top:0; left:0; height:100%; width:var(--sidebar-w); min-width:var(--sidebar-w); z-index:500; transform:translateX(-100%); transition:transform 0.22s ease; box-shadow:2px 0 16px rgba(8,61,62,0.12); }
  .sidebar.open { transform:translateX(0); }
  .page-content { width:100%; min-width:0; }
  .app-shell { display:block; }
  .page-header { padding:20px 16px 0; }
  main { padding:16px; }
}

@media (max-width: 768px) {
  .table-wrap, .table-container, table { display:block; overflow-x:auto; -webkit-overflow-scrolling:touch; max-width:100%; }
  table { min-width:600px; }
}

@media (max-width: 768px) {
  .panel { overflow: visible; }
}

@media (max-width: 768px) {
  [style*="overflow-x:auto"], [style*="overflow-x: auto"] { width:100%; box-sizing:border-box; }
  .data-table, .preview-table { min-width:500px; width:max-content; }
}

@media (max-width: 768px) {
  .panel-body { padding: 12px; }
  .panel-body [style*="overflow-x:auto"], .panel-body [style*="overflow-x: auto"] { margin-left:-12px; margin-right:-12px; padding-left:12px; padding-right:12px; width:calc(100% + 24px); }
}

@media (max-width: 768px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  .app-shell { max-width: 100vw; overflow-x: hidden; }
}

/* ── Platform icon pills ── */
.platform-icon { display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; border-radius:4px; background:var(--surface); border:0.5px solid var(--hair); overflow:hidden; flex-shrink:0; }
.platform-icon img { width:12px; height:12px; object-fit:contain; display:block; }
.platform-icon-sm { width:14px; height:14px; border-radius:3px; }
.platform-icon-sm img { width:10px; height:10px; }
.platform-icon-lg { width:22px; height:22px; border-radius:5px; }
.platform-icon-lg img { width:14px; height:14px; }
.platform-pills { display:inline-flex; gap:3px; align-items:center; }
.yt-handle-link{color:var(--ink);text-decoration:none;font-weight:600;} .yt-handle-link:hover{color:var(--indigo);}
.yt-channel-cell-title{font-weight:700;font-size:13px;color:var(--ink);line-height:1.2;}
.btn-navy{background:var(--navy);color:#fff;border-color:var(--navy);} .btn-navy:hover{background:var(--indigo-dark);border-color:var(--indigo-dark);}
.pt-partner-link{font-weight:600;color:var(--ink);text-decoration:none;} .pt-partner-link:hover{color:var(--indigo);}

/* Classification badges -- shared across all dashboards.
 * Used by any page that emits a <span class="recruit-high"> etc.
 * Page-local copies (e.g. citation_results) may still exist; this is the
 * canonical fallback. */
.cls-badge, .established, .recruit-high, .recruit-mid, .recruit-low, .own-brand, .competitor, .platform { display:inline-block; font-family:var(--font-mono); font-size:10px; font-weight:700; padding:2px 8px; border-radius:99px; white-space:nowrap; }
.established  { background:rgba(30,154,106,0.10); color:var(--success); }
.recruit-high { background:rgba(15,118,110,0.07); color:var(--indigo); }
.recruit-mid  { background:rgba(199,122,42,0.10); color:#b56a10; }
.recruit-low  { background:rgba(138,138,149,0.10); color:var(--ink-3); }
.own-brand    { background:rgba(15,118,110,0.15); color:var(--navy); }
.competitor   { background:rgba(211,47,47,0.08); color:#c62828; }
.platform     { background:rgba(138,138,149,0.10); color:var(--ink-3); }
/* ===== Dashboard components (shared) ===== */
.dash-controls{display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin:0 0 20px;}
.seg{display:inline-flex;border:0.5px solid var(--hair);border-radius:var(--radius);overflow:hidden;}
.seg button{border:0;background:var(--surface);color:var(--ink-2);padding:8px 16px;font-family:var(--font-ui);font-size:13px;font-weight:600;cursor:pointer;}
.seg button+button{border-left:0.5px solid var(--hair);}
.seg button.on{background:var(--indigo);color:#fff;}
.stat-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px;margin-bottom:20px;}
.stat-card{background:var(--surface);border:0.5px solid var(--hair);border-radius:var(--radius-lg);padding:20px 22px;}
.stat-top{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:8px;}
.stat-label{font-family:var(--font-mono);font-size:9px;font-weight:700;letter-spacing:0.1em;text-transform:uppercase;color:var(--ink-3);}
.stat-when{font-family:var(--font-mono);font-size:10px;color:var(--ink-3);}
.stat-value{font-family:var(--font-display);font-size:34px;color:var(--ink);line-height:1;margin-bottom:6px;}
.stat-delta{font-family:var(--font-mono);font-size:10px;font-weight:600;}
.stat-delta.up{color:var(--success);}
.stat-delta.down{color:var(--danger);}
.stat-delta.flat{color:var(--ink-3);}
.cov-bar{display:flex;height:6px;border-radius:99px;overflow:hidden;margin-top:14px;background:var(--paper);}
.cov-bar i{display:block;height:100%;}
.cov-v{background:var(--indigo);}.cov-m{background:var(--warn);}.cov-b{background:var(--danger);}
.cov-legend{display:flex;gap:14px;flex-wrap:wrap;font-family:var(--font-mono);font-size:9px;color:var(--ink-3);margin-top:8px;}
.cov-dot{display:inline-block;width:7px;height:7px;border-radius:2px;margin-right:5px;vertical-align:middle;}
.chart-wrap{background:var(--surface);border:0.5px solid var(--hair);border-radius:var(--radius-lg);padding:20px 24px;margin-bottom:20px;}
.chart-title{font-family:var(--font-mono);font-size:10px;font-weight:700;letter-spacing:0.08em;text-transform:uppercase;color:var(--ink-3);margin-bottom:14px;}
.chart-legend{display:flex;gap:16px;flex-wrap:wrap;margin-top:10px;}
.legend-item{display:flex;align-items:center;gap:6px;font-family:var(--font-mono);font-size:10px;color:var(--ink-2);text-transform:capitalize;}
.legend-dot{width:8px;height:8px;border-radius:2px;flex-shrink:0;}
.svg-host svg{width:100%;height:auto;display:block;}
.two-col{display:grid;grid-template-columns:repeat(auto-fit,minmax(340px,1fr));gap:16px;margin-bottom:20px;}
.panel{background:var(--surface);border:0.5px solid var(--hair);border-radius:var(--radius-lg);padding:20px 22px;}
.panel-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;gap:12px;}
.panel-title{font-family:var(--font-mono);font-size:10px;font-weight:700;letter-spacing:0.08em;text-transform:uppercase;color:var(--ink-3);}
.idx-table{width:100%;border-collapse:collapse;font-size:12px;}
.idx-table th{padding:8px 10px;background:var(--indigo);color:#e0e7ff;font-family:var(--font-mono);font-size:9px;letter-spacing:0.08em;text-transform:uppercase;font-weight:600;text-align:left;}
.idx-table th.sortable{cursor:pointer;}
.idx-table th:first-child{border-radius:var(--radius) 0 0 0;}
.idx-table th:last-child{border-radius:0 var(--radius) 0 0;}
.idx-table td{padding:8px 10px;border-bottom:0.5px solid var(--hair);color:var(--ink-2);vertical-align:middle;}
.idx-table tr:last-child td{border-bottom:none;}
.idx-table tbody tr:hover td{background:rgba(15,118,110,0.03);}
.idx-table tr.clickable{cursor:pointer;}
.idx-table tr.gap td{background:rgba(199,78,58,0.06);}
.dpill{font-family:var(--font-mono);font-size:9px;font-weight:700;padding:2px 7px;border-radius:99px;display:inline-block;background:rgba(15,118,110,0.10);color:var(--indigo);white-space:nowrap;}
.gap-tag{font-family:var(--font-mono);font-size:9px;font-weight:700;padding:1px 6px;border-radius:99px;background:rgba(199,78,58,0.12);color:var(--danger);margin-left:6px;}
.pospill{display:inline-block;min-width:26px;text-align:center;padding:2px 7px;border-radius:var(--radius);background:var(--paper);font-family:var(--font-mono);font-size:11px;color:var(--ink-2);}
.pospill.absent{color:var(--danger);}
.tr-up{color:var(--success);font-weight:700;}
.tr-down{color:var(--danger);font-weight:700;}
.tr-flat{color:var(--ink-3);}
.comprow{display:flex;align-items:center;gap:10px;margin:8px 0;font-size:12px;}
.comprow .lbl{width:130px;color:var(--ink-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--font-mono);font-size:11px;}
.compbar{flex:1;height:14px;background:var(--paper);border-radius:99px;overflow:hidden;}
.compbar i{display:block;height:100%;background:var(--indigo);}
.compbar.brand i{background:var(--navy);}
.comprow .val{width:30px;text-align:right;color:var(--ink-3);font-family:var(--font-mono);font-size:11px;}
.drawer{border:0.5px solid var(--hair);border-radius:var(--radius-lg);background:var(--surface-2);padding:16px;margin-bottom:20px;display:none;}
.drawer.open{display:block;}
.drawer input,.drawer select,.drawer textarea{border:0.5px solid var(--hair);border-radius:var(--radius);background:var(--surface);color:var(--ink);padding:9px;font-family:var(--font-ui);font-size:13px;}
.ed-wrap{background:var(--surface-2);border-radius:var(--radius);padding:12px;}
.ed-wrap label{margin-right:14px;font-size:12px;color:var(--ink-2);}
.muted-note{font-family:var(--font-mono);font-size:10px;color:var(--ink-3);}

/* ---- Brand switcher (multi-brand) ---------------------------------- */
.brand-switcher { padding: 10px 16px 12px; border-bottom: 0.5px solid var(--hair); }
.brand-switcher-label { display: block; font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px; }
.brand-switcher-select { width: 100%; padding: 6px 24px 6px 8px; border: 0.5px solid var(--hair); border-radius: var(--radius); background-color: var(--surface-2); font-family: var(--font-ui); font-size: 12px; font-weight: 600; color: var(--navy); cursor: pointer; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238A8A95' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.brand-switcher-select:disabled { cursor: default; opacity: 0.9; }
.brand-switcher-select:focus { outline: none; border-color: var(--indigo); }

/* ---- Persistent audit status pill --------------------------------- */
.audit-pill { position: fixed; top: 12px; right: 16px; z-index: 1000; display: none; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; font-family: var(--font-ui); font-size: 12px; font-weight: 600; background: var(--surface); border: 0.5px solid var(--hair); box-shadow: 0 4px 14px rgba(8,61,62,0.14); color: var(--navy); max-width: min(92vw, 440px); }
.audit-pill .ap-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-pill.running { border-color: rgba(15,118,110,0.35); }
.audit-pill.done { border-color: rgba(30,154,106,0.5); color: var(--success); }
.audit-pill.failed { border-color: rgba(199,78,58,0.5); color: var(--danger); }
.audit-pill .ap-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(15,118,110,0.25); border-top-color: var(--indigo); animation: apspin 0.8s linear infinite; flex-shrink: 0; }
@keyframes apspin { to { transform: rotate(360deg); } }
.audit-pill .ap-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.audit-pill .ap-x { background: none; border: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 0 0 4px; opacity: 0.6; }
.audit-pill .ap-x:hover { opacity: 1; }
@media (max-width: 900px) { .audit-pill { top: auto; bottom: 16px; right: 12px; } }
