:root {
    --ui-bg: #f6f3ee;
    --ui-surface: #ffffff;
    --ui-surface-soft: #fbfaf7;
    --ui-ink: #182019;
    --ui-muted: #687166;
    --ui-line: #e6e0d6;
    --ui-green-900: #143d2a;
    --ui-green-800: #1f5a3d;
    --ui-green-700: #28724d;
    --ui-green-600: #34865b;
    --ui-gold: #c8892d;
    --ui-red: #c24132;
    --ui-blue: #2f6f8f;
    --ui-radius: 8px;
    --ui-shadow: 0 12px 28px rgba(31, 42, 32, 0.08);
    --ui-shadow-strong: 0 20px 50px rgba(31, 42, 32, 0.14);
}

html {
    scroll-behavior: smooth;
}

body {
    color: var(--ui-ink);
    background:
        linear-gradient(180deg, rgba(246, 243, 238, 0.96), rgba(249, 248, 244, 0.98)),
        repeating-linear-gradient(90deg, rgba(20, 61, 42, 0.03) 0, rgba(20, 61, 42, 0.03) 1px, transparent 1px, transparent 72px);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    letter-spacing: 0;
}

a {
    color: var(--ui-green-700);
}

a:hover {
    color: var(--ui-green-900);
}

.app-sidebar {
    width: 292px;
    padding: 18px 14px;
    color: rgba(255, 255, 255, 0.88);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 180px),
        linear-gradient(180deg, #123825 0%, #1f5a3d 52%, #163f2b 100%);
    box-shadow: 12px 0 34px rgba(20, 61, 42, 0.18);
}

.app-main {
    margin-left: 292px;
}

.brand-block {
    min-height: 72px;
    padding: 12px 12px 18px;
    border-bottom-color: rgba(255, 255, 255, 0.14);
}

.brand-icon {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--ui-gold), #e1ad58);
    border-radius: var(--ui-radius);
    box-shadow: none;
}

.brand-title {
    font-size: 16px;
    font-weight: 850;
    letter-spacing: 0;
}

.brand-subtitle {
    color: rgba(255, 255, 255, 0.66);
}

.sidebar-section {
    margin: 22px 12px 8px;
    color: rgba(255, 255, 255, 0.54);
    letter-spacing: 0.06em;
}

.sidebar-nav {
    gap: 4px;
}

.sidebar-group {
    margin-top: 8px;
}

.sidebar-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    color: rgba(255, 255, 255, 0.78);
    background: transparent;
    border: 0;
    border-radius: var(--ui-radius);
    text-align: left;
    cursor: pointer;
}

.sidebar-group-toggle span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.sidebar-group-toggle span i {
    width: 22px;
    text-align: center;
}

.sidebar-group-toggle:hover,
.sidebar-group.open .sidebar-group-toggle {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);
}

.sidebar-group-chevron {
    font-size: 11px;
    transition: transform 160ms ease;
}

.sidebar-group.open .sidebar-group-chevron {
    transform: rotate(180deg);
}

.sidebar-group .sidebar-nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 180ms ease;
}

.sidebar-group.open .sidebar-nav {
    max-height: 520px;
    margin-top: 4px;
}

.sidebar-group .sidebar-link {
    margin-left: 8px;
}

.sidebar-link {
    min-height: 42px;
    padding: 9px 11px;
    border-radius: var(--ui-radius);
    color: rgba(255, 255, 255, 0.78);
}

.sidebar-link:hover,
.sidebar-link.active {
    transform: none;
}

.sidebar-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);
}

.sidebar-link.active {
    color: #143d2a;
    background: #ffffff;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
}

.sidebar-link-icon {
    width: 28px;
}

.sidebar-link-text {
    font-weight: 700;
}

.sidebar-footer {
    margin: 24px 4px 0;
    padding: 12px;
    border-radius: var(--ui-radius);
    background: rgba(255, 255, 255, 0.09);
}

.sidebar-user-avatar,
.user-chip-avatar {
    color: #ffffff;
    background: var(--ui-gold);
}

.topbar {
    min-height: 68px;
    padding: 12px 28px;
    background: rgba(251, 250, 247, 0.9);
    border-bottom: 1px solid rgba(230, 224, 214, 0.9);
    backdrop-filter: blur(16px);
}

.topbar-left,
.topbar-actions {
    gap: 10px;
}

.topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-kicker,
.page-eyebrow {
    color: var(--ui-green-700);
    letter-spacing: 0.06em;
}

.topbar-copy strong {
    color: var(--ui-ink);
}

.btn-icon {
    width: 40px;
    height: 40px;
    color: var(--ui-green-800);
    background: #eaf1e8;
    border-radius: var(--ui-radius);
}

.btn-icon:focus {
    box-shadow: 0 0 0 4px rgba(52, 134, 91, 0.16);
}

.user-chip {
    background: #f2eee6;
    border-color: var(--ui-line);
    border-radius: 999px;
}

.user-chip-copy span {
    color: var(--ui-ink);
}

.user-chip-copy small,
.text-muted {
    color: var(--ui-muted) !important;
}

.app-container {
    max-width: 1580px;
    padding: 26px 30px 54px;
}

.page-hero {
    align-items: center;
    margin-bottom: 20px;
    padding: 22px 24px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(251, 250, 247, 0.94)),
        linear-gradient(90deg, rgba(52, 134, 91, 0.16), rgba(200, 137, 45, 0.12));
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
}

.page-hero h1 {
    color: var(--ui-ink);
    font-size: clamp(24px, 2.3vw, 34px);
    font-weight: 900;
    letter-spacing: 0;
}

.page-hero p {
    max-width: 860px;
    color: var(--ui-muted);
}

.page-hero-main {
    flex: 1 1 auto;
    min-width: 0;
}

