/* ============================================================
   HAR Analyzer — Full Dashboard CSS
   Dark sidebar + white content area
   ============================================================ */

:root {
  /* Content area */
  --bg:          #f8fafc;
  --bg-card:     #ffffff;
  --bg-hover:    #f1f5f9;
  --border:      #e2e8f0;
  --text:        #0f172a;
  --text-muted:  #64748b;
  --text-light:  #94a3b8;

  /* Refined, Softer Brand colors */
  --primary:     #4f46e5;
  --primary-dk:  #4338ca;
  --primary-lt:  #e0e7ff;
  --success:     #059669;
  --success-lt:  #d1fae5;
  --warning:     #d97706;
  --warning-lt:  #fef3c7;
  --danger:      #dc2626;
  --danger-lt:   #fee2e2;
  --info:        #2563eb;
  --info-lt:     #dbeafe;
  --purple:      #7c3aed;

  --r-lg: 12px;
  --r-md:  8px;
  --r-sm:  5px;
  --sh-sm: 0 1px 3px rgba(0,0,0,.05);
  --sh-md: 0 4px 8px rgba(0,0,0,.08);
}

/* ── Reset ── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

a    { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; font-size: inherit; outline: none; }

/* ================================================================
   LAYOUT  — sidebar | content
   ================================================================ */

.har-app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ================================================================
   MAIN CONTENT PANE
   ================================================================ */

.har-content {
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
/* ── Upload View ── */
.upload-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 60px 24px 40px;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.upload-header h1 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.upload-header p  { color: var(--text-muted); font-size: 13.5px; margin-bottom: 28px; }

.uploader {
  border: 2px dashed var(--border);
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 44px 30px;
  cursor: pointer;
  transition: all .2s;
}
.uploader:hover, .uploader.dragover {
  border-color: var(--primary); background: var(--primary-lt);
}
.uploader-icon {
  width: 52px; height: 52px; border-radius: 12px;
  background: var(--primary-lt); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; transition: all .2s;
}
.uploader:hover .uploader-icon { background: var(--primary); color: #fff; transform: translateY(-2px); }
.uploader h3 { font-size: 15px; font-weight: 700; margin-bottom: 5px; }
.uploader p  { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }

.formats { display: flex; justify-content: center; gap: 8px; }
.tag-format {
  font-size: 10px; font-weight: 700; padding: 3px 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text-muted);
}

.try-demo-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 20px; padding: 9px 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-md); font-weight: 600;
  color: var(--text); cursor: pointer; transition: all .15s;
}
.try-demo-btn:hover { background: var(--bg-hover); transform: translateY(-1px); }
.try-demo-btn svg  { width: 13px; height: 13px; }

/* ── Report view ── */
.report-view {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
}

/* ── Header bar ── */
.dash-header {
  display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
  padding: 11px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.file-meta-row { display: flex; flex-direction: column; gap: 2px; }

.file-title-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.file-name { font-size: 16px; font-weight: 800; letter-spacing: -.4px; }

.badge {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px;
}
.badge-success {
  background: var(--success-lt); color: var(--success);
  border: 1px solid rgba(16,185,129,.25);
}

.file-meta-line {
  font-size: 11.5px; color: var(--text-muted);
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.meta-dot { color: var(--text-light); }

.dash-actions { display: flex; gap: 7px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-md); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text);
}
.btn:hover { background: var(--bg-hover); }
.btn svg   { width: 13px; height: 13px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); border-color: var(--primary-dk); }

/* ── Tabs bar ── */
.tabs-bar {
  display: flex; align-items: center;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  flex-shrink: 0;
}
.tabs-nav {
  display: flex; flex: 1;
  overflow-x: auto; scrollbar-width: none;
}
.tabs-nav::-webkit-scrollbar { display: none; }

.tabs-scroll-btn {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); padding: 0 5px; height: 40px;
  display: flex; align-items: center;
}
.tabs-scroll-btn svg { width: 13px; height: 13px; }
.tabs-scroll-btn:hover { color: var(--text); }

