:root {
  --bp-dark: #0F2D24;
  --bp-dark-2: #163b2e;
  --bp-green: #2E7D4F;
  --bp-green-hover: #276A43;
  --bp-amber: #FFC107;
  --bp-page: #f7f8f7;
  --bp-surface: #ffffff;
  --bp-border: #e2e6e3;
  --bp-text: #14231d;
  --bp-text-muted: #62716b;
  --bp-text-faint: #94a29c;

  /* dataviz reference palette - status */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;

  /* dataviz reference palette - categorical slots 1-4 (light) */
  --cat-1: #2a78d6;
  --cat-2: #eb6834;
  --cat-3: #1baf7a;
  --cat-4: #eda100;

  --sequential-100: #cde2fb;
  --sequential-200: #9ec5f4;
  --sequential-300: #5598e7;
  --sequential-400: #2a78d6;
  --sequential-500: #184f95;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bp-page);
  color: var(--bp-text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; }

/* ============ Shell: sidebar + main ============ */

.bp-shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.bp-sidebar {
  background: var(--bp-dark);
  color: rgba(245,245,245,0.9);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.bp-sidebar-logo {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  padding: 8px 10px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bp-sidebar-logo-mark {
  width: 10px; height: 10px; border-radius: 3px; background: var(--bp-amber);
  flex-shrink: 0;
}

.bp-sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.bp-sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: rgba(245,245,245,0.75);
  text-decoration: none; font-weight: 500; font-size: 13.5px;
}
.bp-sidebar-link:hover { background: rgba(245,245,245,0.06); color: #fff; }
.bp-sidebar-link.bp-active { background: rgba(255,193,7,0.14); color: #fff; }
.bp-sidebar-icon { width: 16px; text-align: center; opacity: 0.9; }

.bp-sidebar-footer { border-top: 1px solid rgba(245,245,245,0.1); padding-top: 12px; margin-top: 12px; }
.bp-sidebar-footer form { margin: 0; }
.bp-sidebar-footer button {
  width: 100%; background: none; border: 1px solid rgba(245,245,245,0.2);
  color: rgba(245,245,245,0.8); padding: 8px 12px; border-radius: 8px; cursor: pointer;
  font-size: 13px; text-align: left;
}
.bp-sidebar-footer button:hover { background: rgba(245,245,245,0.06); }

.bp-main { padding: 28px 36px 60px; min-width: 0; }
.bp-page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.bp-page-header h1 { margin: 0; font-size: 22px; }

/* ============ Login ============ */

.bp-login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bp-dark); }
.bp-login-box {
  width: 320px; text-align: center; background: var(--bp-surface); padding: 32px 28px;
  border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.bp-login-box h1 { font-size: 17px; margin: 0 0 20px; }
.bp-login-box form { display: flex; flex-direction: column; gap: 10px; }
.bp-login-box input {
  padding: 10px 12px; border: 1px solid var(--bp-border); border-radius: 8px; font-size: 14px;
}
.bp-error { color: var(--status-critical); font-size: 13px; margin: 0 0 12px; }
.bp-flash {
  background: rgba(46,125,79,0.1); color: var(--bp-green); padding: 10px 14px;
  border-radius: 8px; margin-bottom: 16px; font-weight: 500; font-size: 13px;
}

/* ============ Buttons ============ */

.bp-btn, .bp-btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; border-radius: 8px; padding: 10px 18px; border: none;
  cursor: pointer; text-decoration: none; font-size: 13.5px;
}
.bp-btn { background: var(--bp-green); color: #fff; }
.bp-btn:hover { background: var(--bp-green-hover); }
.bp-btn-secondary { background: var(--bp-surface); color: var(--bp-text); border: 1px solid var(--bp-border); }
.bp-btn-secondary:hover { border-color: var(--bp-green); }

/* ============ Queue ============ */

.bp-queue-counts { display: flex; gap: 10px; margin-bottom: 22px; }
.bp-count-chip {
  background: var(--bp-surface); border: 1px solid var(--bp-border); border-radius: 999px;
  padding: 6px 14px; font-size: 12.5px; font-weight: 600; color: var(--bp-text-muted);
}
.bp-count-chip strong { color: var(--bp-text); }

.bp-section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--bp-text-muted); margin: 24px 0 10px; }

.bp-queue-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.bp-queue-item {
  border: 1px solid var(--bp-border); border-radius: 10px; padding: 16px 18px; background: var(--bp-surface);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  box-shadow: 0 1px 2px rgba(15,45,36,0.04);
}
.bp-queue-item-main { min-width: 0; flex: 1; }
.bp-queue-url {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%; font-weight: 600; font-size: 14px;
}
.bp-queue-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.bp-tag {
  display: inline-block; background: rgba(15,45,36,0.06); border-radius: 4px;
  padding: 2px 8px; font-size: 11.5px; font-weight: 600; color: var(--bp-text-muted); white-space: nowrap;
}
.bp-status-chip { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.bp-status-pending { background: rgba(250,178,25,0.16); color: #9a6300; }
.bp-status-in_review { background: rgba(42,120,214,0.14); color: #1c5cab; }
.bp-concern {
  color: var(--bp-text-muted); font-size: 12.5px; margin: 8px 0 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.bp-timestamp { color: var(--bp-text-faint); font-size: 11.5px; margin: 4px 0 0; }
.bp-queue-item-action { flex-shrink: 0; }
.bp-empty { color: var(--bp-text-faint); font-style: italic; font-size: 13px; }

/* ============ Analytics ============ */

.bp-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.bp-stat-card {
  border: 1px solid var(--bp-border); border-radius: 12px; padding: 18px; background: var(--bp-surface);
  box-shadow: 0 1px 2px rgba(15,45,36,0.04);
}
.bp-stat-number { font-size: 26px; font-weight: 700; }
.bp-stat-label { color: var(--bp-text-muted); font-size: 12px; margin-top: 4px; }

.bp-chart-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 28px; align-items: stretch; }
.bp-chart-card {
  border: 1px solid var(--bp-border); border-radius: 12px; padding: 20px; background: var(--bp-surface);
  box-shadow: 0 1px 2px rgba(15,45,36,0.04);
}
.bp-chart-card h3 { margin: 0 0 4px; font-size: 14px; }
.bp-chart-subtitle { color: var(--bp-text-muted); font-size: 12px; margin: 0 0 14px; }

.bp-line-svg { width: 100%; height: auto; overflow: visible; }
.bp-line-area { fill: url(#bp-line-gradient); }
.bp-line-stroke { fill: none; stroke: var(--sequential-400); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bp-line-tick { font-size: 10px; fill: var(--bp-text-faint); }
.bp-line-baseline { stroke: var(--bp-border); stroke-width: 1; }

.bp-donut-wrap { display: flex; align-items: center; gap: 20px; }
.bp-donut-svg circle { transition: none; }
.bp-donut-center-value { font-size: 18px; font-weight: 700; }
.bp-donut-center-label { font-size: 10px; fill: var(--bp-text-faint); }
.bp-donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.bp-legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 8px; }
.bp-legend-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bp-legend-count { color: var(--bp-text-muted); font-variant-numeric: tabular-nums; }

.bp-heatmap-card { margin-bottom: 28px; }
.bp-heatmap-wrap { display: flex; gap: 12px; align-items: flex-start; }
.bp-heatmap-daylabels { display: grid; grid-template-rows: repeat(7, 13px); gap: 3px; font-size: 9.5px; color: var(--bp-text-faint); padding-top: 2px; }
.bp-heatmap-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); gap: 3px; }
.bp-heatmap-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--bp-border); }
.bp-heatmap-cell[data-level="0"] { background: #edf1ee; }
.bp-heatmap-cell[data-level="1"] { background: var(--sequential-100); }
.bp-heatmap-cell[data-level="2"] { background: var(--sequential-200); }
.bp-heatmap-cell[data-level="3"] { background: var(--sequential-300); }
.bp-heatmap-cell[data-level="4"] { background: var(--sequential-400); }
.bp-heatmap-cell[data-future="true"] { background: transparent; }
.bp-heatmap-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 11px; color: var(--bp-text-faint); }

.bp-data-table { width: 100%; border-collapse: collapse; margin-bottom: 28px; font-size: 12.5px; background: var(--bp-surface); border: 1px solid var(--bp-border); border-radius: 10px; overflow: hidden; }
.bp-data-table th { text-align: left; padding: 10px 14px; background: rgba(15,45,36,0.03); color: var(--bp-text-muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; }
.bp-data-table td { text-align: left; padding: 9px 14px; border-top: 1px solid var(--bp-border); }
.bp-hint { color: var(--bp-text-muted); font-size: 12.5px; margin: -6px 0 12px; }

/* ============ Review ============ */

.bp-back-link { color: var(--bp-text-muted); text-decoration: none; display: inline-block; margin-bottom: 14px; font-size: 13px; }

.bp-review-header {
  position: sticky; top: 0; z-index: 5; background: var(--bp-page);
  padding: 14px 0 16px; margin-bottom: 8px; border-bottom: 1px solid var(--bp-border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
}
.bp-review-header h1 { margin: 0 0 4px; font-size: 19px; word-break: break-word; }
.bp-review-actions { display: flex; gap: 10px; flex-shrink: 0; }

.bp-review-layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; margin-top: 20px; }

.bp-thumb-rail { position: sticky; top: 110px; height: fit-content; display: flex; flex-direction: column; gap: 8px; }
.bp-thumb-link {
  display: block; border: 2px solid transparent; border-radius: 8px; overflow: hidden;
  text-decoration: none; background: var(--bp-surface);
}
.bp-thumb-link img { width: 100%; display: block; aspect-ratio: 4/3; object-fit: cover; }
.bp-thumb-link:hover { border-color: var(--bp-border); }
.bp-thumb-caption { font-size: 10.5px; padding: 4px 6px; color: var(--bp-text-muted); }

.bp-summary-card {
  background: var(--bp-surface); border: 1px solid var(--bp-border); border-radius: 12px;
  padding: 20px; display: flex; gap: 24px; margin-bottom: 20px; align-items: center;
}
.bp-score-ring-label { font-size: 11px; color: var(--bp-text-muted); text-align: center; margin-top: 4px; }
.bp-subscore-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 20px; flex: 1; }
.bp-subscore-row { display: flex; justify-content: space-between; font-size: 12.5px; }
.bp-subscore-row span:first-child { color: var(--bp-text-muted); }

.bp-review-field { margin-bottom: 20px; }
.bp-review-field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.bp-review-field textarea, .bp-review-field input {
  width: 100%; padding: 10px; border: 1px solid var(--bp-border); border-radius: 8px; font-family: inherit; font-size: 13.5px;
}

.bp-fixes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.bp-fix-edit { border: 1px solid var(--bp-border); border-radius: 10px; padding: 14px; background: var(--bp-surface); }
.bp-fix-edit legend { font-weight: 700; font-size: 12.5px; padding: 0 4px; color: var(--bp-green); }
.bp-fix-edit label { display: block; font-size: 11px; font-weight: 600; margin-top: 8px; color: var(--bp-text-muted); text-transform: uppercase; letter-spacing: 0.02em; }
.bp-fix-edit input, .bp-fix-edit textarea, .bp-fix-edit select {
  width: 100%; padding: 7px 8px; border: 1px solid var(--bp-border); border-radius: 6px; font-family: inherit; font-size: 13px; margin-top: 3px;
}
.bp-fix-order-row { display: flex; gap: 8px; }
.bp-fix-order-row input { width: 60px; }

.bp-screen-section { border-top: 1px solid var(--bp-border); padding: 24px 0; scroll-margin-top: 110px; }
.bp-screen-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.bp-screen-heading h2 { margin: 0; font-size: 15px; }
.bp-screen-score-pill { padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.bp-tone-good { background: rgba(12,163,12,0.12); color: #0a7a0a; }
.bp-tone-warning { background: rgba(250,178,25,0.16); color: #9a6300; }
.bp-tone-critical { background: rgba(208,59,59,0.12); color: var(--status-critical); }

.bp-screen-row { display: grid; grid-template-columns: 320px 1fr; gap: 20px; }
.bp-screen-image img { width: 100%; border-radius: 10px; border: 1px solid var(--bp-border); display: block; }
.bp-screen-image { position: sticky; top: 150px; height: fit-content; }
.bp-screen-caption { font-size: 11.5px; color: var(--bp-text-muted); margin-top: 6px; }

.bp-finding-edit {
  border: 1px solid var(--bp-border); border-left: 4px solid var(--status-warning);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; background: var(--bp-surface);
}
.bp-finding-edit.bp-severity-critical { border-left-color: var(--status-critical); }
.bp-finding-edit.bp-severity-major { border-left-color: var(--status-serious); }
.bp-finding-edit.bp-severity-minor { border-left-color: var(--status-warning); }
.bp-finding-edit legend { font-weight: 600; display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 0; }
.bp-keep-toggle { font-weight: 500; display: flex; align-items: center; gap: 5px; color: var(--bp-text-muted); font-size: 12px; }
.bp-finding-edit label { display: block; font-size: 10.5px; font-weight: 700; margin-top: 8px; color: var(--bp-text-muted); text-transform: uppercase; letter-spacing: 0.02em; }
.bp-finding-edit textarea, .bp-finding-edit select {
  width: 100%; padding: 7px 8px; border: 1px solid var(--bp-border); border-radius: 6px; font-family: inherit; font-size: 13px; margin-top: 3px;
}

.bp-review-submit-bar { display: flex; gap: 12px; margin-top: 24px; padding: 20px 0 40px; border-top: 1px solid var(--bp-border); }

@media (max-width: 900px) {
  .bp-shell { grid-template-columns: 1fr; }
  .bp-sidebar { position: static; height: auto; flex-direction: row; align-items: center; }
  .bp-sidebar-nav { flex-direction: row; }
  .bp-review-layout, .bp-screen-row { grid-template-columns: 1fr; }
  .bp-chart-grid { grid-template-columns: 1fr; }
  .bp-stat-grid { grid-template-columns: repeat(2, 1fr); }
}
