:root {
  color-scheme: light;
  --white: #fff;
  --canvas: #f4f8ff;
  --ink: #172a45;
  --muted: #52647e;
  --blue: #3974c5;
  --blue-strong: #3264b1;
  --blue-dark: #214e90;
  --soft: #edf4fe;
  --wash: #f7faff;
  --line: #e0e9f4;
  --control-line: #c9d7e9;
  --rail: #182b47;
  --rail-hover: #223b5b;
  --rail-active: #2b4a75;
  --rail-ink: #dbe8fa;
  --rail-accent: #dbeaff;
  --green: #245e48;
  --red: #9c2537;
  --radius: 14px;
  --top-height: 74px;
  --phone-nav-height: 65px;
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.05rem, 3.2vw, 2.8rem); line-height: 1.08; letter-spacing: -.052em; font-weight: 780; }
h2 { font-size: 1.25rem; line-height: 1.25; letter-spacing: -.027em; }
h3 { font-size: 1rem; }
a { color: var(--blue-dark); }
button, input, select, textarea { font: inherit; }
button, a, summary { touch-action: manipulation; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #457ece; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; white-space: nowrap; clip-path: inset(50%); }
.muted { color: var(--muted); font-size: .88rem; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 44px; padding: .56rem .9rem; border: 1px solid var(--control-line); border-radius: 9px;
  background: var(--white); color: var(--ink); font-size: .9rem; font-weight: 650; line-height: 1.25;
  white-space: nowrap; text-decoration: none; cursor: pointer;
}
button:hover:not(:disabled), .btn:hover { border-color: #9ab9e2; color: var(--blue-dark); background: var(--wash); }
button:disabled { opacity: .6; cursor: default; }
.primary, .btn.primary { color: var(--white); border-color: var(--blue-strong); background: var(--blue-strong); }
.primary:hover:not(:disabled), .btn.primary:hover { color: var(--white); border-color: var(--blue-dark); background: var(--blue-dark); }
.primary:disabled { color: #536884; border-color: #e1eaf7; background: #e1eaf7; opacity: 1; }
.ghost { border-color: transparent; color: var(--blue-dark); }
.danger { color: var(--red); }
label { display: block; min-width: 0; color: var(--ink); font-size: .87rem; font-weight: 610; }
input, select, textarea {
  width: 100%; min-width: 0; margin-top: .3rem; padding: .56rem .7rem; border: 1px solid var(--control-line);
  border-radius: 8px; color: var(--ink); background: var(--white); font-weight: 480;
}
input[type="checkbox"], input[type="radio"] { width: auto; margin: 0; accent-color: var(--blue-strong); }
textarea { min-height: 5.5rem; resize: vertical; }
fieldset { min-width: 0; margin: 0; }
legend { padding: 0 .45rem; font-weight: 700; }
label.check { display: flex; align-items: center; gap: .55rem; }
details { border: 1px solid var(--line); border-radius: 9px; padding: .7rem .85rem; }
details > summary { cursor: pointer; font-weight: 650; }
details[open] > * + * { margin-top: .7rem; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.app-frame { min-height: 100dvh; }
.signed-in .app-frame { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.workspace { min-width: 0; }
#sidebar:empty, #top:empty { display: none; }
#sidebar {
  position: sticky; top: 0; align-self: start; height: 100dvh; overflow-y: auto;
  padding: 26px 15px 20px; background: var(--rail); color: var(--rail-ink);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 1.04rem; font-weight: 690; letter-spacing: -.024em; white-space: nowrap; }
.brand strong { color: var(--blue-dark); }
.brand-mark {
  display: grid; grid-template-columns: repeat(2, 6px); grid-template-rows: repeat(2, 6px);
  place-content: center; gap: 3px; flex: 0 0 36px; width: 36px; height: 36px;
  border-radius: 10px; background: var(--soft); color: var(--blue-dark);
}
.brand-mark i { background: currentColor; border-radius: 1.5px; }
.brand-mark i:nth-child(3) { grid-column: span 2; }
.sidebar-brand { margin: 0 0 36px 6px; color: var(--white); }
.sidebar-brand .brand-mark { background: var(--rail-accent); color: var(--rail); }
.sidebar-brand strong { color: var(--rail-accent); }
.desktop-nav { display: grid; gap: .75rem; }
.nav-group { display: grid; gap: .3rem; }
.nav-group + .nav-group { border-top: 1px solid #36506e; padding-top: .75rem; }
.desktop-nav .nav-link {
  min-height: 46px; width: 100%; justify-content: start; gap: .75rem; padding: 0 .75rem;
  border: 0; border-radius: 9px; background: transparent; color: var(--rail-ink); text-align: left;
}
.desktop-nav .nav-link:hover:not(:disabled) { background: var(--rail-hover); color: var(--white); }
.desktop-nav .nav-link[aria-current="page"] { color: var(--white); background: var(--rail-active); }
.desktop-nav .nav-link:focus-visible, .sidebar-brand:focus-visible { outline-color: #b7d5ff; }
.phone-nav, .mobile-brand, .phone-checkout { display: none; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: var(--top-height); padding: 10px clamp(19px, 2.45vw, 36px); border-bottom: 1px solid var(--line);
  background: var(--white);
}
.top-location { display: flex; align-items: center; gap: 10px; color: #40536f; font-size: .92rem; font-weight: 690; }
.top-mark { width: 8px; height: 8px; border-radius: 2px; background: var(--blue); transform: rotate(45deg); }
.top-controls, .account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account { border: 1px solid var(--line); border-radius: 10px; padding: 4px 9px 4px 5px; }
.account-name { max-width: 255px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .89rem; font-weight: 660; }
.account-avatar {
  display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 29px;
  border-radius: 7px; color: var(--blue-dark); background: var(--soft); font-size: .76rem; font-weight: 760;
}
.mode-badge { border-radius: 999px; padding: 5px 10px; background: var(--soft); color: var(--blue-dark); font-size: .79rem; font-weight: 700; white-space: nowrap; }
.mode-badge[data-mode="production"] { background: #e7f4ed; color: var(--green); }
.mode-badge[data-mode="playground"] { background: #fff2dc; color: #754d12; }

.page { width: min(100%, 1480px); margin: 0 auto; padding: 32px clamp(20px, 3vw, 46px) 48px; }
.page-title, .catalog-header { display: flex; justify-content: space-between; align-items: center; gap: 12px 18px; flex-wrap: wrap; }
.page-title { margin-bottom: 25px; }
.panel, .setup-card, .auth-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 19px; }
.panel > * + *, .setup-card > * + *, .auth-card > * + * { margin-top: 1rem; }
.setup-body, .auth-wrap { display: grid; place-items: start center; padding: clamp(24px, 7vh, 85px) 19px 36px; }
.setup-card { width: min(100%, 660px); }
.auth-wrap { min-height: 100dvh; place-items: center; }
.auth-card { width: min(100%, 475px); padding: clamp(22px, 5vw, 36px); border-top: 4px solid var(--blue); box-shadow: 0 15px 50px #19395712; }
.auth-card h1 { margin-top: 1.45rem; margin-bottom: .35rem; }
.auth-card form > .primary { margin-top: .35rem; }
.auth-links { gap: .2rem .45rem; }
.auth-links button { padding: .53rem .38rem; }
.form, .stack { display: grid; gap: .85rem; }
.row, .actions { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.error, .banner, .success { padding: .72rem .85rem; border-radius: 9px; margin: .7rem 0; overflow-wrap: anywhere; }
.error { color: var(--red); background: #fff1f2; }
.banner { color: var(--blue-dark); background: var(--soft); }
.success { color: var(--green); background: #eef8f3; }
.empty { padding: 2rem 1rem; border: 1px dashed var(--control-line); border-radius: var(--radius); color: var(--muted); text-align: center; }

.pos-page > .banner { margin: 14px clamp(18px, 3vw, 35px) 0; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) clamp(315px, 29vw, 425px); min-height: calc(100dvh - var(--top-height)); }
.catalog { min-width: 0; padding: 33px clamp(20px, 3vw, 37px) 40px; container-type: inline-size; }
.today { color: var(--muted); margin-top: 6px; font-size: .92rem; }
.today::first-letter { text-transform: uppercase; }
.catalog-toolbar { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 9px 13px; margin-top: 23px; }
.filters { display: flex; flex-wrap: wrap; gap: .3rem; min-width: 0; }
.filter { display: inline-flex; min-height: 36px; padding: 0 .7rem; border-color: transparent; background: transparent; color: var(--muted); }
.filter[aria-pressed="true"] { border-color: #d5e5fb; background: var(--soft); color: var(--blue-dark); }
.catalog-search {
  display: flex; align-items: center; gap: 10px; width: min(100%, 255px); min-height: 41px; padding: 0 .7rem;
  border: 1px solid var(--control-line); border-radius: 9px; background: var(--white); color: var(--muted);
}
.catalog-search:focus-within { outline: 2px solid var(--blue); outline-offset: 1px; }
.catalog-search input { margin: 0; padding: .55rem 0; border: 0; background: transparent; }
.catalog-search input:focus-visible { outline: none; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-top: 17px; }
@container (max-width: 405px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile {
  display: flex; align-items: flex-start; justify-content: start; gap: .45rem; flex-direction: column;
  min-height: 127px; padding: .83rem; border-color: var(--line); border-radius: 13px;
  white-space: normal; text-align: start; overflow-wrap: anywhere;
}
.tile:hover:not(:disabled) { border-color: #abc6e9; box-shadow: 0 6px 18px #204a7b13; }
.tile:active { background: var(--soft); }
.tile strong { color: var(--ink); font-size: .98rem; line-height: 1.27; }
.tile-icon, .cart-symbol, .catalog-empty > .app-icon {
  display: grid; place-items: center; width: 42px; height: 39px; border-radius: 9px;
  background: var(--soft); color: var(--blue-dark);
}
.tile-price { margin-top: auto; color: var(--blue-dark); font-size: .93rem; font-weight: 720; }
.catalog-empty {
  grid-column: 1 / -1; display: grid; justify-items: center; gap: .65rem; padding: 31px 14px;
  border: 1px dashed var(--control-line); border-radius: 13px; text-align: center;
}
.catalog-empty > h2 { font-size: 1.08rem; }
.catalog-empty > .app-icon { width: 42px; height: 40px; }
.catalog-empty > button + button { margin-top: -.25rem; }
.pending-sales { margin-top: 1.1rem; }

.checkout {
  position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; min-width: 0;
  min-height: calc(100dvh - var(--top-height)); max-height: calc(100dvh - var(--top-height));
  padding: 26px clamp(16px, 2.25vw, 28px) 22px;
  border-left: 1px solid var(--line); background: var(--white);
}
.checkout-heading { display: flex; align-items: start; justify-content: space-between; gap: .7rem; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.checkout-heading p { margin-top: 5px; }
.icon-button { display: grid; place-items: center; flex: 0 0 40px; width: 40px; min-height: 40px; padding: 0; color: var(--blue-dark); }
.cart-items { flex: 1; min-height: 0; overflow-y: auto; }
.cart-lines, .receipt-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: .55rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.cart-name { display: block; min-height: 28px; padding: 0; max-width: 100%; background: transparent; border: 0; text-align: left; white-space: normal; overflow-wrap: anywhere; font-size: 1rem; }
.cart-description p { margin-top: .2rem; }
.cart-line-value { display: grid; gap: .45rem; justify-items: end; font-variant-numeric: tabular-nums; }
.cart-line-value > strong { font-size: 1rem; }
.cart-quantity { display: flex; align-items: center; gap: .4rem; }
.cart-quantity span { min-width: 1.4rem; text-align: center; }
.cart-quantity button { width: 44px; min-height: 44px; flex-basis: 44px; font-size: 1.25rem; }
.cart-empty { align-self: center; display: grid; place-items: center; gap: 5px; padding: 37px 5px; text-align: center; }
.cart-empty .cart-symbol { width: 57px; height: 57px; margin-bottom: 7px; border-radius: 14px; }
.cart-symbol .app-icon { transform: scale(1.25); }
.cart-empty p { max-width: 245px; }
.cart-total { display: flex; align-items: baseline; justify-content: space-between; gap: .65rem; margin-top: .9rem; padding: .7rem 0; border-top: 1px solid var(--line); font-weight: 680; }
.cart-total strong { font-size: 1.7rem; font-variant-numeric: tabular-nums; letter-spacing: -.035em; white-space: nowrap; }
#cart-save { width: 100%; min-height: 50px; margin-top: .45rem; }
.items { display: grid; gap: .5rem; }
.items-line {
  display: grid; grid-template-columns: minmax(112px, 3fr) repeat(3, minmax(56px, 1fr)) minmax(56px, .8fr) auto;
  gap: .48rem; align-items: end;
}
.items-line button { margin-bottom: 1px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table:not(:where(.invoice-document table)) { width: 100%; border-collapse: collapse; text-align: start; background: var(--white); }
th:not(:where(.invoice-document th)), td:not(:where(.invoice-document td)) { padding: .72rem .85rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .9rem; }
th:not(:where(.invoice-document th)) { background: var(--white); color: var(--muted); font-size: .83rem; white-space: nowrap; }
tr:last-child td:not(:where(.invoice-document td)) { border-bottom: 0; }
tbody tr:hover { background: #fafcff; }
td .ghost { padding: .4rem; min-height: 36px; }
.money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sort-heading {
  min-height: 32px; justify-content: start; padding: 0 .2rem; border-color: transparent;
  background: transparent; color: var(--muted); font-size: inherit; text-align: start;
}
.sort-heading span { opacity: .7; }
th[aria-sort] .sort-heading { color: var(--blue-dark); }
th[aria-sort] .sort-heading span { opacity: 1; }
.list-sort-mobile { display: none; }
.row-actions { display: flex; justify-content: end; align-items: center; gap: .4rem; }
.row-pdf { min-height: 40px; }
.row-end { width: 1%; }
.ares-results select { min-width: 0; width: 100%; }
.ares-results:empty { display: none; }
.ares-panel { padding: .65rem; border: 1px solid var(--control-line); border-radius: var(--radius); background: var(--wash); }
.ares-panel h3 { margin: .15rem .15rem .55rem; }
.ares-panel h3 .muted { font-weight: 500; }
.ares-list {
  display: grid; gap: .45rem; max-height: min(315px, 40dvh); padding: 3px 4px; margin: 0;
  list-style: none; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable;
}
.ares-option { width: 100%; justify-content: space-between; gap: .6rem; padding: .62rem .75rem; text-align: left; white-space: normal; }
.ares-option-text { display: grid; gap: .14rem; min-width: 0; overflow-wrap: anywhere; }
.ares-option-mark { display: grid; place-items: center; flex: 0 0 20px; width: 20px; height: 20px; border: 1px solid var(--control-line); border-radius: 50%; color: var(--blue-dark); }
.status { display: inline-block; padding: .28rem .5rem; border-radius: 7px; background: var(--soft); color: var(--blue-dark); font-size: .79rem; font-weight: 650; line-height: 1.25; }
.status.error, .status.late { margin: 0; background: #fff1f2; color: var(--red); }
.status.sent, .status.paid { background: #eef8f3; color: var(--green); }
.status.pending, .status.test { background: #fff2dc; color: #754d12; }
.stat h2 { color: var(--muted); font-size: .94rem; font-weight: 640; }
.stat strong { display: block; margin-top: .35rem; font-size: 1.35rem; letter-spacing: -.026em; }
.settings-layout { display: grid; align-content: start; gap: 1rem; }
.settings-nav { display: flex; flex-wrap: wrap; gap: .45rem; }
.settings-nav .filter { min-height: 44px; border-color: var(--line); background: var(--white); }
.settings-nav .filter[aria-pressed="true"] { border-color: #aac4eb; background: var(--soft); }
.settings-form { min-width: 0; }
.settings-form .panel { padding-top: 15px; }
.history-list { display: grid; gap: .5rem; padding: 0; margin: 0; list-style: none; }
.history-entry { display: flex; justify-content: space-between; align-items: center; gap: .65rem; flex-wrap: wrap; padding: .75rem; border: 1px solid var(--line); border-radius: 9px; }

dialog {
  width: min(740px, calc(100% - 1.5rem)); max-height: calc(100dvh - 2rem); overflow: auto; padding: 1.25rem;
  border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: var(--white); box-shadow: 0 20px 60px #10274640;
}
dialog[data-layout="lookup"] {
  --lookup-top: clamp(12px, 8dvh, 68px);
  inset-block: var(--lookup-top) auto;
  margin-block: 0;
  max-height: calc(100dvh - var(--lookup-top) - 12px);
}
dialog::backdrop { background: #1326488c; }
dialog > form > * + *, dialog > .stack > * + * { margin-top: .65rem; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
dialog[data-layout="invoice"] {
  width: min(1320px, calc(100% - 2rem)); padding: clamp(14px, 2vw, 26px); background: var(--canvas);
}
dialog[data-layout="invoice"] > .modal-head { margin-bottom: 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
dialog[data-layout="invoice"] > .modal-head h2 { font-size: clamp(1.35rem, 3vw, 1.85rem); }
.invoice-editor { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); align-items: start; gap: clamp(.85rem, 2vw, 1.55rem); }
.invoice-fields { display: grid; align-content: start; gap: .75rem; min-width: 0; container: invoice-fields / inline-size; }
.invoice-section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.invoice-section > summary {
  position: relative; display: grid; gap: .22rem; min-height: 54px; padding: .8rem 2.45rem .8rem .9rem;
  list-style: none; cursor: pointer; border-radius: var(--radius);
}
.invoice-section > summary::-webkit-details-marker { display: none; }
.invoice-section > summary::after {
  content: ""; position: absolute; top: 1.15rem; right: 1.05rem; width: .56rem; height: .56rem;
  border: solid var(--blue-dark); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.invoice-section[open] > summary::after { transform: translateY(3px) rotate(225deg); }
.invoice-section > summary strong { color: var(--ink); font-size: 1.03rem; }
.invoice-section > summary .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invoice-section-body { padding: .85rem .9rem 1rem; border-top: 1px solid var(--line); }
.invoice-section-body input, .invoice-section-body select, .invoice-section-body textarea { scroll-margin-block: 4.5rem; }
.invoice-customer-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .55rem; align-items: end; }
.invoice-recent { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.invoice-recent button { max-width: 100%; min-height: 36px; border-radius: 999px; overflow-wrap: anywhere; white-space: normal; }
.invoice-customer-card {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .45rem .8rem;
  padding: .7rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white);
}
.invoice-customer-card > div:first-child { flex: 1 1 13rem; min-width: 0; overflow-wrap: anywhere; }
.invoice-customer-card p { margin: .25rem 0 0; }
.invoice-customer-card .actions { margin: 0 0 0 auto; }
.invoice-recipient-editor { padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius); }
.invoice-recipient-editor-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.invoice-recipient-editor h3 { margin: 0; }
.invoice-customer-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.invoice-customer-fields > label:has([name="r-street"]) { grid-column: 1 / -1; }
.ares-add-customer { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.invoice-vat-detail { width: fit-content; max-width: 100%; }
.company-invoice-images { border-top: 1px solid var(--line); padding-top: .9rem; }
.company-invoice-images h3 { margin: 0; }
.invoice-image-setting { display: grid; gap: .5rem; align-content: start; min-width: 0; }
.invoice-image-setting img { max-width: min(120px, 100%); max-height: 58px; object-fit: contain; }
.invoice-image-setting input[type="file"] { width: 100%; }
@container invoice-fields (max-width: 420px) {
  .invoice-customer-search { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .invoice-customer-search label { width: 100%; }
}
@container invoice-fields (max-width: 320px) {
  .invoice-customer-fields { grid-template-columns: minmax(0, 1fr); }
}
.invoice-lines { display: grid; gap: .75rem; }
.invoice-lines .items-line { grid-template-columns: minmax(110px, 2.15fr) minmax(78px, 1fr) minmax(44px, .7fr) minmax(78px, 1.1fr) auto; align-items: end; }
.invoice-lines-vat .items-line { grid-template-columns: minmax(110px, 2.15fr) minmax(78px, 1fr) minmax(44px, .7fr) minmax(78px, 1.1fr) minmax(60px, .8fr) auto; }
.invoice-lines .items-line + .items-line { padding-top: .75rem; border-top: 1px solid var(--line); }
.invoice-line-actions { display: flex; flex-wrap: wrap; align-items: end; gap: .7rem; }
.invoice-line-actions label { flex: 1 1 10rem; }
.invoice-preview {
  position: sticky; top: 0; min-width: 0; max-height: calc(100dvh - 10.5rem); overflow: auto;
  padding: clamp(.55rem, 1.25vw, 1rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft);
}
.invoice-preview-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .55rem; margin-bottom: .75rem; }
.invoice-preview-jump { display: none; }
@font-face { font-family: "DejaVu Sans"; font-weight: 400; src: url("/?api=invoice-font") format("truetype"); font-display: swap; }
@font-face { font-family: "DejaVu Sans"; font-weight: 700; src: url("/?api=invoice-font&weight=bold") format("truetype"); font-display: swap; }
.invoice-paper { min-width: 0; overflow: hidden; background: var(--white); border: 1px solid var(--line); border-radius: 9px; }
.invoice-paper > p { padding: .8rem; }
.invoice-paper > .invoice-document { width: 595.28pt; min-height: 841.89pt; padding: 34pt; overflow-wrap: break-word; -webkit-text-size-adjust: 100%; }
.invoice-paper .doc-jump { display: block; min-height: 0; width: 100%; padding: 0; border: 0; border-radius: 3px; background: transparent; color: inherit; font: inherit; text-align: inherit; white-space: normal; }
.invoice-paper .doc-jump:hover:not(:disabled) { color: inherit; background: #edf4fe; }
.invoice-paper[aria-busy="true"] .doc-qr { visibility: hidden; }
.invoice-quantity { position: relative; }
.invoice-quantity input { padding-right: 1.65rem; }
.invoice-quantity-steps { position: absolute; right: 3px; bottom: 3px; display: grid; width: 1.25rem; }
.invoice-quantity-steps button { min-height: 18px; padding: 0; border: 0; color: var(--blue-dark); font-size: .85rem; line-height: 1; }
.invoice-footer {
  position: sticky; bottom: 0; z-index: 1; display: grid; gap: .4rem;
  padding: .65rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: 0 -3px 14px #214e900e;
}
.invoice-footer-row, .invoice-footer-total { display: flex; align-items: center; gap: .65rem; }
.invoice-footer-row { flex-wrap: wrap; justify-content: space-between; }
.invoice-footer-total strong { font-size: 1.25rem; white-space: nowrap; }
.invoice-next { margin-left: auto; }
@container invoice-fields (max-width: 550px) {
  .invoice-lines .items-line { grid-template-columns: minmax(80px, 1fr) minmax(32px, .56fr) minmax(64px, 1fr); gap: .3rem; }
  .invoice-lines-vat .items-line { grid-template-columns: minmax(77px, 1.14fr) minmax(33px, .62fr) minmax(62px, 1fr) minmax(54px, .85fr); }
  .invoice-lines .items-line > label:first-child { grid-column: 1 / -2; grid-row: 1; }
  .invoice-lines .invoice-line-remove { grid-column: -2 / -1; grid-row: 1; justify-self: end; }
  .invoice-lines .items-line input, .invoice-lines .items-line select { margin-top: .13rem; padding-left: .35rem; }
  .invoice-lines .items-line select { padding-right: .1rem; }
  .invoice-lines .items-line label { font-size: .77rem; }
  .invoice-lines { gap: .45rem; }
  .invoice-lines .items-line + .items-line { padding-top: .45rem; }
}
@media (max-width: 820px) {
  dialog[data-layout="invoice"] { width: calc(100% - 1rem); }
  .invoice-editor { grid-template-columns: minmax(0, 1fr); }
  .invoice-preview { position: static; max-height: none; overflow: visible; }
  .invoice-preview-jump { display: inline-flex; justify-self: start; }
}
@media (max-width: 420px) {
  .invoice-footer-row .actions { width: 100%; }
  .invoice-footer-row .actions > button { flex: 1; }
  .invoice-section-body { padding-inline: .62rem; }
}
dialog[data-layout="pos"] { width: min(580px, calc(100% - 1rem)); padding: clamp(16px, 4vw, 26px); }
dialog[data-layout="pos"] .modal-head { margin-bottom: 1rem; }
dialog[data-layout="pos"] .modal-head h2 { font-size: clamp(1.3rem, 3.5vw, 1.58rem); }
dialog[data-layout="pos"] > .stack > * + * { margin-top: 0; }
dialog[data-layout="pos"] .actions { justify-content: flex-end; margin-top: .55rem; }
.modal-close { width: 44px; min-height: 44px; flex-basis: 44px; font-size: 1.45rem; }
.pos-payment-total, .receipt-total strong:last-child { font-size: clamp(1.8rem, 6vw, 2.65rem); font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
.pos-payment-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; border: 0; padding: 0; }
.pos-payment-option { display: flex; align-items: center; gap: .55rem; min-height: 48px; padding: .55rem .65rem; border: 1px solid var(--control-line); border-radius: 9px; cursor: pointer; }
.pos-payment-option:has(input:checked) { color: var(--blue-dark); background: var(--soft); border-color: #9ab9e2; }
.pos-payment-option:has(input:focus-visible) { outline: 2px solid #457ece; outline-offset: 2px; }
[data-cash-field] p { margin-bottom: .65rem; }
.payment-change:empty { display: none; }
.receipt-meta { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: .3rem .8rem; margin: .15rem 0; }
.receipt-meta dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.receipt-lines li, .receipt-total { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.receipt-lines li { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.receipt-lines li span { overflow-wrap: anywhere; }
.receipt-lines strong { flex-shrink: 0; }
.receipt-total { padding-top: .65rem; border-top: 1px solid var(--line); }
.receipt-actions > .primary { min-width: 6rem; }
.receipt-view .pos-qr img { width: min(100%, 360px); }
.pos-qr { display: grid; justify-items: center; gap: .3rem; padding: .85rem .65rem; border: 1px solid var(--line); border-radius: var(--radius); text-align: center; }
.pos-qr img { display: block; width: min(100%, 410px); height: auto; }
.pos-qr p { overflow-wrap: anywhere; }
#notice {
  position: fixed; z-index: 20; right: 1rem; bottom: 1rem; max-width: min(420px, calc(100% - 2rem));
  padding: .78rem 1rem; border-radius: 10px; background: var(--rail); color: var(--white); box-shadow: 0 10px 24px #172a4430;
}
#notice[data-error="true"] { background: var(--red); }
#print { display: none; }

.app-icon { display: inline-block; position: relative; flex: 0 0 17px; width: 17px; height: 17px; color: inherit; }
.app-icon::before, .app-icon::after { position: absolute; content: ""; }
.icon-tiles { background: linear-gradient(currentColor 0 0) 0 0/7px 7px, linear-gradient(currentColor 0 0) 100% 0/7px 7px, linear-gradient(currentColor 0 0) 0 100%/7px 7px, linear-gradient(currentColor 0 0) 100% 100%/7px 7px; background-repeat: no-repeat; border-radius: 2px; }
.icon-receipt, .icon-invoice, .icon-box { border: 1.45px solid currentColor; border-radius: 2px; }
.icon-receipt::after, .icon-invoice::after { left: 3px; right: 3px; top: 4px; height: 1.5px; background: currentColor; box-shadow: 0 4px currentColor; }
.icon-invoice { width: 14px; flex-basis: 14px; height: 18px; }
.icon-box::after { width: 6px; height: 6px; top: -1px; left: 4px; border: 1.4px solid currentColor; border-top: 0; border-radius: 0 0 2px 2px; }
.icon-person::before { width: 7px; height: 7px; top: 0; left: 5px; border: 1.4px solid currentColor; border-radius: 50%; }
.icon-person::after { left: 1px; right: 1px; bottom: 0; height: 7px; border: 1.4px solid currentColor; border-radius: 7px 7px 2px 2px; }
.icon-chart { border: solid currentColor; border-width: 0 0 1.45px 1.45px; }
.icon-chart::after { left: 3px; bottom: 2px; width: 11px; height: 11px; background: linear-gradient(currentColor 0 0) 0 100%/2px 5px, linear-gradient(currentColor 0 0) 50% 100%/2px 8px, linear-gradient(currentColor 0 0) 100% 100%/2px 11px; background-repeat: no-repeat; }
.icon-settings::before { inset: 3px; border: 1.5px solid currentColor; border-radius: 50%; }
.icon-settings::after { inset: 0; border: 1.5px dashed currentColor; border-radius: 50%; }
.icon-gear::before { content: "\2699\fe0e"; top: -3px; left: 0; line-height: 1; font-size: 21px; }
.icon-download { width: 15px; flex-basis: 15px; height: 15px; border-bottom: 1.5px solid currentColor; }
.icon-download::before { top: 0; left: 7px; height: 10px; border-left: 1.5px solid currentColor; }
.icon-download::after { top: 5px; left: 4px; width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.icon-more::after { width: 3px; height: 3px; border-radius: 50%; top: 7px; left: 7px; background: currentColor; box-shadow: -5px 0 currentColor, 5px 0 currentColor; }
.icon-plus::before, .icon-plus::after { background: currentColor; border-radius: 2px; }
.icon-plus::before { width: 13px; height: 1.5px; top: 8px; left: 2px; }
.icon-plus::after { width: 1.5px; height: 13px; top: 2px; left: 8px; }
.icon-search::before { width: 11px; height: 11px; left: 1px; top: 1px; border: 1.5px solid currentColor; border-radius: 50%; }
.icon-search::after { width: 6px; height: 1.5px; top: 12px; left: 10px; background: currentColor; transform: rotate(45deg); }
.catalog-empty > .icon-search::before { top: 12px; left: 13px; }
.catalog-empty > .icon-search::after { top: 23px; left: 22px; }
.catalog-empty > .icon-box { border: 0; }
.catalog-empty > .icon-box::before { inset: 11px; border: 1.5px solid currentColor; border-radius: 3px; }
.catalog-empty > .icon-box::after { left: 18px; top: 11px; }
.icon-basket::before { bottom: 1px; left: 0; right: 0; height: 12px; border: 1.5px solid currentColor; border-radius: 3px; }
.icon-basket::after { top: 1px; left: 5px; right: 5px; height: 5px; border: solid currentColor; border-width: 1.5px 1.5px 0; border-radius: 4px 4px 0 0; }
.icon-trash::before { inset: 5px 3px 0; border: 1.4px solid currentColor; border-radius: 0 0 2px 2px; }
.icon-trash::after { left: 1px; right: 1px; top: 3px; height: 1.5px; background: currentColor; }
.icon-card { height: 13px; border: 1.5px solid currentColor; border-radius: 3px; }
.icon-card::after { left: 0; right: 0; top: 3px; border-top: 1.5px solid currentColor; }
.icon-cup::before { left: 0; top: 4px; width: 13px; height: 11px; border: 1.5px solid currentColor; border-radius: 0 0 5px 5px; }
.icon-cup::after { left: 12px; top: 5px; width: 5px; height: 7px; border: 1.4px solid currentColor; border-left: 0; border-radius: 0 4px 4px 0; }
.icon-drink::before { inset: 4px 3px 0; border: 1.5px solid currentColor; border-radius: 1px 1px 4px 4px; }
.icon-drink::after { left: 9px; top: 0; height: 10px; border-left: 1.5px solid currentColor; transform: rotate(14deg); }
.icon-bread::before { inset: 3px 0 2px; border: 1.5px solid currentColor; border-radius: 70% 70% 25% 25%; transform: rotate(-17deg); }
.icon-bread::after { inset: 6px 5px; border: solid currentColor; border-width: 0 1.3px; transform: skew(-20deg) rotate(-17deg); }

@media (max-width: 1000px) and (min-width: 761px) {
  .signed-in .app-frame { grid-template-columns: 188px minmax(0, 1fr); }
  #sidebar { padding-inline: 12px; }
  .sidebar-brand { gap: 7px; margin-left: 2px; font-size: .9rem; }
  .pos { grid-template-columns: minmax(0, 1fr) 307px; }
}
@media (max-width: 820px) {
  dialog .items-line { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  dialog .items-line label:first-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  :root { --top-height: 62px; }
  .signed-in .app-frame { display: block; }
  .signed-in .workspace { padding-bottom: calc(var(--phone-nav-height) + env(safe-area-inset-bottom) + 10px); }
  #sidebar { position: static; height: auto; padding: 0; overflow: visible; background: none; }
  .desktop-nav, .sidebar-brand, .top-location { display: none; }
  .mobile-brand { display: inline-flex; font-size: .96rem; }
  .topbar { padding: 9px max(14px, env(safe-area-inset-right)) 9px max(14px, env(safe-area-inset-left)); }
  .top-controls { gap: 5px; }
  .top-controls > .ghost { padding-inline: .5rem; }
  .top-controls .account { border: 0; padding: 0; }
  .top-controls .account-name, .top-controls .mode-badge { display: none; }
  .phone-nav {
    position: fixed; z-index: 9; right: 0; bottom: 0; left: 0; display: flex; align-items: stretch;
    padding: 5px max(7px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
    border-top: 1px solid #395170; color: var(--rail-ink); background: var(--rail);
  }
  .phone-nav > .nav-link, .phone-more { flex: 1 1 0; min-width: 0; }
  .phone-nav > .nav-link, .phone-more > summary {
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; min-height: 54px;
    padding: 3px; border: 0; border-radius: 9px; color: var(--rail-ink); background: transparent; font-size: .72rem; white-space: normal; text-align: center;
  }
  .phone-nav > .nav-link:hover:not(:disabled), .phone-more > summary:hover, .phone-nav > .nav-link[aria-current="page"], .phone-more[data-current] > summary { color: var(--white); background: var(--rail-active); }
  .phone-more { position: relative; padding: 0; border: 0; }
  .phone-more > summary { cursor: pointer; list-style: none; }
  .phone-more > summary::-webkit-details-marker { display: none; }
  .phone-more-list {
    position: absolute; bottom: calc(100% + 13px); right: 0; display: grid; gap: 4px; width: min(225px, calc(100vw - 20px));
    padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); box-shadow: 0 8px 26px #162b4842;
  }
  .phone-more-list .nav-link { justify-content: start; border-color: transparent; }
  .phone-more-list .nav-link[aria-current="page"] { color: var(--blue-dark); background: var(--soft); }
  .phone-checkout {
    position: fixed; z-index: 8; right: 12px; bottom: calc(var(--phone-nav-height) + env(safe-area-inset-bottom) + 9px); left: 12px;
    display: flex; justify-content: start; min-height: 48px; box-shadow: 0 6px 22px #172a4433;
  }
  .phone-checkout strong { margin-left: auto; }
  .signed-in:has(input:focus, textarea:focus, select:focus) .phone-checkout { display: none; }
  .page { padding: 23px 15px 34px; }
  .page-title { margin-bottom: 18px; }
  .panel { padding: 14px; }
  .pos { display: block; }
  .catalog { padding: 22px 15px 24px; }
  .catalog-header { row-gap: 13px; }
  .catalog-toolbar { margin-top: 16px; }
  .catalog-search { width: 100%; }
  .filters { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding: 2px 3px 4px; }
  .filter { min-height: 44px; }
  .tile { min-height: 113px; padding: .7rem; }
  .checkout { position: static; min-height: 0; max-height: none; padding: 20px 15px calc(92px + var(--phone-nav-height) + env(safe-area-inset-bottom)); border-left: 0; border-top: 1px solid var(--line); scroll-margin-top: 12px; }
  .checkout-heading .icon-button { min-height: 44px; width: 44px; flex-basis: 44px; }
  .cart-items { overflow: visible; }
  .cart-items:has(.cart-empty) { min-height: 120px; }
  .cart-empty { padding-block: 20px; }
  .checkout-bottom {
    position: fixed; z-index: 8; right: 0; bottom: calc(var(--phone-nav-height) + env(safe-area-inset-bottom)); left: 0;
    display: flex; align-items: center; gap: .75rem; min-height: 70px; padding: 10px max(15px, env(safe-area-inset-left)) 10px max(15px, env(safe-area-inset-right));
    border-top: 1px solid var(--line); background: var(--white); box-shadow: 0 -5px 18px #172a4420;
  }
  .checkout-bottom .cart-total { flex: 1 1 auto; }
  .checkout-bottom #cart-save { flex: 0 0 auto; width: calc(50% - .375rem); margin-top: 0; }
  .phone-checkout { display: none !important; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-height: 44px; font-size: 16px; }
  th, td { padding: .58rem .55rem; }
  td .ghost { min-height: 44px; }
  .document-list { display: block; }
  .document-list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .document-list tbody { display: grid; }
  .document-list tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    padding: .5rem .85rem .75rem; border-bottom: 1px solid var(--line); gap: .1rem .5rem;
  }
  .document-list tr:last-child { border-bottom: 0; }
  .document-list td { padding: .14rem 0; border: 0; overflow-wrap: anywhere; }
  .document-list td:nth-child(1) { grid-row: 1; grid-column: 1; }
  .document-list td:nth-child(2) { grid-row: 3; grid-column: 1; color: var(--muted); font-size: .79rem; }
  .document-list td:nth-child(3) { grid-row: 2; grid-column: 1; }
  .document-list td:nth-child(4) { grid-row: 3; grid-column: 2; color: var(--muted); font-size: .79rem; text-align: right; }
  .document-list td:nth-child(5) { grid-row: 2; grid-column: 2; text-align: right; }
  .document-list td:nth-child(6) { grid-row: 1; grid-column: 2; font-size: 1.03rem; font-weight: 720; }
  .document-list .mail-cell { grid-column: 1 / -1; }
  .document-list .row-end { grid-column: 1 / -1; width: auto; }
  .document-list .row-end:has(.row-actions:empty) { display: none; }
  .document-list td:empty { display: none; }
  .document-list td .ghost { justify-content: start; padding-inline: 0; text-align: start; white-space: normal; }
  .list-sort-mobile { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .row-edit { min-height: 44px; width: 44px; }
  .row-pdf { min-height: 44px; }
  .settings-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-nav .filter { justify-content: center; white-space: normal; }
  dialog { width: calc(100% - 16px); max-height: calc(100dvh - 18px); padding: 15px; }
  .signed-in #notice { bottom: calc(var(--phone-nav-height) + env(safe-area-inset-bottom) + 60px); }
}
@media (max-width: 360px) {
  .mobile-brand { gap: 6px; font-size: .87rem; }
  .top-controls .account { display: none; }
}
@media (max-width: 560px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  dialog[data-layout="pos"] .receipt-actions > * { flex: 1 1 7rem; }
  dialog[data-layout="pos"] .receipt-actions > .primary { flex-basis: 100%; }
}

@media print {
  :root, body { background: white; }
  body > *:not(#print) { display: none !important; }
  #print { display: block !important; background: white; color: black; font-family: Arial, sans-serif; }
  #print[data-format="80"] { width: 71mm; margin: 0; font-size: 10pt; }
  #print[data-format="a4"] { width: auto; margin: 12mm; font-size: 12pt; }
  #print h1 { font-size: 16pt; margin: 0 0 8px; }
  #print th, #print td { border-bottom: 1px solid #777; padding: 4px 2px; color: black; background: white; font-size: inherit; }
}

.top-controls .company-switcher {
  display: block; min-width: 0; max-width: min(28vw, 15rem);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

[data-header-color="blue"] { --company-header-color: #edf5ff; }
[data-header-color="mint"] { --company-header-color: #eaf7f0; }
[data-header-color="lavender"] { --company-header-color: #f2edfc; }
[data-header-color="rose"] { --company-header-color: #fbedf3; }
[data-header-color="peach"] { --company-header-color: #fff1e8; }
[data-header-color="sand"] { --company-header-color: #fbf5e4; }
.topbar, .header-color-sample { background: var(--company-header-color, var(--white)); }
.header-colors { margin-inline: 0; min-width: 0; padding: 0; border: 0; }
.header-colors legend { margin-bottom: .45rem; font-size: .9rem; font-weight: 650; }
.header-color-options { display: flex; flex-wrap: wrap; gap: .45rem; }
.header-color-option {
  position: relative; display: inline-flex; align-items: center; gap: .4rem; min-height: 44px;
  padding: .35rem .65rem; border: 1px solid var(--control-line); border-radius: 9px;
  cursor: pointer;
}
.header-color-option:has(input:checked) { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.header-color-option:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 3px; }
.header-color-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.header-color-sample { width: 1.15rem; height: 1.15rem; border: 1px solid var(--control-line); border-radius: 50%; }
