:root {
    --sidebar-width: 280px;
    --bg-dark: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-main: #f1f5f9;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;
    --border: #334155;
    --card-bg: #ffffff;
    --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
    --radius: 12px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.5;
    min-height: 100vh;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-sidebar) 100%);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transition: transform 0.25s ease;
    border-right: 1px solid var(--border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--bg-dark);
}

.brand-title {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.brand-sub {
    display: block;
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
}

.brand-extra {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.nav-label-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.nav-sublabel {
    font-size: 0.65rem;
    color: #94a3b8;
    font-weight: 500;
    line-height: 1.2;
}

.nav-item.active .nav-sublabel {
    color: rgba(15, 23, 42, 0.65);
}

.nav-item-officer {
    border-left: 3px solid var(--accent);
    margin-bottom: 4px;
}

.officer-info-card .officer-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.officer-info-card .detail-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
}

.officer-info-card .detail-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 6px;
}

.officer-info-card .detail-value {
    font-size: 0.95rem;
    color: #0f172a;
}

.officer-info-card .detail-value a {
    color: var(--accent-hover);
    text-decoration: none;
}

.officer-info-card .detail-value a:hover {
    text-decoration: underline;
}

.customer-order-sheet-page .readonly-field {
    background: #f1f5f9;
    color: #475569;
    cursor: default;
}

.customer-order-table th,
.customer-order-table td {
    font-size: 0.82rem;
    vertical-align: top;
}

.customer-order-table .price-number {
    white-space: nowrap;
}

.order-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.order-status-pending {
    background: #fef3c7;
    color: #92400e;
}

.order-status-delivered {
    background: #d1fae5;
    color: #065f46;
}

.order-status-partial {
    background: #dbeafe;
    color: #1e40af;
}

.order-status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.delivery-update-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 130px;
}

.delivery-field-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.delivery-update-form .select-compact,
.delivery-update-form .input-compact {
    width: 100%;
    font-size: 0.8rem;
    padding: 6px 8px;
}

.customer-order-table .td-delivery {
    min-width: 150px;
}

/* Order management */
.order-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.order-stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    border-left: 4px solid #94a3b8;
}

.order-stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}

.order-stat-label {
    font-size: 0.78rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.order-stat-pending { border-left-color: #f59e0b; }
.order-stat-partial { border-left-color: #3b82f6; }
.order-stat-delivered { border-left-color: #10b981; }

.order-filters-card {
    margin-bottom: 16px;
    padding: 16px 20px;
}

.order-period-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.period-tab {
    padding: 8px 16px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
}

.period-tab:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.period-tab.is-active {
    background: var(--accent, #ea580c);
    color: #fff;
    border-color: var(--accent, #ea580c);
}

.order-filters-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

.order-filters-row--delivery {
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
}

.order-filters-hint {
    margin: 10px 0 0;
    font-size: 0.8rem;
    color: #64748b;
}

.order-filters-form--auto .order-filter-actions .btn-primary {
    display: none;
}

.order-filter-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.order-mgmt-table .order-ref {
    color: var(--accent-hover, #c2410c);
    font-size: 0.9rem;
}

.order-mgmt-table .order-datetime {
    white-space: nowrap;
    min-width: 130px;
}

.order-party-cell {
    min-width: 160px;
    max-width: 220px;
}

.order-address-line {
    display: block;
    color: #94a3b8;
    font-size: 0.72rem;
}

.order-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px;
    border-top: 1px solid #e2e8f0;
}

.order-page-info {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 600;
}

.order-delivery-modal {
    max-width: 480px;
}

.delivery-modal-summary {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    color: #334155;
}

.delivery-modal-summary p {
    margin: 4px 0;
}

@media (max-width: 900px) {
    .order-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .order-filters-row {
        grid-template-columns: 1fr 1fr;
    }

    .order-search-group {
        grid-column: 1 / -1;
    }

    .order-filter-actions {
        grid-column: 1 / -1;
    }
}

.sidebar-nav-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-scroll-btn {
    flex-shrink: 0;
    width: 100%;
    height: 22px;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(15, 23, 42, 0.55);
    color: #94a3b8;
    font-size: 0.62rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sidebar-scroll-btn:first-child {
    border-top: none;
}

.sidebar-scroll-btn:last-child {
    border-bottom: none;
}

.sidebar-scroll-btn:hover {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent);
}

.sidebar-scroll-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.sidebar-scroll-btn:disabled:hover {
    background: rgba(15, 23, 42, 0.55);
    color: #94a3b8;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 10px;
    scroll-behavior: smooth;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-light);
}

.nav-item.active {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent);
    font-weight: 600;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.85;
}

.nav-item.active .nav-icon {
    opacity: 1;
}

.nav-dropdown {
    position: relative;
    margin-bottom: 4px;
}

.nav-dropdown-trigger {
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.nav-dropdown-caret {
    margin-left: auto;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.7;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.nav-dropdown.is-open .nav-dropdown-caret {
    transform: rotate(-135deg);
}

.nav-dropdown.is-active > .nav-dropdown-trigger {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent);
    font-weight: 600;
}

.nav-dropdown-menu {
    display: none;
    flex-direction: column;
    gap: 2px;
    margin: 4px 0 6px 32px;
    padding: 6px 0 6px 10px;
    border-left: 2px solid rgba(255, 255, 255, 0.12);
}

.nav-dropdown.is-open .nav-dropdown-menu {
    display: flex;
}

.nav-dropdown-item {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    line-height: 1.35;
    transition: background 0.15s, color 0.15s;
}

.nav-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-light);
}

.nav-dropdown-item.active {
    background: rgba(245, 158, 11, 0.18);
    color: var(--accent);
    font-weight: 600;
}

.nav-label {
    line-height: 1.3;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main area */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
    isolation: isolate;
}

.topbar-left {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 48%;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 3;
    padding-right: 12px;
}

.topbar-left .page-heading {
    flex: 0 1 auto;
    max-width: 100%;
}

.topbar-center {
    position: absolute;
    left: calc(50% + 28px);
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    pointer-events: none;
    max-width: calc(100% - 190px);
}

.topbar-center .topbar-brand-logo-wrap {
    pointer-events: auto;
}

.topbar-right {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    z-index: 2;
}

.topbar-right .topbar-user {
    margin-left: 0;
}

.topbar-brand-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 6px;
    background: #ffffff;
    line-height: 0;
    min-width: 100px;
    max-width: 150px;
}

.topbar-brand-logo {
    width: 100%;
    height: 32px;
    max-width: 150px;
    min-width: 110px;
    object-fit: contain;
    object-position: center;
    display: block;
}

.page-heading {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-dark);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: var(--card-bg);
    cursor: pointer;
    padding: 8px;
}

.menu-toggle span {
    display: block;
    height: 2px;
    background: var(--text-dark);
    border-radius: 1px;
}

.main-content {
    padding: 28px;
    flex: 1;
}

/* Page card */
.page-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 32px;
    max-width: 900px;
}

/* Product price list */
.price-list-page {
    max-width: 100%;
}

.price-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.price-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.price-sheet {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 18px;
    border: 1px solid #e2e8f0;
}

.price-sheet-header {
    display: grid;
    grid-template-columns: 160px 1fr 160px;
    align-items: center;
    gap: 18px;
    padding-bottom: 14px;
}

.price-logo-wrap {
    display: flex;
    align-items: center;
}

.price-logo {
    width: 110px;
    max-height: 64px;
    object-fit: contain;
}

.price-title-wrap {
    text-align: center;
}

.price-title-wrap h2 {
    font-size: 1.35rem;
    font-weight: 650;
    color: #000;
    margin-bottom: 2px;
}

.price-title-wrap p {
    font-size: 0.78rem;
    color: #64748b;
}

.price-search-row {
    margin: 6px 0 12px;
}

.price-search {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
}

.price-search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.price-search-row small {
    display: block;
    color: #64748b;
    margin-top: 5px;
    font-size: 0.75rem;
}