.tab-btn {
  padding: 10px 15px; border: none; background: transparent;
  font-size: 12.5px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

/* ── Scrollable dashboard area ── */
.dash-body {
  flex: 1; overflow-y: auto;
  padding: 18px 20px 32px;
  display: flex; flex-direction: column; gap: 16px;
  background: var(--bg);
}

/* ── Section header ── */
.section-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap;
}
.section-title    { font-size: 16px; font-weight: 700; }
.section-subtitle { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.filter-row { display: flex; align-items: center; gap: 7px; }

.sel {
  padding: 5px 10px; border: 1px solid var(--border);
  border-radius: var(--r-md); background: var(--bg-card);
  color: var(--text); font-size: 12px; font-weight: 500; cursor: pointer;
}

/* ── KPI grid — always single row ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 10px 8px;
  display: flex; flex-direction: column;
  min-height: 108px; overflow: hidden;
  box-shadow: var(--sh-sm);
}

.kpi-label {
  font-size: 9.5px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.kpi-val {
  font-size: 18px; font-weight: 800; letter-spacing: -.4px;
  line-height: 1.1; margin-bottom: 1px;
  display: flex; align-items: baseline; gap: 4px;
  white-space: nowrap; overflow: hidden;
}

.kpi-pct { font-size: 11px; font-weight: 600; color: var(--text-muted); }

.kpi-sub { font-size: 10px; color: var(--text-light); margin-bottom: 6px; }

.kpi-spark { margin-top: auto; height: 28px; width: 100%; }

/* Score gauge card */
.kpi-card-score {
  align-items: center; justify-content: center; text-align: center; gap: 3px;
}
.gauge-wrap {
  position: relative; width: 66px; height: 66px;
  display: flex; align-items: center; justify-content: center;
}
.gauge-svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.gauge-bg  { fill: none; stroke: var(--bg-hover); stroke-width: 7; }
.gauge-val {
  fill: none; stroke: var(--warning); stroke-width: 7;
  stroke-linecap: round; stroke-dasharray: 220; stroke-dashoffset: 220;
  transition: stroke-dashoffset .6s ease;
}
.gauge-txt {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; line-height: 1;
}
.gauge-num   { font-size: 16px; font-weight: 800; }
.gauge-denom { font-size: 8px; color: var(--text-light); margin-top: 1px; }
.gauge-label { font-size: 10px; font-weight: 700; color: var(--warning); margin-top: 2px; }
.gauge-sub   { font-size: 9px; color: var(--text-muted); text-align: center; }

/* ── Insights row — 3 panels ── */
.insights-row {
  display: grid;
  grid-template-columns: minmax(0,1.15fr) minmax(0,.9fr) minmax(0,1fr);
  gap: 12px;
  align-items: start;
}

.panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px;
  box-shadow: var(--sh-sm); display: flex; flex-direction: column;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; gap: 7px;
}
.panel-title svg { width: 14px; height: 14px; }

/* Recommendations */
.reco-list { display: flex; flex-direction: column; gap: 7px; }
.reco-item {
  display: flex; gap: 9px; padding: 7px;
  border-radius: var(--r-md); border: 1px solid transparent;
  cursor: pointer; transition: all .15s;
}
.reco-item:hover { background: var(--bg-hover); border-color: var(--border); }
.reco-icon {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.reco-icon svg { width: 13px; height: 13px; }
.reco-body { flex: 1; min-width: 0; }
.reco-top  { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; margin-bottom: 2px; }
.reco-name   { font-size: 11.5px; font-weight: 600; }
.reco-saving { font-size: 11px; font-weight: 700; white-space: nowrap; }
.reco-desc   { font-size: 10px; color: var(--text-muted); line-height: 1.35; }
.view-all {
  margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border);
  text-align: center; font-size: 11.5px; font-weight: 600; color: var(--primary);
}
.view-all:hover { text-decoration: underline; }

/* Breakdown donut */
.donut-wrap {
  display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap;
}
.donut-canvas-wrap { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.donut-legend {
  flex: 1; min-width: 90px;
  display: flex; flex-direction: column; gap: 5px; padding-top: 4px;
}
.legend-row, .legend-item {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; gap: 5px;
}
.legend-key { display: flex; align-items: center; gap: 6px; color: var(--text-muted); min-width: 0; }
.legend-dot, .legend-color-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; display: inline-block; }
.legend-key span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-num { font-weight: 700; white-space: nowrap; font-size: 11.5px; }
.legend-pct { font-size: 10px; color: var(--text-light); margin-left: 2px; }
.legend-vals { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; white-space: nowrap; }

/* Grades */
.grades-list { display: flex; flex-direction: column; gap: 6px; }
.grade-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; border-radius: var(--r-md); border: 1px solid var(--border);
}
.grade-lbl  { font-size: 11.5px; font-weight: 500; color: var(--text-muted); }
.grade-right { display: flex; align-items: center; gap: 10px; }
.grade-val  { font-size: 12.5px; font-weight: 700; }
.grade-badge {
  width: 22px; height: 22px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
}
.ga, .gb { background: var(--success-lt); color: var(--success); border: 1px solid rgba(16,185,129,.25); }
.gc, .gd { background: var(--warning-lt); color: var(--warning); border: 1px solid rgba(245,158,11,.25); }
.gf       { background: var(--danger-lt);  color: var(--danger);  border: 1px solid rgba(239,68,68,.25); }

/* ── Network panel ── */
.net-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px;
  box-shadow: var(--sh-sm); display: flex; flex-direction: column; gap: 11px;
}
.net-title { font-size: 14px; font-weight: 700; }

.net-search-row {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.search-wrap { position: relative; min-width: 170px; flex: 0 1 220px; }
.search-wrap svg {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 13px; height: 13px; color: var(--text-light);
}
.search-field {
  width: 100%; padding: 6px 10px 6px 28px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg-card); font-size: 12px;
}
.search-field:focus { border-color: var(--primary); }

.check-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted); cursor: pointer; user-select: none;
}

.view-toggle {
  display: flex; border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 2px; background: var(--bg-hover);
  margin-left: auto;
}
.vt-btn {
  padding: 4px 10px; border: none; background: transparent;
  border-radius: var(--r-sm); font-size: 11.5px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: all .15s;
}
.vt-btn.active { background: var(--bg-card); color: var(--text); box-shadow: var(--sh-sm); }

/* Pill row */
.pills-row {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); padding-bottom: 8px; gap: 10px;
}
.pills-list { display: flex; gap: 5px; flex-wrap: wrap; }

