/* ============================================================
   DESIGN SYSTEM — ROSE DIEP Admin | Clean White Sidebar
   ============================================================ */
:root {
    --app-primary:            #7c3aed;
    --app-primary-2:          #8b5cf6;
    --app-primary-soft:       #f3e8ff;
    --app-accent:             var(--app-primary);
    --app-accent-dark:        #6d28d9;
    --app-accent-soft:        var(--app-primary-soft);
    --bs-primary:             var(--app-primary);

    --app-bg:                 #f6f8fb;
    --app-card-bg:            #ffffff;

    --app-text:               #1f2937;
    --app-muted:              #6b7280;
    --app-border:             #e5e7eb;

    --app-table-head:         #f7f5ff;
    --app-table-border:       #ded8f5;
    --app-table-border-soft:  #ece8fb;
    --app-row-hover:          #fbfaff;

    --app-success:            #22c55e;
    --app-success-soft:       #dcfce7;
    --app-danger:             #ef4444;
    --app-danger-soft:        #fee2e2;
    --app-warning:            #f59e0b;
    --app-warning-soft:       #fef3c7;
    --app-info:               #0ea5e9;
    --app-info-soft:          #e0f2fe;

    --app-sidebar-bg:         #ffffff;
    --app-sidebar-hover:      var(--app-primary-soft);
    --app-sidebar-text:       #475569;
    --app-sidebar-text-muted: #94a3b8;

    --bs-sidebar-width:       260px;

    --app-content-padding-top: 8px;
    --app-content-padding-x: 4px;
    --app-content-padding-bottom: 6px;
    --app-section-gap: 4px;
    --app-card-gap: 4px;
}

/* ============================================================
   TYPOGRAPHY — Inter Font
   ============================================================ */
body,
.form-control,
.form-select,
.btn {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

/* ============================================================
   GLOBAL PAGE BACKGROUND
   ============================================================ */
body {
    background: var(--app-page-bg);
    color: var(--app-text-primary);
    font-size: 0.875rem;
    line-height: 1.6;
}

/* ============================================================
   BORDER RADIUS — Uniform overrides
   ============================================================ */
.card,
.modal-content,
.dropdown-menu {
    border-radius: 0.5rem !important;
}

.card-header,
.card-footer {
    border-radius: 0 !important;
}

.form-control,
.form-select,
.input-group,
.input-group-text,
.ajax-select-menu,
.toolbar-control,
.sheet-date-control .form-control,
.sheet-collector-input,
.sheet-money-input,
.sheet-note-input {
    border-radius: 0.375rem !important;
}

.btn,
.btn-sm,
.btn-lg {
    border-radius: 0.375rem !important;
}

.badge {
    border-radius: 0.25rem !important;
}

.alert {
    border-radius: 0.5rem !important;
}

.nav-tabs .nav-link,
.nav-pills .nav-link {
    border-radius: 0.375rem !important;
}

.quick-stat-card,
.quick-panel,
.sheet-header.card,
.sheet-workspace.card,
.sheet-table-wrap,
.quick-mini-stat,
.customer-owner-tab {
    border-radius: 0.5rem !important;
}

.app-content .row.g-4,
.app-content .row.g-3 {
    --bs-gutter-x: var(--app-card-gap);
    --bs-gutter-y: var(--app-card-gap);
}

.app-content .mb-4 {
    margin-bottom: var(--app-section-gap) !important;
}

.app-content .card + .card,
.app-content form + .card,
.app-content .card + form {
    margin-top: var(--app-section-gap);
}

.app-alerts-area {
    margin-bottom: 0;
}

.app-alerts-area .alert {
    margin-bottom: var(--app-section-gap);
}

/* ============================================================
   GLOBAL TABLE HEADER STYLING
   ============================================================ */
.table thead th,
.table th,
.sheet-table thead th,
.quick-table th {
    background-color: #f8f9fb !important;
    color: #374151 !important;
    font-weight: 600 !important;
    font-size: 0.7rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
    border-bottom: 2px solid var(--app-border) !important;
    padding-top: 0.65rem !important;
    padding-bottom: 0.65rem !important;
}

/* ============================================================
   SIDEBAR — Dark Navy Style
   ============================================================ */
#layout-menu.layout-menu {
    background-color: var(--app-sidebar-bg) !important;
    border-right: none !important;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15) !important;
}

/* App brand (logo area) */
#layout-menu .app-brand {
    padding: 1.25rem 1rem 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

#layout-menu .app-brand .layout-menu-toggle {
    position: static !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
}

#layout-menu .app-brand .layout-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.16) !important;
    color: #ffffff !important;
}

#layout-menu .app-brand .layout-menu-toggle i {
    font-size: 1.15rem !important;
    color: #ffffff !important;
}

/* Handle collapsed state styling in brand area */
.layout-menu-collapsed #layout-menu .app-brand-link {
    display: none !important;
}

.layout-menu-collapsed #layout-menu .app-brand {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.layout-menu-collapsed #layout-menu .app-brand .layout-menu-toggle {
    display: flex !important;
    margin: 0 auto !important;
}

/* Rotate toggle icon and add transition */
#layout-menu .app-brand .layout-menu-toggle i {
    transition: transform 0.25s ease !important;
}

.layout-menu-collapsed #layout-menu .app-brand .layout-menu-toggle i {
    transform: rotate(180deg) !important;
}

/* Hide menu headers (ugly horizontal lines) when sidebar is collapsed */
.layout-menu-collapsed:not(.layout-menu-hover) #layout-menu .menu-header {
    display: none !important;
}

#layout-menu .app-brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

#layout-menu .app-brand-logo {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--app-accent);
    border-radius: 0.375rem;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

#layout-menu .app-brand-logo .text-primary {
    color: #fff !important;
}

#layout-menu .app-brand-text {
    color: #fff !important;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Toggle button on mobile */
#layout-menu .layout-menu-toggle {
    color: var(--app-sidebar-text) !important;
}

@media (min-width: 1200px) {
    #layout-menu .layout-menu-toggle {
        display: none !important;
    }
}

/* Menu inner container */
#layout-menu .menu-inner {
    padding: 1rem 0;
}

/* Section labels (menu dividers) */
#layout-menu .menu-header {
    color: rgba(255, 255, 255, 0.4) !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    letter-spacing: 1.2px !important;
    text-transform: uppercase !important;
    padding: 1.25rem 1.25rem 0.4rem !important;
    margin-top: 0.5rem;
}

/* Menu items */
#layout-menu .menu-item {
    margin: 0.2rem 0.75rem !important;
    position: relative;
}

#layout-menu .menu-link {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 0.65rem 0.85rem !important;
    border-radius: 0.375rem !important;
    color: var(--app-sidebar-text) !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    white-space: nowrap;
}

#layout-menu .menu-link:hover {
    background-color: rgba(255, 255, 255, 0.06) !important;
    color: #ffffff !important;
}

/* Active menu link state */
#layout-menu .menu-item.active>.menu-link {
    background-color: var(--app-accent) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(105, 108, 255, 0.25) !important;
}

#layout-menu .menu-item.active>.menu-link .menu-icon {
    color: #ffffff !important;
}

#layout-menu .menu-icon {
    font-size: 1.15rem !important;
    width: 1.25rem !important;
    text-align: center !important;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.55) !important;
    transition: color 0.2s ease !important;
}

#layout-menu .menu-link:hover .menu-icon {
    color: #ffffff !important;
}

/* Hide Sneat's default active indicators (ugly blue bars sticking out) */
.menu-vertical .menu-item.active::before,
.menu-vertical .menu-item.active::after {
    display: none !important;
}

#layout-menu .menu-divider {
    border-color: rgba(255, 255, 255, 0.08) !important;
    margin: 0.5rem 1.25rem !important;
}

/* Menu inner shadow */
#layout-menu .menu-inner-shadow {
    background: linear-gradient(var(--app-sidebar-bg) 5%, rgba(26, 34, 52, 0) 100%) !important;
}

/* ============================================================
   TOPBAR / HEADER
   ============================================================ */
#layout-navbar {
    background: #fff !important;
    border-bottom: 1px solid var(--app-border) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
    padding-top: 0.625rem !important;
    padding-bottom: 0.625rem !important;
}

.layout-page-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--app-text-primary);
    margin: 0;
}

/* ============================================================
   CARD STYLES
   ============================================================ */
.card {
    border: 1px solid var(--app-border) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.card-header {
    background: #fff !important;
    border-bottom: 1px solid var(--app-border) !important;
    padding: 1rem 1.25rem !important;
}

.card-title {
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    color: var(--app-text-primary) !important;
    margin-bottom: 0 !important;
}

.card-body {
    padding: 1.25rem !important;
}

/* Page card (main content card) */
.page-card {
    border-radius: 0.5rem !important;
    overflow: hidden;
}

/* ============================================================
   BUTTONS — Override Bootstrap defaults
   ============================================================ */
.btn-primary {
    background-color: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--app-accent-dark) !important;
    border-color: var(--app-accent-dark) !important;
}

.btn-outline-primary {
    color: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary.active,
.btn-outline-primary:active {
    background-color: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
    color: #fff !important;
}

.btn-outline-primary.active[data-days] {
    background-color: var(--app-accent) !important;
    color: #fff !important;
}

/* ============================================================
   FORM CONTROLS
   ============================================================ */
.form-control,
.form-select {
    border-color: var(--app-border) !important;
    color: var(--app-text-primary) !important;
    font-size: 0.875rem !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 3px rgba(105, 108, 255, 0.15) !important;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--app-text-secondary);
    margin-bottom: 0.35rem;
}

/* ============================================================
   BADGES — Role/Status
   ============================================================ */
.badge {
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    padding: 0.25em 0.55em !important;
}

.bg-label-primary {
    background-color: var(--app-accent-soft) !important;
    color: var(--app-accent-dark) !important;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border-left: 3px solid currentColor;
    font-size: 0.875rem;
}

/* ============================================================
   MODAL
   ============================================================ */
.app-modal .modal-header {
    background: #f8f9fb;
    border-bottom: 1px solid var(--app-border);
    padding: 1rem 1.25rem;
}

.app-modal-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--app-text-primary);
}

.app-modal .modal-footer {
    background: #f8f9fb;
    border-top: 1px solid var(--app-border);
}

.app-brand-text {
    letter-spacing: 0;
    line-height: 1.1;
}

/* layout-page-title now overridden by design system above */

.metric-card .card-body {
    min-height: 5rem;
}

/* Metric card inline layout (icon left, text right) */
.metric-card-inline {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem !important;
}

.metric-icon {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    flex-shrink: 0;
}

.metric-icon.success {
    background: var(--app-success-soft);
    color: var(--app-success);
}

.metric-icon.danger {
    background: var(--app-danger-soft);
    color: var(--app-danger);
}

.metric-icon.secondary {
    background: #f3f4f6;
    color: var(--app-text-muted);
}

.metric-icon.warning {
    background: var(--app-warning-soft);
    color: var(--app-warning);
}

.metric-icon.info {
    background: var(--app-info-soft);
    color: var(--app-info);
}