.page-hero-meta {
    flex: 0 0 auto;
    margin-left: auto;
    min-width: 180px;
    color: #8a5a00;
    background: #fff6df;
    border: 2px solid #f0ad2c;
    border-radius: 10px;
    padding: 11px 18px;
    text-align: center;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.page-hero-meta span {
    display: block;
    color: #8a5a00;
    font-size: 12px;
    font-weight: 800;
}

.page-hero-meta strong {
    display: block;
    color: #8a5a00;
    font-size: 26px;
    font-weight: 950;
    line-height: 1.1;
    margin-top: 2px;
}

.card,
.document-box,
.metric-card,
.action-card,
.info-tile,
.old-bill-panel,
.btb-summary-shell,
.payment-summary {
    border-color: var(--ui-line);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
}

.card,
.document-box,
.metric-card,
.action-card {
    background: var(--ui-surface);
}

.card-header {
    padding: 15px 18px;
    color: var(--ui-ink);
    background: var(--ui-surface-soft);
    border-bottom-color: var(--ui-line);
}

.card-header strong {
    font-weight: 850;
}

.card-body {
    padding: 18px;
}

.card-header.d-flex {
    gap: 10px;
}

.card-header .btn,
.document-actions .btn {
    white-space: nowrap;
}

.metric-card {
    min-height: 140px;
    padding: 18px;
    overflow: hidden;
}

.metric-card:after {
    right: -34px;
    bottom: -44px;
    background: rgba(52, 134, 91, 0.11);
}

.metric-card .metric-icon,
.action-card-icon,
.empty-state-icon {
    color: #ffffff;
    background: var(--ui-green-700);
    border-radius: var(--ui-radius);
    box-shadow: none;
}

.metric-label,
.metric-helper {
    color: var(--ui-muted);
}

.metric-label {
    font-weight: 800;
}

.metric-value {
    color: var(--ui-ink);
    font-weight: 900;
    letter-spacing: 0;
}

.metric-copy span,
.metric-copy small {
    color: var(--ui-muted);
}

.metric-copy strong {
    color: var(--ui-ink);
}

.metric-card.metric-primary .metric-copy span,
.metric-card.metric-primary .metric-copy small {
    color: rgba(255, 255, 255, 0.82);
}

.metric-card.metric-primary .metric-copy strong {
    color: #ffffff;
}

.metric-card.metric-primary {
    background: linear-gradient(135deg, var(--ui-green-900), var(--ui-green-600));
}

.metric-card.metric-primary .metric-icon {
    color: var(--ui-green-900);
    background: #ffffff;
}

.action-card {
    min-height: 86px;
    padding: 16px;
    color: var(--ui-ink);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.action-card:hover {
    color: var(--ui-ink);
    border-color: #cdbb9a;
    box-shadow: var(--ui-shadow-strong);
    transform: translateY(-1px);
}

.action-card span:last-child,
.action-card small {
    color: var(--ui-muted);
}

.table-responsive {
    border-radius: 0 0 var(--ui-radius) var(--ui-radius);
}

.modern-table-wrapper,
.table-responsive {
    scrollbar-color: #cdbb9a #f5f2ec;
    scrollbar-width: thin;
}

.table {
    color: #344039;
}

.table thead th,
.thead-light th,
.quotation-products-table thead th,
.table-settings thead th,
#bill-to-bill-form .table th {
    color: #526057;
    background: #f5f2ec !important;
    border-color: var(--ui-line);
    letter-spacing: 0;
}

.table td,
.table th,
.table-bordered td,
.table-bordered th {
    border-color: var(--ui-line);
}

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

.table .btn {
    margin-top: 2px;
    margin-bottom: 2px;
}

.form-group label,
.totals-control-box label {
    color: #48544b;
    font-weight: 800;
}

.form-control,
.custom-select,
.input-group-text,
.select2-container--bootstrap4 .select2-selection {
    min-height: 42px;
    color: var(--ui-ink);
    background-color: #ffffff;
    border-color: #ddd6ca;
    border-radius: var(--ui-radius);
}

.input-group .form-control.border-left-0 {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group .input-group-text {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.form-control:focus,
.custom-select:focus,
.select2-container--bootstrap4.select2-container--focus .select2-selection,
.select2-container--bootstrap4.select2-container--open .select2-selection {
    border-color: var(--ui-green-600);
    box-shadow: 0 0 0 4px rgba(52, 134, 91, 0.14);
}

.select2-container--bootstrap4 .select2-selection--single {
    height: 42px;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
    line-height: 40px;
    padding-left: 14px;
    padding-right: 36px;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
    top: 0;
    right: 10px;
    height: 40px;
}

.form-row {
    margin-right: -6px;
    margin-left: -6px;
}

.form-row > .col,
.form-row > [class*="col-"] {
    padding-right: 6px;
    padding-left: 6px;
}

.btn {
    border-radius: var(--ui-radius);
    font-weight: 800;
}

.btn-sm {
    border-radius: 7px;
}

.btn-primary,
.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--ui-green-700);
    background: var(--ui-green-700);
}

.btn-warning,
.btn-warning:hover,
.btn-warning:focus {
    color: #2f2111;
    border-color: var(--ui-gold);
    background: #d99b3d;
}

.btn-outline-primary {
    color: var(--ui-green-800);
    border-color: #b9cfb5;
    background: #ffffff;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary.active {
    color: #ffffff;
    border-color: var(--ui-green-700);
    background: var(--ui-green-700);
}

.btn-outline-secondary {
    color: #4c574f;
    border-color: #d6cec0;
}

.btn-outline-secondary:hover {
    color: var(--ui-ink);
    background: #f5f2ec;
    border-color: #c7bda9;
}

.btn-success {
    border-color: var(--ui-green-700);
    background: var(--ui-green-700);
}

.btn-danger {
    border-color: var(--ui-red);
    background: var(--ui-red);
}

.btn-info {
    border-color: var(--ui-blue);
    background: var(--ui-blue);
}

.alert {
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
}

.badge {
    border-radius: 999px;
    font-weight: 850;
}

.badge-primary {
    background: var(--ui-green-700);
}

.badge-secondary,
.badge-dark {
    color: #536057;
    background: #e7e1d6;
}

.badge-success {
    color: #14532d;
    background: #dff0df;
}

.badge-warning {
    color: #7a4d12;
    background: #f7e6c7;
}

.badge-danger {
    color: #84241d;
    background: #f5d6d2;
}

.badge-info {
    color: #164e63;
    background: #d8edf1;
}

.document-box {
    border-radius: var(--ui-radius);
}

.document-box h4,
.document-box h5,
.document-box h6 {
    color: var(--ui-ink);
    font-weight: 850;
    letter-spacing: 0;
}

.document-box hr {
    border-top-color: var(--ui-line);
}

.empty-state {
    color: var(--ui-muted);
}

.empty-state i {
    color: #cdbb9a;
}

.info-tile,
.totals-control-box,
.btb-calc-card,
.payment-summary {
    background: var(--ui-surface-soft);
}

.info-tile span,
.btb-total-row span,
.section-title-row p,
.recent-bill-chip small {
    color: var(--ui-muted);
}

.info-tile strong,
.btb-total-row strong,
.section-title-row h5 {
    color: var(--ui-ink);
}

.recent-bill-chip {
    color: var(--ui-green-800);
    background: #f2f7f0;
    border-color: #d7e5d3;
    border-radius: var(--ui-radius);
}

.totals-table .grand-row th,
.totals-table .grand-row td {
    color: var(--ui-green-900);
    border-top-color: #cdbb9a;
}

.document-actions {
    gap: 8px;
}

.document-actions,
.btb-action-row {
    flex-wrap: wrap;
}

.payment-highlight-box,
.btb-payable-card {
    border-radius: var(--ui-radius);
    background: linear-gradient(135deg, var(--ui-green-900), var(--ui-green-600));
    box-shadow: var(--ui-shadow-strong);
}

.btb-total-row {
    background: #ffffff;
    border-color: var(--ui-line);
    border-radius: var(--ui-radius);
}

.btb-total-row.primary {
    background: #eef5eb;
    border-color: #d7e5d3;
}

.btb-total-row.primary span,
.btb-total-row.primary strong,
#btb-old-invoice-help {
    color: var(--ui-green-800) !important;
}