.pill {
  padding: 4px 10px; border: 1px solid var(--border);
  background: var(--bg-card); border-radius: 4px;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px; transition: all .15s;
}
.pill:hover { background: var(--bg-hover); color: var(--text); }
.pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pill-n { font-size: 11px; font-weight: 500; opacity: .85; }

.clear-link { font-size: 11px; font-weight: 600; color: var(--text-light); cursor: pointer; white-space: nowrap; }
.clear-link:hover { color: var(--danger); text-decoration: underline; }

/* Table */
.tbl-wrap {
  overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md);
}
.net-tbl { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
.net-tbl th {
  background: var(--bg-hover); color: var(--text-muted);
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.net-tbl td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  color: var(--text-muted); white-space: nowrap;
}
.net-tbl tbody tr:last-child td { border-bottom: none; }
.net-tbl tbody tr:hover td { background: var(--bg-hover); color: var(--text); }

.td-name {
  max-width: 220px; overflow: hidden; text-overflow: ellipsis;
  color: var(--text); font-weight: 500;
}
.td-status-ok  { color: #16a34a; font-weight: 700; }
.td-status-err { color: var(--danger); font-weight: 700; }
.td-status-rdr { color: var(--warning); font-weight: 700; }

.td-used-yes { display:inline-block; background:var(--success-lt); color:var(--success); font-size:9px; font-weight:700; padding:2px 6px; border-radius:4px; }
.td-used-no  { display:inline-block; background:var(--danger-lt);  color:var(--danger);  font-size:9px; font-weight:700; padding:2px 6px; border-radius:4px; }

.wf-bar-wrap {
  width: 100%; min-width: 120px; height: 9px; background: var(--bg-hover);
  border-radius: 20px; overflow: hidden; display: flex;
}
.wf-seg { height: 100%; }
.wf-blocked { background: var(--text-light); }
.wf-dns     { background: var(--purple); }
.wf-connect { background: var(--warning); }
.wf-ssl     { background: var(--info); }
.wf-send    { background: var(--primary); }
.wf-wait    { background: #fdba74; }
.wf-receive { background: var(--success); }

/* Expand arrow */
.td-expand {
  cursor: pointer; color: var(--text-light); user-select: none;
  width: 18px; text-align: center; font-size: 10px;
  transition: transform .2s;
}
.td-expand.open { transform: rotate(90deg); }

/* Pagination */
.pag-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11.5px; color: var(--text-muted); flex-wrap: wrap; gap: 10px;
}
.pag-btns { display: flex; align-items: center; gap: 3px; }
.pag-btn {
  width: 28px; height: 28px; border: 1px solid var(--border);
  background: var(--bg-card); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-weight: 600; font-size: 11.5px; color: var(--text-muted);
  transition: all .15s;
}
.pag-btn:hover { background: var(--bg-hover); color: var(--text); }
.pag-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pag-btn.disabled { opacity: .4; pointer-events: none; }

.rpp-row { display: flex; align-items: center; gap: 7px; }
.rpp-sel {
  padding: 4px 8px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--bg-card);
  cursor: pointer; font-size: 11.5px;
}

/* ── Row detail pane ── */
.net-detail-row td { padding: 0 !important; }
.net-detail-pane {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 2px solid var(--primary);
  height: 380px;
  background: var(--bg-card);
  overflow: hidden;
  min-width: 0;
}
.net-detail-pane > div {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.net-detail-pane > div:last-child {
  border-right: none;
}
.detail-tabs-bar {
  display: flex; overflow-x: auto; scrollbar-width: none;
  background: var(--bg-hover); border-bottom: 1px solid var(--border);
}
.detail-tabs-bar::-webkit-scrollbar { display: none; }

.detail-tab {
  padding: 9px 14px; border: none; background: transparent;
  font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
  transition: all .15s; margin-bottom: -1px;
}
.detail-tab:hover { color: var(--text); }
.detail-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.detail-body {
  flex: 1; overflow-y: auto; padding: 14px;
}

/* Details content */
.detail-section-lbl {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-muted); margin-bottom: 8px; margin-top: 14px;
}
.detail-section-lbl:first-child { margin-top: 0; }

.detail-kv-table { width: 100%; border-collapse: collapse; }
.detail-kv-table tr { border-bottom: 1px solid var(--border); }
.detail-kv-table tr:last-child { border-bottom: none; }
.detail-kv-table td { padding: 7px 0; font-size: 11.5px; vertical-align: top; }
.dkv-key   { color: var(--text-muted); font-weight: 500; width: 130px; flex-shrink: 0; }
.dkv-val   { color: var(--text); word-break: break-all; font-family: 'Courier New', monospace; font-size: 11px; }

/* Code preview */
.code-preview {
  flex: 1; overflow: auto; background: var(--bg);
  font-family: 'Courier New', monospace; font-size: 11.5px; line-height: 1.6;
  display: flex; flex-direction: column;
}
.code-lines { list-style: none; margin: 0; padding: 8px 0; counter-reset: ln; }
.code-lines li {
  position: relative; padding: 0 14px 0 46px; min-height: 19px;
  white-space: pre-wrap; word-break: break-all; color: var(--text);
  counter-increment: ln;
}
.code-lines li::before {
  content: counter(ln); position: absolute; left: 0; top: 0;
  width: 38px; text-align: right; color: var(--text-light);
  border-right: 1px solid var(--border); padding-right: 8px;
  background: var(--bg); user-select: none;
}
.code-lines li:hover { background: rgba(99,102,241,.04); }

.code-tag   { color: #3b82f6; }
.code-attr  { color: #f59e0b; }
.code-str   { color: #10b981; }
.code-kw    { color: #ef4444; font-weight: 600; }
.code-cmt   { color: #64748b; font-style: italic; }

/* Preview actions bar */
.preview-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-top: 1px solid var(--border);
  background: var(--bg-hover); flex-shrink: 0;
}
.prev-search-wrap { position: relative; flex: 1; max-width: 180px; }
.prev-search-wrap svg { position: absolute; left: 7px; top: 50%; transform: translateY(-50%); width: 11px; height: 11px; color: var(--text-light); }
.prev-search { width: 100%; padding: 4px 8px 4px 22px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-card); font-size: 11px; }

.prev-sel { padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-card); font-size: 11px; cursor: pointer; }
.prev-icon-btn {
  padding: 4px 7px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--bg-card);
  color: var(--text-muted); cursor: pointer; display: flex; align-items: center;
}
.prev-icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.prev-icon-btn svg { width: 12px; height: 12px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--text); color: #fff;
  padding: 10px 20px; border-radius: var(--r-md);
  font-weight: 600; box-shadow: var(--sh-md);
  z-index: 9999; opacity: 0; pointer-events: none;
  transition: all .3s cubic-bezier(.4,0,.2,1);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── Utilities ── */
.hidden { display: none !important; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeUp .3s ease forwards; }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .insights-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .insights-row { grid-template-columns: 1fr; }
  .detail-pane  { grid-template-columns: 1fr; }
}

/* ================================================================
   PERFORMANCE TAB
   ================================================================ */

/* Summary header */
.perf-summary-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 4px;
}

