:root {
  --bg: #f6f6f4; --surface: #ffffff; --text: #1b1d21; --muted: #646a73; --line: #e2e3e0;
  --accent: #0f5c8c; --accent-text: #ffffff; --ok: #1f7a4d; --warn: #9a5b00; --err: #b3261e; --flag: #fff3d6;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121418; --surface: #1b1e24; --text: #e8e9eb; --muted: #9aa0a8; --line: #2c3038; --accent: #4ea3d8; --accent-text: #0b0d10; --flag: #3a2f14; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; }
.mark { background: var(--accent); color: var(--accent-text); padding: 2px 6px; border-radius: 4px; margin-right: 4px; }
nav { display: flex; gap: 12px; align-items: center; }
nav a { color: var(--accent); text-decoration: none; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 17px; margin: 28px 0 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 12px; }
.narrow { max-width: 380px; margin: 48px auto; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; min-width: 0; }
input:focus-visible, button:focus-visible, .drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 6px; padding: 8px 14px; background: var(--accent); color: var(--accent-text); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--muted); padding: 4px 8px; }
form { display: grid; gap: 12px; margin-top: 12px; }
.muted { color: var(--muted); } .err { color: var(--err); min-height: 1em; margin: 0; }
.warn { background: var(--flag); color: var(--warn); padding: 8px 12px; border-radius: 6px; }
.drop { display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; text-align: center; min-height: 140px; border: 2px dashed var(--line); border-radius: 10px; background: var(--surface); padding: 20px; cursor: pointer; margin-bottom: 12px; }
.drop.over { border-color: var(--accent); }
.doc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.pill.ok { color: var(--ok); } .pill.bad { color: var(--err); }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 10px; }
.checks { margin: 4px 0 8px; font-size: 13px; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: top; font-size: 13px; }
th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
table.items input { width: 100%; padding: 4px 6px; border-color: transparent; background: transparent; }
table.items input:hover, table.items input:focus { border-color: var(--line); background: var(--bg); }
table.items td.num input { text-align: right; }
table.items td:nth-child(2) { min-width: 260px; }
tr.flagged { background: var(--flag); }
.actions { display: flex; gap: 12px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.result a { color: var(--accent); }
.history a { color: var(--accent); }