.btb-total-row.danger strong,
.text-danger {
    color: var(--ui-red) !important;
}

.btb-view-summary {
    width: min(100%, 620px);
    margin-left: auto;
}

.btb-view-summary-old {
    width: 100%;
    min-height: 100%;
}

.btb-view-summary .summary-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px solid var(--ui-line);
}

.btb-view-summary .summary-line span {
    color: var(--ui-muted);
    font-size: 14px;
    font-weight: 750;
}

.btb-view-summary .summary-line strong {
    color: var(--ui-ink);
    font-size: 18px;
    font-weight: 900;
    line-height: 1.1;
    text-align: right;
    white-space: nowrap;
}

.btb-view-summary .summary-line-total {
    margin-top: 4px;
    padding-top: 12px;
    border-bottom: 0;
    border-top: 2px solid #c9dcc7;
}

.btb-view-summary .summary-line-total span,
.btb-view-summary .summary-line-total strong {
    color: var(--ui-green-900);
}

.btb-view-summary .summary-line-total strong {
    font-size: 22px;
}

.btb-view-payable {
    min-height: 100%;
}

.btb-view-payable div {
    font-size: inherit;
    font-weight: inherit;
}

.btb-view-payable strong {
    letter-spacing: 0;
}

.btb-view-payable small {
    font-size: inherit;
}

.btb-view-form-size .btb-summary-grid {
    grid-template-columns: minmax(260px, 1.15fr) minmax(320px, .95fr);
}

.select2-container--bootstrap4 .select2-dropdown {
    border-color: #ddd6ca;
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow-strong);
}

.select2-container--bootstrap4 .select2-search--dropdown .select2-search__field {
    border-color: #ddd6ca;
    border-radius: 7px;
}

.select2-container--bootstrap4 .select2-results__option--highlighted[aria-selected] {
    background-color: var(--ui-green-700);
}

.login-body {
    background:
        linear-gradient(120deg, rgba(20, 61, 42, 0.92), rgba(31, 90, 61, 0.88)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0, rgba(255, 255, 255, 0.08) 1px, transparent 1px, transparent 70px);
}

.login-shell {
    padding: 30px 16px;
}

.login-card {
    max-width: 1020px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: var(--ui-radius);
    box-shadow: 0 28px 70px rgba(10, 28, 18, 0.36);
}

.login-visual {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.10), transparent 44%),
        linear-gradient(155deg, #143d2a, #28724d);
}

.login-visual-icon {
    color: #ffffff;
    background: var(--ui-gold);
    border-radius: var(--ui-radius);
}

.login-visual h1,
.login-form-panel h2 {
    letter-spacing: 0;
}

.login-form-panel {
    padding: 46px;
}

.login-demo-box {
    color: #3f493f;
    background: #f7f2e9;
    border-color: #e4d7c2;
    border-radius: var(--ui-radius);
}

@media (max-width: 991.98px) {
    .app-sidebar {
        width: min(292px, calc(100vw - 42px));
    }

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

    .topbar {
        padding: 10px 14px;
    }

    .app-container {
        padding: 18px 14px 38px;
    }

    .page-hero {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 575.98px) {
    .topbar-actions > .btn:not(:last-child) {
        display: none;
    }

    .topbar {
        align-items: flex-start;
    }

    .topbar-actions {
        max-width: 48%;
    }

    .page-hero {
        padding: 18px;
    }

    .page-hero-meta {
        width: 100%;
        border-radius: var(--ui-radius);
        text-align: center;
    }

    .card-header,
    .card-body,
    .document-box {
        padding: 15px;
    }

    .card-header.d-flex {
        align-items: flex-start !important;
        flex-direction: column;
    }

    .card-header.d-flex .btn {
        width: 100%;
    }

    .document-actions .btn,
    .btb-action-row .btn {
        width: 100%;
    }

    .btb-view-summary {
        width: 100%;
    }

    .btb-view-summary .summary-line {
        align-items: center;
        flex-direction: row;
        gap: 10px;
    }

    .btb-view-summary .summary-line strong {
        width: auto;
        text-align: right;
        white-space: nowrap;
    }

    .btb-view-payable {
        min-height: auto;
    }

    .login-form-panel {
        padding: 26px;
    }
}

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

    .card,
    .document-box {
        box-shadow: none !important;
    }
}

/* Unified rice mill theme contract
   Keep this block last so Bootstrap utilities and legacy module CSS share one look. */
:root {
    --ui-bg: #f6f3ee;
    --ui-surface: #ffffff;
    --ui-surface-soft: #fbfaf7;
    --ui-surface-muted: #f3eee6;
    --ui-ink: #182019;
    --ui-muted: #687166;
    --ui-line: #e6e0d6;
    --ui-green-900: #143d2a;
    --ui-green-800: #1f5a3d;
    --ui-green-700: #28724d;
    --ui-green-600: #34865b;
    --ui-gold: #c8892d;
    --ui-gold-soft: #f7e8c9;
    --ui-red: #c24132;
    --ui-red-soft: #f6ddd9;
    --ui-blue: #2f6f8f;
    --ui-blue-soft: #e0eef3;
    --ui-radius: 8px;
    --ui-shadow: 0 12px 28px rgba(31, 42, 32, 0.08);
    --ui-shadow-strong: 0 20px 50px rgba(31, 42, 32, 0.14);
    --blue-900: var(--ui-green-900);
    --blue-800: var(--ui-green-800);
    --blue-700: var(--ui-green-700);
    --blue-600: var(--ui-green-600);
    --blue-500: var(--ui-green-600);
    --blue-100: #eaf1e8;
    --blue-050: var(--ui-surface-soft);
    --ink-900: var(--ui-ink);
    --ink-700: #48544b;
    --ink-500: var(--ui-muted);
    --line: var(--ui-line);
    --success: var(--ui-green-700);
    --warning: var(--ui-gold);
    --danger: var(--ui-red);
    --radius-lg: var(--ui-radius);
    --radius-md: var(--ui-radius);
    --shadow-sm: var(--ui-shadow);
    --shadow-md: var(--ui-shadow-strong);
}

