/* Sąskaitos v1.0.1 — išdėstymas pagal Invoice123 ekranus */
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --side: #f8f9fc;
  --band: #f8f9fc;
  --line: #d0d4dc;
  --line-soft: #e6e8ec;
  --row: #f0f0f0;
  --text: #031227;
  --text-2: #293648;
  --muted: #506272;
  --muted-2: #8a94a3;
  --primary: #3489fe;
  --primary-h: #1f78f5;
  --primary-soft: #eaf2ff;
  --green: #4ec63a;
  --red: #de5050;
  --red-soft: #fdeeee;
  --badge: #f5f5f5;
  --badge-text: #2b303a;
  --card-head: #eef0f4;
  --nav-active: #e8eaee;
  --white: #ffffff;
  --radius: 8px;
  --shadow: 0 2px 4px rgba(3, 18, 39, 0.06), 0 12px 32px -8px rgba(3, 18, 39, 0.18);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side-w: 274px;
  --top-h: 50px;
}

* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--white); line-height: 1.4; -webkit-font-smoothing: antialiased; }
::selection { background: #cfe2ff; color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
p { margin: 0 0 10px; }
svg { flex: none; }
input, select, textarea, button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }
.r { text-align: right; }
.c { text-align: center; }
.red { color: var(--red); }
.green { color: var(--green); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ================= Shell ================= */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); z-index: 50;
  display: flex; align-items: center; background: var(--white); border-bottom: 1px solid var(--line); padding: 0 18px 0 16px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; width: calc(var(--side-w) - 16px); color: var(--text); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand .mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--primary); color: #fff; font-size: 13px; font-weight: 700; }
.topbar .brand .ver { font-size: 11px; font-weight: 500; color: var(--muted-2); margin-left: -4px; align-self: flex-end; margin-bottom: 4px; }
.top-search { flex: 1; display: flex; justify-content: center; }
.top-search form { position: relative; width: 500px; max-width: 100%; }
.top-search input { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 0 12px 0 40px; font-size: 14px; background: var(--white); }
.top-search input::placeholder { color: #9aa2ad; }
.top-search svg { position: absolute; left: 13px; top: 9px; color: #8a94a3; }
.top-actions { display: flex; align-items: center; gap: 14px; margin-left: 18px; }
.top-actions .sep { width: 1px; height: 22px; background: var(--line); }
.icon-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text); background: none; border: 0; padding: 6px; border-radius: 6px; cursor: pointer; }
.icon-link:hover { background: var(--side); text-decoration: none; }
.top-user { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--text); background: none; border: 0; cursor: pointer; padding: 6px 4px; }

