:root {
  --teal: #0f766e; --teal-dark: #115e59; --teal-soft: #ccfbf1;
  --ink: #1f2937; --muted: #6b7280; --line: #e5e7eb; --bg: #f6f7f8; --card: #ffffff;
  --amber: #b45309; --amber-soft: #fef3c7; --red: #b91c1c; --red-soft: #fee2e2; --blue-soft: #dbeafe; --green-soft: #dcfce7;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--teal); }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
p { margin: .5rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.danger { color: var(--red); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { text-decoration: none; display: flex; align-items: baseline; gap: 4px; }
.brand-mark { font-weight: 800; color: var(--teal); letter-spacing: .06em; font-size: 1.1rem; }
.brand-sub { color: var(--muted); font-weight: 500; }
.topbar nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: .95rem; }
.topbar nav a { text-decoration: none; color: var(--ink); }
.inline { display: inline; }
button.link { background: none; border: 0; color: var(--teal); cursor: pointer; font: inherit; padding: 0; }

.container { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 20px 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; }
.card.narrow { max-width: 440px; margin: 32px auto; }
.hero { padding: 8px 0 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.form label { display: block; margin: 0 0 12px; font-weight: 600; font-size: .9rem; }
.form input:not([type=checkbox]), .form select, .form textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.form input:disabled { background: var(--bg); color: var(--muted); }
.form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 4px; margin: 0 0 16px; }
.form legend { font-weight: 700; padding: 0 6px; }
.form .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.form .check input { margin-top: 4px; width: auto; }
.consent { background: #fffdf5; }

.btn { display: inline-block; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--teal); color: var(--teal); background: #fff; text-decoration: none; font-weight: 600; cursor: pointer; font: inherit; }
.btn:hover { background: var(--teal-soft); }
.btn.primary { background: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.big { width: 100%; padding: 14px; font-size: 1.05rem; }
.btn.small { padding: 6px 10px; font-size: .85rem; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }

.alert { padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; border: 1px solid transparent; }
.alert.error { background: var(--red-soft); color: var(--red); }
.alert.warn { background: var(--amber-soft); color: var(--amber); }
.alert.info { background: var(--blue-soft); color: #1e40af; }
.alert.ok { background: var(--green-soft); color: #166534; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; color: var(--muted); }
.table.small { font-size: .82rem; }
.table tr.overdue td { background: #fff7f7; }
.table tr.MATCHED td { background: #f0fdf4; }
.table tr.INVALID td, .table tr.AMBIGUOUS td { background: #fff7ed; }
.table tr.NOT_IN_SCOPE td { color: var(--muted); }

.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--line); }
.status.DELIVERED, .status.REPORT_READY { background: var(--green-soft); color: #166534; }
.status.REQUIRES_PROFESSIONAL_EVALUATION { background: var(--amber-soft); color: var(--amber); }
.status.NEEDS_NEW_UPLOAD, .status.FAILED { background: var(--red-soft); color: var(--red); }
.status.RECEIVED, .status.PROCESSING_DOCUMENT, .status.EXTRACTING, .status.NORMALIZING, .status.VALIDATING, .status.RULES_PROCESSING, .status.REPORT_GENERATING, .status.RETRY_PENDING { background: var(--blue-soft); color: #1e40af; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--line); font-size: .78rem; }

.report-frame { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 12px; }
.report-frame iframe { width: 100%; height: 80vh; border: 0; }
pre { white-space: pre-wrap; background: var(--bg); padding: 8px; border-radius: 6px; }