html,
body {
    background-color: var(--ui-bg);
}

body {
    color: var(--ui-ink);
    background:
        linear-gradient(180deg, rgba(246, 243, 238, 0.96), rgba(249, 248, 244, 0.98)),
        repeating-linear-gradient(90deg, rgba(20, 61, 42, 0.03) 0, rgba(20, 61, 42, 0.03) 1px, transparent 1px, transparent 72px);
}

a {
    color: var(--ui-green-700);
}

a:hover {
    color: var(--ui-green-900);
}

.text-primary {
    color: var(--ui-green-700) !important;
}

.text-success {
    color: var(--ui-green-700) !important;
}

.text-warning {
    color: #8a5a16 !important;
}

.text-info {
    color: var(--ui-blue) !important;
}

.text-danger {
    color: var(--ui-red) !important;
}

.text-muted,
.small.text-muted,
small.text-muted {
    color: var(--ui-muted) !important;
}

.bg-primary,
.bg-success {
    background-color: var(--ui-green-700) !important;
}

.bg-warning {
    background-color: var(--ui-gold) !important;
}

.bg-danger {
    background-color: var(--ui-red) !important;
}

.bg-info {
    background-color: var(--ui-blue) !important;
}

.app-sidebar {
    width: 292px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 180px),
        linear-gradient(180deg, #123825 0%, #1f5a3d 52%, #163f2b 100%);
    box-shadow: 12px 0 34px rgba(20, 61, 42, 0.18);
}

.app-main {
    margin-left: 292px;
}

.brand-icon,
.sidebar-user-avatar {
    color: #ffffff;
    background: linear-gradient(135deg, var(--ui-gold), #e1ad58);
}

.sidebar-link,
.brand-icon,
.sidebar-footer,
.btn-icon,
.page-hero-meta,
.card,
.card-header,
.document-box,
.metric-card,
.action-card,
.info-tile,
.totals-control-box,
.btb-summary-shell,
.btb-calc-card,
.btb-total-row,
.payment-summary,
.login-card,
.login-visual-icon,
.login-demo-box {
    border-radius: var(--ui-radius);
}

.sidebar-link.active {
    color: var(--ui-green-900);
    background: #ffffff;
    box-shadow: inset 4px 0 0 var(--ui-gold);
}

.topbar {
    background: rgba(251, 250, 247, 0.92);
    border-bottom-color: rgba(230, 224, 214, 0.95);
}

.app-container {
    max-width: 1580px;
}

.page-hero {
    align-items: flex-end;
    padding: 4px 0 18px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--ui-line);
    border-radius: 0;
    box-shadow: none;
}

.page-hero h1 {
    font-size: clamp(24px, 2.2vw, 32px);
    font-weight: 900;
}

.page-hero p {
    max-width: 900px;
    color: var(--ui-muted);
}

.page-hero-meta {
    background: #ecf3ea;
    border-color: #d7e5d3;
}

.card,
.document-box,
.metric-card,
.action-card,
.info-tile,
.totals-control-box,
.btb-summary-shell,
.btb-calc-card,
.btb-total-row,
.payment-summary {
    border-color: var(--ui-line) !important;
    box-shadow: var(--ui-shadow);
}

.card-header,
.card-footer {
    color: var(--ui-ink);
    background: var(--ui-surface-soft);
    border-color: var(--ui-line);
}

.card-header.bg-primary,
.card-header.bg-success,
.card-header.bg-danger,
.card-header.bg-info,
.card-header.bg-warning,
.card-header.text-white {
    color: var(--ui-ink) !important;
    background: var(--ui-surface-soft) !important;
}

.card-header.bg-success,
.card-header.bg-primary {
    border-left: 4px solid var(--ui-green-700);
}

.card-header.bg-danger {
    border-left: 4px solid var(--ui-red);
}

.card-header.bg-info {
    border-left: 4px solid var(--ui-blue);
}

.card-header.bg-warning {
    border-left: 4px solid var(--ui-gold);
}

.metric-card .metric-icon,
.action-card-icon,
.empty-state-icon {
    color: #ffffff;
    background: var(--ui-green-700);
}

.metric-card.metric-primary,
.btb-payable-card,
.payment-highlight-box {
    background: linear-gradient(135deg, var(--ui-green-900), var(--ui-green-600));
    box-shadow: var(--ui-shadow-strong);
}

.metric-card.metric-primary .metric-icon {
    color: var(--ui-green-900);
    background: #ffffff;
}

.table {
    color: #344039;
}

.table thead th,
.thead-light th,
.quotation-products-table thead th,
.table-settings thead th,
#bill-to-bill-form .table th {
    color: #526057;
    background: #f5f2ec !important;
    border-color: var(--ui-line) !important;
}

.table td,
.table th,
.table-bordered td,
.table-bordered th {
    border-color: var(--ui-line) !important;
}

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

.form-control,
.custom-select,
.input-group-text,
.select2-container--bootstrap4 .select2-selection {
    color: var(--ui-ink);
    border-color: #ddd6ca;
    border-radius: var(--ui-radius);
}

.form-control:focus,
.custom-select:focus,
.select2-container--bootstrap4.select2-container--focus .select2-selection,
.select2-container--bootstrap4.select2-container--open .select2-selection {
    border-color: var(--ui-green-600);
    box-shadow: 0 0 0 4px rgba(52, 134, 91, 0.14);
}

.btn {
    border-radius: var(--ui-radius);
    font-weight: 800;
}