.metric-label {
    color: var(--app-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: .3rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.metric-value {
    color: var(--app-text-primary);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    word-break: break-word;
}

.table th {
    color: #566a7f;
    font-size: .75rem;
    font-weight: 700;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

.table-info-card,
.table-info-card td,
.table-info-card th {
    border: none !important;
    background: transparent !important;
}

.table-info-card> :not(caption)>*>* {
    border-bottom-width: 0 !important;
    border-top-width: 0 !important;
    --bs-table-border-color: transparent;
    box-shadow: none !important;
}

.table-responsive {
    min-height: .01%;
}

.action-buttons {
    display: flex;
    gap: .35rem;
    justify-content: center;
    flex-wrap: nowrap;
}

.customer-owner-tabs {
    display: flex;
    align-items: stretch;
    gap: .75rem;
    padding: 1.25rem 1.25rem 0;
    flex-wrap: wrap;
}

.customer-owner-tab {
    min-width: 10rem;
    min-height: 3.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1rem;
    border: 1px solid #e4e7ec;
    border-radius: .5rem;
    color: #566a7f;
    background: #fff;
    text-decoration: none;
    transition: all .2s ease;
}

.customer-owner-tab:hover {
    color: var(--app-accent);
    border-color: rgba(105, 108, 255, 0.4);
    background: var(--app-accent-soft);
}

.customer-owner-tab.active {
    color: #fff;
    border-color: var(--app-accent);
    background: var(--app-accent);
    box-shadow: 0 .25rem .75rem rgba(105, 108, 255, .3);
}

.customer-owner-tab span {
    font-weight: 600;
    font-size: 0.8125rem;
}

.customer-owner-tab strong {
    min-width: 2rem;
    text-align: center;
    font-size: 1.1rem;
    line-height: 1;
    font-weight: 700;
}

.customer-duplicate-row {
    --bs-table-bg: #fff1f2;
    --bs-table-striped-bg: #ffe4e6;
    --bs-table-hover-bg: #fecdd3;
}

.customer-duplicate-row td {
    color: #9f1239;
    font-weight: 600;
}

.btn-icon {
    width: 2rem;
    height: 2rem;
}

.search-bar {
    max-width: 460px;
}

.contract-status-filter .form-select {
    min-width: 7.25rem;
    padding-right: 2.25rem;
}

.badge {
    font-weight: 600;
}

.reconciliation-result .amount {
    font-size: 1.25rem;
    font-weight: 700;
}

.form-hint {
    color: #697a8d;
    font-size: .8125rem;
}

.ajax-select {
    position: relative;
}

.ajax-select-menu {
    position: absolute;
    top: calc(100% + .25rem);
    left: 0;
    right: 0;
    z-index: 1080;
    max-height: 16rem;
    overflow-y: auto;
    border: 1px solid #d9dee3;
    border-radius: .375rem;
    background: #fff;
    box-shadow: 0 .25rem 1rem rgba(67, 89, 113, .12);
}

.ajax-select-option {
    width: 100%;
    border: 0;
    border-bottom: 1px solid #f1f1f2;
    background: transparent;
    padding: .65rem .85rem;
    text-align: left;
}

.ajax-select-option:hover,
.ajax-select-option:focus {
    background: #f5f5f9;
}

.ajax-select-option:last-child {
    border-bottom: 0;
}

.ajax-select-option-title {
    display: block;
    color: #384551;
    font-weight: 600;
    line-height: 1.25;
}

.ajax-select-option-description {
    display: block;
    color: #697a8d;
    font-size: .8125rem;
    line-height: 1.25;
    margin-top: .15rem;
}

.quick-payment-page {
    color: #2f3a4a;
}

.quick-payment-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.toolbar-control {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 2.75rem;
    padding: 0 .85rem;
    border: 1px solid #d9dee3;
    border-radius: .45rem;
    background: #fff;
    box-shadow: 0 .125rem .375rem rgba(67, 89, 113, .05);
}

.toolbar-control i {
    color: #697a8d;
    font-size: 1.1rem;
}

.toolbar-date {
    width: 12.5rem;
}

.toolbar-search {
    flex: 1 1 24rem;
    max-width: 34rem;
}

.toolbar-filter-group {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.quick-stat-card,
.quick-panel {
    border: 1px solid #e4e7ec;
    border-radius: .5rem;
    background: #fff;
    box-shadow: 0 .125rem .5rem rgba(67, 89, 113, .08);
}

.quick-stat-card {
    min-height: 7rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
}

.quick-stat-icon {
    width: 3.5rem;
    height: 3.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .75rem;
    font-size: 1.75rem;
}

.quick-stat-icon.purple {
    color: var(--app-accent);
    background: var(--app-accent-soft);
}

.quick-stat-icon.green {
    color: #1aa66a;
    background: #e3f7eb;
}

.quick-stat-icon.amber {
    color: #d99016;
    background: #fff2d6;
}

.quick-stat-label {
    color: #566a7f;
    font-weight: 600;
    margin-bottom: .35rem;
}

.quick-stat-value {
    font-size: 1.75rem;
    line-height: 1.1;
    font-weight: 800;
}

.quick-panel.card {
    border-radius: .5rem;
}

.quick-panel .card-header,
.quick-panel .card-footer {
    background: #fff;
    border-color: #e4e7ec;
}

.quick-table-wrap {
    overflow-x: visible;
}

.quick-table {
    width: 100%;
    table-layout: fixed;
}

.quick-table th,
.quick-table td {
    padding-right: .6rem;
    padding-left: .6rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-customer-col {
    width: 18%;
}

.quick-phone-col {
    width: 13%;
}

.quick-contract-col {
    width: 24%;
}

.quick-money-col {
    width: 15%;
}

.quick-debt-col {
    width: 14%;
}

.quick-action-col {
    width: 9rem;
}

.quick-table .quick-money-col,
.quick-table .quick-debt-col,
.quick-table .quick-action-col {
    white-space: nowrap;
}

.quick-table th:nth-child(4),
.quick-table td:nth-child(4),
.quick-table th:nth-child(5),
.quick-table td:nth-child(5),
.quick-table th:nth-child(6),
.quick-table td:nth-child(6) {
    white-space: nowrap;
}

.quick-table tbody tr {
    transition: background-color .15s ease;
}

.quick-table tbody tr.selected-row {
    background: #f4f2ff;
}

.quick-product-name {
    max-width: 100%;
}

.quick-actions {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    justify-content: flex-end;
    min-width: 7.25rem;
    white-space: nowrap;
}

.quick-actions .btn-sm {
    min-width: 3.2rem;
    padding-right: .5rem;
    padding-left: .5rem;
}

.quick-form-card {
    position: sticky;
    top: 5.5rem;
}

.quick-customer-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.quick-avatar {
    width: 3.75rem;
    height: 3.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--app-accent);
    background: var(--app-accent-soft);
    font-size: 2rem;
}

.quick-readonly-control {
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    background: #fff;
}

.quick-mini-stat {
    min-height: 5rem;
    padding: 1rem;
    border-radius: .45rem;
    background: #f8f9fb;
}

.quick-mini-stat span {
    display: block;
    color: #566a7f;
    font-size: .8125rem;
    font-weight: 600;
    margin-bottom: .5rem;
}

.quick-mini-stat strong {
    display: block;
    color: #2f3a4a;
    font-size: 1.1rem;
    line-height: 1.2;
}

/* ============================================================
   DAILY SHEET / THU TIỀN THEO NGÀY (Payment Page)
   ============================================================ */

.daily-sheet-page {
    color: #334155;
    font-family: var(--font-family-modern);
}

/* Header card styling (Toolbar & Date Picker) */
.sheet-header.card {
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(105, 108, 255, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    margin-bottom: 1.5rem;
    padding: 1.75rem 2rem;
    transition: all 0.3s ease;
}

.sheet-header.card:hover {
    box-shadow: 0 15px 35px rgba(105, 108, 255, 0.08);
}

.sheet-toolbar-row1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

/* Date navigation group */
.sheet-date-nav-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sheet-date-nav-group .btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50% !important;
    /* Làm nút chuyển ngày tròn trịa */
    border: 1.5px solid rgba(105, 108, 255, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    background: #fff;
    color: var(--app-accent);
}

.sheet-date-nav-group .btn-icon:hover {
    border-color: var(--app-accent);
    background: #f1f0ff;
    transform: scale(1.05);
}

.sheet-date-input {
    border: 1.5px solid rgba(105, 108, 255, 0.15) !important;
    border-radius: 0.75rem !important;
    padding: 0.5rem 0.85rem !important;
    font-size: 0.875rem !important;
    background: #fff !important;
    max-width: 9.5rem;
    transition: all 0.25s ease !important;
}

.sheet-date-input:focus {
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 4px rgba(105, 108, 255, 0.12) !important;
}

.sheet-date-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2b3044;
    margin-left: 0.5rem;
    letter-spacing: -0.2px;
}

/* Toolbar search, filter, print */
.sheet-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sheet-search-control {
    width: 16rem;
}

.sheet-search-control .form-control {
    border: 1.5px solid rgba(105, 108, 255, 0.15) !important;
    border-radius: 0.75rem !important;
    padding: 0.55rem 1rem !important;
    background: #fff !important;
    font-size: 0.875rem !important;
}

.sheet-search-control .form-control:focus {
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 4px rgba(105, 108, 255, 0.12) !important;
}

.sheet-toolbar-actions .btn-outline-primary {
    border: 1.5px solid var(--app-accent);
    color: var(--app-accent);
    border-radius: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.sheet-toolbar-actions .btn-outline-primary:hover {
    background: var(--app-accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(105, 108, 255, 0.2);
}

.sheet-print-current {
    border: 1.5px solid rgba(105, 108, 255, 0.2) !important;
    color: #566a7f !important;
    background: #fff !important;
    border-radius: 0.75rem !important;
    font-weight: 700 !important;
    font-size: 0.875rem !important;
    padding: 0.55rem 1.25rem !important;
    transition: all 0.25s ease !important;
}

.sheet-print-current:hover {
    border-color: var(--app-accent) !important;
    color: var(--app-accent) !important;
    background: #f1f0ff !important;
    transform: translateY(-1px);
}

/* Stats section - Glowing panels */
.sheet-stats-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    border-top: 1px solid rgba(226, 232, 240, 0.6);
    padding-top: 1.25rem;
}

.sheet-stat-card {
    flex: 1 1 15rem;
    min-height: 5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.1rem 1.5rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 0.85rem;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sheet-stat-card:hover {
    border-color: rgba(105, 108, 255, 0.25);
    box-shadow: 0 8px 24px rgba(105, 108, 255, 0.04);
    transform: translateY(-2px);
}

.sheet-stat-icon {
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.65rem;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.sheet-stat-icon.success {
    color: #22c55e;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.03) 100%);
}

.sheet-stat-icon.warning {
    color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.03) 100%);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-info span {
    color: #64748b;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.stat-info strong {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.25;
    margin-top: 0.15rem;
}

/* Workspace main area */
.sheet-workspace.card {
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
    background: #fff;
    margin-bottom: 1.5rem;
    padding: 2rem;
}

/* Pills Custom Tabs style for Sheets */
.sheet-tabs {
    border-bottom: none;
    background: #f1f3f9;
    padding: 0.3rem;
    border-radius: 0.75rem !important;
    display: inline-flex;
    gap: 0.25rem;
    margin-bottom: 1.75rem;
}

.sheet-tabs .nav-item {
    margin-bottom: 0;
}

.sheet-tabs .nav-link {
    min-width: 9.5rem;
    border: none !important;
    border-radius: 0.55rem !important;
    color: #64748b !important;
    font-weight: 700;
    font-size: 0.825rem;
    padding: 0.6rem 1.25rem !important;
    background: transparent !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sheet-tabs .nav-link:hover {
    color: var(--app-accent) !important;
    background: rgba(255, 255, 255, 0.6) !important;
}

.sheet-tabs .nav-link.active {
    color: #fff !important;
    background: var(--app-accent) !important;
    box-shadow: 0 6px 16px rgba(105, 108, 255, 0.25) !important;
}

.sheet-tabs .nav-link.active::after {
    display: none;
    /* Bỏ gạch chân active tab kiểu cũ */
}

/* Table wrapper & Table styles */
.sheet-table-wrap {
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.01);
    background: #fff;
}

.sheet-collector-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    background: #f8fafc;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

.sheet-collector-label {
    margin: 0;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 700;
}

.sheet-collector-input {
    max-width: 18rem;
    min-height: 2.3rem;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 0.5rem !important;
    background: #fff !important;
    font-size: 0.875rem !important;
    padding: 0.4rem 0.75rem !important;
}

.sheet-collector-input:focus {
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 4px rgba(105, 108, 255, 0.1) !important;
}

.sheet-table {
    table-layout: fixed;
    margin-bottom: 0;
    width: 100%;
}

.sheet-table thead th {
    background: var(--app-accent-soft) !important;
    color: var(--app-accent) !important;
    font-weight: 700 !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-bottom: 2px solid rgba(105, 108, 255, 0.25) !important;
    vertical-align: middle;
    padding: 0.95rem 0.75rem;
}

.sheet-table tbody td {
    vertical-align: middle;
    border-color: #f1f5f9;
    padding: 0.75rem 0.75rem;
}

.sheet-table tbody tr {
    transition: all 0.2s ease;
}

.sheet-table tbody tr:hover {
    background: rgba(105, 108, 255, 0.015);
}

/* Selected row highlight effect */
.sheet-table tbody tr.is-selected {
    background: rgba(105, 108, 255, 0.04) !important;
    box-shadow: inset 4px 0 0 var(--app-accent) !important;
}

.sheet-table tbody tr.sheet-row-warning {
    background: #fff5f5;
}

.sheet-table tbody tr.sheet-row-warning:hover {
    background: #ffebeb;
}

.sheet-stt-col {
    width: 4rem;
    text-align: center;
}

.sheet-customer-col {
    width: 32%;
}

.sheet-phone-col {
    width: 10rem;
}

.sheet-money-col {
    width: 16%;
    text-align: center;
}

.row-index {
    text-align: center;
    font-weight: 700;
    color: #94a3b8;
    font-size: 0.85rem;
}

.sheet-customer-name {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.925rem;
    transition: color 0.2s ease;
}

.sheet-table tr.is-selected .sheet-customer-name {
    color: var(--app-accent);
}

.sheet-table small {
    display: block;
    color: #94a3b8;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.sheet-phone-display {
    color: #475569;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    font-size: 0.85rem;
}

.sheet-status {
    margin-top: 0.35rem;
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.725rem;
}

/* Minimal input fields inside table */
.sheet-money-input {
    min-height: 2.5rem;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: #2b3044;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 0.5rem !important;
    background: #fafafa !important;
    transition: all 0.2s ease !important;
    padding: 0.35rem 0.5rem !important;
    width: 100%;
}

.sheet-money-input:focus {
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 4px rgba(105, 108, 255, 0.12) !important;
    background: #fff !important;
}

.sheet-money-input::placeholder {
    color: #cbd5e1;
    font-weight: 400;
}

/* Table footer styling */
.sheet-table tfoot td {
    background: #f8fafc;
    font-weight: 700;
    padding: 0.95rem;
    border-top: 2px solid #e2e8f0;
}

.sheet-total {
    color: var(--app-accent);
    font-size: 1.15rem;
    font-weight: 800;
}

/* Customer Detail Panel (Floating Sidebar) */
.customer-detail-panel {
    position: sticky;
    top: 5.5rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    transition: all 0.3s ease;
}

.customer-detail-panel:hover {
    box-shadow: 0 15px 30px rgba(105, 108, 255, 0.05);
}

.customer-detail-panel h6 {
    padding: 1.5rem 1.5rem 0;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.725rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0;
}

.customer-detail-panel h5 {
    padding: 0.5rem 1.5rem 1.25rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
}

.detail-lines {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    margin: 0;
}

.detail-lines div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.detail-lines div:last-child {
    margin-bottom: 0;
}

.detail-lines span {
    color: #64748b;
    font-weight: 600;
    font-size: 0.825rem;
}

.detail-lines strong {
    font-size: 0.925rem;
    font-weight: 700;
    color: #334155;
}

.detail-section-title {
    display: block;
    margin-bottom: 0.85rem;
    color: #1e293b !important;
    font-size: 0.825rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#detailTodaySection {
    background: rgba(34, 197, 94, 0.02);
}

#detailTodaySection .detail-section-title {
    color: #16a34a !important;
}

.detail-session-row {
    font-size: 0.85rem;
}

.detail-today-s,
.detail-today-c {
    color: #16a34a !important;
}

/* Highlight box: remaining amount after collection */
.detail-after {
    margin: 0 1.5rem 1.25rem;
    padding: 1.1rem;
    border: 1.5px dashed #fcd34d;
    border-radius: 0.75rem;
    background: #fffbeb;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-after span {
    color: #b45309;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-after strong {
    color: #92400e;
    font-size: 1.25rem;
    font-weight: 800;
}

.customer-detail-panel .detail-history-link {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 1.5rem 1.5rem;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 0.75rem;
    padding: 0.6rem 1rem;
    border: 1.5px solid var(--app-accent);
    color: var(--app-accent);
    background: #fff;
    transition: all 0.25s ease;
}

.customer-detail-panel .detail-history-link:hover {
    background: var(--app-accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(105, 108, 255, 0.2);
}

/* ============================================================
   STICKY BOTTOM FOOTER BAR (Tối ưu hóa trải nghiệm thao tác lưu)
   ============================================================ */
.sheet-footer-bar.card {
    position: sticky;
    bottom: 0.75rem;
    /* Bay lơ lửng một chút so với đáy trang */
    z-index: 99;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 1rem;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.03), 0 10px 30px rgba(105, 108, 255, 0.08);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 1.1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
    transition: all 0.3s ease;
}

.sheet-footer-bar span {
    font-weight: 700;
    margin-right: 0.5rem;
    color: #64748b;
    font-size: 0.95rem;
}

.sheet-footer-bar strong {
    font-size: 1.45rem;
    color: #16a34a;
    font-weight: 800;
}

.sheet-footer-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sheet-footer-actions .btn-outline-primary {
    border: 1.5px solid rgba(105, 108, 255, 0.3);
    color: #566a7f;
    background: #fff;
    border-radius: 0.75rem;
    font-weight: 700;
    padding: 0.6rem 1.25rem;
    transition: all 0.25s ease;
}

.sheet-footer-actions .btn-outline-primary:hover {
    border-color: var(--app-accent);
    color: var(--app-accent);
    background: #f1f0ff;
    transform: translateY(-1px);
}

.sheet-footer-actions .btn-primary {
    background: linear-gradient(135deg, var(--app-accent) 0%, var(--app-accent-dark) 100%);
    border: none;
    border-radius: 0.75rem;
    font-weight: 800;
    padding: 0.6rem 1.75rem;
    color: #fff;
    box-shadow: 0 4px 16px rgba(105, 108, 255, 0.35);
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.sheet-footer-actions .btn-primary:hover {
    background: linear-gradient(135deg, var(--app-accent-dark) 0%, var(--app-accent) 100%);
    box-shadow: 0 8px 24px rgba(105, 108, 255, 0.45);
    transform: translateY(-2px);
}

/* Badge variants */
.bg-label-secondary {
    background: #f1f5f9 !important;
    color: #64748b !important;
}

.bg-label-success {
    background: #ecfdf5 !important;
    color: #16a34a !important;
}

.bg-label-warning {
    background: #fff7ed !important;
    color: #d97706 !important;
}

.bg-label-danger {
    background: #fef2f2 !important;
    color: #ef4444 !important;
}

.bg-info {
    background: #6366f1 !important;
}

.bg-success {
    background: #22c55e !important;
}

.bg-danger {
    background: #ef4444 !important;
}

.bg-warning {
    background: #f59e0b !important;
    color: #1e293b !important;
}


/* Card body for forms */
.card-body {
    padding: 1.5rem;
}

/* Form control general enhancements */
.form-control,
.form-select,
textarea {
    border: 1.5px solid #d9dee3 !important;
    border-radius: 10px !important;
    padding: 0.6rem 0.95rem !important;
    font-size: 0.875rem !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    color: #384551 !important;
    background-color: #fcfdfe !important;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    background-color: #ffffff !important;
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 4px rgba(105, 108, 255, 0.1) !important;
}

.form-label {
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    color: #566a7f !important;
    margin-bottom: 0.4rem !important;
}

@media (max-width: 767.98px) {
    .content-wrapper>.container-xxl {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .layout-page-title {
        font-size: 1.1rem;
    }

    .metric-value {
        font-size: 1.2rem;
    }

    .search-bar {
        max-width: none;
        width: 100%;
    }

    .search-bar>.col,
    .search-bar>.col-auto,
    .contract-status-filter .form-select {
        width: 100%;
    }

    .mobile-stack {
        flex-direction: column;
        align-items: stretch !important;
    }

    .quick-payment-toolbar,
    .toolbar-filter-group {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar-date,
    .toolbar-search,
    .toolbar-filter-group .btn,
    .quick-payment-toolbar>.btn {
        width: 100%;
        max-width: none;
    }

    .quick-stat-card {
        min-height: 6rem;
    }

    .quick-form-card {
        position: static;
    }

    .sheet-header.card,
    .sheet-workspace.card,
    .sheet-footer-bar.card {
        padding: 1rem;
    }

    .sheet-date-control,
    .sheet-stats,
    .sheet-stat-card,
    .sheet-footer-actions,
    .sheet-footer-actions .btn {
        width: 100%;
    }

    .sheet-tabs .nav-link {
        min-width: 7.5rem;
    }

    .customer-detail-panel {
        position: static;
    }

    .card-body {
        padding: 1.25rem;
    }
}

/* Full-page payment sheet mode, matching the provided reference screen. */
body:has(.daily-sheet-page) {
    background: #f8fafc;
}

body:has(.daily-sheet-page) .content-footer {
    display: none;
}

.layout-wrapper:has(.daily-sheet-page),
.layout-wrapper:has(.daily-sheet-page) .layout-container,
.layout-wrapper:has(.daily-sheet-page) .layout-page,
.layout-wrapper:has(.daily-sheet-page) .content-wrapper {
    min-height: 100vh;
    width: 100%;
    background: #f8fafc;
}

.layout-wrapper:has(.daily-sheet-page) main.container-xxl {
    max-width: 100%;
    width: 100%;
    padding: 1rem 1.5rem !important;
}

.layout-wrapper:has(.daily-sheet-page) .alert {
    max-width: 1400px;
    margin-right: auto;
    margin-left: auto;
}

/* Daily Sheet Page Container */
.daily-sheet-page {
    --sheet-primary: #7c3aed;
    --sheet-primary-light: #f3e8ff;
    --sheet-primary-border: #ddd6fe;
    --sheet-border: #e8e3f8;
    --sheet-text: #1e293b;
    --sheet-muted: #64748b;
    --sheet-bg-blue: #f7f5ff;
    --sheet-bg-blue-dark: #5b21b6;
    --sheet-success: #22c55e;
    --sheet-warning: #f97316;
    --sheet-danger: #ef4444;

    width: 100%;
    max-width: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Header & Toolbar Styling */
.daily-sheet-page .sheet-header.card {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--sheet-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 0;
}

.daily-sheet-page .sheet-title-row {
    margin-bottom: 1.25rem;
}

.daily-sheet-page .sheet-title-row h4 {
    color: #0f172a;
    font-size: 1.5rem;
    font-weight: 700;
}

.daily-sheet-page .sheet-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* === Toolbar Row 1: Date nav + search + actions === */
.daily-sheet-page .sheet-toolbar-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.daily-sheet-page .sheet-date-nav-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.daily-sheet-page .sheet-date-input {
    width: 10rem;
    height: 2.5rem;
    border: 1px solid var(--sheet-border);
    border-radius: 8px;
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--sheet-text);
    padding: 0.375rem 0.75rem;
    text-align: center;
}

.daily-sheet-page .sheet-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

/* === Stats Row 2 === */
.daily-sheet-page .sheet-stats-row {
    display: flex;
    gap: 0.35rem;
    padding-top: 0.4rem;
    margin-top: 0.25rem;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

.daily-sheet-page .sheet-stats-row .sheet-stat-card {
    flex: 1;
    min-width: 13rem;
}

/* === Stat Cards === */
.daily-sheet-page .sheet-stat-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--sheet-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.daily-sheet-page .sheet-header .btn-icon {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--sheet-border);
    border-radius: 8px;
    color: var(--sheet-muted);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1.25rem;
}

.daily-sheet-page .sheet-header .btn-icon:hover {
    color: var(--sheet-primary);
    border-color: var(--sheet-primary);
    background: #f5f3ff;
}

.daily-sheet-page .sheet-date-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--sheet-text);
    margin-left: 0.5rem;
}

.daily-sheet-page .sheet-search-control {
    width: min(18rem, 100%);
}

.daily-sheet-page .sheet-search-control .form-control {
    height: 2.75rem;
    border: 1px solid var(--sheet-border);
    border-radius: 8px;
    font-size: 0.95rem;
}

/* sheet-stats-row và sheet-stat-card đã được định nghĩa ở trên */

.daily-sheet-page .sheet-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 8px;
    font-size: 1.35rem;
    background: #f8fafc;
    flex-shrink: 0;
}

.daily-sheet-page .sheet-stat-icon.success {
    color: var(--sheet-success);
    background: #f0fdf4;
}

.daily-sheet-page .sheet-stat-icon.warning {
    color: var(--sheet-warning);
    background: #fff7ed;
}

.daily-sheet-page .sheet-stat-card .stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.daily-sheet-page .sheet-stat-card span {
    font-size: 0.78rem;
    color: var(--sheet-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.daily-sheet-page .sheet-stat-card strong {
    font-size: 1.15rem;
    font-weight: 800;
}


.daily-sheet-page .sheet-header .sheet-print-current {
    height: 2.75rem;
    padding: 0 1.25rem;
    border: 1px solid var(--sheet-primary);
    border-radius: 8px;
    color: var(--sheet-primary);
    background: #fff;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.daily-sheet-page .sheet-header .sheet-print-current:hover {
    background: var(--sheet-primary);
    color: #fff;
}

/* Workspace Styling */
.daily-sheet-page .sheet-workspace.card {
    padding: 0.5rem;
    border: 1px solid var(--sheet-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Tab Navigation Custom styling */
.daily-sheet-page .sheet-tabs {
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.daily-sheet-page .sheet-tabs .nav-item {
    margin-bottom: -2px;
}

.daily-sheet-page .sheet-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    background: #f8fafc;
    color: var(--sheet-muted);
    font-weight: 600;
    padding: 0.45rem 0.9rem;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.daily-sheet-page .sheet-tabs .nav-link.active {
    background: #fff;
    color: var(--sheet-primary);
    border-bottom: 2px solid var(--sheet-primary);
    font-weight: 700;
    box-shadow: none;
}

.daily-sheet-page .sheet-tabs .nav-link:hover:not(.active) {
    background: #f1f5f9;
    color: var(--sheet-text);
}

.daily-sheet-page .sheet-tabs #addSheetButton {
    background: transparent;
    border: 1px dashed var(--sheet-border);
    color: var(--sheet-muted);
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    height: calc(100% - 2px);
    align-self: center;
}

.daily-sheet-page .sheet-tabs #addSheetButton:hover {
    border-color: var(--sheet-primary);
    color: var(--sheet-primary);
    background: #f5f3ff;
}

/* Columns Grid */
.daily-sheet-page .sheet-workspace>.row {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 0.5rem;
    margin: 0;
}

.daily-sheet-page .sheet-workspace>.row>[class*="col-"] {
    width: 100%;
    padding: 0;
    margin-top: 0 !important;
}

/* Table Design */
.daily-sheet-page .sheet-table-wrap {
    border: 1px solid var(--sheet-border);
    border-radius: 8px;
    overflow: hidden;
}

.daily-sheet-page .sheet-collector-bar {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .35rem;
}

.daily-sheet-page .sheet-collector-label {
    margin: 0;
    color: var(--sheet-muted);
    font-size: .9rem;
    font-weight: 700;
    white-space: nowrap;
}

.daily-sheet-page .sheet-collector-input {
    width: min(100%, 22rem);
    height: 2.5rem;
    border: 1px solid var(--sheet-border);
    border-radius: 6px;
    color: var(--sheet-text);
    font-size: .95rem;
    padding: .375rem .75rem;
}

.daily-sheet-page .sheet-collector-input:focus {
    border-color: var(--sheet-primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
    outline: none;
}

.daily-sheet-page .sheet-table {
    margin-bottom: 0;
    border-collapse: collapse;
}

.daily-sheet-page .sheet-table thead th {
    background: var(--sheet-bg-blue);
    color: #1e3a8a;
    font-weight: 700;
    padding: 0.75rem;
    border: 1px solid #b9d6fe;
    text-align: center;
    vertical-align: middle;
    font-size: 0.95rem;
}

.daily-sheet-page .sheet-table tbody td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
    border: 1px solid var(--sheet-border);
    background: #fff;
}

.daily-sheet-page .sheet-table tbody tr.is-selected td {
    background: #f8fafc;
}

.daily-sheet-page .sheet-stt-col {
    width: 4rem;
}

.daily-sheet-page .sheet-customer-col {
    width: auto;
}

.daily-sheet-page .sheet-phone-col {
    width: 9.5rem;
}

.daily-sheet-page .sheet-money-col {
    width: 9rem;
}

.daily-sheet-page .row-index {
    text-align: center;
    font-weight: 600;
    color: var(--sheet-muted);
}

.daily-sheet-page .sheet-customer-name {
    font-weight: 600;
    color: var(--sheet-text);
    font-size: 0.95rem;
}

.daily-sheet-page .sheet-table small {
    color: var(--sheet-muted);
    font-size: 0.8rem;
    display: block;
    margin-top: 0.15rem;
}

.daily-sheet-page .sheet-phone-display {
    color: var(--sheet-text);
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.daily-sheet-page .sheet-money-input {
    height: 2.5rem;
    border: 1px solid var(--sheet-border);
    border-radius: 6px;
    font-size: 0.95rem;
    padding: 0.375rem 0.75rem;
    transition: all 0.2s;
}

.daily-sheet-page .sheet-money-input {
    text-align: center;
    font-weight: 600;
    color: var(--sheet-text);
}

.daily-sheet-page .sheet-money-input[readonly] {
    background: #eef6ff;
    border-color: #bfdbfe;
    color: #1e40af;
    cursor: default;
}

.daily-sheet-page .sheet-money-input:focus {
    border-color: var(--sheet-primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
    outline: none;
}

/* Footer of the table */
.daily-sheet-page .sheet-table tfoot td {
    padding: 0;
    border: none;
}

.daily-sheet-page .sheet-table .sheet-total-row-container {
    background: var(--sheet-bg-blue);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    border-top: 1px solid var(--sheet-primary-border);
}

.daily-sheet-page .sheet-table .sheet-total-label {
    font-weight: 700;
    color: #4c1d95;
    font-size: 1rem;
}

.daily-sheet-page .sheet-table .sheet-total {
    font-weight: 800;
    color: var(--sheet-primary);
    font-size: 1.15rem;
    text-align: center;
}

/* Customer Detail Panel */
.daily-sheet-page .customer-detail-panel {
    position: relative !important;
    top: auto !important;
    margin-top: 0 !important;
    border: 1px solid var(--sheet-border);
    border-radius: 12px;
    background: #fff;
    padding: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.daily-sheet-page .customer-detail-panel h6 {
    font-size: 0.85rem;
    color: var(--sheet-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.daily-sheet-page .customer-detail-panel .detail-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sheet-text);
    margin: 0;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid #f1f5f9;
}

.daily-sheet-page .customer-detail-panel .detail-lines {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid #f1f5f9;
}

.daily-sheet-page .customer-detail-panel .detail-lines div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.daily-sheet-page .customer-detail-panel .detail-lines span {
    color: var(--sheet-muted);
    font-weight: 500;
}

.daily-sheet-page .customer-detail-panel .detail-lines strong {
    color: var(--sheet-text);
    font-weight: 600;
}

.daily-sheet-page .customer-detail-panel .detail-lines .text-danger {
    color: var(--sheet-danger) !important;
}

.daily-sheet-page .customer-detail-panel .detail-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--sheet-text);
    text-transform: none;
    margin-bottom: 0.25rem;
}

.daily-sheet-page .customer-detail-panel .detail-session-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.daily-sheet-page .customer-detail-panel .detail-after {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
}

.daily-sheet-page .customer-detail-panel .detail-after span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #b45309;
}

.daily-sheet-page .customer-detail-panel .detail-after strong {
    font-size: 1.1rem;
    font-weight: 800;
    color: #d97706;
}

.daily-sheet-page .customer-detail-panel .detail-history-link {
    height: 2.5rem;
    border: 1.5px solid var(--sheet-primary) !important;
    border-radius: 8px !important;
    color: var(--sheet-primary) !important;
    background: #fff !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s !important;
    text-decoration: none !important;
    font-size: 0.9rem !important;
    padding: 0 !important;
    line-height: 1 !important;
    margin: 0 !important;
}

.daily-sheet-page .customer-detail-panel .detail-history-link:hover {
    background: var(--sheet-primary) !important;
    color: #fff !important;
}

/* Sheet action bar lives inside the workspace card. */
.daily-sheet-page .sheet-footer-bar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0 0;
    border-top: 1px solid var(--sheet-border);
    background: transparent;
}

.daily-sheet-page .sheet-footer-bar span {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--sheet-text);
}

.daily-sheet-page .sheet-footer-bar strong {
    color: var(--sheet-primary) !important;
    font-size: 1.25rem;
    font-weight: 800;
    margin-left: 0.5rem;
}

.daily-sheet-page .sheet-footer-actions {
    display: flex;
    gap: 0.75rem;
}

.daily-sheet-page .sheet-footer-actions .btn {
    height: 2.75rem;
    border-radius: 8px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    padding: 0 1.5rem;
    transition: all 0.2s;
}

.daily-sheet-page .sheet-footer-actions .btn-outline-primary {
    border: 1.5px solid var(--sheet-primary);
    color: var(--sheet-primary);
    background: #fff;
}

.daily-sheet-page .sheet-footer-actions .btn-outline-primary:hover {
    background: var(--sheet-primary);
    color: #fff;
}

.daily-sheet-page .sheet-footer-actions .btn-primary {
    background: var(--sheet-primary);
    border: none;
    color: #fff;
}

.daily-sheet-page .sheet-footer-actions .btn-primary:hover {
    background: #4338ca;
}

.daily-sheet-page .sheet-pagination-bar.card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    border: 1px solid var(--sheet-border);
    border-radius: 12px;
    background: #fff;
}

.daily-sheet-page .sheet-page-label {
    min-width: 7rem;
    text-align: center;
    font-weight: 700;
    color: var(--sheet-text);
}

/* Responsiveness adjustments */
@media (max-width: 1199.98px) {
    .daily-sheet-page .sheet-workspace>.row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .daily-sheet-page .sheet-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .daily-sheet-page .sheet-date-control,
    .daily-sheet-page .sheet-date-label,
    .daily-sheet-page .sheet-search-control,
    .daily-sheet-page .sheet-header .sheet-print-current {
        width: 100%;
        margin-left: 0;
    }

    .daily-sheet-page .sheet-stats {
        flex-direction: column;
    }

    .daily-sheet-page .sheet-stat-card {
        width: 100%;
    }

    .daily-sheet-page .sheet-footer-bar {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    .daily-sheet-page .sheet-footer-actions {
        flex-direction: column;
    }

    .daily-sheet-page .sheet-footer-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .daily-sheet-page .sheet-pagination-bar.card {
        flex-direction: column;
        align-items: stretch;
    }

    .daily-sheet-page .sheet-pagination-bar.card .btn {
        width: 100%;
        justify-content: center;
    }
}

.daily-sheet-page .sheet-status {
    display: none;
}

.daily-sheet-page .sheet-tabs .nav-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.daily-sheet-page .remove-sheet-tab-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 1.15rem !important;
    height: 1.15rem !important;
    border-radius: 50% !important;
    color: var(--sheet-muted) !important;
    font-size: 0.8rem !important;
    transition: all 0.2s !important;
    margin-left: 0.5rem !important;
}

.daily-sheet-page .remove-sheet-tab-btn:hover {
    background: #fee2e2 !important;
    color: var(--sheet-danger) !important;
}

/* Custom Modal Backdrop */
.custom-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(4px) !important;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999 !important;
    opacity: 0;
    transition: opacity 0.15s linear;
}

.custom-modal-backdrop.show {
    display: flex !important;
    opacity: 1 !important;
}

/* Custom Modal Card */
.custom-modal-card {
    background: #fff !important;
    border-radius: 12px !important;
    width: 90% !important;
    max-width: 440px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    padding: 1.5rem !important;
    transform: scale(0.95);
    transition: transform 0.15s ease-out;
}

.custom-modal-backdrop.show .custom-modal-card {
    transform: scale(1) !important;
}

.custom-modal-header {
    margin-bottom: 0.75rem !important;
}

.custom-modal-title {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin: 0 !important;
}

.custom-modal-body {
    margin-bottom: 1.5rem !important;
}

.custom-modal-body p {
    font-size: 0.95rem !important;
    color: #475569 !important;
    margin: 0 !important;
    line-height: 1.5 !important;
}

.custom-modal-footer {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 0.75rem !important;
}

.custom-modal-footer .btn {
    height: 2.5rem !important;
    padding: 0 1.25rem !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ============================================================
   UI POLISH — Tables, Cards, Badges, Sidebar, Forms, Buttons
   ============================================================ */

:root {
    --app-surface: #ffffff;
    --app-bg: #f5f5f9;
    --app-border: rgba(105, 108, 255, 0.08);
    --app-text: #384551;
    --app-text-muted: #697a8d;
    --app-primary: #5f61e6;
    --app-primary-light: rgba(95, 97, 230, 0.08);
    --app-success: #71dd37;
    --app-warning: #ffab00;
    --app-danger: #ff3e1d;
    --app-info: #03c3ec;
    --app-radius: 16px;
    --app-shadow: 0 8px 24px rgba(105, 108, 255, 0.04);
}

/* Background floating glow effects */
body {
    background-color: #f5f5f9 !important;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(105, 108, 255, 0.06) 0%, rgba(105, 108, 255, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    bottom: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(3, 195, 236, 0.05) 0%, rgba(3, 195, 236, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

/* ── Sidebar CSS Unified: Duplicate block removed. Styles are configured at the top of this stylesheet. ── */

/* ── Navbar Glassmorphism ── */
.layout-navbar {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    box-shadow: 0 8px 32px rgba(105, 108, 255, 0.04) !important;
    border-radius: 14px !important;
}

/* ── Customer tabs (Separate white cards) ── */
.customer-owner-tabs {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    padding: 0 !important;
    margin: 1.5rem 1.5rem 0.5rem !important;
    background: transparent !important;
    /* Bỏ nền xám đi */
    border: none !important;
    flex-wrap: wrap;
}

.customer-owner-tab {
    flex: 1;
    min-width: 11rem;
    min-height: 3.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem !important;
    border: 1px solid rgba(105, 108, 255, 0.08) !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    /* 3 ô nền trắng riêng biệt */
    color: #697a8d !important;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(105, 108, 255, 0.02) !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.customer-owner-tab:hover {
    border-color: var(--app-accent) !important;
    color: var(--app-accent) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(105, 108, 255, 0.06) !important;
}

.customer-owner-tab.active {
    background: linear-gradient(135deg, var(--app-accent) 0%, var(--app-accent-dark) 100%) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 6px 16px rgba(105, 108, 255, 0.2) !important;
}

.customer-owner-tab strong {
    background: var(--app-accent-soft);
    color: var(--app-accent);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    transition: all 0.25s ease;
}

.customer-owner-tab.active strong {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

/* ── Data tables ── */
/* Override Bootstrap CSS variables để border luôn hiển thị */
.table,
.table-bordered,
.table-app {
    --bs-table-border-color: var(--app-table-border);
    --bs-border-color: var(--app-table-border);
}

.table,
.table-app {
    border-collapse: collapse !important;
    border: 1px solid var(--app-table-border) !important;
}

/* Header: dùng sắc tím rất nhạt để đồng bộ với theme chính */
.table thead tr th,
.table-app thead tr th {
    background: var(--app-table-head) !important;
    color: #3f3a56 !important;
    font-weight: 700 !important;
    font-size: .75rem !important;
    text-transform: uppercase !important;
    letter-spacing: .04em;
    border: 1px solid var(--app-table-border) !important;
    border-bottom: 2px solid #cfc6f4 !important;
    vertical-align: middle;
    padding: 0.95rem 1rem !important;
    white-space: nowrap;
    text-align: center !important;
}

/* Cells: border đồng nhất rõ ràng cả 4 cạnh */
.table tbody tr td,
.table-app tbody tr td {
    vertical-align: middle;
    padding: 0.9rem 1rem !important;
    border-top: 1px solid var(--app-table-border) !important;
    border-bottom: 1px solid var(--app-table-border) !important;
    border-left: 1px solid var(--app-table-border) !important;
    border-right: 1px solid var(--app-table-border) !important;
    color: #384551;
    text-align: center !important;
}

/* Dòng hover nổi bật */
.table-hover tbody tr:hover > td {
    background-color: var(--app-row-hover) !important;
}

.table tbody td.text-end,
.table-app tbody td.text-end,
.table tbody td.col-money,
.table-app tbody td.col-money,
.table tbody td[class*="money"],
.table tbody td[class*="debt"] {
    text-align: right !important;
}

.table tbody td.text-start,
.table-app tbody td.text-start {
    text-align: left !important;
}

.table-app .action-buttons {
    justify-content: center;
}


/* Đảm bảo cột Địa chỉ trong bảng Khách hàng có độ rộng tối thiểu rộng rãi hơn */
.customer-owner-tabs~.table-responsive th:nth-child(5),
.customer-owner-tabs~.table-responsive td:nth-child(5) {
    min-width: 220px !important;
}

/* ── Card Polish ── */
.card {
    border: 1px solid rgba(105, 108, 255, 0.06) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow) !important;
    background: var(--app-surface) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    box-shadow: 0 12px 30px rgba(105, 108, 255, 0.08) !important;
}

.card-header {
    padding: 1.5rem 1.75rem;
    background: transparent;
    border-bottom: 1px solid rgba(105, 108, 255, 0.05);
}

.card-header h5,
.card-header .card-title {
    font-size: 1.15rem !important;
    font-weight: 800 !important;
    color: var(--app-text) !important;
    margin: 0;
}

.card-body {
    padding: 1.75rem !important;
}

.card-footer {
    background: transparent;
    border-top: 1px solid rgba(105, 108, 255, 0.05);
    padding: 1.5rem 1.75rem;
}

/* ── Status badges ── */
.badge {
    font-weight: 700;
    padding: 0.45em 0.8em;
    border-radius: 8px;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

/* Nền nhạt chữ đậm */
.bg-label-primary,
.badge-status-active {
    background: var(--app-accent-soft) !important;
    color: var(--app-accent) !important;
}

.bg-label-success,
.badge-status-completed {
    background: #e8fadf !important;
    color: #71dd37 !important;
}

.bg-label-warning {
    background: #fff2d6 !important;
    color: #ffab00 !important;
}

.bg-label-danger,
.badge-status-cancelled {
    background: #ffe0db !important;
    color: #ff3e1d !important;
}

.bg-label-info,
.badge-status-overpaid {
    background: #d7f5fc !important;
    color: #03c3ec !important;
}

.bg-label-secondary {
    background: #f1f5f9 !important;
    color: #697a8d !important;
}

.bg-label-danger,
.badge-status-cancelled {
    background: #ffe0db !important;
    color: #ff3e1d !important;
}

.bg-label-info,
.badge-status-overpaid {
    background: #d7f5fc !important;
    color: #03c3ec !important;
}

.bg-label-secondary {
    background: #f1f5f9 !important;
    color: #697a8d !important;
}

/* ── Stat/overview cards ── */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    min-height: 5.5rem;
}

.stat-card .stat-icon {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: .65rem;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-card .stat-icon.primary {
    background: var(--app-primary-light);
    color: var(--app-primary);
}

.stat-card .stat-icon.success {
    background: #ecfdf5;
    color: var(--app-success);
}

.stat-card .stat-icon.warning {
    background: #fff7ed;
    color: var(--app-warning);
}

.stat-card .stat-icon.danger {
    background: #fef2f2;
    color: var(--app-danger);
}

.stat-card .stat-icon.info {
    background: #eff6ff;
    color: var(--app-info);
}

.stat-card .stat-icon.secondary {
    background: #f1f5f9;
    color: var(--app-text-muted);
}

.stat-card .stat-label {
    color: var(--app-text-muted);
    font-size: .8125rem;
    font-weight: 600;
    margin-bottom: .25rem;
}

.stat-card .stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--app-text);
    line-height: 1.2;
}

/* ── Search bar refinement ── */
.search-bar {
    max-width: 460px;
    width: 100%;
}

.row.search-bar {
    max-width: 560px;
    /* Nới rộng khung tìm kiếm khi đi kèm ô bộ lọc dropdown */
}

.input-group.search-bar .form-control {
    border-right: 0 !important;
    border-radius: 10px 0 0 10px !important;
}

.input-group.search-bar .btn {
    border-radius: 0 10px 10px 0 !important;
    border-left: 0 !important;
    padding: 0.55rem 1.25rem !important;
}

/* ── Form layout helpers ── */
.form-section {
    padding: 1.5rem;
}

.form-section+.form-section {
    border-top: 1px solid #f1f5f9;
}

/* ── Mini stat boxes (customer detail) ── */
.stat-mini {
    background: #f1f4f9;
    border: 1px solid #e4e7ec;
    border-radius: var(--app-radius);
    padding: 1rem .85rem;
    text-align: center;
}

.stat-mini-warning {
    background: #fff8e6;
    border-color: #ffeeba;
}

/* ── Metric cards (dashboard) ── */
.metric-card-inline {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: #ffffff !important;
    border-radius: 16px !important;
    border: 1px solid rgba(105, 108, 255, 0.05) !important;
    box-shadow: 0 4px 18px rgba(105, 108, 255, 0.03) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.metric-card-inline:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 12px 30px rgba(105, 108, 255, 0.08) !important;
}

.metric-card-inline .metric-icon {
    width: 3.2rem;
    height: 3.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px !important;
    font-size: 1.45rem;
    flex-shrink: 0;
}

.metric-card-inline .metric-icon.success {
    background: #e8fadf !important;
    color: #71dd37 !important;
}

.metric-card-inline .metric-icon.danger {
    background: #ffe0db !important;
    color: #ff3e1d !important;
}

.metric-card-inline .metric-icon.secondary {
    background: #f1f5f9 !important;
    color: #697a8d !important;
}

/* ── Responsive tweaks ── */
@media (max-width: 767.98px) {
    .table-app thead th {
        font-size: .7rem;
        padding: .65rem .5rem;
    }

    .table-app tbody td {
        padding: .55rem .5rem;
    }

    .stat-card {
        padding: 1rem;
        min-height: 4.5rem;
    }

    .stat-card .stat-icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.15rem;
    }

    .stat-card .stat-value {
        font-size: 1.15rem;
    }
}

/* ── Custom Button Styles ── */
.btn {
    border-radius: 10px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease-in-out !important;
}

/* Chỉ áp dụng padding chuẩn cho nút thông thường (không phải icon button và không phải button nhỏ) */
.btn:not(.btn-icon):not(.btn-sm) {
    padding: 0.55rem 1.25rem;
}

/* Nút nhỏ */
.btn-sm:not(.btn-icon) {
    padding: 0.35rem 0.75rem !important;
    font-size: 0.8125rem !important;
}

/* Định hình lại nút icon để hiển thị icon cân đối ở giữa */
.btn-icon {
    width: 2.2rem !important;
    height: 2.2rem !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    border-radius: 8px !important;
}

/* Nút icon loại nhỏ */
.btn-sm.btn-icon {
    width: 1.85rem !important;
    height: 1.85rem !important;
}

.btn-icon i {
    font-size: 1.15rem !important;
    line-height: 1 !important;
}

.btn-sm.btn-icon i {
    font-size: 0.95rem !important;
}

.btn-primary {
    background-color: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
    box-shadow: 0 4px 12px rgba(105, 108, 255, 0.2) !important;
    color: #ffffff !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #5f62f3 !important;
    border-color: #5f62f3 !important;
    box-shadow: 0 6px 16px rgba(105, 108, 255, 0.3) !important;
    transform: translateY(-1px);
    color: #ffffff !important;
}

.btn-outline-primary {
    border-color: var(--app-accent) !important;
    color: var(--app-accent) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

.btn-success {
    background-color: #71dd37 !important;
    border-color: #71dd37 !important;
    box-shadow: 0 4px 12px rgba(113, 221, 55, 0.2) !important;
    color: #ffffff !important;
}

.btn-success:hover {
    background-color: #62cf29 !important;
    border-color: #62cf29 !important;
    transform: translateY(-1px);
    color: #ffffff !important;
}

.btn-danger {
    background-color: #ff3e1d !important;
    border-color: #ff3e1d !important;
    box-shadow: 0 4px 12px rgba(255, 62, 29, 0.2) !important;
    color: #ffffff !important;
}

.btn-danger:hover {
    background-color: #e53213 !important;
    border-color: #e53213 !important;
    transform: translateY(-1px);
    color: #ffffff !important;
}

.btn-outline-secondary {
    border-color: #d9dee3 !important;
    color: #697a8d !important;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active {
    background-color: #f1f5f9 !important;
    border-color: #d9dee3 !important;
    color: #384551 !important;
}

.btn-secondary {
    background-color: #8592a3 !important;
    border-color: #8592a3 !important;
    color: #ffffff !important;
}

.btn-secondary:hover {
    background-color: #788393 !important;
    border-color: #788393 !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

/* ── Custom variables for Customer layout (replaced by root above) ── */

/* ── Reusable Page Component Card ── */
.page-card {
    border: 1px solid rgba(105, 108, 255, 0.06) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(105, 108, 255, 0.04) !important;
    background: #ffffff !important;
    padding: 1.5rem !important;
}

/* ── Collector Tabs Styling ── */
.customer-tabs {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    padding: 0 !important;
}

.customer-tab {
    flex: 1;
    min-width: 10rem;
    min-height: 3.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem !important;
    border: 1px solid var(--app-border) !important;
    border-radius: 0.5rem !important;
    background: #ffffff !important;
    color: var(--app-text-muted) !important;
    text-decoration: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    transition: all 0.2s ease !important;
}

.customer-tab:hover {
    border-color: var(--app-accent) !important;
    color: var(--app-accent) !important;
    background: var(--app-accent-soft) !important;
}

.customer-tab.active {
    background: var(--app-accent) !important;
    color: #ffffff !important;
    border-color: var(--app-accent) !important;
    box-shadow: 0 4px 12px rgba(105, 108, 255, 0.25) !important;
}

.customer-tab strong {
    background: #f3f4f6;
    color: var(--app-text-muted);
    padding: 3px 9px;
    border-radius: 0.25rem;
    font-size: 0.8125rem !important;
    font-weight: 700 !important;
}

.customer-tab.active strong {
    background: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
}

/* ── Customer Action Bar ── */
.customer-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: var(--app-section-gap);
    flex-wrap: wrap;
}

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

    .customer-action-bar .search-box {
        max-width: 100% !important;
        width: 100% !important;
    }

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

    .customer-tabs .customer-tab {
        flex: 1 1 100%;
    }
}

.search-box {
    max-width: 460px;
    width: 100%;
    position: relative;
}

.search-box .form-control {
    border-radius: 0.375rem !important;
    height: 40px !important;
    border: 1px solid var(--app-border) !important;
    padding-left: 2.75rem !important;
    padding-right: 1rem !important;
    background: #fff !important;
    color: var(--app-text-primary) !important;
    font-size: 0.875rem !important;
}

.search-box .form-control:focus {
    background: #ffffff !important;
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 3px rgba(105, 108, 255, 0.15) !important;
}

.search-box .search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--app-text-soft);
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 10;
}

/* ── App Custom Tables ── */
.app-table {
    width: 100%;
    border-collapse: collapse !important;
    border: 1px solid #d9dee3 !important;
}

.app-table thead th {
    background: #f6f7fb !important;
    color: #566a7f !important;
    font-weight: 700 !important;
    font-size: .75rem !important;
    text-transform: uppercase !important;
    letter-spacing: .06em;
    border: 1px solid #edf0f2 !important;
    border-bottom: 2px solid #edf0f2 !important;
    vertical-align: middle;
    padding: 0.95rem 1rem !important;
    white-space: nowrap;
    text-align: center !important;
}

.app-table tbody td {
    vertical-align: middle;
    padding: 0.9rem 1rem !important;
    border: 1px solid #edf0f2 !important;
    color: #384551;
    text-align: center !important;
}

.app-table tbody tr:hover {
    background: #f8f8ff !important;
}

.app-table td:nth-child(1),
.app-table th:nth-child(1) {
    font-weight: 700 !important;
}

.app-table td:nth-child(2) {
    text-align: left !important;
}

/* Cột Địa chỉ (thường là cột 5) căn trái và rộng tối thiểu 220px */
.app-table td:nth-child(5) {
    text-align: left !important;
    min-width: 220px !important;
}

/* Action button in tables */
.action-icon-btn {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 10px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    transition: all 0.2s ease !important;
}

.action-icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(105, 108, 255, 0.15) !important;
}

/* ── Custom modal styling ── */
.app-modal {
    border: none !important;
    border-radius: 18px !important;
    box-shadow: 0 10px 40px rgba(105, 108, 255, 0.12) !important;
    overflow: hidden;
}

.app-modal .modal-header {
    background: #ffffff !important;
    border-bottom: 1px solid #edf0f2 !important;
    padding: 1.5rem 1.75rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.app-modal .btn-close {
    position: static !important;
    transform: none !important;
    margin: 0 !important;
    z-index: 1055 !important;
}

.app-modal-title {
    font-weight: 700 !important;
    color: #384551 !important;
    font-size: 1.15rem !important;
}

.app-modal-subtitle {
    color: #697a8d !important;
    font-size: 0.85rem !important;
}

.app-modal .modal-body {
    padding: 24px !important;
}

.app-modal .modal-footer {
    border-top: 1px solid #edf0f2 !important;
    padding: 1.25rem 1.75rem !important;
}

.app-modal .form-control,
.app-modal .form-select {
    border-radius: 10px !important;
    border: 1px solid #d9dee3 !important;
    height: 46px !important;
    background: #fcfdfe !important;
    color: #384551 !important;
    padding: 0.65rem 1rem !important;
    transition: all 0.2s ease-in-out !important;
}

.app-modal .form-control:focus,
.app-modal .form-select:focus {
    background: #ffffff !important;
    border-color: var(--app-accent) !important;
    box-shadow: 0 0 0 0.25rem rgba(105, 108, 255, 0.1) !important;
}

.app-modal .form-label {
    font-weight: 600 !important;
    color: #566a7f !important;
    font-size: 0.85rem !important;
    margin-bottom: 0.5rem !important;
}

.app-modal .btn {
    border-radius: 10px !important;
    padding: 0.65rem 1.5rem !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    transition: all 0.2s ease !important;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   MODAL BUTTONS — App Modal specific overrides
   ============================================================ */
.app-modal .btn-primary {
    background: var(--app-accent) !important;
    border-color: var(--app-accent) !important;
    color: #ffffff !important;
}

.app-modal .btn-primary:hover {
    background: var(--app-accent-dark) !important;
    border-color: var(--app-accent-dark) !important;
}

.app-modal .btn-outline-secondary {
    border-color: var(--app-border) !important;
    color: var(--app-text-muted) !important;
    background: transparent !important;
}

.app-modal .btn-outline-secondary:hover {
    background: var(--app-accent-soft) !important;
    border-color: var(--app-border) !important;
}

/* ============================================================
   SIDEBAR — Old block removed. New sidebar CSS is at top of file.
   All sidebar styling now in #layout-menu.layout-menu block above.
   ============================================================ */

/* ================================================================
   REDESIGN v2 — Clean Admin Dashboard (append-only override)
   ================================================================ */

/* ── Body & Page ── */
body {
    background: var(--app-bg) !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    color: var(--app-text) !important;
}

/* ── Sidebar: White, clean, professional ── */
#layout-menu.layout-menu {
    background: var(--app-sidebar-bg) !important;
    border-right: 1px solid var(--app-border) !important;
    box-shadow: none !important;
}

#layout-menu .app-brand {
    padding: 1.25rem 1.25rem 1rem !important;
    border-bottom: 1px solid var(--app-border) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

#layout-menu .app-brand-logo {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-2)) !important;
    border-radius: 10px !important;
    color: #fff !important;
    font-size: 1.15rem;
    flex-shrink: 0;
}

#layout-menu .app-brand-logo .text-primary {
    color: #fff !important;
}

