:root {
  --review-bg-deep: #050b13;
  --review-bg: #08111f;
  --review-panel: #0d1827;
  --review-panel-alt: #121f30;
  --review-panel-soft: #172638;
  --review-border: #22364d;
  --review-border-bright: #315474;
  --review-text: #f4f8fc;
  --review-muted: #91a5ba;
  --review-blue: #4b9cff;
  --review-cyan: #43d5ef;
  --review-purple: #aa7cff;
  --review-green: #3fd18a;
  --review-orange: #f4a74e;
  --review-yellow: #e5c65c;
  --review-red: #ef6a78;
}

.review-dashboard-header {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(420px, .8fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 26px;
  padding: 28px;
  border: 1px solid var(--review-border);
  border-radius: 16px;
  background:
    radial-gradient(
      circle at 12% 0%,
      rgba(75, 156, 255, .18),
      transparent 32%
    ),
    linear-gradient(
      145deg,
      #0b1726,
      #07101c
    );
  box-shadow:
    0 18px 42px rgba(0, 0, 0, .30);
}

.review-dashboard-header h2 {
  margin: 5px 0 9px;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -.03em;
}

.review-dashboard-header p {
  max-width: 700px;
  margin: 0;
  color: #a9bbcd;
  line-height: 1.6;
}

.review-dashboard-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.review-dashboard-stats > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 92px;
  padding: 15px;
  border: 1px solid rgba(75, 156, 255, .20);
  border-radius: 10px;
  background: rgba(4, 12, 22, .56);
}

.review-dashboard-stats span {
  color: var(--review-muted);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.review-dashboard-stats strong {
  margin-top: 6px;
  color: white;
  font-size: 28px;
}

.review-section {
  margin-top: 28px;
}

.review-section-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 14px;
}

.section-number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(67, 213, 239, .30);
  border-radius: 10px;
  color: var(--review-cyan);
  background: rgba(67, 213, 239, .07);
  font-weight: 800;
}

.review-section-heading h2,
.sources-panel-heading h4,
.reasoning-panel-header h4,
.decision-panel-heading h4 {
  margin: 2px 0 0;
}

.section-kicker {
  display: block;
  color: var(--review-cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .10em;
  text-transform: uppercase;
}

.candidate-list {
  display: grid;
  gap: 22px;
}

.candidate-card {
  overflow: hidden;
  border: 1px solid var(--review-border);
  border-radius: 16px;
  background: var(--review-panel);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, .26);
}

.candidate-card:nth-child(even) {
  background: #0b1624;
}

.candidate-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 22px;
  border-bottom: 1px solid var(--review-border);
  background:
    linear-gradient(
      90deg,
      rgba(75, 156, 255, .10),
      transparent 52%
    ),
    #101d2d;
}

.candidate-header-main {
  min-width: 0;
}