.price-category-block {
    margin-top: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.price-category-block h3 {
    text-align: center;
    font-size: 1rem;
    font-weight: 650;
    padding: 8px 10px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    color: #1f2937;
}

.price-table-wrap {
    overflow-x: auto;
}

.price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.price-table th,
.price-table td {
    border: 1px solid #d9e1ea;
    padding: 10px 12px;
    vertical-align: middle;
}

.price-table th {
    background: #f8fafc;
    color: #111827;
    font-weight: 700;
    text-align: left;
}

.price-table tbody tr:nth-child(even) {
    background: #fbfdff;
}

.price-table tbody tr:hover {
    background: #fffbeb;
}

.price-product {
    font-weight: 700;
    color: #111827;
}

.price-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.price-action-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.price-empty {
    text-align: center;
    border: 2px dashed #cbd5e1;
    padding: 44px 20px;
    border-radius: 10px;
    color: #64748b;
}

.price-empty p {
    margin-bottom: 14px;
}

/* Primary sale */
.distributor-purchase-table .dist-purchase-row-clickable {
    cursor: pointer;
}

.distributor-purchase-table .dist-purchase-row-clickable:hover {
    background: #fff7ed;
}

.company-primary-sale-page .price-number {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.stock-sheet-page .price-number {
    font-variant-numeric: tabular-nums;
}

.stock-sheet-table .th-sub {
    font-size: 0.7rem;
    font-weight: 500;
    color: #64748b;
}

.stock-balance-cell {
    white-space: nowrap;
}

.stock-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    vertical-align: middle;
}

.stock-badge-low {
    background: #fef2f2;
    color: #b91c1c;
}

.stock-badge-zero {
    background: #f1f5f9;
    color: #64748b;
}

.stock-row-negative {
    background: #fff5f5;
}

.stock-row-zero td {
    color: #64748b;
}

.stock-totals-row {
    background: #fff7ed;
    border-top: 2px solid #fed7aa;
}

.stock-totals-row td {
    padding-top: 12px;
    padding-bottom: 12px;
}

.stock-hint-warn {
    color: #b91c1c;
    font-weight: 600;
}

.complaints-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.complaint-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px 20px;
    background: #fff;
}

.complaint-open {
    border-left: 4px solid #f59e0b;
}

.complaint-resolved {
    border-left: 4px solid #22c55e;
    background: #f8fafc;
}

.complaint-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.complaint-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    text-align: right;
}

.complaint-print-btn {
    margin-top: 2px;
}

.complaint-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    margin-bottom: 10px;
    table-layout: fixed;
}

.complaint-details-table td {
    border: 1px solid #cbd5e1;
    padding: 7px 10px;
    vertical-align: top;
}

.complaint-detail-label {
    font-weight: 700;
    background: #e8f0f7;
    width: 18%;
    white-space: nowrap;
    color: #334155;
}

.complaint-detail-value {
    width: 32%;
    background: #fff;
}

.complaint-issue-value {
    white-space: pre-wrap;
    word-break: break-word;
}

.complaint-resolve-details {
    margin-top: 4px;
}

.complaint-resolve-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
}

.complaint-print-wrap {
    max-width: 900px;
}

.complaint-print-doc {
    margin: 0;
    padding: 4px 0 0;
}

.complaint-issue-cell {
    white-space: pre-wrap;
    word-break: break-word;
}

@media print {
    .complaint-print-body {
        background: #fff !important;
    }

    .complaint-print-body .invoice-print-toolbar {
        display: none !important;
    }

    .complaint-print-wrap {
        box-shadow: none !important;
    }
}

/* Professional dashboard */
.pro-dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dash-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    padding: 24px 28px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #334155 100%);
    border-radius: var(--radius);
    color: var(--text-light);
    box-shadow: var(--shadow);
}

.dash-hero-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.dash-hero-sub {
    color: #cbd5e1;
    font-size: 0.95rem;
    max-width: 520px;
}

.dash-hero-extra {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--accent);
}

.dash-hero-meta {
    text-align: right;
}

.dash-live-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.dash-date {
    display: block;
    font-size: 0.85rem;
    color: #94a3b8;
}

.dash-today-route-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow);
    padding: 18px 20px;
}

.dash-today-route-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.dash-today-route-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.dash-today-route-day {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(249, 115, 22, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
}

.dash-today-route-note {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: #64748b;
}

.dash-today-route-note.is-today-active {
    color: #15803d;
    font-weight: 600;
}

.dash-today-route-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.dash-today-route-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: var(--radius);
    border: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #fff7ed 0%, #ffffff 55%);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.dash-today-route-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border-color: var(--accent);
}

.dash-today-route-grid-single {
    grid-template-columns: 1fr;
}

.dash-today-route-card.dash-today-route-off {
    cursor: default;
    border-color: #cbd5e1;
    background: linear-gradient(135deg, #f1f5f9 0%, #ffffff 55%);
    opacity: 0.95;
}

.dash-today-route-off-label {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: #64748b;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.dash-today-route-card.is-today {
    border-color: #22c55e;
    background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 55%);
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.12);
}

.dash-today-route-end {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.dash-today-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #15803d;
    background: #dcfce7;
    padding: 3px 8px;
    border-radius: 20px;
}

.dash-today-route-icon {
    flex-shrink: 0;
    font-size: 1.5rem;
}

.dash-today-route-body {
    flex: 1;
    min-width: 0;
}

.dash-today-route-name {
    display: block;
    font-size: 1.05rem;
    color: #0f172a;
    margin-bottom: 4px;
}

.dash-today-route-meta {
    display: block;
    font-size: 0.82rem;
    color: #64748b;
}

.dash-today-route-detail {
    display: block;
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-today-route-arrow {
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
}

.dash-today-route-empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #64748b;
}

.dash-today-route-empty .hint {
    font-size: 0.8rem;
    color: #94a3b8;
}

.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.dash-kpi-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid #e2e8f0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dash-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}

.dash-kpi-link {
    display: block;
    padding: 18px 20px;
    text-decoration: none;
    color: inherit;
}

.dash-kpi-static {
    cursor: default;
}

.dash-kpi-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.1;
}

.dash-kpi-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dash-kpi-sub {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
}

.dash-kpi-route {
    position: relative;
}

.dash-kpi-route .dash-kpi-link,
.dash-kpi-route .dash-kpi-static {
    padding-top: 34px;
}

.dash-kpi-route-view-all {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--accent);
    text-decoration: none;
    text-align: right;
    max-width: 52%;
}

.dash-kpi-route-view-all:hover {
    text-decoration: underline;
}

.dash-kpi-route .dash-kpi-route-name {
    text-transform: none;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-kpi-value-off {
    color: #64748b;
}

.so-dash-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

/* Sale officer — 7 cards fit on one screen */
.pro-dashboard-so-compact {
    gap: 10px;
}

.pro-dashboard-so-compact .dash-hero {
    padding: 12px 16px;
}

.pro-dashboard-so-compact .dash-hero-title {
    font-size: 1.15rem;
    margin-bottom: 2px;
}

.pro-dashboard-so-compact .dash-hero-sub {
    font-size: 0.8rem;
    line-height: 1.35;
}

.pro-dashboard-so-compact .dash-hero-extra {
    margin-top: 4px;
    font-size: 0.75rem;
}

.pro-dashboard-so-compact .dash-date {
    font-size: 0.78rem;
}

.so-dash-panels-compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.so-dash-panels-compact .so-dash-panel-recovery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
    align-content: start;
}

.so-dash-panels-compact .so-dash-panel-recovery .so-dash-panel-title {
    grid-column: 1 / -1;
}

.so-dash-panels-compact .so-dash-panel {
    padding: 9px 11px;
    gap: 3px;
}

.so-dash-panels-compact .so-dash-panel-title {
    font-size: 0.76rem;
    margin: 0 0 3px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e2e8f0;
}

.so-dash-panels-compact .so-dash-panel-row {
    padding-bottom: 4px;
    gap: 8px;
}

.so-dash-panels-compact .so-dash-panel-row-link {
    margin: 0 -4px;
    padding: 3px 4px;
    border-radius: 6px;
}

.so-dash-panels-compact .so-dash-panel-label {
    font-size: 0.7rem;
    line-height: 1.25;
}

.so-dash-panels-compact .so-dash-panel-value {
    font-size: 0.84rem;
}

.so-dash-panels-compact .so-dash-panel-table-wrap {
    gap: 4px;
}

.so-dash-panels-compact .so-dash-panel-table {
    font-size: 0.7rem;
}

.so-dash-panels-compact .so-dash-panel-table thead th {
    font-size: 0.62rem;
    padding: 0 0 3px;
}

.so-dash-panels-compact .so-dash-panel-table tbody td {
    padding: 3px 0;
}

.so-dash-panels-compact .so-dash-panel-value-stack {
    gap: 1px;
}

.so-dash-panels-compact .so-dash-panel-value-stack small {
    font-size: 0.62rem;
}

@media (min-width: 1281px) {
    .so-dash-panels-compact .so-dash-panel-recovery {
        grid-column: span 2;
    }
}

@media (max-width: 1280px) {
    .so-dash-panels-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .so-dash-panels-compact .so-dash-panel-recovery {
        grid-column: span 2;
    }
}

@media (max-width: 900px) {
    .so-dash-panels-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .so-dash-panels-compact {
        grid-template-columns: 1fr;
    }

    .so-dash-panels-compact .so-dash-panel-recovery {
        grid-template-columns: 1fr;
    }
}

.so-dash-panel {
    position: relative;
    background: var(--card-bg);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.so-dash-panel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #e2e8f0;
}

.so-dash-panel-row-link {
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    margin: 0 -6px;
    padding: 8px 6px;
    transition: background 0.15s ease;
    cursor: pointer;
}

