/* DSS Finanse · Interface system 1.0.11
   Visual-only layer. Business rules and HTML data attributes remain untouched.
   Loaded last on every screen, replaces legacy visual patches without deleting them.
*/
:root {
  color-scheme:light;
  --bg:#f4f7fb;
  --surface:#ffffff;
  --surface-2:#f7f9fc;
  --ink:#182637;
  --muted:#68788d;
  --line:#e2e9f0;
  --sidebar:#142234;
  --sidebar-2:#101b2a;
  --blue:#079cda;
  --blue-2:#087eb5;
  --blue-soft:#e8f6fc;
  --green:#16845e;
  --green-soft:#e9f7f0;
  --red:#cb4654;
  --red-soft:#feeff1;
  --orange:#b97421;
  --orange-soft:#fff4e6;
  --purple:#7356c1;
  --purple-soft:#f0ecfc;
  --over:#246bbb;
  --shadow:0 3px 17px rgba(26,49,74,.035);
  --radius:14px;
  --sidebar-w:252px;
}
html {font-family:Inter,"Segoe UI",system-ui,-apple-system,Arial,sans-serif;font-size:14px;scrollbar-gutter:stable;}
body {color:var(--ink);background:var(--bg);line-height:1.5;}
button,input,select,textarea {font-family:inherit;}
:focus-visible {outline:3px solid rgba(8,156,218,.32);outline-offset:2px;}
button:disabled,.btn:disabled {cursor:not-allowed;filter:saturate(.7);}
::selection {background:#bfebff;color:#152736;}

/* Shell and navigation */
.app-shell {min-width:0;}
.sidebar {
  width:var(--sidebar-w);padding:22px 14px 17px;
  background:linear-gradient(168deg,#18293e 0%,#111c2d 64%,#0c1626 100%);
  box-shadow:3px 0 22px rgba(13,32,51,.075);border-right:1px solid #21334c;
}
.brand {margin:0 7px 18px;padding:3px 5px 22px;border-bottom:1px solid rgba(235,245,255,.1);}
.brand img {width:190px;max-height:48px;object-fit:contain;object-position:left center;}
.brand>span {font-size:10px;letter-spacing:.32em;color:#74d9ff;margin-top:9px;margin-left:5px;}
.sidebar nav {gap:4px;padding:2px 0 12px;scrollbar-width:thin;scrollbar-color:#35455a transparent;}
.sidebar nav a {position:relative;min-height:44px;padding:9px 12px;border-radius:10px;color:#aebed0;font-size:12.8px;font-weight:620;gap:12px;transition:background .15s ease,color .15s ease;}
.sidebar nav a:hover {background:rgba(207,234,255,.085);color:#fff;}
.sidebar nav a.active {background:#243d57;color:#fff;box-shadow:inset 3px 0 #13baf1;}
.nav-icon {flex:0 0 30px;width:30px;height:30px;display:grid;place-items:center;border:0;background:rgba(255,255,255,.06);border-radius:9px;color:#a7bdd1;}
.nav-icon svg {width:17px;height:17px;stroke:currentColor;stroke-width:1.9;fill:none;stroke-linecap:round;stroke-linejoin:round;}
.sidebar nav a:hover .nav-icon,.sidebar nav a.active .nav-icon {background:rgba(15,186,241,.16);color:#66d6ff;}
.sidebar nav a small {font-size:10px;padding:3px 7px;border-radius:6px;}
.side-bottom {padding-top:14px;border-top:1px solid rgba(235,245,255,.1);}
.user-chip {border-radius:11px;padding:9px 7px;gap:11px;}
.user-chip>span {flex:0 0 36px;width:36px;height:36px;border-radius:10px;background:#254f6b;color:#9de8ff;font-size:15px;}
.user-chip b {font-size:12px;line-height:1.4;}
.user-chip small {font-size:11px;color:#8296ad;}
.logout {padding:10px 10px 4px;font-size:12px;color:#9cb0c5;}
.logout:hover {color:#fff;}
.main {margin-left:var(--sidebar-w);min-width:0;}
.topbar {height:77px;padding:0 30px;gap:13px;background:rgba(255,255,255,.93);border-color:var(--line);box-shadow:0 1px 0 rgba(255,255,255,.8);}
.topbar h1 {font-size:21px;font-weight:770;letter-spacing:-.037em;color:#17283b;line-height:1.25;}
.topbar p {font-size:11px;letter-spacing:.01em;margin-top:4px;color:#73849a;}
.top-status {gap:10px;background:#f7fafc;border:1px solid #e5ebf1;padding:8px 12px;border-radius:9px;font-size:11.5px;font-weight:650;color:#63778c;white-space:nowrap;}
.dot {width:7px;height:7px;background:#25b687;box-shadow:0 0 0 3px #daf5eb;}
.content {max-width:1740px;width:100%;padding:27px 30px 52px;margin:0 auto;}

/* Cards, sections and metrics */
.card {min-width:0;background:#fff;border:1px solid #e1e9f1;border-radius:14px;box-shadow:var(--shadow);padding:21px 22px;margin-bottom:17px;}
.card-head {margin-bottom:16px;gap:14px;align-items:center;flex-wrap:wrap;}
.card-head>div:first-child {min-width:0;flex:1 1 260px;}
.card-head h2 {font-weight:750;letter-spacing:-.025em;font-size:16px;color:#1a2c40;margin-bottom:5px;line-height:1.35;}
.card-head p {font-size:11.8px;color:#78889b;line-height:1.5;max-width:850px;}
.grid-2 {gap:17px;}
.dashboard-grid>.card {margin-bottom:17px;}
.kpi-grid {gap:13px;margin-bottom:17px;}
.kpi {background:#fff;border:1px solid #e0e8f1;border-radius:13px;box-shadow:0 2px 13px rgba(22,44,65,.028);padding:17px 17px 16px;min-height:112px;justify-content:space-between;gap:2px;transition:border-color .16s ease,transform .16s ease,box-shadow .16s ease;}
.kpi:before {width:4px;top:17px;bottom:17px;border-radius:0 3px 3px 0;background:#bdcddc;}
.kpi>span {font-size:10.5px;font-weight:750;letter-spacing:.055em;text-transform:uppercase;color:#728399;}
.kpi>strong {font-size:clamp(17px,1.5vw,23px);font-weight:770;letter-spacing:-.035em;white-space:nowrap;overflow:visible;text-overflow:clip;color:#1c3045;line-height:1.23;margin-top:7px;font-variant-numeric:tabular-nums;}
.kpi>small {font-size:10.5px;line-height:1.4;color:#8593a4;margin-top:5px;}
.kpi.blue:before {background:#0d9fd8;}
.kpi.ok:before {background:#1b9e70;}
.kpi.bad:before {background:#cc4551;}
.kpi.orange:before {background:#df9934;}
.kpi.purple:before {background:#8a6acb;}
.kpi.over:before {background:#568fdb;}
a.kpi:hover {transform:translateY(-2px);border-color:#c2dbe9;box-shadow:0 8px 22px rgba(25,65,93,.085);}
.availability-card {border:1px solid #284a60;border-radius:16px;background:linear-gradient(118deg,#163248 0%,#1d4b61 65%,#166888 100%);padding:23px 27px;box-shadow:0 7px 20px rgba(18,58,82,.09);}
.availability-card:after {right:-28px;top:-75px;width:260px;height:260px;background:radial-gradient(circle,rgba(102,213,254,.17),transparent 72%);}
.availability-card small {font-size:11px;font-weight:650;color:#b9d6e5;}
.availability-card strong {font-size:clamp(27px,3vw,37px);font-weight:780;letter-spacing:-.045em;margin:4px 0 0;font-variant-numeric:tabular-nums;}
.availability-card p {color:#bbd0dd;font-size:11.5px;}
.availability-card .btn.primary {background:#c7efff;border-color:#c7efff;color:#123d54;}
.availability-card .btn.primary:hover {background:white;border-color:white;}
.quick-grid {gap:11px;}
.quick-grid a {padding:14px 15px;border-color:#e4ebf2;background:#fafbfd;border-radius:11px;font-size:12px;color:#31485e;transition:background .14s ease,border-color .14s ease;}
.quick-grid a:hover {background:#f0f9ff;border-color:#bbddeb;}
.quick-grid b {width:34px;height:34px;background:#e6f5fd;border-radius:9px;color:#118dbf;font-size:16px;}

/* Filters, scope and tabs */
.scope-row {gap:14px;margin-bottom:14px;}
.scope-switch {border:1px solid #dce6ef;background:#fff;padding:4px;border-radius:11px;box-shadow:none;gap:3px;}
.scope-switch a {padding:9px 17px;border-radius:8px;font-size:12px;font-weight:720;transition:background .14s ease;}
.scope-switch a.active {background:#183e58;color:#fff;box-shadow:0 2px 7px rgba(25,58,80,.1);}
.scope-switch a:hover:not(.active) {background:#eef5f9;color:#27516e;}
.scope-current small {font-size:9px;font-weight:730;color:#8795a5;}
.scope-current b {font-size:12px;font-weight:700;color:#50637a;}
.period-nav {background:#fff;border:1px solid #dce5ef;border-radius:11px;padding:5px;gap:7px;margin:0 0 17px;box-shadow:0 2px 8px rgba(27,58,85,.025);}
.period-nav>div {min-width:150px;}
.period-nav small {font-size:9px;color:#7a8b9f;}
.period-nav strong {font-size:12.5px;color:#233d53;}
.period-nav input,.period-nav select {background:#f3f7fa;border:1px solid #edf1f5;min-width:133px;color:#52697f;border-radius:7px;min-height:33px;}
.icon-btn {height:35px;width:35px;border:1px solid transparent;background:#f4f7fa;border-radius:8px;font-size:22px;line-height:1;color:#48667e;}
.icon-btn:hover {background:#e6f4fc;border-color:#bcdfea;color:#1b81b5;}
.tabs {display:flex;gap:4px;padding:4px;border:1px solid #e0e8ef;background:#fff;border-radius:11px;margin-bottom:18px;box-shadow:0 2px 9px rgba(27,58,85,.022);overflow-x:auto;overflow-y:hidden;}
.tabs a {margin:0;padding:10px 17px;border:0;border-radius:8px;font-size:12px;font-weight:720;color:#748598;transition:background .12s,color .12s;}
.tabs a:hover:not(.active) {background:#f3f7fa;color:#38546d;}
.tabs a.active {background:#e8f5fc;color:#087fac;border:0;box-shadow:inset 0 0 0 1px #c8e7f6;}

/* Buttons, forms and toolbars */
.btn {display:inline-flex;align-items:center;justify-content:center;gap:7px;background:#fff;border:1px solid #d8e2eb;color:#344a60;padding:9px 13px;min-height:35px;border-radius:9px;font-size:11.8px;font-weight:740;line-height:1.3;box-shadow:0 1px 1px rgba(20,48,67,.015);transition:background .14s ease,border-color .14s ease,box-shadow .14s ease;}
.btn:hover {background:#f5faff;border-color:#b9d2e2;color:#1b6487;}
.btn.primary {background:#079bd5;border-color:#079bd5;color:#fff;box-shadow:0 3px 10px rgba(8,156,218,.12);}
.btn.primary:hover {background:#068ac0;border-color:#068ac0;color:#fff;box-shadow:0 4px 14px rgba(8,156,218,.2);}
.btn.danger {background:#fff7f8;border-color:#f2d7dd;color:#b93f50;}
.btn.danger:hover {background:#ffeeef;border-color:#e9afb8;}
.btn.small {font-size:11px;padding:7px 10px;min-height:30px;}
.btn.large {min-height:42px;padding:11px 19px;font-size:12.5px;}
input,select,textarea {background:#fff;border:1px solid #d6e0e9;color:#23384f;border-radius:9px;min-height:37px;padding:8px 11px;font-size:12.5px;line-height:1.4;transition:border-color .13s ease,box-shadow .13s ease;}
input::placeholder,textarea::placeholder {color:#9aa7b6;opacity:1;}
input:focus,select:focus,textarea:focus {border-color:#4badcf;box-shadow:0 0 0 3px rgba(8,156,218,.10);}
input[type=checkbox],input[type=radio] {width:16px;height:16px;min-height:auto;accent-color:#0b98cf;vertical-align:middle;flex-shrink:0;}
input[type=date],input[type=month],input[type=number] {font-variant-numeric:tabular-nums;}
label {gap:6px;font-size:11.5px;font-weight:700;color:#4c6178;}
label small {font-size:10.5px;color:#8291a2;line-height:1.5;font-weight:500;}
textarea {min-height:90px;}
.toolbar-form {gap:12px;align-items:flex-end;}
.toolbar-form label {width:170px;}
.toolbar-form .btn {min-height:38px;}
.toolbar-form .form-hint {width:100%;font-size:11px;line-height:1.5;color:#7d8d9d;padding:0;margin-top:2px;}
.form-grid {gap:16px;}
.settings-layout {max-width:1130px;}
.settings-layout .card {padding:23px 25px;}
.settings-save {position:sticky;bottom:0;padding:12px 0 16px;background:linear-gradient(0deg,var(--bg) 66%,rgba(244,247,251,0));z-index:4;}
.switch-list {gap:10px;}
.switch-list label {padding:13px 15px;border-radius:10px;border-color:#e2e9f0;background:#f9fbfd;gap:10px;}
.switch-list b {font-weight:740;}
.switch-list small {font-size:11px;}
.table-tools {gap:8px;align-items:center;}
.card-head .table-tools {flex:0 1 auto;justify-content:flex-end;max-width:100%;}
.card-head .table-tools input[type=search] {min-width:205px;width:min(320px,32vw);}
.table-tools select {max-width:190px;}
.bulk-bar {background:#f7fafc;border:1px solid #e2eaf2;border-radius:10px;padding:10px 12px;margin:0 0 12px;gap:9px;color:#657b90;}
.bulk-bar label {flex-direction:row;align-items:center;gap:8px;font-size:11px;}
.bulk-bar>span {font-size:11px;color:#8495a6;}
.bulk-bar select,.bulk-bar input:not([type=checkbox]) {min-width:115px;min-height:33px;padding:6px 8px;}
.percent-input input,.inline-select {min-height:31px;}

/* Status, notice and summary components */
.badge {font-size:10px;padding:4px 9px;border-radius:7px;font-weight:750;letter-spacing:0;}
.badge.blue {background:#e8f6fc;color:#067fae;}
.badge.ok,.badge.sale {background:#e8f7ef;color:#117d56;}
.badge.warn {background:#fff4e8;color:#9b641c;}
.badge.zus {background:#eee9fb;color:#6646ae;}
.badge.pit {background:#fff2e5;color:#a05d15;}
.diff {display:inline-flex;align-items:center;border-radius:7px;font-variant-numeric:tabular-nums;font-size:11px;padding:5px 8px;font-weight:760;}
.info-box,.warning-box,.sync-status {border-radius:10px;padding:12px 14px;font-size:11.5px;line-height:1.6;}
.info-box {border-color:#cfe5f1;background:#f3faff;color:#42647a;}
.warning-box {border-color:#f0d7ae;background:#fff8ed;color:#8a672e;}
.sync-status {margin-top:14px;}
.dra-live {min-height:40px;border-radius:9px;background:#f5fbff;border-color:#c8e4f1;font-size:11.5px;line-height:1.5;padding:11px 13px;}
.importer-hero {display:flex;align-items:center;gap:20px;background:linear-gradient(112deg,#fff 0%,#f1faff 100%);border:1px solid #d4eaf5;padding:22px 25px;}
.importer-hero h2 {font-weight:780;letter-spacing:-.035em;font-size:21px;color:#213b50;margin:4px 0 6px;}
.importer-hero p {font-size:11.9px;line-height:1.55;color:#6a8092;}
.eyebrow {font-size:10px;letter-spacing:.1em;color:#0a91c8;}
.ksef-state {border-left-color:#cfe4ed;}
.ksef-state b {font-size:12px;}
.ksef-state small {font-size:10px;line-height:1.4;}
.empty {border:1px dashed #dce5ec;background:#fafcfe;border-radius:10px;padding:39px 14px;}
.empty span {opacity:.35;}
.empty p {font-size:12px;color:#8192a4;}
.disabled-module {padding:55px 25px;}
.disabled-module>b {font-size:19px;}
.summary-table td {color:#203a50;font-size:14px;}
.summary-table .strong th,.summary-table .strong td {border-color:#b6c9d8;}
.pit-remaining {color:#b3741f;font-size:13px;font-weight:770;}

/* Dense data grids. Table wrappers scroll, viewport never does. */
.main,.content,.card,.grid-2>*,.card-head>* {min-width:0;}
.table-wrap {display:block;position:relative;width:100%;max-width:100%;margin:0;padding:0 0 4px;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;scrollbar-width:thin;scrollbar-color:#b6c8d6 #f3f7fa;}
.table-wrap::-webkit-scrollbar {height:9px;}
.table-wrap::-webkit-scrollbar-track {background:#f3f7fa;border-radius:8px;}
.table-wrap::-webkit-scrollbar-thumb {background:#bbceda;border:2px solid #f3f7fa;border-radius:8px;}
.table-wrap>table {min-width:790px;}
table {border-collapse:separate;border-spacing:0;width:100%;font-size:12px;line-height:1.48;color:#30455c;}
th {background:#f3f7fa;color:#687d91;font-weight:800;font-size:10px;text-transform:uppercase;letter-spacing:.045em;white-space:nowrap;padding:12px 13px;border-top:1px solid #e2eaf0;border-bottom:1px solid #e2eaf0;}
th:first-child {border-left:1px solid #e2eaf0;border-radius:8px 0 0 0;}
th:last-child {border-right:1px solid #e2eaf0;border-radius:0 8px 0 0;}
td {padding:12px 13px;border-bottom:1px solid #ecf1f5;vertical-align:middle;font-variant-numeric:tabular-nums;line-height:1.5;}
tbody tr:hover td {background:#f6faff;}
tbody tr:last-child td {border-bottom-color:#e1e9f0;}
tbody tr[hidden] {display:none!important;}
td.right,th.right {text-align:right;white-space:nowrap;}
td.actions {display:table-cell;text-align:right;vertical-align:middle;min-width:116px;white-space:nowrap;}
td.actions .btn+.btn {margin-left:5px;}
table .check {width:42px;min-width:42px;}
table .muted-row td {opacity:.65;}
.register-table td {padding-top:11px;padding-bottom:11px;}
.register-table .period-cell {min-width:112px;font-weight:730;color:#29465b;white-space:nowrap;}
.register-table .doc-cell {min-width:125px;}
.register-table .actions {min-width:135px;}
.compare-cell {grid-template-columns:minmax(68px,1fr) minmax(68px,1fr) auto;gap:8px;min-width:220px;}
.compare-cell small {font-size:9px;letter-spacing:.03em;color:#8191a2;margin-bottom:3px;}
.compare-cell b {font-size:11.5px;font-variant-numeric:tabular-nums;}
.payment-cell {min-width:168px;}
.payment-total b {font-size:12px;}
.payment-dates {font-size:10px;color:#8292a5;max-width:170px;}
#ksefTable {min-width:1210px;}
#costTable {min-width:1060px;}
#salesTable {min-width:1000px;}
#zusTable,#pitTable {min-width:1050px;}
#paymentsTable {min-width:870px;}
#summaryTable {min-width:1050px;}
#vatTable {min-width:800px;}
#auditTable {min-width:1000px;}
#costTable td:nth-child(3) {max-width:240px;}
#costTable td:nth-child(3) small {max-width:225px;}
#costTable td.actions {white-space:nowrap;min-width:150px;}
#costTable td.actions .btn {margin:0 0 0 4px;}
#auditTable td:nth-child(5),#paymentsTable td:nth-child(5) {overflow-wrap:anywhere;word-break:break-word;}
/* Freeze identifying period for long financial registers; never freeze actions on mobile */
#zusTable th:first-child,#zusTable td:first-child,
#pitTable th:first-child,#pitTable td:first-child,
#summaryTable th:first-child,#summaryTable td:first-child {position:sticky;left:0;z-index:2;background:#fff;box-shadow:5px 0 11px -10px #38556d;}
#zusTable thead th:first-child,#pitTable thead th:first-child,#summaryTable thead th:first-child {z-index:3;background:#f3f7fa;}
#zusTable tbody tr:hover td:first-child,#pitTable tbody tr:hover td:first-child,#summaryTable tbody tr:hover td:first-child {background:#f6faff;}
#ksefTable th:last-child,#ksefTable td:last-child,
#costTable th:last-child,#costTable td:last-child,
#salesTable th:last-child,#salesTable td:last-child,
#zusTable th:last-child,#zusTable td:last-child,
#pitTable th:last-child,#pitTable td:last-child {position:static;right:auto;box-shadow:none;}
tfoot th,tfoot td {background:#edf5fa!important;color:#24445d!important;font-weight:820;border-top:2px solid #c8dce8!important;border-bottom:1px solid #cbdde9!important;padding-top:13px;padding-bottom:13px;}
#zusTable tfoot th:first-child,#pitTable tfoot th:first-child,#summaryTable tfoot th:first-child,
#zusTable tfoot td:first-child,#pitTable tfoot td:first-child,#summaryTable tfoot td:first-child {background:#edf5fa!important;}
.inactive-row td {background:#f8f9fb!important;color:#929faf!important;}
.inactive-row:hover td {background:#f3f6f9!important;}
.pagination {display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:6px;padding-top:15px;}
.pagination span {font-size:11px;margin-right:7px;color:#788ba0;}
.pagination button {min-height:31px;min-width:32px;border-radius:8px;border:1px solid #d9e4ed;background:white;color:#4e647a;font-size:11px;}
.pagination button:hover:not(:disabled) {background:#eff8fd;border-color:#bfe0ee;}
.pagination button.active {background:#147eaa;color:white;border-color:#147eaa;}
.pagination button:disabled {opacity:.45;}

/* Invoice preview, dialogs, toasts */
.modal-backdrop {background:rgba(10,23,39,.62);padding:20px;backdrop-filter:blur(5px);}
.modal-card {width:min(1000px,97vw);max-height:min(90dvh,920px);padding:25px 27px 26px;border-radius:15px;box-shadow:0 25px 95px rgba(10,24,38,.3);overflow:auto;overscroll-behavior:contain;}
.modal-card.narrow {width:min(690px,97vw);}
.modal-title {font-size:20px;letter-spacing:-.028em;font-weight:780;color:#20384d;margin:0 48px 8px 0;}
.modal-title small {font-size:12px;letter-spacing:0;color:#8194a6;}
.modal-sub {font-size:11.8px;line-height:1.6;color:#718498;}
.modal-close {position:sticky;float:right;top:0;right:0;margin:-7px -8px 0 8px;border:1px solid #e4eaf0;background:#f3f7fa;color:#60778a;width:34px;height:34px;border-radius:9px;font-size:21px;}
.modal-close:hover {background:#e8f1f8;color:#254a66;}
.modal-actions {border-top:1px solid #e7edf2;padding-top:15px;margin-top:20px;flex-wrap:wrap;}
.invoice-preview {min-width:0;}
.preview-head {grid-template-columns:minmax(0,2fr) repeat(2,minmax(0,1fr));gap:11px;padding-bottom:17px;}
.preview-head span,.preview-parties small {font-size:10px;color:#8796a6;}
.preview-head strong {font-size:14px;overflow-wrap:anywhere;}
.preview-parties {gap:12px;}
.preview-parties>div {border-radius:10px;background:#f8fafc;border:1px solid #e4ebf2;padding:14px;}
.preview-parties b {color:#263b50;}
.invoice-preview .table-wrap>table {min-width:650px;}
.toast {border-radius:10px;font-size:12px;line-height:1.45;padding:12px 15px;box-shadow:0 12px 27px rgba(7,22,34,.17);background:#203448;}

/* Auth and installation */
.login-body {background:radial-gradient(circle at 32% 18%,#24435c 0%,#14253b 46%,#0c1728 100%);}
.login-card {border:1px solid #e2e8ee;padding:31px;border-radius:16px;box-shadow:0 30px 80px rgba(3,13,24,.28);}
.login-card img {background:#172b41;border-radius:10px;padding:10px 12px;}
.login-card h1 {font-size:25px;font-weight:790;letter-spacing:-.04em;margin:21px 0 4px;}
.login-card>p {font-size:11.8px;color:#8192a2;}
.login-card form {gap:15px;}
.login-card label {font-size:12px;}
.login-card .btn.large {min-height:44px;margin-top:5px;}
.install-body {background:#f1f5f9;}
.install-head {background:linear-gradient(112deg,#1b354b,#11243a);border-radius:15px 15px 0 0;}
.install-panel {border:1px solid #e2e9f0;border-top:0;border-radius:0 0 15px 15px;}

/* Responsive layouts */
@media(max-width:1370px) {
  .kpi-grid.five {grid-template-columns:repeat(3,minmax(0,1fr));}
  .content {padding:24px 23px 42px;}
  .topbar {padding:0 23px;}
  .kpi>strong {font-size:22px;}
}
@media(max-width:1080px) {
  :root {--sidebar-w:224px;}
  .sidebar {padding-inline:10px;}
  .brand img {width:180px;}
  .sidebar nav a {font-size:12px;gap:9px;padding:9px 10px;}
  .grid-2 {grid-template-columns:1fr;}
  .card-head .table-tools input[type=search] {width:min(300px,34vw);}
}
@media(max-width:820px) {
  :root {--sidebar-w:258px;}
  html {scrollbar-gutter:auto;}
  .sidebar {width:var(--sidebar-w);transform:translateX(-102%);transition:transform .2s ease;box-shadow:14px 0 40px rgba(8,21,33,.18);}
  .sidebar.open {transform:none;}
  .main {margin-left:0;}
  .menu-toggle {display:grid;place-items:center;flex:0 0 38px;height:38px;width:38px;background:#f3f7fa;border:1px solid #e0e8ef;border-radius:9px;font-size:20px;color:#33526b;}
  .topbar {height:70px;padding:0 17px;}
  .topbar h1 {font-size:19px;}
  .top-status {padding:7px 9px;font-size:10.5px;}
  .content {padding:18px 17px 36px;}
  .card {padding:19px;}
  .card-head {align-items:stretch;flex-direction:column;}
  .card-head>div:first-child {flex:0 0 auto;width:100%;}
  .card-head .table-tools {width:100%;justify-content:flex-start;flex:0 1 auto;}
  .card-head .table-tools input[type=search] {flex:1 1 190px;width:auto;min-width:0;}
  .scope-row {flex-direction:column;align-items:stretch;gap:9px;}
  .scope-switch {width:100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));}
  .scope-switch a {padding:9px 8px;text-align:center;}
  .scope-current {text-align:left;}
  .kpi-grid.five,.kpi-grid.three {grid-template-columns:repeat(2,minmax(0,1fr));}
  .kpi>strong {font-size:21px;}
  .grid-2 {grid-template-columns:1fr;}
  .table-wrap {width:100%;max-width:100%;margin:0;padding:0 0 4px;}
  .toolbar-form label {width:calc(50% - 8px);}
  .toolbar-form .form-hint {width:100%;}
  .toolbar-form>.btn {flex:0 1 auto;}
  .form-grid.two {grid-template-columns:repeat(2,minmax(0,1fr));}
  .importer-hero {align-items:flex-start;}
  .settings-layout .card {padding:19px;}
}
@media(max-width:550px) {
  .topbar {gap:9px;height:64px;padding:0 13px;}
  .topbar h1 {font-size:17px;}
  .topbar p {font-size:10px;max-width:170px;}
  .top-status {background:transparent;border:0;padding:0;font-size:10px;}
  .content {padding:13px 12px 29px;}
  .card {padding:16px 14px;margin-bottom:12px;border-radius:12px;}
  .card-head {gap:12px;margin-bottom:13px;}
  .card-head h2 {font-size:15px;}
  .card-head p {font-size:11px;}
  .kpi-grid.five,.kpi-grid.three {grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin-bottom:13px;}
  .kpi {padding:13px 11px 12px;min-height:98px;}
  .kpi:before {top:13px;bottom:13px;width:3px;}
  .kpi>span {font-size:9.5px;letter-spacing:.01em;}
  .kpi>strong {font-size:clamp(15px,4vw,19px);letter-spacing:-.035em;white-space:normal;overflow-wrap:anywhere;line-height:1.25;}
  .kpi>small {font-size:9.5px;}
  .availability-card {padding:19px;flex-direction:column;align-items:flex-start;gap:17px;}
  .availability-card strong {font-size:30px;}
  .quick-grid {grid-template-columns:1fr;}
  .period-nav {width:100%;justify-content:space-between;gap:3px;}
  .period-nav>div {min-width:0;}
  .period-nav input,.period-nav select {display:block;min-width:0;width:120px;font-size:11px;}
  .period-nav .icon-btn {flex:0 0 32px;width:32px;height:34px;}
  .tabs a {font-size:11.5px;padding:9px 12px;}
  .scope-current b {white-space:normal;}
  .card-head .table-tools {align-items:stretch;}
  .card-head .table-tools input[type=search] {flex-basis:100%;width:100%;}
  .bulk-bar {align-items:stretch;gap:9px;}
  .bulk-bar>* {width:100%;}
  .bulk-bar .btn {width:100%;}
  .bulk-bar select,.bulk-bar input:not([type=checkbox]) {width:100%;}
  .bulk-bar>span {margin-left:0;}
  .toolbar-form label {width:100%;}
  .toolbar-form>.btn {width:100%;}
  .importer-hero {flex-direction:column;gap:15px;}
  .ksef-state {width:100%;min-width:0;border-left:0;border-top:1px solid #cfe4ed;padding:12px 0 0;}
  .form-grid.two {grid-template-columns:1fr;}
  .form-grid .wide {grid-column:1/-1;}
  .modal-backdrop {padding:7px;}
  .modal-card,.modal-card.narrow {width:100%;max-height:96dvh;border-radius:12px;padding:17px 14px;}
  .modal-title {font-size:18px;}
  .preview-head {grid-template-columns:1fr 1fr;}
  .preview-parties {grid-template-columns:1fr;}
  .modal-actions>.btn {flex:1 1 auto;}
  .pagination {justify-content:flex-start;}
  .pagination span {width:100%;margin-right:0;}
  .toast-stack {right:10px;left:10px;bottom:10px;max-width:none;}
  .toast {width:100%;}
}
@media(max-width:360px) {
  .top-status {font-size:0;gap:0;}
  .top-status .dot {display:none;}
  .kpi-grid.five,.kpi-grid.three {grid-template-columns:1fr;}
  .period-nav strong {font-size:11px;}
  .period-nav input,.period-nav select {width:108px;}
}
@media(prefers-reduced-motion:reduce) {
  .sidebar,.btn,.kpi,.quick-grid a,.sidebar nav a,.scope-switch a,.tabs a {transition:none;}
}
/* Mobile navigation scrim */
.sidebar-scrim {display:none;}
@media(max-width:820px) {
  .sidebar-scrim {display:block;position:fixed;inset:0;z-index:39;background:rgba(8,22,37,.5);opacity:0;pointer-events:none;transition:opacity .2s ease;}
  body.nav-open .sidebar-scrim {opacity:1;pointer-events:auto;}
  body.nav-open {overflow:hidden;}
}
@media(prefers-reduced-motion:reduce) {.sidebar-scrim{transition:none;}}
