:root { --brand: #7a1f2b; --brand2: #5c1620; --bg: #f4f2ef; --card: #fff; --text: #1d1d1f; --muted: #6b6b70;
  --line: #dcd8d2; --ok: #1e7a3c; --warn: #9a6200; --err: #b3261e; --info: #1f5f99; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--brand); color: #fff; }
.top .wrap { display: flex; justify-content: space-between; align-items: center; min-height: 54px; flex-wrap: wrap; gap: 8px; }
.brand { font-size: 17px; }
.top nav a, .top nav .who { color: #fff; margin-left: 14px; text-decoration: none; font-size: 14px; }
.top nav a:hover { text-decoration: underline; }
.top nav .who { opacity: .8; }
main.wrap { padding-top: 22px; padding-bottom: 40px; }
.foot { color: var(--muted); font-size: 13px; padding-bottom: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 22px; margin-bottom: 18px; }
.card.narrow { max-width: 560px; margin: 20px auto; }
h1 { font-size: 21px; margin: 0 0 6px; color: var(--brand2); }
h2 { font-size: 16px; margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--brand); color: var(--brand2); }
h2 small { font-weight: normal; color: var(--muted); font-size: 13px; }
h3 { font-size: 14px; margin: 14px 0 4px; font-style: italic; color: var(--muted); }
.card > h2:first-child { margin-top: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
label.inline, .inline { display: inline-flex; align-items: flex-start; gap: 6px; font-weight: normal; margin-right: 16px; }
input, select, textarea { width: 100%; padding: 9px 10px; margin-top: 4px; font: inherit; border: 1px solid #bdb7ae; border-radius: 6px; background: #fff; font-weight: normal; }
input[type=checkbox], input[type=radio] { width: auto; margin-top: 3px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
input.ro, input[readonly] { background: #f1efec; color: #444; }
.req { color: var(--err); }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 18px; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.four { grid-template-columns: 2fr 2fr 1.3fr 1.3fr; }
.span2 { grid-column: span 2; }
.yn { background: #faf8f5; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
.yn p { margin: 0 0 6px; font-size: 14px; }
.sib { position: relative; border: 1px dashed #c8c1b6; border-radius: 8px; padding: 14px 14px 2px; margin-bottom: 10px; }
.sib .rm { position: absolute; top: 4px; right: 8px; border: 0; background: none; font-size: 22px; color: var(--err); cursor: pointer; }
table.totals { width: 100%; max-width: 620px; border-collapse: collapse; }
table.totals td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
table.totals tr.grand td { font-weight: 700; border-top: 2px solid var(--text); }
.declare { background: #fff8e6; border: 1px solid #e8d49a; border-radius: 8px; padding: 12px 14px; margin: 22px 0 14px; }
.btn { display: inline-block; padding: 9px 16px; border: 1px solid #bdb7ae; border-radius: 6px; background: #fff; color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; margin: 4px 0; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand2); }
.btn.big { padding: 13px 26px; font-size: 16px; }
.btn.full { display: block; width: 100%; text-align: center; }
.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--info); }
.link.danger { color: var(--err); }
.alert { padding: 11px 14px; border-radius: 7px; margin: 0 0 14px; border: 1px solid; font-size: 14px; }
.alert ul { margin: 6px 0 0 18px; padding: 0; }
.alert.ok { background: #e9f6ee; border-color: #a9d8b8; color: var(--ok); }
.alert.warn { background: #fff5e0; border-color: #eccd8c; color: #6e4700; }
.alert.err { background: #fdecea; border-color: #f0b4ae; color: var(--err); }
.alert.info { background: #eaf2fb; border-color: #b6cfe9; color: var(--info); }
.refno { font-size: 26px; font-weight: 700; letter-spacing: .5px; color: var(--brand2); margin: 0 0 4px; }
.steps li { margin-bottom: 6px; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 13px; color: var(--muted); }
.stats b { display: block; font-size: 26px; color: var(--text); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { width: auto; flex: 0 1 auto; margin: 0; }
.filters input[name=q] { flex: 1 1 260px; }
.tablewrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; background: #f1efec; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 8px; border-bottom: 1px solid #ece8e2; vertical-align: top; }
table.list tr:hover td { background: #fbfaf8; }
table.list td form { margin: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.warn { color: var(--warn); font-size: 12px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; background: #eee; }
.tag.ok, .tag.s-approved { background: #dff1e5; color: var(--ok); }
.tag.s-rejected { background: #fbe1de; color: var(--err); }
.tag.s-submitted { background: #e3ecf7; color: var(--info); }
.twocol { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.twocol > .card { margin-bottom: 0; }
table.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
table.kv th { text-align: left; width: 34%; padding: 6px 8px 6px 0; color: var(--muted); font-weight: 600; vertical-align: top; }
table.kv td { padding: 6px 0; border-bottom: 1px solid #f0ede8; }
.code { font-family: Consolas, monospace; font-size: 17px; font-weight: 700; background: #f1efec; padding: 2px 8px; border-radius: 5px; }
.pager a { display: inline-block; padding: 4px 9px; margin: 2px; border: 1px solid var(--line); border-radius: 5px; text-decoration: none; color: var(--text); }
.pager a.cur { background: var(--brand); color: #fff; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
@media (max-width: 760px) {
  .grid, .grid.three, .grid.four, .twocol { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 16px; }
}