.so-dash-panel-row-link:hover {
    background: #f8fafc;
}

.so-dash-panel-row-link:hover .so-dash-panel-value {
    text-decoration: underline;
}

.so-dash-panel-row-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

a.so-dash-panel-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

a.so-dash-panel-card-link:hover {
    border-color: #f59e0b;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.12);
}

a.so-dash-panel-card-link:hover .so-dash-panel-value {
    color: #b45309;
}

a.so-dash-panel-card-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.so-dash-panel-row:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.so-dash-panel-row-rrr {
    margin: 4px -4px 0;
    padding: 6px 8px;
    background: #000;
    border-radius: 6px;
    border-bottom: none;
}

.so-dash-panel-row-rrr .so-dash-panel-label,
.so-dash-panel-row-rrr .so-dash-panel-value {
    color: #fff;
}

.so-dash-panels-compact .so-dash-panel-row-rrr {
    margin: 4px -2px 0;
    padding: 5px 6px;
}

.so-dash-panel-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    line-height: 1.35;
}

.so-dash-panel-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--accent);
    white-space: nowrap;
}

.so-dash-panel-link {
    align-self: flex-end;
    margin-top: 2px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
}

.so-dash-panel-link:hover {
    text-decoration: underline;
}

.so-dash-panel-title {
    margin: 0 0 4px;
    font-size: 0.88rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.01em;
}

.so-dash-panel-table-wrap {
    gap: 8px;
}

.so-dash-panel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.so-dash-panel-table thead th {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    text-align: right;
    padding: 0 0 8px;
    border-bottom: 1px solid #e2e8f0;
}

.so-dash-panel-table thead th:first-child {
    text-align: left;
}

.so-dash-panel-table tbody td {
    padding: 8px 0;
    border-bottom: 1px dashed #e2e8f0;
    color: #475569;
    font-weight: 600;
}

.so-dash-panel-table tbody td:not(:first-child) {
    text-align: right;
    font-weight: 800;
    color: var(--accent);
    white-space: nowrap;
}

.so-dash-panel-table tbody tr:last-child td {
    border-bottom: none;
    padding-bottom: 0;
}

.so-dash-panel-table tbody tr.so-dash-panel-table-row-link {
    cursor: pointer;
    transition: background 0.15s ease;
}

.so-dash-panel-table tbody tr.so-dash-panel-table-row-link:hover td,
.so-dash-panel-table tbody tr.so-dash-panel-table-row-link:focus-visible td {
    background: rgba(243, 156, 18, 0.08);
}

.so-dash-sales-summary-table thead .so-dash-col-group {
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

.so-dash-sales-summary-table thead tr:last-child th {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-align: right;
}

.so-dash-sales-summary-table thead tr:last-child th:first-child {
    text-align: left;
}

.so-dash-summary-link-cell {
    cursor: pointer;
    text-align: right;
    font-weight: 800;
    color: var(--accent);
    transition: background-color 0.15s ease;
}

.so-dash-summary-link-shops {
    cursor: pointer;
    text-align: right;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
    transition: background-color 0.15s ease;
}

.so-dash-summary-link-cell:hover,
.so-dash-summary-link-cell:focus-visible,
.so-dash-summary-link-shops:hover,
.so-dash-summary-link-shops:focus-visible {
    background: rgba(243, 156, 18, 0.08);
}

.so-dash-summary-link-label {
    cursor: pointer;
    font-weight: 600;
    transition: color 0.15s ease;
}

.so-dash-summary-link-label:hover,
.so-dash-summary-link-label:focus-visible {
    color: #c2410c;
}

.display-target-images-page .display-target-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.display-target-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

.display-target-card-pending {
    border-color: #fbbf24;
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.35);
}

.display-target-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.display-target-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.display-target-photo-link {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.display-target-photo {
    display: block;
    width: 120px;
    height: 120px;
    object-fit: cover;
}

.display-target-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    margin: 0;
    font-size: 0.82rem;
}

.display-target-meta dt {
    font-weight: 700;
    color: #64748b;
}

.display-target-meta dd {
    margin: 0;
    color: #1e293b;
}

.display-target-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.display-target-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.display-target-check input {
    accent-color: var(--accent);
}

.display-target-check-display.is-active {
    background: rgba(34, 197, 94, 0.12);
    border-color: #22c55e;
    color: #15803d;
}

.display-target-check-non.is-active {
    background: rgba(249, 115, 22, 0.12);
    border-color: #f97316;
    color: #c2410c;
}

.display-target-check-close.is-active {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
    color: #b91c1c;
}

.display-target-reviewed-by {
    margin: 0;
}

.route-shop-action-cell {
    white-space: nowrap;
}

.route-visited-badge {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.so-dash-panel-value-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    line-height: 1.2;
}

.so-dash-panel-value-stack small {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
}

@media (max-width: 900px) {
    .so-dash-panels {
        grid-template-columns: 1fr;
    }
}

.dash-metrics-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.dash-metric-pill {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 20px;
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow);
}

.dash-metric-pill.dash-metric-secondary {
    border-left-color: #3b82f6;
}

.dash-metric-pill.dash-metric-stock {
    border-left-color: #22c55e;
}

.dash-metric-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dash-metric-pill strong {
    display: block;
    font-size: 1.25rem;
    margin: 4px 0;
}

.dash-metric-qty {
    font-size: 0.8rem;
    color: #94a3b8;
}

.dash-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.dash-chart-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border: 1px solid #e2e8f0;
}

.dash-chart-card.dash-chart-wide {
    grid-column: span 2;
}

.dash-chart-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 12px;
}

.dash-chart-wrap {
    position: relative;
    height: 200px;
}

.dash-chart-wrap.dash-chart-tall {
    height: 240px;
}

.dash-chart-wrap.dash-chart-doughnut {
    height: 220px;
    max-width: 280px;
    margin: 0 auto;
}

.dash-panels-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 16px;
}

.dash-panel .page-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dash-mini-table {
    font-size: 0.85rem;
}

.dash-complaint-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dash-complaint-item {
    padding: 12px 14px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #94a3b8;
}

.dash-complaint-item.is-open {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.dash-complaint-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.dash-quick-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.dash-quick-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
}

.dash-quick-link:hover {
    background: #fff7ed;
    border-color: var(--accent);
}

.dash-quick-link .nav-icon::before {
    font-size: 1.1rem;
}

