.admin-workspace {
    --admin-accent: #004eeb;
    --admin-border: #dce4ef;
    --admin-muted: #94a3b8;
}
.skin-purple .admin-workspace { --admin-accent: #5925dc; }
.skin-green .admin-workspace { --admin-accent: #067647; }
.skin-red .admin-workspace { --admin-accent: #b42318; }
.skin-yellow .admin-workspace { --admin-accent: #926400; }
.skin-orange .admin-workspace { --admin-accent: #c4320a; }
.skin-sky .admin-workspace { --admin-accent: #026aa2; }

@media screen {
    .admin-workspace { height: 100vh; height: 100dvh; overflow: hidden; }
    .admin-workspace > main, .admin-workspace > .side-bar { height: 100%; min-height: 0; }
    .admin-workspace #scrollable-container { min-height: 0; height: auto; }
    .modal-open .admin-workspace #scrollable-container { overflow: hidden; }
    /* Bootstrap Tour writes the previous document width inline. Anchor the backdrop to the viewport. */
    body:has(.admin-workspace) > .tour-backdrop:is(.top, .bottom, .right) {
        right: 0;
        width: auto !important;
    }
    /* Tour popovers use document coordinates and may extend beyond the sidebar. */
    .admin-workspace:has(.admin-nav:not(.tw-overflow-y-auto)),
    .admin-workspace:has(.admin-nav:not(.tw-overflow-y-auto)) > :is(main, aside) {
        height: auto;
        overflow: visible;
    }
}
@media print {
    .admin-workspace > .side-bar { display: none !important; }
}

.admin-nav-search {
    display: flex;
    align-items: center;
    flex: 0 0 34px;
    gap: 10px;
    margin: 8px 12px 4px;
    padding-inline: 12px 4px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    background: #edf2f7;
    color: #64748b;
}
.admin-nav-search:focus-within { border-color: var(--admin-accent); }
.admin-nav-search input {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 32px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #334155;
}
.admin-nav-search input::-webkit-search-cancel-button { display: none; }
.admin-nav-search button { padding: 4px 8px; background: transparent; border: 0; }
.admin-nav {
    flex: 1 1 0%;
    min-height: 0;
    padding: 4px 8px 12px;
    border-inline-end: 1px solid var(--admin-border);
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.admin-nav > * + * { margin-block-start: 4px; }
.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 8px;
    color: #475569;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    cursor: pointer;
}
.admin-nav-link > :is(svg, i) {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    color: var(--admin-muted);
}
.admin-nav-link > span { overflow-wrap: anywhere; }
.admin-nav-link:hover { background: #f1f5f9; color: #1e293b; }
.admin-nav-link:focus-visible, .admin-filters-toggle:focus-visible {
    outline: 2px solid var(--admin-accent);
    outline-offset: -2px;
}
.admin-nav > a[aria-current], .admin-nav-group:has(a[aria-current]) > summary {
    background: color-mix(in srgb, var(--admin-accent) 15%, white);
    color: var(--admin-accent);
}
.admin-nav-link[aria-current], .admin-nav-link[aria-current] > :is(svg, i),
.admin-nav-group:has(a[aria-current]) > summary > :is(svg, i) { color: var(--admin-accent); }
.admin-nav-group > summary { list-style: none; }
.admin-nav-group > summary::-webkit-details-marker { display: none; }
.admin-nav-group > summary::after {
    content: '';
    flex: 0 0 7px;
    height: 7px;
    margin-inline: auto 4px;
    border-inline-start: 1.5px solid currentColor;
    border-block-end: 1.5px solid currentColor;
    transform: rotate(45deg);
}
[dir="rtl"] .admin-nav-group > summary::after { transform: rotate(-45deg); }
.admin-nav-group[open] > summary::after { transform: rotate(-45deg); }
[dir="rtl"] .admin-nav-group[open] > summary::after { transform: rotate(45deg); }
.admin-nav-children {
    margin-block: 4px 8px;
    margin-inline-start: 20px;
    padding-inline-start: 10px;
    border-inline-start: 1px solid #e2e8f0;
}
.admin-nav-children .admin-nav-link { min-height: 28px; padding-block: 4px; }
.admin-nav-children .admin-nav-link + .admin-nav-link { margin-block-start: 4px; }
.admin-nav-divider { margin: 8px 12px; border-color: var(--admin-border); }
.admin-nav-heading, .admin-nav-empty { padding: 8px 12px; color: #64748b; font-size: 13px; }
.admin-nav [data-search-hidden], .admin-nav-search [hidden], .admin-nav-empty[hidden] { display: none; }

.admin-nav-link[data-module-tone="iris"] { --module-accent: #5941a0; }
.admin-nav-link[data-module-tone="sky"] { --module-accent: #075c9c; }
.admin-nav-link[data-module-tone="teal"] { --module-accent: #0c6a60; }
.admin-nav-link[data-module-tone="amber"] { --module-accent: #995308; }
.admin-nav-link[data-module-tone="rose"] { --module-accent: #9b3767; }
.admin-nav-link[data-module-tone="slate"] { --module-accent: #4a5e79; }
.admin-nav-link[data-module-tone] {
    position: relative;
    background: color-mix(in srgb, var(--module-accent) 8%, white);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--module-accent) 14%, white);
    color: #26364e;
    font-weight: 500;
}
.admin-nav-link[data-module-tone]::before {
    content: '';
    position: absolute;
    inset-block: 8px;
    inset-inline-start: 3px;
    width: 2px;
    border-radius: 2px;
    background: var(--module-accent);
}
.admin-nav-link[data-module-tone] > :is(svg, i) { color: var(--module-accent); }
.admin-nav-link[data-module-tone]:hover,
.admin-nav > .admin-nav-link[data-module-tone][aria-current],
.admin-nav-group:has(a[aria-current]) > .admin-nav-link[data-module-tone] {
    background: color-mix(in srgb, var(--module-accent) 15%, white);
    color: var(--module-accent);
}
.admin-nav > .admin-nav-link[data-module-tone][aria-current],
.admin-nav-group:has(a[aria-current]) > .admin-nav-link[data-module-tone] {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--module-accent) 46%, white);
}

.dashboard-overview, .dashboard-reports { padding-inline: clamp(12px, 2vw, 20px); }
.dashboard-overview { padding-block-start: clamp(16px, 2vw, 28px); }
.dashboard-overview:not(:has([data-dashboard-totals])) { padding-block-end: 20px; }
.dashboard-overview:has([data-dashboard-totals]) {
    background-repeat: no-repeat;
    background-size: 100% calc(100% - 46px);
}
.dashboard-topline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 22px;
    margin-block-end: 18px;
}
.dashboard-topline h1 {
    margin: 0;
    color: white;
    font-size: clamp(24px, 2.4vw, 34px);
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -.025em;
}
.dashboard-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 100%; }
.dashboard-location { position: relative; width: 232px; max-width: 100%; }
.dashboard-location-icon {
    position: absolute;
    inset-inline-start: 13px;
    top: 50%;
    z-index: 1;
    transform: translateY(-50%);
    color: #516481;
    pointer-events: none;
}
.dashboard-date,
.dashboard-location .form-control,
.dashboard-location .select2-container .select2-selection--single {
    min-height: 40px;
    border: 1px solid #d6e0ed;
    border-radius: 9px;
    background: #fff;
    color: #26364e;
    font-size: 14px;
    font-weight: 500;
}
.dashboard-date {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding-inline: 13px;
}
.dashboard-date > i { color: #516481; }
.dashboard-date .dashboard-filter-chevron { font-size: 10px; }
.dashboard-date:hover, .dashboard-location .select2-container .select2-selection--single:hover { background: #f4f8fe; }
.dashboard-date:focus-visible, .dashboard-location:focus-within .select2-selection--single {
    outline: 2px solid #a8d2ff;
    outline-offset: 2px;
}
.dashboard-location .form-control { padding-inline-start: 33px; }
.dashboard-location .select2-container .select2-selection--single .select2-selection__rendered {
    padding-inline: 35px 28px;
    line-height: 38px;
    color: inherit;
}
.dashboard-location .select2-container .select2-selection--single .select2-selection__arrow {
    height: 38px;
    left: auto;
    right: auto;
    inset-inline-end: 8px;
}
.dashboard-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: clamp(10px, 1.4vw, 16px);
}
.dashboard-stat,
.dashboard-sales-panel {
    min-width: 0;
    border: 1px solid var(--admin-border);
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 1px 3px rgb(33 59 94 / 6%);
}
.dashboard-stat-inner { display: flex; align-items: center; height: 100%; padding: 15px; }
.dashboard-stat-content { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; }
.dashboard-stat-content > div:first-child { flex-shrink: 0; width: 42px; height: 42px; border-radius: 11px; }
.dashboard-stat-label { margin: 0; color: #52617a; font-size: 13px; font-weight: 600; }
.dashboard-stat-value {
    margin: 3px 0 0;
    color: #142239;
    font: 700 clamp(16px, 1.55vw, 22px)/1.25 var(--tw-font-mono, ui-monospace, monospace);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.dashboard-stat-value:empty::before { content: '—'; }
.dashboard-wallet-breakdown { display: flex; flex-wrap: wrap; gap: 2px 9px; margin-block-start: 4px; color: #52617a; font-size: 12px; }
.dashboard-wallet-breakdown > span > span { white-space: nowrap; }
.dashboard-totals-status { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; background: #fff5db; color: #784e0b; }
.dashboard-totals-status[hidden] { display: none; }
.dashboard-reports { padding-block: 18px 24px; }
.dashboard-chart { overflow: hidden; border: 1px solid #edf1f6; border-radius: 10px; }
.dashboard-sales-panel h3 { color: #26364e; }
@media (min-width: 1280px) {
    .dashboard-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
    .dashboard-overview:has([data-dashboard-totals]) { background-size: 100% 16rem; }
    .dashboard-controls { width: 100%; }
    .dashboard-location { flex: 1 1 150px; }
    .dashboard-date { max-width: 100%; }
    .dashboard-stat-grid { grid-auto-rows: auto; }
    .dashboard-stat-inner { padding: 11px; align-items: flex-start; }
    .dashboard-stat-content { flex-direction: column; align-items: flex-start; gap: 7px; }
    .dashboard-stat-content > div:first-child { width: 34px; height: 34px; border-radius: 9px; }
    .dashboard-stat-content > div:first-child > svg { width: 19px; height: 19px; }
    .dashboard-stat-content > div:last-child { width: 100%; }
    .dashboard-wallet-breakdown { font-size: 11px; }
}

.admin-filters {
    margin-bottom: 14px;
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    background: white;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
.admin-filters-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    border: 0;
    border-radius: inherit;
    background: transparent;
    color: #182230;
    text-align: start;
    font-weight: 600;
}
.admin-filters-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    color: var(--admin-accent);
    background: color-mix(in srgb, var(--admin-accent) 10%, white);
}
.admin-filters-icon > :is(i, svg) { width: 14px; font-size: 13px; }
.admin-filters-chevron { margin-inline-start: auto; color: var(--admin-accent); font-size: 11px; }
.admin-filters-toggle[aria-expanded="true"] .admin-filters-chevron { transform: rotate(180deg); }
.admin-filters-body { padding: 12px 16px; border-top: 1px solid var(--admin-border); }

@media screen and (min-width: 768px) {
    .admin-workspace .admin-table-toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
        gap: 8px;
        align-items: center;
        margin-inline: 0;
    }
    .admin-workspace .admin-table-toolbar::before, .admin-workspace .admin-table-toolbar::after { display: none; }
    .admin-workspace .admin-table-toolbar > [class*="col-sm-"] { width: auto; padding: 0; }
    .admin-workspace .admin-table-toolbar .dataTables_length { text-align: center; }
    .admin-workspace .admin-table-toolbar .dataTables_filter { text-align: end; }
    .admin-table-toolbar .dataTables_filter :is(label, input) { max-width: 100%; }
}

@media screen {
    /* Reserve room for the page heading, controls, totals and paging on standalone sales lists. */
    .sales-list { --sales-table-height: clamp(220px, calc(100vh - 650px), 75vh); }
    /* Keep the full note available as the cashier scrolls across enabled columns. */
    .sales-list-table td.sale-note:not(:empty) { min-width: 26ch; overflow-wrap: anywhere; }
    .sales-list-table td.sale-staff:not(:empty) { min-width: 17ch; }
    .sales-list-table .display_currency,
    .sales-list-table tfoot :is(.footer_sale_total, .footer_total_paid, .footer_total_remaining, .footer_total_sell_return_due) {
        white-space: nowrap;
    }
    .sales-list-table .footer-total small { font-size: 13px; }
    .sales-list-table .footer-total p { margin: 0; line-height: 18px; white-space: nowrap; text-align: start; }
}