/* Summary KPI grid — always single row, number of columns set by data */
.perf-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  /* Force single line even at small widths */
  grid-auto-rows: 1fr;
}

.perf-kpi-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 10px 10px 7px;
  box-shadow: var(--sh-sm); display: flex; flex-direction: column; gap: 1px;
  overflow: hidden; min-height: 90px;
}

.perf-kpi-label {
  font-size: 9px; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.perf-kpi-val {
  font-size: 16px; font-weight: 800; letter-spacing: -.4px; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.perf-kpi-delta {
  font-size: 9px; font-weight: 600; display: flex; align-items: center; gap: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.delta-up   { color: var(--success); }
.delta-down { color: var(--danger); }

.perf-kpi-spark { margin-top: auto; height: 26px; width: 100%; }

/* Mid row layout — side-by-side panels */
.perf-mid-row {
  display: flex; gap: 12px; align-items: stretch; margin-bottom: 14px;
}

/* Load Timeline */
.timeline-wrap {
  position: relative;
  padding: 12px 0 4px;
}

.timeline-scale {
  display: flex; justify-content: space-between;
  font-size: 9px; color: var(--text-light); margin-bottom: 6px;
  padding: 0 2px;
}

.timeline-bar-row {
  position: relative; height: 28px;
  background: var(--bg-hover); border-radius: 4px; overflow: hidden;
  margin-bottom: 6px;
}

.tl-segment {
  position: absolute; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700; color: rgba(255,255,255,.85);
  overflow: hidden; white-space: nowrap;
  transition: opacity .15s;
  cursor: pointer;
}
.tl-segment:hover { opacity: .85; }

.tl-blocked  { background: #94a3b8; }
.tl-dns      { background: #8b5cf6; }
.tl-connect  { background: #f59e0b; }
.tl-ssl      { background: #3b82f6; }
.tl-send     { background: #6366f1; }
.tl-wait     { background: #fdba74; }
.tl-receive  { background: #10b981; }

.timeline-milestones {
  display: flex; gap: 0; position: relative;
  height: 20px; margin-bottom: 4px;
}

.tl-milestone {
  position: absolute; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
}

.tl-milestone-line {
  width: 1px; height: 8px; background: var(--text-light);
}

.tl-milestone-label {
  font-size: 8px; font-weight: 700; color: var(--text-muted);
  white-space: nowrap;
}

.tl-milestone-val {
  font-size: 8px; color: var(--primary); font-weight: 600;
}

.timeline-legend {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px;
}

.tl-legend-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--text-muted);
}

.tl-legend-dot {
  width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0;
}

/* Resource Breakdown table */
.res-breakdown-layout {
  display: flex; gap: 16px; align-items: flex-start;
}
.res-donut-wrap { flex-shrink: 0; }
.res-breakdown-table-wrap { flex: 1; overflow-x: auto; }

.res-breakdown-tbl {
  width: 100%; border-collapse: collapse; font-size: 11.5px;
}
.res-breakdown-tbl th {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--text-muted);
  padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: left;
}
.res-breakdown-tbl td {
  padding: 6px 8px; border-bottom: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-muted);
}
.res-breakdown-tbl tbody tr:last-child td { border-bottom: none; }
.res-breakdown-tbl tbody tr:hover td { background: var(--bg-hover); }
.res-type-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; color: var(--text);
}
.res-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

/* Page Load Breakdown */
.page-breakdown-layout {
  display: flex; gap: 20px; align-items: flex-start;
}

.page-breakdown-donut-wrap {
  position: relative; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 140px; height: 140px;
}

.pbd-val  { font-size: 18px; font-weight: 800; }
.pbd-lbl  { font-size: 10px; color: var(--text-muted); }

.page-breakdown-center-label {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; line-height: 1.2;
  pointer-events: none;
}

.phase-tbl { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.phase-tbl th {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-muted); padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: left;
}
.phase-tbl td {
  padding: 7px 8px; border-bottom: 1px solid var(--border); color: var(--text-muted);
}
.phase-tbl tbody tr:last-child td { border-bottom: none; }
.phase-tbl tbody tr:hover td { background: var(--bg-hover); }

.impact-badge {
  display: inline-block; font-size: 9.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px;
}
.impact-high   { background: var(--danger-lt);  color: var(--danger); }
.impact-medium { background: var(--warning-lt); color: var(--warning); }
.impact-low    { background: var(--success-lt); color: var(--success); }

.phase-tip {
  font-size: 10.5px; color: var(--text-muted);
  margin-top: 8px; padding: 8px 10px;
  background: var(--bg-hover); border-radius: var(--r-sm);
  border-left: 3px solid var(--warning);
  display: none;
}
.phase-tip.visible { display: block; }

/* Aggregate report grid */
.aggregate-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.agg-card {
  background: var(--bg-hover); border-radius: var(--r-md);
  padding: 10px 12px; display: flex; align-items: center; gap: 10px;
}
.agg-icon {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.agg-icon svg { width: 15px; height: 15px; }
.agg-body { min-width: 0; }
.agg-val  { font-size: 16px; font-weight: 800; letter-spacing: -.3px; line-height: 1.1; }
.agg-lbl  { font-size: 9.5px; color: var(--text-muted); margin-top: 1px; }
.agg-sub  { font-size: 9px; color: var(--text-light); }

/* Suggestions table */
.sugg-tbl { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.sugg-tbl th {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-muted); padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left;
  white-space: nowrap;
}
.sugg-tbl td {
  padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-muted);
  font-size: 11.5px;
}
.sugg-tbl tbody tr:last-child td { border-bottom: none; }
.sugg-tbl tbody tr:hover td { background: var(--bg-hover); }

.priority-badge {
  display: inline-block; font-size: 9.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 4px;
}
.priority-high   { background: var(--danger-lt);  color: var(--danger); }
.priority-medium { background: var(--warning-lt); color: var(--warning); }
.priority-low    { background: var(--success-lt); color: var(--success); }

.impact-dots { display: flex; gap: 2px; }
.impact-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.dot-filled-red    { background: var(--danger); }
.dot-filled-yellow { background: var(--warning); }
.dot-filled-green  { background: var(--success); }
.dot-empty         { background: var(--border); }

.panel-subtitle {
  font-size: 10.5px; color: var(--text-muted); font-weight: 400; margin-left: 8px;
}

/* Performance Score panel */
.perf-score-layout {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
}

.perf-score-gauge-wrap {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 110px; height: 110px; margin: 4px 0;
}

.perf-score-label {
  font-size: 16px; font-weight: 700; color: var(--success);
}

.perf-score-desc {
  font-size: 11px; color: var(--text-muted); max-width: 220px; line-height: 1.4;
}

.score-factors-list {
  width: 100%; display: flex; flex-direction: column; gap: 6px; margin-top: 4px;
}

.score-factor-row {
  display: flex; align-items: center; gap: 8px; font-size: 11.5px;
}
.sf-label { flex: 1; text-align: left; color: var(--text-muted); }
.sf-bar-wrap {
  flex: 1.5; height: 5px; background: var(--border); border-radius: 10px; overflow: hidden;
}
.sf-bar { height: 100%; border-radius: 10px; background: var(--success); }
.sf-val { font-size: 11.5px; font-weight: 700; color: var(--text); width: 36px; text-align: right; }

@media (max-width: 1200px) {
  .perf-mid-row  { flex-direction: column; }
}
@media (max-width: 800px) {
  .tim-top-row { flex-direction: column; }
}

/* ================================================================
   TIMINGS TAB
   ================================================================ */

.tim-top-row {
  display: flex; gap: 12px; align-items: stretch; margin-bottom: 14px;
}

/* Gantt / timing bar breakdown */
.tim-gantt-scale {
  display: flex; justify-content: space-between;
  font-size: 9px; color: var(--text-light);
  padding: 0 2px; margin-bottom: 4px;
}

.tim-gantt-labels {
  display: flex; margin-bottom: 6px; gap: 4px; flex-wrap: wrap;
}

.tim-gantt-label {
  font-size: 9px; font-weight: 600; color: var(--text-muted);
  white-space: nowrap;
}

.tim-gantt-bar-row {
  display: flex; height: 26px; border-radius: 4px;
  overflow: hidden; width: 100%; margin-bottom: 8px;
}

.tim-gantt-seg {
  height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700; color: rgba(255,255,255,.9);
  overflow: hidden; white-space: nowrap; cursor: pointer;
  transition: opacity .15s;
}
.tim-gantt-seg:hover { opacity: .82; }

.tim-gantt-scale-bottom {
  display: flex; justify-content: space-between;
  font-size: 9px; color: var(--text-light); padding: 0 2px; margin-top: 4px;
}

.tim-gantt-legend {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px;
}

.tim-legend-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--text-muted);
}

.tim-legend-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* Time distribution */
.tim-dist-layout {
  display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap;
}

/* Timing metrics list */
.tim-metrics-list { display: flex; flex-direction: column; gap: 0; }

.tim-metric-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}
.tim-metric-row:last-child { border-bottom: none; }
.tim-metric-label { color: var(--text-muted); font-weight: 500; }
.tim-metric-val   { font-weight: 700; color: var(--text); }

/* Timing insights cards */
.tim-insights-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}

.tim-insight-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px;
  box-shadow: var(--sh-sm); display: flex; flex-direction: column; gap: 8px;
}