@media (max-width: 1100px) {
    .dash-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dash-charts-grid {
        grid-template-columns: 1fr;
    }

    .dash-chart-card.dash-chart-wide {
        grid-column: span 1;
    }

    .dash-panels-grid {
        grid-template-columns: 1fr;
    }

    .dash-metrics-strip {
        grid-template-columns: 1fr;
    }

    .dash-quick-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.primary-sale-page {
    display: grid;
    gap: 20px;
}

.invoice-field-wrap {
    max-width: 420px;
    margin-bottom: 16px;
}

.line-items-container {
    display: grid;
    gap: 16px;
}

.purchase-line-item {
    padding: 16px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    background: #fafafa;
}

.line-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.line-item-title {
    margin: 0;
    font-size: 1rem;
    color: var(--accent, #c45c26);
}

.primary-sale-table .invoice-merged-cell {
    vertical-align: middle;
    text-align: center;
    font-weight: 600;
    background: rgba(196, 92, 38, 0.06);
    border-right: 2px solid #94a3b8;
}

/* Same invoice ki lines — normal thin */
.primary-sale-table tbody tr.invoice-item-row td {
    border-bottom: 1px solid #e2e8f0;
}

/* Alag invoice groups ke darmiyan — moti black line */
.primary-sale-table tbody tr.invoice-group-separator td {
    padding: 0;
    height: 0;
    line-height: 0;
    border: none;
    border-top: 4px solid #000;
    background: transparent;
}

.primary-sale-table tbody tr.invoice-item-row:hover {
    background: #fafbfc;
}

.primary-sale-table tbody tr.invoice-group-separator:hover {
    background: transparent;
}

.purchase-form-panel {
    display: none;
}

.purchase-form-panel.is-visible {
    display: block;
}

.customer-code-badge {
    display: inline-block;
    min-width: 4.75rem;
    padding: 4px 8px;
    font-family: ui-monospace, monospace;
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    color: var(--accent, #c45c26);
    background: rgba(196, 92, 38, 0.12);
    border-radius: 6px;
    white-space: nowrap;
    line-height: 1.2;
}

.data-table .col-code {
    width: 5.5rem;
    min-width: 5.5rem;
    max-width: 5.5rem;
    text-align: center;
    white-space: nowrap;
}

.data-table .col-sr {
    width: 3rem;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
}

.data-table .cell-sub {
    display: block;
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-muted, #6b7280);
    margin-top: 2px;
}

.data-table .cell-date {
    white-space: nowrap;
    font-size: 0.85rem;
}

.reorder-hint {
    margin: 0 0 12px;
}

.customer-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.allow-change-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.allow-change-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text, #1f2937);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 26px;
    transition: background 0.2s ease;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent, #c45c26);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid var(--accent, #c45c26);
    outline-offset: 2px;
}

.customer-admin-table tbody tr {
    cursor: default;
}

.customer-admin-table.reorder-enabled tbody tr {
    cursor: grab;
}

.customer-admin-table tbody tr.is-dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.customer-admin-table tbody tr.drag-over {
    outline: 2px dashed var(--accent, #c45c26);
    outline-offset: -2px;
}

.data-table .col-drag {
    width: 2rem;
    text-align: center;
    color: var(--text-muted, #9ca3af);
    user-select: none;
    cursor: default;
    opacity: 0.45;
}

.customer-admin-table.reorder-enabled .col-drag {
    color: var(--text-muted, #6b7280);
    cursor: grab;
    opacity: 1;
}

.data-table .col-actions {
    white-space: nowrap;
}

.data-table .col-actions .inline-delete-form {
    display: inline-block;
    margin-left: 6px;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
    border: none;
}

.btn-danger:hover {
    background: #bb2d3b;
}

.primary-sale-grid {
    align-items: end;
}

.manual-input {
    display: none;
    margin-top: 8px;
}

.manual-input.is-visible {
    display: block;
}

.product-search-wrap {
    position: relative;
}

.product-picker-group,
.product-picker-group .product-search-wrap {
    overflow: visible;
}

.customer-order-sheet-page .purchase-form-panel {
    overflow: visible;
}

.customer-order-balance-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.customer-order-balance-box--with-liters {
    align-items: flex-start;
}

.customer-order-liter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 16px;
    flex: 1 1 280px;
    min-width: 0;
}

.customer-order-liter-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.customer-order-liter-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f766e;
}

.customer-order-liter-hint {
    font-size: 0.72rem;
    color: #64748b;
    line-height: 1.2;
}

.ledger-sale-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.ledger-sale-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    padding: 14px 16px;
}

.ledger-sale-card-title {
    margin: 0 0 10px;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #0f172a;
    border-bottom: 2px solid #f59e0b;
    padding-bottom: 6px;
}

.ledger-sale-card-sub {
    margin: -4px 0 10px;
    font-size: 0.78rem;
    color: #64748b;
}

.ledger-sale-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ledger-sale-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.ledger-sale-stat-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
}

.ledger-sale-stat-value {
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
    text-align: right;
}

.ledger-sale-card--allover .ledger-sale-stat-value {
    color: #b45309;
}

.ledger-sale-card--month .ledger-sale-stat-value {
    color: #0369a1;
}

.ledger-sale-card--balance .ledger-sale-card-title {
    border-bottom-color: #16a34a;
}

.ledger-sale-card-body--balance {
    align-items: flex-start;
    gap: 4px;
}

.ledger-sale-balance-value {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    color: #b45309;
    line-height: 1.2;
}

@media (max-width: 1100px) {
    .ledger-sale-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .ledger-sale-cards {
        grid-template-columns: 1fr;
    }
}

.customer-ledger-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customer-ledger-kpi-grid .recovery-kpi-card--month-split {
    grid-column: 1 / -1;
}

.recovery-kpi-value-secondary {
    display: block;
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f766e;
    line-height: 1.2;
    margin-top: 2px;
}

.recovery-kpi-card-today .recovery-kpi-value-secondary {
    color: #0369a1;
}

.recovery-kpi-inner--month-split {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    gap: 0;
    width: 100%;
}

.recovery-kpi-card--month-split .recovery-kpi-inner {
    width: 100%;
}

.recovery-kpi-split-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 0 8px;
    text-align: center;
}

.recovery-kpi-split-col:first-child {
    padding-left: 0;
}

.recovery-kpi-split-col:last-child {
    padding-right: 0;
}

.recovery-kpi-split-divider {
    width: 1px;
    background: rgba(15, 23, 42, 0.12);
    margin: 2px 4px;
    align-self: stretch;
}

@media (max-width: 520px) {
    .customer-ledger-kpi-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .customer-order-liter-grid {
        grid-template-columns: 1fr;
        width: 100%;
    }
}

.customer-order-balance-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.customer-order-balance-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.customer-order-balance-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: #b45309;
}

.customer-order-balance-value.balance-clear {
    color: #15803d;
}

.customer-ledger-link {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-hover, #c45c26);
    text-decoration: none;
    white-space: nowrap;
}

.customer-ledger-link:hover {
    text-decoration: underline;
}

.customer-suggestion-item .suggestion-code {
    font-family: ui-monospace, monospace;
    font-weight: 700;
    color: #fbbf24;
    margin-right: 8px;
}

.product-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    background: #111827;
    color: #fff;
    border-radius: 10px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
    overflow: hidden;
    z-index: 80;
    max-height: min(60vh, 420px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.product-suggestion-item {
    width: 100%;
    border: 0;
    background: transparent;
    color: #fff;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    font-family: inherit;
}

.product-suggestion-item:hover,
.product-suggestion-item:focus {
    background: rgba(245, 158, 11, 0.18);
    outline: none;
}

.suggestion-title {
    font-weight: 700;
    font-size: 0.88rem;
}

.suggestion-meta {
    font-size: 0.75rem;
    color: #cbd5e1;
    white-space: nowrap;
}

#subtotal_amount,
#payable_amount {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
}

.primary-totals-card {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 12px;
    margin: 8px 0 20px;
}

.primary-totals-card > div {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
}

.primary-totals-card span {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.primary-totals-card strong {
    display: block;
    font-size: 1.1rem;
    color: #0f172a;
}

.primary-totals-card .payable-box {
    background: #fffbeb;
    border-color: #fde68a;
}

.primary-totals-card .payable-box strong {
    color: #b45309;
    font-size: 1.25rem;
}

@media print {
    body {
        background: #fff;
    }

    .sidebar,
    .topbar,
    .flash-container,
    .no-print,
    .sidebar-overlay {
        display: none !important;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .main-content {
        padding: 0;
    }

    .price-sheet {
        box-shadow: none;
        border: none;
        padding: 0;
    }
}

.page-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.page-card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 10px;
    border-radius: 20px;
}

.badge-soon {
    background: #fef3c7;
    color: #b45309;
}

.page-description {
    color: #64748b;
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.staff-dist-picker-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin: 8px 0 16px;
    max-width: 520px;
}

.staff-dist-picker-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    margin: 0;
}

.staff-dist-picker-select {
    flex: 1;
    min-width: 220px;
}

.assigned-distribution-box .staff-dist-picker-form {
    margin: 0;
    max-width: none;
}

.placeholder-box {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius);
    padding: 48px 32px;
    text-align: center;
    color: #64748b;
}

.placeholder-box p:first-child {
    font-size: 1.05rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 8px;
}

.hint {
    font-size: 0.875rem;
}

.page-card-wide {
    max-width: 100%;
    width: 100%;
}

