/* ============================================================
   Accounting System — Design Tokens & Utilities
   Phase 3 output: single source of truth for all visual constants
   ============================================================ */

:root {
    /* Brand — warm premium defaults (2026-07 modernization).
       Tenants may still override --color-primary/-light, --color-success and
       --color-danger through the per-restaurant theme settings; these are only
       the defaults shown before customization. */
    --color-primary:        #1f4e79;   /* deep trustworthy navy */
    --color-primary-light:  #e9eff5;
    --color-accent:         #e8762d;   /* warm restaurant orange */
    --color-accent-light:   #fdf0e4;
    --color-success:        #1f9d51;
    --color-success-light:  #e6f6ec;
    --color-danger:         #e05252;
    --color-danger-light:   #fdeaea;
    --color-warning:        #f59e0b;
    --color-warning-light:  #fef3e2;
    --color-info:           #0e9cb8;

    /* Neutral — warm charcoal text on soft cream */
    --color-text:           #28303f;
    --color-text-muted:     #6b7280;   /* AA contrast on white (was #8a8fa3 ≈3.5:1) */
    --color-border:         #e7e3db;
    --color-surface:        #ffffff;
    --color-surface-muted:  #f6f3ee;
    --color-bg:             #f7f4ef;

    /* Focus ring (matches primary at 35% alpha) */
    --focus-ring: rgba(31, 78, 121, 0.35);

    /* Radius */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   14px;
    --radius-pill: 20px;

    /* Shadow — layered and soft */
    --shadow-card:  0 1px 2px rgba(40, 48, 63, 0.04), 0 4px 14px rgba(40, 48, 63, 0.06);
    --shadow-hover: 0 8px 24px rgba(31, 78, 121, 0.14);

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    /* Typography */
    --font-family-base: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-md: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 22px;
}

/* ============================================================
   Phase 2 — RTL / Direction Utilities
   Replace locale @if blocks with these CSS-driven classes
   ============================================================ */

/* .pull-end floats to the trailing edge (right in LTR, left in RTL) */
[dir="ltr"] .pull-end { float: right !important; }
[dir="rtl"] .pull-end { float: left  !important; }

/* .pull-start floats to the leading edge */
[dir="ltr"] .pull-start { float: left  !important; }
[dir="rtl"] .pull-start { float: right !important; }

/* text-end aligns text to trailing edge */
[dir="ltr"] .text-end-dir { text-align: right !important; }
[dir="rtl"] .text-end-dir { text-align: left  !important; }

/* text-start aligns text to leading edge */
[dir="ltr"] .text-start-dir { text-align: left  !important; }
[dir="rtl"] .text-start-dir { text-align: right !important; }

/* margin start/end (Bootstrap 4 doesn't have ms-/me-; these bridge the gap) */
[dir="ltr"] .ms-dir-2 { margin-left:  0.5rem !important; }
[dir="rtl"] .ms-dir-2 { margin-right: 0.5rem !important; }
[dir="ltr"] .me-dir-2 { margin-right: 0.5rem !important; }
[dir="rtl"] .me-dir-2 { margin-left:  0.5rem !important; }
[dir="ltr"] .ms-dir-1 { margin-left:  0.25rem !important; }
[dir="rtl"] .ms-dir-1 { margin-right: 0.25rem !important; }
[dir="ltr"] .me-dir-1 { margin-right: 0.25rem !important; }
[dir="rtl"] .me-dir-1 { margin-left:  0.25rem !important; }
[dir="ltr"] .pe-dir-2 { padding-right: 0.5rem !important; }
[dir="rtl"] .pe-dir-2 { padding-left:  0.5rem !important; }

/* Bootstrap 5-style utilities used by shared components (search-form, data-table,
   alert, empty-state) but NOT shipped by Bootstrap 4.4.1 / DeskApp. Without these,
   search/reset buttons and icon+text were glued together on ~30 admin pages.
   me-* use logical margin-inline-end so they stay correct in both LTR and RTL. */
.me-1 { margin-inline-end: 0.25rem !important; }
.me-2 { margin-inline-end: 0.5rem !important; }
.ms-1 { margin-inline-start: 0.25rem !important; }
.ms-2 { margin-inline-start: 0.5rem !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.row.g-2 { row-gap: 0.5rem !important; }
.row.g-3 { row-gap: 1rem !important; }

.pagination-footer-controls,
.pagination-footer-per-page {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
}

.pagination-footer-per-page label {
    white-space: nowrap;
}

.pagination-footer-per-page select {
    width: auto;
    min-width: 72px;
}

.pagination-footer-links .pagination {
    flex-wrap: nowrap;
    margin-bottom: 0;
}

@media screen and (max-width: 575.98px) {
    .pagination-footer-controls {
        flex-wrap: wrap;
    }
}

/* Report cards (.invoice-box) hold wide financial tables; on small screens let
   the card scroll horizontally instead of clipping money/date columns. Print
   media is unaffected, so PDF/print exports keep the full table width. */
@media screen and (max-width: 767px) {
  .invoice-box { overflow-x: auto; }
}

/* .invoice-col — salary payslip columns float to the leading edge per direction */
[dir="ltr"] .invoice-col { float: left  !important; }
[dir="rtl"] .invoice-col { float: right !important; }

/* salary invoice text block alignment */
[dir="rtl"] .invoice-desc  { text-align: right !important; }
[dir="ltr"] .invoice-desc  { text-align: left; }

/* section-label alignment */
[dir="rtl"] .section-label { text-align: right !important; }

/* Sidebar/header placement for Arabic dashboard layouts. */
.left-side-bar.rtl-sidebar,
.left-side-bar.rtl-sidebar::before {
    left: auto;
    right: 0;
}

body,
button,
input,
select,
textarea {
    font-family: var(--font-family-base);
}

html,
body {
    overflow-x: hidden;
}

.header.rtl-header {
    right: auto;
    left: 0;
}

.header.rtl-header .dropdown-menu {
    right: auto;
    left: 0;
}

.user-dropdown-ltr,
.user-dropdown-rtl {
    display: inline-flex !important;
    align-items: center;
}

.user-dropdown-ltr { direction: rtl; }
.user-dropdown-ltr::after {
    margin-left: 0;
    margin-right: .255em;
}
.user-dropdown-rtl { direction: ltr; }

html[dir="rtl"] .main-container {
    padding-left: 20px;
    padding-right: 300px;
}

.sidebar-menu .dropdown-toggle {
    padding-inline-start: 67px;
    padding-inline-end: 42px;
}

.sidebar-menu .dropdown-toggle.no-arrow {
    padding-inline-end: 15px;
}

.sidebar-menu .dropdown-toggle .micon {
    left: auto;
    right: auto;
    inset-inline-start: 10px;
}

.sidebar-menu .dropdown-toggle::after {
    left: auto;
    right: auto;
    inset-inline-end: 15px;
}

.sidebar-menu .submenu li a {
    padding-inline-start: 60px;
    padding-inline-end: 42px;
}

.sidebar-menu .submenu li a.no-arrow {
    padding-inline-end: 15px;
}

.sidebar-menu .submenu li > a::before {
    left: auto;
    right: auto;
    inset-inline-start: 28px;
}

.sidebar-menu .submenu li:hover > a::before,
.sidebar-menu .submenu li > a.active::before,
.sidebar-menu .submenu li > a[aria-current="page"]::before {
    left: auto;
    right: auto;
    inset-inline-start: 18px;
}

.sidebar-menu .dropdown.show > .submenu {
    display: block;
}

.sidebar-menu .dropdown.show > .dropdown-toggle,
.sidebar-menu .dropdown > .dropdown-toggle.active {
    background: rgba(0, 0, 0, .4);
    color: #fff;
    font-weight: 500;
}

.sidebar-menu .submenu li > a.active,
.sidebar-menu .submenu li > a[aria-current="page"] {
    background: rgba(255, 255, 255, .14);
    border-inline-start: 3px solid var(--color-primary);
    color: #fff;
    font-weight: 600;
    padding-inline-start: 57px;
}

.left-side-bar.rtl-sidebar .sidebar-menu .submenu li > a.active,
.left-side-bar.rtl-sidebar .sidebar-menu .submenu li > a[aria-current="page"] {
    padding-inline-start: 57px;
}

.sidebar-menu .submenu li > a.active::before,
.sidebar-menu .submenu li > a[aria-current="page"]::before {
    color: var(--color-primary);
}

.sidebar-menu .dropdown-toggle:focus-visible,
.sidebar-menu .submenu li > a:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35);
}

@media (min-width: 1200px) and (max-width: 1400px) {
    html[dir="rtl"] .main-container {
        padding-right: 270px;
        padding-left: 20px;
    }
}

@media (max-width: 1300px) {
    .left-side-bar.rtl-sidebar {
        left: auto;
        right: -281px;
    }

    .left-side-bar.rtl-sidebar.open {
        left: auto;
        right: 0;
    }

    html[dir="rtl"] .main-container {
        padding-right: 0;
        padding-left: 0;
    }
}

/* ============================================================
   Status Badges  (replaces <button> status elements)
   ============================================================ */

.status-badge {
    display:       inline-flex;
    align-items:   center;
    gap:           4px;
    padding:       3px 10px;
    border-radius: var(--radius-pill);
    font-size:     var(--font-size-xs);
    font-weight:   600;
    white-space:   nowrap;
}

.status-badge-approved,
.status-badge-success {
    background: var(--color-success-light);
    color:      var(--color-success);
}

.status-badge-pending,
.status-badge-warning {
    background: var(--color-warning-light);
    color:      var(--color-warning);
}

.status-badge-rejected,
.status-badge-danger {
    background: var(--color-danger-light);
    color:      var(--color-danger);
}

/* ============================================================
   Page Header Component
   ============================================================ */

.x-page-header {
    display:         flex;
    align-items:     flex-start;
    justify-content: space-between;
    flex-wrap:       wrap;
    gap:             12px;
    margin-bottom:   24px;
    padding-bottom:  16px;
    border-bottom:   1px solid var(--color-border);
}

.x-page-header .page-title {
    font-size:   20px;
    font-weight: 700;
    color:       var(--color-text);
    margin:      0 0 4px;
}

.x-page-header .breadcrumb {
    font-size:   var(--font-size-sm);
    color:       var(--color-text-muted);
    margin:      0;
    padding:     0;
    background:  none;
}

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

/* ============================================================
   Data Table Enhancements
   ============================================================ */

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

.table tbody tr:hover {
    background-color: var(--color-primary-light);
}

/* Inline action buttons (replaces three-dot dropdown) */
.table-actions {
    display:    flex;
    gap:        4px;
    flex-wrap:  nowrap;
    align-items: center;
}

.stat-card-link {
    color: inherit;
    text-decoration: none;
}

.stat-card-link:hover,
.stat-card-link:focus {
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.widget-style3 {
    position: relative;
    padding: var(--space-5);
    overflow: hidden;
    border-top: 3px solid transparent;
    transition: transform .18s ease, box-shadow .18s ease;
}

.widget-style3 > .d-flex {
    flex-wrap: nowrap !important;
    gap: var(--space-4);
}

.widget-style3 .widget-icon {
    display: flex;
    flex: 0 0 58px;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: var(--radius-lg);
}

.widget-style3 .widget-icon .icon {
    color: #fff;
    font-size: 27px;
    line-height: 1;
}

.widget-style3 .widget-data {
    flex: 1 1 auto;
    min-width: 0;
}

.stat-top-blue { border-top-color: var(--color-primary); }
.stat-top-green { border-top-color: var(--color-success); }
.stat-top-orange { border-top-color: var(--color-warning); }
.stat-top-red { border-top-color: var(--color-danger); }
.stat-top-purple { border-top-color: #6f42c1; }

.branch-health-card {
    height: 100%;
    border-inline-start: 4px solid var(--color-primary);
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    margin-top: var(--space-1);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.chart-card {
    position: relative;
    min-height: 220px;
}

.chart-card-body {
    min-height: 180px;
}

.chart-card.is-loading .chart-card-body {
    visibility: hidden;
}

.chart-card.is-loading .chart-card-loader {
    display: block;
}

.chart-card-loader {
    display: none;
    position: absolute;
    inset: 64px var(--space-4) var(--space-4);
}

.card-section-header {
    border-bottom: 1px solid var(--color-border);
}

.card-section-title {
    margin: 0;
    color: var(--color-text);
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.skeleton {
    position: relative;
    overflow: hidden;
    background: #e9edf3;
    border-radius: var(--radius-md);
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .72), transparent);
    animation: skeleton-shimmer 1.35s infinite;
}

.skeleton-line { height: 12px; margin-bottom: var(--space-2); }
.skeleton-line:last-child { width: 62%; margin-bottom: 0; }
.skeleton-chart { height: 100%; min-height: 150px; }

@keyframes skeleton-shimmer {
    100% { transform: translateX(100%); }
}

button.is-busy,
.btn.is-busy {
    position: relative;
    pointer-events: none;
    opacity: .72;
}

button.is-busy::after,
.btn.is-busy::after {
    content: "";
    display: inline-block;
    width: 13px;
    height: 13px;
    margin-inline-start: var(--space-2);
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: busy-spin .65s linear infinite;
    vertical-align: -2px;
}

@keyframes busy-spin {
    to { transform: rotate(360deg); }
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--focus-ring) !important;
    outline-offset: 2px;
}

.command-palette-trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    align-self: center;
    margin-inline: var(--space-3);
    padding: 8px 11px;
    color: var(--color-text-muted);
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.command-palette-trigger kbd,
.command-palette-search kbd {
    padding: 2px 6px;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    box-shadow: none;
    font-size: 11px;
}

.command-palette {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.command-palette[hidden] {
    display: none;
}

.command-palette-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .58);
    backdrop-filter: blur(3px);
}

