:root {
  --navy:        #0C1B2E;
  --navy-mid:    #132540;
  --orange:      #F4731C;
  --orange-hover:#d95f0d;
  --orange-soft: #fff3ec;
  --white:       #ffffff;
  --bg:          #f0f4f8;
  --surface:     #ffffff;
  --surface2:    #f8fafc;
  --border:      #dde3ed;
  --text:        #0C1B2E;
  --text-mid:    #3d5166;
  --text-dim:    #7a92a8;
  --pass-bg:     #edfaf3;
  --pass-text:   #1a7a45;
  --fail-bg:     #fff0ee;
  --fail-text:   #c0392b;
  --radius:      10px;
  --radius-lg:   14px;
  --shadow:      0 2px 8px rgba(12,27,46,.08);
  --shadow-md:   0 4px 20px rgba(12,27,46,.12);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────── */
.header {
  background: var(--navy);
  padding: 0 32px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(12,27,46,.2);
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon { flex-shrink: 0; }
.logo-wordmark { font-size: 1.35rem; font-weight: 700; letter-spacing: .01em; line-height: 1; }
.logo-w-campaign { color: #fff; }
.logo-w-pulse { color: var(--orange); }
.header-tag {
  font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: rgba(255,255,255,.45);
}
.demo-badge {
  background: var(--orange); color: #fff; font-size: 10px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; letter-spacing: .06em;
  text-transform: uppercase; margin-left: 10px;
}
.header-nav { display: flex; align-items: center; gap: 16px; }
.header-nav a {
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,.5);
  text-decoration: none; letter-spacing: .04em; transition: color .18s;
}
.header-nav a:hover { color: var(--orange); }
.header-nav .nav-logout { opacity: .45; margin-left: 4px; border-left: 1px solid rgba(255,255,255,.12); padding-left: 16px; }
.header-nav .nav-logout:hover { opacity: 1; color: #e74c3c; }

/* ── Page layout ─────────────────────────────────── */
.main { max-width: 1380px; margin: 0 auto; padding: 28px 24px 48px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.page-head p { font-size: 0.9rem; color: var(--text-mid); }
.page-head p strong { color: var(--orange); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
.flow-section { margin-bottom: 20px; }

/* ── Two-column master layout ─────────────────── */
.master-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 960px) { .master-grid { grid-template-columns: 1fr; } }
.master-col {
  display: flex; flex-direction: column; gap: 20px;
}

/* ── Card ────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-compact { padding: 16px; gap: 10px; }
.card-assets {
  border-top: 3px solid var(--orange);
  background: linear-gradient(180deg, #fff8f3 0%, var(--surface) 60px);
  box-shadow: var(--shadow-md);
}
.card-muted {
  background: var(--surface2);
  border-color: #e2e8f0;
  box-shadow: 0 1px 4px rgba(12,27,46,.04);
}
.card-header {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-icon {
  width: 32px; height: 32px;
  background: var(--orange-soft);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.card-icon svg { width: 16px; height: 16px; fill: var(--orange); }
.card-title {
  font-size: 0.82rem; font-weight: 700;
  color: var(--navy);
  text-transform: uppercase; letter-spacing: .07em;
}
.card-header-toggle {
  cursor: pointer; user-select: none; transition: background .15s; border-radius: var(--radius) var(--radius) 0 0;
  margin: -20px -20px 0; padding: 14px 20px;
}
.card-compact .card-header-toggle { margin: -16px -16px 0; padding: 12px 16px; }
.card-header-toggle:hover { background: rgba(244,115,28,.03); }
.card-toggle-arrow {
  margin-left: auto; flex-shrink: 0; color: var(--text-dim);
  transition: transform .2s;
}
.card-body {
  display: flex; flex-direction: column; gap: 12px;
  overflow: hidden;
  transition: max-height .35s ease, opacity .25s ease, padding .3s ease;
  opacity: 1;
}
.card-body.collapsed {
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  gap: 0;
}

/* ── Form fields ─────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
label.field-label {
  font-size: 11.5px; font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .06em;
}
input[type="text"], input[type="number"], textarea {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  width: 100%;
  transition: border-color .18s, box-shadow .18s;
  outline: none;
}
input:focus, textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(244,115,28,.12);
  background: #fff;
}
input::placeholder, textarea::placeholder { color: #b0beca; }
textarea { min-height: 68px; resize: vertical; line-height: 1.5; }
textarea[rows="2"] { min-height: 32px; }
textarea[rows="3"] { min-height: 48px; }
.row { display: flex; gap: 12px; }
.row .field { flex: 1; }

.field-auto-any { animation: flashOrange 2s ease; }
@keyframes flashOrange {
  0%   { background: #fff7ed; border-color: var(--orange); box-shadow: 0 0 0 4px rgba(234,88,12,.2); }
  60%  { background: #fff7ed; border-color: var(--orange); box-shadow: 0 0 0 4px rgba(234,88,12,.1); }
  100% { background: var(--surface2); border-color: var(--border); box-shadow: none; }
}

/* Blank-field hint shown after Excel load */
.blank-field-hint {
  display: flex; align-items: center; gap: 5px;
  margin-top: 4px; padding: 4px 8px;
  font-size: 11px; font-weight: 500; color: #92400e;
  background: linear-gradient(135deg,#fffbeb,#fef3c7);
  border: 1px solid #fbbf24; border-radius: 6px;
  animation: hintFadeIn .3s ease;
}
.blank-field-hint svg { flex-shrink: 0; fill: #d97706; }
.blank-field-hint a {
  color: #b45309; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-decoration-style: dotted;
  text-underline-offset: 2px;
}
.blank-field-hint a:hover { color: #92400e; }
@keyframes hintFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--orange); color: #fff; font-size: 13px; font-weight: 600;
  padding: 12px 24px; border-radius: 10px; z-index: 9999;
  box-shadow: 0 6px 20px rgba(234,88,12,.3);
  opacity: 0; transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.checkbox-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 9px 12px; cursor: pointer;
  transition: border-color .18s;
}
.checkbox-row:hover { border-color: var(--orange); }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--orange); cursor: pointer; flex-shrink: 0; }
.checkbox-row span { font-size: 13px; color: var(--text-mid); }
.checkbox-row-sm { font-size: 12px; padding: 6px 10px; }
.checkbox-row-sm span { font-size: 12px; }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  padding: 11px 20px; border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all .18s;
}
.btn svg { width: 15px; height: 15px; fill: currentColor; flex-shrink: 0; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-hover); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(244,115,28,.28); }
.btn-ghost { background: #fff; border: 1.5px solid var(--border); color: var(--text-mid); }
.btn-ghost:hover { border-color: var(--orange); color: var(--orange); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-mid); }
.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover { background: var(--orange-hover); }
.btn-orange:disabled { opacity:.5; cursor:not-allowed; }
.btn-analyze-assets {
  width: 100%; justify-content: center; margin-top: 8px;
  background: linear-gradient(135deg, var(--orange), #e85d0a);
  color: #fff; font-size: 14px; font-weight: 700; letter-spacing: .03em;
  border-radius: var(--radius); padding: 12px 20px;
  box-shadow: 0 2px 8px rgba(244,115,28,.18);
}
.btn-analyze-assets:hover {
  background: linear-gradient(135deg, #e86a12, #d45408);
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(244,115,28,.35);
}
.btn-analyze-assets:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(244,115,28,.2); }
@keyframes stale-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244,115,28,.45); }
  50% { box-shadow: 0 0 0 6px rgba(244,115,28,0); }
}
.btn-analyze-stale {
  background: linear-gradient(135deg, #c05a10, #a84b08);
  animation: stale-pulse 1.8s ease infinite;
}
.btn-analyze-stale:hover { background: linear-gradient(135deg, #b85210, #984306); }

/* ── Upload zone ─────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 20px 16px; text-align: center; cursor: pointer;
  transition: all .18s; display: block;
  background: var(--surface2);
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--orange); background: var(--orange-soft); }
.upload-zone input { display: none; }
.upload-zone .uz-icon { color: var(--orange); margin-bottom: 6px; }
.upload-zone p { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.upload-zone strong { color: var(--navy); }

/* ── Or divider ──────────────────────────────────── */
.or-divider {
  display: flex; align-items: center; gap: 10px;
  color: #a0b0c0; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
}
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: #e8edf2; }

/* ── Data note ───────────────────────────────────── */
.data-note {
  font-size: 12px; color: var(--text-dim);
  padding: 8px 14px; background: var(--surface2);
  border-radius: var(--radius); border: 1px solid var(--border);
  margin-top: -8px;
}
.data-note strong { color: var(--orange); }

/* ── Lead info (demo) ────────────────────────────── */
.lead-info {
  background: var(--pass-bg); border: 1.5px solid #c6e9d4;
  border-radius: var(--radius); padding: 14px 18px; text-align: center;
}
.lead-info .li-num { font-size: 2rem; font-weight: 800; color: var(--pass-text); line-height: 1; }
.lead-info .li-label { font-size: 12px; font-weight: 600; color: var(--pass-text); margin-top: 4px; text-transform: uppercase; letter-spacing: .06em; }

/* ── Stats row ───────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::after { content:''; position:absolute; bottom:0; left:0; right:0; height:3px; border-radius:0 0 var(--radius-lg) var(--radius-lg); background:var(--border); }
.stat.s-pass::after { background:var(--pass-text); }
.stat.s-review::after { background:#f59e0b; }
.stat.s-fail::after { background:var(--fail-text); }
.stat.s-rate::after { background:var(--orange); }
.stat.s-score::after { background:#6366f1; }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); margin-bottom: 8px; }
.stat-value { font-size: 2.2rem; font-weight: 800; line-height: 1; color: var(--navy); }
.stat.s-pass .stat-value { color: var(--pass-text); }
.stat.s-review .stat-value { color: #d97706; }
.stat.s-fail .stat-value { color: var(--fail-text); }
.stat.s-rate .stat-value { color: var(--orange); }
.stat.s-score .stat-value { color: #6366f1; }

/* ── Results card ────────────────────────────────── */
.results-wrap { max-width: 1380px; margin: 20px auto 0; display: none; }
.results-wrap.visible { display: block; }
.results-card {
  background: var(--surface); border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); box-shadow: var(--shadow); overflow: hidden;
}
.results-toolbar {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.toolbar-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-row-top { gap: 10px; }
.toolbar-row-bottom { gap: 6px; }
.toolbar-left-actions { display: flex; align-items: center; gap: 4px; flex: 1; flex-wrap: wrap; }
.results-title { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--navy); }
.filter-tabs { display: flex; gap: 4px; }
.tab {
  padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: 1.5px solid var(--border); background: transparent;
  color: var(--text-dim); transition: all .15s;
}
.tab:hover { border-color: var(--navy); color: var(--navy); }
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tab.active.t-pass { background: var(--pass-text); border-color: var(--pass-text); }
.tab.active.t-fail { background: var(--fail-text); border-color: var(--fail-text); }

/* ── Table ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; max-height: 520px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
th {
  position: sticky; top: 0; background: #f0f4f8; z-index: 1;
  color: var(--text-dim); font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 10px 14px; white-space: nowrap;
  border-bottom: 1px solid var(--border); text-align: left;
  overflow: hidden; text-overflow: ellipsis;
}
th.sortable-th { cursor: pointer; user-select: none; transition: background .15s; }
th.sortable-th:hover { background: #e4eaf2; }
.th-resize-handle {
  position: absolute; right: 0; top: 0; width: 5px; height: 100%;
  cursor: col-resize; z-index: 3; background: transparent;
}
.th-resize-handle:hover { background: rgba(243,111,36,.45); }
body.col-resizing { cursor: col-resize !important; }
body.col-resizing * { user-select: none !important; }
.sort-arrow { font-size: 9px; margin-left: 3px; color: var(--text-dim); opacity: 0; transition: opacity .15s; }
th.sortable-th:hover .sort-arrow { opacity: 0.4; }
.sort-arrow.sort-asc, .sort-arrow.sort-desc { opacity: 1; color: var(--navy); }
td { padding: 9px 14px; border-bottom: 1px solid #edf1f7; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfd; }
td.cell-info { background: #f0f4ff; color: #4a6fa5; }
td.cell-high { background: #d1fae5; color: #065f46; }
td.cell-medium { background: var(--pass-bg); color: var(--pass-text); }
td.cell-low { background: #fff3cd; color: #856404; }
td.cell-caution { background: #fff8e1; color: #b45309; }
td.cell-mismatch { background: var(--fail-bg); color: var(--fail-text); }
td.cell-nodata { background: #f3e5f5; color: #7b1fa2; }
.badge { display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; white-space:nowrap; }
.badge::before { content:''; width:6px; height:6px; border-radius:50%; background:currentColor; flex-shrink:0; }
.badge-pass { background:var(--pass-bg); color:var(--pass-text); }
.badge-fail { background:var(--fail-bg); color:var(--fail-text); }
.num-col { color: var(--text-dim); font-size: 12px; text-align: center; width: 36px; }
td.reasons-col { color: var(--text-dim); font-size: 12px; white-space: normal; max-width: 180px; }
.mismatch-pill { display:inline-block; background:#fff3ee; color:var(--orange); border:1px solid #fbd5bf; border-radius:4px; font-size:10px; font-weight:600; padding:1px 6px; margin:1px 2px; }

/* ── Global Search ──────────────────────────────── */
.global-search-input {
  padding: 6px 12px; border-radius: 20px; border: 1.5px solid var(--border);
  font-size: 12px; width: 200px; outline: none; background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.global-search-input:focus { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(15,42,80,.1); }

/* ── Quick Filter Pills ─────────────────────────── */
.quick-filter-pills { display: flex; gap: 4px; flex-wrap: wrap; }
.qf-pill {
  padding: 4px 10px; border-radius: 14px; font-size: 10.5px; font-weight: 600;
  cursor: pointer; border: 1.5px solid var(--border); background: transparent;
  color: var(--text-dim); transition: all .15s; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em;
}
.qf-pill:hover { border-color: var(--navy); color: var(--navy); }
.qf-pill.active { color: #fff; }
.qf-conf.active { background: var(--navy); border-color: var(--navy); }
.qf-attention.active { background: var(--orange); border-color: var(--orange); }
.qf-limit.active { background: var(--fail-text); border-color: var(--fail-text); }
.qf-risk.active { background: #dc2626; border-color: #dc2626; }
.qf-asset.active { background: #7c3aed; border-color: #7c3aed; }

/* ── Toolbar Buttons & Dropdowns ────────────────── */
.toolbar-icon-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); transition: all .15s; white-space: nowrap;
}
.toolbar-icon-btn:hover { border-color: var(--navy); color: var(--navy); background: #f0f4f8; }
.toolbar-icon-btn svg { flex-shrink: 0; }
.filter-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; border-radius: 8px; font-size: 10px; font-weight: 700;
  background: var(--orange); color: #fff; margin-left: 2px; padding: 0 4px;
}
.toolbar-dropdown { position: relative; }
.toolbar-dd-panel {
  display: none; position: absolute; top: 100%; left: 0; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(12,27,46,.12); padding: 8px; min-width: 180px;
  max-height: 280px; overflow-y: auto;
}
.toolbar-dd-panel.open { display: block; }
.toolbar-dd-opt {
  display: flex; align-items: center; gap: 6px; padding: 5px 8px;
  font-size: 12px; color: var(--text); cursor: pointer; border-radius: 4px;
  white-space: nowrap;
}
.toolbar-dd-opt:hover { background: #f0f4f8; }
.toolbar-dd-opt input { margin: 0; }

.showing-count { font-size: 11.5px; color: var(--text-dim); font-weight: 600; white-space: nowrap; }
.btn-sm { padding: 5px 12px; font-size: 11.5px; }

/* ── Presets ─────────────────────────────────────── */
.preset-save-btn {
  width: 100%; padding: 6px; border: 1.5px dashed var(--border); border-radius: 6px;
  background: transparent; font-size: 11px; font-weight: 600; color: var(--navy);
  cursor: pointer; margin-bottom: 6px; transition: all .15s;
}
.preset-save-btn:hover { border-color: var(--orange); background: var(--orange-soft); }
.preset-item { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.preset-load {
  flex: 1; padding: 5px 8px; border: none; background: transparent; text-align: left;
  font-size: 12px; cursor: pointer; border-radius: 4px; color: var(--text);
}
.preset-load:hover { background: #f0f4f8; }
.preset-del {
  padding: 2px 6px; border: none; background: transparent; color: var(--text-dim);
  cursor: pointer; font-size: 14px; border-radius: 4px;
}
.preset-del:hover { color: var(--fail-text); background: var(--fail-bg); }
.preset-empty { font-size: 11px; color: var(--text-dim); padding: 8px; text-align: center; }

/* ── Filter Row ─────────────────────────────────── */
tr.filter-row th {
  background: #f8fafc; padding: 4px 6px; border-bottom: 2px solid var(--border);
  vertical-align: top; position: sticky; top: 36px; z-index: 1;
  font-weight: normal; text-transform: none; letter-spacing: normal;
  font-size: 13px; color: var(--text);
}
tr.filter-row .filter-cell-idx { width: 36px; }
tr.header-row th { z-index: 2; }
.filter-cell { min-width: 80px; }
.col-filter-input {
  width: 100%; padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 11px; outline: none; background: #fff; box-sizing: border-box;
}
.col-filter-input:focus { border-color: var(--navy); }

/* ── Multi-Select Dropdown ──────────────────────── */
.ms-dropdown { position: relative; }
.ms-trigger {
  width: 100%; padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 11px; background: #fff; cursor: pointer; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text);
}
.ms-trigger:hover { border-color: var(--navy); }
.ms-panel {
  display: none; position: absolute; top: 100%; left: 0; z-index: 60;
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 6px 16px rgba(12,27,46,.1); width: max-content; min-width: 100%;
  max-height: 200px; overflow-y: auto; padding: 4px;
}
.ms-panel.open { display: block; }
.ms-search {
  width: calc(100% - 8px); margin: 4px; padding: 3px 6px; border: 1px solid var(--border);
  border-radius: 3px; font-size: 11px; outline: none; box-sizing: border-box;
}
.ms-options { max-height: 140px; overflow-y: auto; }
.ms-option {
  display: flex; align-items: center; gap: 5px; padding: 3px 6px;
  font-size: 11px; cursor: pointer; border-radius: 3px; white-space: nowrap;
}
.ms-option:hover { background: #f0f4f8; }
.ms-option input { margin: 0; }
.ms-actions {
  display: flex; gap: 4px; padding: 4px; border-top: 1px solid var(--border); margin-top: 4px;
}
.ms-actions button {
  flex: 1; padding: 3px; border: 1px solid var(--border); border-radius: 3px;
  font-size: 10px; font-weight: 600; cursor: pointer; background: #fff; color: var(--text-dim);
}
.ms-actions button:hover { background: #f0f4f8; color: var(--navy); }

/* ── Cell Match Power Filter ────────────────────── */
.match-power-filter { display: flex; gap: 2px; margin-top: 3px; }
.mpf-btn {
  width: 20px; height: 18px; border-radius: 3px; border: 1px solid var(--border);
  font-size: 9px; font-weight: 700; cursor: pointer; transition: all .12s;
  background: #fff; color: var(--text-dim); padding: 0; line-height: 16px; text-align: center;
}
.mpf-btn:hover { transform: scale(1.1); }
.mpf-btn.mpf-high.active { background: #d1fae5; color: #065f46; border-color: #86efac; }
.mpf-btn.mpf-medium.active { background: var(--pass-bg); color: var(--pass-text); border-color: #86efac; }
.mpf-btn.mpf-low.active { background: #fff3cd; color: #856404; border-color: #fde68a; }
.mpf-btn.mpf-caution.active { background: #fff8e1; color: #b45309; border-color: #fbbf24; }
.mpf-btn.mpf-mismatch.active { background: var(--fail-bg); color: var(--fail-text); border-color: #fca5a5; }
.mpf-btn.mpf-nodata.active { background: #f3e5f5; color: #7b1fa2; border-color: #ce93d8; }
.mpf-btn:not(.active) { opacity: 0.4; }

/* ── Blank & Negate Toggles ─────────────────────── */
.filter-extras { display: flex; gap: 2px; margin-top: 3px; }
.blank-toggle, .negate-toggle {
  width: 20px; height: 18px; border-radius: 3px; border: 1px solid var(--border);
  font-size: 11px; cursor: pointer; background: #fff; color: var(--text-dim);
  transition: all .12s; padding: 0; line-height: 16px; text-align: center;
}
.blank-toggle:hover, .negate-toggle:hover { border-color: var(--navy); }
.blank-toggle.active { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.negate-toggle.active { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

/* ── Confidence Bands in Filter Row ─────────────── */
.confidence-bands { display: flex; gap: 2px; }
.conf-band {
  flex: 1; padding: 3px 0; border-radius: 3px; border: 1px solid var(--border);
  font-size: 9px; font-weight: 700; cursor: pointer; background: #fff;
  color: var(--text-dim); text-align: center; transition: all .12s;
}
.conf-band:hover { border-color: var(--navy); }
.conf-band.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ── Stat cards clickable ───────────────────────── */
.stats-row .stat { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.stats-row .stat:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(12,27,46,.1); }

/* ── Group-by header rows ───────────────────────── */
.group-header-row td {
  background: #eef2f7; font-weight: 700; font-size: 12px; color: var(--navy);
  padding: 8px 14px; cursor: pointer; border-bottom: 2px solid var(--border);
}
.group-header-row:hover td { background: #e4eaf2; }
.group-toggle { font-size: 10px; margin-right: 4px; }
.group-count { font-weight: 400; color: var(--text-dim); }
.group-collapsed + tr { display: none; }

/* ── Column hidden ──────────────────────────────── */
.col-hidden { display: none !important; }

/* ── Lead Detail Panel ──────────────────────────── */
.lead-detail { padding: 16px; }
.ld-verdict { padding: 16px; border-radius: 8px; margin-bottom: 16px; text-align: center; }
.ld-verdict-pass { background: var(--pass-bg); }
.ld-verdict-review-high, .ld-verdict-review-low { background: #fff8ee; }
.ld-verdict-fail { background: var(--fail-bg); }
.ld-badge {
  display: inline-block; padding: 4px 14px; border-radius: 20px; font-size: 13px;
  font-weight: 700; letter-spacing: .04em; margin-bottom: 8px;
}
.ld-verdict-pass .ld-badge { background: var(--pass-text); color: #fff; }
.ld-verdict-review-high .ld-badge, .ld-verdict-review-low .ld-badge { background: var(--orange); color: #fff; }
.ld-verdict-fail .ld-badge { background: var(--fail-text); color: #fff; }
.ld-score-bar {
  height: 8px; background: #e5e7eb; border-radius: 4px; margin: 8px auto; width: 80%; max-width: 200px;
}
.ld-score-fill { height: 100%; border-radius: 4px; transition: width .4s ease; background: linear-gradient(to right, #ef4444, #f59e0b, #22c55e); }
.ld-score-label { font-size: 18px; font-weight: 700; color: var(--navy); }
.ld-key-reason { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

.ld-section { margin-bottom: 16px; }
.ld-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-dim); margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border);
}

.ld-breakdown { display: flex; flex-direction: column; gap: 6px; }
.ld-breakdown-row { display: flex; align-items: center; gap: 8px; }
.ld-dim-name { font-size: 11px; font-weight: 600; width: 90px; flex-shrink: 0; color: var(--text); }
.ld-dim-bar { flex: 1; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.ld-dim-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.ld-dim-fill.mpf-high { background: #059669; }
.ld-dim-fill.mpf-medium { background: #10b981; }
.ld-dim-fill.mpf-low { background: #f59e0b; }
.ld-dim-fill.mpf-caution { background: #d97706; }
.ld-dim-fill.mpf-mismatch { background: #ef4444; }
.ld-dim-fill.mpf-nodata { background: #8b5cf6; }
.ld-dim-level { font-size: 9px; font-weight: 700; width: 64px; text-align: center; padding: 1px 4px; border-radius: 3px; }
.badge-high { background: #d1fae5; color: #065f46; }
.badge-medium { background: var(--pass-bg); color: var(--pass-text); }
.badge-low { background: #fff3cd; color: #856404; }
.badge-caution { background: #fff8e1; color: #b45309; }
.badge-mismatch { background: var(--fail-bg); color: var(--fail-text); }
.badge-nodata { background: #f3e5f5; color: #7b1fa2; }

.ld-dim-card {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 6px;
  padding: 10px; margin-bottom: 8px;
}
.ld-dim-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.ld-icon-pass { color: var(--pass-text); font-size: 14px; }
.ld-icon-fail { color: var(--fail-text); font-size: 14px; }
.ld-mp-badge { font-size: 9px; padding: 1px 6px; border-radius: 3px; font-weight: 700; }
.ld-dim-row { font-size: 11.5px; color: var(--text); margin-bottom: 2px; }
.ld-dim-lbl { font-weight: 600; color: var(--text-dim); }

.ld-asset-rel { padding: 8px; border-radius: 6px; }
.ld-asset-rel.ar-high { background: #d1fae5; }
.ld-asset-rel.ar-medium { background: #fef3c7; }
.ld-asset-rel.ar-low { background: #fee2e2; }

.ld-cross-issue {
  background: #fff8ee; border: 1px solid #fde68a; border-radius: 6px;
  padding: 8px 10px; font-size: 11.5px; color: #92400e; margin-bottom: 4px;
}

/* ── Compact upload zone ─────────────────────────── */
.upload-zone-sm { padding: 10px 10px; }
.upload-zone-sm p { font-size: 12px; margin-top: 0; }

/* ── Inline upload row ──────────────────────────── */
.inline-upload-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.inline-upload-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--navy);
  background: var(--surface2); border: 1.5px dashed var(--border);
  transition: all .18s; white-space: nowrap;
}
.inline-upload-btn:hover { border-color: var(--orange); background: var(--orange-soft); color: var(--orange); }
.inline-upload-btn input { display: none; }
.inline-upload-btn svg { flex-shrink: 0; opacity: .6; }
.inline-upload-btn:hover svg { opacity: 1; }
.inline-upload-name {
  font-size: 12px; color: var(--text-dim); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 260px;
}
.btn-sm { font-size: 12px; padding: 6px 14px; }

/* ── Brief toggle ───────────────────────────────── */
.brief-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-mid);
  cursor: pointer; user-select: none; padding: 4px 0;
  transition: color .15s;
}
.brief-toggle:hover { color: var(--orange); }
.brief-toggle-arrow { transition: transform .2s; flex-shrink: 0; }
.brief-toggle-hint { font-weight: 400; color: var(--text-dim); font-size: 11px; }
.brief-body { padding-top: 2px; }
.brief-body textarea { min-height: 60px; }

/* ── Method badge (AI vs Rule) ───────────────────── */
.method-pill { display:inline-block; border-radius:4px; font-size:9px; font-weight:700; padding:1px 5px; margin-left:3px; text-transform:uppercase; letter-spacing:.04em; }
.method-pill.m-ai { background:#fff3ec; color:var(--orange); border:1px solid #fbd5bf; }
.method-pill.m-rule { background:#e8edf4; color:var(--navy); border:1px solid var(--border); }

/* ── Cell interactivity ──────────────────────────── */
td[data-has-detail] { cursor: pointer !important; }
td[data-has-detail]:hover { outline: 2px solid var(--orange); outline-offset: -2px; border-radius: 2px; }
td[data-lead-click] { cursor: pointer !important; }
td[data-lead-click]:hover { outline: 2px solid var(--navy); outline-offset: -2px; border-radius: 2px; }

/* ── JS floating tooltip ─────────────────────────── */
.cell-tooltip {
  display: none; position: fixed; z-index: 100;
  transform: translateX(-50%) translateY(-100%);
  background: var(--navy); color: #fff; font-size: 11px; font-weight: 500;
  padding: 6px 10px; border-radius: 6px; white-space: pre-line;
  max-width: 350px; min-width: 120px; line-height: 1.4;
  box-shadow: 0 4px 14px rgba(12,27,46,.2); pointer-events: none;
}
.cell-tooltip::after {
  content: ''; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--navy);
}

/* ── NAC/SUP badges ──────────────────────────────── */
.badge-nac { background:#fff0ee; color:var(--fail-text); }
.badge-sup { background:#fff0ee; color:var(--fail-text); }
.badge-return { background:#fff3ec; color:var(--orange); }
.lead-status-cell, .lead-score-cell { cursor: pointer !important; }
.lead-status-cell:hover, .lead-score-cell:hover { outline: 2px solid var(--navy); outline-offset: -2px; border-radius: 2px; }

/* ── Detail Panel (slide-in) ────────────────────── */
.detail-overlay {
  position: fixed; inset: 0; background: rgba(12,27,46,.3);
  z-index: 100; opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.detail-panel {
  position: fixed; top: 0; right: -420px; bottom: 0; width: 400px;
  background: var(--surface); box-shadow: -4px 0 20px rgba(12,27,46,.15);
  z-index: 101; transition: right .3s ease;
  display: flex; flex-direction: column; overflow: hidden;
}
.detail-panel.open { right: 0; }
.detail-panel.open ~ .detail-overlay,
.detail-overlay.open { opacity: 1; pointer-events: auto; }
.detail-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; font-size: 22px;
  color: var(--text-dim); cursor: pointer; line-height: 1; z-index: 2;
}
.detail-close:hover { color: var(--text); }
.detail-body { padding: 24px; overflow-y: auto; flex: 1; }
.detail-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
}
.detail-status-pass { background: var(--pass-bg); }
.detail-status-fail { background: var(--fail-bg); }
.detail-status-caution { background: #fff8e1; }
.detail-status-caution .detail-badge { background: #b45309; color: #fff; }
.detail-field { font-size: 1rem; font-weight: 700; color: var(--navy); }
.detail-badge {
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: .04em;
}
.detail-status-pass .detail-badge { background: var(--pass-text); color: #fff; }
.detail-status-fail .detail-badge { background: var(--fail-text); color: #fff; }
.detail-section { padding: 14px 0; border-bottom: 1px solid #edf1f7; }
.detail-section:last-child { border-bottom: none; }
.detail-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-dim); margin-bottom: 6px;
}
.detail-value { font-size: 14px; color: var(--text); line-height: 1.5; }
.detail-ai { background: var(--orange-soft); border-radius: var(--radius); padding: 14px; margin: 8px 0; }
.detail-returns { background: #f0f4ff; border-radius: var(--radius); padding: 14px; margin: 8px 0; }
.detail-hint { background: var(--surface2); border-radius: var(--radius); padding: 14px; margin: 8px 0; }
.detail-hint .detail-value { color: var(--orange); font-weight: 600; font-size: 13px; }
.detail-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* ── Detail Panel: Lead Check Summary ────────────── */
.detail-summary {
  margin-top: 16px; padding-top: 14px;
  border-top: 2px solid var(--border);
}
.detail-summary > .detail-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--navy); margin-bottom: 10px;
}
.detail-category { margin-bottom: 10px; }
.detail-cat-label {
  font-size: 11px; font-weight: 600; color: var(--text-mid);
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em;
}
.check-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 6px; font-size: 11px;
  font-weight: 600; margin: 2px 3px 2px 0; border: 1px solid;
}
.check-pill-pass {
  background: var(--pass-bg); color: var(--pass-text); border-color: #c6f0c6;
}
.check-pill-fail {
  background: var(--fail-bg); color: var(--fail-text); border-color: #f5c6c0;
}
.check-pill .method-pill { font-size: 9px; padding: 1px 5px; }

/* ── Detail Panel: Per-Perspective Analysis ──────── */
.detail-perspectives {
  margin-top: 16px; padding-top: 14px;
  border-top: 2px solid var(--border);
}
.detail-perspectives > .detail-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--navy); margin-bottom: 10px;
}
.detail-perspective {
  margin-bottom: 14px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.detail-persp-header {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--navy);
  margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.detail-persp-item {
  padding: 8px 10px; margin-bottom: 6px;
  border-radius: 6px; border-left: 3px solid var(--border);
}
.detail-persp-item:last-child { margin-bottom: 0; }
.detail-persp-pass { border-left-color: var(--pass-text); background: #f0fdf4; }
.detail-persp-fail { border-left-color: var(--fail-text); background: #fef2f2; }
.detail-persp-caution { border-left-color: var(--caution-text, #b45309); background: #fffbeb; }
.detail-persp-status {
  font-size: 12px; margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}
.detail-persp-status .method-pill { font-size: 9px; padding: 1px 5px; }
.detail-persp-row {
  font-size: 12px; color: var(--text); line-height: 1.5;
  padding: 1px 0;
}
.detail-persp-lbl {
  font-weight: 600; color: var(--text-mid);
}
.detail-persp-row.detail-ai { color: #7c3aed; }
.detail-persp-row.detail-returns { color: #0369a1; }
.detail-persp-na {
  font-size: 11px; color: var(--text-dim); font-style: italic;
  padding: 6px 10px;
}

/* ── RT Issues Block ─────────────────────────────── */
.rt-issues-block {
  max-width: 1380px; margin: 16px auto 0; padding: 0;
  background: var(--fail-bg); border: 1.5px solid #f5c6c0;
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  overflow: hidden;
}
.rt-issues-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px; font-size: 13px; font-weight: 700;
  color: var(--fail-text); border-bottom: 1px solid #f5c6c0;
}
.rt-issues-header svg { flex-shrink: 0; color: var(--fail-text); }
.rt-issues-header span { flex: 1; }
.block-toggle {
  background: none; border: none; font-size: 14px; line-height: 1;
  color: inherit; cursor: pointer; opacity: .5; padding: 2px 6px;
  transition: opacity .15s, transform .15s;
}
.block-toggle:hover { opacity: 1; }
.rt-issue { padding: 12px 20px; font-size: 13px; color: var(--text); line-height: 1.6; }
.rt-issue + .rt-issue { border-top: 1px solid #f5c6c0; }
.rt-issue-fail { background: var(--fail-bg); }
.rt-issue-warn { background: #fffbeb; border-top-color: #f0d68a; }
.rt-issue-tag-warn {
  display: inline-block; background: #fef3c7; color: #92400e;
  padding: 2px 10px; border-radius: 6px; font-size: 12px;
  margin: 4px 4px 0 0; border: 1px solid #f0d68a;
}
.rt-issue strong { color: var(--fail-text); }
.rt-issue-tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 12px; font-weight: 600; margin: 3px 2px;
}
.rt-issue-tag-fail { background: #fff; border: 1px solid #f5c6c0; color: var(--fail-text); }

/* ── Full-width card (Returns) ──────────────────── */
.full-width-card {
  grid-column: 1 / -1;
  margin-top: 4px;
}
.returns-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 860px) { .returns-grid { grid-template-columns: 1fr; } }
.returns-section {
  padding: 0;
}

/* ── Campaign info blocks (collapsible) ────────── */
.campaign-info-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface2);
}
.campaign-info-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  background: rgba(15,23,42,.03);
  user-select: none;
  transition: background .15s;
}
.campaign-info-header:hover {
  background: rgba(244,115,28,.04);
}
.campaign-info-arrow {
  transition: transform .2s;
  transform: rotate(90deg);
  flex-shrink: 0;
}
.campaign-info-body {
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
  border-top: 1px solid var(--border);
}
.campaign-info-body div {
  padding: 1px 0;
}
.campaign-info-body strong {
  color: var(--navy);
  font-weight: 600;
}

/* AI Mode segmented control */
.ai-mode-row {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0 4px; flex-wrap: wrap;
}
.ai-mode-label {
  font-weight: 600; font-size: 13px; color: var(--navy);
  white-space: nowrap;
}
.ai-mode-group {
  display: inline-flex; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface2);
}
.ai-mode-group input[type="radio"] {
  position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0;
}
.ai-mode-opt {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; font-size: 12px; font-weight: 500;
  color: var(--text-mid); cursor: pointer; user-select: none;
  border-right: 1px solid var(--border); transition: all .18s ease;
  background: transparent; white-space: nowrap; line-height: 1; position: relative;
}
.ai-mode-opt:last-child { border-right: none; border-radius: 0 7px 7px 0; }
.ai-mode-group input:first-child + .ai-mode-opt { border-radius: 7px 0 0 7px; }
.ai-mode-opt:hover { background: rgba(244,115,28,.06); color: var(--text); }
.ai-mode-opt svg { width: 14px; height: 14px; flex-shrink: 0; opacity: .55; transition: opacity .18s; }
.ai-mode-group input[type="radio"]:checked + .ai-mode-opt {
  background: var(--orange); color: #fff; font-weight: 600;
  border-right-color: var(--orange-hover);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
}
.ai-mode-group input[type="radio"]:checked + .ai-mode-opt svg { opacity: 1; }
.ai-mode-group input[type="radio"]:focus-visible + .ai-mode-opt {
  outline: 2px solid var(--orange); outline-offset: -2px;
}

/* AI Mode tooltips */
.ai-mode-opt[data-tip]::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) scale(.92); transform-origin: top center;
  background: var(--navy); color: #fff; font-size: 11px; font-weight: 400;
  line-height: 1.45; padding: 7px 11px; border-radius: 6px;
  white-space: normal; width: max-content; max-width: 210px; text-align: center;
  pointer-events: none; opacity: 0; transition: opacity .18s, transform .18s;
  z-index: 90; box-shadow: 0 4px 14px rgba(12,27,46,.18);
}
.ai-mode-opt[data-tip]::before {
  content: ''; position: absolute; top: calc(100% + 3px); left: 50%;
  transform: translateX(-50%); border: 5px solid transparent;
  border-bottom-color: var(--navy);
  pointer-events: none; opacity: 0; transition: opacity .18s;
  z-index: 91;
}
.ai-mode-opt[data-tip]:hover::after,
.ai-mode-opt[data-tip]:hover::before {
  opacity: 1;
}
.ai-mode-opt[data-tip]:hover::after {
  transform: translateX(-50%) scale(1);
}

/* ── Step Badges ────────────────────────────────── */
.step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--orange); color: #fff;
  font-size: 14px; font-weight: 800; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(244,115,28,.3);
}
.step-subtitle {
  font-size: 12px; color: var(--text-dim); font-weight: 400;
  margin-top: -4px; line-height: 1.4;
}

/* ── Section Divider ────────────────────────────── */
.section-divider {
  display: flex; align-items: center; gap: 14px;
  color: var(--text-dim); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  margin: 24px 0 16px; padding: 0 4px;
}
.section-divider::before, .section-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Optional Card ──────────────────────────────── */
.card-optional {
  border-style: dashed;
  background: var(--surface2);
  box-shadow: 0 1px 4px rgba(12,27,46,.03);
}
.badge-optional {
  display: inline-block; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 8px; border-radius: 10px;
  background: #e8edf4; color: var(--text-dim);
  margin-left: auto;
}

/* ── Sub-section header (within card) ────────────── */
.sub-section-header {
  font-size: 11.5px; font-weight: 700; color: var(--navy);
  text-transform: uppercase; letter-spacing: .06em;
  padding-bottom: 6px; margin-top: 4px;
  border-bottom: 1px solid var(--border);
}

/* ── Multi-field rows (Assets, Brand Guidelines, etc.) ── */
.multi-field-container { display: flex; flex-direction: column; gap: 6px; }
.multi-field-row {
  display: flex; align-items: center; gap: 6px;
}
.multi-field-label {
  font-size: 11px; font-weight: 600; color: var(--text-dim);
  min-width: 100px; white-space: nowrap; flex-shrink: 0;
}
.multi-field-row input[type="text"] {
  flex: 1; font-size: 12px; padding: 7px 10px;
}
.multi-field-upload-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px; cursor: pointer;
  background: var(--surface2); border: 1.5px solid var(--border);
  color: var(--text-dim); transition: all .15s; flex-shrink: 0;
  position: relative; overflow: hidden;
}
.multi-field-upload-btn:hover { border-color: var(--orange); color: var(--orange); background: var(--orange-soft); }
.multi-field-upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.multi-field-upload-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.multi-field-upload-btn.upload-disabled {
  opacity: 0.35; pointer-events: none; cursor: not-allowed;
  background: #f3f4f6; border-color: #e5e7eb;
}
.multi-field-row input[type="text"].input-disabled {
  background: #f3f4f6 !important; color: #9ca3af !important;
  cursor: not-allowed; border-color: #e5e7eb !important;
}
.multi-field-file-name {
  font-size: 10px; color: var(--pass-text); max-width: 120px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0;
}
.multi-field-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px; cursor: pointer;
  background: none; border: 1px solid transparent;
  color: var(--text-dim); transition: all .15s; flex-shrink: 0;
  font-size: 16px; line-height: 1;
}
.multi-field-remove:hover { background: var(--fail-bg); color: var(--fail-text); border-color: #f5c6c0; }
.multi-field-add {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; color: var(--orange);
  cursor: pointer; padding: 4px 0; border: none; background: none;
  transition: color .15s;
}
.multi-field-add:hover { color: var(--orange-hover); }
.multi-field-add svg { width: 12px; height: 12px; }

/* ── Additional files (file-only rows) ──────────── */
.file-only-row {
  display: flex; align-items: center; gap: 8px;
}
.file-only-row .file-only-input {
  flex: 1; font-size: 12px;
}
.file-only-name {
  font-size: 11px; color: var(--text-mid); flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Compact action bar (Step 3) ────────────────── */
.action-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════ */
/* ── NEW: Enhanced Match Intelligence Styles ────────── */
/* ══════════════════════════════════════════════════════ */

/* ── Cell match power classes (consolidated above) ── */

/* ── Badge: Review status ───────────────────────── */
.badge-review {
  background: #fef3c7; color: #92400e; padding: 3px 12px 3px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px;
}
.badge-review-low { background: #fed7aa; color: #9a3412; }
.badge-sub {
  font-size: 9px; font-weight: 500; opacity: 0.75;
  display: block; line-height: 1;
}

/* ── Review filter tab ──────────────────────────── */
.filter-tabs .tab.t-review { border-color: #f59e0b; }
.filter-tabs .tab.t-review.active { background: #fef3c7; color: #92400e; border-color: #f59e0b; }

/* ── Confidence score in table ──────────────────── */
.score-col { text-align: center; width: 60px; }
.keyreason-col { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.confidence-score {
  display: inline-block; font-size: 13px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px; min-width: 32px; text-align: center;
}
.cs-pass { background: #d1fae5; color: #065f46; }
.cs-review-high { background: #fef3c7; color: #92400e; }
.cs-review-low { background: #fed7aa; color: #9a3412; }
.cs-fail { background: #fce4ec; color: #c62828; }
.key-reason { font-size: 11px; color: var(--text-mid); }
td.keyreason-col:hover { outline: 2px solid var(--navy); outline-offset: -2px; border-radius: 2px; }

/* ── Detail panel: match power statuses ─────────── */
.detail-status-high { background: #d1fae5; }
.detail-status-high .detail-badge { background: #059669; color: #fff; }
.detail-status-medium { background: var(--pass-bg); }
.detail-status-medium .detail-badge { background: var(--pass-text); color: #fff; }
.detail-status-low { background: #fff3cd; }
.detail-status-low .detail-badge { background: #d97706; color: #fff; }
.detail-status-mismatch { background: var(--fail-bg); }
.detail-status-mismatch .detail-badge { background: var(--fail-text); color: #fff; }
.detail-status-nodata { background: #f3e5f5; }
.detail-status-nodata .detail-badge { background: #7b1fa2; color: #fff; }

.detail-confidence-bar {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.confidence-track {
  height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin: 6px 0 4px;
}
.confidence-fill {
  height: 100%;
  border-radius: 4px; transition: width .3s ease;
  background: linear-gradient(to right, #ef4444, #f59e0b, #22c55e);
}
.confidence-label {
  font-size: 12px; font-weight: 700; color: var(--navy);
}

/* ── Batch Intelligence Dashboard ───────────────── */
.batch-intelligence {
  max-width: 1380px; margin: 12px auto 0;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden;
}
.batch-intel-header {
  display: flex; align-items: center; gap: 8px; padding: 12px 20px;
  cursor: pointer; border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
  transition: background .15s;
}
.batch-intel-header:hover { background: #eef2ff; }
.batch-intel-title { font-size: 13px; font-weight: 700; color: var(--navy); flex: 1; }
.batch-intel-body { padding: 16px 20px; }

.batch-intel-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px;
}
.bi-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
}
.bi-card-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-dim); margin-bottom: 10px;
}
.bi-status-row { display: flex; gap: 12px; margin-bottom: 10px; }
.bi-stat { font-size: 13px; color: var(--text-mid); }
.bi-stat strong { font-size: 18px; display: block; }
.bi-pass strong { color: var(--pass-text); }
.bi-review strong { color: #d97706; }
.bi-fail strong { color: var(--fail-text); }

.bi-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: #e5e7eb; }
.bi-bar-pass { background: #22c55e; }
.bi-bar-review { background: #f59e0b; }
.bi-bar-fail { background: #ef4444; }
.bi-avg-score { font-size: 12px; color: var(--text-mid); margin-top: 8px; }
.bi-avg-score strong { color: #6366f1; }

.bi-reason { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.bi-reason-label { flex: 1; color: var(--text-mid); }
.bi-reason-bar { height: 6px; background: #ef4444; border-radius: 3px; opacity: 0.4; }
.bi-reason-count { font-weight: 700; color: var(--navy); min-width: 28px; text-align: right; }
.bi-empty { font-size: 12px; color: var(--text-dim); font-style: italic; }

.bi-histogram { display: flex; align-items: flex-end; gap: 8px; height: 80px; }
.bi-hist-col { display: flex; flex-direction: column; align-items: center; flex: 1; }
.bi-hist-bar { width: 100%; background: linear-gradient(180deg, #6366f1, #818cf8); border-radius: 3px 3px 0 0; min-height: 3px; }
.bi-hist-label { font-size: 9px; color: var(--text-dim); margin-top: 4px; }

.bi-recommendations { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.bi-rec {
  font-size: 12px; color: var(--text-mid); padding: 6px 10px; margin-bottom: 4px;
  background: #fefce8; border-left: 3px solid #f59e0b; border-radius: 0 6px 6px 0;
}

/* ── Guide modal ────────────────────────────────── */
.nav-guide {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.1); padding: 4px 12px; border-radius: 6px;
}
.nav-guide:hover { background: rgba(255,255,255,.2); color: #fff !important; }

.guide-overlay {
  position: fixed; inset: 0; background: rgba(12,27,46,.5); z-index: 999;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.guide-overlay.open { opacity: 1; pointer-events: auto; }

.guide-modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 720px; max-width: 95vw; max-height: 85vh;
  background: var(--surface); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(12,27,46,.3);
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: all .25s; display: flex; flex-direction: column;
}
.guide-modal.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }

.guide-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
}
.guide-title { font-size: 16px; font-weight: 700; color: var(--navy); }
.guide-close {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: var(--surface2); cursor: pointer; font-size: 18px;
  color: var(--text-dim); transition: all .15s;
}
.guide-close:hover { background: var(--fail-bg); color: var(--fail-text); }

.guide-body { display: flex; flex: 1; overflow: hidden; }

.guide-nav {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px; border-right: 1px solid var(--border);
  min-width: 140px; background: var(--surface2);
}
.guide-nav-btn {
  padding: 8px 12px; border: none; background: none;
  text-align: left; font-size: 12px; font-weight: 600;
  color: var(--text-mid); border-radius: 6px; cursor: pointer;
  transition: all .15s;
}
.guide-nav-btn:hover { background: var(--bg); color: var(--navy); }
.guide-nav-btn.active { background: var(--navy); color: #fff; }

.guide-content { flex: 1; overflow-y: auto; padding: 20px 24px; }
.guide-section { display: none; }
.guide-section.active { display: block; }
.guide-section h3 { font-size: 15px; color: var(--navy); margin-bottom: 10px; margin-top: 16px; }
.guide-section h3:first-child { margin-top: 0; }
.guide-section p { font-size: 13px; color: var(--text-mid); line-height: 1.6; margin-bottom: 10px; }

.guide-steps { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.guide-step {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
}
.guide-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.guide-note {
  font-size: 12px; color: var(--text-dim); padding: 8px 12px;
  background: #f0f9ff; border-left: 3px solid #3b82f6;
  border-radius: 0 6px 6px 0; margin-top: 8px;
}

.guide-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 10px 0; }
.guide-table th { background: var(--surface2); padding: 8px 10px; text-align: left; font-weight: 700; color: var(--navy); border-bottom: 2px solid var(--border); }
.guide-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-mid); }
.guide-table tr.gt-pass td:first-child { border-left: 3px solid var(--pass-text); }
.guide-table tr.gt-review td:first-child { border-left: 3px solid #f59e0b; }
.guide-table tr.gt-review-low td:first-child { border-left: 3px solid #f97316; }
.guide-table tr.gt-fail td:first-child { border-left: 3px solid var(--fail-text); }

.guide-ol { padding-left: 0; list-style: none; counter-reset: guide-step; margin: 10px 0; }
.guide-ol li {
  counter-increment: guide-step; padding: 6px 0 6px 32px; position: relative;
  font-size: 13px; color: var(--text-mid); line-height: 1.5;
}
.guide-ol li::before {
  content: counter(guide-step); position: absolute; left: 0; top: 6px;
  width: 22px; height: 22px; border-radius: 50%; background: var(--navy);
  color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 22px;
}
.guide-ul { padding-left: 16px; margin: 10px 0; }
.guide-ul li { font-size: 13px; color: var(--text-mid); line-height: 1.6; margin-bottom: 6px; }

.guide-color-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.guide-color-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-mid); }
.guide-swatch {
  width: 24px; height: 24px; border-radius: 6px; border: 2px solid; flex-shrink: 0;
}

/* ── URL-loaded row highlight ──────────────────── */
.multi-field-row.url-loaded .multi-field-upload-btn {
  background: var(--orange); border-color: var(--orange); color: #fff;
  opacity: 1; pointer-events: auto; cursor: pointer;
  animation: pulseUpload 2s ease-in-out infinite;
}
.multi-field-row.url-loaded .multi-field-upload-btn:hover {
  background: #c2410c; border-color: #c2410c;
}
@keyframes pulseUpload {
  0%, 100% { box-shadow: 0 0 0 0 rgba(234,88,12,.3); }
  50%      { box-shadow: 0 0 0 5px rgba(234,88,12,.08); }
}
.url-loaded-hint {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; margin-bottom: 6px;
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px;
  font-size: 11px; font-weight: 500; color: #9a3412;
}
.url-loaded-hint svg { flex-shrink: 0; }
.url-loaded-hint-dismiss {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: #9a3412; font-size: 14px; line-height: 1; padding: 0 2px;
  opacity: 0.6; transition: opacity .15s;
}
.url-loaded-hint-dismiss:hover { opacity: 1; }

/* ── Override buttons in detail panel ────────────── */
.override-actions {
  padding: 14px 16px; border-top: 2px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.override-btn {
  padding: 10px 16px; border: 2px solid; border-radius: 8px;
  font-size: 13px; font-weight: 700; cursor: pointer; transition: all .15s;
  text-align: center;
}
.override-approve {
  background: #f0fdf4; border-color: #86efac; color: #166534;
}
.override-approve:hover { background: #dcfce7; border-color: #4ade80; }
.override-reject {
  background: #fff1f2; border-color: #fecaca; color: #991b1b;
}
.override-reject:hover { background: #ffe4e6; border-color: #fca5a5; }
.override-done {
  font-size: 13px; font-weight: 600; padding: 10px 14px;
  border-radius: 8px; background: #f0f9ff; color: #1d4ed8;
  text-align: center;
}

/* ── Asset Analysis Status Indicator ────────────── */
.asset-analysis-status {
  margin-top: 6px; padding: 5px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.as-loading { background: #eff6ff; color: #1d4ed8; }
.as-ready { background: #f0fdf4; color: #166534; }
.as-error { background: #fff1f2; color: #991b1b; }
.as-spinner {
  display: inline-block; width: 12px; height: 12px; border: 2px solid #93c5fd;
  border-top-color: #1d4ed8; border-radius: 50%;
  animation: asSpin 0.7s linear infinite;
}
@keyframes asSpin { to { transform: rotate(360deg); } }

/* ── Asset Relevance Badge (detail panel) ────────── */
.detail-asset-relevance {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; margin: 6px 0; border-radius: 6px;
  font-size: 12px;
}
.detail-asset-relevance .detail-label {
  font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
}
.ar-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
}
.ar-high { background: #ecfdf5; }
.ar-high .ar-badge { background: #d1fae5; color: #065f46; }
.ar-medium { background: #eff6ff; }
.ar-medium .ar-badge { background: #dbeafe; color: #1e40af; }
.ar-low { background: #fefce8; }
.ar-low .ar-badge { background: #fef3c7; color: #92400e; }

/* ── Asset Intelligence Panel ───────────────────── */
.aip-panel {
  margin-top: 10px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden;
}
.aip-header {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  cursor: pointer; border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #f8fafc, #f0f4ff);
  transition: background .15s;
}
.aip-header:hover { background: #eef2ff; }
.aip-title { font-size: 12px; font-weight: 700; color: var(--navy); flex: 1; }
.aip-body {
  padding: 14px 16px; overflow: hidden;
  transition: max-height .35s ease, opacity .25s ease, padding .3s ease;
  opacity: 1;
}
.aip-body.collapsed {
  max-height: 0 !important; opacity: 0;
  padding-top: 0; padding-bottom: 0;
}

.aip-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: #64748b; margin: 14px 0 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.aip-section-label:first-child { margin-top: 0; }

.aip-asset-card {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 10px 14px; margin-bottom: 10px;
}
.aip-asset-card:last-child { margin-bottom: 0; }
.aip-asset-name {
  font-size: 12px; font-weight: 700; color: var(--navy);
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
}
.aip-asset-name svg { flex-shrink: 0; color: #64748b; }
.aip-asset-chars { font-weight: 400; color: #94a3b8; font-size: 11px; margin-left: auto; }

.aip-text-preview {
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 11px; line-height: 1.5; color: #475569;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 6px;
  padding: 8px 10px; margin-bottom: 6px;
  max-height: 90px; overflow: hidden; position: relative;
  white-space: pre-wrap; word-break: break-word;
  transition: max-height .35s ease;
}
.aip-text-preview.expanded { /* max-height set by JS via scrollHeight */ }
.aip-text-toggle {
  font-size: 11px; color: #3b82f6; cursor: pointer; background: none;
  border: none; padding: 0; font-weight: 600;
}
.aip-text-toggle:hover { text-decoration: underline; }
.aip-text-na {
  font-size: 11px; color: #94a3b8; font-style: italic; margin-bottom: 6px;
}

.aip-kw-label {
  font-size: 10px; font-weight: 600; color: #64748b; text-transform: uppercase;
  letter-spacing: .04em; margin-bottom: 4px;
}
.aip-keyword-wrap { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.aip-keyword-tag {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 500; background: #e0e7ff; color: #3730a3;
  line-height: 1.4;
}
.aip-kw-more {
  font-size: 11px; color: #3b82f6; cursor: pointer; background: none;
  border: none; padding: 2px 6px; font-weight: 600; border-radius: 12px;
}
.aip-kw-more:hover { background: #eff6ff; }
.aip-kw-extra {
  display: flex; flex-wrap: wrap; gap: 4px; width: 100%;
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height .35s ease, opacity .25s ease;
}
.aip-kw-extra.aip-kw-visible {
  opacity: 1; /* max-height set by JS via scrollHeight */
}

.aip-asset-ai {
  font-size: 11px; color: #475569; background: #eff6ff;
  border-radius: 6px; padding: 6px 10px; margin-top: 4px;
  line-height: 1.5;
}
.aip-asset-ai strong { color: #1e40af; font-weight: 600; }
.aip-ai-pending { color: #94a3b8; font-style: italic; }

.aip-overall-summary {
  background: #f0f9ff; border: 1px solid #bfdbfe; border-radius: 8px;
  padding: 12px 14px; margin-top: 8px;
}
.aip-summary-row {
  display: flex; gap: 8px; margin-bottom: 5px; font-size: 12px; line-height: 1.5;
}
.aip-summary-row:last-child { margin-bottom: 0; }
.aip-summary-label {
  font-weight: 600; color: #1e40af; min-width: 120px; flex-shrink: 0;
  font-size: 11px;
}
.aip-summary-value { color: #334155; }
.aip-array-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.aip-array-tag {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 10px; font-weight: 500; background: #dbeafe; color: #1e40af;
}

@media (max-width: 680px) {
  .stats-row { grid-template-columns: repeat(3,1fr); }
  .guide-modal { width: 98vw; }
  .guide-nav { min-width: 100px; font-size: 11px; }
  .guide-nav-btn { padding: 6px 8px; }
  .batch-intel-grid { grid-template-columns: 1fr; }
}