/* Login */
.login-body {
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1e3a5f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-brand .brand-icon {
    margin: 0 auto 12px;
}

.login-brand h1 {
    font-size: 1.35rem;
    margin-bottom: 4px;
}

.login-brand p {
    color: #64748b;
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-hint {
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 16px;
}

.login-hint-small {
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 6px;
}

.login-flash {
    padding: 0;
    margin-bottom: 12px;
}

.login-roles {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.login-roles-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.role-list {
    list-style: none;
    font-size: 0.8rem;
    color: #475569;
}

.role-list li {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.role-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.role-company {
    background: #dbeafe;
    color: #1d4ed8;
}

.role-dist {
    background: #fef3c7;
    color: #b45309;
}

.role-staff {
    background: #dcfce7;
    color: #166534;
}

.form-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
    margin: 8px 0 4px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
}

.field-hint {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
}

.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
}

.table-wrap-wide {
    max-width: 100%;
}

/* Staff table */
.table-hint {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 12px;
}

.staff-table-wrap {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.staff-table tbody tr.staff-row {
    cursor: pointer;
    transition: background 0.12s;
}

.staff-table tbody tr.staff-row:hover {
    background: #fffbeb;
}

.staff-table tbody tr.staff-row:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.staff-name-cell {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
}

.staff-sub {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
}

.staff-profile-photo-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.staff-profile-photo-preview {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}

.staff-profile-photo-preview.is-visible,
.staff-profile-photo-preview:not([hidden]) {
    display: block;
}

.staff-profile-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.staff-profile-photo-actions {
    flex: 1;
    min-width: 200px;
}

.col-staff-photo {
    width: 56px;
}

.staff-table-photo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}

.staff-table-photo-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #e2e8f0;
    color: #475569;
    font-weight: 700;
    font-size: 0.95rem;
}

.staff-modal-photo-wrap {
    text-align: center;
    margin-bottom: 16px;
}

.staff-modal-photo {
    width: 120px;
    height: 120px;
    border-radius: 16px;
    object-fit: cover;
    border: 3px solid #e2e8f0;
}

.login-code {
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.th-actions,
.td-actions {
    width: 150px;
    text-align: center;
}

.td-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.btn-icon:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-delete:hover {
    background: #fef2f2;
    border-color: #fecaca;
}

.btn-edit:hover {
    background: #fff7ed;
    border-color: #fed7aa;
}

.btn-block:hover {
    background: #fef3c7;
    border-color: #fde68a;
}

.btn-unblock:hover {
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-blocked {
    background: #fee2e2;
    color: #991b1b;
}

.form-actions-split {
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.form-actions-primary,
.form-actions-account {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
    border: none;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-success {
    background: #16a34a;
    color: #fff;
    border: none;
}

.btn-success:hover {
    background: #15803d;
}

.assign-cell {
    min-width: 120px;
}

.dist-chip {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    margin: 2px 4px 2px 0;
    font-weight: 500;
}

.dist-chip small {
    font-weight: 400;
    opacity: 0.85;
}

.text-muted {
    color: #94a3b8;
    font-size: 0.85rem;
}

.text-muted.small {
    font-size: 0.75rem;
}

/* Professional select */
.select-wrap {
    position: relative;
}

.select-wrap::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-top-color: #64748b;
    pointer-events: none;
}

.select-pro {
    width: 100%;
    padding: 12px 40px 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
    color: var(--text-dark);
    appearance: none;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.select-pro:hover {
    border-color: #cbd5e1;
}

.select-pro:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* Modal */
body.modal-open {
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: none;
    align-items: flex-start;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: max(16px, env(safe-area-inset-top, 0px)) 20px max(16px, env(safe-area-inset-bottom, 0px));
}

.modal-overlay.is-open {
    display: flex !important;
}

.modal-overlay[hidden]:not(.is-open) {
    display: none !important;
}

.modal-panel {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: min(88dvh, calc(100vh - 2.5rem));
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    margin: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: modalIn 0.2s ease;
}

.modal-panel > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    overflow: hidden;
}

.modal-panel-wide {
    max-width: 820px;
}

.city-manage-body {
    overflow-y: auto;
}

.city-manage-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}

.city-add-form {
    flex: 1 1 320px;
    margin: 0;
}

.city-add-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.city-name-field {
    flex: 1 1 220px;
    margin: 0;
}

.city-add-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.city-list-header {
    margin-bottom: 12px;
}

.city-list-header h3 {
    font-size: 1rem;
    margin: 0;
}

.city-manage-table-wrap {
    max-height: 340px;
    overflow-y: auto;
}

.routes-cities-summary .summary-text {
    margin: 0;
    color: #475569;
}

.route-shops-summary {
    margin-bottom: 1rem;
    color: #475569;
}

.route-shops-summary p {
    margin: 0;
}

.form-hint-block {
    margin: 0.5rem 0 0;
}

.routes-page .btn-link {
    background: none;
    border: none;
    color: var(--primary, #d97706);
    cursor: pointer;
    font-weight: 600;
    padding: 0;
    text-decoration: underline;
}

.route-type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 1.25rem;
}

.route-type-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.route-type-tab:hover {
    border-color: #fdba74;
    color: #c2410c;
}

.route-type-tab.is-active {
    background: #fff7ed;
    border-color: #fdba74;
    color: #c2410c;
}

.route-type-panels .route-type-panel {
    display: none;
}

.route-type-panels .route-type-panel.is-active {
    display: block;
}

.route-type-section-header {
    margin-bottom: 1rem;
}

.route-type-section-title {
    margin: 0 0 0.35rem;
    font-size: 1.125rem;
    color: #0f172a;
}

.route-type-section + .route-type-section {
    margin-top: 2rem;
}

.routes-browse-page .routes-distributor-table th,
.routes-browse-page .routes-distributor-table td {
    border-bottom: 1px solid #e2e8f0;
}

.routes-browse-page .routes-distributor-table tbody tr.dist-purchase-row-clickable {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.routes-browse-page .routes-distributor-table tbody tr.dist-purchase-row-clickable:hover td {
    background: #fff7ed;
}

.routes-browse-page .routes-distributor-table .col-go {
    width: 52px;
    text-align: center;
    padding-left: 8px;
    padding-right: 16px;
}

.routes-browse-page .table-row-go {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.routes-browse-page .routes-distributor-table tbody tr.dist-purchase-row-clickable:hover .table-row-go {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent, #f59e0b);
    transform: translateX(2px);
}

.route-city-grid {
    max-height: 280px;
    overflow-y: auto;
}

.route-city-item.is-filtered-out {
    display: none;
}

.route-day-select-main {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9375rem;
    background: #fff;
}

.route-day-select-main option:disabled {
    color: #94a3b8;
}

/* Customer form — voice mic inside input (WhatsApp style) */
.voice-field-wrap {
    position: relative;
    display: block;
}

.voice-field-wrap .voice-field-input {
    width: 100%;
    box-sizing: border-box;
    padding-right: 42px;
}

.voice-field-wrap textarea.voice-field-input {
    min-height: 72px;
    padding-right: 42px;
    padding-bottom: 36px;
    resize: vertical;
}

.voice-mic-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #8696a0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

.voice-field-wrap.is-textarea .voice-mic-btn {
    top: auto;
    bottom: 8px;
    transform: none;
}

.voice-mic-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.voice-mic-btn:hover:not(:disabled) {
    color: #54656f;
    background: rgba(0, 0, 0, 0.06);
}

.voice-mic-btn.is-listening {
    color: #fff;
    background: #ef4444;
    animation: voice-mic-pulse 1.2s ease-in-out infinite;
}

@keyframes voice-mic-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
}

.voice-mic-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.voice-field-status.is-listening {
    color: #ea580c;
}

.voice-field-status.is-error {
    color: #dc2626;
}

.page-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.route-details-cell {
    max-width: 360px;
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.45;
}

.route-row-today td {
    background: #f0fdf4;
}

.route-today-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #15803d;
    background: #dcfce7;
}

.route-customer-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 4px 4px;
}

.route-filter-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.route-filter-chip:hover {
    border-color: var(--accent);
    background: #fff7ed;
}

.route-filter-chip.is-active {
    border-color: var(--accent);
    background: #fff7ed;
    color: #c2410c;
}

.route-filter-chip-meta {
    font-size: 0.72rem;
    font-weight: 500;
    color: #64748b;
}

.route-filter-chip.is-active .route-filter-chip-meta {
    color: #9a3412;
}

.van-route-details-box {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.van-route-details-label {
    margin: 0 0 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.van-route-details-text {
    margin: 0;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.5;
}

.route-day-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #c2410c;
    white-space: nowrap;
}

.city-search-input {
    width: 100%;
}

.city-search-empty {
    margin: 0 0 10px;
    padding: 10px 12px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 8px;
    color: #92400e;
    font-size: 0.875rem;
}

.selected-cities-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.selected-cities-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
}

.selected-cities-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.selected-city-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #c2410c;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
}

.modal-subtitle {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 4px;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
}

.modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: #fafbfc;
    flex-shrink: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
}

.detail-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid #f1f5f9;
}

.detail-item-full {
    grid-column: 1 / -1;
}

.detail-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 0.9rem;
    color: #334155;
    font-weight: 500;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    margin-bottom: 12px;
}

.assignment-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.assignment-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
}

.assignment-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.assignment-info strong {
    color: #1e40af;
    font-size: 0.95rem;
}

.assignment-info span {
    font-size: 0.8rem;
    color: #475569;
}

.assignment-addr {
    font-size: 0.75rem !important;
    color: #94a3b8 !important;
}

.empty-assign {
    color: #94a3b8;
    font-size: 0.875rem;
    padding: 12px;
    text-align: center;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #e2e8f0;
}

.assign-panel {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 16px;
}

.assign-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.assign-select-group {
    margin: 0;
}

.btn-assign {
    width: 100%;
    padding: 12px;
}

.btn-outline {
    background: transparent;
    border: 1px solid #94a3b8;
    color: #475569;
}

.btn-outline:hover {
    background: #f8fafc;
}

.hint-error {
    color: #b91c1c !important;
}

.deassign-form {
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

@media (max-height: 760px) {
    .modal-panel {
        max-height: calc(100dvh - 1rem);
    }

    .modal-header {
        padding: 16px 18px 12px;
    }

    .modal-header h2 {
        font-size: 1.15rem;
    }

    .modal-body {
        padding: 14px 18px;
    }

    .modal-footer {
        padding: 12px 18px;
    }
}

.login-switch {
    text-align: center;
    margin-top: 12px;
    font-size: 0.875rem;
}

.login-switch a {
    color: var(--accent-hover);
    font-weight: 600;
}

/* Forms */
.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.data-form {
    margin-top: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, transform 0.1s;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-dark);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: #e2e8f0;
    color: #334155;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-danger:hover {
    background: #fecaca;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-block {
    width: 100%;
}

