:root {
    --bg: #f3f5f8;
    --panel: #ffffff;
    --line: #e6ebf2;
    --text: #0f172a;
    --muted: #64748b;
    --brand: #0ea5e9;
    --brand-soft: #e0f2fe;
}
* { box-sizing: border-box; }
body { font-family: Inter, Segoe UI, Arial, sans-serif; margin: 0; background: var(--bg); color: var(--text); }
.topbar {
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 14px;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}
.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    min-height: 24px;
}
.logo-img {
    display: block;
    height: 60px;
    width: auto;
    max-width: 360px;
    object-fit: contain;
}
.menu-toggle {
    display: none;
    margin-left: auto;
    width: 40px;
    height: 40px;
    border: 1px solid #d7deea;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    padding: 0;
    align-items: center;
    justify-content: center;
    z-index: 31;
}
.menu-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.mobile-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 24;
}
.mobile-drawer {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: min(320px, 86vw);
    height: 100vh;
    background: #fff;
    border-left: 1px solid var(--line);
    box-shadow: -8px 0 24px rgba(15, 23, 42, .12);
    z-index: 30;
    transform: translateX(100%);
    transition: transform .18s ease;
    padding: 72px 12px 12px;
    overflow: hidden;
    flex-direction: column;
}
.mobile-drawer-head {
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--line);
    font-size: 42px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.05;
}
.mobile-drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.mobile-drawer-nav a {
    color: #334155;
    text-decoration: none;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mobile-drawer-nav a.active,
.mobile-drawer-nav a:hover {
    background: var(--brand-soft);
    color: #0369a1;
}
.mobile-drawer-nav svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.mobile-drawer-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    justify-content: center;
}
.nav a {
    color: #334155;
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 1;
    pointer-events: auto;
}
.nav a svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.nav a.active, .nav a:hover { background: var(--brand-soft); color: #0369a1; }
.user-box {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 18px;
    color: #0f172a;
}
.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.user-meta strong {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}
.user-meta span {
    margin-top: 2px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}
.user-box form { margin: 0; }
.user-box .logout-btn {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    color: #1e293b;
    font: inherit;
    font-weight: 700;
    font-size: 22px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.logout-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.mobile-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.mobile-user-row .user-meta strong {
    font-size: 18px;
}
.mobile-user-row .user-meta span {
    font-size: 13px;
}
.mobile-user-row .logout-btn {
    min-height: 40px;
    border-radius: 8px;
    padding: 8px 10px;
    color: #0f172a;
    font-size: 24px;
}
.logout-confirm {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, .45);
    z-index: 80;
    padding: 16px;
}
.logout-confirm.open { display: flex; }
.logout-confirm-card {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .15);
    padding: 16px;
}
.logout-confirm-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
}
.logout-confirm-card p {
    margin: 0;
    color: #475569;
    font-size: 13px;
}
.logout-confirm-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.wrap { max-width: 1220px; margin: 14px auto; padding: 0 12px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
h1 { margin: 0; font-size: 26px; }
h2 { margin: 0 0 8px; font-size: 18px; }
.muted { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; box-shadow: 0 1px 2px rgba(15, 23, 42, .03); }
.list-search-card { padding: 12px; margin-bottom: 6px; }
.list-table-card { padding: 8px 10px 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.list-table-card table { min-width: 760px; }
.invoice-list-table { min-width: 1040px; }
.grid { display: grid; gap: 12px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.btn {
    background: #0284c7;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn-ghost {
    background: #e2e8f0;
    color: #1e293b;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
}
.search {
    width: 100%;
    border: 1px solid #d7deea;
    border-radius: 10px;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 13px;
    margin: 0;
    background: #f8fafc;
}
.list-table-card th,
.list-table-card td {
    min-height: 42px;
    vertical-align: middle;
}
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 8px 6px; font-size: 12px; }
th { color: #475569; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.invoice-list-table th,
.invoice-list-table td {
    padding: 9px 7px;
    font-size: 11px;
    border-bottom: 1px solid #e9edf4;
    white-space: nowrap;
    vertical-align: middle;
}
.invoice-list-table th {
    font-size: 9px;
    color: #64748b;
    letter-spacing: .03em;
    font-weight: 800;
}
.invoice-list-table tbody tr:last-child td {
    border-bottom: none;
}
.invoice-list-table .invoice-number-cell,
.invoice-list-table .invoice-gross-cell {
    font-weight: 700;
    color: #0f172a;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
}
.invoice-status-trigger {
    cursor: pointer;
}
.invoice-status-trigger:hover {
    filter: brightness(0.97);
}
.status-pill.paid {
    background: #d1fae5;
    color: #065f46;
}
.status-pill.overdue {
    background: #fee2e2;
    color: #b91c1c;
}
.status-pill.open {
    background: #fef3c7;
    color: #854d0e;
}
.reminder-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.reminder-dot {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    text-decoration: none;
    cursor: pointer;
    line-height: 1;
}
.reminder-dot.active {
    border-color: #22c55e;
    color: #ffffff;
    background: #22c55e;
}
.reminder-dot.disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: auto;
}
.invoice-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
}
.invoice-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #d7deea;
    background: #fff;
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.invoice-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(15, 23, 42, .08);
}
.invoice-action.purple { color: #7e22ce; border-color: #e9d5ff; background: #faf5ff; }
.invoice-action.cyan { color: #0e7490; border-color: #a5f3fc; background: #ecfeff; }
.invoice-action.green { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.invoice-action.blue { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }
.invoice-action.red { color: #b91c1c; border-color: #fecaca; background: #fef2f2; cursor: pointer; }
.invoice-view-btn {
    cursor: pointer;
}
.invoice-view-card {
    width: min(980px, calc(100vw - 28px));
    height: min(820px, calc(100vh - 64px));
    padding: 44px 18px 18px;
    position: relative;
    overflow: hidden;
}
.invoice-view-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 34px;
    height: 34px;
    border: 1px solid #d7deea;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.invoice-view-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-full { grid-column: 1 / -1; }
.form-field label { display: block; margin-bottom: 4px; font-size: 12px; color: #334155; font-weight: 700; }
.form-input {
    width: 100%;
    border: 1px solid #cfd8e5;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    background: #fff;
}
.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    border: 1px solid #cfd8e5;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    background: #fff;
}
.form-field input[type="date"] {
    -webkit-locale: "de-DE";
}
.form-field.compact-textarea textarea {
    min-height: 64px;
    max-height: 84px;
    resize: vertical;
}
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, .45);
    z-index: 40;
    padding: 20px;
}
.modal.open { display: flex; }
.modal-card {
    width: min(560px, 100%);
    max-height: 92vh;
    overflow: auto;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 12px;
}
.modal-card.wide {
    width: min(760px, 100%);
}
.modal-card.offer-wide {
    width: min(980px, 100%);
}
.modal-card.invoice-wide {
    width: min(980px, 100%);
    padding: 0;
}
.invoice-shell {
    padding: 16px 16px 14px;
}
.invoice-head {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
    margin-bottom: 12px;
}
.invoice-title {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.05;
}
.invoice-no { color: #64748b; font-size: 11px; font-weight: 600; text-align: center; justify-self: center; }
.invoice-no strong { display: block; color: #0f172a; font-size: 22px; line-height: 1.05; margin-top: 2px; }
.invoice-head-actions { display: flex; gap: 8px; justify-self: end; }
.invoice-head-actions .btn,
.invoice-head-actions .btn-ghost { padding: 8px 12px; font-size: 12px; }
.invoice-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1.25fr) minmax(220px, 1fr) minmax(170px, 0.8fr) minmax(220px, 1fr);
    gap: 10px;
    margin-bottom: 10px;
    align-items: start;
}
.offer-meta-row {
    display: grid;
    grid-template-columns: minmax(320px, 1.5fr) minmax(220px, 1fr) minmax(220px, 1fr);
    gap: 10px;
    width: 100%;
}
.invoice-grid .span-2 { grid-column: span 2; }
.invoice-grid .customer-compact {
    max-width: none;
    justify-self: start;
    width: 100%;
    min-width: 260px;
}
.invoice-grid .status-field {
    min-width: 170px;
    justify-self: end;
}
.status-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
}
.invoice-grid .radio-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 0;
    min-height: 0;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    align-self: start;
    white-space: nowrap;
}
.invoice-grid .check-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 23px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}
.convert-paid-wrap {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    white-space: nowrap;
}
.convert-paid-wrap input {
    margin: 0;
}
.offer-convert-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 10px;
}
.offer-convert-due-field {
    flex: 0 0 240px;
    min-width: 240px;
    max-width: 240px;
}
.due-day-options {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}
.due-day-options label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
}
.invoice-section-label {
    font-size: 12px;
    font-weight: 800;
    color: #334155;
    margin: 8px 0 6px;
}
.invoice-lines {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 8px;
}
.invoice-lines table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}
.invoice-lines th,
.invoice-lines td { border-bottom: 1px solid var(--line); padding: 6px 6px; font-size: 11px; }
.invoice-lines tr:last-child td { border-bottom: none; }
.invoice-lines .line-mini { width: 100%; border: 1px solid #cfd8e5; border-radius: 6px; padding: 5px 6px; font-size: 11px; }
.invoice-lines .line-mini[type="number"] { padding-right: 2px; }
.invoice-lines .line-mini[type="number"]::-webkit-inner-spin-button,
.invoice-lines .line-mini[type="number"]::-webkit-outer-spin-button {
    margin: 0;
    width: 12px;
    height: 14px;
    transform: scale(0.8);
    transform-origin: center;
}
.invoice-lines .line-num {
    width: 30px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #f1f5f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}
.invoice-lines .sum-blue { color: #0284c7; font-weight: 800; }
.invoice-lines .line-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 700;
    font-size: 10px;
    text-decoration: none;
}
.invoice-lines .line-action.del,
.invoice-lines .line-action.del-shipping,
.invoice-lines .line-action.del-offer-shipping {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}
.invoice-line-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}
.invoice-note-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: #2563eb;
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 10px;
}
.invoice-summary {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
    overflow: hidden;
}
.invoice-summary-head {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 800;
    color: #334155;
    border-bottom: 1px solid var(--line);
}
.invoice-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--line);
}
.invoice-summary-row:last-child { border-bottom: 0; }
.invoice-summary-row strong { font-size: 30px; color: #0284c7; line-height: 1; }
.invoice-summary-row .muted-small { font-size: 11px; color: #64748b; display: block; text-align: right; margin-top: 3px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.table-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.table-actions.offer-actions-layout {
    flex-direction: row;
    align-items: center;
    gap: 6px;
}
.offer-actions-layout .offer-convert-row {
    display: flex;
    width: auto;
    align-items: center;
    order: -1;
}
.offer-actions-layout .offer-secondary-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}
.table-actions .action-main-btn {
    border: 1px solid #d7deea;
    background: #fff;
    color: #334155;
    border-radius: 10px;
    width: 30px;
    height: 30px;
    padding: 0;
    margin-right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}