.command-palette-panel {
    position: relative;
    width: min(620px, calc(100% - 32px));
    max-height: min(680px, calc(100vh - 80px));
    margin: 10vh auto 0;
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .3);
}

.command-palette-search {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.command-palette-search > i {
    color: var(--color-primary);
    font-size: 22px;
}

.command-palette-search input {
    flex: 1;
    height: 42px;
    color: var(--color-text);
    background: transparent;
    border: 0;
    font-size: 16px;
}

.command-palette-results {
    max-height: 470px;
    padding: var(--space-2);
    overflow-y: auto;
}

.command-palette-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 11px 12px;
    color: var(--color-text);
    border-radius: var(--radius-md);
}

.command-palette-item:hover,
.command-palette-item.is-active {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.command-palette-item > i:first-child {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    place-items: center;
    background: var(--color-surface-muted);
    border-radius: var(--radius-md);
    font-size: 19px;
}

.command-palette-item span {
    min-width: 0;
}

.command-palette-item strong,
.command-palette-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.command-palette-item small {
    margin-top: 2px;
    color: var(--color-text-muted);
}

.command-palette-enter {
    margin-inline-start: auto;
    color: var(--color-text-muted);
}

[dir="rtl"] .command-palette-enter {
    transform: rotate(180deg);
}

.command-palette-empty {
    padding: var(--space-6);
    color: var(--color-text-muted);
    text-align: center;
}

.command-palette-open {
    overflow: hidden;
}

.order-status-timeline {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 0;
    padding: 0;
}

.order-status-timeline li {
    position: relative;
    display: flex;
    align-items: center;
    flex-direction: column;
    min-width: 0;
    color: var(--color-text-muted);
    text-align: center;
}

.order-status-timeline li::before {
    content: "";
    position: absolute;
    top: 18px;
    inset-inline-start: -50%;
    width: 100%;
    height: 3px;
    background: var(--color-border);
}

.order-status-timeline li:first-child::before {
    display: none;
}

.order-status-timeline li.is-complete::before,
.order-status-timeline li.is-current::before {
    background: var(--color-success);
}

.order-status-marker {
    position: relative;
    z-index: 1;
    display: grid;
    width: 38px;
    height: 38px;
    margin-bottom: var(--space-2);
    place-items: center;
    background: var(--color-surface-muted);
    border: 2px solid var(--color-border);
    border-radius: 50%;
    font-weight: 700;
}

.order-status-timeline .is-complete .order-status-marker {
    color: #fff;
    background: var(--color-success);
    border-color: var(--color-success);
}

.order-status-timeline .is-current .order-status-marker {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 5px var(--color-primary-light);
}

.order-status-label {
    color: var(--color-text);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.order-status-timeline small {
    display: block;
    margin-top: var(--space-1);
    font-size: 11px;
}

.order-cancelled-state {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    color: var(--color-danger);
    background: rgba(233, 90, 90, .1);
    border-radius: var(--radius-md);
}

.order-cancelled-state > i {
    font-size: 26px;
}

.order-cancelled-state p {
    margin: 3px 0 0;
    color: var(--color-text-muted);
}

@media (max-width: 767.98px) {
    .command-palette-trigger span,
    .command-palette-trigger kbd {
        display: none;
    }

    .order-status-timeline {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .order-status-timeline li {
        align-items: flex-start;
        flex-direction: row;
        min-height: 62px;
        gap: var(--space-3);
        text-align: start;
    }

    .order-status-timeline li::before {
        top: -24px;
        inset-inline-start: 18px;
        width: 3px;
        height: 42px;
    }

    .order-status-timeline small {
        margin-inline-start: auto;
    }

    .table-stack-mobile {
        border: 0;
    }

    .table-stack-mobile thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .table-stack-mobile tbody,
    .table-stack-mobile tr,
    .table-stack-mobile td {
        display: block;
        width: 100%;
    }

    .table-stack-mobile tbody tr {
        margin: var(--space-3);
        width: calc(100% - (var(--space-3) * 2));
        padding: var(--space-2) var(--space-4);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        background: var(--color-surface);
        box-shadow: var(--shadow-card);
    }

    .table-stack-mobile tbody td {
        display: flex;
        justify-content: space-between;
        gap: var(--space-4);
        padding: var(--space-2) 0;
        border-top: 1px solid var(--color-border);
        text-align: end;
    }

    .table-stack-mobile tbody td:first-child {
        border-top: 0;
    }

    .table-stack-mobile tbody td::before {
        content: attr(data-label);
        flex: 0 0 44%;
        color: var(--color-text-muted);
        font-weight: 600;
        text-align: start;
    }

    .table-stack-mobile tbody td[colspan]::before {
        display: none;
    }
}

/* ============================================================
   Empty State Component
   ============================================================ */

.x-empty-state {
    text-align: center;
    padding:    48px 24px;
    color:      var(--color-text-muted);
}

.x-empty-state img,
.x-empty-state .empty-icon {
    width:         100px;
    height:        100px;
    margin-bottom: 16px;
    opacity:       0.6;
}

.x-empty-state h5 {
    font-size:     16px;
    font-weight:   600;
    color:         var(--color-text);
    margin-bottom: 6px;
}

.x-empty-state p {
    font-size:     var(--font-size-sm);
    margin-bottom: 16px;
}

/* ============================================================
   Form Enhancements
   ============================================================ */

.x-page-header > div:first-child {
    min-width: 0;
    text-align: start;
}

.x-page-header .breadcrumb {
    align-items: center;
    justify-content: flex-start;
    direction: inherit;
    text-align: start;
}

[dir="rtl"] .x-page-header .breadcrumb-item + .breadcrumb-item {
    padding-right: .5rem;
    padding-left: 0;
}

[dir="rtl"] .x-page-header .breadcrumb-item + .breadcrumb-item::before {
    padding-right: 0;
    padding-left: .5rem;
}

[dir="rtl"] .x-page-header .page-actions {
    justify-content: flex-end;
}

.card-box .form-label,
.card-box label,
.x-search-form label,
.modal label,
.invalid-feedback,
.valid-feedback,
.form-text,
.text-muted {
    text-align: start;
}

.card-box .form-group,
.card-box .mb-3,
.x-search-form .form-group,
.x-search-form .mb-3 {
    text-align: start;
}

.form-control,
.custom-select,
select.form-control,
textarea.form-control {
    direction: inherit;
    text-align: start;
}

[dir="rtl"] .form-control,
[dir="rtl"] .custom-select,
[dir="rtl"] select.form-control,
[dir="rtl"] textarea.form-control {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .form-control::placeholder,
[dir="rtl"] textarea.form-control::placeholder {
    text-align: right;
}

.field-ltr,
.code-field,
.date-field,
.number-field,
.email-field,
.phone-field,
.url-field,
.billing-code,
input[type="number"].form-control,
input[type="date"].form-control,
input[type="datetime-local"].form-control,
input[type="month"].form-control,
input[type="time"].form-control,
input[type="email"].form-control,
input[type="url"].form-control,
input[type="tel"].form-control,
input[type="password"].form-control,
input[name*="code"].form-control,
input[name*="date"].form-control,
input[name*="Date"].form-control,
input[name*="invoice"].form-control,
input[name*="username"].form-control {
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
}

.text-dir-auto {
    direction: auto;
    text-align: start;
}

.field-rtl {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .input-group {
    direction: rtl;
}

[dir="rtl"] .input-group > .form-control {
    direction: inherit;
}

[dir="rtl"] .input-group > .field-ltr,
[dir="rtl"] .input-group > .code-field,
[dir="rtl"] .input-group > .date-field,
[dir="rtl"] .input-group > .number-field,
[dir="rtl"] .input-group > .email-field,
[dir="rtl"] .input-group > .phone-field,
[dir="rtl"] .input-group > .url-field {
    direction: ltr;
}

.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    min-height: 38px;
    border-color: #ced4da;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 36px;
    text-align: start;
}

[dir="rtl"] .select2-container--default .select2-selection--single {
    direction: rtl;
}

[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__rendered,
[dir="rtl"] .select2-results__option {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__arrow {
    right: auto;
    left: 1px;
}

[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__clear {
    float: left;
}

.form-label .required,
.form-label .text-danger,
label .required,
label .text-danger {
    margin-inline-start: .15rem;
}

.form-section-title {
    font-size:     var(--font-size-sm);
    font-weight:   600;
    color:         var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 8px;
    border-bottom:  1px solid var(--color-border);
    margin-bottom:  16px;
    margin-top:     24px;
}

.form-actions-bar {
    display:         flex;
    justify-content: space-between;
    align-items:     center;
    gap:             var(--space-3);
    padding-top:     20px;
    margin-top:      20px;
    border-top:      1px solid var(--color-border);
}

[dir="rtl"] .form-actions-bar {
    direction: rtl;
}

.form-actions-bar .btn {
    min-width: 120px;
}

@media (max-width: 575.98px) {
    .form-actions-bar {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .form-actions-bar > * {
        width: 100%;
    }
}

.x-search-form .row {
    row-gap: var(--space-3);
}

.x-search-form .col-auto {
    margin-inline-start: auto;
}

[dir="rtl"] .x-search-form .col-auto {
    margin-inline-start: 0;
    margin-inline-end: auto;
}

.table th,
.table td {
    text-align: start;
    vertical-align: middle;
}

.table-actions {
    justify-content: flex-start;
}

[dir="rtl"] .table-actions {
    justify-content: flex-end;
}

/* ============================================================
   Card Enhancements
   ============================================================ */

.card-box {
    box-shadow: var(--shadow-card);
    border-radius: var(--radius-md);
}

/* Stat-card icon accent — DeskApp ships bg-light-{blue,green,orange,purple}
   but no red. Fill the gap so danger stat cards get a proper icon colour. */
.bg-light-red { background-color: #ee6e73; }

/* ============================================================
   Fixed-header offset fix (768–1024px band)
   ------------------------------------------------------------
   DeskApp's style.css intends the header to be position:relative
   at <=1024px, but a later unconditional `.header{position:fixed}`
   overrides it — so the header is fixed at every width, while
   `.main-container` padding-top still drops to 10px in this band,
   sliding page content under the 70px header. Reserve space for the
   always-fixed header here. (<=767px already uses 80px in vendor CSS.)
   ============================================================ */
@media (max-width: 1024px) {
    .main-container { padding-top: 80px; }
}

/* ============================================================
   Stat Card Pulse (pending indicator)
   ============================================================ */

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(1.3); }
}

.pending-pulse::after {
    content:    '';
    display:    inline-block;
    width:      8px;
    height:     8px;
    border-radius: 50%;
    background: var(--color-warning);
    margin-left: 6px;
    animation:  pulse-dot 1.5s ease-in-out infinite;
    vertical-align: middle;
}

/* ============================================================
   Toast Notifications (Phase 5 — replaces SweetAlert confirms)
   ============================================================ */

.toast-container-top-right {
    position: fixed;
    top:      20px;
    right:    20px;
    z-index:  9999;
}

html[dir="rtl"] .toast-container-top-right {
    right: auto;
    left:  20px;
}

/* ============================================================
   Print Overrides  (for report pages)
   ============================================================ */

.salary-slip-print-area {
    max-width: 920px;
    margin: 0 auto;
}

.salary-slip-document {
    background: #fff;
    color: #182b49;
    border: 1px solid #dce5ef;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 18px 44px rgba(20, 43, 73, 0.08);
}

.salary-slip-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    border-bottom: 1px solid #dce5ef;
    padding-bottom: 22px;
    margin-bottom: 18px;
}

.salary-slip-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.salary-slip-brand h2,
.salary-slip-title-block h1,
.salary-slip-document h3 {
    margin: 0 0 8px;
}

.salary-slip-brand h2 {
    color: #172b4d;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.salary-slip-logo {
    width: 76px;
    height: 76px;
    max-height: 76px;
    object-fit: contain;
    border: 1px solid #dce5ef;
    border-radius: 12px;
    padding: 7px;
    background: #fff;
}

.salary-slip-title-block {
    min-width: 260px;
    padding: 16px 18px;
    border-radius: 10px;
    background: #172b4d;
    color: #fff;
    text-align: end;
}

.salary-slip-title-block h1 {
    color: #fff;
    font-size: 25px;
    font-weight: 800;
}

.salary-slip-document-meta {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    color: #dce7f5;
    font-size: 12px;
}

.salary-slip-document-meta > div {
    display: grid;
    gap: 3px;
}

.salary-slip-document-meta strong {
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.salary-slip-muted {
    color: #697386;
    font-size: 13px;
}

.salary-slip-info-table,
.salary-slip-lines,
.salary-slip-signatures {
    width: 100%;
    border-collapse: collapse;
}

.salary-slip-identity {
    padding: 14px;
    border: 1px solid #dce5ef;
    border-radius: 10px;
    background: #f8fafc;
}

.salary-slip-info-table th,
.salary-slip-info-table td,
.salary-slip-lines td {
    border: 1px solid #dce5ef;
    padding: 11px 12px;
}

.salary-slip-info-table th {
    width: 18%;
    background: #eef3f8;
    color: #39516e;
    font-weight: 700;
}

.salary-slip-breakdown {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.salary-slip-section {
    overflow: hidden;
    border: 1px solid #dce5ef;
    border-radius: 10px;
    background: #fff;
}

.salary-slip-section-heading {
    padding: 11px 14px;
    border-inline-start: 4px solid #236e9c;
    background: #f4f8fb;
}

.salary-slip-section--deductions .salary-slip-section-heading {
    border-inline-start-color: #bd6a36;
    background: #fdf7f2;
}

.salary-slip-section-heading h3 {
    color: #172b4d;
    font-size: 18px;
    font-weight: 800;
    margin: 0;
}

.salary-slip-lines td:last-child {
    text-align: end;
    font-weight: 700;
    color: #172b4d;
    white-space: nowrap;
}

.salary-slip-total-row td {
    background: #eef3f8;
    color: #172b4d;
    font-weight: 700;
}

.salary-slip-net-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 22px;
    border: 0;
    border-radius: 10px;
    background: #172b4d;
    color: #fff;
    padding: 18px 20px;
    font-size: 19px;
    box-shadow: 0 10px 24px rgba(23, 43, 77, 0.16);
}

.salary-slip-net-total span {
    color: #dce7f5;
    font-weight: 700;
}

.salary-slip-net-total strong {
    color: #fff;
    font-size: 27px;
    font-weight: 800;
}

.salary-slip-note,
.salary-slip-acknowledgement {
    margin-top: 22px;
    border: 1px solid #dce5ef;
    border-radius: 10px;
    padding: 16px 18px;
    background: #fafcff;
}

.salary-slip-note p,
.salary-slip-acknowledgement p {
    margin: 0;
    line-height: 1.9;
}

.salary-slip-signatures {
    margin-top: 34px;
}

.salary-slip-signatures td {
    width: 33.333%;
    padding: 0 12px;
    vertical-align: bottom;
}

.salary-slip-signatures div {
    height: 42px;
    border-bottom: 1px solid #7b8ba0;
    margin-top: 18px;
}

@media (max-width: 767.98px) {
    .salary-slip-document {
        border-radius: 8px;
        padding: 18px;
    }

    .salary-slip-header,
    .salary-slip-document-meta,
    .salary-slip-breakdown {
        display: block;
    }

    .salary-slip-title-block {
        margin-top: 16px;
        min-width: 0;
    }

    .salary-slip-document-meta > div + div,
    .salary-slip-section + .salary-slip-section {
        margin-top: 10px;
    }

    .salary-slip-info-table th,
    .salary-slip-info-table td {
        display: block;
        width: 100%;
    }

    .salary-slip-net-total strong {
        font-size: 22px;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    .left-side-bar,
    .header,
    .x-page-header .page-actions,
    .x-page-header,
    .x-search-form,
    .x-report-tabs,
    .noprint,
    .footer-wrap,
    .mobile-menu-overlay {
        display: none !important;
    }

    .main-container .min-height-200px > *:not(.print-area) {
        display: none !important;
    }

    .main-container {
        padding: 0 !important;
        margin:  0 !important;
    }

    .main-container .pd-ltr-20,
    .main-container .min-height-200px {
        padding: 0 !important;
        margin: 0 !important;
        min-height: 0 !important;
    }

    .print-area {
        display: block !important;
        visibility: visible !important;
        position: static !important;
        width: 100% !important;
    }

    .salary-slip-print-area {
        max-width: 190mm;
        margin: 0 auto !important;
    }

    .salary-slip-document {
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
        page-break-inside: avoid;
        color: #111 !important;
    }

    .salary-slip-info-table th,
    .salary-slip-info-table td,
    .salary-slip-lines td {
        padding: 7px 9px !important;
    }

    .salary-slip-net-total,
    .salary-slip-info-table th,
    .salary-slip-total-row td,
    .salary-slip-title-block,
    .salary-slip-section-heading {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body {
        background: #fff;
        padding: 10mm !important;
    }
}

/* ============================================================
   Header — branch selector & restaurant branding (F-19)
   ============================================================ */

.header-left {
    display:     flex;
    align-items: center;
    gap:         10px;
}

.header-restaurant-logo {
    height:      36px;
    max-width:   130px;
    object-fit:  contain;
    flex-shrink: 0;
}

.header-restaurant-name {
    font-weight:  600;
    font-size:    14px;
    color:        var(--color-text-muted);
    white-space:  nowrap;
}

.branch-nav-item {
    display:      flex;
    align-items:  center;
}

[dir="ltr"] .branch-nav-item { margin: 0 12px 0 0; }
[dir="rtl"] .branch-nav-item { margin: 0 0 0 12px; }

.branch-selector-toggle {
    display:         flex;
    align-items:     center;
    gap:             6px;
    cursor:          pointer;
    font-size:       13px;
    color:           var(--color-text);
    padding:         6px 10px;
    border:          1px solid var(--color-border);
    border-radius:   var(--radius-sm);
    background:      var(--color-bg);
    text-decoration: none;
}

.branch-selector-toggle:hover {
    color:           var(--color-primary);
    border-color:    var(--color-primary);
    text-decoration: none;
}

.branch-selector-icon { font-size: 15px; }

.branch-selector-menu { min-width: 180px; }

.branch-btn {
    border:     none;
    background: none;
    width:      100%;
    font-size:  var(--font-size-sm);
}

[dir="ltr"] .branch-btn      { text-align: left;  }
[dir="rtl"] .branch-btn      { text-align: right; }
[dir="ltr"] .branch-btn-icon { margin-right: 6px; }
[dir="rtl"] .branch-btn-icon { margin-left:  6px; }

/* Billing / subscription screens */
.billing-code {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
}

.billing-detail-table th {
    width: 38%;
    color: var(--color-text-muted);
    font-weight: 600;
    text-align: start;
    white-space: nowrap;
}

.billing-detail-table td {
    text-align: start;
    word-break: break-word;
}

.billing-summary-head {
    gap: var(--space-3);
}

[dir="rtl"] .billing-summary-head {
    flex-direction: row-reverse;
}

.billing-inline-form {
    gap: var(--space-2);
}

/* ============================================================
   Footer (F-18 — was position:fixed, now static flow)
   ============================================================ */

.footer-wrap {
    margin-top: 24px;
    text-align: center;
    font-size:  var(--font-size-sm);
    color:      var(--color-text-muted);
}

/* ============================================================
   Quick Actions (dashboard)
   ============================================================ */

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

.quick-action-btn {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    gap:            6px;
    padding:        14px 20px;
    background:     var(--color-surface);
    border:         1px solid var(--color-border);
    border-radius:  var(--radius-md);
    color:          var(--color-text);
    text-decoration: none;
    font-size:      var(--font-size-sm);
    font-weight:    500;
    transition:     box-shadow 0.15s, border-color 0.15s, transform 0.12s;
    box-shadow:     var(--shadow-card);
    cursor:         pointer;
}

.quick-action-btn:hover {
    border-color: var(--color-primary);
    box-shadow:   var(--shadow-hover);
    transform:    translateY(-2px);
    color:        var(--color-primary);
    text-decoration: none;
}

.quick-action-btn i {
    font-size: 22px;
    color:     var(--color-primary);
}

/* ============================================================
   Dashboard — home.blade.php
   ============================================================ */

.dashboard-welcome {
    background:    linear-gradient(135deg, var(--color-primary-light) 0%, #fff 100%);
    border-radius: var(--radius-lg);
    padding:       24px;
    margin-bottom: 24px;
}

.welcome-title {
    font-size:     22px;
    font-weight:   700;
    color:         var(--color-text);
    margin-bottom: 4px;
}

.welcome-subtitle,
.welcome-meta {
    font-size:     var(--font-size-md);
    color:         var(--color-text-muted);
    margin-bottom: 4px;
}

.section-label {
    font-size:      var(--font-size-sm);
    font-weight:    600;
    color:          var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom:  12px;
}

/* Chart card header — row-reverse in RTL eliminates @if isLocale order swaps */
.chart-card-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    flex-wrap:       wrap;
    gap:             8px;
    margin-bottom:   16px;
}

[dir="rtl"] .chart-card-header { flex-direction: row-reverse; }

.chart-card-header h5 {
    margin:      0;
    font-size:   15px;
    font-weight: 700;
    color:       var(--color-text);
}

.chart-badge {
    display:       inline-block;
    padding:       3px 8px;
    border-radius: var(--radius-sm);
    background:    var(--color-primary-light);
    color:         var(--color-primary);
    font-size:     var(--font-size-xs);
    font-weight:   600;
}

.kpi-positive { color: var(--color-success); }
.kpi-negative { color: var(--color-danger);  }

/* ============================================================
   Detail view fields (x-detail-field component)
   ============================================================ */

.detail-label {
    font-size:      0.73rem;
    font-weight:    600;
    color:          var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.45px;
    margin-bottom:  3px;
}

.detail-value {
    font-size:    0.925rem;
    color:        var(--color-text);
    padding:      5px 0 8px;
    border-bottom: 1px solid var(--color-border);
    min-height:   34px;
    word-break:   break-word;
}

/* ============================================================
   Permission Matrix — Position Create / Edit Pages
   ============================================================ */

.perm-group-header {
    cursor:        pointer;
    background:    #f8f9fa;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    transition:    background .15s;
    user-select:   none;
}
.perm-group-header:hover { background: #eef0f5; }

.group-perm-badge {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    font-size:       .68rem;
    font-weight:     700;
    background:      #e9ecef;
    color:           var(--color-text-muted);
    border-radius:   var(--radius-pill);
    padding:         2px 8px;
    min-width:       42px;
    transition:      background .2s, color .2s;
    pointer-events:  none;
}
.group-perm-badge.has-perms {
    background: var(--color-success-light);
    color:      var(--color-success);
}

.global-perm-counter {
    font-size:     .77rem;
    font-weight:   600;
    color:         var(--color-text-muted);
    background:    #e9ecef;
    border-radius: var(--radius-pill);
    padding:       2px 10px;
    transition:    background .2s, color .2s;
}
.global-perm-counter.has-perms {
    background: var(--color-success-light);
    color:      var(--color-success);
}

.perm-section-header {
    display:         flex;
    justify-content: space-between;
    align-items:     center;
    margin-bottom:   6px;
    margin-top:      10px;
}
.perm-section-label {
    font-size:      .71rem;
    font-weight:    700;
    color:          var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.perm-section-locked {
    opacity: .72;
}
.perm-section-locked .custom-control-label {
    color: var(--color-text-muted);
    cursor: not-allowed;
}
.perm-feature-lock-badge {
    text-transform: none;
    letter-spacing: 0;
    white-space: normal;
}
.sec-quick-links { font-size: .72rem; line-height: 1; }
.sec-grant-link  { color: var(--color-success) !important; font-weight: 600; }
.sec-revoke-link { color: var(--color-danger)  !important; font-weight: 600; }
.sec-grant-link:hover,
.sec-revoke-link:hover { text-decoration: underline !important; }

.grant-group-btn,
.revoke-group-btn {
    font-size:     .72rem !important;
    padding:       2px 10px !important;
    border-radius: var(--radius-pill) !important;
    line-height:   1.6 !important;
}

.custom-control-input:checked ~ .custom-control-label {
    color:       var(--color-primary);
    font-weight: 500;
}

.group-chevron {
    display:    inline-block;
    transition: transform .25s ease;
}
.perm-group-header[aria-expanded="false"] .group-chevron {
    transform: rotate(-90deg);
}

/* Sticky toolbar: global counter + search + grant/revoke controls stay visible
   while scrolling the (long) matrix. 70px = fixed .header height. */
.perm-toolbar {
    position:      sticky;
    top:           78px;
    z-index:       50;
    gap:           8px;
    background:    var(--color-surface);
    border:        1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding:       10px 14px;
    box-shadow:    0 2px 8px rgba(0, 0, 0, .05);
}

.perm-toolbar > div {
    gap: 8px;
}

.perm-search-input {
    max-width: 230px;
    min-width: 170px;
}

.perm-no-results {
    color: var(--color-text-muted);
}

/* ============================================================
   Feature Catalog — documentation page + plan details panel
   ============================================================ */
.feature-detail-label {
    font-size:      .68rem;
    font-weight:    700;
    letter-spacing: .04em;
}
.feature-chip {
    display:        inline-block;
    margin:         2px 0;
    margin-inline-end: 4px;
    white-space:    normal;
    text-align:     start;
}
.feature-catalog-meta {
    font-size: .8rem;
}
.feature-info-link {
    font-size:   .72rem;
    font-weight: 600;
    color:       var(--color-text-muted) !important;
}
.feature-info-link:hover { color: var(--color-primary) !important; text-decoration: none; }
.feature-detail-panel .card-box { box-shadow: none; }

/* ============================================================
   Phase C + F — Dark Mode Token Block
   Activated when server sets data-theme="dark" on <html>
   ============================================================ */

[data-theme="dark"] {
    /* Brighter primary/accent for contrast on dark surfaces. Tenant theme
       overrides are injected after this stylesheet, so a customized tenant
       primary still wins in dark mode exactly as before. */
    --color-primary:        #5e94c5;
    --color-accent:         #f08a45;
    --color-text:           #e4e7ec;
    --color-text-muted:     #98a2b3;
    --color-border:         #323a49;
    --color-surface:        #202634;
    --color-surface-muted:  #262d3d;
    --color-bg:             #171c27;
    --color-primary-light:  rgba(94, 148, 197, 0.18);
    --color-accent-light:   rgba(232, 118, 45, 0.16);
    --color-success-light:  rgba(46, 178, 107, 0.18);
    --color-danger-light:   rgba(233, 90, 90, 0.18);
    --color-warning-light:  rgba(245, 158, 11, 0.18);
    --focus-ring:           rgba(120, 165, 205, 0.45);
    --shadow-card:          0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-hover:         0 6px 22px rgba(0, 0, 0, 0.45);
}

.archive-banner-icon {
    font-size: 1.4rem;
}

.welcome-illustration {
    max-height: 90px;
    width: auto;
    opacity: .85;
}

.budget-progress {
    height: 8px;
}

[data-theme="dark"] .skeleton {
    background: #303a4d;
}

/* Report system design tokens (`.report-surface`, see the shared operational
   report workspace block below) hardcode a light-mode ink color with no
   var() fallback, so every report page — including the Reports Center hero,
   KPI cards, section labels, and card titles — rendered dark navy text on
   the dark-mode surface (unreadable) until this override. */
[data-theme="dark"] .report-surface {
    --report-ink: var(--color-text);
}

/* Body & page shell */
[data-theme="dark"] body                { background-color: var(--color-bg); color: var(--color-text); }
[data-theme="dark"] .main-container     { background-color: var(--color-bg); }

/* Cards */
[data-theme="dark"] .card-box,
[data-theme="dark"] .card               { background: var(--color-surface); border-color: var(--color-border); }

/* Permission matrix */
[data-theme="dark"] .perm-group-header        { background: #232b3b; }
[data-theme="dark"] .perm-group-header:hover  { background: #2a3347; }
[data-theme="dark"] .group-perm-badge:not(.has-perms),
[data-theme="dark"] .global-perm-counter:not(.has-perms) { background: #252d3d; }

/* Tables */
[data-theme="dark"] .table                              { color: var(--color-text); }
[data-theme="dark"] .table th,
[data-theme="dark"] .table td                          { border-color: var(--color-border); }
[data-theme="dark"] .table-bordered                    { border-color: var(--color-border); }
[data-theme="dark"] .table thead th                    { background: var(--color-bg); color: var(--color-text-muted); }
[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) { background-color: rgba(255,255,255,0.03); }

/* Form controls */
[data-theme="dark"] .form-control,
[data-theme="dark"] .custom-select          { background-color: #252d3d; border-color: var(--color-border); color: var(--color-text); }
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .custom-select:focus    { background-color: #2a3347; border-color: var(--color-primary); color: var(--color-text); }
[data-theme="dark"] .form-control::placeholder { color: var(--color-text-muted); }
[data-theme="dark"] label,
[data-theme="dark"] .form-label             { color: var(--color-text); }
[data-theme="dark"] .input-group-text       { background-color: #252d3d; border-color: var(--color-border); color: var(--color-text-muted); }

/* Dropdowns */
[data-theme="dark"] .dropdown-menu              { background-color: var(--color-surface); border-color: var(--color-border); }
[data-theme="dark"] .dropdown-item              { color: var(--color-text); }
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus        { background-color: rgba(255,255,255,0.06); color: var(--color-text); }
[data-theme="dark"] .dropdown-divider           { border-color: var(--color-border); }

/* Modals */
[data-theme="dark"] .modal-content     { background-color: var(--color-surface); border-color: var(--color-border); color: var(--color-text); }
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer      { border-color: var(--color-border); }

/* Pagination */
[data-theme="dark"] .page-link         { background-color: var(--color-surface); border-color: var(--color-border); color: var(--color-text); }
[data-theme="dark"] .page-link:hover   { background-color: rgba(255,255,255,0.08); color: var(--color-text); }
[data-theme="dark"] .page-item.disabled .page-link { background-color: var(--color-bg); border-color: var(--color-border); }

/* Alerts */
[data-theme="dark"] .alert             { border-color: var(--color-border); }

/* Badges */
[data-theme="dark"] .badge-light       { background-color: rgba(255,255,255,0.08); color: var(--color-text); }

/* Select2 */
[data-theme="dark"] .select2-container--default .select2-selection--single { background-color: #252d3d; border-color: var(--color-border); }
[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--color-text); }
[data-theme="dark"] .select2-dropdown  { background-color: var(--color-surface); border-color: var(--color-border); }
[data-theme="dark"] .select2-container--default .select2-results__option { color: var(--color-text); }
[data-theme="dark"] .select2-container--default .select2-results__option:hover { background-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: var(--color-primary); }

/* Phase F — Sidebar */
[data-theme="dark"] .left-side-bar                  { background: #131929; border-color: #1e2740; }
[data-theme="dark"] .left-side-bar .sidebar-menu a  { color: #b0bec5; }
[data-theme="dark"] .left-side-bar .sidebar-menu a:hover,
[data-theme="dark"] .left-side-bar .sidebar-menu li.active > a { color: var(--color-primary); }
[data-theme="dark"] .left-side-bar .sidebar-menu .sub-menu      { background: #0f1522; }
[data-theme="dark"] .left-side-bar .menu-title      { color: #5c7080; }
[data-theme="dark"] .left-side-bar .side-menu-title { color: #5c7080; }
[data-theme="dark"] .mobile-menu-overlay            { background: rgba(0,0,0,0.6); }

/* Phase F — Header */
[data-theme="dark"] .header                         { background: #1a2236; border-color: #2d3748; }
[data-theme="dark"] .header .header-left a,
[data-theme="dark"] .header .header-right a         { color: #b0bec5; }
[data-theme="dark"] .header .menu-icon              { color: #b0bec5; }
[data-theme="dark"] .header .user-info-dropdown .dropdown-menu { background-color: #1e2433; }
[data-theme="dark"] .header-restaurant-name         { color: #e2e8f0; }
[data-theme="dark"] .branch-selector-toggle,
[data-theme="dark"] .branch-selector-toggle .dw    { color: #b0bec5; }
[data-theme="dark"] .branch-selector-menu           { background-color: #1e2433; border-color: var(--color-border); }
[data-theme="dark"] .branch-btn                     { color: #b0bec5; }
[data-theme="dark"] .branch-btn:hover               { background-color: rgba(255,255,255,0.06); color: var(--color-text); }

/* ============================================================
   Phase L2 — Treasury Posting Queue table layout
   ============================================================ */

#posting-queue .posting-queue-account-select {
    min-width: 160px;
    max-width: 220px;
    width: 100%;
}

#posting-queue td {
    vertical-align: middle;
}

#posting-queue td .badge-warning {
    white-space: normal;
    max-width: 100%;
    text-align: start;
}

#posting-queue td .d-flex.flex-wrap {
    min-width: 0;
}

.sidebar-section-divider {
    height: 0;
    margin: 8px 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    list-style: none;
}

/* ============================================================
   UI Modernization 2026-07 — Warm Premium Component Layer
   ------------------------------------------------------------
   Maps DeskApp/Bootstrap 4 components onto the design tokens so
   the whole admin follows one identity (vendor CSS bakes its own
   hex values, e.g. .btn-primary was #1b00ff). Kept last so it
   wins the vendor cascade; [data-theme="dark"] rules above keep
   higher specificity and still apply on top.
   ============================================================ */

/* ---- Buttons ---- */
.btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: background-color .16s ease, border-color .16s ease,
                color .16s ease, box-shadow .16s ease, transform .12s ease;
}

.btn:not(.btn-lg):not(.btn-sm) {
    padding: 8px 18px;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary,
.btn-primary:not(:disabled):not(.disabled).active,
.btn-primary:not(:disabled):not(.disabled):active,
.show > .btn-primary.dropdown-toggle {
    color: #fff;
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary.focus {
    color: #fff;
    background-color: color-mix(in srgb, var(--color-primary), #000 14%);
    border-color: color-mix(in srgb, var(--color-primary), #000 14%);
    box-shadow: none;
}

.btn-primary.disabled,
.btn-primary:disabled {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    opacity: .55;
}

.btn-outline-primary {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background-color: transparent;
}

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

.btn-success,
.btn-success:not(:disabled):not(.disabled):active {
    color: #fff;
    background-color: var(--color-success);
    border-color: var(--color-success);
}

.btn-success:hover,
.btn-success:focus {
    color: #fff;
    background-color: color-mix(in srgb, var(--color-success), #000 14%);
    border-color: color-mix(in srgb, var(--color-success), #000 14%);
    box-shadow: none;
}

.btn-outline-success {
    color: var(--color-success);
    border-color: var(--color-success);
}

.btn-outline-success:hover,
.btn-outline-success:not(:disabled):not(.disabled):active {
    color: #fff;
    background-color: var(--color-success);
    border-color: var(--color-success);
}

.btn-danger,
.btn-danger:not(:disabled):not(.disabled):active {
    color: #fff;
    background-color: var(--color-danger);
    border-color: var(--color-danger);
}

.btn-danger:hover,
.btn-danger:focus {
    color: #fff;
    background-color: color-mix(in srgb, var(--color-danger), #000 14%);
    border-color: color-mix(in srgb, var(--color-danger), #000 14%);
    box-shadow: none;
}

.btn-outline-danger {
    color: var(--color-danger);
    border-color: var(--color-danger);
}

.btn-outline-danger:hover,
.btn-outline-danger:not(:disabled):not(.disabled):active {
    color: #fff;
    background-color: var(--color-danger);
    border-color: var(--color-danger);
}

.btn-warning,
.btn-warning:not(:disabled):not(.disabled):active {
    color: #4a3204;
    background-color: var(--color-warning);
    border-color: var(--color-warning);
}

.btn-warning:hover,
.btn-warning:focus {
    color: #4a3204;
    background-color: color-mix(in srgb, var(--color-warning), #000 10%);
    border-color: color-mix(in srgb, var(--color-warning), #000 10%);
    box-shadow: none;
}

.btn-info,
.btn-info:not(:disabled):not(.disabled):active {
    color: #fff;
    background-color: var(--color-info);
    border-color: var(--color-info);
}

.btn-info:hover,
.btn-info:focus {
    color: #fff;
    background-color: color-mix(in srgb, var(--color-info), #000 14%);
    border-color: color-mix(in srgb, var(--color-info), #000 14%);
    box-shadow: none;
}

.btn-secondary {
    color: var(--color-text);
    background-color: var(--color-surface-muted);
    border-color: var(--color-border);
}

.btn-secondary:hover,
.btn-secondary:focus {
    color: var(--color-text);
    background-color: color-mix(in srgb, var(--color-surface-muted), #000 7%);
    border-color: color-mix(in srgb, var(--color-border), #000 10%);
    box-shadow: none;
}

.btn-outline-secondary {
    color: var(--color-text-muted);
    border-color: var(--color-border);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:not(:disabled):not(.disabled):active {
    color: var(--color-text);
    background-color: var(--color-surface-muted);
    border-color: color-mix(in srgb, var(--color-border), #000 12%);
}

.btn-link {
    color: var(--color-primary);
    font-weight: 500;
}

.btn-link:hover {
    color: color-mix(in srgb, var(--color-primary), #000 20%);
}

/* ---- Semantic text/background utilities (vendor bakes #1b00ff etc.) ---- */
.text-primary { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-danger  { color: var(--color-danger) !important; }
.text-warning { color: #b97708 !important; }
.text-info    { color: var(--color-info) !important; }

.bg-primary { background-color: var(--color-primary) !important; }
.bg-success { background-color: var(--color-success) !important; }
.bg-danger  { background-color: var(--color-danger) !important; }
.bg-warning { background-color: var(--color-warning) !important; }
.bg-info    { background-color: var(--color-info) !important; }

.border-primary { border-color: var(--color-primary) !important; }
.border-success { border-color: var(--color-success) !important; }
.border-danger  { border-color: var(--color-danger) !important; }

.progress-bar { background-color: var(--color-primary); }
.progress-bar.bg-success { background-color: var(--color-success) !important; }
.progress-bar.bg-danger  { background-color: var(--color-danger) !important; }
.progress-bar.bg-warning { background-color: var(--color-warning) !important; }

[data-theme="dark"] .text-warning { color: #f5b04c !important; }

/* ---- Badges (soft-tint semantic variants) ---- */
.badge {
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 4px 8px;
}

.badge-pill {
    border-radius: var(--radius-pill);
}

.badge-primary { color: var(--color-primary); background-color: var(--color-primary-light); }
.badge-success { color: var(--color-success); background-color: var(--color-success-light); }
.badge-danger  { color: var(--color-danger);  background-color: var(--color-danger-light);  }
.badge-warning { color: #92610a;              background-color: var(--color-warning-light); }
.badge-info    { color: var(--color-info);    background-color: rgba(14, 156, 184, 0.12);   }
.badge-secondary { color: var(--color-text-muted); background-color: var(--color-surface-muted); }

[data-theme="dark"] .badge-warning { color: #f5b04c; }

/* Bootstrap .text-dark is unreadable on dark surfaces (stat-card values) */
[data-theme="dark"] .text-dark { color: var(--color-text) !important; }

/* ---- Cards ---- */
.card-box,
.card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.card-box {
    background: var(--color-surface);
}

/* ---- Tables ---- */
.table thead th {
    background: var(--color-surface-muted);
    border-bottom: 1px solid var(--color-border);
    border-top: 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding-top: 10px;
    padding-bottom: 10px;
}

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

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

[data-theme="dark"] .table thead th {
    background: var(--color-surface-muted);
}

/* ---- Forms ---- */
.form-control,
.custom-select {
    border-radius: var(--radius-md);
    border-color: var(--color-border);
    color: var(--color-text);
    transition: border-color .16s ease, box-shadow .16s ease;
}

.form-control:focus,
.custom-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.card-box label,
.modal label,
.form-label {
    font-weight: 600;
    color: var(--color-text);
    font-size: var(--font-size-sm);
}

.select2-container--default .select2-selection--single {
    border-radius: var(--radius-md);
    border-color: var(--color-border);
}

/* ---- Alerts (soft, with leading accent bar) ---- */
.alert {
    border: 1px solid transparent;
    border-inline-start: 4px solid transparent;
    border-radius: var(--radius-md);
}

.alert-info {
    color: color-mix(in srgb, var(--color-info), #000 35%);
    background-color: rgba(14, 156, 184, 0.10);
    border-color: rgba(14, 156, 184, 0.25);
    border-inline-start-color: var(--color-info);
}

.alert-success {
    color: color-mix(in srgb, var(--color-success), #000 30%);
    background-color: var(--color-success-light);
    border-color: color-mix(in srgb, var(--color-success), transparent 70%);
    border-inline-start-color: var(--color-success);
}

.alert-warning {
    color: #7a5306;
    background-color: var(--color-warning-light);
    border-color: rgba(245, 158, 11, 0.30);
    border-inline-start-color: var(--color-warning);
}

.alert-danger {
    color: color-mix(in srgb, var(--color-danger), #000 30%);
    background-color: var(--color-danger-light);
    border-color: color-mix(in srgb, var(--color-danger), transparent 70%);
    border-inline-start-color: var(--color-danger);
}

[data-theme="dark"] .alert-info    { color: #7ed4e6; }
[data-theme="dark"] .alert-success { color: #7fd8a5; }
[data-theme="dark"] .alert-warning { color: #f5c46b; }
[data-theme="dark"] .alert-danger  { color: #f1a0a0; }

/* ---- Pagination ---- */
.page-link {
    color: var(--color-primary);
    border-color: var(--color-border);
    min-width: 34px;
    text-align: center;
}

.page-link:hover {
    color: color-mix(in srgb, var(--color-primary), #000 20%);
    background-color: var(--color-primary-light);
    border-color: var(--color-border);
}

.page-item.active .page-link {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.page-item:first-child .page-link {
    border-start-start-radius: var(--radius-md);
    border-end-start-radius: var(--radius-md);
}

.page-item:last-child .page-link {
    border-start-end-radius: var(--radius-md);
    border-end-end-radius: var(--radius-md);
}

/* ---- Dropdown menus / modals ---- */
.dropdown-menu {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 34px rgba(40, 48, 63, 0.14);
}

.dropdown-item {
    transition: background-color .12s ease, color .12s ease;
}

.modal-content {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 70px rgba(40, 48, 63, 0.24);
}

/* ---- SweetAlert compact popup ---- */
.swal2-popup.swal-compact,
.swal-compact {
    border-radius: var(--radius-lg);
}

/* ---- Empty states: guided, softly framed ---- */
.x-empty-state {
    background: var(--color-surface-muted);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
}

.x-empty-state .empty-icon {
    color: var(--color-text-muted);
}

/* ---- Admin shell: page background, header + sidebar ---- */
body,
.main-container {
    background-color: var(--color-bg);
    color: var(--color-text);
}

.header {
    box-shadow: none;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.left-side-bar {
    background: #242b3a;   /* warm deep charcoal-navy */
}

.left-side-bar .brand-logo {
    height: 70px;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.left-side-bar .brand-logo a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.left-side-bar .brand-logo a img {
    width: auto;
    max-width: min(180px, calc(100% - 30px));
    max-height: 48px;
    object-fit: contain;
}

/* Sidebar page finder: always available above the independently scrolling menu. */
.left-side-bar .menu-block {
    height: calc(100vh - 146px);
}

.sidebar-search {
    height: 76px;
    padding: 14px 16px 13px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-search__control {
    position: relative;
}

.sidebar-search__input {
    width: 100%;
    height: 44px;
    padding-inline: 42px;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 12px;
    outline: 0;
    background: rgba(255, 255, 255, .07);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
    text-align: start;
    transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.sidebar-search__input::placeholder {
    color: rgba(255, 255, 255, .62);
    opacity: 1;
}

.sidebar-search__input::-webkit-search-cancel-button {
    display: none;
}

.sidebar-search__input:focus {
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, .11);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent), transparent 76%);
}

.sidebar-search__icon,
.sidebar-search__clear {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.sidebar-search__icon {
    inset-inline-start: 14px;
    color: rgba(255, 255, 255, .68);
    font-size: 17px;
    pointer-events: none;
}

.sidebar-search__clear {
    inset-inline-end: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: rgba(255, 255, 255, .72);
    cursor: pointer;
    transition: background-color .14s ease, color .14s ease;
}

.sidebar-search__clear[hidden],
.sidebar-search-empty[hidden],
.sidebar-menu li[hidden] {
    display: none !important;
}

.sidebar-search__clear:hover,
.sidebar-search__clear:focus-visible {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.sidebar-search__clear:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

.sidebar-search-empty {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 42px 24px;
    color: rgba(255, 255, 255, .68);
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
}

.sidebar-search-empty__icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 13px;
    background: rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .8);
    font-size: 19px;
}

.sidebar-menu--filtering .sidebar-section-divider {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .sidebar-search__input,
    .sidebar-search__clear {
        transition: none;
    }
}

.sidebar-menu .dropdown-toggle,
.sidebar-menu .submenu li a {
    transition: background-color .14s ease, color .14s ease;
}

.sidebar-menu .dropdown.show > .dropdown-toggle,
.sidebar-menu .dropdown > .dropdown-toggle.active {
    background: rgba(0, 0, 0, .32);
}

/* Active submenu accent follows the warm accent for a branded touch */
.sidebar-menu .submenu li > a.active,
.sidebar-menu .submenu li > a[aria-current="page"] {
    border-inline-start-color: var(--color-accent);
}

.sidebar-menu .submenu li > a.active::before,
.sidebar-menu .submenu li > a[aria-current="page"]::before {
    color: var(--color-accent);
}

[data-theme="dark"] .left-side-bar {
    background: #141926;
}

/* ---- Links ---- */
a {
    transition: color .12s ease;
}

/* ---- Breadcrumbs & in-card links follow the token palette ---- */
.x-page-header .breadcrumb a,
.breadcrumb a {
    color: var(--color-primary);
}

.breadcrumb a:hover {
    color: color-mix(in srgb, var(--color-primary), #000 20%);
}

.breadcrumb-item.active {
    color: var(--color-text-muted);
}

/* ---- Auth / guest pages ---- */
body.login-page {
    background:
        radial-gradient(640px 320px at 18% -8%, var(--color-accent-light), transparent 70%),
        radial-gradient(560px 300px at 88% 108%, var(--color-primary-light), transparent 70%),
        var(--color-bg);
}

body.login-page .login-box,
body.login-page .card-box {
    border-radius: var(--radius-lg);
    box-shadow: 0 14px 44px rgba(40, 48, 63, 0.10);
}

/* ---- Dashboard (2026-07 refresh) ---- */
.dashboard-welcome {
    position: relative;
    overflow: hidden;
    padding: 28px;
    color: #f4f6f9;
    background:
        radial-gradient(620px 190px at 85% -30%, rgba(232, 118, 45, 0.28), transparent 70%),
        linear-gradient(135deg, #242b3a 0%, color-mix(in srgb, var(--color-primary), #10141c 30%) 100%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.dashboard-welcome .welcome-title {
    color: #ffffff;
    font-size: 24px;
}

.dashboard-welcome .welcome-subtitle,
.dashboard-welcome .welcome-meta {
    color: rgba(244, 246, 249, 0.78);
}

.dashboard-welcome .welcome-illustration {
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.25));
}

.section-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-label::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--color-accent), var(--color-primary));
}

.quick-action-btn {
    flex-direction: row;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-lg);
}

.quick-action-btn i {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--color-accent-light);
    color: var(--color-accent);
    font-size: 19px;
    transition: background-color .16s ease, color .16s ease;
}

.quick-action-btn:hover i {
    background: var(--color-accent);
    color: #fff;
}

/* ---- Dashboard Quick Actions grid ---- */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}

.quick-actions-grid .quick-action-btn {
    width: 100%;
}

/* ---- Dashboard KPI flow rows (Cash Inflow/Outflow, Delivery Performance) ---- */
.dashboard-flow-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dashboard-flow-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.dashboard-flow-item strong {
    font-size: var(--font-size-md);
}

/* ---- Dashboard Notes widget ---- */
.dashboard-notes-view-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
}

.dashboard-notes-view-all:hover {
    color: var(--color-accent);
    text-decoration: none;
}

[dir="rtl"] .dashboard-notes-view-all i { transform: scaleX(-1); }

.dashboard-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 10px;
    border-radius: var(--radius-md);
    border-bottom: 1px solid var(--color-border);
}

.dashboard-note:last-child {
    border-bottom: none;
}

.dashboard-note.is-unread {
    background: var(--color-primary-light);
}

.dashboard-note-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
    color: var(--color-primary);
    font-size: 16px;
}

.dashboard-note.is-unread .dashboard-note-icon {
    background: var(--color-primary);
    color: #fff;
}

.dashboard-note-body {
    flex: 1 1 auto;
    min-width: 0;
}

.dashboard-note-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.dashboard-note-title {
    color: var(--color-text);
    font-size: var(--font-size-md);
}

.dashboard-note-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dashboard-note-preview {
    margin: 4px 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-note-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
}

.dashboard-note-meta i {
    margin-inline-end: 4px;
}

.dashboard-note-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: none;
}

.dashboard-note-action {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-muted);
    transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}

.dashboard-note-action:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.dashboard-notes-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 12px;
    color: var(--color-text-muted);
    text-align: center;
}

.dashboard-notes-empty i {
    font-size: 26px;
    opacity: 0.5;
}

/* ---- Searchable Select Standard ---- */
.select2-container {
    max-width: 100%;
}

.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    width: 100%;
    min-height: 45px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    color: var(--color-text);
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    min-height: 43px;
    line-height: 43px;
    padding-inline: 14px 38px;
    color: var(--color-text);
    text-align: start;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder,
.select2-container--default .select2-selection--multiple .select2-search__field::placeholder {
    color: var(--color-text-muted);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 1px;
    inset-inline-end: 8px;
    inset-inline-start: auto;
    width: 24px;
    height: 43px;
}

.select2-container--default .select2-selection--multiple {
    padding: 3px 8px;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    margin: 3px 0;
    border: 1px solid var(--color-primary);
    border-radius: calc(var(--radius-md) - 2px);
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

.select2-container--default .select2-selection--multiple .select2-search__field {
    min-width: 7rem;
    margin-top: 7px;
    color: var(--color-text);
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.select2-container--default.select2-container--disabled .select2-selection--single,
.select2-container--default.select2-container--disabled .select2-selection--multiple {
    background-color: var(--color-surface-muted);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.select2-dropdown {
    z-index: 2050;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    box-shadow: var(--shadow-card);
}

.select2-search--dropdown {
    padding: 8px;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    height: 38px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding-inline: 10px;
    color: var(--color-text);
    background-color: var(--color-surface);
    text-align: start;
}

.select2-container--default .select2-results__option {
    padding: 8px 12px;
    color: var(--color-text);
    text-align: start;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--color-primary);
    color: #fff;
}

.is-invalid + .select2-container--default .select2-selection--single,
.is-invalid + .select2-container--default .select2-selection--multiple,
.form-control.is-invalid + .select2-container--default .select2-selection--single,
.form-control.is-invalid + .select2-container--default .select2-selection--multiple {
    border-color: var(--color-danger);
}

[dir="rtl"] .select2-container--default .select2-selection--single,
[dir="rtl"] .select2-dropdown,
[dir="rtl"] .select2-results__option,
[dir="rtl"] .select2-search__field {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-inline: 38px 14px;
}

[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__arrow {
    inset-inline-start: 8px;
    inset-inline-end: auto;
}

[data-theme="dark"] .select2-container--default .select2-selection--single,
[data-theme="dark"] .select2-container--default .select2-selection--multiple,
[data-theme="dark"] .select2-dropdown,
[data-theme="dark"] .select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

/* ---- Native Cash Entry workspace ---- */
.cash-entry-page__branch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--color-text-muted);
    font-size: .875rem;
    font-weight: 600;
}

.cash-entry-ledger-intro {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr);
    gap: 26px;
    align-items: end;
    padding: 24px 28px;
    border: 1px solid var(--color-border);
    border-inline-start: 5px solid var(--color-accent);
    border-radius: var(--radius-lg);
    background: linear-gradient(112deg, var(--color-surface) 0%, var(--color-accent-light) 100%);
    box-shadow: var(--shadow-card);
}

.cash-entry-ledger-intro__eyebrow,
.cash-entry-section-heading > div > span,
.cash-entry-preview__heading > span {
    display: block;
    margin-bottom: 6px;
    color: var(--color-accent);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.cash-entry-ledger-intro h2,
.cash-entry-preview h2 {
    margin: 0;
    color: var(--color-text);
    font-size: 1.28rem;
    font-weight: 750;
    line-height: 1.35;
}

.cash-entry-ledger-intro p,
.cash-entry-section-heading p,
.cash-entry-adjustment__header p,
.cash-entry-preview__heading p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: .875rem;
    line-height: 1.55;
}

.cash-entry-context-note {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 13px 15px;
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
}

.cash-entry-context-note > i {
    color: var(--color-primary);
    font-size: 20px;
}

.cash-entry-context-note strong,
.cash-entry-context-note span {
    display: block;
}

.cash-entry-context-note strong {
    color: var(--color-text);
    font-size: .9rem;
}

.cash-entry-context-note span {
    margin-top: 2px;
    color: var(--color-text-muted);
    font-size: .825rem;
}

.cash-entry-section-heading,
.cash-entry-adjustment__header,
.cash-entry-form-actions,
.cash-entry-form-actions__submit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.cash-entry-section-heading > div > span {
    margin-bottom: 3px;
}

.cash-entry-card-toggle {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin: 4px 0 14px;
    padding: 12px 14px;
    border: 1px dashed var(--color-primary);
    border-radius: var(--radius-md);
    background: var(--color-primary-light);
}

.cash-entry-card-toggle small {
    color: var(--color-text-muted);
    font-size: .8rem;
}

.cash-entry-card-allocation {
    margin-bottom: 14px;
    padding: 16px;
    border-inline-start: 3px solid var(--color-primary);
    background: var(--color-surface-muted);
}

.cash-entry-composition-message {
    padding-top: 5px;
    font-size: .84rem;
    font-weight: 650;
}

.cash-entry-composition-message.is-balanced { color: var(--color-success); }
.cash-entry-composition-message.is-unbalanced { color: var(--color-danger); }
.cash-entry-composition-message.is-pending { color: var(--color-text-muted); }

.cash-entry-adjustment {
    padding: 18px 0;
    border-top: 1px solid var(--color-border);
}

.cash-entry-adjustment:last-child { padding-bottom: 0; }

.cash-entry-adjustment__header h3 {
    margin: 0 0 4px;
    color: var(--color-text);
    font-size: 1rem;
    font-weight: 700;
}

.cash-entry-line {
    margin-top: 12px;
    padding: 15px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
}

.cash-entry-line .form-group { margin-bottom: 0; }

.cash-entry-preview {
    display: grid;
    grid-template-columns: minmax(220px, .68fr) minmax(0, 1.32fr);
    overflow: hidden;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
}

.cash-entry-preview__heading {
    padding: 24px;
    background: var(--color-primary);
}

.cash-entry-preview__heading > span { color: var(--color-accent); }
.cash-entry-preview__heading h2 { color: #fff; }
.cash-entry-preview__heading p { margin-top: 8px; color: rgba(255,255,255,.78); }

.cash-entry-preview__values {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cash-entry-preview__values > div {
    min-height: 88px;
    padding: 16px 18px;
    border-inline-start: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.cash-entry-preview__values > div:nth-child(3n + 1) { border-inline-start: 0; }
.cash-entry-preview__values > div:nth-last-child(-n + 3) { border-bottom: 0; }
.cash-entry-preview__values span,
.cash-entry-preview__values strong { display: block; }
.cash-entry-preview__values span { color: var(--color-text-muted); font-size: .76rem; font-weight: 650; }
.cash-entry-preview__values strong { margin-top: 6px; color: var(--color-text); font-family: var(--font-mono, monospace); font-size: 1.05rem; }
.cash-entry-preview__addition strong { color: var(--color-success); }
.cash-entry-preview__outflow strong { color: var(--color-danger); }
.cash-entry-preview__net { background: var(--color-accent-light); }
.cash-entry-preview__net strong { color: var(--color-primary); font-size: 1.18rem; }

.cash-entry-form-actions {
    margin-bottom: 34px;
    padding: 18px 0;
    border-top: 1px solid var(--color-border);
}

.cash-entry-form[aria-busy="true"] .cash-entry-form-actions button { pointer-events: none; opacity: .7; }

@media (max-width: 991px) {
    .cash-entry-ledger-intro,
    .cash-entry-preview { grid-template-columns: 1fr; }
    .cash-entry-preview__values > div { border-inline-start: 1px solid var(--color-border); }
    .cash-entry-preview__values > div:nth-child(3n + 1) { border-inline-start: 0; }
}

@media (max-width: 767px) {
    .cash-entry-ledger-intro { padding: 20px; gap: 12px; }
    .cash-entry-card-toggle,
    .cash-entry-section-heading,
    .cash-entry-adjustment__header,
    .cash-entry-form-actions { align-items: stretch; flex-direction: column; }
    .cash-entry-card-toggle { gap: 8px; }
    .cash-entry-adjustment__header .btn { width: 100%; }
    .cash-entry-preview__values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cash-entry-preview__values > div:nth-child(n) { border-inline-start: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
    .cash-entry-preview__values > div:nth-child(2n + 1) { border-inline-start: 0; }
    .cash-entry-preview__values > div:nth-last-child(-n + 2) { border-bottom: 0; }
    .cash-entry-form-actions__submit { display: grid; grid-template-columns: 1fr; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .cash-entry-form * { transition: none !important; }
}

/* Cash list and canonical entry detail */
.cash-bulk-bar {
    position: sticky;
    top: 74px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    padding: 14px 18px;
    border: 1px solid color-mix(in srgb, var(--color-primary) 22%, var(--color-border));
    border-radius: 12px;
    background: color-mix(in srgb, var(--color-surface) 94%, var(--color-primary));
    box-shadow: 0 10px 28px rgba(31, 92, 143, .1);
}
.cash-bulk-bar__summary { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cash-bulk-bar__summary strong,.cash-bulk-bar__summary small { display: block; }
.cash-bulk-bar__summary small { color: var(--color-text-muted); margin-top: 2px; }
.cash-bulk-bar__count { display: grid; place-items: center; min-width: 42px; height: 42px; border-radius: 10px; background: var(--color-primary); color: #fff; font-size: 1.1rem; font-weight: 800; }
.cash-bulk-bar__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.cash-bulk-bar__message { flex-basis: 100%; margin: 0; }
.cash-entry-select-cell { width: 44px; text-align: center !important; }
.cash-entry-select-cell input { width: 17px; height: 17px; accent-color: var(--color-primary); cursor: pointer; }
@media (max-width: 767px) {
    .cash-bulk-bar { position: static; align-items: stretch; flex-direction: column; }
    .cash-bulk-bar__actions,.cash-bulk-bar__actions .btn { width: 100%; }
}
.cash-report-brand { display:flex; align-items:center; gap:14px; border-inline-start:4px solid var(--color-accent); }
.cash-report-brand img,.cash-report-brand__fallback { width:52px; height:52px; object-fit:contain; flex:0 0 auto; }
.cash-report-brand__fallback { display:grid; place-items:center; border-radius:50%; color:#fff; background:var(--color-primary); font-weight:800; }
.cash-report-brand span,.cash-report-brand strong,.cash-report-brand small { display:block; }
.cash-report-brand span,.cash-report-brand small { color:var(--color-text-muted); font-size:.78rem; }
.cash-report-brand strong { color:var(--color-text); font-size:1.05rem; }
.cash-entry-filters__basic {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(145px, 1fr)) auto;
    gap: 14px;
    align-items: end;
}

.cash-entry-filters__actions,
.cash-detail-hero,
.cash-detail-hero__badges,
.cash-detail-related,
.cash-detail-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cash-entry-filters__advanced {
    margin-top: 15px;
    padding-top: 13px;
    border-top: 1px solid var(--color-border);
}

.cash-entry-filters__advanced summary {
    cursor: pointer;
    color: var(--color-primary);
    font-size: .875rem;
    font-weight: 700;
}

.cash-entry-filters__summary {
    margin-top: 12px;
    color: var(--color-text-muted);
    font-size: .84rem;
}

.cash-entry-filters__summary i { color: var(--color-success); }

.cash-entry-total-cards {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}

.cash-entry-total-card {
    position: relative;
    min-width: 0;
    padding: 15px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
}

.cash-entry-total-card > i { color: var(--color-primary); }
.cash-entry-total-card span,
.cash-entry-total-card strong { display: block; }
.cash-entry-total-card span { margin-top: 8px; color: var(--color-text-muted); font-size: .76rem; font-weight: 650; }
.cash-entry-total-card strong { margin-top: 4px; color: var(--color-text); font-size: 1rem; overflow-wrap: anywhere; }

.cash-detail-hero {
    justify-content: space-between;
    padding: 21px 24px;
    border-radius: var(--radius-lg);
    background: linear-gradient(120deg, var(--color-primary), var(--color-primary-dark, var(--color-primary)));
    box-shadow: var(--shadow-card);
}

.cash-detail-hero__eyebrow { color: var(--color-accent); font-size: .76rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.cash-detail-hero h2 { margin: 4px 0; color: #fff; }
.cash-detail-hero p { margin: 0; color: rgba(255, 255, 255, .75); font-size: .84rem; }
.cash-detail-hero__badges { align-self: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.cash-detail-related { padding: 12px 15px; border-inline-start: 3px solid var(--color-primary); background: var(--color-surface-muted); }
.cash-detail-related a { font-weight: 700; }

.cash-detail-money-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.cash-detail-money-grid > div { padding: 14px; border-inline-start: 1px solid var(--color-border); }
.cash-detail-money-grid > div:first-child { border-inline-start: 0; }
.cash-detail-money-grid span,
.cash-detail-money-grid strong { display: block; }
.cash-detail-money-grid span { color: var(--color-text-muted); font-size: .76rem; font-weight: 650; }
.cash-detail-money-grid strong { margin-top: 5px; color: var(--color-text); overflow-wrap: anywhere; }

.cash-detail-facts { margin: 0; }
.cash-detail-facts > div { display: grid; grid-template-columns: minmax(105px, .85fr) minmax(0, 1.15fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--color-border); }
.cash-detail-facts > div:last-child { border-bottom: 0; }
.cash-detail-facts dt { color: var(--color-text-muted); font-size: .78rem; font-weight: 650; }
.cash-detail-facts dd { margin: 0; color: var(--color-text); overflow-wrap: anywhere; }
.cash-detail-facts__reason { grid-template-columns: 1fr !important; }

.cash-detail-allocation { display: grid; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.cash-detail-allocation:last-child { padding-bottom: 0; border-bottom: 0; }
.cash-detail-allocation small { color: var(--color-text-muted); }
.cash-detail-allocation a { margin-top: 3px; font-size: .82rem; font-weight: 700; }

.cash-detail-actions { flex-wrap: wrap; align-items: flex-start; }
.cash-workflow-disclosure { min-width: 180px; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.cash-workflow-disclosure summary { cursor: pointer; color: var(--color-primary); font-weight: 700; }
.cash-workflow-disclosure form { display: grid; gap: 10px; margin-top: 12px; }
.cash-entry-correction-ribbon { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 20px; padding: 14px 16px; border-inline-start: 3px solid var(--color-warning); border-radius: var(--radius-md); background: var(--color-surface-muted); }
.cash-entry-correction-ribbon i { color: var(--color-warning); font-size: 20px; }
.cash-entry-correction-ribbon strong,
.cash-entry-correction-ribbon span { display: block; }
.cash-entry-correction-ribbon span { margin-top: 2px; color: var(--color-text-muted); font-size: .84rem; }

@media (max-width: 1199px) {
    .cash-entry-filters__basic { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .cash-entry-filters__actions { grid-column: span 3; }
    .cash-entry-total-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    .cash-entry-filters__basic,
    .cash-entry-total-cards,
    .cash-detail-money-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cash-entry-filters__actions { grid-column: span 2; }
    .cash-detail-hero { align-items: flex-start; flex-direction: column; }
    .cash-detail-hero__badges { justify-content: flex-start; }
    .cash-detail-money-grid > div:nth-child(odd) { border-inline-start: 0; }
    .cash-detail-money-grid > div:nth-child(n + 3) { border-top: 1px solid var(--color-border); }
    .cash-detail-actions { align-items: stretch; flex-direction: column; }
    .cash-detail-actions > form > .btn,
    .cash-detail-actions > .btn { width: 100%; }
}

/* --------------------------------------------------------------------------
 * Shared operational report workspace
 * -------------------------------------------------------------------------- */
.report-surface {
    --report-ink: #17243b;
    /* Always dark, unlike --report-ink (which flips to a light tone in dark
       mode for text contrast) — for the handful of decorative elements that
       are a fixed dark navy chip/gradient in both themes (hero background,
       featured KPI card, count badge, branding fallback initials). */
    --report-ink-fixed: #17243b;
    --report-blue: var(--color-primary, #1f5c8f);
    --report-blue-soft: color-mix(in srgb, var(--report-blue) 10%, var(--color-surface));
    --report-orange: var(--color-accent, #e8762d);
    --report-rule: var(--color-border, #e5e7eb);
}

.report-surface .main-container { overflow-x: clip; }
.report-surface__content { max-width: 1680px; margin-inline: auto; }
.report-workspace { display: grid; gap: 18px; }

/* Reports Center hub — hero, context strip, grouped sections, cards */
.report-hub { display: grid; gap: 28px; }
.report-hub__hero { position: relative; overflow: hidden; padding: 28px 30px; border: 1px solid var(--report-rule); border-radius: 16px; background: linear-gradient(135deg, var(--report-ink-fixed) 0%, color-mix(in srgb, var(--report-blue) 78%, var(--report-ink-fixed)) 100%); color: #fff; }
.report-hub__hero::before { position: absolute; inset-inline-end: -60px; top: -60px; width: 220px; height: 220px; content: ''; border-radius: 50%; background: color-mix(in srgb, var(--report-orange) 30%, transparent); filter: blur(2px); opacity: .35; }
.report-hub__eyebrow { position: relative; display: inline-flex; align-items: center; gap: 8px; color: color-mix(in srgb, var(--report-orange) 82%, #fff 18%); font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.report-hub__title { position: relative; margin: 8px 0 6px; color: #fff; font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 800; }
.report-hub__subtitle { position: relative; max-width: 62ch; margin: 0; color: rgba(255,255,255,.82); font-size: .92rem; line-height: 1.55; }
.report-hub__context { margin-top: 20px; }
.report-hub__section { display: grid; gap: 14px; }
.report-hub__section-head { display: flex; align-items: baseline; gap: 10px; }
.report-hub__section-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; background: var(--report-blue-soft); color: var(--report-blue); font-size: 1rem; }
.report-hub__section-desc { margin: -6px 0 0 40px; color: var(--color-text-muted); font-size: .82rem; }
.report-hub__card { position: relative; display: grid; grid-template-rows: auto 1fr auto; min-height: 172px; gap: 10px; padding: 20px 22px; overflow: hidden; border: 1px solid var(--report-rule); border-radius: 14px; color: var(--report-ink); background: linear-gradient(150deg, var(--color-surface) 0%, var(--report-blue-soft) 120%); transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.report-hub__card:hover, .report-hub__card:focus-visible { color: var(--report-ink); border-color: var(--report-blue); box-shadow: 0 16px 28px color-mix(in srgb, var(--report-blue) 20%, transparent); transform: translateY(-3px); text-decoration: none; }
.report-hub__card-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; background: color-mix(in srgb, var(--report-blue) 14%, var(--color-surface)); color: var(--report-blue); font-size: 1.35rem; }
.report-hub__card-title { max-width: 88%; font-size: 1.05rem; font-weight: 800; line-height: 1.3; }
.report-hub__card-desc { color: var(--color-text-muted); font-size: .8rem; line-height: 1.45; }
.report-hub__card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.report-hub__card-open { display: inline-flex; align-items: center; gap: 4px; color: var(--report-blue); font-size: .78rem; font-weight: 800; white-space: nowrap; }
.report-hub__card-open i { font-size: .7rem; transition: transform .16s ease; }
.report-hub__card:hover .report-hub__card-open i, .report-hub__card:focus-visible .report-hub__card-open i { transform: translateX(3px); }
[dir="rtl"] .report-hub__card:hover .report-hub__card-open i, [dir="rtl"] .report-hub__card:focus-visible .report-hub__card-open i { transform: translateX(-3px); }
.report-hub__empty { padding: 40px 0; }
.report-print-overlay { display: none; }
.cash-sales-report { display: grid; gap: 18px; }
.cash-sales-report__split { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; border: 1px solid var(--report-rule); border-radius: 14px; overflow: hidden; background: var(--color-surface); }
.cash-sales-report__channel { position: relative; display: grid; align-content: center; min-height: 138px; padding: 24px 28px; }
.cash-sales-report__channel::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 5px; background: currentColor; }
.cash-sales-report__channel span,.cash-sales-report__channel small { color: var(--color-text-muted); }
.cash-sales-report__channel strong { margin: 6px 0; font-family: var(--font-data, monospace); font-size: clamp(1.8rem, 4vw, 3.15rem); line-height: 1; letter-spacing: -.04em; direction: ltr; }
.cash-sales-report__channel--cash { color: var(--color-success, #25855a); background: color-mix(in srgb, var(--color-success, #25855a) 7%, var(--color-surface)); }
.cash-sales-report__channel--card { color: var(--report-blue); background: var(--report-blue-soft); }
.cash-sales-report__divider { display: grid; place-items: center; align-content: center; gap: 2px; min-width: 118px; padding: 18px; border-inline: 1px solid var(--report-rule); text-align: center; }
.cash-sales-report__divider span { font-size: 1.55rem; font-weight: 800; color: var(--color-text); }
.cash-sales-report__divider small { max-width: 90px; color: var(--color-text-muted); line-height: 1.25; }

.report-branding {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 112px;
    margin-bottom: 18px;
    padding: 20px 24px 20px 30px;
    overflow: hidden;
    border: 1px solid var(--report-rule);
    border-radius: var(--radius-lg, 12px);
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--report-blue) 7%, transparent), transparent 42%),
        var(--color-surface, #fff);
    box-shadow: var(--shadow-card);
}

.report-branding::before {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 6px;
    content: '';
    background: linear-gradient(180deg, var(--report-orange) 0 28%, var(--report-blue) 28% 100%);
}

.report-branding__identity { display: flex; align-items: center; gap: 15px; min-width: 0; }
.report-branding__logo,
.report-branding__fallback { width: 62px; height: 62px; flex: 0 0 62px; }
.report-branding__logo { object-fit: contain; }
.report-branding__fallback {
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--report-ink-fixed);
    color: #fff;
    font-weight: 800;
    letter-spacing: .04em;
}
.report-branding__eyebrow { display: block; color: var(--report-orange); font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.report-branding__name { display: block; color: var(--report-ink); font-size: 1.12rem; }
.report-branding__title { margin: 2px 0 0; color: var(--report-ink); font-size: 1.35rem; line-height: 1.2; }
.report-branding__subtitle { max-width: 680px; margin: 5px 0 0; color: var(--color-text-muted); font-size: .82rem; }
.report-branding__meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 52%; margin: 0; }
.report-branding__meta > div { min-width: 112px; padding: 8px 11px; border: 1px solid var(--report-rule); border-radius: 9px; background: var(--color-surface-muted, #f7f8fa); }
.report-branding__meta dt { color: var(--color-text-muted); font-size: .65rem; font-weight: 700; }
.report-branding__meta dd { margin: 2px 0 0; color: var(--report-ink); font-size: .78rem; font-weight: 750; }

.report-surface .x-page-header {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--report-rule);
}
.report-surface .x-page-header .page-title { color: var(--report-ink); font-size: clamp(1.35rem, 2vw, 1.8rem); }
.report-surface .x-page-header .page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.report-actions .btn,
.report-surface .x-page-header .btn { min-height: 38px; padding-inline: 14px; border-radius: 8px; font-weight: 700; }

.report-panel {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--report-rule);
    border-radius: var(--radius-lg, 12px);
    background: var(--color-surface, #fff);
    box-shadow: var(--shadow-card);
}
.report-panel__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.report-panel__heading h3 { margin: 0; color: var(--report-ink); font-size: 1rem; font-weight: 800; }
.report-panel__heading p { margin: 4px 0 0; color: var(--color-text-muted); font-size: .78rem; }
.report-panel__kicker { display: block; margin-bottom: 3px; color: var(--report-orange); font-size: .65rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.report-panel__aside { display: flex; align-items: center; gap: 8px; }

.report-filter-panel .form-control,
.report-filter-panel .custom-select2 + .select2 .select2-selection,
.report-surface .search-form .form-control { min-height: 42px; border-color: var(--report-rule); border-radius: 8px; }
.report-filter-panel .select2-container--default .select2-selection--multiple {
    min-height: 42px;
    padding: 3px 8px;
    border-color: var(--report-rule);
    background: var(--color-surface);
}
.report-filter-panel .select2-selection--multiple .select2-selection__rendered {
    align-items: center;
    min-height: 34px;
}
.report-filter-panel .select2-selection--multiple .select2-selection__rendered[data-empty-label]::before {
    color: var(--color-text-muted);
    content: attr(data-empty-label);
    font-size: .82rem;
    pointer-events: none;
}
.report-filter-panel .select2-selection--multiple[data-selected-count="0"] .select2-search__field {
    min-width: 2.5rem;
}
.report-filter-panel .select2-selection--multiple .select2-selection__choice {
    display: inline-flex;
    align-items: center;
    max-width: calc(100% - 6px);
    margin: 2px 0;
    padding: 3px 8px;
    border: 1px solid color-mix(in srgb, var(--report-blue) 24%, var(--report-rule));
    border-radius: 999px;
    background: var(--report-blue-soft);
    color: var(--report-ink);
    font-size: .74rem;
    font-weight: 700;
    line-height: 1.25;
}
.report-filter-panel .select2-selection__choice__remove {
    order: 2;
    margin-inline: 5px 0;
    border: 0;
    color: var(--report-blue);
    font-size: 1rem;
    line-height: 1;
}
.report-filter-panel .select2-selection__choice__remove:hover { color: var(--color-danger); }
.report-multiselect-dropdown .select2-results__option[aria-selected="true"] {
    position: relative;
    padding-inline-end: 34px;
    background: var(--report-blue-soft);
    color: var(--report-ink);
    font-weight: 700;
}
.report-multiselect-dropdown .select2-results__option[aria-selected="true"]::after {
    position: absolute;
    inset-inline-end: 12px;
    color: var(--report-blue);
    content: '✓';
    font-size: .95rem;
    font-weight: 800;
}
.report-multiselect-dropdown .select2-results__option--highlighted[aria-selected]::after { color: #fff; }
.report-multiselect-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 10px;
    border-bottom: 1px solid var(--report-rule);
    background: color-mix(in srgb, var(--report-blue-soft) 52%, var(--color-surface));
}
.report-multiselect-toolbar__button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--report-blue);
    cursor: pointer;
    font-size: .75rem;
    font-weight: 800;
}
.report-multiselect-toolbar__button:hover,
.report-multiselect-toolbar__button:focus-visible { color: var(--report-orange); }
.report-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.report-filter-grid .form-group { min-width: 0; margin-bottom: 0; }
.report-filter-grid label { display: block; margin-bottom: 6px; color: var(--report-ink); font-size: .74rem; font-weight: 750; }
.report-filter-actions { display: flex; align-items: center; gap: 9px; margin-top: 16px; }
.report-advanced-filters { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--report-rule); }
.report-advanced-filters summary { cursor: pointer; color: var(--report-blue); font-size: .8rem; font-weight: 800; }
.report-advanced-filters[open] summary { margin-bottom: 14px; }

.report-filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: -4px; }
.report-filter-chips__label { color: var(--color-text-muted); font-size: .72rem; font-weight: 750; }
.report-filter-chip { max-width: 100%; padding: 6px 9px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--report-blue) 22%, var(--report-rule)); border-radius: 999px; background: var(--report-blue-soft); color: var(--report-ink); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }

.report-section-label { display: flex; align-items: center; gap: 10px; margin: 4px 0 0; color: var(--report-ink); font-size: .94rem; font-weight: 800; }
.report-section-label::after { height: 1px; flex: 1; content: ''; background: var(--report-rule); }
.report-kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.report-kpi-grid--secondary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.report-kpi {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    min-height: 88px;
    padding: 14px;
    overflow: hidden;
    border: 1px solid var(--report-rule);
    border-radius: 11px;
    background: var(--color-surface, #fff);
    box-shadow: 0 4px 12px rgba(23, 36, 59, .045);
}
.report-kpi::after { position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; content: ''; background: var(--report-blue); }
.report-kpi--success::after { background: var(--color-success); }
.report-kpi--warning::after { background: var(--color-warning); }
.report-kpi--danger::after { background: var(--color-danger); }
.report-kpi__icon { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 9px; background: var(--report-blue-soft); color: var(--report-blue); }
.report-kpi__label { display: block; color: var(--color-text-muted); font-size: .68rem; font-weight: 700; line-height: 1.3; }
.report-kpi__value { display: block; margin-top: 4px; color: var(--report-ink); font-family: Consolas, 'Courier New', monospace; font-size: .94rem; font-variant-numeric: tabular-nums; direction: ltr; text-align: start; white-space: nowrap; }
.report-kpi--featured { grid-column: span 2; background: var(--report-ink-fixed); }
.report-kpi--featured .report-kpi__label { color: rgba(255,255,255,.68); }
.report-kpi--featured .report-kpi__value { color: #fff; font-size: 1.2rem; }

.report-table-panel { padding: 0; overflow: hidden; }
.report-table-panel > .report-panel__heading { margin: 0; padding: 18px 20px 14px; }
.report-table-scroll { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.report-table-scroll > .table-responsive { overflow: visible; }
.report-table-scroll table { width: 100%; margin: 0; color: var(--report-ink); font-size: .78rem; }
.report-table-scroll thead th { position: sticky; z-index: 2; top: 0; min-width: 96px; padding: 11px 9px; border-bottom: 1px solid var(--report-rule); background: var(--color-surface-muted, #f6f7f9); color: var(--color-text-muted); font-size: .67rem; font-weight: 800; line-height: 1.35; white-space: normal; }
.report-table-scroll thead th:first-child { min-width: 126px; }
.report-table-scroll tbody td { padding: 11px 9px; border-color: var(--report-rule); vertical-align: middle; }
.report-table-scroll tbody tr:hover { background: var(--report-blue-soft); }
.report-table-scroll tfoot th,
.report-table-scroll tfoot td { padding: 12px 9px; border-top: 2px solid var(--report-blue); background: var(--color-surface-muted, #f6f7f9); font-weight: 800; }
.report-table-scroll .report-money { min-width: 122px; font-family: Consolas, 'Courier New', monospace; font-variant-numeric: tabular-nums; direction: ltr; text-align: end; white-space: nowrap; }
.report-count { display: inline-grid; min-width: 30px; height: 30px; padding-inline: 8px; place-items: center; border-radius: 999px; background: var(--report-ink-fixed); color: #fff; font-size: .72rem; font-weight: 800; }

.report-row-primary { display: grid; gap: 2px; min-width: 120px; }
.report-row-primary strong { color: var(--report-ink); }
.report-row-primary small { color: var(--color-text-muted); }
.report-row-details { border-top: 1px dashed var(--report-rule); }
.report-row-details > td { padding: 0 !important; background: var(--color-surface-muted, #f7f8fa); }
.report-row-details details { padding: 8px 12px; }
.report-row-details summary { cursor: pointer; color: var(--report-blue); font-size: .72rem; font-weight: 800; }
.report-row-details__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 16px; margin-top: 10px; }
.report-row-details__grid div { min-width: 0; }
.report-row-details__grid span,
.report-row-details__grid strong { display: block; }
.report-row-details__grid span { color: var(--color-text-muted); font-size: .64rem; }
.report-row-details__grid strong { margin-top: 2px; color: var(--report-ink); font-size: .75rem; overflow-wrap: anywhere; }

.report-empty-state { display: flex; align-items: center; justify-content: center; gap: 15px; min-height: 136px; padding: 24px; text-align: start; }
.report-empty-state__icon { display: grid; width: 52px; height: 52px; flex: 0 0 52px; place-items: center; border: 1px dashed color-mix(in srgb, var(--report-blue) 35%, var(--report-rule)); border-radius: 14px; background: var(--report-blue-soft); color: var(--report-blue); font-size: 24px; }
.report-empty-state h4 { margin: 0; color: var(--report-ink); font-size: .92rem; }
.report-empty-state p { margin: 5px 0 0; color: var(--color-text-muted); font-size: .75rem; }

.report-badge { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 8px; border: 1px solid var(--report-rule); border-radius: 999px; background: var(--color-surface-muted); color: var(--report-ink); font-size: .66rem; font-weight: 750; white-space: nowrap; }
.report-badge--success { border-color: color-mix(in srgb, var(--color-success) 30%, var(--report-rule)); background: color-mix(in srgb, var(--color-success) 10%, var(--color-surface)); color: var(--color-success); }
.report-badge--warning { border-color: color-mix(in srgb, var(--color-warning) 35%, var(--report-rule)); background: color-mix(in srgb, var(--color-warning) 11%, var(--color-surface)); color: #8a5a00; }
.report-badge--danger { border-color: color-mix(in srgb, var(--color-danger) 30%, var(--report-rule)); background: color-mix(in srgb, var(--color-danger) 9%, var(--color-surface)); color: var(--color-danger); }
.report-badge--info { border-color: color-mix(in srgb, var(--report-blue) 28%, var(--report-rule)); background: var(--report-blue-soft); color: var(--report-blue); }

/* Air Datepicker parks closed popovers at -100000px. In RTL documents that
   offset becomes document overflow, so remove only closed portal instances
   from layout; active and inline calendars keep the vendor behavior. */
.datepickers-container > .datepicker:not(.active) { display: none; }

/* Lift legacy active report surfaces into the same visual language. */
.report-surface .card-box,
.report-surface .invoice-box { border: 1px solid var(--report-rule); border-radius: var(--radius-lg, 12px); box-shadow: var(--shadow-card); }
.report-surface .invoice-wrap { max-width: none; margin: 0; background: transparent; }
.report-surface .invoice-box { width: 100%; max-width: none; padding: 22px; background: var(--color-surface); }
.report-surface .invoice-header .logo img { max-width: 78px; max-height: 62px; object-fit: contain; }
.report-surface .x-empty-state { min-height: 136px; padding-block: 22px; }
.report-surface .x-empty-state img { display: none; }
.report-surface .table-responsive { max-width: 100%; }
.report-surface .table th { white-space: normal; }

/* Shared row-action menu contract. The legacy DeskApp menus occur on every
   operations grid, so this one layout must keep their icon and localized label
   independent of text direction or label length. */
.dropdown-menu-icon-list {
    min-width: 13.5rem;
    padding: var(--space-1);
}

.dropdown-menu-icon-list > .dropdown-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-3);
    min-height: 2.5rem;
    padding-block: 0.625rem;
    padding-inline: 0.75rem;
    margin: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    text-align: start;
    white-space: normal;
}

.dropdown-menu-icon-list > .dropdown-item > i {
    position: static !important;
    inset: auto !important;
    width: 1.25rem;
    flex: 0 0 1.25rem;
    margin: 0 !important;
    text-align: center;
}

.dropdown-menu-icon-list > .dropdown-item > span {
    min-width: 0;
}

.dropdown-menu-icon-list > .dropdown-item.text-danger > i,
.dropdown-menu-icon-list > .dropdown-item.text-danger:hover > i,
.dropdown-menu-icon-list > .dropdown-item.text-danger:focus > i {
    color: currentColor;
}

.dropdown-menu-icon-list > .dropdown-item:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

.dropdown-menu-icon-list > .dropdown-item:disabled,
.dropdown-menu-icon-list > .dropdown-item.disabled {
    opacity: 0.55;
    pointer-events: none;
}

/* Row-action menus are portalled to <body> while open so responsive table
   overflow can never crop them. Position is calculated by the shared layout. */
.table-dropdown-portal {
    position: fixed !important;
    inset: auto !important;
    top: var(--table-dropdown-top, 8px) !important;
    right: auto !important;
    bottom: auto !important;
    left: var(--table-dropdown-left, 8px) !important;
    z-index: 1085 !important;
    max-width: calc(100vw - 16px);
    max-height: var(--table-dropdown-max-height, calc(100vh - 16px)) !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-color: var(--color-border);
    background: var(--color-surface);
    box-shadow: var(--shadow-hover);
    scrollbar-color: var(--color-border) transparent;
    scrollbar-width: thin;
    transform: none !important;
    will-change: auto !important;
    animation: table-dropdown-portal-reveal 120ms ease-out;
}

.table-dropdown-portal.table-dropdown-portal--above {
    transform-origin: center bottom;
}

.table-dropdown-portal::-webkit-scrollbar {
    width: 6px;
}

.table-dropdown-portal::-webkit-scrollbar-thumb {
    border-radius: var(--radius-pill);
    background: var(--color-border);
}

@keyframes table-dropdown-portal-reveal {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .table-dropdown-portal {
        animation: none;
    }
}

@media (max-width: 1199px) {
    .report-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .report-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .report-kpi-grid--secondary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .report-branding__meta { max-width: 46%; }
}

@media (max-width: 767px) {
    .report-branding { align-items: flex-start; flex-direction: column; padding: 17px 17px 17px 23px; }
    .report-branding__meta { width: 100%; max-width: none; justify-content: flex-start; }
    .report-branding__meta > div { flex: 1 1 120px; }
    .report-branding__logo,
    .report-branding__fallback { width: 50px; height: 50px; flex-basis: 50px; }
    .report-branding__title { font-size: 1.08rem; }
    .report-panel { padding: 16px; }
    .report-filter-grid,
    .report-kpi-grid,
    .report-kpi-grid--secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-panel__heading { align-items: flex-start; flex-direction: column; }
    .report-row-details__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-hub__hero { padding: 22px; }
    .report-hub__section-desc { margin-inline-start: 0; }
}

@media (max-width: 479px) {
    .report-filter-grid,
    .report-kpi-grid,
    .report-kpi-grid--secondary { grid-template-columns: 1fr; }
    .report-kpi--featured { grid-column: auto; }
    .report-filter-actions { align-items: stretch; flex-direction: column; }
    .report-filter-actions .btn { width: 100%; }
    .cash-sales-report__split { grid-template-columns: 1fr; }
    .cash-sales-report__divider { min-height: 76px; border-inline: 0; border-block: 1px solid var(--report-rule); }
}

@media print {
    @page { size: A4 landscape; margin: 12mm; }
    body.is-printing-report > :not(.report-print-overlay) { display: none !important; }
    body.is-printing-report .report-print-overlay {
        display: block !important;
        width: 100% !important;
        color: #17212b !important;
    }
    .report-print-overlay .noprint,
    .report-print-overlay .report-filter-panel,
    .report-print-overlay .report-filter-chips,
    .report-print-overlay .x-page-header { display: none !important; }
    .report-print-overlay .invoice-wrap,
    .report-print-overlay .invoice-box,
    .report-print-overlay .card-box,
    .report-print-overlay .report-panel { box-shadow: none !important; margin-inline: 0 !important; }
    .report-print-overlay .report-table-scroll { overflow: visible !important; }
    .report-print-overlay thead { display: table-header-group; }
    .report-print-overlay tr,
    .report-print-overlay .report-kpi { break-inside: avoid; }
    .report-print-overlay details { display: block; }
    .report-print-overlay summary { display: none; }
    .report-surface .left-side-bar,
    .report-surface .header,
    .report-surface .footer-wrap,
    .report-surface .noprint,
    .report-surface .x-page-header { display: none !important; }
    .report-surface .main-container { margin: 0 !important; padding: 0 !important; }
    .report-surface .report-branding,
    .report-surface .report-panel { box-shadow: none; break-inside: avoid; }
    .report-surface .report-table-scroll { overflow: visible; }
    .report-surface .report-table-scroll thead { display: table-header-group; }
}