/* Toolbar */
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-title {
    font-size: 1.15rem;
    font-weight: 700;
}

/* Distribution list search */
.dist-search-row {
    margin: 0 0 14px;
}

.dist-search {
    width: 100%;
    max-width: 520px;
    padding: 11px 14px 11px 40px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='8' cy='8' r='5'/%3E%3Cpath d='M12 12l4 4'/%3E%3C/svg%3E") no-repeat 12px center;
}

.dist-search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.dist-search-row small {
    display: block;
    color: #64748b;
    margin-top: 6px;
    font-size: 0.75rem;
}

.dist-search-empty {
    margin: 10px 0 0;
    padding: 12px 14px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    color: #9a3412;
    font-size: 0.875rem;
}

.dist-card[hidden] {
    display: none !important;
}

/* Cards grid - distributions */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.dist-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.dist-card-clickable {
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.dist-card-clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
    border-color: #f59e0b;
}

.dist-card-clickable:focus {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.dist-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-sidebar));
    color: var(--text-light);
}

.dist-card-header h3 {
    font-size: 1.1rem;
}

.dist-badge {
    font-size: 0.7rem;
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.dist-card-body {
    padding: 16px 20px;
}

.dist-card-body p {
    font-size: 0.875rem;
    margin-bottom: 8px;
    color: #475569;
}

.dist-date {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    color: #94a3b8 !important;
}

.distribution-modal-panel {
    max-width: 640px;
}

.distribution-profile {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #fff;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.distribution-profile::after {
    content: "";
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.16);
    right: -40px;
    top: -45px;
}