.table-actions .action-main-btn:hover {
    background: #e0f2fe;
    border-color: #7dd3fc;
}
.icon-btn {
    border: 1px solid #d7deea;
    background: #fff;
    border-radius: 10px;
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #334155;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(15, 23, 42, .08);
}
.table-actions .offer-mail-btn {
    color: #7e22ce;
    border-color: #e9d5ff;
    background: #faf5ff;
}
.table-actions .offer-download-btn {
    color: #166534;
    border-color: #bbf7d0;
    background: #f0fdf4;
}
.table-actions .offer-edit-btn {
    color: #1d4ed8;
    border-color: #bfdbfe;
    background: #eff6ff;
}
.table-actions .offer-delete-btn {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}
.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    background: #e2e8f0;
    color: #334155;
}
.chip.blue { background: #dbeafe; color: #1d4ed8; }
.chip.green { background: #dcfce7; color: #166534; }
.chip.red { background: #fee2e2; color: #b91c1c; }
.company-wrap { max-width: 860px; margin: 0 auto; }
.link-row { display: grid; gap: 8px; margin-top: 4px; }
.link-row a {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    color: #334155;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
}
.dashboard-title { font-size: 30px; line-height: 1.1; margin-bottom: 4px; }
.kpi-card { display: flex; align-items: center; justify-content: space-between; min-height: 74px; }
.kpi-link { text-decoration: none; color: inherit; }
.kpi-link:hover { border-color: #cfd8e5; box-shadow: 0 2px 6px rgba(15, 23, 42, .06); }
.kpi-card .label { color: #475569; font-weight: 700; font-size: 15px; }
.kpi-card .value { color: #0f172a; font-size: 26px; font-weight: 800; margin-top: 4px; }
.dashboard-kpi-grid {
    grid-template-columns: repeat(3, minmax(260px, 290px));
    justify-content: center;
    margin-bottom: 20px;
}
.delivery-map-shell {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}
.delivery-map-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.delivery-map-panel label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 800;
    color: #334155;
}
.delivery-map-panel select {
    width: 100%;
    border: 1px solid #d7deea;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    font-size: 13px;
    color: #0f172a;
    background: #fff;
}
.delivery-start-location {
    display: grid;
    gap: 5px;
}
.delivery-start-location-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
}
.delivery-start-location input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #d7deea;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    background: #fff;
    outline: none;
}
.delivery-start-location input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .12);
}
.delivery-current-location {
    min-height: 42px;
    white-space: nowrap;
}
.delivery-customer-dropdown {
    position: relative;
}
.delivery-customer-dropdown.open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, .32);
}
.delivery-customer-toggle {
    width: 100%;
    min-height: 42px;
    border: 1px solid #d7deea;
    border-radius: 10px;
    padding: 0 10px;
    background: #fff;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}
.delivery-customer-dropdown.open .delivery-customer-toggle {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .12);
}
.delivery-customer-list {
    display: grid;
    gap: 8px;
    grid-auto-rows: max-content;
    position: fixed;
    top: 96px;
    bottom: 18px;
    left: 50%;
    z-index: 2001;
    width: min(560px, calc(100vw - 24px));
    max-height: none;
    overflow-y: auto;
    margin-top: 0;
    padding: 12px;
    border: 1px solid #dbe4ef;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 20px 48px rgba(15, 23, 42, .18);
    transform: translateX(-50%);
}
.delivery-customer-list[hidden] {
    display: none;
}
.delivery-customer-list-head {
    position: sticky;
    top: 0;
    z-index: 3;
    padding-bottom: 8px;
    background: #fff;
    box-shadow: 0 8px 14px rgba(255, 255, 255, .95);
}
.delivery-customer-panel-search {
    width: 100%;
    min-height: 42px;
    border: 1px solid #d7deea;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    font-size: 13px;
    color: #0f172a;
    background: #fff;
    outline: none;
}
.delivery-customer-panel-search:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .12);
}
.delivery-customer-search {
    width: 100%;
    min-height: 40px;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
    background: transparent;
    outline: none;
}
.delivery-customer-search::placeholder {
    color: #0f172a;
    opacity: 1;
}
.delivery-customer-empty {
    padding: 10px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    color: #64748b;
    font-size: 12px;
    text-align: center;
    background: #f8fafc;
}
.delivery-customer-option {
    display: flex !important;
    align-items: flex-start;
    gap: 9px;
    margin: 0 !important;
    padding: 10px;
    border: 1px solid #dbe4ef;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}
.delivery-customer-option[hidden] {
    display: none !important;
}
.delivery-customer-option input {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex: 0 0 auto;
}
.delivery-customer-option span {
    display: grid;
    gap: 3px;
}
.delivery-customer-option strong {
    font-size: 12px;
    color: #0f172a;
}
.delivery-customer-option small,
.delivery-route-list small {
    font-size: 11px;
    line-height: 1.35;
    color: #64748b;
}
.delivery-route-submit {
    width: 100%;
    margin-top: 10px;
    position: sticky;
    bottom: 0;
    z-index: 2;
    box-shadow: 0 -8px 14px rgba(255, 255, 255, .95);
}
.delivery-map-address {
    border: 1px solid #dbe4ef;
    border-radius: 10px;
    padding: 12px;
    background: #f8fafc;
}
.delivery-map-address span {
    display: block;
    color: #475569;
    font-size: 13px;
    line-height: 1.45;
}
.delivery-route-toggle {
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    text-align: left;
}
.delivery-route-toggle strong {
    display: block;
    font-size: 14px;
    color: #0f172a;
}
.delivery-route-toggle span {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}
.delivery-route-toggle::after {
    content: "▾";
    color: #64748b;
    font-size: 12px;
}
.delivery-route-toggle[aria-expanded="true"]::after {
    content: "▴";
}
.delivery-route-panel {
    margin-top: 10px;
}
.delivery-route-panel[hidden] {
    display: none;
}
.delivery-map-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    align-items: center;
}
.delivery-route-save-form {
    margin: 0;
    min-width: 0;
}
.delivery-map-actions .btn,
.delivery-map-actions .btn-ghost,
.delivery-route-save-form .btn-ghost {
    width: 100%;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding-right: 10px;
    padding-left: 10px;
    text-align: center;
    white-space: normal;
    line-height: 1.15;
}
.delivery-action-disabled,
.delivery-route-save-form .btn-ghost:disabled {
    opacity: .55;
    cursor: not-allowed;
}
.delivery-map-messages {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}
.delivery-map-message {
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 9px 12px;
    background: #e0f2fe;
    color: #075985;
    font-size: 13px;
    font-weight: 800;
}
.delivery-map-message-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}
.delivery-map-message-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}
.delivery-saved-routes {
    margin-top: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px;
    background: #f8fafc;
}
.delivery-saved-routes[hidden] {
    display: none;
}
.delivery-saved-route-list {
    display: grid;
    gap: 8px;
}
.delivery-saved-route-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
}
.delivery-saved-route-item strong,
.delivery-saved-route-item small {
    display: block;
}
.delivery-saved-route-item small,
.delivery-saved-route-empty {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}
.delivery-saved-route-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
.delivery-saved-route-actions form {
    margin: 0;
}
.delivery-saved-route-actions .btn-ghost {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 12px;
    text-decoration: none;
}
.delivery-route-remove-saved {
    width: 34px;
    height: 34px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}