#layout-menu .app-brand-text {
    color: var(--app-text) !important;
    font-size: 1.1rem;
    font-weight: 800 !important;
    letter-spacing: 0.3px;
}

#layout-menu .app-brand .layout-menu-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px;
    height: 28px;
    border-radius: 8px !important;
    background: var(--app-primary-soft) !important;
    color: var(--app-primary) !important;
    border: none !important;
    transition: all 0.2s ease;
}

#layout-menu .app-brand .layout-menu-toggle:hover {
    background: var(--app-primary) !important;
    color: #fff !important;
}

#layout-menu .app-brand .layout-menu-toggle i {
    font-size: 1.1rem !important;
    transition: transform 0.25s ease;
}

.layout-menu-collapsed #layout-menu .app-brand-link { display: none !important; }
.layout-menu-collapsed #layout-menu .app-brand { justify-content: center !important; padding: 1.25rem 0 !important; }
.layout-menu-collapsed #layout-menu .app-brand .layout-menu-toggle { display: flex !important; margin: 0 auto !important; }
.layout-menu-collapsed #layout-menu .app-brand .layout-menu-toggle i { transform: rotate(180deg) !important; }

#layout-menu .menu-inner { padding: 0.75rem 0 !important; }

#layout-menu .menu-item {
    margin: 0.15rem 0.75rem !important;
    position: relative;
}