.sidebar {
  position: fixed; top: var(--top-h); bottom: 0; left: 0; width: var(--side-w); z-index: 40;
  background: var(--side); border-right: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column;
}
.side-company { position: relative; padding: 16px 15px 0; }
.side-company .co-btn { display: flex; align-items: flex-start; justify-content: space-between; width: 100%; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.side-company .co-name { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.3; }
.side-company .co-role { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.side-company .co-btn svg { margin-top: 2px; color: var(--text); }
.side-turnover { padding: 18px 15px 14px; }
.side-turnover .v { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.side-turnover .k { font-size: 12px; color: var(--muted-2); margin-top: 3px; }
.side-turnover .bar { height: 4px; background: #dfe2e6; border-radius: 2px; margin: 12px 0 9px; overflow: hidden; }
.side-turnover .bar span { display: block; height: 100%; background: var(--primary); border-radius: 2px; }
.side-turnover .note { font-size: 12px; color: var(--muted); font-weight: 500; }
.side-cta { padding: 0 15px 14px; border-bottom: 1px solid var(--line); }
.btn-side { display: flex; justify-content: center; align-items: center; height: 34px; width: 100%; border-radius: 8px; background: var(--primary); color: #fff; font-weight: 600; font-size: 14px; }
.btn-side:hover { background: var(--primary-h); text-decoration: none; }
.side-section { display: flex; align-items: center; gap: 8px; padding: 18px 15px 10px; font-size: 14px; color: var(--muted); font-weight: 500; }
.side-nav { display: flex; flex-direction: column; padding: 0 5px; }
.side-nav a { display: flex; align-items: center; gap: 15px; height: 32px; padding: 0 10px 0 12px; border-radius: 6px; color: var(--text); font-weight: 600; font-size: 14px; margin-bottom: 0; }
.side-nav a:hover { background: var(--nav-active); text-decoration: none; }
.side-nav a.active { background: var(--nav-active); }
.side-nav a svg { width: 18px; height: 18px; color: var(--muted); }
.side-nav a.sub { font-weight: 400; font-size: 13px; padding-left: 45px; height: 32px; }
.side-nav a .plus { margin-left: auto; color: var(--primary); display: inline-grid; }
.side-nav .gap { height: 8px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 15px; font-size: 12px; color: var(--muted-2); display: flex; justify-content: space-between; }

.page { margin-left: var(--side-w); padding-top: var(--top-h); min-height: 100vh; display: flex; flex-direction: column; }
.page-title { height: 42px; display: flex; align-items: center; padding: 0 30px; background: var(--band); border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; gap: 8px; }
.page-title a { color: var(--muted); font-weight: 500; }
.toolbar { min-height: 60px; display: flex; align-items: center; justify-content: flex-end; gap: 22px; padding: 10px 30px; background: var(--band); flex-wrap: wrap; }
.toolbar .tb-left { margin-right: auto; display: flex; align-items: center; gap: 12px; }
.content { flex: 1; padding: 30px 30px 50px; }
.container { max-width: 1440px; margin: 0 auto; }
.container.narrow { max-width: 1060px; }
.app-foot { border-top: 1px solid var(--line-soft); background: var(--band); padding: 18px 40px; display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }

/* ================= Controls ================= */
.search-box { display: flex; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; width: 364px; max-width: 100%; }
.search-box svg { margin: 11px 8px 0 12px; color: #8a94a3; }
.search-box input { flex: 1; border: 0; outline: 0; font-size: 14px; min-width: 0; background: transparent; }
.search-box button { border: 0; border-left: 1px solid var(--line); background: #f0f2f5; padding: 0 16px; font-weight: 600; font-size: 14px; cursor: pointer; }
.search-box button:hover { background: #e6e9ee; }
.tool-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; font-size: 14px; background: none; border: 0; cursor: pointer; padding: 6px 0; }
.tool-link:hover { color: var(--primary); text-decoration: none; }
.tool-link.dim { color: var(--muted-2); font-weight: 500; }
.tool-link.dim:hover { color: var(--primary); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background 0.12s, border-color 0.12s; }
.btn:hover { background: var(--side); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); border-color: var(--primary-h); }
.btn-gray { background: #f0f2f5; border-color: #f0f2f5; }
.btn-gray:hover { background: #e4e7ec; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger { background: transparent; border-color: transparent; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-outline-red { color: var(--red); border-color: #f0c2c2; }
.btn-outline-blue { color: var(--primary); border-color: #b9d4fd; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.disabled { opacity: 0.5; pointer-events: none; }
.link-btn { background: none; border: 0; color: var(--primary); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 0; }
.link-btn:hover { text-decoration: underline; }
.link-btn svg { width: 18px; height: 18px; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #f3f4f7; border: 0; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: #e6e9ee; }
.icon-btn.plain { background: transparent; border-radius: 6px; }
.icon-btn.plain:hover { background: #eef0f4; }
.icon-btn.del { color: var(--red); background: transparent; border-radius: 6px; }
.icon-btn.del:hover { background: var(--red-soft); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.field .req { color: var(--red); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea, .select {
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 14px; font-weight: 400; color: var(--text); width: 100%;
}
.field textarea, textarea.input { height: auto; padding: 9px 12px; min-height: 38px; resize: vertical; }
select.input, .field select, .select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23031227' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(52, 137, 254, 0.18); }
.input:disabled, .field input:disabled { background: #f6f7f9; color: var(--muted); }
input::placeholder, textarea::placeholder { color: #9aa2ad; }
.hint { font-size: 12px; color: var(--muted-2); font-weight: 400; }
.grid { display: grid; gap: 16px 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }

/* Jungiklis */
.switch { position: relative; display: inline-block; width: 46px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 12px; background: #fff; border: 1.5px solid #c3c8d0; transition: background 0.15s, border-color 0.15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; border: 1.5px solid #c3c8d0; transition: transform 0.15s; }
.switch input:checked + span { background: var(--primary); border-color: var(--primary); }
.switch input:checked + span::after { transform: translateX(21px); border-color: #fff; }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(52, 137, 254, 0.25); }
.cb { width: 20px; height: 20px; border: 1.5px solid #c9ced6; border-radius: 4px; accent-color: var(--primary); margin: 0; cursor: pointer; }

/* Pranešimai */
.flash { padding: 12px 16px; border-radius: 8px; margin: 0 auto 16px; max-width: 1440px; font-size: 14px; border: 1px solid transparent; }
.flash-success { background: #eaf8e7; color: #2b7a1f; border-color: #c9ecc2; }
.flash-error { background: var(--red-soft); color: #b33a3a; border-color: #f4caca; }
.flash-warn { background: #fff6e0; color: #8a5a00; border-color: #f1dca0; }

/* ================= Sąskaitų sąrašas ================= */
.inv-table { width: 100%; }
.inv-grid { display: grid; grid-template-columns: 46px 19px 174px 285px 280px 195px minmax(0, 1fr) 104px 96px; align-items: center; }
.inv-grid.no-cb { grid-template-columns: 0 35px 155px 300px 300px 205px minmax(0, 1fr) 110px 96px; }
.inv-head { height: 48px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.inv-head > div { padding-top: 6px; }
.inv-head .cb-col, .inv-row .cb-col { display: flex; justify-content: center; }
.inv-group { height: 55px; background: var(--band); border-radius: 8px; margin: 0 0 0; font-size: 15px; }
.inv-group .g-title { grid-column: 3; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.inv-group .g-sums { grid-column: 4; display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.inv-group .g-right { grid-column: 5 / 9; display: flex; justify-content: flex-end; align-items: center; gap: 18px; white-space: nowrap; color: var(--text-2); }
.inv-group .g-right b { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.inv-group .g-count { grid-column: 9; display: flex; justify-content: center; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.dot.g { background: var(--green); }
.dot.r { background: var(--red); }
.dot.b { background: #64b5f6; }
.dot.o { background: #f5a623; }
.pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 600; }
.info-i { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: #c8ccd3; color: #fff; font-size: 9px; font-weight: 700; font-style: italic; margin-left: 6px; }

.inv-row { min-height: 51px; border-bottom: 1px solid var(--row); font-size: 15px; }
.inv-row > div { padding: 10px 0; }
.inv-row .arrow { background: none; border: 0; padding: 4px; margin-left: -10px; cursor: pointer; color: var(--text); display: inline-grid; transition: transform 0.15s; }
.inv-row.open .arrow { transform: rotate(90deg); }
.inv-row .client { padding-right: 14px; line-height: 1.25; }
.inv-row .sum { text-align: right; white-space: nowrap; }
.inv-row .menu-col { display: flex; justify-content: center; }
.inv-row.open { border-bottom-color: transparent; }
.inv-row:hover { background: #fcfcfd; }
.inv-row.cancelled .num, .inv-row.cancelled .sum { text-decoration: line-through; color: var(--muted-2); }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 4px; background: var(--badge); color: var(--badge-text); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap; }
.badge .late { color: var(--red); text-transform: none; font-weight: 500; font-size: 12px; margin-left: 4px; letter-spacing: 0; }
.status-wrap { display: inline-flex; align-items: center; gap: 4px; }
.quick-pay { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0; background: none; color: #b7bcc4; cursor: pointer; border-radius: 4px; padding: 0; }
.quick-pay:hover { color: var(--green); background: #eef8ec; }

.inv-detail { padding: 0 20px 26px; background: #fff; border-bottom: 1px solid var(--row); }
.inv-detail .loading { padding: 30px; text-align: center; color: var(--muted); }

/* Kortelės (detalės) */
.d-card { border: 1px solid #e3e6eb; border-radius: 6px; background: #fff; overflow: hidden; }
.d-card > .d-head { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 10px; background: var(--card-head); font-size: 15px; font-weight: 600; }
.d-card > .d-head .h-icons { display: flex; gap: 12px; color: var(--muted); }
.d-card > .d-head .h-icons a, .d-card > .d-head .h-icons button { color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; display: inline-grid; }
.d-items { width: 100%; border-collapse: collapse; font-size: 13px; }
.d-items th { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); text-align: right; padding: 10px 10px; border-bottom: 1px solid #edf0f3; }
.d-items th:first-child, .d-items td:first-child { text-align: left; }
.d-items td { padding: 9px 10px; border-bottom: 1px solid #edf0f3; text-align: right; }
.d-items tr.tot td { font-weight: 600; }
.d-items tr.sumrow td { border-bottom: 1px solid #edf0f3; }
.d-items tr:last-child td { border-bottom: 0; }
.d-items td.lbl { color: var(--text-2); text-align: right; }
.d-cols { display: grid; grid-template-columns: 452px 334px minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.kv { display: grid; grid-template-columns: 158px 1fr; gap: 10px 10px; padding: 12px 10px 14px; font-size: 13px; }
.kv dt { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding-top: 1px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.narrow { grid-template-columns: 176px 1fr; }
.d-actions { display: flex; align-items: center; gap: 28px; margin-top: 40px; flex-wrap: wrap; }
.d-actions .act { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 600; font-size: 14px; background: none; border: 0; cursor: pointer; padding: 0; }
.d-actions .act.red { color: var(--red); }
.d-actions .act:hover { text-decoration: underline; }
.d-actions .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.seg { display: inline-flex; border: 1px solid #e3e6eb; border-radius: 8px; padding: 3px; gap: 2px; background: #fff; }
.seg a, .seg button { height: 30px; min-width: 44px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 6px; font-weight: 600; font-size: 14px; color: var(--text); background: none; border: 0; cursor: pointer; }
.seg .on { background: #eaf2ff; color: var(--primary); }
.seg a:hover { text-decoration: none; background: #f3f5f8; }
.pay-list { padding: 4px 10px 10px; font-size: 13px; }
.pay-list .pay { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #edf0f3; }
.pay-list .pay:last-child { border-bottom: 0; }
.pay-list .pay b { margin-left: auto; font-weight: 600; }
.pay-add { padding: 10px; border-top: 1px solid #edf0f3; display: grid; grid-template-columns: 130px 110px 1fr auto; gap: 8px; align-items: end; }
.pay-add .input, .pay-add .select { height: 34px; font-size: 13px; }
.pay-toggle { display: flex; align-items: center; gap: 10px; padding: 10px; color: var(--muted); font-size: 14px; font-weight: 500; background: none; border: 0; width: 100%; cursor: pointer; text-align: left; }
.pay-toggle:hover { color: var(--primary); }

/* Meniu */
.menu { position: relative; display: inline-block; }
.menu-list { display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: #fff; border: 1px solid #e3e6eb; border-radius: 8px; box-shadow: var(--shadow); padding: 6px; z-index: 60; text-align: left; }
.menu-list.left { right: auto; left: 0; }
.menu-list.up { top: auto; bottom: calc(100% + 6px); }
.menu.open > .menu-list { display: block; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px; background: none; border: 0; color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; text-align: left; white-space: nowrap; }
.menu-list a:hover, .menu-list button:hover { background: #f3f5f8; text-decoration: none; }
.menu-list .danger { color: var(--red); }
.menu-list .muted-item { color: var(--muted-2); cursor: default; }
.menu-list hr { border: 0; border-top: 1px solid #edf0f3; margin: 6px 0; }
.menu-list form { margin: 0; }
.menu-list .m-title { font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px 4px; display: flex; align-items: center; gap: 8px; }

/* Puslapiavimas */
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 26px 0 6px; position: relative; }
.pager a, .pager span { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 6px; border: 1px solid #e3e6eb; color: var(--text); font-size: 13px; font-weight: 600; background: #fff; }
.pager a:hover { border-color: var(--primary); text-decoration: none; }
.pager .on { background: var(--primary-soft); border-color: var(--primary-soft); color: var(--primary); }
.pager .dots { border: 0; background: none; }
.pager .arr { border: 0; background: none; color: var(--text); }
.pager .arr.dis { color: #c3c8d0; pointer-events: none; }
.pager .per { position: absolute; right: 0; }
.pager .per select { height: 38px; width: 86px; }

/* Bendros lentelės (klientai, prekės, kvitai) */
.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th { height: 46px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 0 10px; white-space: nowrap; }
.list th a { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.list th a:hover { color: var(--primary); text-decoration: none; }
.list td { padding: 12px 10px; border-top: 1px solid var(--row); vertical-align: middle; }
.list tr:last-child td { border-bottom: 1px solid var(--row); }
.list .r { text-align: right; }
.list .cb-col { width: 40px; text-align: center; }
.list .arr-col { width: 24px; padding-left: 0; padding-right: 0; }
.list .menu-col { width: 60px; text-align: center; }
.list tr.sub td { background: #fcfcfd; }
.list .debt { display: inline-block; min-width: 92px; padding: 2px 6px; background: #fdf1f1; color: var(--red); border-radius: 3px; font-weight: 500; }
.list tr:hover td { background: #fcfcfd; }
.list .ex { font-weight: 400; color: var(--muted-2); }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty .btn { margin-top: 14px; }

/* Aktyvūs filtrai */
.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: -6px 0 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 5px; background: #f3f4f7; color: var(--text-2); font-weight: 500; }
.chip b { font-weight: 600; color: var(--text); }
.chip a { color: var(--muted); display: inline-grid; }
.chips .r-act { margin-left: auto; display: flex; gap: 6px; }
.chips .r-act a, .chips .r-act button { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 5px; background: #f3f4f7; color: var(--text); font-weight: 600; font-size: 12px; border: 0; cursor: pointer; }

/* Modalas */
.modal-back { position: fixed; inset: 0; background: rgba(41, 54, 72, 0.45); z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-back.open { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 630px; max-width: 100%; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; gap: 16px; padding: 22px 32px 18px; border-bottom: 1px solid #edf0f3; }
.modal-head h2 { font-size: 20px; font-weight: 600; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 20px 32px 18px; }
.modal-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 20px 32px 20px; border-top: 1px solid #edf0f3; }
.cond { display: grid; grid-template-columns: 130px 150px 1fr 30px; gap: 8px; align-items: center; margin-bottom: 10px; }
.cond .select, .cond .input { height: 36px; font-size: 14px; }
.cond-add { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.saved-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

/* ================= Formos / kortelės ================= */
.card { background: #fff; border: 1px solid #e3e6eb; border-radius: 10px; padding: 24px 28px; }
.card + .card { margin-top: 18px; }
.sec-title { font-size: 20px; font-weight: 600; margin: 0 0 16px; }
.sec-sub { font-size: 16px; font-weight: 600; margin: 26px 0 12px; }
.divider { border: 0; border-top: 1px solid var(--line-soft); margin: 26px 0; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 24px; }

/* Sąskaitos forma */
.inv-sheet { max-width: 1440px; margin: 0 auto; background: #fff; border: 1px solid #e3e6eb; border-radius: 10px; padding: 34px 40px 40px; }
.inv-sheet .top { display: grid; grid-template-columns: 1fr 520px; gap: 30px; align-items: start; }
.inv-sheet .doc-type { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; margin-bottom: 18px; }
.inv-sheet .doc-type select { border: 0; font-size: 22px; font-weight: 700; padding: 0 28px 0 0; height: auto; background-position: right 4px center; cursor: pointer; }
.inv-sheet .logo-box img { max-height: 70px; max-width: 220px; }
.meta { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; align-items: center; }
.meta label { text-align: right; font-weight: 600; font-size: 15px; color: var(--text); }
.meta .row-inline { display: flex; gap: 8px; align-items: center; }
.meta .num-lock { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: 5px; background: #f3f4f7; font-size: 12px; font-weight: 600; color: var(--muted); }
.parties { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; margin-top: 46px; }
.parties h3 { font-size: 20px; font-weight: 600; margin-bottom: 16px; }
.seller-kv { display: grid; grid-template-columns: 140px 1fr; gap: 14px; font-size: 13px; align-items: center; }
.seller-kv dt { font-weight: 500; color: var(--muted); font-size: 12px; }
.seller-kv dd { margin: 0; font-size: 14px; }
.bank-box { border: 1px solid #e3e6eb; border-radius: 8px; margin-top: 18px; max-width: 380px; }
.bank-box .b-row { display: flex; align-items: center; gap: 16px; padding: 14px 12px; border-bottom: 1px solid #edf0f3; font-size: 13px; }
.bank-box .b-row:last-child { border-bottom: 0; }
.bank-box .b-row .switch { margin-left: auto; }
.items-wrap { margin-top: 46px; }
.items-wrap h3 { font-size: 20px; font-weight: 600; margin-bottom: 16px; }
.it-table { width: 100%; border-collapse: collapse; }
.it-table th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 0 4px 8px; border-bottom: 1px solid #e3e6eb; white-space: nowrap; }
.it-table td { padding: 14px 4px 4px; vertical-align: top; }
.it-table .num-cell { width: 26px; padding-top: 24px; color: var(--muted); text-align: right; padding-right: 8px; }
.it-table .input, .it-table .select { height: 40px; }
.it-table .desc { margin-top: 6px; border: 0; padding: 0 2px; font-size: 13px; color: var(--muted); height: auto; min-height: 20px; resize: none; width: 100%; background: transparent; }
.it-table .desc:focus { outline: none; color: var(--text); }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; height: 40px; background: #fff; }
.stepper button { width: 34px; height: 100%; border: 0; background: none; cursor: pointer; font-size: 18px; color: var(--text); }
.stepper input { width: 100%; border: 0; text-align: center; height: 100%; outline: none; min-width: 0; }
.it-table .ro { background: #f6f7f9; }
.add-line { margin: 14px 0 0 26px; }
.totals-area { display: grid; grid-template-columns: 1fr 420px; gap: 40px; margin-top: 28px; border-top: 1px solid #e3e6eb; padding-top: 22px; }
.t-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 13px; }
.t-row b { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.t-row.sm b { font-size: 20px; }
.t-row .lbl { font-weight: 600; font-size: 13px; }
.t-toggle { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; font-size: 14px; font-weight: 500; }
.words-line { margin-top: 26px; font-size: 18px; font-weight: 500; }
.sticky-actions { padding: 22px 0 10px; display: flex; gap: 12px; justify-content: flex-end; max-width: 1440px; margin: 0 auto; }

.combo { position: relative; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid #e3e6eb; border-radius: 8px; box-shadow: var(--shadow); max-height: 330px; overflow: auto; padding: 4px; margin: 0; list-style: none; }
.combo-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.combo-list li small { display: block; color: var(--muted); font-size: 12px; }
.combo-list li.grp { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; cursor: default; padding: 8px 10px 4px; }
.combo-list li.act, .combo-list li:not(.grp):hover { background: var(--primary-soft); }
.combo-list li.inactive { color: var(--muted-2); text-decoration: line-through; }
.buyer-fields { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.buyer-fields .span2 { grid-column: span 2; }

/* ================= Nustatymai ================= */
.settings { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - 92px); }
.set-nav { border-right: 1px solid var(--line); padding: 22px 20px; background: #fff; }
.set-nav a { display: flex; align-items: center; gap: 10px; height: 35px; padding: 0 8px; border-radius: 6px; color: var(--text); font-size: 14px; font-weight: 500; }
.set-nav a:hover { background: var(--side); text-decoration: none; }
.set-nav a.active { background: #eef0f4; }
.set-nav .grp { font-size: 14px; color: var(--muted); padding: 18px 8px 6px; }
.set-nav svg { width: 18px; height: 18px; color: var(--text); }
.set-body { padding: 36px 40px 120px; }
.set-body .inner { max-width: 1440px; margin: 0 auto; padding: 0 0 0 0; max-width: 1340px; }
.set-body h1 { font-size: 26px; font-weight: 600; margin: 0 0 24px; }
.set-body h2 { font-size: 20px; font-weight: 600; margin: 34px 0 14px; }
.opt-box { border: 1px solid #e3e6eb; border-radius: 6px; }
.opt { display: flex; align-items: center; gap: 16px; min-height: 52px; padding: 8px 14px; border-bottom: 1px solid #edf0f3; font-size: 14px; }
.opt:last-child { border-bottom: 0; }
.opt .o-label { flex: 1; }
.opt .o-desc { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.opt .o-ctrl { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.opt .o-ctrl .select, .opt .o-ctrl .input { height: 38px; width: auto; min-width: 120px; }
.opt.info { min-height: 40px; font-size: 13px; color: var(--muted); }
.opt .drag { color: var(--muted-2); }
.opt .def { display: inline-block; padding: 2px 6px; background: var(--primary); color: #fff; border-radius: 3px; font-size: 11px; font-weight: 600; }
.save-bar { position: fixed; left: calc(var(--side-w) + 236px); right: 0; bottom: 0; display: flex; justify-content: flex-end; padding: 14px 30px; background: #fff; border-top: 1px solid var(--line-soft); z-index: 30; }
.series-group { font-size: 13px; color: var(--muted); padding: 10px 14px 4px; border-bottom: 0; }
.mini-stepper { display: inline-flex; align-items: center; height: 34px; border: 1px solid var(--line); border-radius: 6px; }
.mini-stepper button { width: 30px; height: 100%; border: 0; background: none; cursor: pointer; font-size: 16px; }
.mini-stepper input { width: 64px; height: 100%; border: 0; text-align: center; outline: none; }
.logo-prev { display: flex; align-items: center; gap: 16px; }
.logo-prev img { max-height: 60px; max-width: 200px; border: 1px solid #edf0f3; border-radius: 6px; padding: 6px; background: #fff; }
pre.code { background: var(--side); border: 1px solid #e3e6eb; padding: 12px; border-radius: 6px; overflow: auto; font-size: 12px; font-family: var(--mono); }
.progress { height: 8px; background: #eef0f4; border-radius: 4px; overflow: hidden; margin-top: 10px; }
.progress span { display: block; height: 100%; width: 0; background: var(--primary); transition: width 0.3s ease-out; }

/* ================= Statistika ================= */
.stat-head { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; }
.stat-head .yr { display: flex; align-items: center; gap: 14px; font-size: 17px; font-weight: 600; }
.stat-head .yr a { color: var(--text); display: inline-grid; }
.stat-head .ctrls { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-head .ctrls .select { height: 38px; width: 100px; }
.stat-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; margin-bottom: 26px; }
.stat-card .k { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.stat-card .k .ic { width: 22px; height: 22px; border-radius: 5px; display: inline-grid; place-items: center; }
.stat-card .v { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin-top: 8px; }
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; justify-content: center; gap: 18px; font-size: 13px; font-weight: 500; margin-top: 10px; }
.stat-list { margin-top: 50px; border-top: 1px solid var(--line-soft); padding-top: 34px; }
.stat-list h2 { font-size: 20px; font-weight: 600; display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }

/* ================= Prisijungimas ================= */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: var(--side); }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid #e3e6eb; border-radius: 14px; padding: 32px; box-shadow: var(--shadow); }
.login-card.wide { max-width: 640px; }
.login-card h1 { font-size: 22px; font-weight: 600; margin: 0 0 18px; }
.login-card h2 { font-size: 17px; margin: 18px 0 10px; }
.login-card .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; margin-bottom: 22px; }
.login-card .brand .mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--primary); color: #fff; font-size: 13px; }
.login-card .form { display: flex; flex-direction: column; gap: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.login-card input:not([type=checkbox]) { height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font-size: 15px; color: var(--text); }
.login-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(52, 137, 254, 0.18); }
.login-card label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--text); font-weight: 500; }
input.otp { font-family: var(--mono); font-size: 26px !important; letter-spacing: 0.35em; text-align: center; }
.steps { margin: 4px 0 16px; padding-left: 20px; color: var(--text-2); font-size: 14px; }
.qr-row { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.qr { width: 180px; height: 180px; background: #fff; border: 1px solid #e3e6eb; border-radius: 8px; padding: 6px; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: 0.06em; margin: 4px 0 8px; word-break: break-all; user-select: all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; background: var(--side); border: 1px solid #e3e6eb; border-radius: 8px; padding: 14px; margin: 14px 0 16px; font-family: var(--mono); text-align: center; }
.checks-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; font-size: 13px; }
.checks-grid div { padding: 4px 10px; border-radius: 999px; background: #eaf8e7; color: #2b7a1f; }
.checks-grid div.bad { background: var(--red-soft); color: var(--red); }

/* Registras (paieška) */
.registry-hint { font-size: 12px; color: var(--muted-2); margin-top: 6px; font-weight: 400; }
.registry-hint.warn { color: var(--red); }
.vies-out.ok { color: #2b7a1f; }
.vies-out.bad { color: var(--red); }
.with-btn { display: flex; gap: 6px; }
.with-btn .input, .with-btn input { flex: 1; }

/* ================= Prisitaikymas ================= */
@media (max-width: 1500px) {
  .inv-grid { grid-template-columns: 40px 19px 120px 220px 210px 120px minmax(0, 1fr) 110px 60px; }
  .d-cols { grid-template-columns: 1fr 1fr; }
  .d-cols > :last-child { grid-column: span 2; }
}
@media (max-width: 1100px) {
  :root { --side-w: 0px; }
  .sidebar { transform: translateX(-100%); width: 274px; transition: transform 0.2s; box-shadow: var(--shadow); }
  body.side-open .sidebar { transform: none; }
  .topbar .brand { width: auto; margin-right: 12px; }
  .inv-grid { grid-template-columns: 34px 19px 98px 1fr 0 90px 1fr 100px 40px; font-size: 13px; }
  .inv-grid > .type-col { visibility: hidden; overflow: hidden; white-space: nowrap; }
  .inv-head .type-col { visibility: hidden; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .settings { grid-template-columns: 1fr; }
  .set-nav { border-right: 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px; padding: 12px; }
  .set-nav .grp { display: none; }
  .save-bar { left: 0; }
  .inv-sheet .top, .parties, .totals-area { grid-template-columns: 1fr; gap: 24px; }
  .d-cols { grid-template-columns: 1fr; }
  .d-cols > :last-child { grid-column: auto; }
  .g3, .g4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .content, .toolbar, .set-body { padding-left: 14px; padding-right: 14px; }
  .top-search { display: none; }
  .search-box { width: 100%; }
  .inv-grid { grid-template-columns: 0 19px 86px 1fr 0 0 0 96px 34px; }
  .inv-grid > .cb-col, .inv-grid > .series-col, .inv-grid > .client-col { display: none; }
  .inv-row .status-col .badge { font-size: 10px; }
  .inv-group .g-sums { display: none; }
  .inv-group .g-right span:first-child { display: none; }
  .g2, .g3, .g4, .buyer-fields { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  .inv-sheet { padding: 20px 16px; }
  .stat-cards { grid-template-columns: 1fr; }
  .modal-body, .modal-head, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .cond { grid-template-columns: 1fr 1fr; }
  .cond > :nth-child(3) { grid-column: span 2; }
}

/* Papildymai */
.inline-f { display: inline; margin: 0; }
.combo-list li.active { background: var(--primary-soft); }
.combo-list li.empty { color: var(--muted); cursor: default; }
.co-menu { left: calc(100% - 4px) !important; top: 8px !important; min-width: 260px; }
.inv-row.no-cb, .inv-head.no-cb { grid-template-columns: 0 35px 155px 300px 300px 205px minmax(0, 1fr) 110px 96px; }
.it-table .r, .input.r { text-align: right; }
.d-actions form { display: inline; }

/* ================= v1.0.2: PWA ir telefonas ================= */
.tabbar, .side-scrim { display: none; }
.passkey-box .or { display: flex; align-items: center; gap: 10px; color: var(--muted-2); font-size: 12px; margin: 18px 0 14px; }
.passkey-box .or::before, .passkey-box .or::after { content: ""; flex: 1; border-top: 1px solid var(--line-soft); }
.c { text-align: center; }
html.is-app body { -webkit-user-select: none; user-select: none; }
html.is-app input, html.is-app textarea, html.is-app [contenteditable] { -webkit-user-select: text; user-select: text; }
.share-btn { display: none; }
@supports (-webkit-touch-callout: none) { .share-btn { display: inline-flex; } }

@media (max-width: 1100px) {
  .side-scrim { position: fixed; inset: var(--top-h) 0 0 0; background: rgba(41, 54, 72, 0.35); z-index: 39; }
  body.side-open .side-scrim { display: block; }
}

@media (max-width: 700px) {
  html { font-size: 15px; }
  body { overscroll-behavior-y: none; }
  .topbar { padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top)); }
  .topbar #sideToggle, .topbar .brand .ver, .top-actions .sep { display: none; }
  .topbar .brand { font-size: 17px; }
  .top-actions { margin-left: auto; gap: 4px; }
  .top-user { font-size: 0; gap: 0; }
  .top-user svg { width: 22px; height: 22px; }
  .sidebar { top: calc(var(--top-h) + env(safe-area-inset-top)); bottom: calc(64px + env(safe-area-inset-bottom)); }
  .page { padding-top: calc(var(--top-h) + env(safe-area-inset-top)); padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .app-foot { display: none; }
  .page-title { padding: 0 14px; height: 40px; font-size: 13px; overflow: hidden; white-space: nowrap; }
  .content { padding: 14px 12px 24px; }

  /* Apatinė juosta */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 500; color: var(--muted); background: none; border: 0; padding: 6px 0; text-decoration: none; }
  .tabbar .on { color: var(--primary); }
  .tabbar .tab-new { justify-self: center; width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: #fff; padding: 0; justify-content: center; box-shadow: 0 6px 16px -4px rgba(52, 137, 254, 0.55); }
  .tabbar .tab-new:active { transform: scale(0.94); }

  /* Įrankių juosta */
  .toolbar { padding: 10px 12px; gap: 10px 16px; justify-content: flex-start; }
  .toolbar .search-box { width: 100%; order: -1; }
  .toolbar .btn-primary { display: none; }

  /* Sąskaitų sąrašas – kortelės */
  .inv-head { display: none; }
  .inv-group { display: flex; justify-content: space-between; height: auto; padding: 12px 14px; margin-top: 14px; }
  .inv-group .g-title { font-size: 15px; }
  .inv-group .g-sums, .inv-group .g-count, .inv-group .g-right > span:first-child { display: none !important; }
  .inv-group .g-right b { font-size: 16px; }
  .inv-group .info-i { display: none; }
  .inv-row, .inv-row.no-cb { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "client sum" "num status" "date status";
    gap: 2px 12px; padding: 12px 4px; min-height: 0; font-size: 14px; }
  .inv-row > div { padding: 0 !important; }
  .inv-row > .cb-col, .inv-row > :nth-child(2), .inv-row > .type-col, .inv-row > .menu-col { display: none !important; }
  .inv-row > .client-col { display: block !important; grid-area: client; font-weight: 600; font-size: 15px; }
  .inv-row > .sum { grid-area: sum; font-weight: 600; font-size: 15px; }
  .inv-row > .series-col { display: block !important; grid-area: num; color: var(--muted); font-size: 13px; }
  .inv-row > :nth-child(3) { grid-area: date; color: var(--muted); font-size: 13px; }
  .inv-row > .status-col { grid-area: status; justify-self: end; align-self: end; }
  .inv-row .badge { font-size: 10px; height: 20px; padding: 0 6px; }
  .inv-row .badge .late { font-size: 11px; }
  .inv-row.open { background: var(--band); border-radius: 8px 8px 0 0; padding-left: 10px; padding-right: 10px; }
  .inv-detail { padding: 0 0 18px; }

  /* Detalė */
  .d-card > .d-head { font-size: 14px; }
  .d-card { overflow-x: auto; }
  .d-items { min-width: 520px; font-size: 12px; }
  .d-cols { grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
  .kv, .kv.narrow { grid-template-columns: 120px minmax(0, 1fr); font-size: 13px; }
  .pay-add { grid-template-columns: 1fr 1fr; }
  .pay-add .btn { grid-column: span 2; height: 40px; }
  .d-actions { gap: 14px 22px; margin-top: 22px; }
  .d-actions .right { margin-left: 0; width: 100%; display: grid; grid-template-columns: auto 1fr 1fr; }
  .d-actions .right .btn { height: 42px; }
  .d-actions .right .btn-primary { grid-column: 1 / -1; }

  /* Lentelės */
  .list { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .list td, .list th { padding-left: 8px; padding-right: 8px; }
  .pager { flex-wrap: wrap; gap: 6px; padding-top: 18px; }
  .pager .per { position: static; width: 100%; display: flex; justify-content: center; }
  .chips { margin-bottom: 8px; }
  .chips .r-act { margin-left: 0; }

  /* Modalas kaip apatinis lapas */
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .cond { grid-template-columns: 1fr 1fr 30px; }
  .cond > :nth-child(3) { grid-column: 1 / 3; }
  .modal-foot { grid-template-columns: 1fr 1fr; }

  /* Sąskaitos forma */
  .inv-sheet { padding: 18px 14px 20px; border-radius: 10px; }
  .inv-sheet .doc-type select { font-size: 19px; }
  .meta { grid-template-columns: 100px 1fr; }
  .meta label { text-align: left; font-size: 14px; }
  .parties { margin-top: 26px; }
  .parties h3, .items-wrap h3 { font-size: 18px; }
  .bank-box { max-width: none; }
  .bank-box .b-row { flex-wrap: wrap; gap: 6px 12px; }
  .it-table thead { display: none; }
  .it-table, .it-table tbody { display: block; }
  .it-table tr.item { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 8px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
  .it-table td { padding: 0; display: flex; flex-direction: column; gap: 4px; }
  .it-table td[data-l]::before { content: attr(data-l); font-size: 11px; font-weight: 600; color: var(--muted); }
  .it-table .num-cell { display: none; }
  .it-table .name-cell { grid-column: 1 / -1; }
  .it-table .del-cell { justify-content: flex-end; align-items: flex-end; }
  .it-table .input, .it-table .select, .stepper { height: 42px; font-size: 16px; }
  .add-line { margin-left: 0; }
  .totals-area { margin-top: 18px; }
  .words-line { font-size: 15px; }
  .sticky-actions { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); background: #fff; padding: 10px 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line-soft); z-index: 20; }
  .sticky-actions .btn-primary { grid-column: 1 / -1; order: -1; }
  .sticky-actions .btn-gray { display: none; }
  /* iOS nedidina, kai šriftas >= 16px */
  .input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea, .select, .search-box input, .login-card input:not([type=checkbox]) { font-size: 16px; }

  /* Statistika */
  .stat-head { flex-wrap: wrap; }
  .stat-head .ctrls { margin-left: 0; }
  .stat-cards { grid-template-columns: 1fr 1fr; gap: 14px; }
  .stat-card .k { font-size: 12px; }
  .stat-card .v { font-size: 20px; }
  .chart { min-width: 760px; }
  .stat-head + .stat-cards + .chart, .chart { overflow: visible; }
  .stat-list { margin-top: 30px; padding-top: 20px; }

  /* Nustatymai */
  .settings { min-height: 0; }
  .set-nav { flex-wrap: nowrap; overflow-x: auto; padding: 10px 12px; gap: 4px; -webkit-overflow-scrolling: touch; }
  .set-nav a { white-space: nowrap; flex: none; height: 34px; background: var(--side); }
  .set-body { padding: 18px 12px 120px; }
  .set-body h1 { font-size: 21px; margin-bottom: 16px; }
  .opt { flex-wrap: wrap; }
  .opt .o-ctrl { margin-left: 0; flex-wrap: wrap; }
  .save-bar { left: 0; bottom: calc(64px + env(safe-area-inset-bottom)); padding: 10px 12px; }
  .save-bar .btn { width: 100%; }
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .card { padding: 18px 14px; }
}

/* ================= v1.0.3 ================= */
/* Invoicy logotipas */
.brand { gap: 9px; }
.logo-mark { flex: none; display: block; }
.logo-word { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); line-height: 1; }
.logo-word span { color: var(--primary); }
.login-card .brand .logo-word { font-size: 21px; }

/* Šoninio meniu suskleidimas (darbalaukis) */
@media (min-width: 1101px) {
  .sidebar { will-change: auto; }
  body.side-collapsed { --side-w: 68px; }
  body.side-collapsed .sidebar { overflow-x: hidden; }
  body.side-collapsed .side-company { padding: 14px 10px 0; }
  body.side-collapsed .co-btn > span, body.side-collapsed .co-btn > svg { display: none; }
  body.side-collapsed .co-btn::before { content: attr(data-initial); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: #e6edf9; color: var(--primary); font-weight: 700; font-size: 16px; margin: 0 auto; }
  body.side-collapsed .co-btn { justify-content: center; }
  body.side-collapsed .side-turnover, body.side-collapsed .side-section, body.side-collapsed .side-nav a.sub, body.side-collapsed .side-foot, body.side-collapsed .side-nav .gap { display: none; }
  body.side-collapsed .side-cta { padding: 14px 10px; }
  body.side-collapsed .btn-side { width: 44px; height: 40px; margin: 0 auto; padding: 0; }
  body.side-collapsed .btn-side span { display: none; }
  body.side-collapsed .side-nav { padding: 10px 10px 0; gap: 2px; }
  body.side-collapsed .side-nav a { justify-content: center; padding: 0; height: 40px; gap: 0; }
  body.side-collapsed .side-nav a span, body.side-collapsed .side-nav a .plus { display: none; }
  body.side-collapsed .side-nav a svg { width: 20px; height: 20px; color: var(--text); }
  body.side-collapsed .save-bar { left: calc(68px + 236px); }
}
.btn-side svg { display: none; }
body.side-collapsed .btn-side svg { display: block; }

/* Veiklų langas */
.co-modal { width: 480px; }
.co-modal .modal-body { display: flex; flex-direction: column; gap: 8px; }
.co-modal form { margin: 0; }
.co-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; border: 1px solid #e3e6eb; border-radius: 10px; background: #fff; cursor: pointer; text-align: left; color: var(--text); }
.co-item:hover { border-color: var(--primary); background: #fafcff; }
.co-item.on { border-color: var(--primary); background: var(--primary-soft); }
.co-item.on > svg { color: var(--primary); }
.co-av { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: #e6edf9; color: var(--primary); font-weight: 700; font-size: 16px; flex: none; }
.co-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.co-txt b { font-weight: 600; font-size: 15px; }
.co-txt small { color: var(--muted); font-size: 12px; }
.co-foot { display: flex; justify-content: space-between; gap: 12px; padding: 16px 32px 20px; border-top: 1px solid #edf0f3; flex-wrap: wrap; }
.side-company .co-btn { border-radius: 8px; padding: 6px 8px; margin: -6px -8px; width: calc(100% + 16px); }
.side-company .co-btn:hover { background: var(--nav-active); }

/* Sąrašas: lankstūs stulpeliai visuose pločiuose */
.inv-grid { grid-template-columns: 46px 19px minmax(96px, 174fr) minmax(176px, 285fr) minmax(0, 280fr) minmax(88px, 195fr) minmax(150px, 330fr) minmax(104px, 120fr) 64px; column-gap: 0; }
.inv-grid.no-cb, .inv-row.no-cb, .inv-head.no-cb { grid-template-columns: 0 35px minmax(96px, 174fr) minmax(176px, 285fr) minmax(0, 280fr) minmax(88px, 195fr) minmax(150px, 330fr) minmax(104px, 120fr) 64px; }
.inv-row .client { padding-right: 16px; overflow-wrap: anywhere; }
.inv-row .sum { padding-left: 8px; }
@media (max-width: 1420px) and (min-width: 701px) {
  .inv-grid, .inv-grid.no-cb, .inv-row.no-cb, .inv-head.no-cb { grid-template-columns: 40px 19px minmax(92px, 1fr) minmax(170px, 1.6fr) 0 minmax(80px, 0.9fr) minmax(150px, 2fr) minmax(100px, 1fr) 52px; }
  .inv-grid > .type-col { visibility: hidden; overflow: hidden; white-space: nowrap; }
  .inv-group .g-right { grid-column: 6 / 9; }
}
@media (max-width: 1100px) and (min-width: 701px) {
  .inv-grid, .inv-grid.no-cb, .inv-row.no-cb, .inv-head.no-cb { grid-template-columns: 34px 19px 96px minmax(150px, 1.4fr) 0 0 minmax(130px, 2fr) 100px 44px; font-size: 14px; }
  .inv-grid > .series-col { visibility: hidden; overflow: hidden; white-space: nowrap; }
  .inv-row > .client-col::after { content: attr(data-num); display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
  .inv-group .g-sums { grid-column: 4; }
  .inv-group .g-right { grid-column: 7 / 9; }
}

/* Išskleista sąskaita: 3 stulpeliai tik plačiame ekrane, kitaip 2 + mokėjimai per visą plotį */
.d-cols { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1.15fr); }
@media (max-width: 1900px) {
  .d-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .d-cols > :last-child { grid-column: 1 / -1; }
}
.kv { grid-template-columns: minmax(110px, 158px) minmax(0, 1fr); }
.pay-add { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.pay-add .btn { align-self: end; }

/* Siuntimo langas */
.send-modal { width: 640px; }
.send-modal .grid { gap: 14px; }
.send-modal textarea { min-height: 170px; }
.attach-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid #e3e6eb; border-radius: 8px; font-size: 14px; }
.attach-row .file { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.attach-row .file svg { color: var(--red); }
.attach-row .seg { margin-left: auto; }

/* Sąskaitos forma: numerio atrakinimas, papildoma informacija, apatinė juosta */
.num-input { width: 96px; }
.num-input[readonly] { background: #f6f7f9; color: var(--muted); }
.num-lock { cursor: pointer; border: 0; }
.num-lock.open { background: var(--primary-soft); color: var(--primary); }
.seller-kv dd .edit-i { color: var(--muted); margin-left: 6px; vertical-align: -3px; }
.extra-info { margin-top: 40px; border-top: 1px solid #e3e6eb; padding-top: 24px; }
.extra-info h3 { font-size: 20px; font-weight: 600; margin-bottom: 16px; }
.extra-toggles { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.extra-toggles label.tg { display: inline-flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 500; cursor: pointer; }
.form-bar { display: flex; align-items: center; gap: 12px; max-width: 1440px; margin: 0 auto; padding: 18px 40px; background: #fff; border: 1px solid #e3e6eb; border-top: 0; border-radius: 0 0 10px 10px; }
.inv-sheet.has-bar { border-radius: 10px 10px 0 0; }
.form-bar .left { margin-right: auto; }
.form-bar .btn-text { background: none; border: 0; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--text); cursor: pointer; padding: 8px 4px; }
.form-bar .btn-text:hover { color: var(--primary); }
.paid-method { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding-bottom: 6px; }
.paid-method .select { width: auto; height: 34px; font-size: 13px; }
@media (max-width: 700px) {
  .form-bar { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); padding: 10px 12px; display: grid; grid-template-columns: 1fr 1fr; z-index: 20; border-radius: 0; }
  .form-bar .left { grid-column: 1 / -1; margin: 0; justify-self: center; order: 3; }
  .form-bar .btn-primary { grid-column: 1 / -1; order: -1; }
  .co-foot { padding: 14px 18px 18px; }
}

/* Prekių lentelė: fiksuotas išdėstymas, kad ilgi pasirinkimai neplėstų lentelės */
.it-table { table-layout: fixed; }
.it-table .select, .it-table .input { width: 100%; min-width: 0; }
.it-table th:nth-child(1) { width: 26px; }
.it-table th:nth-child(3) { width: 96px; }
.it-table th:nth-child(4) { width: 130px; }
.it-table th:nth-child(5) { width: 110px; }
.it-table th:nth-child(6) { width: 90px; }
.it-table th:nth-child(7) { width: 90px; }
.it-table th:nth-child(8), .it-table th:nth-child(9) { width: 110px; }
.it-table th:nth-child(10) { width: 40px; }
.inv-sheet, .inv-sheet * { min-width: 0; }
.page { min-width: 0; overflow-x: clip; }
/* Vidutiniai ekranai: eilutė dviem aukštais (pavadinimas viršuje, skaičiai apačioje) */
@media (max-width: 1500px) and (min-width: 701px) {
  .it-table thead { display: none; }
  .it-table, .it-table tbody { display: block; }
  .it-table tr.item { display: grid; grid-template-columns: 26px minmax(0, 1fr) 96px 130px 110px 84px 84px 104px 104px 36px; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); align-items: end; }
  .it-table td { padding: 0; display: flex; flex-direction: column; gap: 4px; }
  .it-table td[data-l]::before { content: attr(data-l); font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
  .it-table .num-cell { padding: 0 0 12px; align-self: start; padding-top: 34px; }
  .it-table .name-cell { grid-column: 2 / -1; grid-row: 1; }
  .it-table tr.item > td:nth-child(n+3) { grid-row: 2; }
  .it-table tr.item > td:nth-child(3) { grid-column: 2 / 4; }
  .it-table .del-cell { justify-content: flex-end; }
}
@media (max-width: 1250px) and (min-width: 701px) {
  .it-table tr.item { grid-template-columns: 26px repeat(4, minmax(0, 1fr)) 36px; }
  .it-table tr.item > td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .it-table tr.item > td:nth-child(4) { grid-column: 3; grid-row: 2; }
  .it-table tr.item > td:nth-child(5) { grid-column: 4; grid-row: 2; }
  .it-table tr.item > td:nth-child(6) { grid-column: 5; grid-row: 2; }
  .it-table tr.item > td:nth-child(7) { grid-column: 2; grid-row: 3; }
  .it-table tr.item > td:nth-child(8) { grid-column: 3; grid-row: 3; }
  .it-table tr.item > td:nth-child(9) { grid-column: 4; grid-row: 3; }
  .it-table tr.item > td:nth-child(10) { grid-column: 6; grid-row: 3; }
  .parties { gap: 32px; }
  .inv-sheet .top { grid-template-columns: 1fr minmax(0, 440px); }
}

/* ================= v1.0.4 ================= */
.pay-grid { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(120px, 0.8fr) minmax(170px, 1fr) auto; gap: 12px; align-items: end; }
.pay-grid .field { gap: 6px; }
.pay-grid .field > input, .pay-grid .field > select { height: 38px; font-size: 14px; }
.pay-grid .pay-btn .btn { height: 38px; }
.pay-add { display: block; padding: 12px 10px; border-top: 1px solid #edf0f3; }
.pay-add.hidden { display: none; }
.pay-modal { width: 560px; }
.pay-modal .pay-grid { grid-template-columns: 1fr 1fr; }
.pay-modal .pay-grid .field:nth-child(3) { grid-column: 1 / -1; }
.menu-list button[data-pay] { color: var(--primary); }

/* PDF peržiūra programėlėje */
.pdf-body { background: #e9ecf1; margin: 0; }
.pdf-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 10px 8px; background: rgba(255, 255, 255, 0.96); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.pdf-back { display: inline-flex; align-items: center; gap: 2px; font-size: 16px; font-weight: 500; color: var(--primary); padding: 6px 4px; }
.pdf-back:hover { text-decoration: none; }
.pdf-title { flex: 1; text-align: center; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-acts { display: flex; gap: 4px; }
.pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 8px calc(24px + env(safe-area-inset-bottom)); }
.pdf-pages canvas { background: #fff; box-shadow: 0 1px 2px rgba(3, 18, 39, 0.08), 0 8px 24px -8px rgba(3, 18, 39, 0.18); border-radius: 2px; max-width: 100%; }
.pdf-pages .loading { padding: 60px 20px; color: var(--muted); }

/* Telefono vaizdas: galutinės taisyklės (paskutinės, kad nebūtų perrašytos) */
@media (max-width: 700px) {
  .inv-row, .inv-row.no-cb, .inv-grid.inv-row { grid-template-columns: minmax(0, 1fr) auto !important; grid-template-areas: "client sum" "num status" "date status"; }
  .inv-grid.inv-group { display: flex; }
  .inv-row > .type-col { display: none !important; visibility: visible; }
  .inv-row > .series-col { visibility: visible !important; }
  .inv-row > .client-col::after { content: none !important; }
  .d-cols { grid-template-columns: 1fr !important; }
  .d-cols > :last-child { grid-column: auto !important; }
  .kv, .kv.narrow { grid-template-columns: minmax(96px, 120px) minmax(0, 1fr); }
  .kv dt { font-size: 10px; }
  .pay-grid { grid-template-columns: 1fr 1fr; }
  .pay-grid .field:nth-child(3), .pay-grid .pay-btn { grid-column: 1 / -1; }
  .pay-grid .pay-btn span { display: none; }
  .pay-grid .pay-btn .btn { width: 100%; height: 44px; }
  .pay-list .pay { flex-wrap: wrap; gap: 4px 10px; }
  .d-actions { gap: 12px 18px; }
  .d-actions .act { font-size: 14px; }
  .menu-list { min-width: 240px; max-width: calc(100vw - 24px); }
  .menu-list a, .menu-list button { white-space: normal; }
  .d-actions .menu .menu-list { position: fixed; left: 12px !important; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); top: auto; max-height: 60vh; overflow: auto; }
  .seller-kv { grid-template-columns: 96px minmax(0, 1fr); }
  .meta { grid-template-columns: 96px minmax(0, 1fr); }
  .meta .row-inline { flex-wrap: wrap; }
  .num-input { width: 80px; }
  .extra-info .grid { grid-template-columns: 1fr; }
  .co-modal { width: 100%; }
}
@media (max-width: 700px) {
  .d-items { min-width: 0 !important; table-layout: auto; }
  .d-items th:nth-child(3), .d-items th:nth-child(4), .d-items th:nth-child(5),
  .d-items tbody tr:not(.sumrow) td:nth-child(3), .d-items tbody tr:not(.sumrow) td:nth-child(4), .d-items tbody tr:not(.sumrow) td:nth-child(5) { display: none; }
  .d-items td:first-child { width: 60%; }
}
.d-items td:last-child { white-space: nowrap; }
@media (max-width: 700px) {
  .d-items .sr-pad { display: none; }
  .d-items td.lbl { text-align: right; }
}

/* ================= v1.0.5: pirkimai ================= */
.dropzone { position: relative; }
.dz-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 34px 20px; border: 2px dashed #c9d2de; border-radius: 12px; background: var(--side); cursor: pointer; text-align: center; transition: border-color 0.15s, background 0.15s; }
.dz-inner:hover, .dropzone.over .dz-inner { border-color: var(--primary); background: #f3f8ff; }
.dz-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: #fff; color: var(--primary); box-shadow: 0 2px 6px rgba(3, 18, 39, 0.08); }
.dz-text { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.dz-text b { font-size: 15px; font-weight: 600; }
.dz-text span { color: var(--muted); }
.dz-ai { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: #fff; border: 1px solid #e3e6eb; }
.dz-ai.on { color: #2b7a1f; border-color: #c9ecc2; background: #eaf8e7; }
.dz-busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; background: rgba(255, 255, 255, 0.92); border-radius: 12px; font-weight: 600; color: var(--primary); }
.dz-busy[hidden] { display: none; }
.dz-busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.seg.tabs a { min-width: 0; padding: 0 14px; }
.pur-wrap { max-width: 1440px; margin: 0 auto; }
.pur-wrap.has-doc { display: grid; grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.4fr); gap: 20px; align-items: start; }
.pur-wrap.has-doc .pur-bar { grid-column: 1 / -1; border-radius: 10px; border-top: 1px solid #e3e6eb; }
.pur-doc { position: sticky; top: calc(var(--top-h) + 16px); border: 1px solid #e3e6eb; border-radius: 10px; background: #fff; overflow: hidden; }
.pur-doc-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 14px; background: var(--card-head); font-size: 13px; font-weight: 600; }
.pur-doc-head span { display: inline-flex; gap: 6px; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pur-doc img { display: block; width: 100%; height: auto; }
.pur-doc iframe { display: block; width: 100%; height: 78vh; border: 0; }
.pur-sheet { border-radius: 10px; }
.pur-wrap:not(.has-doc) .pur-sheet { border-radius: 10px 10px 0 0; }
.pur-items th:nth-child(3) { width: 80px; }
.pur-items th:nth-child(4) { width: 90px; }
.pur-items th:nth-child(5) { width: 120px; }
.pur-items th:nth-child(6) { width: 90px; }
.pur-items th:nth-child(7) { width: 110px; }
.pur-sum { width: 160px; height: 38px; font-size: 16px; font-weight: 600; }
.pur-total { font-size: 19px; }
@media (max-width: 1250px) {
  .pur-wrap.has-doc { grid-template-columns: 1fr; }
  .pur-doc { position: static; max-height: 60vh; overflow: auto; }
  .pur-doc iframe { height: 60vh; }
}
@media (max-width: 1500px) and (min-width: 701px) {
  .pur-items tr.item { grid-template-columns: 26px minmax(0, 1fr) 80px 90px 110px 84px 104px 36px; }
}
@media (max-width: 700px) {
  .dz-inner { padding: 22px 14px; }
  .pur-sum { width: 130px; }
  .seg.tabs { display: flex; overflow-x: auto; max-width: 100%; }
  .seg.tabs a { white-space: nowrap; }
}
.pur-wrap .form-bar { margin: 0; width: auto; justify-self: stretch; }
.seg.tabs a { white-space: nowrap; flex: none; }
@media (max-width: 700px) {
  .seg.tabs { gap: 4px; }
  .seg.tabs a { padding: 0 10px; font-size: 13px; }
  .pur-wrap .form-bar { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); }
}

/* ================= v1.0.6 ================= */
.chart-wrap { width: 100%; }
.chart-m { display: none; }
.legend { flex-wrap: wrap; row-gap: 6px; }
.stat-head .ctrls .select { width: 130px; }
@media (max-width: 700px) {
  .chart-d { display: none; }
  .chart-m { display: block; min-width: 0 !important; width: 100%; }
  .chart { min-width: 0 !important; }
  .legend { justify-content: flex-start; gap: 6px 14px; font-size: 12px; }
  .stat-head { gap: 12px; margin-bottom: 18px; }
  .stat-head .yr { font-size: 16px; width: 100%; justify-content: space-between; }
  .stat-head .ctrls { width: 100%; display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 8px; }
  .stat-head .ctrls .select { width: 100%; height: 38px; }
  .stat-card .k { font-size: 12px; align-items: flex-start; }
  .stat-card .k .ic { flex: none; }
  .stat-card .v { font-size: 19px; }

  /* Sąskaitos forma telefone */
  .meta { grid-template-columns: 1fr !important; gap: 4px; }
  .meta label { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 8px; }
  .meta .row-inline { flex-wrap: nowrap; }
  .meta .row-inline .select { flex: 1; max-width: none !important; }
  .meta input[type="date"], .meta .input, .meta .select { width: 100%; max-width: 100%; min-width: 0; -webkit-appearance: none; appearance: none; text-align: left; }
  .meta .select { appearance: none; }
  .buyer-fields { grid-template-columns: 1fr !important; }
  .buyer-fields > * { grid-column: auto !important; }
  .buyer-fields .with-btn .btn { flex: none; }
  .inv-sheet .top { gap: 16px; }
  .inv-sheet .doc-type { margin-bottom: 8px; }
  .inv-sheet .logo-box img { max-height: 48px; }

  /* Formos mygtukai – formos gale, kompaktiški, ne lipnūs */
  .form-bar, .pur-wrap .form-bar { position: static !important; display: flex !important; flex-wrap: wrap; gap: 8px; padding: 14px 12px !important; border-radius: 0 0 10px 10px; }
  .form-bar .btn { flex: 1 1 calc(50% - 4px); height: 44px; font-size: 14px; padding: 0 10px; }
  .form-bar .btn-primary { order: -1; flex-basis: 100%; }
  .form-bar .left { order: 3; flex-basis: 100%; justify-content: center; }
  body.kb-open .tabbar { display: none; }
  body.kb-open .page { padding-bottom: 0; }
}
@media (max-width: 700px) {
  .meta .row-inline { display: grid !important; grid-template-columns: minmax(100px, 1fr) 84px auto; gap: 8px; align-items: center; }
  .meta .row-inline .select { width: 100% !important; min-width: 100px; }
  .meta .row-inline .num-input { width: 84px; }
  .meta .num-lock { white-space: nowrap; height: 38px; padding: 0 10px; }
}