.tim-insight-head {
  display: flex; align-items: flex-start; gap: 10px;
}

.tim-insight-icon {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tim-insight-icon svg { width: 16px; height: 16px; }

.tim-insight-title-row {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
}
.tim-insight-title { font-size: 12.5px; font-weight: 700; }
.tim-insight-badge {
  display: inline-block; font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px; align-self: flex-start;
}

.tim-insight-desc { font-size: 11px; color: var(--text-muted); line-height: 1.45; }

.tim-insight-link {
  font-size: 11px; font-weight: 600; color: var(--primary); margin-top: 2px;
}
.tim-insight-link:hover { text-decoration: underline; }

@media (max-width: 1200px) {
  .tim-top-row { flex-direction: column; }
  .tim-insights-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .tim-insights-grid { grid-template-columns: 1fr; }
}


/* ================================================================
   NEW TABS — Domains, Resources, Cache, Cookies, Headers,
              Content, Security, Redirects, Errors, Unused
   ================================================================ */

/* responsive: stack mid-rows on narrow screens */
@media (max-width: 900px) {
  .perf-mid-row { flex-direction: column; }
  .tim-insights-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Generic insight card inside panels ── */
.tab-insight-card {
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-hover);
}
.tab-insight-title {
  font-size: 11px; font-weight: 700; margin-bottom: 3px;
}
.tab-insight-desc {
  font-size: 11px; color: var(--text-muted); line-height: 1.4;
}

/* ── Horizontal bar chart rows ── */
.h-bar-row {
  margin-bottom: 8px;
}
.h-bar-label-row {
  display: flex; justify-content: space-between;
  font-size: 10.5px; margin-bottom: 2px; font-weight: 600;
}
.h-bar-track {
  height: 7px; background: var(--bg-hover);
  border-radius: 4px; overflow: hidden;
}
.h-bar-fill {
  height: 100%; border-radius: 4px; transition: width .3s ease;
}

/* ── Status/cache/type badges (reused) ── */
.badge-https  { background: var(--success-lt); color: var(--success); border: 1px solid rgba(16,185,129,.25); }
.badge-http   { background: var(--danger-lt);  color: var(--danger);  border: 1px solid rgba(239,68,68,.25); }
.badge-cached { background: var(--success-lt); color: var(--success); }
.badge-nocache{ background: var(--danger-lt);  color: var(--danger); }

/* ── Cookie / security icon rows ── */
.check-icon-yes { color: var(--success); font-weight: 700; }
.check-icon-no  { color: var(--danger); }

/* ── Panel subtitle ── */
.panel-subtitle {
  font-size: 10.5px; color: var(--text-muted); margin-top: 1px;
}

/* ── Donut chart legend compact ── */
.donut-legend-compact {
  display: flex; flex-direction: column; gap: 4px;
}
.donut-legend-compact .legend-entry {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-muted);
}
.donut-legend-compact .legend-entry .dot {
  width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0;
}
.donut-legend-compact .legend-entry strong {
  margin-left: auto; color: var(--text); font-weight: 700;
}

