:root {
  color-scheme: light;
  --paper: #f5f5ef;
  --surface: #fff;
  --ink: #172d29;
  --muted: #57675f;
  --line: #dce4da;
  --green: #244e42;
  --light-green: #e2eee4;
  --gold: #edd99b;
  --danger: #852b24;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #a17528; outline-offset: 3px; }
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { padding: 30px 20px 22px; background: #173831; color: #fff; display: flex; flex-direction: column; gap: 42px; }
.brand { display: flex; align-items: center; gap: 12px; padding-inline: 4px; white-space: nowrap; }
.brand-icon { width: 43px; height: 43px; display: grid; place-items: center; background: var(--gold); color: var(--ink); border-radius: 13px; font-size: 24px; }
.brand strong { display: block; font-size: 17px; }
.brand small { display: block; color: #bed1c4; margin-top: 5px; direction: ltr; text-align: right; font-size: 11px; }
nav { display: grid; gap: 6px; }
nav button { display: flex; align-items: center; gap: 12px; text-align: start; background: transparent; border: 0; color: #e4eee7; padding: 12px; border-radius: 8px; font-size: 14px; }
nav button span { width: 20px; text-align: center; color: #d1cead; font-size: 19px; }
nav button:hover, nav button[aria-current] { background: #2e5148; color: #fff; }
nav button[aria-current] span { color: var(--gold); }
.sidebar-foot { margin-top: auto; font-size: 12px; padding: 12px; color: #d6e4dd; border-top: 1px solid #527064; }
.sidebar-foot span { color: var(--gold); margin-inline-start: 4px; font-size: 9px; }
main { min-width: 0; }
.top { display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; align-items: center; min-height: 68px; border-bottom: 1px solid var(--line); color: var(--muted); padding: 12px clamp(20px,4vw,56px); font-size: 13px; }
#entity { font-weight: 700; color: var(--green); overflow-wrap: anywhere; }
#content { max-width: 1440px; margin-inline: auto; padding: 34px clamp(18px,4vw,56px) 50px; }
.heading, .section-head, .actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.heading { margin-bottom: 24px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px,4vw,38px); letter-spacing: -.025em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.sub { color: var(--muted); line-height: 1.7; font-size: 14px; margin-top: 7px; }
.btn { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--green); padding: 9px 13px; font-weight: 700; min-height: 38px; }
.btn:hover { border-color: #729486; }
.primary { background: var(--green); border-color: var(--green); color: #fff; }
.danger { color: var(--danger); }
.cards { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 22px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 18px; min-width: 0; }
.card:first-child { background: #234a3f; border-color: #234a3f; color: white; }
.card:first-child .sub { color: #e4eee7; }
.card .figure { display: block; text-align: right; font-size: clamp(18px, 2.35vw, 27px); font-weight: 700; margin-top: 12px; }
.mono, .figure, .amount { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; white-space: nowrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 20px; margin-bottom: 16px; }
.document-verification { display: flex; gap: 14px; align-items: center; margin-block: 14px; break-inside: avoid; }
.document-verification img { width: 104px; height: 104px; image-rendering: pixelated; }
.document-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.verification-page { max-width: 42rem; margin: 4rem auto; padding-inline: 1rem; }
.verification-page dt { font-weight: 700; margin-top: .85rem; }
.verification-page dd { margin-inline-start: 0; overflow-wrap: anywhere; }
.callout { background: #fbf1d8; border: 1px solid #eddeb6; color: #503b16; }
.empty { margin-top: 12px; padding: 24px 8px; color: var(--muted); text-align: center; }
.table-wrap { margin-top: 12px; overflow: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; text-align: start; font-size: 14px; }
th, td { text-align: start; padding: 12px 9px; border-bottom: 1px solid var(--line); line-height: 1.45; vertical-align: middle; }
th { color: var(--muted); background: #f4f7f2; white-space: nowrap; font-size: 12px; }
td { overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; white-space: nowrap; border-radius: 999px; padding: 3px 8px; font-size: 12px; background: var(--light-green); color: var(--green); }
.pill.due { background: #fbefd6; color: #5f4013; }
.pill.late { background: #fae7e1; color: var(--danger); }
.plain { background: none; border: 0; padding: 3px 0; color: #255e4a; text-decoration: underline; font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
label { display: grid; align-content: start; font-size: 14px; gap: 6px; }
input, select, textarea { border: 1px solid #aebdb2; color: var(--ink); background: #fff; border-radius: 7px; min-width: 0; width: 100%; padding: 8px 10px; min-height: 39px; }
input[dir=ltr] { text-align: right; }
.inline-field { display: flex; align-items: center; gap: 8px; }
.inline-field input { width: auto; }
.block-gap { margin-top: 16px; }
dialog { border: 1px solid var(--line); border-radius: 16px; max-width: min(850px,95vw); width: 100%; max-height: 90vh; padding: 22px; color: var(--ink); }
dialog::backdrop { background: #152a26a8; }
dialog .panel { padding: 14px; margin-block: 14px; }
dialog .section-head { align-items: start; }
.items { display: grid; gap: 8px; margin-block: 10px; }
.item { display: grid; grid-template-columns: 2.1fr .75fr 1fr auto; gap: 8px; align-items: end; }
.item .btn { min-width: 37px; }
.error { color: var(--danger); line-height: 1.6; margin-block: 8px; }
.total { display: flex; justify-content: space-between; gap: 12px; margin-block: 9px; }
.parties p { margin-top: 4px; overflow-wrap: anywhere; }
#notice { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 3; padding: 12px 16px; border-radius: 8px; background: #183e34; color: white; max-width: 88vw; }
[hidden] { display: none !important; }
@media(max-width: 1050px) { .cards { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width: 720px) {
  .shell { grid-template-columns: minmax(0,1fr); }
  .sidebar { padding: 14px 12px 8px; gap: 10px; }
  nav { display: flex; overflow: auto; }
  nav button { flex-shrink: 0; padding: 7px; gap: 5px; }
  .sidebar-foot { display: none; }
  #content { padding-top: 20px; }
  .grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .panel, .card, dialog { padding: 13px; }
}
@media(max-width: 420px) {
  .item { grid-template-columns: 1fr 1fr auto; }
  .item > :first-child { grid-column: 1/-1; }
}
@media print {
  body.printing .shell, body.printing #notice, .no-print { display: none !important; }
  body.printing dialog { position: static; width: auto; margin: 0; border: 0; padding: 0; max-height: none; max-width: none; overflow: visible; }
  body.printing dialog::backdrop { background: none; }
  body { background: #fff; }
  dialog .table-wrap { overflow: visible; }
  tr { break-inside: avoid; }
}
.top-company { display: flex; align-items: center; gap: 12px; min-width: 0; }
.union-mark { width: 134px; height: 50px; object-fit: contain; flex-shrink: 0; }
.invoice-mark { display: block; width: 165px; height: 65px; object-fit: contain; margin-block-end: 12px; }
@media(max-width: 580px) { .union-mark { width: 108px; height: 42px; } }
.wide { grid-column: 1 / -1; }
.sale-item { display: block; padding: 13px; border: 1px solid var(--line); border-radius: 10px; }
.line-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.shipping-confirm { margin-top: 14px; padding: 12px; border-radius: 8px; background: #fbf1d8; }
.operation-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.account-form { max-width: 430px; }
.statement-prose { white-space: pre-wrap; }
@media print {
  .scf-sheet + .scf-sheet { break-before: page; }
  .scf-sheet .table-wrap { overflow: visible; }
  .scf-sheet tr { break-inside: avoid; }
}