#layout-menu .menu-link {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 0.65rem 0.85rem !important;
    border-radius: 10px !important;
    color: var(--app-sidebar-text) !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    white-space: nowrap;
}

#layout-menu .menu-link:hover {
    background: var(--app-primary-soft) !important;
    color: var(--app-primary) !important;
}

#layout-menu .menu-link:hover .menu-icon {
    color: var(--app-primary) !important;
}

#layout-menu .menu-icon {
    font-size: 1.15rem !important;
    width: 1.25rem !important;
    text-align: center !important;
    flex-shrink: 0;
    color: var(--app-sidebar-text-muted) !important;
    transition: color 0.2s ease !important;
}

#layout-menu .menu-item.active > .menu-link {
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-2)) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3) !important;
}

#layout-menu .menu-item.active > .menu-link .menu-icon {
    color: #ffffff !important;
}

#layout-menu .menu-item.active::before,
#layout-menu .menu-item.active::after {
    display: none !important;
}

#layout-menu .menu-divider {
    border-color: var(--app-border) !important;
    margin: 0.5rem 1.25rem !important;
}

#layout-menu .menu-inner-shadow {
    background: linear-gradient(var(--app-sidebar-bg) 5%, rgba(255,255,255,0) 100%) !important;
}

@media (min-width: 1200px) {
    #layout-menu .layout-menu-toggle { display: none !important; }
}