.candidate-type {
  display: inline-block;
  margin-bottom: 7px;
  padding: 5px 8px;
  border: 1px solid rgba(170, 124, 255, .24);
  border-radius: 999px;
  color: #d8c2ff;
  background: rgba(170, 124, 255, .09);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.candidate-header h3 {
  margin: 0;
  color: white;
  font-size: 23px;
  overflow-wrap: anywhere;
}

.candidate-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.candidate-meta span {
  padding: 5px 8px;
  border: 1px solid var(--review-border);
  border-radius: 999px;
  color: #aebfd0;
  background: rgba(5, 13, 23, .42);
  font-size: 11px;
}

.candidate-header-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.review-status {
  padding: 6px 9px;
  border: 1px solid rgba(229, 198, 92, .28);
  border-radius: 999px;
  color: #f6df87;
  background: rgba(229, 198, 92, .10);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.confidence-high {
  color: #9ef0c1;
  border: 1px solid rgba(63, 209, 138, .28);
  background: rgba(63, 209, 138, .10);
}

.confidence-medium {
  color: #f4d877;
  border: 1px solid rgba(229, 198, 92, .28);
  background: rgba(229, 198, 92, .10);
}

.confidence-low {
  color: #ff9ba5;
  border: 1px solid rgba(239, 106, 120, .28);
  background: rgba(239, 106, 120, .10);
}

.candidate-card-body {
  padding: 20px;
  background: var(--review-bg);
}

.reasoning-panel {
  padding: 17px;
  border: 1px solid #24507a;
  border-radius: 12px;
  background:
    linear-gradient(
      145deg,
      rgba(16, 60, 100, .92),
      rgba(11, 38, 67, .92)
    );
}

.reasoning-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.reasoning-copy {
  margin: 12px 0 15px;
  color: #d8e8f6;
  line-height: 1.6;
}

.reasoning-grid,
.pattern-grid,
.source-technical-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.reasoning-grid > div,
.pattern-grid > div,
.source-technical-grid > div {
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 8px;
  background: rgba(4, 15, 27, .34);
}

.reasoning-grid span,
.reasoning-grid strong,
.pattern-grid span,
.pattern-grid strong,
.source-technical-grid span,
.source-technical-grid strong {
  display: block;
}

.reasoning-grid span,
.pattern-grid span,
.source-technical-grid span {
  margin-bottom: 4px;
  color: #9bb4ca;
  font-size: 10px;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.pattern-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(170, 124, 255, .25);
  border-radius: 10px;
  background: rgba(57, 38, 87, .34);
}

.pattern-panel-heading h5 {
  margin: 2px 0 10px;
}

.new-pattern-panel {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 13px;
  border: 1px solid rgba(170, 124, 255, .30);
  border-radius: 9px;
  background: rgba(170, 124, 255, .09);
}

.new-pattern-panel span {
  color: #c8badb;
}

.sources-panel {
  margin-top: 18px;
  padding: 17px;
  border: 1px solid var(--review-border);
  border-radius: 12px;
  background: #07101b;
}

.sources-panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 13px;
}

.source-count,
.count-pill {
  padding: 6px 9px;
  border: 1px solid rgba(67, 213, 239, .24);
  border-radius: 999px;
  color: #9ce9f5;
  background: rgba(67, 213, 239, .07);
  font-size: 11px;
  font-weight: 800;
}

.source-list {
  display: grid;
  gap: 11px;
}

.source-card {
  overflow: hidden;
  border: 1px solid #2a4058;
  border-radius: 11px;
  background: #111e2d;
}

.source-card:nth-child(even) {
  background: #172638;
}

.source-card[open] {
  border-color: #3b668e;
  box-shadow:
    0 8px 22px rgba(0, 0, 0, .20);
}

.source-summary {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 70px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.source-summary::-webkit-details-marker {
  display: none;
}

.source-index {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(75, 156, 255, .28);
  border-radius: 8px;
  color: #acd2ff;
  background: rgba(75, 156, 255, .09);
  font-weight: 800;
}

.source-summary-main {
  min-width: 0;
}

.source-title {
  display: block;
  overflow: hidden;
  color: white;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-domain {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: #8299af;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-summary-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.zone-pill {
  padding: 6px 8px;
  border: 1px solid rgba(75, 156, 255, .24);
  border-radius: 999px;
  color: #a8ceff;
  background: rgba(75, 156, 255, .08);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.source-card-body {
  padding: 15px;
  border-top: 1px solid #2a4058;
  background: #0a1421;
}

.source-context-card {
  padding: 14px;
  border: 1px solid rgba(67, 213, 239, .25);
  border-radius: 10px;
  background:
    linear-gradient(
      145deg,
      rgba(18, 50, 63, .88),
      rgba(10, 31, 43, .88)
    );
}

.source-context-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 11px;
}

.source-context-heading h5 {
  margin: 2px 0 0;
}

.source-context-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.context-field {
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: rgba(4, 15, 26, .45);
}

.context-field-wide {
  grid-column: 1 / -1;
}

.context-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  color: #91aabd;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.field-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 6px;
  color: white;
  background: rgba(255, 255, 255, .06);
  font-size: 10px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.data-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
}

.data-chip-manufacturer {
  color: #b8ddff;
  border: 1px solid rgba(75, 156, 255, .30);
  background: rgba(75, 156, 255, .12);
}

.data-chip-model {
  color: #dfccff;
  border: 1px solid rgba(170, 124, 255, .30);
  background: rgba(170, 124, 255, .12);
}

.data-chip-oem {
  color: #ffd49d;
  border: 1px solid rgba(244, 167, 78, .32);
  background: rgba(244, 167, 78, .12);
}

.data-chip-component {
  color: #9ff3c6;
  border: 1px solid rgba(63, 209, 138, .30);
  background: rgba(63, 209, 138, .11);
}

.data-chip-measurement {
  color: #fff0a9;
  border: 1px solid rgba(229, 198, 92, .30);
  background: rgba(229, 198, 92, .11);
}

.context-missing {
  color: #d7a963;
  font-style: italic;
}

.source-relationships {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.source-relationships summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  color: #dff7fb;
  font-weight: 800;
}

.relationship-list {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.relationship-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto minmax(110px, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 7px;
  background: rgba(4, 15, 26, .46);
}

.relationship-node {
  color: white;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.relationship-edge {
  color: var(--review-cyan);
  font-size: 11px;
}

.relationship-meta {
  color: #91a6ba;
  font-size: 10px;
}

.source-technical-grid {
  margin-top: 12px;
}

.source-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 11px;
}

.evidence-excerpt,
.source-reasoning {
  margin-top: 13px;
  padding: 13px;
  border-radius: 9px;
}

.evidence-excerpt {
  border: 1px solid rgba(67, 213, 239, .21);
  background: rgba(67, 213, 239, .05);
}

.evidence-excerpt blockquote {
  margin: 8px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--review-cyan);
  color: #d8e8f4;
  background: rgba(0, 0, 0, .15);
  line-height: 1.6;
}

.source-reasoning {
  border: 1px solid rgba(170, 124, 255, .20);
  background: rgba(170, 124, 255, .05);
}

.source-reasoning ul {
  margin: 8px 0 0;
  padding-left: 19px;
  color: #c4d1df;
}

.decision-panel {
  margin-top: 18px;
  padding: 17px;
  border: 1px solid #354c65;
  border-radius: 12px;
  background:
    linear-gradient(
      145deg,
      #151f2d,
      #0e1723
    );
}

.decision-form {
  display: grid;
  gap: 11px;
  margin-top: 13px;
}

.decision-form label {
  display: grid;
  gap: 6px;
  color: #a0b2c4;
  font-size: 11px;
  font-weight: 700;
}

.decision-form input,
.decision-form textarea {
  width: 100%;
  padding: 11px 12px;
  color: white;
  border: 1px solid #31465d;
  border-radius: 8px;
  background: #07101a;
  font: inherit;
}

.decision-input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.review-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.decision-button {
  display: grid;
  gap: 3px;
  min-height: 70px;
  padding: 12px;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
}

.decision-button span {
  font-size: 15px;
  font-weight: 900;
}

.decision-button small {
  opacity: .78;
}

.decision-accept {
  color: #dff8e9;
  border: 1px solid rgba(63, 209, 138, .34);
  background: rgba(63, 209, 138, .13);
}

.decision-reject {
  color: #ffe1e5;
  border: 1px solid rgba(239, 106, 120, .34);
  background: rgba(239, 106, 120, .13);
}

.decision-correct {
  color: #e2efff;
  border: 1px solid rgba(75, 156, 255, .34);
  background: rgba(75, 156, 255, .13);
}

.decision-merge {
  color: #ecddff;
  border: 1px solid rgba(170, 124, 255, .34);
  background: rgba(170, 124, 255, .13);
}

.empty-state {
  padding: 18px;
  color: #8ea1b5;
  text-align: center;
}

.empty-state.large {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px dashed #30445a;
  border-radius: 12px;
  background: #0b1521;
}

@media (max-width: 1150px) {
  .review-dashboard-header {
    grid-template-columns: 1fr;
  }

  .review-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reasoning-grid,
  .pattern-grid,
  .source-technical-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .candidate-header,
  .reasoning-panel-header,
  .source-context-heading,
  .sources-panel-heading {
    flex-direction: column;
  }

  .candidate-header-status {
    align-items: flex-start;
  }

  .source-summary {
    grid-template-columns: 34px 1fr;
  }

  .source-summary-meta {
    grid-column: 2;
    justify-content: flex-start;
  }

  .source-context-grid,
  .decision-input-grid {
    grid-template-columns: 1fr;
  }

  .context-field-wide {
    grid-column: auto;
  }

  .relationship-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .review-dashboard-stats,
  .review-actions,
  .reasoning-grid,
  .pattern-grid,
  .source-technical-grid {
    grid-template-columns: 1fr;
  }

  .candidate-card-body,
  .candidate-header,
  .review-dashboard-header {
    padding: 15px;
  }
}