/* ── Score gauge (security) ── */
.sec-score-gauge {
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0;
}
.sec-score-num {
  font-size: 28px; font-weight: 800;
}
.sec-score-lbl {
  font-size: 11px; color: var(--text-muted); margin-top: 2px;
}

/* ── Redirect type label ── */
.rdr-type-badge {
  display: inline-block; font-size: 9.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px;
  background: var(--warning-lt); color: var(--warning);
}

/* ── Error/warning severity rows ── */
.err-item-row {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 6px 0; border-bottom: 1px solid var(--border);
  font-size: 11.5px;
}
.err-item-row:last-child { border-bottom: none; }

/* ── Unused resource type badge ── */
.unused-type-badge {
  display: inline-block; font-size: 9.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px;
  text-transform: uppercase;
}

/* ── Canvas resize helper ── */
.chart-canvas-wrap {
  position: relative;
  display: flex; align-items: center; justify-content: center;
}

/* ── Network row expand arrow ── */
.net-expand-cell {
  width: 28px; text-align: center; padding: 0 4px;
}
.net-expand-arrow {
  display: inline-block;
  font-size: 9px;
  color: var(--text-light);
  transition: transform .15s;
  cursor: pointer;
  user-select: none;
  line-height: 1;
}
tr:hover .net-expand-arrow { color: var(--primary); }

/* Detail pane */
.net-detail-row td { padding: 0 !important; }
.net-detail-pane {
  background: var(--bg-hover);
  border-top: 2px solid var(--primary);
}