/* ── Navbar / Header ── */
#layout-navbar.layout-navbar {
    background: var(--app-card-bg) !important;
    border-bottom: 1px solid var(--app-border) !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
    padding: 0.6rem 1.5rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    min-height: 52px;
}

#layout-navbar .layout-page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--app-text);
    margin: 0;
}

.header-logout-btn {
    background: transparent !important;
    border: 1px solid var(--app-border) !important;
    color: var(--app-muted) !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 0.8125rem !important;
    padding: 0.35rem 0.85rem !important;
    transition: all 0.2s ease;
}

.header-logout-btn:hover {
    background: var(--app-danger-soft) !important;
    border-color: var(--app-danger) !important;
    color: var(--app-danger) !important;
}

.app-alerts-area {
    padding: 0;
}

.layout-page-title {
    font-size: 1.35rem !important;
    font-weight: 800 !important;
    color: var(--app-text) !important;
    margin: 0 !important;
}

/* ── Cards ── */
.card {
    border: 1px solid var(--app-border) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.035) !important;
    background: var(--app-card-bg) !important;
    transition: box-shadow 0.3s ease;
    margin-bottom: var(--app-section-gap);
}

.card:hover {
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06) !important;
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--app-border) !important;
    padding: 0.75rem 1rem !important;
}

