:root {
  color-scheme: light;
  --ink: #20213d;
  --muted: #596078;
  --line: #e2e4ee;
  --surface: #fff;
  --background: #f6f7fb;
  --accent: #393579;
  --accent-dark: #2c2861;
  --accent-subtle: #eeedf8;
  --shadow: 0 1px 2px #211d4208, 0 5px 16px #211d4205;
  font-family: "Inter", "Aptos", "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button,input,select,textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
:focus-visible { outline: 2px solid #675ac8; outline-offset: 3px; }
h1,h2,h3,p,dl,dd { margin: 0; }
h1 { font-size: clamp(1.72rem, 4vw, 2.48rem); letter-spacing: -.055em; line-height: 1.1; }
h2 { font-size: 1.05rem; letter-spacing: -.025em; line-height: 1.3; }
h3 { font-size: 1rem; letter-spacing: -.012em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); font-size: .88rem; line-height: 1.55; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ui-icon { width: 18px; height: 18px; position: relative; display: inline-block; flex: none; }
.ui-icon::before,.ui-icon::after { content: ""; position: absolute; }
.icon-all::before,.icon-drafts::before { inset: 1px 3px; border: 1.5px solid; border-radius: 3px; }
.icon-all::after { left: 6px; top: 6px; width: 6px; height: 4px; border-block: 1.5px solid; }
.icon-drafts::after { width: 7px; height: 3px; border-bottom: 1.6px solid; transform: rotate(-43deg); top: 8px; left: 6px; }
.icon-inbox::before { inset: 2px; border: 1.5px solid; border-radius: 4px; }
.icon-inbox::after,.icon-done::after { width: 6px; height: 3px; border: solid; border-width: 0 0 1.5px 1.5px; transform: rotate(-45deg); top: 6px; left: 5.5px; }
.icon-done::before { inset: 1px; border: 1.5px solid; border-radius: 50%; }
.icon-search::before { width: 8px; height: 8px; top: 1px; left: 1px; border: 1.5px solid; border-radius: 50%; }
.icon-search::after { width: 5px; border-top: 1.5px solid; transform: rotate(45deg); left: 10px; top: 12px; }
.sidebar {
  position: fixed; z-index: 2; inset: 0 auto 0 0; width: 230px;
  background: white; border-right: 1px solid var(--line); padding: 24px 15px 17px;
  display: flex; flex-direction: column;
}
.sidebar-top { padding: 0 8px; }
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 36px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 43px; height: 43px; padding: 2px; object-fit: contain; background: white; border-radius: 50%; flex: none; }
.brand strong { display: block; font-size: 1.12rem; line-height: 1.13; letter-spacing: -.03em; }
.brand small { display: block; color: var(--muted); font-size: .72rem; font-weight: 650; margin-top: 3px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-link { position: relative; display: flex; gap: 12px; align-items: center; min-height: 46px; padding: 10px 13px; border-radius: 9px; color: #545b75; font-size: .88rem; font-weight: 630; }
.nav-link:hover,.nav-link.active { background: var(--accent-subtle); color: var(--accent-dark); text-decoration: none; }
.nav-link.active { font-weight: 760; }
.nav-link b { margin-left: auto; color: white; background: var(--accent); border-radius: 999px; padding: 1px 7px; font-size: .71rem; }
.nav-mobile-name,.mobile-account,.mobile-currency { display: none; }
.sidebar-foot { margin-top: auto; padding: 16px 3px 1px; display: flex; align-items: center; gap: 9px; border-top: 1px solid var(--line); }
.avatar { font-size: .75rem; font-weight: 780; background: var(--accent-subtle); color: var(--accent); display: grid; place-items: center; border-radius: 50%; width: 35px; height: 35px; flex: none; }
.sidebar-foot div { min-width: 0; }
.sidebar-foot strong,.sidebar-foot small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot strong { font-size: .8rem; }
.sidebar-foot small { font-size: .69rem; color: var(--muted); margin-top: 3px; }
main { margin-left: 230px; min-height: 100vh; min-width: 0; }
.topbar { min-height: 66px; padding: 0 clamp(20px,4vw,48px); border-bottom: 1px solid var(--line); background: white; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: .85rem; }
.crumb,.slash { color: var(--muted); }
.slash { margin: 0 10px; }
.private { display: inline-flex; align-items: center; gap: 7px; color: #3d6158; font-size: .77rem; font-weight: 650; white-space: nowrap; }
.account-controls { display: flex; align-items: center; gap: 12px; }
.private i,.badge i { width: 7px; height: 7px; border-radius: 99px; background: #20826a; flex: none; }
.content { max-width: 1480px; margin: 0 auto; padding: 28px clamp(20px,4vw,48px) 46px; }
.hero {
  position: relative; isolation: isolate; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 20px; overflow: hidden; min-height: 165px; padding: clamp(22px,4vw,36px);
  background: linear-gradient(106deg,#fbfaff,#eeedf9);
  border: 1px solid #e5e3f1; border-radius: 16px;
}
.hero::before {
  position: absolute; z-index: -1; right: -80px; top: -138px; width: 360px; aspect-ratio: 1;
  border: 1px solid #dbd7ef; border-radius: 50%; content: "";
  box-shadow: 0 0 0 24px #ebe8f800, 0 0 0 25px #e2dff2, 0 0 0 52px #ebe8f800, 0 0 0 53px #e6e2f4;
}
.hero h1 { font-size: clamp(2rem,4vw,3rem); }
.hero p { color: #4f5272; margin-top: 8px; font-size: .95rem; line-height: 1.5; }
.hero-brand,.heading-brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.hero-logo,.heading-logo { flex: none; object-fit: contain; border-radius: 50%; background: white; }
.hero-logo { width: clamp(52px,9vw,80px); height: clamp(52px,9vw,80px); padding: 5px; border: 1px solid #e1dfed; box-shadow: var(--shadow); }
.heading-logo { width: 52px; height: 52px; padding: 4px; border: 1px solid var(--line); }
.button { min-height: 44px; padding: 9px 15px; border-radius: 8px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: .86rem; font-weight: 720; text-align: center; line-height: 1.2; }
.button:hover { text-decoration: none; }
.primary { background: var(--accent); color: white; box-shadow: 0 1px 2px #201d3933; }
.primary:hover { background: var(--accent-dark); }
.secondary { background: white; border-color: #dcdce9; color: var(--accent-dark); }
.secondary:hover { background: #f5f4fa; }
.hero-button { white-space: nowrap; }
.hero-button span,.entry-summary button span { font-size: 1.25rem; line-height: .85; font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; margin: 17px 0 24px; }
.stat,.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); min-width: 0; }
.stat { min-height: 92px; display: flex; align-items: center; gap: 12px; padding: 14px; }
.stat:hover { border-color: #c4bfe4; text-decoration: none; }
.stat-icon,.file-icon,.empty-icon { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 10px; flex: none; }
.stat-icon,.file-icon,.empty-icon { color: var(--accent); background: var(--accent-subtle); }
.stat-icon.inbox { color: #855918; background: #fcf2df; }
.stat-icon.drafts { color: #50627d; background: #edf0f6; }
.stat-icon.done { color: #26715e; background: #e6f4ef; }
.stat strong { display: block; font-size: 1.48rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat div span { display: block; color: var(--muted); font-size: .77rem; line-height: 1.3; margin-top: 5px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 17px 21px; border-bottom: 1px solid var(--line); }
.filters { display: flex; flex-wrap: wrap; gap: 9px; min-width: 0; }
input,select,textarea { color: var(--ink); background: white; border: 1px solid #d7dae7; border-radius: 8px; min-height: 44px; padding: 9px 11px; font-size: .9rem; width: 100%; min-width: 0; }
input:focus,select:focus,textarea:focus { border-color: #7870b9; }
input::placeholder,textarea::placeholder { color: #777e92; }
select { padding-right: 26px; }
textarea { resize: vertical; }
.search { display: flex; align-items: center; position: relative; }
.search .ui-icon { position: absolute; left: 11px; color: #656981; pointer-events: none; }
.search input { padding-left: 35px; width: 205px; }
.filters select { max-width: 260px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .86rem; }
th { font-size: .76rem; color: #525b76; white-space: nowrap; font-weight: 740; }
.table-scroll { overflow-x: auto; }
.table-scroll th,.table-scroll td { padding: 13px 15px; border-bottom: 1px solid var(--line); }
.table-scroll th { background: #f8f8fc; }
.table-scroll td:first-child { min-width: 145px; }
.table-scroll tbody tr:last-child td { border-bottom: 0; }
.table-scroll tbody tr:hover { background: #faf9ff; }
.table-scroll td small { display: block; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.voucher-link { color: var(--accent); font-weight: 760; white-space: nowrap; }
.row-open { display: inline-grid; place-items: center; min-width: 36px; height: 36px; font-size: 1.1rem; color: var(--accent); border-radius: 8px; }
.row-open:hover { text-decoration: none; background: var(--accent-subtle); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; white-space: nowrap; font-size: .73rem; font-weight: 720; background: #eceef4; color: #4f5970; }
.badge i { background: currentColor; width: 6px; height: 6px; }
.badge.complete { background: #e6f4ef; color: #19614e; }
.badge.pending { background: #fbf0db; color: #795018; }
.badge.returned { background: #fae9e7; color: #8e392d; }
.empty { padding: clamp(35px,7vw,65px) 16px; text-align: center; }
.empty-icon { width: 50px; height: 50px; margin: 0 auto 14px; }
.empty p { font-size: .88rem; color: var(--muted); margin: 7px auto 0; max-width: 39ch; line-height: 1.45; }
.back { display: inline-flex; align-items: center; min-height: 38px; color: var(--accent); font-size: .85rem; font-weight: 680; margin: 0 0 9px; }
.page-heading { display: flex; flex-wrap: wrap; gap: 15px; align-items: flex-end; justify-content: space-between; margin-bottom: 21px; }
.page-heading p { color: var(--muted); font-size: .9rem; margin-top: 7px; line-height: 1.5; }
.page-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.editor-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(246px,308px); gap: 17px; align-items: start; }
.editor-layout > div { min-width: 0; }
.form-section { padding: 21px; margin-bottom: 15px; }
.form-section h2 { margin-bottom: 15px; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field { min-width: 0; display: grid; align-content: start; gap: 6px; }
.field > span { color: #424762; font-size: .79rem; font-weight: 710; }
.entry-grid { container-type: inline-size; display: grid; gap: 9px; }
.entry-row {
  position: relative; display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr) auto; align-items: end;
  gap: 9px; min-width: 0; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafafd;
}
.entry-grid[data-count="2"] .entry-row { grid-template-columns: minmax(0,2fr) repeat(2,minmax(0,1fr)) auto; }
.entry-grid[data-count="5"] .entry-row { grid-template-columns: repeat(5,minmax(0,1fr)); }
.entry-grid[data-count="5"] .entry-label { grid-column: 1 / -1; padding-right: 53px; }
.entry-grid[data-count="5"] .remove-entry { position: absolute; right: 8px; top: 11px; }
.entry-summary { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 8px; }
.entry-totals { display: flex; gap: 13px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; max-width: 100%; }
.entry-totals div { display: grid; gap: 3px; text-align: right; }
.entry-totals dt { color: var(--muted); font-size: .71rem; font-weight: 650; }
.entry-totals dd { color: var(--ink); font-size: .89rem; font-weight: 770; overflow-wrap: anywhere; }
.icon-button { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; border: 0; padding: 5px; background: transparent; color: #66647c; border-radius: 8px; font-size: 1.3rem; line-height: 1; }
.icon-button:hover { background: #faeaea; color: #892f29; }
.text-button { display: inline-flex; gap: 5px; align-items: center; min-height: 42px; border: 0; background: transparent; color: var(--accent); font-weight: 720; font-size: .84rem; padding: 7px 4px; }
.text-button:hover { text-decoration: underline; }
.amount-words { display: grid; gap: 4px; font-size: .85rem; padding-top: 14px; }
.amount-words span { color: var(--muted); }
.route { display: grid; list-style: none; padding: 0; margin: 15px 0 0; gap: 15px; }
.route li { display: flex; align-items: flex-start; gap: 10px; position: relative; }
.route li:not(:last-child)::after { position: absolute; left: 13px; top: 31px; bottom: -12px; border-left: 1px solid #dedbef; content: ""; }
.route li > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.route strong,.route small { display: block; }
.route strong { font-size: .85rem; }
.route small { color: var(--muted); font-size: .76rem; margin-top: 4px; line-height: 1.35; }
.guest-preparer { display: grid; gap: 9px; margin-top: 8px; }
.route-dot { display: grid; place-items: center; border-radius: 50%; width: 28px; height: 28px; background: var(--accent-subtle); color: var(--accent); font-size: .75rem; font-weight: 780; flex: none; }
.route-dot.done { background: #e4f4ee; color: #216c5a; }
.route-dot.current { background: var(--accent-subtle); color: var(--accent-dark); outline: 2px solid #aea5dd; outline-offset: 1px; }
.file-list { display: grid; gap: 7px; list-style: none; padding: 0; margin: 0 0 8px; }
.file-list li { display: flex; align-items: center; gap: 8px; padding: 7px; border: 1px solid var(--line); border-radius: 9px; font-size: .84rem; }
.file-list li > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.file-list a { color: var(--accent); }
.file-list small { display: block; color: var(--muted); margin-top: 3px; }
.upload-zone { margin-top: 12px; position: relative; border: 1px dashed #aea8cf; border-radius: 10px; background: #f9f8fd; color: var(--accent); display: grid; justify-items: center; gap: 4px; padding: 15px; font-size: .87rem; cursor: pointer; }
.upload-zone:hover,.upload-zone:focus-within { background: var(--accent-subtle); border-color: var(--accent); }
.upload-zone span { font-size: 1.2rem; }
.upload-zone small { color: var(--muted); }
.upload-zone input { opacity: 0; position: absolute; inset: 0; height: 100%; cursor: pointer; }
.editor-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0 0; }
.editor-actions > div,.dialog-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-left: auto; }
#form-error,.decision-error { font-size: .85rem; color: #8f3228; line-height: 1.4; }
#form-error:empty,.decision-error:empty { display: none; }
.detail-status { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; margin: -5px 0 14px; color: var(--muted); font-size: .85rem; }
.review { margin-top: 15px; border-top: 1px solid var(--line); padding-top: 13px; }
.review p { font-size: .85rem; line-height: 1.45; margin-bottom: 9px; }
.return { display: block; margin-top: 4px; color: #8a3530; }
.events { list-style: none; padding: 0; margin: 0; display: grid; gap: 11px; }
.events li { padding: 0 0 9px 10px; border-left: 2px solid #e3e0f0; font-size: .84rem; overflow-wrap: anywhere; }
.events li small { display: block; color: var(--muted); margin-top: 3px; }
.events p { margin-top: 5px; white-space: pre-wrap; }
.sign-in-panel { padding: clamp(23px,6vw,52px); max-width: 640px; }
.sign-in-panel p { color: var(--muted); max-width: 46ch; margin: 12px 0 18px; line-height: 1.5; }
.loading { max-width: 500px; margin: 14vh auto 0; padding: 25px; text-align: center; }
.loading p { margin: 14px 0; color: var(--muted); }
#notice { position: fixed; z-index: 4; right: 20px; bottom: 20px; padding: 12px 16px; border-radius: 8px; background: #284b40; color: white; max-width: min(90vw,440px); display: none; box-shadow: 0 8px 28px #19163225; }
#notice.visible { display: block; }
#notice.error { background: #79332d; }
dialog { width: min(450px,92vw); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 40px #17133044; padding: 22px; color: var(--ink); }
dialog::backdrop { background: #17153280; }
dialog p { margin: 9px 0 13px; color: var(--muted); font-size: .89rem; line-height: 1.5; }
.dialog-actions { justify-content: end; margin-top: 13px; }
.voucher-paper {
  --paper-accent: #302b65;
  --paper-rule: #e2e2ec;
  --paper-soft: #f6f5fb;
  --paper-muted: #525970;
  background: #fff;
  border: 1px solid var(--paper-rule);
  border-radius: 16px;
  box-shadow: 0 4px 24px #211d4208;
  padding: clamp(19px, 3vw, 33px);
  margin-bottom: 16px;
  color: #22243b;
}
.paper-industries { --paper-accent: #413766; --paper-soft: #f7f5fa; }
.paper-heading { display: grid; gap: 22px; }
.paper-company { display: flex; align-items: center; gap: 12px; min-width: 0; }
.paper-company strong { display: block; font-size: .96rem; color: var(--paper-accent); overflow-wrap: anywhere; }
.paper-company small { display: block; margin-top: 4px; color: var(--paper-muted); font-size: .74rem; }
.paper-logo { width: 52px; height: 52px; flex: none; object-fit: contain; }
.paper-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--paper-accent); padding-bottom: 13px; }
.paper-title h2 { font-size: clamp(1.26rem, 2.5vw, 2.14rem); letter-spacing: -.04em; line-height: 1.08; color: var(--paper-accent); }
.paper-status { color: #7e322b; border: 1px solid #e9ccc7; background: #fcf5f3; border-radius: 999px; padding: 5px 9px; font-size: .72rem; font-weight: 710; flex: none; }
.paper-status.is-approved { color: #1e6151; border-color: #bedbd1; background: #eef7f3; }
.paper-meta,.paper-facts,.paper-notes { display: grid; gap: 12px 18px; }
.paper-meta {
  grid-template-columns: minmax(0,1.18fr) minmax(0,.9fr) minmax(0,1fr);
  align-items: center;
  margin: 17px 0 21px;
  padding: 13px 16px;
  background: var(--paper-soft);
  border: 1px solid var(--paper-rule);
  border-radius: 10px;
}
.paper-fact { min-width: 0; margin: 0; }
.paper-fact dt { color: var(--paper-muted); font-size: .72rem; font-weight: 680; line-height: 1.4; margin-bottom: 4px; }
.paper-fact dd { font-size: .86rem; color: inherit; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.44; }
.paper-meta dd { color: var(--paper-accent); font-weight: 730; font-variant-numeric: tabular-nums; }
.paper-amount { text-align: right; }
.paper-amount dd { font-size: clamp(1.1rem, 2.7vw, 1.58rem); letter-spacing: -.03em; line-height: 1.1; }
.paper-body { display: grid; gap: 19px; }
.paper-facts { grid-template-columns: repeat(2,minmax(0,1fr)); padding-bottom: 13px; border-bottom: 1px solid var(--paper-rule); }
.paper-section h3 { color: var(--paper-accent); margin-bottom: 8px; font-size: .91rem; }
.paper-empty { padding: 10px 12px; background: var(--paper-soft); border: 1px solid var(--paper-rule); border-radius: 7px; color: var(--paper-muted); font-size: .8rem; }
.paper-notes { padding: 13px 14px; background: var(--paper-soft); border: 1px solid var(--paper-rule); border-radius: 9px; }
.print-table { table-layout: fixed; font-size: .82rem; border-collapse: collapse; }
.print-table th,.print-table td { border-bottom: 1px solid var(--paper-rule); padding: 8px 9px; white-space: normal; overflow-wrap: anywhere; }
.print-table thead th { background: var(--paper-soft); color: var(--paper-accent); font-weight: 720; }
.print-table thead th:first-child { width: 55%; border-radius: 6px 0 0; }
.print-table thead th:last-child { border-radius: 0 6px 0 0; }
.print-table tfoot th,.print-table tfoot td { border-top: 1px solid #aaa7c3; color: var(--paper-accent); border-bottom: 0; font-weight: 740; }
.allocation-table thead th { font-size: .69rem; }
.allocation-table thead th:first-child { width: 24%; }
.allocation-label { display: none; }
.paper-signoffs { margin-top: 22px; border-top: 1px solid var(--paper-rule); padding-top: 13px; }
.signatures { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,95px),1fr)); gap: 8px; }
.signature {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 79px;
  padding: 8px 9px 10px;
  border: 1px solid var(--paper-rule);
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.signature-role { color: var(--paper-accent); font-size: .72rem; font-weight: 720; margin-bottom: 7px; }
.signature strong { font-size: .76rem; line-height: 1.32; }
.signature small { color: var(--paper-muted); font-size: .64rem; line-height: 1.45; margin-top: 3px; }
.blank-signature { width: 100%; height: 22px; margin-top: auto; border-bottom: 1px solid #9694a6; }
@container (max-width: 480px) {
  .entry-grid[data-count="5"] .entry-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@container (max-width: 390px) {
  .entry-grid:not([data-count="5"]) .entry-row { grid-template-columns: minmax(0,1fr); }
  .entry-grid[data-count="2"] .entry-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .entry-grid:not([data-count="5"]) .entry-label { grid-column: 1 / -1; padding-right: 53px; }
  .entry-grid:not([data-count="5"]) .remove-entry { position: absolute; right: 8px; top: 11px; }
}
@media screen and (max-width: 1170px) {
  .sidebar { width: 198px; }
  main { margin-left: 198px; }
  .editor-layout { grid-template-columns: minmax(0,1fr) minmax(228px,265px); gap: 13px; }
  .form-section { padding: 16px; }
  .stat { padding: 11px; gap: 8px; }
}
@media screen and (max-width: 960px) {
  .editor-layout { grid-template-columns: 1fr; }
  .detail-layout { gap: 0; }
}
@media screen and (max-width: 850px) {
  .sidebar { position: static; width: auto; padding: env(safe-area-inset-top) max(14px,env(safe-area-inset-right)) 0 max(14px,env(safe-area-inset-left)); border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0 8px; }
  .brand { margin: 0; gap: 8px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand strong { font-size: 1rem; }
  .brand small { font-size: .67rem; }
  .sidebar nav { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; }
  .nav-link { justify-content: center; gap: 5px; padding: 8px 4px; border-radius: 9px 9px 0 0; border-bottom: 2px solid transparent; min-height: 47px; }
  .nav-link.active { border-bottom-color: var(--accent); }
  .nav-link b { margin-left: 0; }
  .nav-desktop-name,.sidebar-foot,.topbar { display: none; }
  .nav-mobile-name,.mobile-account { display: block; }
  .mobile-account .button { font-size: .78rem; min-height: 42px; padding: 7px 10px; white-space: nowrap; }
  .mobile-account .private { display: none; }
  main { margin: 0; }
  .content { padding: 19px max(15px,env(safe-area-inset-right)) 28px max(15px,env(safe-area-inset-left)); }
  .hero { min-height: 0; }
  .button,.text-button,.row-open { min-height: 44px; }
}
@media screen and (max-width: 640px) {
  .hero { padding: 20px 17px; gap: 16px; border-radius: 13px; }
  .hero-brand { gap: 10px; }
  .hero h1 { font-size: 1.87rem; }
  .hero p { font-size: .82rem; margin-top: 5px; }
  .hero-button { width: 100%; }
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 12px 0 17px; }
  .stat { min-height: 68px; }
  .stat-icon { width: 34px; height: 34px; }
  .stat strong { font-size: 1.22rem; }
  .stat div span { font-size: .72rem; }
  .panel-head { padding: 14px; gap: 10px; }
  .filters { display: grid; grid-template-columns: minmax(0,1fr); width: 100%; }
  .search input,.filters select { width: 100%; max-width: none; }
  .table-scroll { overflow: visible; }
  .table-scroll table,.table-scroll tbody { display: block; }
  .table-scroll thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-scroll tr { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; column-gap: 7px; row-gap: 5px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
  .table-scroll tbody tr:last-child { border-bottom: 0; }
  .table-scroll td,.table-scroll td:first-child { padding: 0; border: 0; min-width: 0; }
  .row-reference { grid-row: 1 / 3; grid-column: 1; }
  .row-status { grid-row: 1; grid-column: 2; justify-self: end; }
  .row-amount { grid-row: 2; grid-column: 2; font-weight: 760; overflow-wrap: anywhere; }
  .row-company { grid-column: 1 / -1; margin-top: 3px; overflow-wrap: anywhere; }
  .row-date { grid-column: 1 / -1; color: var(--muted); font-size: .76rem; }
  .table-scroll td.row-arrow { display: none; }
  .mobile-currency { display: inline; font-size: .71rem; color: var(--muted); }
  .voucher-link { display: inline-block; padding: 5px 0; }
  .table-scroll td small { margin-top: 0; font-size: .76rem; }
  .page-heading { margin-bottom: 16px; gap: 11px; }
  .page-heading h1 { overflow-wrap: anywhere; font-size: 1.66rem; }
  .page-buttons { width: 100%; }
  .page-buttons .button { flex: 1 1 130px; }
  .heading-brand { gap: 10px; }
  .heading-logo { width: 43px; height: 43px; }
  .heading-brand p { font-size: .81rem; line-height: 1.4; }
  .field-grid { grid-template-columns: minmax(0,1fr); gap: 12px; }
  input,select,textarea { font-size: 1rem; min-height: 46px; }
  input[type="date"] { min-width: 0; max-width: 100%; }
  .editor-actions { position: sticky; z-index: 1; bottom: 0; margin-inline: -4px; padding: 9px 7px max(9px,env(safe-area-inset-bottom)); background: #fff; border: 1px solid var(--line); border-radius: 10px 10px 0 0; box-shadow: 0 -4px 20px #211d4212; }
  .editor-actions > div { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.55fr); width: 100%; }
  .editor-actions .button { padding-inline: 6px; min-height: 46px; }
  #notice { inset: auto 14px 14px; max-width: none; }
  body:has(#voucher-form) #notice { bottom: 77px; }
  .voucher-paper { padding: 16px; }
  .paper-heading { gap: 17px; }
  .paper-meta { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 10px 11px; }
  .paper-amount { grid-column: 1 / -1; text-align: left; border-top: 1px solid var(--paper-rule); padding-top: 8px; }
  .paper-body { gap: 15px; }
  .paper-company strong { font-size: .86rem; }
  .paper-logo { width: 44px; height: 44px; }
  .paper-status { padding: 4px 5px; font-size: .64rem; }
  .allocation-table,.allocation-table tbody,.allocation-table tfoot { display: block; }
  .allocation-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .allocation-table tr { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); border-bottom: 1px solid var(--paper-rule); }
  .allocation-table td,.allocation-table tfoot th { border: 0; padding: 6px 5px; text-align: left; }
  .allocation-table tr > :first-child { grid-column: 1 / -1; font-weight: 720; }
  .allocation-label { display: block; color: var(--paper-muted); font-size: .68rem; line-height: 1.3; margin-bottom: 2px; }
  .allocation-table tfoot { background: var(--paper-soft); margin-top: 5px; border-radius: 6px; padding: 4px; }
  .allocation-table tfoot tr { border: 0; }
  .signatures { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media screen and (max-width: 420px) {
  .nav-link { flex-direction: column; font-size: .73rem; min-height: 51px; }
  .nav-link b { position: absolute; inset: 3px 5px auto auto; }
  .content { padding-top: 13px; }
  .form-section { padding: 13px; }
  .entry-row { padding: 8px; gap: 8px; }
  .entry-grid[data-count="5"] .entry-totals { width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .entry-grid[data-count="5"] .entry-totals div { text-align: left; }
  .entry-grid[data-count="5"] .entry-totals dd { text-align: left; }
}

@page { size: A4 landscape; margin: 13mm; }
.pdf-staging { position: fixed; width: 297mm; height: 210mm; inset: 0 auto auto -12000px; pointer-events: none; border: 0; }
.full-field { grid-column: 1 / -1; }
.icon-staff::before { inset: 2px 6px 9px; border: 1.5px solid; border-radius: 50%; }
.icon-staff::after { inset: 10px 3px 1px; border: 1.5px solid; border-radius: 5px 5px 2px 2px; }
.badge.rejected { background: #fae9e7; color: #8e392d; }
.review-actions { display: flex; flex-wrap: wrap; gap: 6px 9px; }
.danger-text { color: #8f3228; }
.query-note { overflow-wrap: anywhere; white-space: pre-wrap; color: var(--ink); margin-bottom: 12px; }
#accounting-form > .button { margin-top: 10px; }
.accounting-inputs { margin-bottom: 10px; }
#accounting-error,#staff-error { margin-top: 7px; font-size: .85rem; color: #8f3228; }
.staff-layout { grid-template-columns: minmax(0, 1fr) minmax(290px, 390px); }
.staff-list { list-style: none; margin: 0; padding: 0; }
.staff-list li { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.staff-list li:last-child { border-bottom: 0; }
.staff-list li > div:last-child { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.staff-list small { display: block; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.staff-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.staff-tags span { font-size: .73rem; color: var(--accent); background: var(--accent-subtle); padding: 4px 6px; border-radius: 5px; }
#staff-form { display: grid; gap: 12px; }
.admin-login { max-width: 515px; }
#admin-login-form { display: grid; gap: 13px; }
#admin-login-form button { justify-self: start; }
#admin-login-error { color: #8f3228; margin: 0; font-size: .85rem; }
#admin-login-error:empty { display: none; }
.admin-login > .text-button { margin-top: 6px; }
.staff-assignment-list { display: grid; gap: 10px; }
.staff-assignment-list fieldset { min-width: 0; margin: 0; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
.staff-assignment-list legend { font-size: .82rem; font-weight: 710; padding-inline: 5px; }
.check-option { display: flex; align-items: center; gap: 9px; min-height: 40px; cursor: pointer; font-size: .86rem; }
.check-option input { width: 18px; min-height: 18px; accent-color: var(--accent); }
.staff-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
@media screen and (max-width: 960px) { .staff-layout { grid-template-columns: 1fr; } }
@media screen and (max-width: 850px) { .sidebar nav.with-admin { grid-template-columns: repeat(5,minmax(0,1fr)); } }
@media screen and (max-width: 360px) { .with-admin .nav-link { font-size: .65rem; } }
@media print {
  :root,body { background: #fff; color: #000; }
  body:not(:has(#print-voucher)) #app { display: none; }
  #print-voucher { width: 100%; padding: 0; background: white; border: 0; border-radius: 0; box-shadow: none; margin: 0; }
  .detail-layout { display: block; }
  .paper-heading { grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 16pt; border-bottom: 2pt solid var(--paper-accent); padding-bottom: 9pt; break-inside: avoid; }
  .paper-logo { width: 38pt; height: 38pt; }
  .paper-company strong { font-size: 11pt; }
  .paper-company small { font-size: 8pt; }
  .paper-title { border: 0; padding: 0; }
  .paper-title h2 { font-size: 18pt; }
  .paper-meta { margin: 8pt 0 9pt; padding: 6pt 9pt; }
  .paper-meta,.paper-status,.paper-notes,.print-table thead th { print-color-adjust: exact; }
  .paper-fact dt { font-size: 8pt; }
  .paper-fact dd { font-size: 10pt; }
  .paper-amount dd { font-size: 15pt; }
  .paper-body { display: block; }
  .paper-body > * { margin-bottom: 7pt; }
  .paper-facts { padding-bottom: 8pt; }
  .paper-notes { padding: 8pt 9pt; }
  .paper-section h3 { font-size: 10pt; margin-bottom: 5pt; break-after: avoid; }
  .print-table { font-size: 9pt; }
  .print-table th,.print-table td { padding: 3pt 6pt; border-color: #a8a8b4; }
  .print-table thead { display: table-header-group; }
  .print-table tfoot { display: table-row-group; }
  .print-table tr,.paper-meta,.paper-fact,.paper-signoffs { break-inside: avoid; }
  .paper-signoffs { margin-top: 8pt; padding-top: 6pt; }
  .signatures { grid-template-columns: repeat(auto-fit,minmax(102pt,1fr)); gap: 7pt; }
  .signature { min-height: 57pt; max-width: 168pt; padding: 5pt 7pt; }
  .signature-role,.signature small { font-size: 8pt; }
  .signature strong { font-size: 9pt; }
  .blank-signature { min-height: 16pt; }
  .sidebar,.topbar,.back,.page-heading,.detail-status,.detail-layout > div:nth-child(2),.form-section,#notice,dialog { display: none !important; }
  .content,main { margin: 0; padding: 0; min-height: 0; }
}


