body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: #f6f6f6;
  color: #1f2933;
}

.page {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 16px;
}

.card {
  background: white;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
}

.hidden {
  display: none;
}

.muted {
  color: #667085;
}

.trust {
  background: #f0f4f8;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  margin-top: 14px;
}

.small {
  font-size: 13px;
  color: #667085;
}

/* Header */
.app-header {
  padding-bottom: 16px;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.product-title {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.2;
}

.product-subtitle {
  margin: 6px 0 0;
  font-size: 1rem;
  color: #475467;
  font-weight: 500;
}

.version-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #344054;
  background: #e4e7ec;
  border: 1px solid #d0d5dd;
}

.section-label {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
}

.section-hint {
  margin: 0 0 14px;
  font-size: 14px;
}

/* Auth */
.login-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.session-bar.hidden {
  display: none;
}

.session-bar p {
  margin: 0;
  font-size: 14px;
}

/* Forms & upload */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
}

.login-grid {
  grid-template-columns: 1fr 1fr auto;
}

.upload-panel {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
}

.upload-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legacy-controls input[type="text"],
.legacy-controls input[type="password"] {
  max-width: 280px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

input,
button {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccd5df;
  font-size: 14px;
}

button {
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: #1f2933;
  color: #fff;
  border-color: #1f2933;
}

.btn-primary:hover:not(:disabled) {
  background: #344054;
  border-color: #344054;
}

.btn-secondary {
  background: #fff;
  color: #344054;
}

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

.status-bar {
  margin-top: 12px;
  padding: 10px 12px;
  background: #eef4ff;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid #d0d9f0;
}

.status-bar.is-error {
  background: #fef3f2;
  border-color: #fecdca;
}

.status-bar.is-processing {
  background: #f0f4ff;
  border-color: #c7d7fe;
}

.file-meta {
  font-size: 13px;
  color: #475467;
  background: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

/* Summary cards */
.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
}

.stat-card .stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: #667085;
  line-height: 1.3;
}

.stat-card.integrity-partial {
  background: #fff7ed;
  border-color: #fed7aa;
}

.review-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.review-breakdown h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #475467;
}

.review-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
}

.review-card .stat-value {
  font-size: 1.35rem;
}

.identifiers-footer {
  margin-top: 18px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.identifiers-footer .run-id {
  margin: 0 0 4px;
  font-size: 14px;
  word-break: break-all;
}

.identifiers-footer .batch-id {
  margin: 0;
  font-size: 13px;
  color: #667085;
  word-break: break-all;
}

.integrity-explanation {
  margin: 8px 0 0;
  font-size: 13px;
}

.low-confidence-note {
  margin: 14px 0 0;
  font-size: 14px;
}

/* Tables & detail */
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  padding: 10px;
  vertical-align: top;
}

.clickable {
  cursor: pointer;
}

.clickable:hover {
  background: #f8fafc;
}

.pill {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.high {
  background: #fee2e2;
}

.medium {
  background: #ffedd5;
}

.low {
  background: #e0f2fe;
}

.none {
  background: #e5e7eb;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 16px;
}

.message {
  padding: 9px;
  border-left: 3px solid #d0d5dd;
  background: #f9fafb;
  margin-bottom: 8px;
}

.notice {
  padding: 10px;
  background: #fff7ed;
  border-radius: 8px;
}

.error-card {
  padding: 10px;
  margin-bottom: 8px;
  background: #fef3f2;
  border-radius: 8px;
  border: 1px solid #fecdca;
}

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid #c7d7fe;
  border-top: 2px solid #344054;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
}

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