.card-body {
    padding: 1rem !important;
}

.card-footer {
    background: transparent !important;
    border-top: 1px solid var(--app-border) !important;
    padding: 0.75rem 1rem !important;
}

.card-title {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    color: var(--app-text) !important;
    margin-bottom: 0 !important;
}

/* ── Metric Cards for Dashboard ── */
.metric-card-custom {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--app-card-bg);
    border: 1px solid var(--app-border);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    transition: all 0.3s ease;
    min-height: 100px;
}

.metric-card-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.metric-card-custom .icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.35rem;
}

.metric-card-custom.theme-green .icon-box {
    background: var(--app-success-soft);
    color: var(--app-success);
}

.metric-card-custom.theme-red .icon-box {
    background: var(--app-danger-soft);
    color: var(--app-danger);
}

.metric-card-custom.theme-blue .icon-box {
    background: var(--app-info-soft);
    color: var(--app-info);
}

.metric-card-custom.theme-purple .icon-box {
    background: var(--app-primary-soft);
    color: var(--app-primary);
}

.metric-card-custom .label-text {
    font-size: 0.8rem;
    color: var(--app-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 0.2rem;
}

.metric-card-custom .value-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--app-text);
    line-height: 1.2;
}

.metric-card-custom .sub-text {
    font-size: 0.75rem;
    color: var(--app-muted);
    margin-top: 0.2rem;
}

.metric-card-custom .sub-text span {
    color: #22c55e;
    font-weight: 700;
}

/* ── Page Header ── */
.app-header {
    background: var(--app-card-bg);
    border-radius: 16px;
    padding: 18px 24px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    margin-bottom: 24px;
    border: 1px solid var(--app-border);
}

.app-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--app-text);
    margin: 0;
}

.app-subtitle {
    font-size: 0.875rem;
    color: var(--app-muted);
    margin-top: 4px;
}

/* ── App Card ── */
.app-card {
    background: var(--app-card-bg);
    border: 1px solid var(--app-border);
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

/* ── Buttons ── */
.btn {
    border-radius: 10px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease-in-out !important;
}

.btn:not(.btn-icon):not(.btn-sm):not(.btn-lg) {
    padding: 0.55rem 1.25rem;
}

.btn-sm:not(.btn-icon) {
    padding: 0.35rem 0.75rem !important;
    font-size: 0.8125rem !important;
}

.btn-icon {
    width: 2.2rem !important;
    height: 2.2rem !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    border-radius: 8px !important;
}

.btn-sm.btn-icon {
    width: 1.85rem !important;
    height: 1.85rem !important;
}

.btn-icon i { font-size: 1.15rem !important; line-height: 1 !important; }
.btn-sm.btn-icon i { font-size: 0.95rem !important; }

.app-btn-primary,
.btn-primary {
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-2)) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.25) !important;
}

