:root {
  --bg: #f4f6f8; --card: #fff; --text: #1d2733; --muted: #5b6878; --line: #d9dfe6;
  --primary: #1f4e79; --primary-text: #fff; --danger: #a4262c; --ok: #1b6e3a; --warn: #8a5300;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); }
.topbar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: .75rem 1rem; background: var(--primary); color: var(--primary-text); }
.topbar a, .topbar .link { color: var(--primary-text); text-decoration: none; }
.topbar nav { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; font-size: .95rem; }
.brand { font-weight: 700; font-size: 1.15rem; }
.container { max-width: 720px; margin: 0 auto; padding: 1rem; }
.container-wide { max-width: 1400px; margin: 0 auto; padding: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.narrow { max-width: 420px; margin: 2rem auto; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; } h2 { font-size: 1.15rem; }
label { display: block; font-weight: 600; margin: .75rem 0 .25rem; }
input, select, textarea { width: 100%; padding: .6rem .7rem; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
input[type=checkbox] { width: auto; }
button, .button-like { display: inline-block; padding: .7rem 1rem; font: inherit; font-weight: 600; border-radius: 10px; border: 1px solid var(--primary); cursor: pointer; text-align: center; text-decoration: none; }
.primary { background: var(--primary); color: var(--primary-text); }
.secondary { background: #fff; color: var(--primary); }
.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.link { background: none; border: 0; padding: 0; font-weight: 400; }
.wide { display: block; width: 100%; margin: .5rem 0; font-size: 1.1rem; padding: 1rem; }
.inline { display: inline; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.preview img { max-width: 100%; max-height: 50vh; display: block; margin: .5rem auto; border-radius: 8px; }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.msg { padding: .7rem 1rem; border-radius: 8px; margin-bottom: .5rem; background: #e8f0f8; }
.msg-success { background: #e3f3e8; color: var(--ok); } .msg-error { background: #fbe9ea; color: var(--danger); }
.error, .errorlist { color: var(--danger); }
.muted { color: var(--muted); }
.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-row { display: flex; gap: .75rem; align-items: center; padding: .6rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: .5rem; color: inherit; text-decoration: none; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: var(--line); flex: none; }
.doc-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.doc-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amount { font-weight: 700; white-space: nowrap; }
.status { display: inline-block; font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; background: #e8edf2; }
.status-ready_for_review { background: #fff1d6; color: var(--warn); }
.status-reviewed, .status-exported { background: #e3f3e8; color: var(--ok); }
.status-failed { background: #fbe9ea; color: var(--danger); }
.photo { max-width: 100%; border-radius: 8px; display: block; margin: .5rem 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.pagination { display: flex; gap: 1rem; justify-content: center; margin: 1rem 0; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { padding: .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: .85rem; color: var(--muted); }
td.num { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .5rem 1rem; align-items: end; }
.filters label { margin: 0 0 .25rem; }
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
.review .photo-pane img { width: 100%; border-radius: 8px; }
.review .photo-pane { position: sticky; top: 1rem; align-self: start; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
.field-warning { color: var(--warn); font-size: .85rem; }
.warnings { background: #fff7e6; border: 1px solid #f0d199; border-radius: 8px; padding: .5rem 1rem; }
.vat-table input { min-width: 6rem; }
pre.ocr { white-space: pre-wrap; background: #f7f7f7; padding: .75rem; border-radius: 8px; font-size: .85rem; }
@media (max-width: 900px) { .review { grid-template-columns: 1fr; } .review .photo-pane { position: static; } }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.month-nav h1 { margin: 0; text-align: center; }
.month-nav a { font-size: 1.6rem; text-decoration: none; padding: .25rem .75rem; }
.day h2 { display: flex; justify-content: space-between; margin: 1.25rem 0 .5rem; }
.day .hours { color: var(--muted); font-weight: 600; }
.doc-meta small { overflow-wrap: anywhere; }
