:root {
    --bg: #f6f7f9; --surface: #fff; --ink: #1d2433; --muted: #5d6677; --line: #dfe3ea; --accent: #1f5fbf;
    --accent-ink: #fff; --bad: #b42318; --bad-bg: #fdecea; --warn: #8a5a00; --warn-bg: #fff4d6;
    --info: #3b5b85; --info-bg: #eaf1fb; --ok: #1e7a3a; --ok-bg: #e6f4ea; --edit: #6b3fa0; --edit-bg: #f1eafb;
    --radius: 8px; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.55rem; margin: 0 0 .4rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
code, .mono { font-family: var(--mono); font-size: .85em; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.bad-text { color: var(--bad); font-weight: 600; }
.pre-line { white-space: pre-line; }
pre { white-space: pre-wrap; font-size: .8rem; }

.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1.5rem; background: #14213d; color: #fff; }
.topbar a { color: #dbe4f5; text-decoration: none; }
.topbar .brand { font-weight: 700; color: #fff; }
.topbar nav { display: flex; gap: 1rem; }
.topbar nav a.active { color: #fff; border-bottom: 2px solid #fff; }
.topbar .user { margin-left: auto; display: flex; gap: .8rem; align-items: center; font-size: .9rem; }
.topbar .link { color: #dbe4f5; }

.page { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 6rem; }
.page.wide { max-width: 1440px; }
.page.narrow { max-width: 420px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.stack > * + * { margin-top: .8rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.spacer { flex: 1; }

label { display: block; font-weight: 600; font-size: .9rem; }
label.check { display: inline-flex; gap: .4rem; align-items: center; font-weight: normal; }
input, select, textarea { font: inherit; color: inherit; width: 100%; padding: .45rem .6rem; border: 1px solid #c4cad5; border-radius: 6px; background: #fff; margin-top: .25rem; }
label.check input { width: auto; margin: 0; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input.num { text-align: right; font-variant-numeric: tabular-nums; }

.btn { display: inline-block; padding: .5rem .95rem; border-radius: 6px; border: 1px solid #b9c1ce; background: #fff; color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f0f2f5; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #184e9e; }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.btn:disabled { opacity: .6; cursor: progress; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
form.inline { display: inline; }

.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.flash-ok { background: var(--ok-bg); border-color: #a8d5b5; color: var(--ok); }
.flash-warn { background: var(--warn-bg); border-color: #f0d48a; color: var(--warn); }
.flash-bad { background: var(--bad-bg); border-color: #f3b4ad; color: var(--bad); }

.pills { display: inline-flex; gap: .35rem; flex-wrap: wrap; }
.pill, .tag, .status { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill.bad, .tag.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn, .tag.warn { background: var(--warn-bg); color: var(--warn); }
.pill.info, .tag.info { background: var(--info-bg); color: var(--info); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.edited { background: var(--edit-bg); color: var(--edit); }
.status { background: #eef0f4; color: var(--muted); }
.status-reviewing, .status-run { background: var(--info-bg); color: var(--info); }
.status-downloaded, .status-download, .status-resolve { background: var(--ok-bg); color: var(--ok); }
.status-edit { background: var(--edit-bg); color: var(--edit); }

table { border-collapse: collapse; width: 100%; }
table.list th, table.list td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
table.list td.actions { text-align: right; white-space: nowrap; }
.company h2 { display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap; }
.search { margin-bottom: 1rem; max-width: 420px; }
.empty { text-align: center; padding: 2.5rem; }

.dropzone { border: 2px dashed #b9c1ce; border-radius: var(--radius); padding: 2rem 1rem; text-align: center; cursor: pointer; display: grid; gap: .3rem; font-weight: normal; }
.dropzone.over { border-color: var(--accent); background: var(--info-bg); }
.dropzone input { border: 0; padding: 0; justify-self: center; width: auto; max-width: 100%; }
.file-list { margin: 0; padding-left: 1.2rem; font-size: .9rem; }
.checklist { padding-left: 1.2rem; margin: 0 0 .5rem; }

.filing-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.eyebrow { margin: 0; font-size: .85rem; color: var(--muted); }
.steps { display: flex; gap: .3rem; flex-wrap: wrap; }
.steps a, .steps span { padding: .4rem .8rem; border-radius: 6px; text-decoration: none; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: .9rem; }
.steps a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.steps .disabled { color: #9aa3b2; }
.req { font-size: .75rem; color: var(--bad); background: var(--bad-bg); padding: .05rem .45rem; border-radius: 999px; vertical-align: middle; }

.edit-table th { font-size: .78rem; text-align: left; color: var(--muted); font-weight: 600; padding: 0 .3rem .2rem; }
.edit-table td { padding: .2rem .3rem; }
.edit-table input { margin: 0; }
.actionbar { position: sticky; bottom: 0; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; box-shadow: 0 -4px 12px rgba(20, 33, 61, .06); }
details summary { cursor: pointer; font-weight: 600; }

.toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.fix-panel { border: 2px solid var(--bad); background: var(--bad-bg); }
.fix-panel h2 { color: var(--bad); }
.fix-panel.all-clear { border-color: #a8d5b5; background: var(--ok-bg); }
.fix-panel.all-clear h2 { color: var(--ok); }
.issue-list { list-style: none; margin: 0; padding: 0; }
.issue-list li { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: start; padding: .5rem 0; border-top: 1px solid rgba(0, 0, 0, .07); }
.issue-list li.resolved .msg { text-decoration: line-through; color: var(--muted); }
.issue-actions { display: flex; gap: .6rem; align-items: center; white-space: nowrap; font-size: .9rem; }
.checks summary { margin-bottom: .4rem; }

.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--line); margin: 1.5rem 0 1rem; overflow-x: auto; }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--ink); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a.active { border-color: var(--accent); color: var(--accent); }
.filters { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.filters input[type="search"] { max-width: 340px; margin: 0; }

table.review { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); table-layout: fixed; }
table.review th { position: sticky; top: 0; background: #eef1f5; text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: .5rem .6rem; z-index: 1; }
table.review td { padding: .55rem .6rem; border-top: 1px solid var(--line); vertical-align: top; }
.c-cell { width: 70px; } .c-field { width: 26%; } .c-source { width: 22%; color: var(--muted); }
.c-field .label { font-weight: 600; }
.c-field .path { color: var(--muted); font-size: .75rem; word-break: break-all; }
.c-value input, .c-value select, .c-value textarea { margin: 0; }
.c-value .meta { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: .2rem; }
tr.row-bad { box-shadow: inset 4px 0 0 var(--bad); }
tr.row-warn { box-shadow: inset 4px 0 0 #e0a800; }
tr.row-info { box-shadow: inset 4px 0 0 #8fb0dc; }
tr.is-edited td { background: #fbf8ff; }
tr.is-dirty td { background: #fffbea; }
tr.flash-row td { animation: flash 2s ease-out; }
@keyframes flash { from { background: #ffe58a; } }
.edited-note { color: var(--edit); }
.edited-note q { color: var(--ink); }
.inline-issue { margin-top: .35rem; padding: .3rem .5rem; border-radius: 6px; font-size: .85rem; }
.inline-issue.bad { background: var(--bad-bg); color: var(--bad); }
.inline-issue.warn { background: var(--warn-bg); color: var(--warn); }
.inline-issue.info { background: var(--info-bg); color: var(--info); }
.inline-issue.resolved { opacity: .6; text-decoration: line-through; }
.full-text { white-space: pre-wrap; background: #f6f7f9; padding: .5rem; border-radius: 6px; }
.savebar { position: sticky; bottom: 0; display: flex; gap: .6rem; align-items: center; background: #14213d; color: #fff; padding: .7rem 1rem; border-radius: var(--radius); margin-top: .8rem; box-shadow: 0 -4px 16px rgba(20, 33, 61, .2); z-index: 2; }
.savebar[hidden] { display: none; }
.add-field { margin-top: 1.5rem; }
.grid-add { display: grid; grid-template-columns: 2fr 2fr auto; gap: .8rem; align-items: end; }
.history del { color: var(--bad); } .history ins { color: var(--ok); text-decoration: none; }

@media (max-width: 760px) {
    .topbar { flex-wrap: wrap; gap: .6rem 1rem; padding: .6rem 1rem; }
    .grid-3, .grid-add { grid-template-columns: 1fr; }
    .issue-list li { grid-template-columns: 1fr; }
    table.review, table.review tbody, table.review tr, table.review td { display: block; width: 100%; }
    table.review thead { display: none; }
    table.review td { border: 0; padding: .25rem .6rem; }
    table.review tr { border-top: 1px solid var(--line); padding: .4rem 0; }
    .c-cell, .c-field, .c-source { width: auto; }
    .edit-table, .edit-table tbody, .edit-table tr, .edit-table td { display: block; }
    .edit-table thead { display: none; }
    .edit-table tr { border-top: 1px solid var(--line); padding: .4rem 0; }
    table.list { display: block; overflow-x: auto; }
}
table.history { table-layout: fixed; }
table.history td { overflow-wrap: anywhere; }
table.history th:nth-child(1) { width: 150px; } table.history th:nth-child(2) { width: 110px; } table.history th:nth-child(3) { width: 140px; } table.history th:nth-child(4) { width: 28%; }