.app-btn-primary:hover,
.btn-primary:hover {
    background: linear-gradient(135deg, #6d28d9, #7c3aed) !important;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.35) !important;
    color: #fff !important;
}

.btn-outline-primary {
    border-color: var(--app-primary) !important;
    color: var(--app-primary) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary.active {
    background: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
    color: #fff !important;
}

.btn-outline-secondary {
    border-color: var(--app-border) !important;
    color: var(--app-muted) !important;
}

.btn-outline-secondary:hover {
    background: var(--app-primary-soft) !important;
    border-color: var(--app-primary) !important;
    color: var(--app-primary) !important;
}

.btn-success {
    background: var(--app-success) !important;
    border-color: var(--app-success) !important;
    color: #fff !important;
}

.btn-danger {
    background: var(--app-danger) !important;
    border-color: var(--app-danger) !important;
    color: #fff !important;
}

/* ── Forms ── */
.form-label {
    color: var(--app-text) !important;
    font-weight: 700 !important;
    font-size: 0.875rem !important;
    margin-bottom: 0.4rem !important;
}

.form-control,
.form-select {
    height: 44px !important;
    border-radius: 10px !important;
    border: 1.5px solid var(--app-border) !important;
    color: var(--app-text) !important;
    font-size: 0.875rem !important;
    background: #fff !important;
    transition: all 0.2s ease !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.12) !important;
    background: #fff !important;
}

textarea {
    border-radius: 10px !important;
    border: 1.5px solid var(--app-border) !important;
}

/* ── Tables ── */
.app-table {
    width: 100%;
    border-collapse: collapse !important;
}

.app-table thead th {
    background: var(--app-table-head) !important;
    color: var(--app-muted) !important;
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--app-border) !important;
    padding: 14px 16px !important;
    white-space: nowrap;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
}

.app-table tbody td {
    padding: 14px 16px !important;
    vertical-align: middle !important;
    color: var(--app-text) !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
}

.app-table tbody tr:hover {
    background: var(--app-row-hover) !important;
}

.app-table td:nth-child(1),
.app-table th:nth-child(1) {
    font-weight: 700 !important;
}

.app-table td:nth-child(2) {
    text-align: left !important;
}

/* ── Regular tables too (for contracts, payments, etc) ── */
.table {
    border-collapse: collapse !important;
}

.table thead th {
    background: var(--app-table-head) !important;
    color: var(--app-muted) !important;
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--app-border) !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    padding: 14px 16px !important;
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px !important;
    vertical-align: middle !important;
    color: var(--app-text) !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
}

.table tbody tr:hover {
    background: var(--app-row-hover) !important;
}

/* ── Badges ── */
.app-badge-primary,
.badge.bg-label-primary {
    background: var(--app-primary-soft) !important;
    color: var(--app-primary) !important;
    border-radius: 999px !important;
    padding: 4px 10px !important;
    font-weight: 700 !important;
    font-size: 0.75rem !important;
}

.badge.bg-label-success {
    background: var(--app-success-soft) !important;
    color: #16a34a !important;
    border-radius: 999px !important;
}

.badge.bg-label-warning {
    background: var(--app-warning-soft) !important;
    color: #d97706 !important;
    border-radius: 999px !important;
}

.badge.bg-label-danger {
    background: var(--app-danger-soft) !important;
    color: var(--app-danger) !important;
    border-radius: 999px !important;
}

.badge.bg-label-info {
    background: var(--app-info-soft) !important;
    color: #0284c7 !important;
    border-radius: 999px !important;
}

.badge.bg-label-secondary {
    background: #f1f5f9 !important;
    color: var(--app-muted) !important;
    border-radius: 999px !important;
}

/* ── Action Icon Buttons ── */
.action-icon-btn {
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid var(--app-border) !important;
    background: #fff !important;
    color: var(--app-primary) !important;
    padding: 0 !important;
    transition: all 0.2s ease !important;
}

.action-icon-btn:hover {
    background: var(--app-primary-soft) !important;
    border-color: var(--app-primary) !important;
    transform: translateY(-1px);
}

.action-icon-btn i { font-size: 1.1rem !important; }

/* ── Modal ── */
.modal-content {
    border: none !important;
    border-radius: 18px !important;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2) !important;
}

.app-modal {
    border: none !important;
    border-radius: 18px !important;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2) !important;
    overflow: hidden;
}

.app-modal .modal-header {
    padding: 22px 24px !important;
    border-bottom: 1px solid var(--app-border) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #fff !important;
}

.app-modal-title {
    font-weight: 800 !important;
    color: var(--app-text) !important;
    font-size: 1.15rem !important;
}

.app-modal-subtitle {
    font-size: 0.875rem !important;
    color: var(--app-muted) !important;
}

.app-modal .modal-body {
    padding: 24px !important;
}

.app-modal .modal-footer {
    padding: 18px 24px 24px !important;
    border-top: none !important;
    background: transparent !important;
}

.app-modal .btn-close {
    position: static !important;
    transform: none !important;
    margin: 0 !important;
    z-index: 1055 !important;
}

.app-modal .form-control,
.app-modal .form-select {
    height: 44px !important;
    border-radius: 10px !important;
    border: 1.5px solid var(--app-border) !important;
    background: #fff !important;
}

.app-modal .form-control:focus,
.app-modal .form-select:focus {
    border-color: var(--app-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(79, 70, 229, 0.1) !important;
}

.app-modal .form-label {
    font-weight: 700 !important;
    color: var(--app-text) !important;
    font-size: 0.875rem !important;
    margin-bottom: 0.5rem !important;
}

.app-modal .btn {
    border-radius: 10px !important;
    padding: 0.65rem 1.5rem !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-modal .btn-primary {
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-2)) !important;
    border: none !important;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.25) !important;
    color: #fff !important;
}

.app-modal .btn-primary:hover {
    background: linear-gradient(135deg, #6d28d9, #7c3aed) !important;
}

.app-modal .btn-outline-secondary {
    border: 1.5px solid var(--app-border) !important;
    color: var(--app-muted) !important;
}

.app-modal .btn-outline-secondary:hover {
    background: var(--app-primary-soft) !important;
    border-color: var(--app-primary) !important;
    color: var(--app-primary) !important;
}

/* ── Customer Page ── */
.customer-tabs {
    display: flex;
    align-items: stretch;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    padding: 0 !important;
}

.customer-tab {
    flex: 1;
    min-width: 10rem;
    min-height: 3.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem !important;
    border: 1px solid var(--app-border) !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    color: var(--app-muted) !important;
    text-decoration: none !important;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04) !important;
    transition: all 0.2s ease !important;
    cursor: pointer;
}

.customer-tab:hover {
    border-color: var(--app-primary) !important;
    color: var(--app-primary) !important;
    background: var(--app-primary-soft) !important;
}

.customer-tab.active {
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-2)) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25) !important;
}

.customer-tab span {
    font-weight: 600;
    font-size: 0.85rem;
}

.customer-tab strong {
    background: var(--app-primary-soft);
    color: var(--app-primary);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    transition: all 0.2s ease;
}

.customer-tab.active strong {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

.customer-action-bar {
    display: grid;
    grid-template-columns: minmax(20rem, 42rem) auto;
    align-items: center;
    justify-content: space-between;
    column-gap: 1.5rem;
    row-gap: 1rem;
    margin-bottom: 1.25rem;
}

.customer-action-bar .search-box {
    max-width: none;
    width: 100%;
    position: relative;
}

.customer-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.customer-actions .btn {
    min-height: 44px;
    white-space: nowrap;
}

.customer-table-wrap {
    margin-top: 0.35rem;
    border-radius: 10px;
}

.search-box .form-control {
    height: 44px !important;
    border-radius: 10px !important;
    border: 1.5px solid var(--app-border) !important;
    padding-left: 2.75rem !important;
    padding-right: 1rem !important;
    background: #fff !important;
    color: var(--app-text) !important;
    font-size: 0.875rem !important;
}

.search-box .form-control:focus {
    border-color: var(--app-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.12) !important;
}

.search-box .search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--app-muted);
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 10;
}

.customer-duplicate-row {
    --bs-table-bg: #fff1f2 !important;
}

.customer-duplicate-row td {
    color: #9f1239 !important;
    font-weight: 600 !important;
}

/* ── Alerts ── */
.alert {
    border: none !important;
    border-radius: 12px !important;
    font-size: 0.875rem;
    border-left: 3px solid currentColor;
}

.alert-success {
    background: var(--app-success-soft) !important;
    color: #16a34a !important;
}

.alert-danger {
    background: var(--app-danger-soft) !important;
    color: var(--app-danger) !important;
}

.alert-dismissible {
    position: relative !important;
    padding-right: 3rem !important;
}

.alert .btn-close {
    font-size: 0.75rem;
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    right: 1rem !important;
    padding: 0.5rem !important;
    margin: 0 !important;
}

/* ── App Alert (custom) ── */
.app-alert {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    position: relative;
    overflow: hidden;
    border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    animation: alertSlideIn 0.25s ease;
}

@keyframes alertSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.app-alert-success {
    background: var(--app-success-soft, #dcfce7);
    color: #16a34a;
}

.app-alert-danger {
    background: var(--app-danger-soft, #fee2e2);
    color: var(--app-danger, #dc2626);
}

.app-alert-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    line-height: 1;
}

.app-alert-text {
    flex: 1;
    line-height: 1.4;
}

.app-alert-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 1.1rem;
    color: inherit;
    opacity: 0.65;
    transition: background 0.15s, opacity 0.15s;
    padding: 0;
    margin: 0;
}

.app-alert-close:hover {
    opacity: 1;
    background: rgba(0,0,0,0.08);
}

.app-alert-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: currentColor;
    opacity: 0.25;
    transform-origin: left;
    animation: alertProgress var(--alert-duration, 5s) linear forwards;
}

@keyframes alertProgress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ── Pagination ── */
.pagination {
    gap: 0.25rem;
}

.page-link {
    border-radius: 8px !important;
    border: 1px solid var(--app-border) !important;
    color: var(--app-text) !important;
    font-weight: 600 !important;
    font-size: 0.8125rem !important;
    padding: 0.4rem 0.75rem !important;
}

.page-link:hover {
    background: var(--app-primary-soft) !important;
    border-color: var(--app-primary) !important;
    color: var(--app-primary) !important;
}

.page-item.disabled .page-link {
    background: var(--app-table-head) !important;
    color: var(--app-muted) !important;
}

/* ── List Group (Top Debt) ── */
.list-group-flush .list-group-item {
    border-color: var(--app-border) !important;
    padding: 0.75rem 0 !important;
}

/* ── Footer ── */
.content-footer {
    background: transparent !important;
    border-top: 1px solid var(--app-border) !important;
}

.footer-container {
    color: var(--app-muted);
    font-size: 0.8125rem;
}

/* ── Dashboard Header Card ── */
.card-header .btn-group-sm .btn {
    border-radius: 8px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    padding: 0.3rem 0.75rem !important;
}

/* ── Responsive ── */
@media (max-width: 1199.98px) {
    .app-page { padding: 16px; }
    .app-header { padding: 16px; }
}

@media (max-width: 991.98px) {
    .row.g-3.mb-4 > [class*="col-"] { margin-bottom: 0; }
}

@media (max-width: 767.98px) {
    .app-page { padding: 12px; }

    .customer-action-bar {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .customer-action-bar .search-box,
    .customer-action-bar .btn {
        max-width: 100% !important;
        width: 100% !important;
    }

    .customer-actions {
        width: 100%;
        justify-content: stretch;
    }

    .customer-tabs .customer-tab {
        flex: 1 1 100%;
    }

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

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

    .table-responsive {
        overflow-x: auto;
    }

    .content-wrapper > .container-xxl {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ── ApexCharts tweaks ── */
.apexcharts-legend-text {
    font-family: 'Inter', sans-serif !important;
    font-weight: 600 !important;
    color: var(--app-text) !important;
}

.apexcharts-tooltip {
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1) !important;
    border: 1px solid var(--app-border) !important;
}

.apexcharts-tooltip-title {
    font-family: 'Inter', sans-serif !important;
    font-weight: 700 !important;
}

/* ── Chart toggle buttons ── */
[data-days].active {
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-2)) !important;
    border-color: transparent !important;
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2) !important;
}

/* ============================================================
   NEW APP LAYOUT — Flex-based, replaces Sneat's layout-wrapper
   ============================================================ */

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