.btn-primary,
.btn-success {
    color: #ffffff !important;
    border-color: var(--ui-green-700);
    background: var(--ui-green-700);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-success:hover,
.btn-success:focus {
    border-color: var(--ui-green-900);
    background: var(--ui-green-900);
}

.btn-warning {
    color: #2f2111 !important;
    border-color: var(--ui-gold);
    background: var(--ui-gold);
}

.btn-secondary,
.btn-light,
.btn-outline-secondary {
    color: #4c574f !important;
    border-color: #d6cec0;
    background: #f7f4ed;
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-light:hover,
.btn-light:focus,
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    color: var(--ui-ink) !important;
    border-color: #c7bda9;
    background: #f0ebe2;
}

.btn-outline-primary {
    color: var(--ui-green-800) !important;
    border-color: #b9cfb5;
    background: #ffffff;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary.active {
    color: #ffffff !important;
    border-color: var(--ui-green-700);
    background: var(--ui-green-700);
}

.btn-danger,
.btn-outline-danger:hover,
.btn-outline-danger:focus {
    color: #ffffff !important;
    border-color: var(--ui-red);
    background: var(--ui-red);
}

.btn-outline-danger {
    color: var(--ui-red);
    border-color: #ddb0a9;
    background: #ffffff;
}

.btn-info {
    border-color: var(--ui-blue);
    background: var(--ui-blue);
}

.badge {
    border-radius: 999px;
    font-weight: 850;
}

.badge-primary,
.badge-success {
    color: #14532d;
    background: #dff0df;
}

.badge-warning {
    color: #7a4d12;
    background: var(--ui-gold-soft);
}

.badge-danger {
    color: #84241d;
    background: var(--ui-red-soft);
}

.badge-info {
    color: #164e63;
    background: var(--ui-blue-soft);
}

.badge-secondary,
.badge-dark {
    color: #536057;
    background: #e7e1d6;
}

.alert {
    border: 1px solid transparent;
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
}

.alert-success {
    color: #14532d;
    background: #dff0df;
    border-color: #c8e3ca;
}

.alert-warning {
    color: #7a4d12;
    background: var(--ui-gold-soft);
    border-color: #eed6a8;
}

.alert-danger {
    color: #84241d;
    background: var(--ui-red-soft);
    border-color: #e8bbb5;
}

.alert-info {
    color: #164e63;
    background: var(--ui-blue-soft);
    border-color: #c7e0e8;
}

.alert-light {
    color: var(--ui-ink);
    background: var(--ui-surface-soft);
    border-color: var(--ui-line);
}

.info-tile,
.totals-control-box,
.btb-calc-card,
.payment-summary {
    background: var(--ui-surface-soft) !important;
}

.totals-control-box {
    padding: 16px;
    border: 1px solid var(--ui-line);
}

.summary-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid var(--ui-line);
}

.summary-line span {
    color: var(--ui-muted);
    font-size: 14px;
    font-weight: 750;
}

.summary-line strong {
    color: var(--ui-ink);
    font-size: 17px;
    font-weight: 900;
    text-align: right;
    white-space: nowrap;
}

.summary-line-total {
    margin-top: 4px;
    padding-top: 13px;
    border-bottom: 0;
    border-top: 2px solid #c9dcc7;
}

.summary-line-total span,
.summary-line-total strong {
    color: var(--ui-green-900);
}

.btb-total-row {
    background: #ffffff;
}

.btb-total-row.primary {
    background: #eef5eb;
    border-color: #d7e5d3 !important;
}

.btb-total-row.primary span,
.btb-total-row.primary strong,
#btb-old-invoice-help {
    color: var(--ui-green-800) !important;
}

.btb-total-row.danger strong {
    color: var(--ui-red) !important;
}

.btb-total-row.muted {
    background: var(--ui-surface-muted);
}

.totals-table .grand-row th,
.totals-table .grand-row td {
    color: var(--ui-green-900);
    border-top-color: #cdbb9a !important;
}

.payment-proof-preview {
    border-color: var(--ui-line);
    border-radius: var(--ui-radius);
}

.select2-container--bootstrap4 .select2-dropdown {
    border-color: #ddd6ca;
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow-strong);
}

.select2-container--bootstrap4 .select2-results__option--highlighted[aria-selected] {
    background-color: var(--ui-green-700);
}

.login-body {
    background:
        linear-gradient(120deg, rgba(20, 61, 42, 0.92), rgba(31, 90, 61, 0.88)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0, rgba(255, 255, 255, 0.08) 1px, transparent 1px, transparent 70px);
}

.login-visual {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.10), transparent 44%),
        linear-gradient(155deg, #143d2a, #28724d);
}

.login-demo-box {
    background: #f7f2e9;
    border-color: #e4d7c2;
}

.color-code-control {
    display: grid;
    grid-template-columns: 52px minmax(96px, 1fr);
    gap: 8px;
    align-items: center;
    min-width: 180px;
}

.color-code-control .color-picker-control {
    width: 52px;
    min-width: 52px;
    height: 42px;
    padding: 4px;
}

.color-code-control .js-color-code {
    font-family: Consolas, "Courier New", monospace;
    text-transform: uppercase;
}

.consignment-grand-total-table th,
.consignment-grand-total-table td {
    font-size: 20px;
    font-weight: 800;
}

.consignment-grand-total-table #grand-text {
    font-size: 24px;
    font-weight: 900;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        width: min(292px, calc(100vw - 42px));
    }

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

    .page-hero {
        align-items: flex-start;
    }
}

@media (max-width: 575.98px) {
    .page-hero {
        gap: 12px;
        padding-bottom: 14px;
    }

    .summary-line {
        gap: 10px;
    }

    .summary-line strong {
        min-width: 112px;
    }
}

/* Standard filter controls
   Keeps list-page filters visually consistent across legacy inline forms,
   invoice filters, and stock-history filters. */
:root {
    --filter-control-height: 40px;
    --filter-control-gap: 10px;
    --filter-button-min: 104px;
}

.card-body.border-bottom > form.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--filter-control-gap);
}

.card-body.border-bottom > form.form-inline label {
    min-height: var(--filter-control-height);
    display: inline-flex;
    align-items: center;
    margin: 0 !important;
    color: #48544b;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

.card-body.border-bottom > form.form-inline .form-control,
.card-body.border-bottom > form.form-inline .custom-select,
.invoice-filter-form .form-control,
.invoice-filter-form .custom-select,
.stock_history_filter_form .form-control,
.stock_history_filter_form .custom-select,
.card-body.border-bottom > form.form-inline .select2-container--bootstrap4 .select2-selection,
.invoice-filter-form .select2-container--bootstrap4 .select2-selection,
.stock_history_filter_form .select2-container--bootstrap4 .select2-selection {
    width: auto;
    min-width: 148px;
    min-height: var(--filter-control-height);
    height: var(--filter-control-height);
    margin: 0 !important;
    font-size: 13px;
    line-height: 1.4;
}

.card-body.border-bottom > form.form-inline input[type="date"].form-control,
.invoice-filter-form input[type="date"].form-control,
.stock_history_filter_form input[type="date"].form-control {
    min-width: 152px;
}

.card-body.border-bottom > form.form-inline .filter-customer-select,
.card-body.border-bottom > form.form-inline .select2-container,
.invoice-filter-form .filter-customer-select,
.invoice-filter-form .select2-container {
    min-width: 260px !important;
}

.card-body.border-bottom > form.form-inline .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered,
.invoice-filter-form .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered,
.stock_history_filter_form .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
    line-height: calc(var(--filter-control-height) - 2px);
}

