.review-module {
  min-width: 0;
  font-size: 14px;
}

.review-module[hidden] {
  display: none;
}

.review-page-header,
.review-section-head,
.review-result-header,
.review-result-title-row,
.review-finding-head,
.review-cross-check > div,
.review-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-page-header {
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.review-page-header h3 {
  margin: 0;
  color: #123f68;
  font-size: 24px;
}

.review-page-header p {
  max-width: 820px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.review-prototype-badge,
.review-mode-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 3px;
  background: #e8f3fb;
  color: #0067b8;
  font-size: 12px;
  font-weight: 800;
}

.review-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
  margin-top: 14px;
}

.review-setup-disclosure {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.review-setup-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 9px 14px;
  cursor: pointer;
  list-style: none;
}

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

.review-setup-summary::after {
  content: "›";
  flex: 0 0 auto;
  color: #0f6cbd;
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 160ms ease;
}

.review-setup-disclosure[open] > .review-setup-summary::after {
  transform: rotate(90deg);
}

.review-setup-summary strong,
.review-setup-summary span {
  display: block;
}

.review-setup-summary strong {
  color: #12344d;
  font-size: 16px;
}

.review-setup-summary span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.review-setup-disclosure > .review-workspace {
  margin-top: 0;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.review-input-title {
  margin: 0;
  color: #12344d;
  font-size: 17px;
}

.review-input-section,
.review-template-section {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.review-section-head h4,
.review-template-section h4,
.review-result-header h4 {
  margin: 0;
  color: #12344d;
  font-size: 17px;
}

.review-section-head p,
.review-template-section > p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.review-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.review-form-grid label {
  min-width: 0;
  margin: 0;
}

.review-form-grid label > span,
.review-focus-fieldset legend {
  display: block;
  margin-bottom: 5px;
  color: #31506d;
  font-size: 12px;
  font-weight: 800;
}

.review-form-grid input,
.review-form-grid select,
.review-form-grid textarea {
  width: 100%;
  min-height: 42px;
  margin: 0;
  font-size: 14px;
}

.review-notes-field {
  grid-column: 1 / -1;
}

.review-notes-field textarea {
  resize: vertical;
}

.review-focus-fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
}

.review-focus-fieldset legend {
  float: left;
  margin: 3px 8px 0 0;
}

.review-focus-fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
}

.review-focus-fieldset input {
  width: auto;
  margin: 0;
}

.review-drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 150px;
  margin-top: 14px;
  padding: 16px;
  border: 2px dashed #9bb4c9;
  border-radius: 6px;
  background: #f7fafc;
  text-align: center;
  cursor: pointer;
}

.review-drop-zone.is-dragging,
.review-drop-zone:focus-visible {
  border-color: #0f6cbd;
  background: #e8f3fb;
  outline: 0;
}

.review-drop-zone strong {
  color: #123f68;
  font-size: 16px;
}

.review-drop-zone > span {
  max-width: 720px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.review-drop-zone .btn {
  min-height: 38px;
  margin-top: 10px;
}

.review-file-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.review-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #c8d6e3;
  border-radius: 5px;
  background: #ffffff;
}

.review-file-item > div {
  min-width: 0;
}

.review-file-item strong,
.review-file-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-file-item strong {
  color: #12344d;
  font-size: 13px;
}

.review-file-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.review-file-item button {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #a4262c;
  cursor: pointer;
  font-size: 20px;
}

.review-privacy-note,
.review-boundary-note,
.review-disclaimer {
  margin-top: 10px;
  padding: 9px 11px;
  border-left: 3px solid #647f97;
  background: #f3f6f9;
  color: #40576a;
  font-size: 12px;
  line-height: 1.5;
}

.review-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.review-actions .btn {
  min-height: 40px;
}

.review-status {
  min-height: 20px;
  margin-top: 7px;
  color: #31506d;
  font-size: 12px;
}

.review-status.is-error {
  color: #a4262c;
}

