:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-alt: #f8faf9;
  --ink: #18201f;
  --muted: #65706e;
  --line: #d9dfdd;
  --line-strong: #bdc8c5;
  --brand: #087667;
  --brand-dark: #075e53;
  --sidebar: #172522;
  --sidebar-muted: #aebfba;
  --amber: #9a5b06;
  --amber-bg: #fff7e7;
  --danger: #a92c27;
  --danger-bg: #fff0ef;
  --success: #176b47;
  --success-bg: #edf8f2;
  --shadow: 0 1px 2px rgba(24, 32, 31, .06);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: Inter, "Segoe UI", Arial, sans-serif; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 26px; line-height: 1.25; letter-spacing: 0; }
h2 { margin-bottom: 5px; font-size: 17px; line-height: 1.3; letter-spacing: 0; }
p { margin-bottom: 12px; }
small { color: var(--muted); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 13px; color: #f6fbf9; background: var(--sidebar); z-index: 30; }
.brand-block { display: flex; align-items: center; gap: 11px; padding: 2px 8px 21px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-block strong, .brand-block small { display: block; }
.brand-block strong { font-size: 16px; }
.brand-block small { margin-top: 1px; color: var(--sidebar-muted); font-size: 11px; text-transform: uppercase; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid #5f8c82; border-radius: 7px; color: white; background: #245a50; font-weight: 800; }
.nav { flex: 1; overflow-y: auto; padding: 15px 0; }
.nav a { display: block; min-height: 39px; margin: 2px 0; padding: 9px 11px; border-radius: 6px; color: #d3dfdc; font-size: 14px; font-weight: 600; }
.nav a:hover { color: white; background: rgba(255,255,255,.06); }
.nav a.active { color: white; background: #26594f; box-shadow: inset 3px 0 0 #6fd0bd; }
.sidebar-user { padding: 14px 8px 2px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user strong { font-size: 13px; }
.sidebar-user small { margin: 2px 0 9px; color: var(--sidebar-muted); font-size: 11px; }
.sidebar-user a, .sidebar-user button { color: #d9e6e3; font-size: 12px; text-decoration: underline; }
.sidebar-user form { margin-top: 4px; }
.sidebar-user button { padding: 0; border: 0; background: none; cursor: pointer; }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 68px; display: flex; align-items: center; gap: 15px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.company-context { display: flex; align-items: center; gap: 10px; min-width: 0; }
.company-context > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.company-context form { min-width: 0; }
.company-context select { min-width: 230px; max-width: 380px; border-color: transparent; background-color: var(--surface-alt); font-weight: 700; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.menu-toggle { display: none !important; }
.content { width: 100%; max-width: 1440px; margin: 0 auto; padding: 25px 28px 50px; }

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--brand-dark); font-size: 13px; font-weight: 700; }
.profile-chip { display: inline-flex; align-items: center; min-height: 30px; padding: 5px 9px; border: 1px solid #b9d7d1; border-radius: 6px; color: var(--brand-dark); background: #f0f8f6; font-size: 12px; font-weight: 800; white-space: nowrap; }

.btn { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); cursor: pointer; font-weight: 700; font-size: 13px; line-height: 1.2; }
.btn:hover { border-color: #94a39f; background: var(--surface-alt); }
.btn.primary { color: white; border-color: var(--brand); background: var(--brand); }
.btn.primary:hover { border-color: var(--brand-dark); background: var(--brand-dark); }
.btn.danger { color: var(--danger); border-color: #dfaaa7; background: white; }
.btn.small { min-height: 32px; padding: 6px 9px; font-size: 12px; }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; flex: 0 0 36px; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; background: white; cursor: pointer; font-size: 20px; line-height: 1; }
.icon-btn.danger { color: var(--danger); }

.alert { margin-bottom: 18px; padding: 11px 13px; border: 1px solid #acd5c6; border-radius: 6px; color: #125b3d; background: var(--success-bg); font-size: 13px; }
.alert.warning { color: #754603; border-color: #e3c17c; background: var(--amber-bg); }
.alert.error { color: var(--danger); border-color: #e5aaa6; background: var(--danger-bg); }
.inline-alert { margin: 16px 0 0; }

.form-section, .data-section { margin-bottom: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.form-section { padding: 18px; }
.data-section { overflow: hidden; }
.section-heading { min-height: 34px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.data-section > .section-heading { margin: 0; padding: 16px 17px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin-bottom: 3px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.section-heading > span, .section-heading > a { color: var(--muted); font-size: 12px; font-weight: 700; }
.section-heading > a { color: var(--brand-dark); }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset:disabled { opacity: .78; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
label { display: block; margin-bottom: 6px; color: #37413f; font-size: 12px; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--ink); background: white; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(8,118,103,.11); }
input::placeholder, textarea::placeholder { color: #99a3a1; }
textarea { min-height: 88px; resize: vertical; }
input[type="checkbox"] { width: 17px; min-height: 17px; accent-color: var(--brand); }
input[type="file"] { padding: 7px; font-size: 12px; }
.form-grid small, .field-help { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.checkbox-field { display: flex; flex-direction: column; justify-content: center; min-height: 40px; }
.checkbox-field label { display: flex; align-items: center; gap: 8px; margin: 0; }
.field-note { align-self: end; min-height: 40px; display: flex; align-items: center; padding: 9px 11px; border-left: 3px solid #c6d1ce; color: var(--muted); background: var(--surface-alt); font-size: 12px; }
.calculated-field { min-height: 66px; display: flex; flex-direction: column; justify-content: center; padding: 8px 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-alt); }
.calculated-field span { color: var(--muted); font-size: 11px; }
.calculated-field strong { font-size: 17px; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 9px; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; padding: 13px; border: 1px solid var(--line); background: rgba(255,255,255,.96); }
.profile-summary { display: flex; gap: 10px; margin-top: 14px; padding: 10px 12px; border-left: 3px solid var(--brand); background: #f2f8f6; font-size: 13px; }
.profile-summary span { color: var(--muted); }
.asset-preview { width: 120px; height: 60px; display: block; margin-top: 8px; padding: 4px; border: 1px solid var(--line); object-fit: contain; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.cols-3-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { min-height: 126px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.stat > span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat > strong { display: block; margin: 9px 0 5px; font-size: 23px; line-height: 1.2; }
.stat small { display: block; font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 18px; }
.threshold-section, .deadline-section { padding: 0; }
.threshold-section .threshold-row { padding: 14px 17px; border-bottom: 1px solid var(--line); }
.threshold-section .threshold-row:last-child { border-bottom: 0; }
.threshold-row > div:first-child { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.threshold-row p, .threshold-row small { display: block; margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.progress { height: 7px; margin-top: 9px; overflow: hidden; border-radius: 4px; background: #e3e8e6; }
.progress span { height: 100%; display: block; border-radius: inherit; background: var(--brand); }
.deadline-section { padding-bottom: 17px; }
.deadline-section > :not(.section-heading) { margin-left: 17px; margin-right: 17px; }
.deadline-section time { display: block; margin-bottom: 5px; font-size: 28px; font-weight: 800; }
.deadline-section > strong { display: block; font-size: 14px; }
.deadline-section p { margin-top: 8px; color: var(--muted); font-size: 12px; }

.table-toolbar { min-height: 59px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.search-field { width: min(360px, 100%); margin: 0; }
.search-field input { min-height: 36px; }
.record-count { color: var(--muted); font-size: 12px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 12px; }
th { color: #4d5956; background: #f6f8f7; font-size: 11px; font-weight: 800; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfcfc; }
td small, td strong { display: block; }
td small { margin-top: 3px; font-size: 10px; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong-link { color: var(--brand-dark); font-weight: 800; }
.strong-link:hover { text-decoration: underline; }
.table-actions { min-width: 140px; text-align: right; white-space: nowrap; }
.table-actions .btn + .btn { margin-left: 4px; }
.empty-state { padding: 28px; color: var(--muted); text-align: center; }
.badge { min-height: 24px; display: inline-flex; align-items: center; padding: 3px 7px; border: 1px solid #cbd8d4; border-radius: 5px; color: #3d5b54; background: #f2f7f5; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge.ok { color: var(--success); border-color: #b5dac8; background: var(--success-bg); }
.badge.warn { color: var(--amber); border-color: #ead19b; background: var(--amber-bg); }
.badge.danger { color: var(--danger); border-color: #e6b2ae; background: var(--danger-bg); }

.filter-bar { display: flex; align-items: end; gap: 12px; margin-bottom: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.filter-bar > div { width: 190px; }
.definition-list { margin: 0; }
.definition-list > div { display: grid; grid-template-columns: 210px 1fr; gap: 15px; padding: 11px 17px; border-bottom: 1px solid var(--line); }
.definition-list > div:last-child { border-bottom: 0; }
.definition-list dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.definition-list dd { margin: 0; font-size: 13px; }
.calculation-line { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 17px; border-top: 1px solid var(--line); background: var(--surface-alt); }
.calculation-line strong { font-size: 18px; }
.text-danger { color: var(--danger); }

.export-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.export-tool .btn { width: 100%; }
.compliance-note .source-links { display: flex; flex-wrap: wrap; gap: 15px; margin: 0; padding: 13px 17px; border-top: 1px solid var(--line); }
.source-links a { color: var(--brand-dark); font-size: 12px; font-weight: 700; text-decoration: underline; }

.document-form { padding-bottom: 76px; }
.line-section { padding: 0; overflow: hidden; }
.line-section > .section-heading { margin: 0; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.line-table { min-width: 940px; table-layout: fixed; }
.line-table th:first-child { width: auto; }
.line-table .w-qty { width: 90px; }
.line-table .w-unit { width: 95px; }
.line-table .w-price { width: 145px; }
.line-table .w-vat { width: 90px; }
.line-table .w-total { width: 130px; }
.line-table .w-action { width: 52px; }
.line-table td { padding: 7px 5px; }
.line-table td:first-child { padding-left: 12px; }
.line-table td:last-child { padding-right: 12px; }
.line-table input, .line-table select { min-height: 35px; padding: 6px 7px; }
.line-total { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.document-summary { display: flex; justify-content: flex-end; padding: 17px; border-top: 1px solid var(--line); background: var(--surface-alt); }
.document-summary dl { width: min(370px, 100%); margin: 0; }
.document-summary dl > div { display: flex; justify-content: space-between; gap: 20px; padding: 5px 0; }
.document-summary dt { color: var(--muted); font-size: 12px; }
.document-summary dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.document-summary .grand-total { margin-top: 5px; padding-top: 10px; border-top: 1px solid var(--line-strong); }
.document-summary .grand-total dt, .document-summary .grand-total dd { color: var(--ink); font-size: 18px; font-weight: 800; }
.payment-fields { display: none; grid-template-columns: 1fr 1fr 2fr; gap: 14px; align-items: end; padding: 13px; border: 1px solid #e3c17c; border-radius: 6px; background: var(--amber-bg); }
.payment-fields.visible { display: grid; }
.payment-fields p { margin: 0 0 9px; color: #754603; font-size: 12px; }

.document-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.invoice-paper { width: 100%; max-width: 1000px; min-height: 1120px; margin: 0 auto 20px; padding: 40px 44px 30px; border: 1px solid var(--line); background: white; box-shadow: 0 8px 28px rgba(24,32,31,.08); }
.invoice-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; padding-bottom: 25px; border-bottom: 2px solid var(--ink); }
.invoice-brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.invoice-brand img { width: 132px; height: 64px; object-fit: contain; object-position: left center; }
.invoice-brand strong, .invoice-brand span { display: block; }
.invoice-brand strong { font-size: 18px; }
.invoice-brand span { color: var(--muted); font-size: 11px; }
.invoice-monogram { width: 58px; height: 58px; display: grid; place-items: center; color: white; background: var(--sidebar); font-size: 19px; font-weight: 800; }
.invoice-identity { text-align: right; }
.invoice-identity .invoice-title { margin: 0; font-size: 24px; font-weight: 300; }
.invoice-identity > strong { display: block; margin: 3px 0 8px; font-size: 16px; }
.invoice-meta-band { margin: 0 -44px; padding: 13px 44px; background: #f1f4f3; }
.invoice-meta-band dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 0; }
.invoice-meta-band dt { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.invoice-meta-band dd { margin: 3px 0 0; font-size: 12px; font-weight: 700; }
.correction-reference { margin: 18px 0 -4px; padding: 10px 12px; border-left: 3px solid var(--amber); background: var(--amber-bg); font-size: 11px; }
.correction-reference a { color: var(--brand-dark); text-decoration: underline; }
.invoice-parties { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 50px; padding: 27px 0; }
.invoice-parties h2, .invoice-payment h2, .invoice-notes h2 { margin-bottom: 9px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.invoice-parties strong { font-size: 13px; }
.invoice-parties p, .invoice-payment p, .invoice-notes p { margin: 5px 0 0; color: #4f5a57; font-size: 11px; line-height: 1.6; }
.invoice-lines { overflow: visible; }
.invoice-lines table { border: 0; }
.invoice-lines th { padding: 8px 7px; color: white; background: var(--sidebar); font-size: 9px; }
.invoice-lines td { padding: 10px 7px; font-size: 10px; }
.invoice-lines td:first-child, .invoice-lines th:first-child { width: 34px; text-align: center; }
.invoice-lines td small { margin-top: 1px; }
.invoice-closing { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 45px; padding-top: 22px; }
.exchange-note { padding: 7px 8px; border-left: 2px solid var(--line-strong); background: var(--surface-alt); }
.invoice-totals { margin: 0; }
.invoice-totals > div { display: flex; justify-content: space-between; gap: 20px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.invoice-totals dd { margin: 0; font-weight: 700; }
.invoice-totals .total { padding: 10px 0; border-bottom: 2px solid var(--ink); font-size: 16px; font-weight: 800; }
.invoice-notes { margin-top: 20px; padding: 12px; border: 1px solid var(--line); }
.invoice-footer { display: grid; grid-template-columns: 1fr 270px; gap: 35px; align-items: end; margin-top: 55px; padding-top: 16px; border-top: 1px solid var(--line); }
.invoice-footer p, .invoice-footer small { margin: 0; color: var(--muted); font-size: 9px; }
.signature-area { min-height: 82px; display: flex; align-items: end; justify-content: center; gap: 8px; position: relative; padding-bottom: 16px; border-bottom: 1px solid var(--line-strong); }
.signature-area img { max-width: 100px; max-height: 55px; object-fit: contain; }
.signature-area span { position: absolute; bottom: -15px; color: var(--muted); font-size: 9px; }
.related-documents, .correction-tool { max-width: 1000px; margin-left: auto; margin-right: auto; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: #e9eeec; }
.auth-card { width: min(430px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 7px; background: white; box-shadow: 0 14px 45px rgba(24,32,31,.11); }
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 25px; }
.auth-brand > span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 7px; color: white; background: var(--sidebar); font-weight: 800; }
.auth-brand h1 { margin: 0; font-size: 20px; }
.auth-brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.auth-card .btn { width: 100%; }
.account-form { max-width: 720px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.no-print { print-color-adjust: exact; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .export-grid { grid-template-columns: 1fr; }
  .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.cols-4 .span-3, .form-grid.cols-4 .span-4 { grid-column: span 2; }
  .invoice-paper { padding-left: 32px; padding-right: 32px; }
  .invoice-meta-band { margin-left: -32px; margin-right: -32px; padding-left: 32px; padding-right: 32px; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); width: 244px; transition: transform .2s ease; box-shadow: 10px 0 30px rgba(0,0,0,.2); }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open::after { content: ""; position: fixed; inset: 0; z-index: 25; background: rgba(10,20,18,.42); }
  .menu-toggle { display: inline-grid !important; }
  .topbar { padding: 9px 14px; }
  .company-context { flex: 1; }
  .company-context > span { display: none; }
  .company-context select { width: 100%; min-width: 0; }
  .top-actions .btn:first-child { display: none; }
  .content { padding: 19px 14px 40px; }
  .page-heading { align-items: stretch; }
  .page-heading > .btn { align-self: flex-start; }
  .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.cols-3 .span-3, .form-grid.cols-4 .span-3, .form-grid.cols-4 .span-4 { grid-column: span 2; }
  .invoice-paper { min-height: 0; padding: 26px 24px; }
  .invoice-meta-band { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
  .invoice-meta-band dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-parties { gap: 25px; }
  .invoice-closing { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 560px) {
  h1 { font-size: 22px; }
  .top-actions .btn { padding-left: 9px; padding-right: 9px; }
  .page-heading { flex-direction: column; gap: 12px; }
  .stats-grid, .cols-3-stats { grid-template-columns: 1fr; }
  .stat { min-height: 105px; }
  .form-grid, .form-grid.cols-2, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4, .form-grid.cols-3 .span-3, .form-grid.cols-4 .span-3, .form-grid.cols-4 .span-4 { grid-column: span 1; }
  .form-section { padding: 14px; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1; }
  .payment-fields.visible { grid-template-columns: 1fr; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-bar > div { width: 100%; }
  .definition-list > div { grid-template-columns: 1fr; gap: 4px; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .invoice-paper { padding: 20px 16px; }
  .invoice-header { flex-direction: column; }
  .invoice-identity { width: 100%; text-align: left; }
  .invoice-meta-band { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .invoice-parties, .invoice-footer { grid-template-columns: 1fr; gap: 20px; }
  .invoice-lines { overflow-x: auto; }
  .invoice-lines table { min-width: 720px; }
  .invoice-footer { margin-top: 30px; }
}

@page { size: A4; margin: 10mm; }
@media print {
  body { background: white; }
  .sidebar, .topbar, .no-print { display: none !important; }
  .app-shell, .main { display: block; min-height: 0; }
  .content { max-width: none; padding: 0; }
  .invoice-paper { width: 100%; max-width: none; min-height: 0; margin: 0; padding: 0; border: 0; box-shadow: none; }
  .invoice-meta-band { margin-left: -10mm; margin-right: -10mm; padding-left: 10mm; padding-right: 10mm; }
  .invoice-lines table { min-width: 0; }
  .invoice-lines thead { display: table-header-group; }
  .invoice-lines tr { break-inside: avoid; }
  a { text-decoration: none !important; }
}