.card-body.border-bottom > form.form-inline .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow,
.invoice-filter-form .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow,
.stock_history_filter_form .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
    height: calc(var(--filter-control-height) - 2px);
}

.card-body.border-bottom > form.form-inline .btn,
.invoice-filter-form .btn,
.stock_history_filter_form .btn,
.card-body.border-bottom > a.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--filter-button-min);
    min-height: var(--filter-control-height);
    height: var(--filter-control-height);
    margin: 0 !important;
    padding: 0 14px;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
}

.invoice-filter-form .form-row {
    row-gap: var(--filter-control-gap);
}

.invoice-filter-button-row {
    align-items: flex-end;
    justify-content: flex-end;
    margin-top: var(--filter-control-gap);
}

.invoice-filter-form .form-control,
.invoice-filter-form .custom-select,
.invoice-filter-form .select2-container,
.invoice-filter-form .filter-customer-select,
.invoice-filter-form input[type="date"].form-control {
    width: 100% !important;
    min-width: 0 !important;
}

.invoice-filter-form .select2-container,
.invoice-filter-form .select2-container--bootstrap4 .select2-selection--single {
    box-sizing: border-box;
    min-height: var(--filter-control-height);
    height: var(--filter-control-height);
}

.invoice-filter-form .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
    display: block;
    box-sizing: border-box;
    min-height: 0;
    height: calc(var(--filter-control-height) - 2px);
    line-height: calc(var(--filter-control-height) - 2px);
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invoice-filter-form .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
    top: 0;
    height: calc(var(--filter-control-height) - 2px);
}

.invoice-filter-form .form-group,
.stock_history_filter_form .form-group {
    margin-bottom: 0;
}

.invoice-filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(40px, 1fr));
    gap: 8px;
}

.invoice-filter-actions .btn {
    min-width: 40px;
    padding: 0 10px;
}

.card-body.border-bottom > a.btn-sm {
    margin-right: 6px !important;
    margin-bottom: 6px !important;
}

@media (max-width: 767.98px) {
    .card-body.border-bottom > form.form-inline {
        align-items: stretch;
        gap: 8px;
    }

    .card-body.border-bottom > form.form-inline label {
        width: 100%;
        min-height: auto;
        margin-bottom: -4px !important;
    }

    .card-body.border-bottom > form.form-inline .form-control,
    .card-body.border-bottom > form.form-inline .custom-select,
    .card-body.border-bottom > form.form-inline .select2-container,
    .invoice-filter-form .form-control,
    .invoice-filter-form .custom-select,
    .invoice-filter-form .select2-container,
    .stock_history_filter_form .form-control,
    .stock_history_filter_form .custom-select,
    .stock_history_filter_form .select2-container {
        width: 100% !important;
        min-width: 100% !important;
    }

    .card-body.border-bottom > form.form-inline .btn,
    .invoice-filter-form .btn,
    .stock_history_filter_form .btn {
        width: 100%;
        min-width: 100%;
    }

    .invoice-filter-actions {
        grid-template-columns: 1fr 1fr;
    }
}

/* Standard card headers */
:root {
    --page-hero-min-height: 116px;
    --card-header-min-height: 58px;
}

.page-hero.no-print {
    min-height: var(--page-hero-min-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 0 20px;
}

.page-hero.no-print > div:first-child {
    min-width: 0;
}

.page-hero.no-print h1 {
    margin-bottom: 8px;
    line-height: 1.2;
}

.page-hero.no-print p {
    margin-bottom: 0;
    line-height: 1.55;
}

.page-hero.no-print .page-hero-meta {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    white-space: nowrap;
}

.card > .card-header,
.old-bill-panel > .card-header {
    min-height: var(--card-header-min-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
}

.card > .card-header strong,
.old-bill-panel > .card-header strong {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    line-height: 1.25;
}

.card > .card-header .small,
.old-bill-panel > .card-header .small {
    margin-top: 3px;
    line-height: 1.35;
}

.card > .card-header .btn,
.old-bill-panel > .card-header .btn {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 767.98px) {
    .page-hero.no-print {
        min-height: auto;
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .page-hero.no-print .page-hero-meta {
        width: 100%;
        justify-content: flex-start;
    }

    .card > .card-header,
    .old-bill-panel > .card-header {
        align-items: stretch;
        flex-direction: column;
    }

    .card > .card-header .btn,
    .old-bill-panel > .card-header .btn {
        width: 100%;
    }
}

/* Standard document header fields
   Makes date, customer, and document-number controls feel consistent across pages
   without enlarging compact table inputs. */
:root {
    --doc-control-height: 46px;
    --doc-date-width: 210px;
    --doc-id-width: 220px;
    --doc-party-width: 360px;
}

.card-body .form-row .form-control:not(.form-control-sm),
.card-body .form-row .custom-select:not(.custom-select-sm),
.card-body .form-row .select2-container--bootstrap4 .select2-selection {
    min-height: var(--doc-control-height);
    height: var(--doc-control-height);
    font-size: 14px;
}

.card-body .form-row .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
    line-height: calc(var(--doc-control-height) - 2px);
}

.card-body .form-row .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
    height: calc(var(--doc-control-height) - 2px);
}

.card-body .form-row .consignment-status-filter-button {
    min-height: 42px;
    height: 42px;
    padding: 0 14px;
    border-color: #ddd6ca;
    border-radius: var(--ui-radius);
    font-size: 14px;
    line-height: 1.4;
}

.card-body .consignment-filter-form .filter-customer-select,
.card-body .consignment-filter-form .select2-container,
.card-body .consignment-filter-form .consignment-status-filter {
    width: 100% !important;
    min-width: 0 !important;
}

.card-body .consignment-filter-form .select2-container--bootstrap4 .select2-selection {
    min-height: 42px;
    height: 42px;
}

.card-body .consignment-filter-form .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
    line-height: 40px;
}

.card-body .consignment-filter-form .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
    height: 40px;
}

.card-body .list-filter-form .form-control,
.card-body .list-filter-form .custom-select,
.card-body .list-filter-form .select2-container,
.card-body .list-filter-form .select2-container--bootstrap4 .select2-selection,
.card-body .list-filter-form .select2-container--bootstrap4 .select2-selection--single,
.card-body .list-filter-form .consignment-status-filter,
.card-body .list-filter-form .consignment-status-filter-button {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 42px;
    height: 42px;
}