/* Detail pane tabs */
.detail-tabs-bar {
  display: flex; overflow-x: auto; scrollbar-width: none;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.detail-tabs-bar::-webkit-scrollbar { display: none; }

.detail-tab {
  padding: 8px 14px; border: none; background: transparent;
  font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  border-bottom: 2px solid transparent; cursor: pointer;
  white-space: nowrap; transition: all .15s; margin-bottom: -1px;
}
.detail-tab:hover { color: var(--text); }
.detail-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.detail-body { overflow-y: auto; }

/* Response preview search/copy bar */
.prev-icon-btn {
  padding: 3px 7px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--bg-card);
  color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center;
  transition: all .15s; font-size: 11px;
}
.prev-icon-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ================================================================
   API / XHR DEEP-DIVE — Table, Toolbar, Tags, Sidebar
   ================================================================ */

/* Toolbar above the API table */
.api-dive-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

/* Sortable headers */
.api-dive-tbl th.api-th-sort { cursor: pointer; user-select: none; }
.api-dive-tbl th.api-th-sort:hover { color: var(--primary); }
.api-sort-arrow { font-size: 10px; margin-left: 2px; color: var(--primary); }

/* ── Sidebar tabs (Analysis / Request / Response) ── */
.api-sb-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin: 12px 0 0;
}

/* ── Performance Sub-Tabs ── */
.perf-sub-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.perf-sub-tab {
  background: var(--bg-hover);
  border: 1px solid transparent;
  padding: 8px 16px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.2s ease;
}
.perf-sub-tab:hover {
  background: var(--border);
  color: var(--text);
}
.perf-sub-tab.active {
  background: var(--primary-lt);
  color: var(--primary-dk);
  border-color: var(--primary);
  box-shadow: var(--sh-sm);
}
.api-sb-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px 4px 0 0;
}
.api-sb-tab:hover { color: var(--text); background: var(--bg-hover); }
.api-sb-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: none; }

.api-sb-tab-body { padding-top: 10px; }

/* ── Response body preview inside sidebar ── */
#apiSbRespBodyWrap {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-top: 4px;
}
/* Inner wrapper produced by _dtlPreview */
#apiSbRespBodyWrap > div {
  display: flex;
  flex-direction: column;
}
/* The scrollable body area inside preview */
#apiSbRespBodyWrap [id$="_body"] {
  overflow-y: auto;
  max-height: 420px;
  min-height: 80px;
  background: var(--bg-card);
}

