* {
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
  padding: 24px 16px;
  background: #f4f6f9;
  color: #1f2937;
  line-height: 1.5;
}

main {
  max-width: 820px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: 1.85rem;
  color: #111827;
}

.subtitle {
  margin: 0;
  color: #4b5563;
  font-size: 0.98rem;
}

.input-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.field-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.92rem;
  color: #374151;
}

select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  background: #ffffff;
  color: #111827;
}

select:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

button {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #1d4ed8;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary-btn {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.secondary-btn:hover:not(:disabled) {
  background: #e5e7eb;
}

.status-text {
  margin: 12px 0 0;
  font-size: 0.92rem;
  color: #4b5563;
}

.status-error {
  color: #b91c1c;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.results-container {
  margin-top: 24px;
}

.summary-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 22px;
}

.summary-box h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: #1e3a8a;
}

.summary-box ul {
  margin: 0;
  padding-left: 20px;
}

.summary-box li {
  margin-bottom: 6px;
  color: #1e40af;
}

.findings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.findings-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.meta-badge {
  background: #e5e7eb;
  color: #374151;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}

.findings-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.risk-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-left-width: 6px;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.risk-card.red {
  border-left-color: #dc2626;
}

.risk-card.yellow {
  border-left-color: #d97706;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 0;
}

.badge {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 6px;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.badge-yellow {
  background: #fef3c7;
  color: #92400e;
}

.badge-category {
  background: #f3f4f6;
  color: #374151;
  text-transform: capitalize;
  font-weight: 600;
}

.badge-unsure {
  background: #ede9fe;
  color: #5b21b6;
  font-weight: 600;
  text-transform: none;
}

.locate-btn {
  background: #f3f4f6;
  color: #1f2937;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.locate-btn:hover {
  background: #e5e7eb;
}

.sentence-quote {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0 0 12px;
  font-size: 0.93rem;
  color: #374151;
  font-style: italic;
}

.sentence-num {
  font-style: normal;
  font-weight: 700;
  color: #6b7280;
  margin-right: 4px;
}

.reason-text {
  margin: 0 0 12px;
  font-size: 0.97rem;
  color: #111827;
}

.ask-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.92rem;
  color: #14532d;
}

.ask-box strong {
  color: #166534;
}

.clean-state {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 18px;
  color: #166534;
  font-weight: 500;
}

.doc-preview-box {
  margin-top: 26px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.doc-preview-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
}

.doc-preview-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.doc-preview-hint {
  font-size: 0.82rem;
  color: #6b7280;
}

.doc-preview-content {
  font-size: 0.95rem;
  line-height: 1.75;
  color: #374151;
}

.doc-sentence {
  display: inline;
  padding: 2px 4px;
  border-radius: 4px;
  transition: box-shadow 0.25s ease;
}

.doc-sentence.highlight-red {
  background: #fee2e2;
  color: #7f1d1d;
  border-bottom: 2px solid #dc2626;
}

.doc-sentence.highlight-yellow {
  background: #fef3c7;
  color: #78350f;
  border-bottom: 2px solid #d97706;
}

.doc-sentence.flash-focus {
  box-shadow: 0 0 0 3px #2563eb;
}

.notes-panel {
  margin-top: 18px;
  font-size: 0.85rem;
  color: #6b7280;
}

.notes-panel summary {
  cursor: pointer;
  font-weight: 600;
}

.disclaimer {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
  font-size: 0.84rem;
  color: #6b7280;
}

.badge-location {
  background: #e0e7ff;
  color: #1e3a8a;
  font-weight: 600;
  text-transform: none;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.card-header-row .card-badges {
  margin-bottom: 0;
}

.locate-btn {
  background: #f3f4f6;
  color: #1f2937;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.locate-btn:hover {
  background: #e5e7eb;
}

.doc-preview-box {
  margin-top: 26px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.doc-preview-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
}

.doc-preview-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.doc-preview-hint {
  font-size: 0.82rem;
  color: #6b7280;
}

.doc-preview-content {
  font-size: 0.95rem;
  line-height: 1.75;
  color: #374151;
}

.doc-sentence {
  display: inline;
  padding: 2px 4px;
  border-radius: 4px;
  transition: box-shadow 0.25s ease;
}

.doc-sentence.highlight-red {
  background: #fee2e2;
  color: #7f1d1d;
  border-bottom: 2px solid #dc2626;
}

.doc-sentence.highlight-yellow {
  background: #fef3c7;
  color: #78350f;
  border-bottom: 2px solid #d97706;
}

.doc-sentence.flash-focus {
  box-shadow: 0 0 0 3px #2563eb;
}