.card-body .list-filter-form .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
    height: 40px;
    line-height: 40px;
}

.card-body .list-filter-form .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
    height: 40px;
}

.card-body .list-filter-form .btn {
    min-height: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.card-body .form-row > [class*="col-"]:has(input[type="date"].form-control:not(.form-control-sm)) {
    flex: 0 0 var(--doc-date-width);
    max-width: var(--doc-date-width);
    min-width: var(--doc-date-width);
}

.card-body .form-row > [class*="col-"]:has(.js-customer-select),
.card-body .form-row > [class*="col-"]:has(.js-consignment-customer),
.card-body .form-row > [class*="col-"]:has(.filter-customer-select) {
    flex: 1 1 var(--doc-party-width);
    max-width: 100%;
    min-width: var(--doc-party-width);
}

.card-body .form-row > [class*="col-"]:has(input[name$="_no"].form-control:not(.form-control-sm)),
.card-body .form-row > [class*="col-"]:has(input[name="code"].form-control:not(.form-control-sm)),
.card-body .form-row > [class*="col-"]:has(input[name="id"].form-control:not(.form-control-sm)) {
    flex: 0 0 var(--doc-id-width);
    max-width: var(--doc-id-width);
    min-width: var(--doc-id-width);
}

.customer-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    align-items: stretch;
}

.info-tile {
    min-height: 92px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-tile strong {
    overflow-wrap: anywhere;
}

@media (max-width: 767.98px) {
    .card-body .form-row > [class*="col-"]:has(input[type="date"].form-control:not(.form-control-sm)),
    .card-body .form-row > [class*="col-"]:has(.js-customer-select),
    .card-body .form-row > [class*="col-"]:has(.js-consignment-customer),
    .card-body .form-row > [class*="col-"]:has(.filter-customer-select),
    .card-body .form-row > [class*="col-"]:has(input[name$="_no"].form-control:not(.form-control-sm)),
    .card-body .form-row > [class*="col-"]:has(input[name="code"].form-control:not(.form-control-sm)),
    .card-body .form-row > [class*="col-"]:has(input[name="id"].form-control:not(.form-control-sm)) {
        flex: 0 0 100%;
        max-width: 100%;
        min-width: 100%;
    }
}

.card-body .invoice-filter-form .form-row > [class*="col-"]:has(.filter-customer-select) {
    flex: 1 0 0%;
    max-width: 100%;
    min-width: 0;
}

.card-body .invoice-filter-form .select2-container,
.card-body .invoice-filter-form .select2-container--bootstrap4 .select2-selection,
.card-body .invoice-filter-form .select2-container--bootstrap4 .select2-selection--single {
    min-height: var(--filter-control-height);
    height: var(--filter-control-height);
}

.card-body .invoice-filter-form .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
    height: calc(var(--filter-control-height) - 2px);
    line-height: calc(var(--filter-control-height) - 2px);
}

.card-body .invoice-filter-form .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
    height: calc(var(--filter-control-height) - 2px);
}

.page-hero.no-print .page-hero-meta.consignment-status-panel {
    display: block;
    min-height: 0;
    min-width: 240px;
    width: auto;
    margin-left: auto;
    padding: 12px 16px;
    border-radius: 10px;
    text-align: center;
    white-space: normal;
}

.page-hero.no-print .page-hero-meta.consignment-status-partial {
    color: #8a5a00;
    background: #fff6df;
    border-color: #f0ad2c;
}

