:root {
  --bg: #f4f2ee; --panel: #ffffff; --ink: #1d232b; --muted: #6b7380; --line: #e2ded6;
  --brand: #1f3b6d; --brand-2: #2f5aa8; --ok: #2e7d4f; --warn: #a86a00; --err: #b3261e;
  --radius: 10px; --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
nav.side { background: #18202b; color: #cfd6e0; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow: auto; }
nav.side .brand { font-weight: 700; color: #fff; font-size: 16px; letter-spacing: .2px; margin: 2px 6px 18px; }
nav.side .brand small { display: block; font-weight: 400; color: #8b96a6; font-size: 11.5px; }
nav.side a { display: block; color: #cfd6e0; padding: 7px 10px; border-radius: 7px; }
nav.side a:hover, nav.side a.on { background: #263243; color: #fff; text-decoration: none; }
nav.side .grp { color: #7c8797; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; margin: 16px 10px 6px; }
nav.side .sub { padding-left: 18px; font-size: 13px; }
main { padding: 26px 32px 60px; max-width: 1280px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.lead { color: var(--muted); margin: 0 0 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.row { display: flex; gap: 18px; flex-wrap: wrap; }
.row > * { flex: 1 1 280px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 14px; }
.grid .w2 { grid-column: span 2; }
.grid .w3 { grid-column: span 3; }
.grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid #cfcac0; border-radius: 7px; background: #fff; font: inherit; color: var(--ink); }
textarea { min-height: 60px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b8cdf2; border-color: var(--brand-2); }
input[type=color] { width: 46px; height: 32px; padding: 0; border: 1px solid #cfcac0; border-radius: 6px; background: #fff; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink); margin: 0; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: #172d55; text-decoration: none; }
.btn.alt { background: #fff; color: var(--brand); }
.btn.alt:hover { background: #eef2fa; }
.btn.danger { background: #fff; color: var(--err); border-color: #e2b4b0; }
.btn.small { padding: 4px 9px; font-size: 12.5px; font-weight: 500; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 7px 8px; }
table.list td { border-bottom: 1px solid #f0ece5; padding: 7px 8px; vertical-align: top; }
table.list tr:hover td { background: #faf8f4; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; border: 1px solid; }
.flash.ok { background: #eaf6ee; border-color: #b9dfc6; color: #1d5a37; }
.flash.warn { background: #fff6e5; border-color: #f0d49a; color: #6d4700; }
.flash.error { background: #fdecea; border-color: #f2b8b3; color: #8c1d18; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; background: #eef1f6; color: #3b4a63; }
.tag.beta { background: #fde7e4; color: #9a2617; }
.tag.ok { background: #e6f4ea; color: #1d5a37; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.card .logo { height: 46px; display: flex; align-items: center; }
.card .logo img { max-height: 46px; max-width: 200px; }
.card h2 { margin: 0; }
.stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); vertical-align: middle; }
.scanwrap { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.scanwrap img { display: block; width: 100%; }
.scanwrap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sticky { position: sticky; top: 16px; }
.thumb { max-height: 60px; max-width: 180px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.split { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 22px; align-items: start; }
.lines-table input, .lines-table select { padding: 5px 6px; }
.lines-table td { padding: 4px 4px; }
.totals { margin-left: auto; width: 320px; }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals .grand { font-weight: 700; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
details.box { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 10px 0; background: #fcfbf9; }
details.box summary { cursor: pointer; font-weight: 600; }
.legend span { margin-right: 14px; font-size: 12px; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  nav.side { position: static; height: auto; }
  .split { grid-template-columns: 1fr; }
  main { padding: 18px 16px; }
}