/* Search highlight mark */
mark.prev-hl {
  background: #fde68a;
  color: #92400e;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Postman-style request / response blocks ── */
.api-pm-block { margin-bottom: 14px; }
.api-pm-section-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding-top: 2px;
}
.api-pm-block-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.api-pm-url-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-hover);
  border-radius: var(--r-sm);
  word-break: break-all;
}
.api-pm-method {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 1px;
  color: #fff;
}
.api-pm-method[data-method="GET"]    { background: #10b981; }
.api-pm-method[data-method="POST"]   { background: #f59e0b; }
.api-pm-method[data-method="PUT"]    { background: #6366f1; }
.api-pm-method[data-method="PATCH"]  { background: #8b5cf6; }
.api-pm-method[data-method="DELETE"] { background: #ef4444; }
.api-pm-full-url { font-size: 11px; font-family: monospace; color: var(--text); line-height: 1.5; }

.api-pm-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-hover);
  border-radius: var(--r-sm);
}
.api-pm-status {
  font-size: 12px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 3px;
  border: 1px solid currentColor;
}
.api-pm-size-time { font-size: 11px; color: var(--text-muted); }

/* Key-value header table */
.api-pm-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.api-pm-tbl tr { border-bottom: 1px solid var(--border); }
.api-pm-tbl tr:last-child { border-bottom: none; }
.api-pm-key {
  width: 38%;
  padding: 4px 8px 4px 0;
  color: var(--text-muted);
  font-weight: 600;
  vertical-align: top;
  word-break: break-all;
  font-family: monospace;
  font-size: 10.5px;
}
.api-pm-val {
  padding: 4px 0;
  color: var(--text);
  word-break: break-all;
  font-family: monospace;
  font-size: 10.5px;
}

/* Body block */
.api-pm-mime {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}
.api-pm-body {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 10.5px;
  font-family: 'Fira Mono', 'Consolas', monospace;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 340px;
  overflow-y: auto;
}
.api-pm-empty { font-size: 11px; color: var(--text-muted); font-style: italic; }

/* Issue tags in cells — solid filled chips */
.api-issue-tag {
  display: inline-block;
  font-size: 8.5px;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: .02em;
}
.api-issue-error { background: #ef4444; color: #fff; }
.api-issue-warn  { background: #f59e0b; color: #fff; }
.api-issue-info  { background: #6366f1; color: #fff; }

/* Row hover */
.api-dive-row:hover td { background: var(--bg-hover); }

/* ── Sidebar overlay + panel ── */
.api-sidebar { pointer-events: none; }
.api-sidebar.open { pointer-events: auto; }

.api-sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 900;
  opacity: 0;
  transition: opacity .25s;
}
.api-sidebar.open .api-sidebar-overlay { opacity: 1; }

.api-sidebar-panel {
  position: fixed;
  top: 0; right: 0;
  width: 580px; max-width: 95vw;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
  z-index: 901;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.api-sidebar.open .api-sidebar-panel { transform: translateX(0); }

/* Panel header */
.api-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-card);
}
.api-sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.api-sidebar-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.api-sidebar-close:hover { background: var(--bg-hover); color: var(--text); }

/* Sticky header inside sidebar */
.api-sidebar-sticky-header {
  padding: 14px 16px 0;
  background: var(--bg-card);
  flex-shrink: 0;
}

/* Scrollable body */
.api-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}

/* Meta row */
.api-sb-meta { margin-bottom: 12px; }
.api-sb-domain { display: block; font-size: 10px; color: var(--text-muted); margin-bottom: 2px; }
.api-sb-url { display: block; font-size: 11.5px; font-weight: 600; word-break: break-all; color: var(--text); }

/* KPI strip */
.api-sb-kpis {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.api-sb-kpi {
  background: var(--bg-hover);
  border-radius: var(--r-md);
  padding: 8px;
  text-align: center;
}
.api-sb-kpi-val { font-size: 14px; font-weight: 800; color: var(--text); }
.api-sb-kpi-lbl { font-size: 9.5px; color: var(--text-muted); margin-top: 2px; }

/* Section title */
.api-sb-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin: 14px 0 8px;
}

/* Timeline phases */
.api-sb-timeline { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.api-phase-row { display: flex; align-items: center; gap: 8px; }
.api-phase-lbl { width: 72px; font-size: 10.5px; color: var(--text-muted); flex-shrink: 0; }
.api-phase-bar-wrap { flex: 1; height: 8px; background: var(--bg-hover); border-radius: 4px; overflow: hidden; }
.api-phase-bar { height: 100%; border-radius: 4px; transition: width .4s; }
.api-phase-val { width: 54px; text-align: right; font-size: 10.5px; font-weight: 600; flex-shrink: 0; }

/* What's happening paragraphs */
.api-sb-analysis { margin-bottom: 4px; }
.api-sb-para {
  font-size: 12px;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 8px;
  padding: 10px 12px;
  background: #ffffff;
  border-radius: var(--r-sm);
  border: 1px solid #e2e8f0;
}
.api-sb-para code { background: #e0e7ff; color: #4338ca; padding: 1px 4px; border-radius: 3px; font-size: 11px; }
.api-sb-para em { color: var(--warning); font-style: normal; font-weight: 600; }

/* Issues list */
.api-sb-issues { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.api-sb-issue {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 12px; border-radius: var(--r-sm);
  font-size: 11.5px;
  border: 1px solid transparent;
}
.api-sb-issue.api-issue-error { background: #fff8f8; border-color: #fecaca; }
.api-sb-issue.api-issue-warn  { background: #fffef5; border-color: #fde68a; }
.api-sb-issue.api-issue-info  { background: #f9f8ff; border-color: #ddd6fe; }
.api-sb-issue-badge {
  font-size: 9px; font-weight: 800; white-space: nowrap;
  padding: 2px 7px; border-radius: 3px; flex-shrink: 0;
}
.api-issue-error .api-sb-issue-badge { background: #ef4444; color: #fff; }
.api-issue-warn  .api-sb-issue-badge { background: #f59e0b; color: #fff; }
.api-issue-info  .api-sb-issue-badge { background: #6366f1; color: #fff; }
.api-sb-issue-tip { color: var(--text); line-height: 1.55; font-size: 11.5px; }

/* All-OK */
.api-sb-ok { font-size: 12.5px; color: var(--success); font-weight: 600; padding: 8px 0; }

/* Fix items */
.api-sb-fixes { display: flex; flex-direction: column; gap: 8px; }
.api-sb-fix {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-card);
}
.api-sb-fix-title { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.api-sb-fix-body { font-size: 11.5px; color: var(--text-muted); line-height: 1.6; }
.api-sb-fix-body strong { color: var(--text); font-weight: 700; }
.api-sb-fix-body code { background: #e0e7ff; color: #4338ca; padding: 1px 4px; border-radius: 3px; font-size: 10.5px; font-family: monospace; }
.api-sb-fix-body { font-size: 11.5px; color: var(--text-muted); line-height: 1.6; }

/* ── Hint badge — "click any row" affordance ── */
.api-row-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-lt);
  border: 1px solid rgba(99,102,241,.2);
  padding: 3px 9px 3px 7px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Bullet list styles in API Deep-Dive sidebar */
.api-sb-bullet-list {
  margin: 0;
  padding-left: 18px;
  list-style-type: disc;
}
.api-sb-bullet-list li {
  margin-bottom: 6px;
  line-height: 1.6;
}
.api-sb-bullet-list li:last-child {
  margin-bottom: 0;
}

/* ── Global Search ── */
#globalSearchInput:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px var(--primary-lt) !important;
}
.search-result-item {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover {
  background: var(--bg-hover);
}
.search-match-text {
  font-size: 11px;
  color: var(--text);
  background: var(--bg);
  padding: 6px;
  border-radius: 4px;
  border: 1px dashed var(--border);
  word-break: break-all;
  max-height: 80px;
  overflow: hidden;
  position: relative;
}
.search-match-highlight {
  background: #fef08a;
  color: #854d0e;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 2px;
}