/* ── Sidebar ── */
.app-sidebar {
    width: var(--bs-sidebar-width, 260px);
    min-width: var(--bs-sidebar-width, 260px);
    height: 100vh;
    background: #fff;
    border-right: 1px solid var(--app-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.25s ease, min-width 0.25s ease;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.app-sidebar.collapsed {
    width: 72px;
    min-width: 72px;
}

.app-brand {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid var(--app-border);
    flex-shrink: 0;
}

.app-brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.app-brand-logo {
    width: 1.85rem;
    height: 1.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--app-primary);
    border-radius: 0.375rem;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.app-brand-text {
    color: #1f2937;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
}

.app-sidebar.collapsed .app-brand-text {
    display: none;
}

.app-sidebar.collapsed .app-brand {
    justify-content: center;
    padding: 0;
}

.app-sidebar .layout-menu {
    flex: 1;
    overflow-y: auto;
    padding-top: 0.2rem;
    box-shadow: none !important;
}

.app-sidebar .menu-inner {
    padding: 0.2rem 0;
}

.app-sidebar .menu-item {
    margin: 0.05rem 0.55rem !important;
}

.app-sidebar .menu-link {
    padding: 0.42rem 0.65rem !important;
    border-radius: 0.375rem !important;
    color: #475569 !important;
    gap: 0.75rem !important;
    white-space: nowrap;
}

.app-sidebar .menu-link:hover {
    background-color: #f3e8ff !important;
    color: #7c3aed !important;
}

.app-sidebar .menu-item.active > .menu-link {
    background-color: #7c3aed !important;
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25) !important;
}

.app-sidebar .menu-item.active > .menu-link .menu-icon {
    color: #fff !important;
}

.app-sidebar .menu-icon {
    font-size: 1.15rem !important;
    width: 1.25rem !important;
    text-align: center !important;
    flex-shrink: 0;
    color: #94a3b8 !important;
}

.app-sidebar .menu-link:hover .menu-icon {
    color: #7c3aed !important;
}

.app-sidebar.collapsed .menu-text,
.app-sidebar.collapsed .menu-link > div {
    display: none;
}

.app-sidebar.collapsed .menu-link {
    justify-content: center;
    padding: 0.6rem !important;
}

.app-sidebar.collapsed .menu-item {
    margin: 0.15rem auto !important;
    width: 42px;
}

/* ── Main (topbar + content) ── */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
    min-width: 0;
    background: #f6f8fb;
    overflow: hidden;
}

/* ── Topbar ── */
.app-topbar {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    background: #fff;
    border-bottom: 1px solid var(--app-border);
    flex-shrink: 0;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.topbar-toggle-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.25rem;
}

.topbar-toggle-btn:hover {
    background: #f3e8ff;
    border-color: #7c3aed;
    color: #7c3aed;
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    white-space: nowrap;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-search {
    position: relative;
}

.topbar-search .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1rem;
    pointer-events: none;
}

.topbar-search .form-control {
    width: 260px;
    height: 2.25rem;
    padding-left: 2.25rem !important;
    font-size: 0.8125rem !important;
    border-radius: 999px !important;
    border: 1px solid var(--app-border) !important;
    background: #f8fafc !important;
}

.topbar-search .form-control:focus {
    background: #fff !important;
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1) !important;
}

.topbar-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    pointer-events: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.topbar-icon-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.topbar-icon-btn:hover {
    background: #f1f5f9;
    color: #1f2937;
}

/* ── Notification Dropdown ── */
.notif-dropdown-menu {
    width: 360px;
    padding: 0;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    max-height: 400px !important;
    display: flex !important;
    flex-direction: column !important;
}

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--app-border);
    background: #fafbfc;
}

.notif-dropdown-title {
    font-weight: 600;
    font-size: 0.8125rem;
    color: #1f2937;
}

.notif-dropdown-count {
    font-size: 0.7rem;
    color: #6b7280;
    font-weight: 600;
}

.notif-dropdown-body {
    max-height: 300px !important;
    overflow-y: auto !important;
    flex: 1;
}

.notif-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid var(--app-border);
    transition: background 0.15s ease;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: #f8f9fb;
}

.notif-item-left {
    flex-shrink: 0;
}

.notif-item-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-size: 1.1rem;
}

.notif-item-icon.warning {
    background: #fef3c7;
    color: #d97706;
}

.notif-item-icon.danger {
    background: #fee2e2;
    color: #ef4444;
}

.notif-item-right {
    flex: 1;
    min-width: 0;
}

.notif-item-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-item-detail {
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 0.15rem;
}

.notif-item-detail strong {
    color: #1f2937;
}

.notif-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.8125rem;
}

.notif-dropdown-footer {
    border-top: 1px solid var(--app-border);
    padding: 0.65rem 1rem;
    text-align: center;
    background: #fafbfc;
}

.notif-read-form {
    margin: 0 0 0.55rem;
}

.notif-read-btn {
    width: 100%;
    border: 1px solid rgba(105, 108, 255, 0.35);
    border-radius: 0.375rem;
    background: #fff;
    color: #696cff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.notif-read-btn:hover {
    background: rgba(105, 108, 255, 0.08);
    border-color: rgba(105, 108, 255, 0.55);
}

.notif-footer-link {
    font-size: 0.75rem;
    font-weight: 600;
    color: #7c3aed;
    text-decoration: none;
}

.notif-footer-link:hover {
    text-decoration: underline;
}

.topbar-notif-dropdown .dropdown-menu {
    display: block;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.topbar-notif-dropdown.show .dropdown-menu,
.topbar-notif-dropdown .dropdown-menu.show {
    visibility: visible;
    opacity: 1;
}

.topbar-user {
    display: flex;
    align-items: center;
}

.topbar-user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem 0.35rem 0.35rem;
    border-radius: 999px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.topbar-user-btn:hover {
    background: #f1f5f9;
}

.topbar-user-avatar {
    font-size: 1.75rem;
    color: #7c3aed;
    line-height: 1;
}

.topbar-user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1f2937;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Content area ── */
.app-content {
    flex: 1;
    min-height: 0;
    min-width: 0;
    padding: var(--app-content-padding-top) var(--app-content-padding-x) var(--app-content-padding-bottom);
    overflow: auto;
    overscroll-behavior: contain;
}

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1029;
}

.sidebar-overlay.show {
    display: block;
}

/* ── Responsive ── */
@media (max-width: 1199.98px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100vh;
        z-index: 1030;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    }

    .app-sidebar.mobile-open {
        transform: translateX(0);
    }

    .app-sidebar.collapsed {
        width: var(--bs-sidebar-width, 260px);
        min-width: var(--bs-sidebar-width, 260px);
    }

    .app-sidebar.collapsed.mobile-open .app-brand-text {
        display: inline;
    }

    .app-sidebar.collapsed.mobile-open .menu-text,
    .app-sidebar.collapsed.mobile-open .menu-link > div {
        display: inline;
    }

    .app-sidebar.collapsed.mobile-open .menu-link {
        justify-content: flex-start;
    }

    .app-sidebar.collapsed.mobile-open .menu-item {
        width: auto;
    }
}

@media (max-width: 1199.98px) {
    :root {
        --app-content-padding-x: 4px;
        --app-content-padding-top: 8px;
        --app-section-gap: 4px;
        --app-card-gap: 4px;
    }
}

@media (max-width: 767.98px) {
    :root {
        --app-content-padding-x: 3px;
        --app-content-padding-top: 6px;
        --app-content-padding-bottom: 6px;
        --app-section-gap: 4px;
        --app-card-gap: 4px;
    }

    .app-topbar {
        padding: 0 0.75rem;
    }

    .app-content {
        padding: var(--app-content-padding-top) var(--app-content-padding-x) var(--app-content-padding-bottom);
    }

    .topbar-title {
        font-size: 1rem;
    }

    .topbar-search {
        display: none !important;
    }
}

/* ============================================================
   PROGRESS SECTION — TODAY COLLECTION DETAIL
   ============================================================ */
.progress-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 0;
}

.progress-percent {
    font-size: 2rem;
    font-weight: 800;
    color: #1f2937;
}

.progress-caption {
    color: #6b7280;
    font-size: 0.9rem;
}

.dashboard-collection-body {
    gap: 1.15rem;
    justify-content: flex-start !important;
}

.collection-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.collection-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--app-muted);
    font-size: 0.8125rem;
    font-weight: 700;
}

.collection-progress-meta strong {
    color: var(--app-primary);
    font-size: 0.9rem;
}

.collection-progress {
    height: 30px !important;
    border-radius: 0.5rem !important;
    background: #e9eef5 !important;
    overflow: hidden !important;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.collection-progress .progress-bar {
    min-width: 0;
    border-radius: inherit !important;
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
}

.collection-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 0;
}

.collection-stat {
    padding: 12px;
    border-radius: 12px;
    text-align: center;
}

.collection-stat-label {
    font-size: 0.8rem;
    font-weight: 600;
}

.collection-stat-value {
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 800;
}

/* Dashboard customer payment status card */
.dashboard-status-card .card-title {
    font-size: 1rem !important;
}

.dashboard-status-header {
    padding: 0.85rem 1rem !important;
}

.dashboard-status-title-icon {
    width: 2.125rem;
    height: 2.125rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border-radius: 0.375rem;
    flex-shrink: 0;
}

.dashboard-status-body {
    gap: 0.75rem;
    padding: 1rem !important;
}

.dashboard-status-total {
    display: grid;
    justify-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0 0.1rem;
}

.dashboard-status-total span {
    color: var(--app-muted);
    font-weight: 700;
    font-size: 0.8125rem;
}

.dashboard-status-total strong {
    color: var(--app-text);
    font-size: clamp(2.5rem, 4vw, 3.25rem);
    line-height: 0.95;
    font-weight: 800;
}

.dashboard-status-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.dashboard-status-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--app-muted);
    font-size: 0.8125rem;
    font-weight: 700;
}

.dashboard-status-progress-meta strong {
    color: var(--app-success);
    font-size: 0.9rem;
}

.dashboard-status-progress {
    height: 30px;
    border-radius: 0.5rem;
    background: #e9eef5;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.dashboard-status-progress .progress-bar {
    font-size: 0.7rem;
    font-weight: 700;
}

.dashboard-status-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--app-border);
    font-size: 0.8125rem;
}

.dashboard-status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    display: inline-block;
}

.dashboard-status-dot.success {
    background: var(--app-success);
}

.dashboard-status-dot.warning {
    background: var(--app-warning);
}

.dashboard-status-dot.muted {
    background: #8592a3;
}

.dashboard-status-mini {
    min-height: 7.25rem;
    padding: 0.75rem;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
}

.dashboard-status-mini span {
    color: var(--app-muted);
    font-size: 0.75rem;
    font-weight: 700;
}

.dashboard-status-mini strong {
    font-size: 1.75rem;
    line-height: 1;
    font-weight: 800;
}

.dashboard-status-mini-icon {
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1rem;
}

.dashboard-status-mini.success .dashboard-status-mini-icon,
.dashboard-status-mini.success .dashboard-status-percent {
    background: var(--app-success-soft);
    color: var(--app-success);
}

.dashboard-status-mini.success strong {
    color: var(--app-success);
}

.dashboard-status-mini.warning .dashboard-status-mini-icon,
.dashboard-status-mini.warning .dashboard-status-percent {
    background: var(--app-warning-soft);
    color: var(--app-warning);
}

.dashboard-status-mini.warning strong {
    color: var(--app-warning);
}

.dashboard-status-mini.muted .dashboard-status-mini-icon,
.dashboard-status-mini.muted .dashboard-status-percent {
    background: #eef2f7;
    color: #8592a3;
}

.dashboard-status-mini.muted strong {
    color: #8592a3;
}

.dashboard-status-percent {
    min-width: 2.25rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem !important;
}

@media (max-width: 575.98px) {
    .collection-stats {
        grid-template-columns: 1fr !important;
    }

    .progress-summary {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
}

/* Stronger functional control borders for better scanability */
.btn-outline-primary,
.customer-actions .btn-outline-primary,
.sheet-toolbar-actions .btn-outline-primary,
.sheet-footer-actions .btn-outline-primary,
.daily-sheet-page .sheet-footer-actions .btn-outline-primary,
.detail-history-link,
.notif-read-btn {
    border-width: 2px !important;
    border-color: rgba(124, 58, 237, 0.72) !important;
}

.btn-outline-secondary,
.customer-actions .btn-outline-secondary,
.app-modal .btn-outline-secondary {
    border-width: 2px !important;
    border-color: #c9ced8 !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.customer-actions .btn-outline-primary:hover,
.customer-actions .btn-outline-primary:focus,
.sheet-toolbar-actions .btn-outline-primary:hover,
.sheet-footer-actions .btn-outline-primary:hover,
.daily-sheet-page .sheet-footer-actions .btn-outline-primary:hover,
.detail-history-link:hover,
.notif-read-btn:hover {
    border-color: var(--app-primary) !important;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active,
.customer-actions .btn-outline-secondary:hover,
.customer-actions .btn-outline-secondary:focus,
.app-modal .btn-outline-secondary:hover {
    border-color: rgba(124, 58, 237, 0.55) !important;
}

.action-icon-btn,
.btn-icon.btn-outline-primary,
.btn-icon.btn-outline-info,
.btn-icon.btn-outline-success,
.btn-icon.btn-outline-secondary {
    border-width: 1.5px !important;
    border-color: rgba(124, 58, 237, 0.35) !important;
}
