:root {
    --crm-ink: #162724;
    --crm-muted: #526763;
    --crm-bg: #f1f5f3;
    --crm-line: #d8e2df;
    --crm-accent: #08715d;
    --crm-sidebar: #112521;
}
.crm-body { margin: 0; background: var(--crm-bg); color: var(--crm-ink); font: 15px/1.55 "Aptos", "Segoe UI", system-ui, sans-serif; }
.crm-skip { position: fixed; inset: 8px auto auto 8px; transform: translateY(-150%); z-index: 100; background: white; padding: 10px; }
.crm-skip:focus { transform: none; }
.crm-shell { display: grid; grid-template-columns: 223px minmax(0, 1fr); min-height: 100vh; }
.crm-shell.nav-collapsed { grid-template-columns: minmax(0, 1fr); }
.crm-shell.nav-collapsed .crm-sidebar { display: none; }
.crm-sidebar { grid-column: 1; grid-row: 1; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; padding: 20px 14px 24px; background: var(--crm-sidebar); color: #d2e3dd; }
.crm-brand { display: flex; align-items: center; gap: 11px; padding: 0 7px 16px; border-bottom: 1px solid #304641; color: white; font-size: 20px; font-weight: 750; text-decoration: none; }
.crm-brand span { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 8px; background: #a7efcf; color: #14382e; }
.crm-nav-group { margin-top: 17px; }
.crm-nav-group p { margin: 0 8px 4px; color: #a4c1b7; font-weight: 700; font-size: 11px; }
.crm-nav-group a { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 5px 8px; color: inherit; text-decoration: none; border-radius: 7px; font-size: 14px; }
.crm-nav-group a span { display: inline-grid; width: 20px; place-items: center; font-size: 17px; }
.crm-nav-group a:hover, .crm-nav-group .is-current { color: white; background: #274b40; }
.crm-nav-group .is-current { box-shadow: inset 3px 0 #a7efcf; font-weight: 750; }
.crm-notifications { display: block; margin: 20px 8px 0; text-decoration: underline; color: #d2e3dd; }
.crm-workspace { grid-row: 1; grid-column: -2; min-width: 0; }
.crm-topbar { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; min-height: 63px; padding: 8px clamp(12px, 3vw, 32px); background: white; border-bottom: 1px solid var(--crm-line); }
.crm-location, .crm-top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; min-width: 0; }
.crm-location { font-weight: 750; }
.crm-username { color: var(--crm-muted); overflow-wrap: anywhere; font-size: 13px; }
.crm-main { width: min(100%, 1540px); margin: auto; padding: clamp(14px, 3vw, 32px); min-width: 0; }
.crm-main :is(section, details, [id]) { scroll-margin-top: 115px; }
.crm-main :is(input, select, textarea) { max-width: 100%; }
.crm-main .bg-blue-600, .crm-main .bg-blue-700 { background-color: var(--crm-accent); }
.crm-main .bg-blue-600:hover, .crm-main .bg-blue-700:hover { background-color: #075645; }
.crm-main > .grid > *, .crm-main > form > *, .crm-main section { min-width: 0; }
.crm-button { display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 38px; padding: 7px 12px; border-radius: 8px; border: 1px solid #bdcec8; background: white; color: var(--crm-ink); font: inherit; font-size: 13px; font-weight: 700; white-space: normal; text-decoration: none; cursor: pointer; }
.crm-button[hidden] { display: none; }
.crm-button:hover { background: #ecf6f1; }
.crm-primary { background: var(--crm-accent); border-color: var(--crm-accent); color: white; }
.crm-primary:hover { background: #075645; color: white; }
.crm-button[aria-pressed="true"] { background: #e0f4eb; border-color: #65a792; }
.crm-heading { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 0 0 18px; }
.crm-heading h1 { margin: 0; font-size: clamp(25px, 4vw, 38px); line-height: 1.13; font-weight: 770; }
.crm-heading p { margin: 5px 0 0; color: var(--crm-muted); }
.crm-hero { padding: clamp(18px, 4vw, 32px); border-radius: 16px; background: #15362f; color: #fff; margin-bottom: 16px; }
.crm-hero p { color: #c0e1d3; }
.crm-hero .crm-primary { background: #a7efcf; color: #15362f; border-color: #a7efcf; }
.crm-hero .crm-button:not(.crm-primary) { background: transparent; border-color: #76a694; color: white; }
.crm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crm-metrics, .crm-columns { display: grid; gap: 12px; margin-bottom: 16px; }
.crm-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.crm-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.crm-panel, .crm-metric { display: block; min-width: 0; padding: clamp(14px, 2.5vw, 22px); background: white; border: 1px solid var(--crm-line); border-radius: 12px; }
.crm-metric { color: var(--crm-ink); text-decoration: none; font-weight: 650; }
.crm-metric:hover { border-color: #68a895; }
.crm-metric strong { display: block; color: var(--crm-accent); font-size: 30px; line-height: 1.2; }
.crm-metric.is-urgent strong, .crm-late { color: #ae3225; }
.crm-panel-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; }
.crm-panel h2 { font-size: 18px; font-weight: 750; margin: 0; }
.crm-panel a:not(.crm-button) { color: #075f4f; }
.crm-record { display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 48px; padding: 10px 0; border-top: 1px solid var(--crm-line); overflow-wrap: anywhere; }
.crm-record:first-of-type { margin-top: 8px; }
.crm-record small { display: block; color: var(--crm-muted); }
.crm-record .crm-date { text-align: right; flex-shrink: 0; font-size: 13px; font-weight: 650; }
.crm-status { display: inline-flex; border-radius: 6px; font-size: 12px; font-weight: 750; padding: 3px 7px; background: #e6f2ee; color: #175444; }
.crm-flow > summary { cursor: pointer; font-size: 18px; font-weight: 750; padding: 2px 0; }
.crm-flow[open] > summary { margin-bottom: 18px; }
.crm-filter { display: grid; grid-template-columns: minmax(0, 1fr) minmax(105px, 190px) auto; align-items: end; gap: 8px; margin: 13px 0; }
.crm-filter label { display: grid; gap: 4px; min-width: 0; font-size: 13px; font-weight: 650; }
.crm-filter :is(input,select) { width: 100%; min-width: 0; border: 1px solid #bdcec8; border-radius: 8px; background: #fff; min-height: 40px; padding: 7px 9px; }
.crm-jump { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:16px; }
.crm-mobile-bar { display: none; }
.touch-mode .crm-nav-group a, .touch-mode .crm-button, .touch-mode .crm-filter :is(input,select) { min-height: 46px; }
@media (max-width: 940px) {
    .crm-shell, .crm-shell.nav-collapsed { display: block; }
    .crm-sidebar { position: static; height: auto; }
    .crm-shell.nav-enhanced .crm-sidebar { display: none; }
    .crm-shell.nav-open .crm-sidebar { display: block; position: fixed; top: 0; bottom: 0; z-index: 40; width: min(295px,calc(100% - 60px)); height:auto; box-shadow: 0 0 0 100vmax #111d19a8; }
    .crm-shell.nav-open .crm-menu-toggle { position:fixed; top: 10px; right: 8px; z-index: 42; }
    .crm-shell.nav-open .crm-topbar { z-index: 41; background: transparent; pointer-events: none; }
    .crm-shell.nav-open .crm-topbar .crm-menu-toggle { pointer-events: auto; }
    .crm-mobile-bar { position:fixed; inset:auto 0 0; z-index: 34; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); padding: 4px 5px calc(4px + env(safe-area-inset-bottom)); background:#fff; border-top:1px solid var(--crm-line); }
    .crm-mobile-bar a { display:grid; justify-items:center; align-content:center; min-height: 49px; color:#36534b; font-size:12px; font-weight:700; text-decoration:none; }
    .crm-mobile-bar a span { font-size:19px; line-height: 1.1; }
    .crm-mobile-bar [aria-current] { background:#e4f3eb; color:#075f4f; border-radius:8px; }
    .crm-main { padding-bottom:calc(75px + env(safe-area-inset-bottom)); }
    .crm-topbar .crm-button { min-height:44px; }
    .crm-username { display:none; }
}
@media (max-width: 620px) {
    .crm-columns { grid-template-columns: minmax(0,1fr); }
    .crm-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .crm-filter { grid-template-columns: minmax(0,1fr) auto; }
    .crm-filter label:first-child { grid-column: 1 / -1; }
    .crm-topbar { padding-inline: 10px; gap: 4px; }
    .crm-topbar .crm-button { padding-inline: 8px; }
    .crm-location > span { display:none; }
    .crm-main :is(input, select, textarea) { font-size: 16px; }
    .crm-panel .crm-button, .crm-jump .crm-button, .crm-actions .crm-button { min-height: 44px; }
    .crm-record .crm-date { flex-shrink: 1; }
    .crm-main .touch-card { padding: 14px; }
}
@media print {
    .crm-shell { display:block; }
    .crm-topbar, .crm-sidebar, .crm-mobile-bar, .crm-jump { display:none !important; }
    .crm-main { padding:0; }
}
.crm-drawer-backdrop { display:none; }
.crm-login { min-height:100vh; display:grid; place-items:center; padding:16px; box-sizing:border-box; background:#15362f; }
.crm-login-panel { width:min(100%, 420px); box-sizing:border-box; padding:clamp(20px, 5vw, 35px); border-radius:16px; background:white; }
.crm-login .crm-brand { padding:0 0 14px; color:var(--crm-ink); border-color:var(--crm-line); }
.crm-login h1 { font-size:28px; margin:18px 0; }
.crm-login form, .crm-login label { display:grid; gap:7px; }
.crm-login form { gap:14px; }
.crm-login label { font-weight:700; }
.crm-login input:not([type=hidden]) { box-sizing:border-box; width:100%; border:1px solid #bdcec8; border-radius:8px; min-height:44px; padding:8px 11px; font:inherit; font-size:16px; }
.crm-login .crm-button { min-height:44px; }
.crm-login-error { padding:10px; border-radius:7px; background:#fff0ee; color:#9c3024; }
.crm-main .crm-flow > form { max-width: 920px; }
.crm-main .order-item-row > * { min-width:0; }
.crm-main .item-row > div { min-width:0; }
.touch-mode .crm-main :is(button, input:not([type=hidden]):not([type=checkbox]):not([type=radio]), select) { font-size: 16px; }
.touch-mode .crm-main .crm-record { min-height: 54px; }
@media (max-width: 940px) {
    .crm-shell.nav-open .crm-sidebar { box-shadow:none; }
    .crm-shell.nav-open .crm-drawer-backdrop { display:block; position:fixed; z-index:39; inset:0; background:#111d19a8; width:100%; border:0; }
    .crm-main .touch-orders .touch-order-table,
    .crm-main .touch-orders .touch-order-table tbody,
    .crm-main .crm-quote-list table,
    .crm-main .crm-quote-list tbody { display:block; width:100%; }
    .crm-main .touch-orders .touch-order-table thead,
    .crm-main .crm-quote-list thead { display:none; }
    .crm-main .touch-orders .touch-order-table tr,
    .crm-main .crm-quote-list tr { display:block; border:1px solid var(--crm-line); border-radius:10px; margin-bottom:10px; padding:5px 10px; }
    .crm-main .touch-orders .touch-order-table td,
    .crm-main .crm-quote-list td[data-label] { display:grid; grid-template-columns:minmax(80px, 29%) minmax(0, 1fr); align-items:center; gap:6px; padding:8px 0; text-align:left; overflow-wrap:anywhere; border-bottom:1px solid #edf2f0; }
    .crm-main .touch-orders .touch-order-table td:last-child,
    .crm-main .crm-quote-list td:last-child { border-bottom:0; }
    .crm-main .touch-orders .touch-order-table td::before,
    .crm-main .crm-quote-list td[data-label]::before { content:attr(data-label); color:var(--crm-muted); font-size:11px; font-weight:700; }
    .crm-main .touch-orders .touch-order-table td[data-label="Akcje i status"],
    .crm-main .crm-quote-list td[data-label="Akcje"] { display:flex; flex-wrap:wrap; justify-content:flex-start; }
    .crm-main .touch-orders .touch-order-table td[data-label="Akcje i status"]::before,
    .crm-main .crm-quote-list td[data-label="Akcje"]::before { width:100%; }
    .crm-main .touch-orders .touch-order-table td[data-label="Akcje i status"] form { flex-wrap:wrap; justify-content:flex-start; }
    .crm-main .touch-orders .touch-order-table td[data-label="Akcje i status"] :is(a,button,select),
    .crm-main .crm-quote-list td[data-label="Akcje"] :is(a,button) { display:inline-flex; align-items:center; min-height:44px; }
}
@media (max-width: 710px) {
    .crm-main .crm-quote-row-head { display:none; }
    .crm-main .item-row { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; padding:8px; border:1px solid var(--crm-line); border-radius:8px; }
    .crm-main .item-row > div { grid-column:auto; }
    .crm-main .item-row > div:first-child { grid-column:1 / -1; }
    .crm-main .item-row > div:last-child { grid-column:3; text-align:right; }
    .crm-main .item-row input { min-height:43px; }
}