.review-template-list {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

.review-template-list li + li {
  margin-top: 7px;
}

.review-boundary-note {
  border-left-color: #ca8a04;
  background: #fff9e8;
  color: #66510b;
}

.review-result {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 2px solid #8ba7bf;
}

.review-result[hidden] {
  display: none;
}

.review-result-header {
  align-items: flex-start;
}

.review-result-title-row {
  justify-content: flex-start;
}

.review-result-header p {
  max-width: 980px;
  margin: 5px 0 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.review-mode-badge.is-ai {
  background: #dff6dd;
  color: #0b6a0b;
}

.review-mode-badge.is-local {
  background: #fff4ce;
  color: #6b4f00;
}

.review-mode-badge.is-sample {
  background: #e8f3fb;
  color: #0067b8;
}

.review-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid #c8d6e3;
  border-radius: 5px;
  background: #f7fafc;
}

.review-summary-grid > div {
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid #d8e1ea;
}

.review-summary-grid > div:last-child {
  border-right: 0;
}

.review-summary-grid span,
.review-summary-grid strong {
  display: block;
}

.review-summary-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.review-summary-grid strong {
  margin-top: 3px;
  color: #12344d;
  font-size: 17px;
}

.review-summary-grid .is-high_risk,
.review-summary-grid .is-critical {
  color: #a4262c;
}

.review-result-section {
  margin-top: 15px;
}

.review-result-section h5 {
  margin: 0 0 8px;
  color: #12344d;
  font-size: 15px;
}

.review-section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.review-section-title-row h5 {
  margin: 0;
}

.review-section-title-row > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.review-key-facts-section {
  padding: 12px;
  border: 1px solid #b9cfe0;
  border-radius: 6px;
  background: #f4f9fd;
}

.review-key-facts {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.review-key-fact {
  grid-column: span 2;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #c8d6e3;
  border-left: 4px solid #0f6cbd;
  border-radius: 5px;
  background: #ffffff;
}

.review-key-fact > span,
.review-key-fact > strong,
.review-key-fact > small {
  display: block;
}

.review-key-fact > span {
  color: #40576a;
  font-size: 11px;
  font-weight: 800;
}

.review-key-fact > strong {
  margin-top: 5px;
  color: #12344d;
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.review-key-fact > small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.review-key-fact.is-missing,
.review-key-fact.is-unverified {
  border-left-color: #ca8a04;
  background: #fffaf0;
}

.review-key-fact.is-inconsistent {
  border-color: #e2a6aa;
  border-left-color: #a4262c;
  background: #fff3f4;
}

.review-key-fact.is-inconsistent > strong,
.review-key-fact.is-missing > strong {
  color: #a4262c;
}

.review-findings-summary {
  padding: 3px 7px;
  border-radius: 3px;
  background: #fde7e9;
  color: #a4262c !important;
}

.review-findings {
  display: grid;
  gap: 8px;
}

.review-finding {
  padding: 10px 12px;
  border: 1px solid #c8d6e3;
  border-left: 4px solid #647f97;
  border-radius: 5px;
  background: #ffffff;
}

.review-finding.is-critical {
  border-left-color: #a4262c;
  background: #fff6f7;
}

.review-finding.is-high {
  border-left-color: #d83b01;
  background: #fff8f3;
}

.review-finding.is-medium {
  border-left-color: #ca8a04;
  background: #fffaf0;
}

.review-finding.is-low {
  border-left-color: #0f6cbd;
}

.review-finding-head {
  justify-content: flex-start;
}

.review-finding-severity {
  padding: 2px 6px;
  border-radius: 3px;
  background: #e9eff5;
  color: #40576a;
  font-size: 11px;
  font-weight: 800;
}

.review-finding-number {
  color: #647f97;
  font-size: 12px;
  font-weight: 900;
}

.review-finding.is-critical .review-finding-severity,
.review-finding.is-high .review-finding-severity {
  background: #a4262c;
  color: #ffffff;
}

.review-finding.is-critical .review-finding-head strong,
.review-finding.is-high .review-finding-head strong {
  color: #8b1f26;
  font-size: 15px;
}

.review-finding-head strong {
  color: #12344d;
  font-size: 14px;
}

.review-finding-head small {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}

.review-finding-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1.2fr;
  gap: 12px;
  margin-top: 8px;
}

.review-finding-grid b {
  color: #31506d;
  font-size: 11px;
}

.review-finding-grid p {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.review-finding-grid small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.review-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #c8d6e3;
  border-radius: 5px;
}

.review-data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.review-data-table th,
.review-data-table td {
  padding: 8px 9px;
  border-right: 1px solid #d8e1ea;
  border-bottom: 1px solid #d8e1ea;
  font-size: 12px;
  text-align: left;
  vertical-align: top;
}

.review-data-table th {
  background: #dcebf7;
  color: #12344d;
}

.review-data-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.review-data-table tr.is-missing td,
.review-data-table tr.is-inconsistent td {
  background: #fff3f4;
}

.review-data-table tr.is-missing td:first-child,
.review-data-table tr.is-inconsistent td:first-child {
  color: #a4262c;
  font-weight: 800;
}

.review-data-status,
.review-cross-check span {
  display: inline-block;
  padding: 2px 5px;
  border-radius: 3px;
  background: #e9eff5;
  color: #40576a;
  font-size: 10px;
  font-weight: 800;
}

.review-data-status.is-present,
.review-cross-check.is-consistent span {
  background: #dff6dd;
  color: #0b6a0b;
}

.review-data-status.is-missing,
.review-data-status.is-inconsistent,
.review-cross-check.is-inconsistent span,
.review-cross-check.is-missing span {
  background: #fde7e9;
  color: #a4262c;
}

.review-cross-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.review-cross-check {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #c8d6e3;
  border-radius: 5px;
  background: #ffffff;
}

.review-cross-check strong {
  color: #12344d;
  font-size: 13px;
}

.review-cross-check p,
.review-cross-check small {
  display: block;
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.review-cross-check small {
  color: var(--muted);
}

.review-result-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.review-result-columns ol {
  margin: 0;
  padding-left: 22px;
  font-size: 13px;
  line-height: 1.5;
}

.review-result-columns li + li {
  margin-top: 6px;
}

.review-result-columns li span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.review-limitations {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}

.review-limitations span {
  padding: 3px 6px;
  border-radius: 3px;
  background: #fff4ce;
  color: #6b4f00;
  font-size: 11px;
}

.review-disclaimer {
  border-left-color: #ca8a04;
  background: #fff9e8;
  color: #66510b;
}

.review-empty {
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

body.dark .review-input-section,
body.dark .review-template-section,
body.dark .review-file-item,
body.dark .review-finding,
body.dark .review-cross-check {
  border-color: var(--line);
  background: var(--panel-soft);
}

body.dark .review-setup-disclosure,
body.dark .review-key-fact {
  border-color: var(--line);
  background: var(--panel-soft);
}

body.dark .review-setup-summary strong,
body.dark .review-input-title,
body.dark .review-key-fact > strong {
  color: #8ecbfa;
}

body.dark .review-page-header h3,
body.dark .review-section-head h4,
body.dark .review-template-section h4,
body.dark .review-result-header h4,
body.dark .review-result-section h5,
body.dark .review-summary-grid strong,
body.dark .review-finding-head strong,
body.dark .review-cross-check strong,
body.dark .review-file-item strong {
  color: #8ecbfa;
}

body.dark .review-drop-zone,
body.dark .review-summary-grid,
body.dark .review-privacy-note {
  border-color: var(--line);
  background: #132433;
}

body.dark .review-data-table th {
  background: #23425b;
  color: var(--text);
}

body.dark .review-data-table th,
body.dark .review-data-table td,
body.dark .review-summary-grid > div {
  border-color: var(--line);
}

@media (max-width: 1100px) {
  .review-workspace {
    grid-template-columns: 1fr;
  }

  .review-template-section {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 8px 18px;
  }

  .review-template-section > p,
  .review-template-section .review-boundary-note {
    grid-column: 1 / -1;
  }

  .review-template-list {
    margin-top: 0;
  }

  .review-finding-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .review-page-header,
  .review-result-header,
  .review-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .review-prototype-badge {
    align-self: flex-start;
  }

  .review-form-grid,
  .review-file-list,
  .review-summary-grid,
  .review-cross-checks,
  .review-result-columns,
  .review-template-section,
  .review-key-facts {
    grid-template-columns: 1fr;
  }

  .review-key-fact {
    grid-column: auto;
  }

  .review-setup-summary {
    align-items: flex-start;
  }

  .review-focus-fieldset {
    align-items: flex-start;
    flex-direction: column;
  }

  .review-focus-fieldset legend {
    float: none;
  }

  .review-actions .btn,
  .review-result-header .btn {
    width: 100%;
  }

  .review-summary-grid > div {
    border-right: 0;
    border-bottom: 1px solid #d8e1ea;
  }

  .review-summary-grid > div:last-child {
    border-bottom: 0;
  }

  .review-finding-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .review-finding-head small {
    width: 100%;
    margin-left: 0;
  }
}