.distribution-profile h3 {
    font-size: 1.35rem;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.distribution-profile p {
    color: #cbd5e1;
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.distribution-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.distribution-status.status-blocked {
    background: rgba(239, 68, 68, 0.22);
    color: #fecaca;
}

.dist-badge-active {
    background: #22c55e;
    color: #fff;
}

.dist-badge-blocked {
    background: #ef4444;
    color: #fff;
}

.distribution-modal-footer {
    flex-wrap: wrap;
    gap: 12px;
}

.modal-footer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.password-field-wrap,
.password-reveal-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.password-field-wrap .password-input {
    flex: 1;
}

.password-toggle-btn {
    width: 38px;
    height: 38px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
}

.password-toggle-btn:hover {
    background: #f8fafc;
}

.password-toggle-inline {
    width: 34px;
    height: 34px;
}

.detail-password-item .password-reveal-value {
    font-family: ui-monospace, monospace;
    letter-spacing: 0.05em;
}

.form-card {
    margin-bottom: 28px;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-hover);
}

.stat-label {
    font-size: 0.875rem;
    color: #64748b;
}

.stat-sublabel {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
}

.stat-card-highlight {
    border: 2px solid rgba(245, 158, 11, 0.35);
    background: linear-gradient(180deg, #fffbeb 0%, #fff 100%);
}

.stat-card-highlight .stat-value {
    color: #b45309;
}

.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Table */
.table-wrap {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table tbody tr:hover {
    background: #fafbfc;
}

.detail-row td {
    background: #f8fafc;
    font-size: 0.8rem;
    color: #64748b;
}

.detail-row span {
    margin-right: 20px;
}

.inline-form {
    display: inline;
}

/* Flash messages */
.flash-container {
    padding: 12px 28px 0;
}

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: opacity 0.35s ease, transform 0.35s ease, margin 0.35s ease,
        padding 0.35s ease, max-height 0.35s ease;
    max-height: 120px;
    overflow: hidden;
}

.flash.is-dismissing {
    opacity: 0;
    transform: translateY(-6px);
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    max-height: 0;
}

.flash-success {
    background: #dcfce7;
    color: #166534;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

.flash-info {
    background: #e0f2fe;
    color: #075985;
}

/* Sidebar extras */
.sidebar-user {
    display: block;
    margin-bottom: 6px;
    color: var(--text-light);
    font-weight: 500;
}

.logout-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
}

.logout-link:hover {
    text-decoration: underline;
}

.topbar-user {
    margin-left: auto;
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-user-name {
    font-weight: 600;
    color: #334155;
}

.role-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 4px;
    background: #fef3c7;
    color: #b45309;
}

.nav-icon[data-icon="staff"]::before { content: "👔"; }

/* Icons via data-icon */
.nav-icon[data-icon="home"]::before { content: "⌂"; }
.nav-icon[data-icon="truck"]::before { content: "🚚"; }
.nav-icon[data-icon="box"]::before { content: "📦"; }
.nav-icon[data-icon="cart"]::before { content: "🛒"; }
.nav-icon[data-icon="store"]::before { content: "🏪"; }
.nav-icon[data-icon="wallet"]::before { content: "💰"; }
.nav-icon[data-icon="users"]::before { content: "👥"; }
.nav-icon[data-icon="clipboard"]::before { content: "📋"; }
.nav-icon[data-icon="layers"]::before { content: "📊"; }
.nav-icon[data-icon="message"]::before { content: "💬"; }
.nav-icon[data-icon="gift"]::before { content: "🎁"; }
.nav-icon[data-icon="chart"]::before { content: "📈"; }
.nav-icon[data-icon="hierarchy"]::before { content: "🌳"; }
.nav-icon[data-icon="route"]::before { content: "🗺️"; }
.nav-icon[data-icon="receipt"]::before { content: "🧾"; }

.nav-icon::before {
    font-size: 1rem;
    line-height: 1;
    display: block;
}

/* Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 150;
}

/* Mobile layout — see responsive.css (992px breakpoint) */
body.sidebar-open {
    overflow: hidden;
}

/* Recovery browse (distributor / admin) */
.recovery-search-header {
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.recovery-search-wrap {
    flex: 1;
    min-width: 220px;
    max-width: 420px;
}

.recovery-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 8px);
    font-size: 0.95rem;
    font-family: inherit;
}

.recovery-search-input:focus {
    outline: none;
    border-color: var(--accent, #f59e0b);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.recovery-row-clickable {
    cursor: pointer;
}

.recovery-row-clickable:hover td {
    background: rgba(245, 158, 11, 0.06);
}

.customer-row-clickable {
    cursor: pointer;
}

.delivery-boy-row-clickable {
    cursor: pointer;
}

.delivery-boy-row-clickable:hover td {
    background: rgba(243, 156, 18, 0.06);
}

.customer-row-clickable:hover td {
    background: rgba(245, 158, 11, 0.06);
}

.customer-action-modal-body {
    padding: 8px 0 4px;
}

.customer-action-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 14px;
}

.customer-action-btn {
    min-width: 140px;
    text-align: center;
}

.customer-action-btn-stacked {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    line-height: 1.2;
    padding-top: 10px;
    padding-bottom: 10px;
}

.customer-action-btn-label {
    display: block;
}

.customer-action-btn-meta {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    opacity: 0.92;
    letter-spacing: 0.01em;
}

.btn-ledger {
    background: #0ea5e9;
    color: #fff;
}

.btn-ledger:hover {
    background: #0284c7;
    color: #fff;
}

.customer-action-btn.is-disabled,
.customer-action-btn.is-disabled:hover,
.customer-action-btn.is-disabled:focus-visible {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    filter: grayscale(0.35);
}

.customer-action-sep {
    color: var(--text-muted, #94a3b8);
    font-size: 0.85rem;
    user-select: none;
}

.staff-targets-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.staff-target-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.staff-target-chip-month {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.staff-target-chip-liters {
    color: #0f766e;
    font-size: 0.95rem;
}

.staff-target-modal-panel {
    max-width: 480px;
}

@media (max-width: 640px) {
    .customer-action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .customer-action-sep {
        display: none;
    }

    .customer-action-btn {
        width: 100%;
    }
}

.recovery-no-results {
    margin-top: 12px;
    color: var(--text-muted, #64748b);
}

/* Recovery page — KPI cards */
.recovery-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.recovery-kpi-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.recovery-kpi-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1100px) {
    .recovery-kpi-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .recovery-kpi-grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .recovery-kpi-grid-4 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .recovery-kpi-grid {
        grid-template-columns: 1fr;
    }
}

.recovery-kpi-card {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.recovery-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
}

.recovery-kpi-card-total {
    background: linear-gradient(135deg, #fffbeb 0%, #fff 55%);
    border-color: rgba(245, 158, 11, 0.25);
}

.recovery-kpi-card-today {
    background: linear-gradient(135deg, #ecfdf5 0%, #fff 55%);
    border-color: rgba(34, 197, 94, 0.2);
}

.recovery-kpi-card-bills {
    background: linear-gradient(135deg, #eff6ff 0%, #fff 55%);
    border-color: rgba(59, 130, 246, 0.2);
}

.recovery-kpi-card-balance {
    background: linear-gradient(135deg, #ecfdf5 0%, #fff 55%);
    border-color: rgba(16, 185, 129, 0.25);
}

.recovery-kpi-card-allover {
    background: linear-gradient(135deg, #fffbeb 0%, #fff 55%);
    border-color: rgba(245, 158, 11, 0.25);
}

.recovery-kpi-card-month {
    background: linear-gradient(135deg, #eff6ff 0%, #fff 55%);
    border-color: rgba(59, 130, 246, 0.22);
}

.recovery-kpi-card-month-prev {
    background: linear-gradient(135deg, #f5f3ff 0%, #fff 55%);
    border-color: rgba(139, 92, 246, 0.22);
}

.recovery-kpi-card-balance .recovery-kpi-value {
    color: #059669;
}

.recovery-kpi-card-allover .ledger-kpi-stat-value {
    color: #b45309;
}

.recovery-kpi-card-month .ledger-kpi-stat-value {
    color: #0369a1;
}

.recovery-kpi-card-month-prev .ledger-kpi-stat-value {
    color: #7c3aed;
}

.recovery-kpi-icon-svg svg {
    width: 24px;
    height: 24px;
}

.recovery-kpi-card-balance .recovery-kpi-icon {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.recovery-kpi-card-allover .recovery-kpi-icon {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.recovery-kpi-card-month .recovery-kpi-icon {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.recovery-kpi-card-month-prev .recovery-kpi-icon {
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
}

.recovery-kpi-label-top {
    display: block;
    margin-bottom: 4px;
}

.recovery-kpi-sub-month {
    margin-top: -2px;
    margin-bottom: 8px;
}

.ledger-kpi-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.ledger-kpi-stat-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.ledger-kpi-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ledger-kpi-stat-value {
    font-size: 0.88rem;
    font-weight: 800;
    color: #0f172a;
    text-align: right;
    white-space: nowrap;
}

.customer-ledger-kpi-grid .recovery-kpi-inner {
    align-items: flex-start;
    padding: 16px 18px;
}

.customer-ledger-kpi-grid .recovery-kpi-value {
    font-size: 1.45rem;
}

.recovery-kpi-inner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 22px;
}

.recovery-kpi-icon {
    font-size: 1.75rem;
    line-height: 1;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.recovery-kpi-card-total .recovery-kpi-icon {
    background: rgba(245, 158, 11, 0.12);
}

.recovery-kpi-card-today .recovery-kpi-icon {
    background: rgba(34, 197, 94, 0.12);
}

.recovery-kpi-card-bills .recovery-kpi-icon {
    background: rgba(59, 130, 246, 0.12);
}

.recovery-kpi-value {
    display: block;
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.15;
    color: #0f172a;
}

.recovery-kpi-card-total .recovery-kpi-value {
    color: #b45309;
}

.recovery-kpi-card-today .recovery-kpi-value {
    color: #15803d;
}

.recovery-kpi-card-bills .recovery-kpi-value {
    color: #1d4ed8;
}

.recovery-kpi-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-top: 6px;
}

.recovery-kpi-sub {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 4px;
}

.ledger-balance-due strong {
    color: #b45309;
}

.page-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.ledger-type-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ledger-type-invoice {
    background: #dbeafe;
    color: #1d4ed8;
}

.ledger-type-recovery {
    background: #dcfce7;
    color: #15803d;
}

.ledger-row-invoice td {
    background: rgba(59, 130, 246, 0.04);
}

.ledger-row-recovery td {
    background: rgba(34, 197, 94, 0.04);
}

.customer-code-badge {
    font-weight: 700;
    font-size: 0.85rem;
    color: #475569;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Staff order form + distributor invoice order list */
.order-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.staff-search-row {
    margin: 0 0 12px;
}

.staff-row[hidden] {
    display: none;
}

.hierarchy-tree-wrap {
    margin-top: 8px;
    max-height: 420px;
    overflow: auto;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.hierarchy-summary-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 4px;
}

.hier-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
}

.hier-badge.hier-nsm { background: #e2e8f0; color: #334155; }
.hier-badge.hier-rm { background: #dbeafe; color: #1d4ed8; }
.hier-badge.hier-bdm { background: #ffedd5; color: #c2410c; }
.hier-badge.hier-so { background: #dcfce7; color: #15803d; }
.hier-badge.hier-dist { background: #f3e8ff; color: #7e22ce; }

.hierarchy-hint {
    margin: 0 0 4px;
}

.hierarchy-tree,
.hierarchy-children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hierarchy-children {
    margin: 6px 0 6px 20px;
    padding-left: 12px;
    border-left: 2px solid #cbd5e1;
}

.hierarchy-node {
    margin: 0 0 8px;
}

.hierarchy-node-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.hierarchy-node-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.hierarchy-role-tag {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.hierarchy-role-bdm .hierarchy-node-body { border-left: 3px solid #f59e0b; }
.hierarchy-role-rm .hierarchy-node-body { border-left: 3px solid #3b82f6; }
.hierarchy-role-sale_officer .hierarchy-node-body { border-left: 3px solid #22c55e; }
.hierarchy-role-nsm .hierarchy-node-body { border-left: 3px solid #8b5cf6; }

.hierarchy-dist .hierarchy-node-body {
    border-left: 3px solid #a855f7;
    background: #faf5ff;
}

.hierarchy-node-sub {
    font-size: 0.78rem;
    color: #64748b;
}

.hierarchy-node-icon {
    font-size: 1rem;
    line-height: 1;
    margin-top: 10px;
}

.hierarchy-empty-branch {
    margin: 4px 0 4px 34px;
    font-size: 0.78rem;
    color: #94a3b8;
    font-style: italic;
}

.root-hierarchy > .hierarchy-node > .hierarchy-node-body {
    background: #fffbeb;
    border-color: #fcd34d;
}

.hierarchy-mini-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.staff-dash-summary {
    margin: 12px 0;
}

.staff-dash-hierarchy {
    margin-top: 16px;
}

.manager-dash-note p {
    margin-bottom: 8px;
}

.hierarchy-flat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hierarchy-flat-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    border-left: 3px solid #94a3b8;
}

.hierarchy-flat-item.depth-0 {
    background: #fffbeb;
    border-left-color: #f59e0b;
    margin-left: 0;
}

.hierarchy-flat-item.depth-1 { margin-left: 16px; border-left-color: #3b82f6; }
.hierarchy-flat-item.depth-2 { margin-left: 32px; border-left-color: #f59e0b; }
.hierarchy-flat-item.depth-3 { margin-left: 48px; border-left-color: #22c55e; }
.hierarchy-flat-item.depth-4 { margin-left: 64px; border-left-color: #a855f7; }
.hierarchy-flat-item.is-dist {
    background: #faf5ff;
    border-left-color: #a855f7;
}

.hierarchy-flat-icon {
    font-size: 1rem;
    line-height: 1.4;
}

.hierarchy-flat-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hierarchy-flat-body strong {
    font-size: 0.92rem;
}

.hierarchy-flat-body small {
    font-size: 0.78rem;
    color: #64748b;
}

.mini-pill {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    background: #e2e8f0;
    color: #475569;
    white-space: nowrap;
}

.username-check-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    line-height: 1.35;
    min-height: 1.1em;
}

.username-check-available {
    color: #15803d;
    font-weight: 500;
}

.username-check-taken {
    color: #b91c1c;
    font-weight: 600;
}

.username-check-checking {
    color: #64748b;
}

.input-username-taken {
    border-color: #f87171 !important;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2) !important;
}

.input-username-ok {
    border-color: #4ade80 !important;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15) !important;
}

.assign-field-lead {
    margin: 0 0 10px;
}

.assign-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.assign-checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.assign-checkbox-item:hover {
    border-color: #f59e0b;
}

.assign-checkbox-item:has(input:checked) {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.12);
}

.assign-checkbox-item input {
    margin-top: 3px;
    flex-shrink: 0;
}

.assign-checkbox-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.85rem;
    line-height: 1.35;
}

.assign-checkbox-text strong {
    color: #0f172a;
}

.assign-checkbox-meta {
    color: #64748b;
    font-size: 0.75rem;
}

.assign-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    border-radius: 10px;
    vertical-align: middle;
}

.officer-cards-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 8px;
}

.officer-card-block {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 18px;
    background: #f8fafc;
}

.officer-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 12px;
}

.officer-card-head h3 {
    font-size: 1.05rem;
    margin: 0;
}

.officer-card-role {
    font-size: 0.8rem;
    color: #64748b;
}

.assigned-distribution-box {
    margin-bottom: 8px;
}

.assigned-distribution-box .readonly-field {
    font-weight: 600;
}

.order-invoice-cards {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 8px;
}

.order-invoice-card {
    border: 1px solid #e2e8f0;
    border-radius: var(--radius, 8px);
    background: #fff;
    overflow: hidden;
    box-shadow: var(--shadow, 0 1px 3px rgba(15, 23, 42, 0.08));
}

.order-invoice-card-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.order-invoice-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.order-invoice-card-body {
    padding: 8px;
    overflow-x: auto;
    background: #fafafa;
}

.order-invoice-card-body .invoice-oil-store {
    margin: 0;
}

/* Sale officer — customer live camera capture */
.customer-capture-section {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.customer-camera-panel {
    display: grid;
    gap: 12px;
    margin-top: 8px;
}

.customer-camera-preview-wrap {
    position: relative;
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    min-height: 220px;
}

.customer-camera-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 220px;
    padding: 24px 16px;
    text-align: center;
    color: #94a3b8;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    font-size: 0.95rem;
}

.customer-camera-placeholder-icon {
    font-size: 2rem;
    line-height: 1;
    opacity: 0.85;
}

.customer-camera-preview-wrap.is-live .customer-camera-placeholder {
    display: none;
}

.customer-camera-video {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    background: #0f172a;
}

.customer-camera-preview-wrap:not(.is-live) .customer-camera-video {
    display: none;
}

.customer-camera-status {
    margin: 0;
    padding: 10px 12px;
    font-size: 0.875rem;
    color: #64748b;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.customer-camera-status.is-error {
    color: #b91c1c;
    background: #fef2f2;
}

.customer-camera-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.customer-photo-gallery {
    margin-top: 14px;
}

.customer-photo-gallery-title {
    margin: 0 0 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
}

.customer-photo-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.customer-photo-thumb {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    background: #f1f5f9;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.customer-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.customer-photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.field-error {
    margin: 8px 0 0;
    color: #b91c1c;
    font-size: 0.875rem;
}

@media (min-width: 640px) {
    .customer-camera-panel {
        grid-template-columns: 1fr auto;
        align-items: start;
    }

    .customer-camera-actions {
        flex-direction: column;
        min-width: 140px;
    }
}

/* Admin — customer capture view modal */
.customer-capture-modal-panel {
    max-width: 720px;
}

.customer-capture-modal-body {
    overflow-y: auto;
}

.customer-capture-view-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.customer-capture-view-photo {
    display: block;
    width: 140px;
    height: 140px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.customer-capture-view-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.customer-capture-address-box {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.customer-capture-address-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 6px;
}

.customer-capture-address-text {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.45;
    color: #0f172a;
}

.customer-capture-address-text.is-error {
    color: #b45309;
    font-weight: 500;
}

.customer-capture-coords {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: #334155;
}

.customer-capture-map-wrap {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    margin-bottom: 12px;
    background: #1e293b;
}

.customer-capture-map-badge {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 500;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 4px 10px;
    border-radius: 999px;
    pointer-events: none;
}

.customer-capture-map {
    display: block;
    width: 100%;
    height: 320px;
    z-index: 1;
}

.customer-map-pin-host {
    background: transparent;
    border: none;
}

.customer-map-pin {
    display: block;
    width: 28px;
    height: 28px;
    margin: 0 auto;
    background: #dc2626;
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.55);
    position: relative;
}

.customer-map-pin::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

.capture-empty-msg[hidden],
.capture-empty-msg.is-hidden {
    display: none !important;
}

.leaflet-container {
    font-family: inherit;
}

.customer-data-page .col-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.customer-data-page .col-actions .inline-delete-form {
    display: inline-flex;
    margin: 0;
}

.customer-data-page .btn-icon.btn-view {
    color: #16a34a;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.customer-data-page .btn-icon.btn-view:hover {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}

.customer-data-page .btn-icon.btn-edit {
    color: #2563eb;
    border-color: #bfdbfe;
    background: #eff6ff;
}

.customer-data-page .btn-icon.btn-edit:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.customer-data-page .btn-icon.btn-delete {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
}

.customer-data-page .btn-icon.btn-delete:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.customer-admin-filters {
    padding: 0 20px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.customer-search-wrap {
    padding: 0 20px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.customer-search-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.customer-search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.customer-search-icon {
    position: absolute;
    left: 14px;
    font-size: 0.95rem;
    color: #94a3b8;
    pointer-events: none;
}

.customer-search-input {
    width: 100%;
    padding: 12px 42px 12px 40px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.95rem;
    color: #0f172a;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.customer-search-input:focus {
    outline: none;
    border-color: #fdba74;
    box-shadow: 0 0 0 3px rgba(253, 186, 116, 0.25);
}

.customer-search-input::-webkit-search-cancel-button {
    display: none;
}

.customer-search-voice-btn {
    position: absolute;
    right: 42px;
    border: none;
    background: transparent;
    color: #8696a0;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

.customer-search-voice-btn .voice-mic-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.customer-search-voice-btn:hover {
    color: #54656f;
    background: rgba(0, 0, 0, 0.06);
}

.customer-search-voice-btn.is-listening {
    color: #fff;
    background: #ef4444;
    animation: voice-mic-pulse 1.2s ease-in-out infinite;
}

.customer-search-input {
    padding-right: 78px !important;
}

.customer-search-clear {
    position: absolute;
    right: 10px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.customer-search-clear:hover {
    background: #e2e8f0;
    color: #334155;
}

.customer-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.customer-filter-tab {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.customer-filter-tab:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.customer-filter-tab.is-active {
    background: #fff7ed;
    border-color: #fdba74;
    color: #c2410c;
}

.customer-filter-picker-title {
    margin: 0 0 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
}

.customer-filter-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 8px;
}

.customer-filter-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.customer-filter-card:hover {
    border-color: #fdba74;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.customer-filter-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

.customer-filter-card-sub {
    font-size: 0.8rem;
    color: #64748b;
}

.customer-filter-card-meta {
    font-size: 0.8rem;
    color: #ea580c;
    font-weight: 600;
}

.customer-filter-active {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.customer-filter-active-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
}

.customer-filter-empty {
    padding: 0 20px 16px;
}

.customer-capture-detail-grid {
    margin-bottom: 4px;
}

/* Target management */
.target-role-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.target-role-tab {
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.target-role-tab:hover {
    border-color: #f59e0b;
    color: #b45309;
}

.target-role-tab.is-active {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #b45309;
}

.target-month-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.target-month-filter label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
}

.target-mgmt-table .target-pct {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fef2f2;
    color: #dc2626;
    font-size: 0.75rem;
    font-weight: 700;
}

.target-mgmt-table .col-actions {
    white-space: nowrap;
}

.target-dead-count {
    color: #dc2626;
    font-weight: 700;
}

.active-shop-criteria-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fafafa;
}

.active-shop-criteria-row .form-group {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .active-shop-criteria-row {
        grid-template-columns: 1fr;
    }
}

.recovery-target-chip {
    display: inline-block;
    margin: 2px 6px 2px 0;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
}

.recovery-targets-block {
    margin-top: 4px;
}

.recovery-targets-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recovery-target-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fafafa;
}

.recovery-target-row .form-group {
    margin-bottom: 0;
}

.recovery-pct-group .input-with-suffix {
    display: flex;
    align-items: center;
    gap: 6px;
}

.recovery-pct-group .input-with-suffix input {
    flex: 1;
}

.recovery-pct-group .input-suffix {
    font-size: 0.9rem;
    font-weight: 700;
    color: #64748b;
}

.btn-recovery-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-top: 10px;
    border: 1px dashed #f59e0b;
    border-radius: 8px;
    background: #fffbeb;
    color: #d97706;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-recovery-add:hover {
    background: #fef3c7;
    border-color: #d97706;
}

.recovery-row-remove {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #fee2e2;
    color: #dc2626;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    align-self: end;
    margin-bottom: 2px;
}

.recovery-row-remove:hover {
    background: #fecaca;
}

@media (max-width: 640px) {
    .recovery-target-row {
        grid-template-columns: 1fr;
    }

    .recovery-row-remove {
        justify-self: start;
    }
}

.fake-visit-row-unresolved {
    background: rgba(220, 53, 69, 0.1);
}

.fake-visit-row-unresolved:hover {
    background: rgba(220, 53, 69, 0.16);
}

.fake-visit-row-resolved {
    background: rgba(25, 135, 84, 0.12);
}

.fake-visit-row-resolved:hover {
    background: rgba(25, 135, 84, 0.18);
}

.fake-visits-table .fake-visit-comments-cell {
    min-width: 200px;
    max-width: 280px;
}

.fake-visit-resolve-form textarea {
    width: 100%;
    min-height: 3.2rem;
    resize: vertical;
    font: inherit;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border-color, #d8dee9);
    border-radius: 6px;
}

.fake-visit-resolved-comment {
    display: block;
    font-weight: 500;
}

.fake-visit-resolved-label {
    color: #198754;
    font-weight: 600;
    font-size: 0.85rem;
}

.fake-visit-action-cell {
    white-space: nowrap;
}