.delivery-route-remove-saved:hover {
    background: #fee2e2;
}
@media (max-width: 520px) {
    .delivery-map-actions {
        gap: 6px;
    }
    .delivery-map-actions .btn,
    .delivery-map-actions .btn-ghost,
    .delivery-route-save-form .btn-ghost {
        min-height: 34px;
        padding-right: 6px;
        padding-left: 6px;
        font-size: 11px;
    }
}
.delivery-route-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
}
.delivery-route-list li {
    padding-right: 76px;
    position: relative;
    cursor: grab;
}
.delivery-route-list li.dragging {
    opacity: .55;
    cursor: grabbing;
}
.delivery-route-list li span {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
}
.delivery-route-drag {
    position: absolute;
    top: 0;
    right: 34px;
    width: 34px;
    height: 26px;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    background: #e0f2fe;
    color: #0369a1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    cursor: grab;
}
.delivery-route-drag-axis {
    position: absolute;
    inset: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: #0f172a !important;
    font-size: 18px !important;
    line-height: 1 !important;
}
.delivery-route-drag-horizontal {
    transform: translateY(1px);
}
.delivery-route-drag-vertical {
    transform: translateY(-1px);
}
.delivery-route-list li.dragging .delivery-route-drag {
    cursor: grabbing;
}
.delivery-route-remove {
    position: absolute;
    top: 0;
    right: 0;
    width: 26px;
    height: 26px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: #b91c1c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}
.delivery-route-remove:hover {
    background: #fee2e2;
}
.delivery-stop-count {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}
.delivery-map-frame-card {
    overflow: hidden;
    min-height: 560px;
    padding: 0;
    position: relative;
    z-index: 0;
}
.delivery-map-frame {
    display: block;
    width: 100%;
    height: 560px;
    border: 0;
}
.delivery-customer-map {
    width: 100%;
    height: 560px;
    min-height: 560px;
    background: #e2e8f0;
    z-index: 0;
}
.delivery-map-loading {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 2;
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, .92);
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
}
.delivery-green-marker span {
    display: block;
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 999px;
    background: #16a34a;
    box-shadow: 0 2px 8px rgba(22, 163, 74, .45);
}
.delivery-red-marker span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 3px solid #fff;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 2px 10px rgba(220, 38, 38, .5);
}
.delivery-marker-add {
    margin-top: 6px;
    border: 0;
    border-radius: 8px;
    padding: 6px 8px;
    background: #0ea5e9;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.delivery-marker-remove {
    margin-top: 6px;
    border: 0;
    border-radius: 8px;
    padding: 6px 8px;
    background: #dc2626;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.delivery-marker-position {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}
.delivery-marker-position select {
    min-height: 30px;
    border: 1px solid #d7deea;
    border-radius: 8px;
    padding: 4px 8px;
    background: #fff;
    color: #0f172a;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
}
.delivery-empty-map {
    height: 560px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    color: #64748b;
    background: #f8fafc;
}
.icon-badge {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
}
.icon-badge svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.icon-badge.icon-sm {
    width: 30px;
    height: 30px;
}
.icon-badge.icon-sm svg {
    width: 14px;
    height: 14px;
}
.icon-blue { background: #dbeafe; color: #2563eb; }
.icon-green { background: #dcfce7; color: #16a34a; }
.icon-purple { background: #f3e8ff; color: #9333ea; }
.icon-orange { background: #ffedd5; color: #f97316; }
.panel-title { font-size: 24px; margin-bottom: 10px; }
.quick-item,
.activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--line);
    background: #f8fafc;
    border-radius: 10px;
    min-height: 48px;
    padding: 0 10px;
    color: #334155;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
}
.activity-item {
    justify-content: flex-start;
    gap: 10px;
    align-items: center;
}
.activity-item .text strong { display: block; color: #0f172a; }
.activity-item .text span { color: #64748b; font-weight: 500; }
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--panel);
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 10px rgba(15, 23, 42, .1);
    z-index: 50;
    padding: 16px;
    transform: translateY(100%);
    transition: transform .3s ease;
}
.cookie-banner.open {
    transform: translateY(0);
}
.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.cookie-banner-content p {
    margin: 0;
    font-size: 14px;
    color: var(--text);
    line-height: 1.45;
}
.cookie-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
@media (max-width: 980px) {
    .grid-4, .grid-2, .form-grid { grid-template-columns: 1fr; }
    .dashboard-kpi-grid {
        grid-template-columns: 1fr;
        justify-content: stretch;
        margin-bottom: 14px;
    }
    .delivery-map-shell {
        grid-template-columns: 1fr;
    }
    .delivery-map-frame-card,
    .delivery-map-frame,
    .delivery-customer-map,
    .delivery-empty-map {
        min-height: 420px;
        height: 420px;
    }
    h1 { font-size: 22px; }
    .topbar {
        gap: 10px;
        padding: 8px 10px;
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    .logo-img { height: 52px; max-width: 300px; }
    .menu-toggle { display: inline-flex; }
    .nav,
    .user-box {
        display: none;
    }
    .mobile-drawer {
        display: flex;
    }
    body.mobile-drawer-open .mobile-drawer {
        transform: translateX(0);
    }
    body.mobile-drawer-open .mobile-drawer-overlay {
        display: block;
    }
    .wrap {
        margin: 10px auto;
        padding: 0 8px;
    }
    .page-head {
        flex-wrap: wrap;
        align-items: flex-start;
    }
    .page-head .btn,
    .page-head .btn-ghost {
        min-height: 38px;
    }
    .dashboard-title { font-size: 24px; }
    .panel-title { font-size: 20px; }
    .kpi-card .label { font-size: 14px; }
    .kpi-card .value { font-size: 22px; }
    .modal-card.invoice-wide { width: 100%; }
    .invoice-head { grid-template-columns: 1fr; }
    .invoice-title { font-size: 24px; }
    .invoice-no strong { font-size: 20px; }
    .invoice-grid { grid-template-columns: 1fr; }
    .offer-meta-row { grid-template-columns: 1fr; }
    .invoice-grid .span-2 { grid-column: span 1; }
    .table-actions,
    .invoice-actions {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    .table-actions.offer-actions-layout {
        align-items: center;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 6px;
    }
    .offer-actions-layout .offer-convert-row,
    .offer-actions-layout .offer-secondary-actions {
        justify-content: flex-start;
        flex-wrap: nowrap;
    }
    .offer-actions-layout .offer-convert-row {
        width: auto;
        flex: 0 0 auto;
    }
    .search,
    .form-input,
    .form-field input,
    .form-field select,
    .form-field textarea {
        font-size: 16px;
    }
    .modal {
        padding: 10px;
    }
    .modal-card {
        max-height: 95vh;
    }
    .cookie-banner-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .cookie-banner-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 640px) {
    h1 { font-size: 20px; }
    .dashboard-kpi-grid {
        gap: 8px;
    }
    .btn,
    .btn-ghost {
        min-height: 40px;
        padding: 8px 10px;
        font-size: 13px;
    }
    .invoice-actions,
    .table-actions:not(.offer-actions-layout) {
        display: grid;
        grid-template-columns: repeat(2, 28px);
        gap: 6px;
        justify-content: start;
        align-items: center;
    }
    .offer-actions-layout .offer-secondary-actions {
        display: flex;
        gap: 6px;
        justify-content: start;
        flex-wrap: nowrap;
    }
    .delivery-customer-list {
        top: 74px;
        bottom: 10px;
        width: calc(100vw - 16px);
        padding: 10px;
        border-radius: 12px;
    }
    .delivery-start-location-row {
        grid-template-columns: 1fr;
    }
    .list-table-card {
        padding: 6px;
    }
    .list-search-card {
        padding: 8px;
    }
    .icon-btn,
    .invoice-action {
        width: 28px;
        min-width: 28px;
        height: 28px;
        font-size: 12px;
    }
    .reminder-dot {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    .logout-confirm-card {
        padding: 12px;
    }
}