.page-hero.no-print .page-hero-meta.consignment-status-panel span {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.page-hero.no-print .page-hero-meta.consignment-status-panel strong {
    color: inherit;
    font-size: 26px;
    font-weight: 950;
    line-height: 1.1;
    margin-top: 2px;
}

.consignment-customer-header {
    display: grid;
    grid-template-columns: minmax(260px, 1.35fr) minmax(180px, .85fr) minmax(160px, .8fr);
    gap: 12px 22px;
    align-items: start;
    max-width: 980px;
}

.consignment-customer-field > span {
    display: block;
    color: #111827;
    font-size: 13px;
    font-weight: 850;
    margin-bottom: 3px;
}

.consignment-customer-field strong {
    display: block;
    color: #111827;
    font-size: 19px;
    font-weight: 900;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.consignment-customer-field strong span {
    color: inherit;
    font: inherit;
}

@media (max-width: 767.98px) {
    .consignment-customer-header {
        grid-template-columns: 1fr;
    }
}

/* Customer management */
.customer-management-page {
    --customer-border: #e5eaf1;
}

.customer-management-hero .card-header,
.customer-form-header {
    padding: 1.15rem 1.25rem;
    gap: 1rem;
}

.customer-management-hero .card-header strong,
.customer-form-header strong {
    font-size: 1.08rem;
}

.customer-metric-card {
    min-height: 112px;
    border: 1px solid var(--customer-border);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}

.customer-metric-card .metric-icon {
    background: #eef2ff;
    color: #4f46e5;
}

.customer-metric-active .metric-icon {
    background: #dcfce7;
    color: #15803d;
}

.customer-metric-credit .metric-icon {
    background: #e0f2fe;
    color: #0369a1;
}

.customer-metric-warning .metric-icon {
    background: #fff7ed;
    color: #c2410c;
}

.customer-filter-form label {
    color: #475569;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .02em;
    margin-bottom: .38rem;
}

.customer-filter-form .form-control,
.customer-filter-form .custom-select,
.customer-filter-form .input-group-text {
    min-height: 40px;
}

.customer-filter-footer,
.customer-pagination-footer,
.customer-form-actions {
    align-items: center;
    display: flex;
    gap: .75rem;
    justify-content: space-between;
}

.customer-filter-actions {
    display: flex;
    gap: .5rem;
}

.customer-table {
    min-width: 980px;
}

.customer-table thead th {
    background: #f8fafc;
    border-bottom: 1px solid #dfe5ed;
    color: #64748b;
    font-size: .76rem;
    letter-spacing: .035em;
    padding-bottom: .8rem;
    padding-top: .8rem;
    text-transform: uppercase;
    vertical-align: middle;
}

.customer-table tbody td {
    border-color: #edf1f5;
    padding-bottom: .9rem;
    padding-top: .9rem;
    vertical-align: middle;
}

.customer-row-inactive {
    background: #fafafa;
    opacity: .74;
}

.customer-code-link {
    color: #2563eb;
    display: inline-block;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .035em;
    margin-bottom: .2rem;
}

.customer-name {
    color: #172033;
    font-weight: 750;
    margin-bottom: .2rem;
}

.customer-tax,
.customer-address {
    color: #64748b;
    font-size: .76rem;
    margin-top: .2rem;
    max-width: 310px;
}

.customer-contact-icon {
    color: #94a3b8;
    width: 14px;
}

.customer-credit-pill,
.customer-cash-pill {
    border-radius: 999px;
    display: inline-block;
    font-size: .75rem;
    font-weight: 750;
    min-width: 66px;
    padding: .32rem .65rem;
}

.customer-credit-pill {
    background: #e0f2fe;
    color: #075985;
}

.customer-cash-pill {
    background: #f1f5f9;
    color: #475569;
}

.customer-actions {
    white-space: nowrap;
}

.customer-detail-card {
    margin-left: auto;
    margin-right: auto;
    max-width: 1060px;
}

.customer-detail-header-actions {
    display: flex;
    gap: .5rem;
}

.customer-detail-identity {
    align-items: center;
    border-bottom: 1px solid var(--customer-border);
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: .25rem 0 1.25rem;
}

.customer-detail-avatar {
    align-items: center;
    background: linear-gradient(135deg, #eef2ff, #dbeafe);
    border-radius: 18px;
    color: #4f46e5;
    display: flex;
    flex: 0 0 68px;
    font-size: 1.65rem;
    height: 68px;
    justify-content: center;
}

.customer-detail-code {
    color: #2563eb;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .08em;
    margin-bottom: .2rem;
    text-transform: uppercase;
}

.customer-detail-identity h3 {
    color: #172033;
    font-size: 1.45rem;
    margin-bottom: .35rem;
}

.customer-detail-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.customer-detail-item {
    background: #f8fafc;
    border: 1px solid var(--customer-border);
    border-radius: 12px;
    min-height: 82px;
    padding: .9rem 1rem;
}

.customer-detail-item span,
.customer-detail-item strong {
    display: block;
}

.customer-detail-item span {
    color: #64748b;
    font-size: .75rem;
    font-weight: 700;
    margin-bottom: .35rem;
}

.customer-detail-item strong {
    color: #1e293b;
    font-size: .92rem;
    overflow-wrap: anywhere;
}

.customer-detail-address {
    grid-column: 1 / -1;
}

.customer-form-card {
    margin-left: auto;
    margin-right: auto;
    max-width: 1060px;
}

.customer-form-card .card-body {
    padding: 1.35rem;
}

.customer-form-section {
    border-bottom: 1px solid var(--customer-border);
    margin-bottom: 1.35rem;
    padding-bottom: .35rem;
}

.customer-form-section:last-child {
    border-bottom: 0;
}

.customer-form-section-title {
    align-items: center;
    display: flex;
    gap: .75rem;
    margin-bottom: 1rem;
}

.customer-form-section-title > span {
    align-items: center;
    background: #eef2ff;
    border-radius: 10px;
    color: #4f46e5;
    display: inline-flex;
    flex: 0 0 38px;
    height: 38px;
    justify-content: center;
}

.customer-form-section-title strong,
.customer-form-section-title small {
    display: block;
}

.customer-form-section-title small {
    color: #64748b;
    margin-top: .12rem;
}

.customer-form-card .input-group-text {
    background: #f8fafc;
    color: #64748b;
}

.permission-groups-grid {
    row-gap: .35rem;
}

.permission-group-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    padding: 1rem;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.permission-group-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 5px 18px rgba(15, 23, 42, .045);
}

.permission-group-heading {
    align-items: center;
    border-bottom: 1px solid #edf1f5;
    color: #1e293b;
    display: flex;
    justify-content: space-between;
    margin: -.15rem 0 .75rem;
    padding: 0 0 .75rem;
}

.permission-group-heading > span {
    align-items: center;
    background: #f1f5f9;
    border-radius: 999px;
    color: #64748b;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 700;
    height: 1.5rem;
    justify-content: center;
    min-width: 1.5rem;
    padding: 0 .4rem;
}

.permission-check-list {
    display: grid;
    gap: .4rem;
}

.permission-check-row {
    align-items: center;
    background: #f8fafc;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #334155;
    cursor: pointer;
    display: flex;
    font-size: .91rem;
    gap: .7rem;
    line-height: 1.4;
    margin: 0;
    min-height: 44px;
    padding: .58rem .7rem;
    transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}

.permission-check-row:hover {
    background: #f1f5f9;
    border-color: #dbe3ed;
}

.permission-check-row:has(input:checked) {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e3a8a;
}

.permission-check-row input[type="checkbox"] {
    accent-color: #2563eb;
    cursor: pointer;
    flex: 0 0 17px;
    height: 17px;
    margin: 0;
    width: 17px;
}

.permission-check-copy {
    min-width: 0;
}

.permission-check-copy small {
    background: #dbeafe;
    border-radius: 999px;
    color: #1d4ed8;
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    margin-left: .25rem;
    padding: .13rem .4rem;
    vertical-align: .08rem;
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .customer-filter-footer,
    .customer-pagination-footer,
    .customer-form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .customer-filter-actions,
    .customer-filter-actions .btn,
    .customer-form-actions .btn,
    .customer-management-hero .btn,
    .customer-detail-header-actions,
    .customer-detail-header-actions .btn {
        width: 100%;
    }

    .customer-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Keep filter controls aligned and evenly sized across listing pages. */
.card-body .list-filter-form .form-row,
.card-body .customer-filter-form .form-row,
.card-body .stock_history_filter_form .form-row,
.card-body .invoice-filter-form .form-row:not(.invoice-filter-button-row) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
    column-gap: 12px;
    row-gap: 0;
    margin-left: 0;
    margin-right: 0;
}

.card-body .list-filter-form .form-row > .form-group,
.card-body .customer-filter-form .form-row > .form-group,
.card-body .stock_history_filter_form .form-row > .form-group,
.card-body .invoice-filter-form .form-row:not(.invoice-filter-button-row) > .form-group {
    width: auto;
    max-width: none;
    min-width: 0 !important;
    flex: none;
    padding-left: 0;
    padding-right: 0;
}

.card-body .list-filter-form .form-row > .form-group > label,
.card-body .customer-filter-form .form-row > .form-group > label,
.card-body .stock_history_filter_form .form-row > .form-group > label,
.card-body .invoice-filter-form .form-row:not(.invoice-filter-button-row) > .form-group > label {
    display: block;
    min-height: 2em;
}
