/* Mobile-first. Large tap targets, plain layout, works on slow phones. */
:root {
  --red: #d7264f; --navy: #1b1f5e; --ink: #1d1d22; --muted: #5d6070; --line: #dedfe6; --bg: #f6f6f9;
  --ok: #1d7a46; --warn: #9a5b00; --bad: #b3261e; --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--navy); }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; line-height: 1.25; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
.wrap { max-width: 760px; margin: 0 auto; padding: 1rem; }
.wrap.wide { max-width: 1200px; }
header.top { background: var(--navy); color: #fff; }
header.top .wrap { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding-top: .6rem; padding-bottom: .6rem; }
header.top a { color: #fff; text-decoration: none; }
.brand { font-weight: 800; letter-spacing: .02em; }
.brand span { color: #ff6b8b; }
nav.main { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .95rem; margin-left: auto; align-items: center; }
nav.main form { display: inline; }
nav.main button { background: none; border: 0; color: #fff; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.banner { padding: .5rem 1rem; font-size: .9rem; text-align: center; }
.banner.dev { background: #fff4c2; color: #5a4300; border-bottom: 1px solid #e9d27a; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: .5rem; background: #eef0ff; }
.messages li.success { background: #e5f5eb; color: #0f5130; }
.messages li.error { background: #fde8e7; color: #7d1a14; }
.notice { background: #eef4ff; border-left: 4px solid var(--navy); padding: .6rem .8rem; border-radius: 6px; }
.warning { background: #fff4e5; border-left: 4px solid var(--warn); padding: .6rem .8rem; border-radius: 6px; }
.danger-box { background: #fde8e7; border-left: 4px solid var(--bad); padding: .6rem .8rem; border-radius: 6px; }

/* Forms */
fieldset { border: 0; padding: 0; margin: 0 0 1.2rem; }
legend { font-weight: 700; font-size: 1.05rem; margin-bottom: .4rem; }
.field { margin-bottom: 1rem; }
.field > label, .field > div > label:first-child, .field legend { display: block; font-weight: 600; margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=tel], input[type=password],
input:not([type]), select, textarea {
  width: 100%; font: inherit; padding: .7rem .75rem; border: 1px solid #b9bccb; border-radius: 8px; background: #fff; min-height: 46px;
}
textarea { min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 3px solid #c9cdf5; border-color: var(--navy); }
.helptext, .field .help { display: block; color: var(--muted); font-size: .88rem; margin-top: .2rem; }
.errorlist { list-style: none; padding: 0; margin: .25rem 0 0; color: var(--bad); font-size: .9rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--bad); }
p.error, .error { color: var(--bad); }
.field ul, .field div[id] > div { list-style: none; padding: 0; margin: 0; }
.field ul li, .field div[id] > div { margin: .2rem 0; }
input[type=radio], input[type=checkbox] { width: 1.2rem; height: 1.2rem; vertical-align: middle; margin-right: .4rem; }
.choice-grid ul, .choice-grid div[id] { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .2rem .8rem; }
.row2 { display: grid; gap: 0 1rem; }
@media (min-width: 620px) { .row2 { grid-template-columns: 1fr 1fr; } }
.save-bar { position: sticky; bottom: 0; background: rgba(246,246,249,.96); padding: .6rem 0; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); }
.save-status { font-size: .9rem; color: var(--muted); }
.save-status.ok { color: var(--ok); } .save-status.warn { color: var(--warn); }

button, .button { font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: .7rem 1.1rem; min-height: 46px; cursor: pointer;
  background: var(--navy); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; }
.button.secondary, button.secondary { background: #fff; color: var(--navy); border: 1px solid var(--navy); }
.button.primary, button.primary { background: var(--red); }
.button.small, button.small { padding: .35rem .7rem; min-height: 34px; font-size: .9rem; }
button.link { background: none; color: var(--navy); padding: 0; min-height: 0; text-decoration: underline; font-weight: 500; }
button.link.danger, .danger { color: var(--bad); }
button[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .6rem; }
.inline { display: inline; }

/* Progress and steps */
.progress { background: #e4e5ee; border-radius: 99px; height: 10px; overflow: hidden; margin: .4rem 0 1rem; }
.progress span { display: block; height: 100%; background: var(--red); }
.steps { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; }
.steps li a { display: block; white-space: nowrap; padding: .4rem .75rem; border-radius: 99px; border: 1px solid var(--line); background: #fff; text-decoration: none; font-size: .9rem; color: var(--ink); }
.steps li a.current { background: var(--navy); color: #fff; border-color: var(--navy); }
.steps li a.done::before { content: "✓ "; color: var(--ok); }
.steps li a.current.done::before { color: #9ff0c0; }
.steps li a.fix { border-color: var(--red); }
.section-list { list-style: none; padding: 0; margin: 0; }
.section-list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.section-list li:last-child { border-bottom: 0; }

/* Status badges */
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: .12rem .5rem; border-radius: 99px; background: #eceef5; color: #333; vertical-align: middle; white-space: nowrap; }
.badge.ok, .badge.clean, .badge.verified, .badge.accepted, .badge.approved, .badge.match, .badge.positive, .badge.met, .badge.resolved { background: #dff3e6; color: #0f5130; }
.badge.warn, .badge.pending, .badge.submitted, .badge.addressed, .badge.under_review, .badge.needs_evidence, .badge.neutral, .badge.unclear { background: #fff1d6; color: #6b4300; }
.badge.bad, .badge.infected, .badge.rejected, .badge.declined, .badge.needs_correction, .badge.negative, .badge.not_met, .badge.not_found, .badge.inactive, .badge.open, .badge.corrections_requested { background: #fde3e1; color: #7d1a14; }
.badge.info, .badge.provider_error, .badge.not_configured, .badge.error, .badge.draft { background: #e7e9fb; color: #23286b; }

/* Uploads */
.slot { border: 1px dashed #b9bccb; border-radius: var(--radius); padding: .8rem; margin-bottom: .8rem; background: #fcfcfe; }
.slot .slot-label { font-weight: 600; }
.slot .docs { list-style: none; padding: 0; margin: .5rem 0; }
.slot .doc { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; padding: .35rem 0; border-top: 1px solid #eee; font-size: .95rem; word-break: break-all; }
.slot .doc progress { width: 120px; }
.slot .pickers { display: flex; flex-wrap: wrap; gap: .5rem; }
.slot .pickers label { cursor: pointer; }
.slot input[type=file] { position: absolute; left: -9999px; }
.slot.filled:not([data-multiple]) .pickers .button { background: #fff; color: var(--navy); border: 1px solid var(--navy); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: .94rem; }
th, td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f1f2f7; font-weight: 700; white-space: nowrap; }
dl.kv { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: .25rem .8rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }

/* Review layout */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin: 0 0 1rem; border-bottom: 2px solid var(--line); }
.tabs a { padding: .45rem .8rem; text-decoration: none; border-radius: 8px 8px 0 0; color: var(--ink); font-size: .93rem; }
.tabs a.current { background: var(--navy); color: #fff; }
.split { display: grid; gap: 1rem; }
@media (min-width: 980px) { .split { grid-template-columns: 1.15fr 1fr; } }
.evidence-list { list-style: none; margin: .3rem 0; padding: 0; }
.evidence-list li { padding: .2rem 0; font-size: .93rem; }
.locked { color: var(--muted); font-style: italic; }
.thumbs { display: flex; flex-wrap: wrap; gap: .5rem; }
.thumbs a { display: block; width: 110px; height: 110px; border-radius: 8px; overflow: hidden; background: #e8e9f0; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; }
.kpi .n { font-size: 1.7rem; font-weight: 800; }
.kpi.ok { border-color: #8fd1a7; } .kpi.bad { border-color: #f0a39d; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: 1rem; }
.filters > * { flex: 1 1 150px; }
.filters button { flex: 0 0 auto; }
details summary { cursor: pointer; font-weight: 600; }
.diff-old { background: #fde8e7; } .diff-new { background: #e5f5eb; }
iframe.viewer { width: 100%; height: 80vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
img.viewer { max-width: 100%; border-radius: 8px; }
footer { color: var(--muted); font-size: .85rem; padding: 2rem 1rem; text-align: center; }
