/* ==========================================================================
   Acnoo Admin — design system (v2)
   Loaded after style.css / custom.css so it restyles every admin page
   without touching the 190 page templates. English UI, brand blue #0287FF.
   ========================================================================== */

:root {
    /* Brand #0287FF. Used as-is for accents that carry no text (focus rings,
       toggles, checkboxes, selection borders, active markers, charts).
       Fills with white text use --ac-blue, the brand darkened just enough for
       WCAG AA (4.5:1); hover / pressed go darker still. Text in brand colour
       on white or on the soft tints uses --ac-blue-text. */
    --ac-brand: #0287ff;
    --ac-brand-rgb: 2, 135, 255;
    --ac-blue: #0275de;
    --ac-blue-600: #0066c4;
    --ac-blue-700: #00569f;
    --ac-blue-text: #006acc;
    --ac-blue-ink: #053b70;
    --ac-blue-50: #eef6ff;
    --ac-blue-100: #d9ecff;
    --ac-blue-200: #b8dcff;
    --ac-blue-300: #8cc7ff;
    --ac-navy: #0e1530;
    --ac-navy-2: #151d3d;
    --ac-ink: #0f172a;
    --ac-text: #334155;
    --ac-muted: #64748b;
    --ac-faint: #94a3b8;
    --ac-border: #e5e8f0;
    --ac-border-strong: #d5dae5;
    --ac-bg: #f4f6fb;
    --ac-surface: #ffffff;
    --ac-surface-2: #f8fafc;
    --ac-green: #059669;
    --ac-green-50: #ecfdf5;
    --ac-amber: #b45309;
    --ac-amber-50: #fffbeb;
    --ac-red: #dc2626;
    --ac-red-50: #fef2f2;
    --ac-radius: 14px;
    --ac-radius-sm: 10px;
    --ac-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);
    --ac-shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.16);
    --ac-sidebar-w: 264px;
    --ac-font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

    /* re-point the legacy theme variables */
    --clr-primary: var(--ac-blue);
    --btn-primary: var(--ac-blue);
    --ff: var(--ac-font);
    --ff-body: var(--ac-font);
}

/* ---------- Base ---------- */
body {
    font-family: var(--ac-font) !important;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ac-text);
    background: var(--ac-bg) !important;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--ac-font) !important;
    color: var(--ac-ink);
    letter-spacing: -0.01em;
}

a {
    color: var(--ac-blue-text);
}

::selection {
    background: var(--ac-blue-100);
}

:focus-visible {
    outline: 2px solid var(--ac-brand);
    outline-offset: 2px;
}

/* ---------- Sidebar ---------- */
.side-bar {
    width: var(--ac-sidebar-w) !important;
    background: linear-gradient(180deg, var(--ac-navy) 0%, var(--ac-navy-2) 100%) !important;
    box-shadow: none !important;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.side-bar-logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    padding: 0 20px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 10px;
}

.side-bar-logo img {
    max-height: 36px;
    max-width: 170px;
    object-fit: contain;
}

.side-bar-manu {
    padding-bottom: 32px;
}

.side-bar-manu li {
    margin: 2px 12px !important;
}

.side-bar-manu li a {
    font-family: var(--ac-font) !important;
    font-size: 14px !important;
    font-weight: 500;
    color: #c7cee3 !important;
    padding: 9px 12px !important;
    border-radius: 10px !important;
    gap: 10px;
    transition: background 0.15s ease, color 0.15s ease;
}

.side-bar-manu li a .sidebar-icon {
    margin-right: 0 !important;
    width: 20px;
    display: inline-grid !important;
    place-items: center;
    opacity: 0.85;
}

.side-bar-manu li:hover > a {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #fff !important;
}

.side-bar-manu li.active > a,
.side-bar-manu > ul > li.active > a {
    background: var(--ac-blue) !important;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(2, 135, 255, 0.35);
}

.side-bar-manu li.active > a .sidebar-icon {
    opacity: 1;
}

.side-bar-manu .dropdown::before {
    color: #8b95b3 !important;
    top: 11px !important;
}

.side-bar-manu li .dropdown-menu {
    margin-left: 22px !important;
    padding-left: 12px !important;
    border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
    background: transparent !important;
}

.side-bar-manu li .dropdown-menu li a {
    font-size: 13.5px !important;
    color: #9aa4c3 !important;
    padding: 7px 10px !important;
    background: transparent !important;
    box-shadow: none !important;
}

.side-bar-manu li .dropdown-menu li a:hover,
.side-bar-manu li .dropdown-menu li a.active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

.side-bar-manu .ac-nav-label {
    display: block;
    padding: 16px 24px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6f7a9b;
    margin: 0 !important;
}

.side-bar-manu .ac-nav-label::before {
    display: none !important;
}

.side-bar-manu .ac-nav-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: rgba(2, 135, 255, 0.25);
    color: #cfe7ff;
    border-radius: 999px;
    padding: 1px 8px;
}

/* When a dropdown item shows a count badge, drop the "›" chevron so the two
   never collide on the right edge — the badge takes that spot cleanly.
   With no badge (count 0) the chevron returns, so all menus stay consistent. */
.side-bar-manu .dropdown:has(.ac-nav-badge)::before {
    display: none;
}

/* Summary totals shown at the TOP of a list (under the card head), one line,
   scrolls sideways on small screens so the figures never stack. */
.ac-summary-top {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px 22px;
    overflow-x: auto;
    padding: 12px 25px;
    border-bottom: 1px solid var(--ac-border, #e5e8f0);
}
.ac-summary-top .ac-total {
    white-space: nowrap;
}

/* Contact list: CV download icon (soft brand-blue chip that fills on hover). */
.ac-cv-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: #0287ff;
    background: #eaf3ff;
    border: 1px solid #d6e6fb;
    transition: background 0.15s ease, color 0.15s ease;
}
.ac-cv-download:hover {
    background: #0287ff;
    color: #fff;
}

@media (min-width: 1150px) {
    .section-container {
        padding-left: var(--ac-sidebar-w) !important;
    }
}

/* ---------- Header ---------- */
.main-header-section {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 68px;
    padding: 0 24px !important;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid var(--ac-border);
    box-shadow: none !important;
}

.main-header-section .header-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.main-header-section .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.main-header-section .header-left a {
    font-weight: 600;
    font-size: 14px;
}

.main-header-section .sidebar-opner {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--ac-border);
    cursor: pointer;
    color: var(--ac-text);
}

.main-header-section .sidebar-opner:hover {
    background: var(--ac-surface-2);
}

.main-header-section .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.main-header-section .profile-info img {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    border: 2px solid var(--ac-blue-100);
    object-fit: cover;
}

.ac-kbd-hint {
    display: none;
    align-items: center;
    gap: 6px;
    color: var(--ac-muted);
    font-size: 13px;
    border: 1px solid var(--ac-border);
    border-radius: 10px;
    padding: 6px 10px;
    background: var(--ac-surface);
    cursor: pointer;
}

@media (min-width: 992px) {
    .ac-kbd-hint {
        display: inline-flex;
    }
}

kbd,
.ac-kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 6px;
    border: 1px solid var(--ac-border-strong);
    border-bottom-width: 2px;
    background: var(--ac-surface-2);
    color: var(--ac-ink);
}

.dropdown-menu {
    border: 1px solid var(--ac-border) !important;
    border-radius: 12px !important;
    box-shadow: var(--ac-shadow-lg) !important;
    padding: 6px !important;
}

.dropdown-menu li a,
.dropdown-item {
    border-radius: 8px;
    padding: 8px 12px !important;
    font-size: 14px;
    color: var(--ac-text) !important;
}

.dropdown-menu li a:hover,
.dropdown-item:hover {
    background: var(--ac-surface-2) !important;
    color: var(--ac-ink) !important;
}

/* ---------- Page & cards ---------- */
.min-100-vh {
    padding: 24px 8px;
}

.erp-table-section,
.order-form-section,
.erp-state-overview-section {
    padding-top: 0 !important;
}

.card,
.full-page-card {
    border: 1px solid var(--ac-border) !important;
    border-radius: var(--ac-radius) !important;
    box-shadow: var(--ac-shadow) !important;
    background: var(--ac-surface);
    overflow: visible;
}

.card-body {
    padding: 0 !important;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 18px 22px !important;
    border-bottom: 1px solid var(--ac-border) !important;
    margin: 0 !important;
}

.table-header h4,
.card-header h4,
.card-title {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: var(--ac-ink) !important;
    margin: 0 !important;
}

.table-top-form {
    padding: 14px 22px !important;
    border-bottom: 1px solid var(--ac-border);
    background: var(--ac-surface);
}

.table-top-form .margin-l-16 {
    margin-left: 0 !important;
}

.table-search .form-control,
.table-top-form .form-control {
    height: 40px !important;
}

.table-search {
    min-width: 260px;
}

/* ---------- Buttons ---------- */
.theme-btn,
.btn-primary,
.submit-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px !important;
    border-radius: 10px !important;
    background: var(--ac-blue) !important;
    border: 1px solid var(--ac-blue) !important;
    color: #fff !important;
    font-family: var(--ac-font) !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    line-height: 1 !important;
    box-shadow: 0 1px 2px rgba(2, 135, 255, 0.2);
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.theme-btn:hover,
.btn-primary:hover,
.submit-btn:hover {
    background: var(--ac-blue-600) !important;
    box-shadow: 0 6px 16px rgba(2, 135, 255, 0.25);
    color: #fff !important;
}

.theme-btn i {
    margin: 0 !important;
}

.theme-btn.border-btn,
.reset-btn,
.btn-light,
.btn-outline-secondary {
    background: var(--ac-surface) !important;
    color: var(--ac-text) !important;
    border: 1px solid var(--ac-border-strong) !important;
    box-shadow: none !important;
}

.theme-btn.border-btn:hover,
.reset-btn:hover {
    background: var(--ac-surface-2) !important;
    color: var(--ac-ink) !important;
}

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

/* ---------- Tables ---------- */
.responsive-table,
.table-responsive {
    overflow-x: auto;
    border-radius: 0 0 var(--ac-radius) var(--ac-radius);
}

.table {
    margin: 0 !important;
    font-size: 14px;
    color: var(--ac-text);
    --bs-table-bg: transparent;
}

.table > thead > tr > th,
.table thead th {
    background: var(--ac-surface-2) !important;
    color: var(--ac-muted) !important;
    font-family: var(--ac-font) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 16px !important;
    border-bottom: 1px solid var(--ac-border) !important;
    border-top: 0 !important;
    white-space: nowrap;
}

.table > tbody > tr > td,
.table tbody td {
    padding: 13px 16px !important;
    vertical-align: middle !important;
    border-bottom: 1px solid var(--ac-border) !important;
    color: var(--ac-text);
}

.table > tbody > tr:hover > td {
    background: #eaf3ff;
}

.table-img {
    width: 44px !important;
    height: 44px !important;
    border-radius: 10px !important;
    object-fit: cover;
    border: 1px solid var(--ac-border);
}

.table-action > button {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid var(--ac-border) !important;
    background: var(--ac-surface);
    color: var(--ac-muted);
}

.table-action > button:hover {
    background: var(--ac-surface-2);
    color: var(--ac-ink);
}

/* ----- Row-action (three-dot) column: always in view at the right edge -----
   When columns are removed the table leaves extra width, which used to open a
   big empty gap and push the action menu off-screen. Pinning the last column
   to the right keeps the three-dot visible on every list table, on any screen,
   with no sideways scrolling, and lets it hug its own content. */
.responsive-table table > thead > tr > th:last-child,
.responsive-table table > tbody > tr > td:last-child,
.ac-table-wrap table > thead > tr > th:last-child,
.ac-table-wrap table > tbody > tr > td:last-child {
    position: sticky;
    right: 0;
    width: 1px;
    white-space: nowrap;
}
.responsive-table table > tbody > tr > td:last-child,
.ac-table-wrap table > tbody > tr > td:last-child {
    z-index: 2;
    background: var(--ac-surface);
}
.responsive-table table > thead > tr > th:last-child,
.ac-table-wrap table > thead > tr > th:last-child {
    z-index: 3;
    background: var(--ac-surface-2) !important;
}
.responsive-table table > tbody > tr:hover > td:last-child,
.ac-table-wrap table > tbody > tr:hover > td:last-child {
    background: #eaf3ff;
}

/* One footer design on every table: totals line, then the pager. */
.ac-table-footer {
    border-top: 1px solid var(--ac-border);
}

.ac-totals {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    padding: 12px 22px;
    background: var(--ac-surface-2);
    border-top: 1px solid var(--ac-border);
    scrollbar-width: thin;
}

.ac-total {
    flex: 0 0 auto;
    white-space: nowrap;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    background: var(--ac-surface);
    border: 1px solid var(--ac-border);
    font-size: 13px;
    color: var(--ac-muted);
}

.ac-total strong {
    color: var(--ac-ink);
    font-size: 14px;
}

nav > ul.pagination {
    display: block;
    margin: 0 !important;
    padding: 0 !important;
}

nav > ul.pagination > li.page-item {
    display: block;
    list-style: none;
}

.ac-pager {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
}

.ac-pager-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    display: inline-grid;
    place-items: center;
    border-radius: 9px;
    border: 1px solid var(--ac-border);
    background: var(--ac-surface);
    color: var(--ac-text) !important;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none !important;
    transition: background 0.15s, border-color 0.15s;
}

a.ac-pager-btn:hover {
    border-color: var(--ac-blue);
    color: var(--ac-blue-text) !important;
}

.ac-pager-btn.is-active {
    background: var(--ac-blue);
    border-color: var(--ac-blue);
    color: #fff !important;
}

.ac-pager-btn.is-disabled {
    opacity: 0.4;
    cursor: default;
}

/* ---------- Forms ---------- */
.form-control,
.form-select,
select.form-control,
.nice-select {
    min-height: 42px;
    border: 1px solid var(--ac-border-strong) !important;
    border-radius: var(--ac-radius-sm) !important;
    font-family: var(--ac-font) !important;
    font-size: 14px !important;
    color: var(--ac-ink) !important;
    background-color: var(--ac-surface);
    box-shadow: none !important;
    transition: border-color 0.15s, box-shadow 0.15s;
}

textarea.form-control {
    min-height: 96px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ac-blue) !important;
    box-shadow: 0 0 0 4px rgba(2, 135, 255, 0.12) !important;
}

.form-control::placeholder {
    color: var(--ac-faint) !important;
}

label,
.form-label {
    font-family: var(--ac-font) !important;
    font-weight: 600 !important;
    font-size: 13.5px !important;
    color: var(--ac-ink) !important;
    margin-bottom: 6px;
}

.mt-lg-4 > label,
.order-form-section label {
    background: transparent !important;
}

.switch .slider {
    background-color: #cbd2e0;
}

.switch input:checked + .slider {
    background-color: var(--ac-brand) !important;
}

/* ---------- Badges & status ---------- */
.badge {
    border-radius: 999px !important;
    padding: 5px 10px !important;
    font-weight: 600 !important;
    font-size: 12px !important;
}

.ac-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--ac-surface-2);
    color: var(--ac-text);
    white-space: nowrap;
}

.ac-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.ac-badge-green {
    background: var(--ac-green-50);
    color: var(--ac-green);
}

.ac-badge-amber {
    background: var(--ac-amber-50);
    color: var(--ac-amber);
}

.ac-badge-red {
    background: var(--ac-red-50);
    color: var(--ac-red);
}

.ac-badge-blue {
    background: var(--ac-blue-50);
    color: var(--ac-blue-text);
}

/* ---------- Modals: one look for every popup ----------
   Header (optional logo/icon + title + badges), scrollable body with
   titled sections and a 2-column grid, sticky footer with the actions.
   Bootstrap keeps focus inside, Esc closes; admin-ux.js makes Enter
   press the primary button. */
.modal {
    --ac-modal-pad: 22px;
}

.modal.fade .modal-dialog {
    transform: translateY(14px) scale(0.98) !important;
    opacity: 0;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.18s ease !important;
}

.modal.show .modal-dialog {
    transform: none !important;
    opacity: 1;
}

.modal-backdrop.show {
    opacity: 0.5;
    backdrop-filter: blur(2px);
}

.modal-content {
    padding: 0 !important;
    border: 1px solid var(--ac-border) !important;
    border-radius: 18px !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22) !important;
    overflow: hidden;
    background: var(--ac-surface) !important;
}

.modal-header {
    display: flex !important;
    align-items: center !important;
    gap: 14px;
    padding: 18px var(--ac-modal-pad) !important;
    border-bottom: 1px solid var(--ac-border) !important;
    background: var(--ac-surface) !important;
}

.modal-header .btn-close {
    flex: none;
    align-self: flex-start;
    width: 32px;
    height: 32px;
    margin: 0 0 0 auto !important;
    padding: 0 !important;
    border-radius: 10px;
    background-size: 12px;
    background-color: var(--ac-surface-2);
    opacity: 0.8;
}

.modal-header .btn-close:hover {
    opacity: 1;
    background-color: var(--ac-border);
}

.modal-title,
.modal-header h4,
.modal-header h5 {
    margin: 0 !important;
    font-weight: 700 !important;
    font-size: 17px !important;
    line-height: 1.3 !important;
    color: var(--ac-ink) !important;
}

.modal-body {
    padding: 20px var(--ac-modal-pad) !important;
    color: var(--ac-text);
}

.modal-dialog-scrollable .modal-body {
    overscroll-behavior: contain;
}

.modal-footer {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end !important;
    gap: 8px;
    padding: 14px var(--ac-modal-pad) !important;
    border-top: 1px solid var(--ac-border) !important;
    background: var(--ac-surface-2) !important;
}

.modal-footer > * {
    margin: 0 !important;
}

.modal-footer .theme-btn,
.modal-footer .btn {
    min-width: 96px;
    height: 40px;
    justify-content: center;
}

/* Legacy popups put Cancel/Save in a .button-group inside the body:
   give them the same footer look. */
.modal-body .button-group:last-child,
.modal-body form > .button-group,
.modal-body .row > .col-lg-12 > .button-group {
    display: flex !important;
    justify-content: flex-end !important;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px calc(var(--ac-modal-pad) * -1) -20px !important;
    padding: 14px var(--ac-modal-pad);
    border-top: 1px solid var(--ac-border);
    background: var(--ac-surface-2);
    position: sticky;
    bottom: -20px;
    z-index: 2;
}

.modal-body .button-group .theme-btn {
    margin: 0 !important;
    min-width: 96px;
}

/* Header parts */
.ac-modal-head {
    align-items: flex-start !important;
}

.ac-modal-logo,
.ac-modal-icon {
    flex: none;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--ac-blue-50);
    color: var(--ac-blue-text);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.ac-modal-head-text {
    min-width: 0;
    flex: 1 1 auto;
}

.ac-modal-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.ac-modal-link {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ac-blue-text) !important;
    text-decoration: none;
}

.ac-modal-link:hover {
    text-decoration: underline;
}

.ac-modal-intro {
    margin: 0 0 14px;
    color: var(--ac-muted);
    font-size: 13.5px;
    line-height: 1.55;
}

/* Sections */
.ac-modal-section {
    padding: 18px 0;
    border-top: 1px solid var(--ac-border);
}

.ac-modal-section:first-of-type {
    border-top: 0;
    padding-top: 4px;
}

.ac-modal-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ac-ink) !important;
}

.ac-modal-section-title i {
    color: var(--ac-blue-text);
}

.ac-modal-section-help {
    margin: -4px 0 12px !important;
}

.ac-modal-grid + .ac-modal-section-help {
    margin: 10px 0 0 !important;
}

.ac-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

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

.ac-modal-grid > .ac-span-2 {
    grid-column: 1 / -1;
}

.ac-field {
    min-width: 0;
    margin-bottom: 12px;
}

.ac-modal-grid > .ac-field {
    margin-bottom: 0;
}

.ac-field > .form-label,
.ac-field > span.form-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--ac-ink) !important;
}

.ac-field .ac-help {
    margin: 6px 0 0;
}

.ac-req {
    color: var(--ac-red);
}

.ac-check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 0;
    font-weight: 600;
    color: var(--ac-ink);
    cursor: pointer;
}

.ac-check-row .form-check-input {
    margin: 0;
    width: 18px;
    height: 18px;
}

/* Footer helpers */
.ac-modal-foot {
    position: sticky;
    bottom: 0;
}

.ac-modal-keys {
    margin-right: auto !important;
    color: var(--ac-faint);
    font-size: 12px;
    white-space: nowrap;
}

.ac-modal-keys kbd {
    padding: 1px 6px;
    border: 1px solid var(--ac-border-strong);
    border-radius: 5px;
    background: var(--ac-surface);
    color: var(--ac-text);
    font-size: 11px;
    box-shadow: none;
}

/* Secret inputs with a show / hide button */
.ac-secret {
    position: relative;
}

.ac-secret.has-toggle > .form-control {
    padding-right: 46px !important;
}

.ac-secret-toggle {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ac-muted);
}

.ac-secret-toggle:hover,
.ac-secret-toggle[aria-pressed="true"] {
    background: var(--ac-blue-50);
    color: var(--ac-blue-text);
}

textarea.is-masked {
    -webkit-text-security: disc;
}

/* Copy boxes */
.ac-copy {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 12px;
    border: 1px solid var(--ac-border);
    border-radius: 12px;
    background: var(--ac-surface-2);
    min-width: 0;
}

.ac-copy code {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--ac-ink);
    background: transparent;
    font-size: 12.5px;
    word-break: break-all;
}

.ac-copy-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--ac-border-strong);
    border-radius: 8px;
    background: var(--ac-surface);
    color: var(--ac-ink);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.ac-copy-btn:hover {
    border-color: var(--ac-blue);
    color: var(--ac-blue-text);
}

.ac-copy-btn.is-copied {
    border-color: var(--ac-green) !important;
    color: var(--ac-green) !important;
    background: var(--ac-green-50);
}

/* View popups ("details" lists) */
.modal-body ul.list-unstyled li,
.modal-body .view-list li,
.modal-body .user-view-list li {
    display: grid;
    grid-template-columns: minmax(110px, 34%) 12px minmax(0, 1fr);
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid var(--ac-border);
    font-size: 14px;
}

.modal-body img.img-fluid,
.modal-body .preview-img img {
    border-radius: 12px;
}

@media (max-width: 575.98px) {
    .modal {
        --ac-modal-pad: 16px;
    }

    .modal-dialog:not(.modal-fullscreen-sm-down) {
        margin: 12px;
    }

    .modal-dialog:not(.modal-fullscreen-sm-down) .modal-content {
        max-height: calc(100vh - 24px);
    }

    .ac-modal-grid,
    .ac-modal-grid-3 {
        grid-template-columns: minmax(0, 1fr);
    }

    .ac-modal-keys {
        display: none;
    }

    .modal-footer .theme-btn,
    .modal-footer .btn {
        flex: 1 1 auto;
    }

    .modal-fullscreen-sm-down .modal-content {
        border-radius: 0 !important;
        border: 0 !important;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .ac-modal-grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .modal.fade .modal-dialog {
        transition: none !important;
    }
}

/* Note popup shown before every approve / cancel / reject / delete */
.ac-note-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex: none;
    font-size: 18px;
}

.ac-note-icon.is-danger {
    background: var(--ac-red-50);
    color: var(--ac-red);
}

.ac-note-icon.is-warning {
    background: var(--ac-amber-50);
    color: var(--ac-amber);
}

.ac-note-icon.is-success {
    background: var(--ac-green-50);
    color: var(--ac-green);
}

.ac-note-head {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.ac-note-head h5 {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 700;
}

.ac-note-head p {
    margin: 0;
    color: var(--ac-muted);
    font-size: 14px;
}

.ac-note-field {
    margin-top: 16px;
}

.ac-note-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--ac-muted);
}

.ac-note-error {
    margin-top: 6px;
    font-size: 13px;
    color: var(--ac-red);
}

/* ---------- Searchable dropdown (combobox) ---------- */
.ac-combo {
    position: relative;
    width: 100%;
}

.ac-combo-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    clip: rect(0 0 0 0);
}

.ac-combo-input {
    width: 100%;
    min-height: 42px;
    padding: 0 38px 0 12px;
    border: 1px solid var(--ac-border-strong);
    border-radius: var(--ac-radius-sm);
    font-size: 14px;
    color: var(--ac-ink);
    background: var(--ac-surface);
    outline: none;
    cursor: pointer;
    text-overflow: ellipsis;
}

.ac-combo-input {
    background-image: none !important;
}

.ac-combo.is-open .ac-combo-caret {
    transform: translateY(-50%) rotate(180deg);
}

.ac-combo.is-open .ac-combo-input {
    cursor: text;
    border-color: var(--ac-blue);
    box-shadow: 0 0 0 4px rgba(2, 135, 255, 0.12);
}

/* Plain dropdown (short list, no search): stays a click-to-pick control. */
.ac-combo-plain .ac-combo-input,
.ac-combo-plain.is-open .ac-combo-input {
    cursor: pointer;
    caret-color: transparent;
}

.ac-combo-caret {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--ac-muted);
    font-size: 12px;
}

.ac-combo-list {
    position: absolute;
    z-index: 1060;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
    margin: 0;
    list-style: none;
    background: var(--ac-surface);
    border: 1px solid var(--ac-border);
    border-radius: 12px;
    box-shadow: var(--ac-shadow-lg);
}

.ac-combo-option {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    color: var(--ac-text);
}

.ac-combo-option.is-active {
    background: var(--ac-blue-50);
    color: var(--ac-blue-text);
}

.ac-combo-option.is-selected {
    font-weight: 700;
}

.ac-combo-empty {
    padding: 10px;
    color: var(--ac-muted);
    font-size: 13px;
}

.ac-combo-option mark {
    padding: 0;
    background: transparent;
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
}

/* ---------- Shortcut help ---------- */
.ac-shortcuts dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 16px;
    margin: 0;
    align-items: center;
}

.ac-shortcuts dt {
    white-space: nowrap;
}

.ac-shortcuts dd {
    margin: 0;
    color: var(--ac-text);
}

/* ---------- Stat cards (dashboard & marketplace) ---------- */
.ac-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.ac-stat {
    background: var(--ac-surface);
    border: 1px solid var(--ac-border);
    border-radius: var(--ac-radius);
    box-shadow: var(--ac-shadow);
    padding: 18px 20px;
}

.ac-stat-label {
    font-size: 13px;
    color: var(--ac-muted);
    margin: 0;
}

.ac-stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--ac-ink);
    margin: 4px 0 0;
    letter-spacing: -0.02em;
}

.ac-stat-sub {
    font-size: 12px;
    color: var(--ac-muted);
}

/* ---------- Detail lists ---------- */
.ac-section {
    padding: 20px 22px;
}

.ac-section + .ac-section {
    border-top: 1px solid var(--ac-border);
}

.ac-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ac-ink);
    margin: 0 0 14px;
}

.ac-dl {
    display: grid;
    grid-template-columns: minmax(90px, 120px) 1fr;
    gap: 10px 16px;
    margin: 0;
}

.ac-dl dt {
    color: var(--ac-muted);
    font-weight: 500;
}

.ac-dl dd {
    margin: 0;
    color: var(--ac-ink);
    word-break: break-word;
}

.ac-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
}

.ac-help {
    font-size: 13px;
    color: var(--ac-muted);
    margin-top: 6px;
}

.ac-callout {
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13.5px;
    background: var(--ac-blue-50);
    color: var(--ac-blue-ink);
    border: 1px solid var(--ac-blue-100);
}

.ac-callout code {
    background: rgba(255, 255, 255, 0.7);
    padding: 1px 6px;
    border-radius: 6px;
    word-break: break-all;
}

.ac-gateway-grid {
    display: grid;
    gap: 20px;
}

@media (min-width: 1200px) {
    .ac-gateway-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.ac-form-grid {
    display: grid;
    gap: 16px;
}

@media (min-width: 768px) {
    .ac-form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.ac-form-grid .ac-span-2 {
    grid-column: 1 / -1;
}

.ac-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--ac-border);
}

.ac-card-head h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.ac-card-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 22px;
    border-top: 1px solid var(--ac-border);
    background: var(--ac-surface-2);
    border-radius: 0 0 var(--ac-radius) var(--ac-radius);
}

.ac-empty {
    text-align: center;
    padding: 48px 20px !important;
    color: var(--ac-muted);
}

/* ---------- Toasts & misc ---------- */
#toast-container > div {
    border-radius: 12px !important;
    box-shadow: var(--ac-shadow-lg) !important;
    font-family: var(--ac-font);
    opacity: 1 !important;
}

.footer-section,
footer {
    color: var(--ac-muted);
    font-size: 13px;
}

@media (max-width: 767px) {
    .min-100-vh {
        padding: 16px 0;
    }

    .table-header,
    .table-top-form,
    .ac-card-head,
    .ac-section {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    .ac-dl {
        grid-template-columns: 1fr;
        gap: 2px 0;
    }

    .ac-dl dd {
        margin-bottom: 10px;
    }

    .table-search {
        min-width: 0;
        flex: 1;
    }
}

@media print {
    .side-bar,
    .main-header-section,
    .ac-pager {
        display: none !important;
    }

    .section-container {
        padding-left: 0 !important;
    }
}

/* ---------- Filter bar ---------- */
.ac-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.ac-filter-bar > div {
    flex: 0 1 150px;
}

.ac-filter-bar > .ac-filter-search {
    flex: 1 1 260px;
}

.ac-filter-bar > .ac-filter-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
}

.theme-btn {
    min-width: 0 !important;
}

.table .theme-btn,
.ac-card-head .theme-btn,
.table-header .theme-btn {
    width: auto !important;
    white-space: nowrap;
}

.table td .theme-btn {
    height: 34px;
    padding: 0 12px !important;
    font-size: 13px !important;
}

.table.ac-table th,
.table.ac-table td {
    text-align: left;
}

.table.ac-table th.text-end,
.table.ac-table td.text-end {
    text-align: right;
}

.table.ac-table td {
    white-space: normal;
}

/* Legacy tables reserved a full screen of height (so row action menus are
   not clipped). Keep enough room for the menus without the huge gap. */
.responsive-table {
    min-height: 380px !important;
}

.responsive-table.ac-table-wrap {
    min-height: 0 !important;
}

/* ---------- "Go to…" command palette ---------- */
.ac-jump-dialog {
    max-width: 620px;
    margin-top: 10vh;
}

.ac-jump-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--ac-border);
    color: var(--ac-muted);
}

.ac-jump-input {
    flex: 1;
    border: 0;
    outline: none;
    font-size: 16px;
    color: var(--ac-ink);
    background: transparent;
}

.ac-jump-list {
    list-style: none;
    margin: 0;
    padding: 8px;
    max-height: 50vh;
    overflow-y: auto;
}

.ac-jump-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
}

.ac-jump-item.is-active {
    background: var(--ac-blue-50);
}

.ac-jump-item.is-active .ac-jump-label {
    color: var(--ac-blue-text);
}

.ac-jump-label {
    font-weight: 600;
    color: var(--ac-ink);
}

.ac-jump-meta {
    font-size: 12px;
    color: var(--ac-muted);
    white-space: nowrap;
}

.ac-jump-empty {
    padding: 16px;
    color: var(--ac-muted);
    text-align: center;
}

.ac-jump-foot {
    padding: 10px 18px;
    border-top: 1px solid var(--ac-border);
    background: var(--ac-surface-2);
    font-size: 12px;
    color: var(--ac-muted);
}

.ac-jump-btn kbd + kbd {
    margin-left: -2px;
}

@media (max-width: 991px) {
    .ac-jump-btn {
        display: inline-flex;
        padding: 6px 8px;
    }

    .ac-jump-btn kbd,
    .ac-jump-btn .ac-jump-text {
        display: none;
    }
}

/* ---------- Long create/edit forms: keep the Save button in reach ---------- */
.add-product-header {
    position: sticky;
    top: 68px;
    z-index: 15;
    padding: 12px 18px;
    margin: -4px 0 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
    border: 1px solid var(--ac-border);
    border-radius: var(--ac-radius);
    box-shadow: var(--ac-shadow);
}

.add-product-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.new-product-left > h3,
.new-product-right > h3,
.order-form-section h3 {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--ac-ink) !important;
    padding: 16px 20px 0 !important;
    margin: 0 !important;
}

.new-product-left,
.new-product-right {
    border-radius: var(--ac-radius) !important;
}

/* ==========================================================================
   v3 — one look for every page (lists, forms, headers, empty states)
   ========================================================================== */

/* ---------- Page / card header: title + subtitle left, actions right ---------- */
.ac-page-head-text {
    min-width: 0;
    flex: 1 1 260px;
}

.table-header .ac-page-sub,
.ac-page-sub {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--ac-muted);
}

/* Legacy cards reserved a full screen of height even for two rows */
.full-page-card {
    min-height: 0 !important;
}

.ac-logo-text {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
}

.ac-page-actions,
.table-header > .d-flex,
.table-header > div:last-child:not(.ac-page-head-text) {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.table-header .theme-btn i.me-1 {
    margin-right: 0 !important;
}

/* ---------- Shared filter bar ---------- */
.ac-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.ac-filter-bar .form-control,
.ac-filter-bar .form-select,
.ac-filter-bar .ac-combo-input {
    height: 40px !important;
    min-height: 40px;
}

.ac-filter-bar > .ac-filter-search {
    position: relative;
    flex: 1 1 200px;
}

.ac-filter-search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ac-faint);
    font-size: 13px;
    pointer-events: none;
}

.ac-filter-search .form-control {
    padding-left: 36px !important;
}

.ac-filter-bar > .ac-filter-field {
    flex: 0 1 170px;
}

.ac-filter-bar > .ac-filter-dates {
    flex: 0 1 290px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ac-filter-dates .form-control {
    min-width: 0;
    flex: 1 1 0;
}

.ac-filter-dash {
    color: var(--ac-faint);
}

.ac-filter-bar > .ac-filter-perpage {
    flex: 0 0 130px;
}

.ac-filter-bar > .ac-filter-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
}

@media (max-width: 767px) {
    .ac-filter-bar > .ac-filter-search,
    .ac-filter-bar > .ac-filter-dates {
        flex: 1 1 100%;
    }

    .ac-filter-bar > .ac-filter-field,
    .ac-filter-bar > .ac-filter-perpage {
        flex: 1 1 calc(50% - 5px);
    }

    .ac-filter-bar > .ac-filter-actions {
        flex: 1 1 100%;
    }

    .ac-filter-bar > .ac-filter-actions .theme-btn {
        flex: 1;
    }
}

/* ---------- Tables ---------- */
/* Row menus open with a fixed popper (admin-ux.js), so lists no longer need
   to reserve a screen of empty space below a short table. */
.responsive-table {
    min-height: 0 !important;
}

.table td.ac-empty,
.ac-empty-row td {
    text-align: center !important;
    padding: 44px 20px !important;
    color: var(--ac-muted);
    background: var(--ac-surface) !important;
}

.ac-empty-inner {
    position: sticky;
    left: 0;
    width: min(100%, calc(100vw - 72px));
    white-space: normal;
}

.ac-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--ac-blue-50);
    color: var(--ac-blue-text);
    font-size: 20px;
}

.ac-empty-title {
    font-weight: 700;
    color: var(--ac-ink);
    font-size: 15px;
    margin: 0 0 2px;
}

.ac-empty-text {
    margin: 0;
    font-size: 13px;
}

.table-action .dropdown-menu {
    min-width: 160px;
}

.table-action .dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-action .dropdown-menu li a.confirm-action,
.table-action .dropdown-menu li a.delete-confirm {
    color: var(--ac-red) !important;
}

/* Cleaner, evenly-aligned, colour-coded action icons. The destructive item
   keeps its red (inherited from .confirm-action), so it is not recoloured. */
.table-action .dropdown-menu li a > i {
    width: 18px;
    font-size: 15px;
    text-align: center;
    flex: none;
}
/* Colour-coded by meaning, covering both the new and the legacy glyphs, so
   every table's action menu looks the same across the whole admin. */
.table-action .dropdown-menu li a .fa-pen,
.table-action .dropdown-menu li a .fa-pencil-alt,
.table-action .dropdown-menu li a .fa-edit { color: #0287ff; }              /* Edit */
.table-action .dropdown-menu li a .fa-clone,
.table-action .dropdown-menu li a .fa-copy { color: #6366f1; }              /* Duplicate */
.table-action .dropdown-menu li a .fa-window-maximize,
.table-action .dropdown-menu li a .fa-columns { color: #0ea5e9; }           /* Landing / layout */
.table-action .dropdown-menu li a .fa-eye { color: #0ea5e9; }               /* Preview */
.table-action .dropdown-menu li a .fa-external-link,
.table-action .dropdown-menu li a .fa-external-link-alt { color: #16a34a; } /* View on website */
.table-action .dropdown-menu li a .fa-download { color: #16a34a; }          /* Download */
.table-action .dropdown-menu li a .fa-print { color: #64748b; }             /* Print */
.table-action .dropdown-menu li a .fa-envelope,
.table-action .dropdown-menu li a .fa-bell { color: #f59e0b; }              /* Notify */
.table-action .dropdown-menu li a .fa-credit-card { color: #0ea5e9; }       /* Payment */
.table-action .dropdown-menu li a .fa-trash-alt,
.table-action .dropdown-menu li a .fa-trash { color: var(--ac-red); }       /* Delete */

.ac-table-footer .ac-totals {
    border-top: 0;
}

.ac-table-footer .ac-pager {
    border-top: 1px solid var(--ac-border);
}

.ac-table-footer:last-child {
    border-radius: 0 0 var(--ac-radius) var(--ac-radius);
    overflow: hidden;
}

/* Bulk-delete bar above the table */
.multi-delete-popup {
    margin: 12px 22px !important;
    background: var(--ac-red-50) !important;
    border: 1px solid #fecaca;
}

.multi-delete-popup h2 {
    font-size: 14px !important;
    margin: 0;
    color: var(--ac-red);
}

.multi-delete-popup .trigger-modal {
    border: 0;
    border-radius: 8px;
    padding: 6px 14px;
    background: var(--ac-red);
    color: #fff;
    font-weight: 600;
}

/* ---------- Create / edit forms ---------- */
.order-form-section {
    padding: 20px 22px 0 !important;
}

.order-form-section .row > h5,
.order-form-section .row > h4,
.order-form-section .row > h3,
.order-form-section > form > h5,
.order-form-section .add-suplier-modal-wrapper > .row > .col-12 > h5 {
    flex: 0 0 100%;
    margin: 22px 0 2px !important;
    padding: 18px calc(var(--bs-gutter-x, 1.5rem) * 0.5) 0 !important;
    border-top: 1px solid var(--ac-border);
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--ac-ink) !important;
    background: transparent !important;
}

.order-form-section .row > [class*="col-"] {
    margin-bottom: 6px;
}

.order-form-section .row > [class*="col-"] > label + label.form-label,
.order-form-section .form-label.m-0 + .form-label.m-0 {
    display: block;
    font-weight: 500 !important;
    font-size: 12.5px !important;
    color: var(--ac-muted) !important;
}

/* Cancel / Save row → a right-aligned footer like the newer pages */
.order-form-section .button-group {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin: 24px -22px 0 !important;
    padding: 14px 22px;
    border-top: 1px solid var(--ac-border);
    background: var(--ac-surface-2);
    border-radius: 0 0 var(--ac-radius) var(--ac-radius);
}

.order-form-section .button-group .theme-btn {
    margin: 0 !important;
    min-width: 96px !important;
}

.order-form-section .button-group a.theme-btn:not(.border-btn),
.order-form-section .button-group button[type="reset"] {
    background: var(--ac-surface) !important;
    color: var(--ac-text) !important;
    border: 1px solid var(--ac-border-strong) !important;
    box-shadow: none !important;
}

/* File inputs: same height and look as the other fields */
input[type="file"].form-control {
    padding: 0 !important;
    line-height: 40px;
    overflow: hidden;
}

input[type="file"].form-control::file-selector-button {
    height: 40px;
    margin: 0 12px 0 0;
    padding: 0 14px;
    border: 0;
    border-right: 1px solid var(--ac-border);
    background: var(--ac-surface-2);
    color: var(--ac-ink);
    font-weight: 600;
    cursor: pointer;
}

.order-form-section .table-img,
.order-form-section img.image-preview {
    flex: none;
    width: 42px !important;
    height: 42px !important;
}

/* Plain multi-selects that are not enhanced by select2 */
select[multiple].form-control,
select[multiple].form-select {
    min-height: 110px;
    padding: 6px !important;
}

/* Summernote editor frame */
.note-editor.note-frame {
    border: 1px solid var(--ac-border-strong) !important;
    border-radius: var(--ac-radius-sm) !important;
    overflow: hidden;
}

.note-editor .note-toolbar {
    background: var(--ac-surface-2) !important;
    border-bottom: 1px solid var(--ac-border) !important;
}

/* Two-column legacy rows stack on phones */
@media (max-width: 767px) {
    .order-form-section .row > .col-6,
    .order-form-section .row > .col-5,
    .order-form-section .row > .col-4,
    .order-form-section .row > .col-3,
    .order-form-section .row > .col-8,
    .order-form-section .row > .col-7 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .order-form-section {
        padding: 16px 16px 0 !important;
    }

    .order-form-section .button-group {
        margin: 20px -16px 0 !important;
        padding: 12px 16px;
    }

    .order-form-section .button-group .theme-btn {
        flex: 1;
    }
}

/* ---------- Header on phones ---------- */
.main-header-section .notifications .bg-red:empty,
.main-header-section .notifications .bg-red.is-zero {
    display: none;
}

@media (max-width: 575px) {
    .main-header-section {
        padding: 0 12px !important;
    }

    .main-header-section .header-left {
        gap: 10px;
    }

    .main-header-section .ac-hide-sm,
    .main-header-section .ac-jump-btn {
        display: none !important;
    }

    .main-header-section .header-left a .fa-globe {
        margin: 0 !important;
        font-size: 18px;
    }

    .main-header-section .header-right {
        gap: 6px;
    }

    .main-header-section .notifications .dropdown-toggleer {
        margin-right: 4px !important;
    }

    .table-header {
        padding: 16px !important;
    }

    .table-header .theme-btn {
        height: 38px;
        padding: 0 12px !important;
    }
}

/* ---------- Header search (customers / orders) ---------- */
.main-header-section .header-middle {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.ac-gsearch {
    position: relative;
    width: 100%;
    max-width: 520px;
}

.ac-gsearch-box {
    position: relative;
}

.ac-gsearch-glass {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ac-faint);
    font-size: 14px;
    pointer-events: none;
}

.ac-gsearch-input {
    width: 100%;
    height: 40px;
    padding: 0 40px 0 38px;
    border: 1px solid var(--ac-border);
    border-radius: 12px;
    background: var(--ac-surface-2);
    color: var(--ac-ink);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.ac-gsearch-input::-webkit-search-cancel-button {
    display: none;
}

.ac-gsearch-input:focus {
    background: var(--ac-surface);
    border-color: var(--ac-blue);
    box-shadow: 0 0 0 4px rgba(2, 135, 255, 0.12);
}

.ac-gsearch-kbd {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.ac-gsearch-input:focus ~ .ac-gsearch-kbd,
.ac-gsearch.is-loading .ac-gsearch-kbd {
    display: none;
}

.ac-gsearch-spin {
    display: none;
    position: absolute;
    right: 14px;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid var(--ac-blue-100);
    border-top-color: var(--ac-blue);
    border-radius: 50%;
    animation: ac-spin 0.7s linear infinite;
}

.ac-gsearch.is-loading .ac-gsearch-spin {
    display: block;
}

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

.ac-gsearch-panel {
    position: absolute;
    z-index: 1070;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    max-height: min(70vh, 480px);
    overflow-y: auto;
    padding: 6px;
    background: var(--ac-surface);
    border: 1px solid var(--ac-border);
    border-radius: 14px;
    box-shadow: var(--ac-shadow-lg);
}

.ac-gsearch-head {
    padding: 8px 10px 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ac-muted);
}

.ac-gsearch-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--ac-ink) !important;
    text-decoration: none !important;
}

.ac-gsearch-item.is-active {
    background: var(--ac-blue-50);
}

.ac-gsearch-icon {
    flex: none;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--ac-surface-2);
    color: var(--ac-blue-text);
    font-size: 13px;
}

.ac-gsearch-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ac-gsearch-title {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ac-gsearch-meta {
    font-size: 12px;
    color: var(--ac-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ac-gsearch-msg {
    padding: 14px 12px;
    color: var(--ac-muted);
    font-size: 13px;
}

.ac-gsearch-foot {
    margin-top: 4px;
    padding: 8px 10px 4px;
    border-top: 1px solid var(--ac-border);
    font-size: 12px;
    color: var(--ac-faint);
}

.ac-gsearch-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--ac-border);
    border-radius: 10px;
    background: var(--ac-surface);
    color: var(--ac-text);
}

/* phones / small tablets: an icon that opens a full-width bar under the header */
@media (max-width: 991px) {
    .main-header-section .header-middle {
        flex: 0 0 auto;
        justify-content: flex-end;
        margin-left: auto;
    }

    .ac-gsearch {
        position: static;
        width: auto;
    }

    .ac-gsearch-toggle {
        display: grid;
        place-items: center;
    }

    .ac-gsearch-box,
    .ac-gsearch-panel {
        display: none;
    }

    .ac-gsearch.is-open .ac-gsearch-box {
        display: block;
        position: absolute;
        left: 0;
        right: 0;
        top: 68px;
        z-index: 1071;
        padding: 10px 12px;
        background: var(--ac-surface);
        border-bottom: 1px solid var(--ac-border);
        box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    }

    .ac-gsearch.is-open .ac-gsearch-glass {
        left: 26px;
    }

    .ac-gsearch.is-open .ac-gsearch-input {
        background: var(--ac-surface);
    }

    .ac-gsearch.is-open .ac-gsearch-panel:not([hidden]) {
        display: block;
        left: 12px;
        right: 12px;
        top: 126px;
    }

    .ac-gsearch-kbd {
        display: none;
    }
}

/* ---------- Sidebar search (menus, sub-menus and pages inside them) ---------- */
.side-bar-manu .ac-nav-search {
    margin: 4px 12px 8px !important;
    padding: 0 !important;
}

.side-bar-manu .ac-nav-search::before {
    display: none !important;
}

.ac-nav-search-box {
    position: relative;
}

.ac-nav-search-box > .fa-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #8b95b3;
    font-size: 13px;
    pointer-events: none;
}

.ac-nav-search-input {
    width: 100%;
    height: 38px;
    padding: 0 32px 0 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 13.5px;
    outline: none;
}

.ac-nav-search-input::placeholder {
    color: #8b95b3;
}

.ac-nav-search-input::-webkit-search-cancel-button {
    display: none;
}

.ac-nav-search-input:focus {
    border-color: rgba(2, 135, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
}

.ac-nav-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #9aa4c3;
}

.ac-nav-search-clear:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.side-bar-manu .ac-nav-results {
    list-style: none;
    margin: 8px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    display: block;
}

.side-bar-manu .ac-nav-results[hidden] {
    display: none !important;
}

.side-bar-manu .ac-nav-results li {
    margin: 0 0 2px !important;
}

.side-bar-manu .ac-nav-results li::before {
    display: none !important;
}

.side-bar-manu .ac-nav-results .ac-nav-result {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 1px !important;
    padding: 8px 10px !important;
    border-radius: 10px !important;
    white-space: normal;
}

.side-bar-manu .ac-nav-results .ac-nav-result.is-active {
    background: rgba(2, 135, 255, 0.9) !important;
    color: #fff !important;
}

.ac-nav-result-label {
    font-weight: 600;
    color: #fff;
    font-size: 13.5px;
}

.ac-nav-result-meta {
    font-size: 11.5px;
    color: #8b95b3;
    font-weight: 500;
}

.ac-nav-result.is-active .ac-nav-result-meta {
    color: #d6ebff;
}

.ac-nav-result-empty {
    padding: 8px 4px;
    font-size: 12.5px;
    color: #8b95b3;
}

/* while searching, the results replace the menu */
.side-bar.is-searching .side-bar-manu > ul > li:not(.ac-nav-search) {
    display: none !important;
}

.side-bar-manu mark.ac-nav-mark {
    padding: 0 1px;
    border-radius: 3px;
    background: rgba(250, 204, 21, 0.35);
    color: inherit;
}

/* Collapsed desktop sidebar (toggle button): icons only; hovering or
   focusing the search opens it full width so results can be read. */
@media (min-width: 1150px) {
    .side-bar.active {
        width: 76px !important;
        overflow-x: hidden;
    }

    .section-container.active {
        padding-left: 76px !important;
    }

    .side-bar.active:hover,
    .side-bar.active:focus-within,
    .side-bar.active.is-searching {
        width: var(--ac-sidebar-w) !important;
        box-shadow: 0 0 40px rgba(15, 23, 42, 0.35) !important;
    }

    .side-bar.active:not(:hover):not(:focus-within):not(.is-searching) .ac-nav-label,
    .side-bar.active:not(:hover):not(:focus-within):not(.is-searching) .ac-nav-badge,
    .side-bar.active:not(:hover):not(:focus-within):not(.is-searching) .side-bar-manu .dropdown-menu {
        display: none !important;
    }

    .side-bar.active:not(:hover):not(:focus-within):not(.is-searching) .side-bar-manu > ul > li > a {
        font-size: 0 !important;
        justify-content: center;
    }

    .side-bar.active:not(:hover):not(:focus-within):not(.is-searching) .side-bar-manu > ul > li > a .sidebar-icon {
        font-size: 15px !important;
        margin: 0 !important;
        left: 0 !important;
    }

    .side-bar.active:not(:hover):not(:focus-within):not(.is-searching) .side-bar-manu .dropdown::before {
        opacity: 0;
    }

    .side-bar.active:not(:hover):not(:focus-within):not(.is-searching) .ac-nav-badge,
    .side-bar.active:not(:hover):not(:focus-within):not(.is-searching) .side-bar-logo img,
    .side-bar.active:not(:hover):not(:focus-within):not(.is-searching) .ac-logo-text {
        visibility: hidden;
    }

    .side-bar.active:not(:hover):not(:focus-within):not(.is-searching) .ac-nav-search-input {
        padding: 0;
        color: transparent;
        cursor: pointer;
    }

    .side-bar.active:not(:hover):not(:focus-within):not(.is-searching) .ac-nav-search-input::placeholder {
        color: transparent;
    }

    .side-bar.active:not(:hover):not(:focus-within):not(.is-searching) .side-bar-manu li a {
        white-space: nowrap;
    }
}

/* ---------- Upload progress (AJAX forms with files) ---------- */
.ac-upload-progress {
    margin: 12px 0 0;
    padding: 12px 16px;
    border: 1px solid var(--ac-blue-100);
    border-radius: var(--ac-radius-sm);
    background: var(--ac-blue-50);
}

.ac-upload-progress[hidden] {
    display: none !important;
}

.ac-upload-progress.is-floating {
    position: fixed;
    z-index: 1080;
    top: 76px;
    right: 20px;
    width: min(360px, calc(100vw - 40px));
    margin: 0;
    box-shadow: var(--ac-shadow-lg);
}

.ac-upload-progress-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--ac-blue-ink);
    margin-bottom: 8px;
}

.ac-upload-progress-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--ac-blue-100);
    overflow: hidden;
}

.ac-upload-progress-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: var(--ac-blue);
    transition: width 0.2s ease;
}

.ac-upload-progress.is-done .ac-upload-progress-bar span {
    background: var(--ac-green);
}

/* ---------- Field validation messages (browser + server) ---------- */
label.error,
.ac-field-error {
    display: block;
    margin: 6px 0 0 !important;
    padding: 0 !important;
    background: transparent !important;
    color: var(--ac-red) !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    position: static !important;
    text-align: left !important;
}

.form-control.error,
.form-select.error,
select.error + .ac-combo-input,
.ac-combo:has(select.error) .ac-combo-input {
    border-color: var(--ac-red) !important;
}

.ac-offscreen {
    position: fixed;
    top: -1000px;
    left: -1000px;
    opacity: 0;
}

/* Popup icon tones, details lists */
.ac-modal-icon.is-danger { background: var(--ac-red-50); color: var(--ac-red); }
.ac-modal-icon.is-warning { background: var(--ac-amber-50); color: var(--ac-amber); }
.ac-modal-icon.is-success { background: var(--ac-green-50); color: var(--ac-green); }

.ac-modal-sub {
    margin: 4px 0 0 !important;
    color: var(--ac-muted) !important;
    font-size: 13.5px !important;
    line-height: 1.5 !important;
}

.ac-details {
    margin: 0;
}

.ac-detail {
    display: grid;
    grid-template-columns: minmax(110px, 36%) minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--ac-border);
}

.ac-detail:last-child {
    border-bottom: 0;
}

.ac-detail dt {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--ac-muted);
}

.ac-detail dd {
    margin: 0;
    font-size: 14px;
    color: var(--ac-ink);
    min-width: 0;
    overflow-wrap: anywhere;
}

.ac-detail-img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--ac-border);
    background: var(--ac-surface-2);
}

.ac-break {
    overflow-wrap: anywhere;
}

.modal .ac-field-error[hidden] {
    display: none !important;
}

.ac-detail-stack {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
}

.ac-modal-avatar {
    flex: none;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid var(--ac-border);
    background: var(--ac-surface-2);
}

/* ==========================================================================
   v4 — create / edit / view pages: labels above fields, even spacing,
   sectioned cards, previews next to file inputs, sticky save bar.
   ========================================================================== */

/* Labels sit above the field (the old theme floated them on the border) */
.order-form-section label:not(.switch):not(.form-check-label):not(.upload-v4):not(.upload-img-v2):not(.error):not(.ac-check-row),
.add-suplier-modal-wrapper label:not(.switch):not(.form-check-label):not(.upload-v4):not(.error) {
    position: static !important;
    top: auto !important;
    left: auto !important;
    display: block;
    margin: 0 0 6px !important;
    padding: 0 !important;
    background: transparent !important;
    text-align: left !important;
    line-height: 1.35 !important;
    white-space: normal !important;
    z-index: auto !important;
}

.order-form-section .row {
    row-gap: 16px;
}

.order-form-section .row > [class*="col-"] {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.order-form-section .row > [class*="col-"] > .mt-1,
.order-form-section .row > [class*="col-"] > .mt-2 {
    margin-top: 0 !important;
}

/* Size hints that were written as a second label */
.order-form-section .row > [class*="col-"] > label + label.form-label,
.order-form-section .form-label.m-0 + .form-label.m-0 {
    margin-top: -2px !important;
    margin-bottom: 8px !important;
}

/* Section headings inside a form: a clear divider + title */
.order-form-section .row > h5,
.order-form-section .row > h4,
.order-form-section .row > h3,
.order-form-section > form > h5,
.order-form-section .add-suplier-modal-wrapper > .row > .col-12 > h5 {
    margin: 8px 0 0 !important;
    padding-top: 22px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* File input + preview thumbnail on one line */
.order-form-section .d-flex.align-items-center.gap-2:has(> input[type="file"]) {
    gap: 12px !important;
}

.order-form-section .table-img,
.order-form-section img.image-preview,
.order-form-section .row > [class*="col-"] > img.table-img {
    flex: none;
    width: 56px !important;
    height: 56px !important;
    object-fit: cover;
    border-radius: 12px !important;
    border: 1px solid var(--ac-border);
    background: var(--ac-surface-2);
    padding: 0 !important;
}

.order-form-section .row > [class*="col-"] > img.table-img,
.order-form-section .row > [class*="col-"] > div > img.table-img:only-child {
    margin-top: 10px;
    display: block;
}

/* Drag & drop upload boxes: one dashed box with the picked image centred */
.order-form-section .upload-img-v2 {
    height: auto !important;
    border: 0 !important;
    background: transparent !important;
}

.order-form-section .upload-img-v2 label.upload-v4,
.order-form-section .upload-v4 .drag-img,
.order-form-section .drag-img {
    position: relative !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    left: 0 !important;
    top: 0 !important;
    width: 100%;
    height: 132px !important;
    margin: 0 !important;
    padding: 10px !important;
    border: 1.5px dashed var(--ac-border-strong) !important;
    border-radius: 12px !important;
    background: var(--ac-surface-2) !important;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s, background 0.15s;
}

.order-form-section .upload-img-v2 label.upload-v4:hover,
.order-form-section .drag-img:hover {
    border-color: var(--ac-blue) !important;
    background: var(--ac-blue-50) !important;
}

.order-form-section .upload-v4 .img-wrp {
    height: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.order-form-section .upload-img-v2 label img,
.order-form-section .upload-v4 .img-wrp img {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 108px !important;
    min-width: 36px;
    min-height: 36px;
    border: 0 !important;
    border-radius: 8px !important;
    object-fit: contain;
}

.order-form-section .upload-v4 .img-wrp img[src$=".svg"] {
    width: auto !important;
    height: 64px !important;
}

/* Tag / repeater rows: input + delete button aligned */
.order-form-section .row > [class*="col-"] > .d-flex > .form-control + button,
.order-form-section .row > [class*="col-"] > .d-flex > .form-control + a {
    flex: none;
}

/* Save bar sticks to the bottom of the screen while the form scrolls */
.order-form-section .button-group,
.ac-sticky-save {
    position: sticky;
    bottom: 0;
    z-index: 20;
    box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.05);
}

.erp-table-section .card,
.erp-table-section .card-body,
.order-form-section,
.order-form-section form,
.add-suplier-modal-wrapper {
    overflow: visible !important;
}

/* Cards of the newer settings pages: same inner spacing everywhere */
.ac-card-head + .card-body,
.card > form > .card-body {
    padding: 20px 22px;
}

/* Validation messages sit under the field, never over it */
.order-form-section label.error,
.order-form-section .ac-field-error {
    position: static !important;
    left: auto !important;
    top: auto !important;
    background: transparent !important;
    margin-top: 6px !important;
}

/* Tablet (768–1023): keep two columns, tighter gutters */
@media (min-width: 768px) and (max-width: 1023.98px) {
    .order-form-section {
        padding: 18px 18px 0 !important;
    }

    .order-form-section .button-group {
        margin: 20px -18px 0 !important;
        padding: 12px 18px;
    }
}

/* Header: on tablets and phones the header search icon is enough; the
   "Go to…" palette stays on Ctrl+K and the sidebar search. */
@media (max-width: 991.98px) {
    .main-header-section .ac-jump-btn,
    .main-header-section .ac-kbd-hint {
        display: none !important;
    }
}

.ac-pointer { cursor: pointer; }
.ac-collapsed { display: none; }

.order-form-section .row > .button-group {
    flex: 0 0 auto;
    width: calc(100% + 44px);
}

@media (max-width: 767.98px) {
    .order-form-section .row > .button-group {
        width: calc(100% + 32px);
    }
}

/* Label-left / field-right rows (profile, older settings pages) */
.order-form-section .row > .col-lg-4 > label:only-child {
    margin: 10px 0 0 !important;
}

@media (max-width: 991.98px) {
    .order-form-section .row > .col-lg-4 > label:only-child {
        margin: 0 0 -10px !important;
    }
}

/* ==========================================================================
   Responsive: tables scroll inside their card; cells never break words
   letter by letter. Long values (URLs, keys) are capped and ellipsised.
   ========================================================================== */
.table td,
.table th,
.ac-table td,
.ac-table th {
    word-break: normal !important;
    overflow-wrap: normal !important;
}

.table td .ac-mono,
.table td code {
    white-space: nowrap;
}

.responsive-table,
.table-responsive,
.ac-table-wrap,
.ac-hscroll {
    position: relative; /* keeps visually-hidden labels inside the scroll box */
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 991.98px) {
    .table td,
    .ac-table td {
        max-width: 280px;
    }
}

/* Phones: keep wide data tables at a usable width and let them scroll sideways
   inside their card, instead of crushing every column to a single character. */
@media (max-width: 767.98px) {
    .ac-table-wrap > .ac-table,
    .responsive-table > .ac-table,
    .responsive-table > .table {
        min-width: 720px;
    }
}

/* Rows with wide gutters (g-4/g-5) directly in the page container must
   not poke out of narrow screens */
@media (max-width: 767.98px) {
    .container-fluid > .row.g-4,
    .container-fluid > .row.g-5 {
        --bs-gutter-x: 1rem;
    }
}

/* Safety net: decorative overhangs (shadows, pseudo-elements) never
   cause a sideways page scroll; real content scrolls inside its card. */
.min-100-vh {
    overflow-x: clip;
}

/* Role permission grid: checkbox + label side by side, wrap on small screens */
.custom-control.custom-checkbox {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    margin-right: 18px !important;
    padding: 0 !important;
    min-height: 0;
}

.custom-control.custom-checkbox .custom-control-input {
    position: static !important;
    opacity: 1 !important;
    width: 16px;
    height: 16px;
    margin: 0;
    flex: none;
    accent-color: var(--ac-blue);
}

.custom-control.custom-checkbox .custom-control-label {
    position: static !important;
    margin: 0 !important;
    font-weight: 500 !important;
    white-space: nowrap;
}

.custom-control.custom-checkbox .custom-control-label::before,
.custom-control.custom-checkbox .custom-control-label::after {
    display: none !important;
}

td > .d-flex:has(> .custom-checkbox) {
    flex-wrap: wrap;
    row-gap: 8px;
}

/* ==========================================================================
   feat/admin-ui — one list toolbar, one table footer, page padding,
   clean sidebar submenus.
   ========================================================================== */

/* ---------- Page content: 25px on all four sides, every page ---------- */
:root {
    --ac-page-pad: 25px;
}

.section-container > .min-100-vh {
    padding: var(--ac-page-pad) !important;
}

.section-container > .min-100-vh > .container-fluid,
.section-container > .min-100-vh > section > .container-fluid,
.section-container > .min-100-vh > div > .container-fluid,
.section-container > .min-100-vh > div > div > .container-fluid {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.section-container > .min-100-vh > .erp-table-section,
.section-container > .min-100-vh > .erp-state-overview-section,
.section-container > .min-100-vh > .order-form-section,
.section-container > .min-100-vh > section,
.section-container > .min-100-vh > div {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.section-container > .min-100-vh > .erp-table-section,
.section-container > .min-100-vh > .erp-state-overview-section {
    padding-bottom: 0 !important;
    min-height: 0;
}

/* Wrappers directly in the content area add no extra inset (e.g. .m-3) */
.section-container > .min-100-vh > :not(.row) {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.section-container > .min-100-vh > :first-child:not(.row),
.section-container > .min-100-vh > :first-child > :first-child:not(.row),
.section-container > .min-100-vh > .container-fluid > :first-child:not(.row) {
    margin-top: 0 !important;
}

/* The last card of a page ends 25px above the footer, never more */
.section-container > .min-100-vh > :last-child,
.section-container > .min-100-vh > * > .container-fluid > :last-child,
.section-container > .min-100-vh > .container-fluid > :last-child {
    margin-bottom: 0 !important;
}

@media (max-width: 767.98px) {
    .section-container > .min-100-vh {
        padding: var(--ac-page-pad) !important;
    }
}

/* ---------- The list / report toolbar (x-admin.toolbar) ----------
   [Show N] [period][from – to] [search] [filters…] [Filter][Reset] …… [CSV][PDF] */
.ac-filter-bar.ac-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px 16px;
    container: ac-toolbar / inline-size;
}

.ac-toolbar > .ac-tb-main {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.ac-toolbar .ac-tb-main > div {
    flex: 0 1 170px;
    min-width: 0;
}

.ac-toolbar .ac-tb-main > .ac-tb-perpage {
    flex: 0 0 112px;
    order: -3;
}

.ac-toolbar .ac-tb-main > .ac-tb-period {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    order: -2;
}

.ac-tb-period > .form-select {
    flex: 0 0 148px;
    width: 148px;
}

.ac-tb-period > .ac-tb-dates {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 1 auto;
    min-width: 0;
}

.ac-tb-dates .form-control {
    width: 150px;
    min-width: 0;
    flex: 0 1 150px;
}

.ac-toolbar .ac-tb-main > .ac-tb-search {
    position: relative;
    flex: 1 1 200px;
    max-width: 340px;
    order: -1;
}

.ac-toolbar .ac-tb-main > .ac-tb-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    order: 50;
}

.ac-toolbar > .ac-tb-export {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.ac-toolbar .theme-btn {
    height: 40px;
    min-height: 40px;
    padding: 0 14px !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.ac-tb-export-btn i.fa-file-excel { color: #15803d; }
.ac-tb-export-btn i.fa-file-pdf { color: #dc2626; }

.ac-tb-export-btn.is-busy {
    opacity: 0.6;
    pointer-events: none;
}

/* One muted line under a toolbar (e.g. the date range a report covers) */
.ac-tb-note {
    margin: 0;
    padding: 8px 22px;
    font-size: 13px;
    color: var(--ac-muted);
    border-top: 1px solid var(--ac-border);
    background: var(--ac-surface-2);
}

/* Old in-page "rows per page" / date controls that still sit in a toolbar */
.ac-toolbar .ac-filter-perpage:not(.ac-tb-perpage) {
    order: -3;
}

/* A narrow toolbar (small card, tablet): CSV / PDF move under the filters */
@container ac-toolbar (max-width: 900px) {
    .ac-toolbar > .ac-tb-main {
        flex: 1 1 100%;
    }
}

@supports not (container-type: inline-size) {
    @media (max-width: 1199.98px) {
        .ac-toolbar > .ac-tb-main {
            flex: 1 1 100%;
        }
    }
}

/* A period preset already says which dates it covers, so the from / to
   inputs only show for "Custom range" (hidden inputs are still submitted). */
.ac-toolbar:not(.is-custom-range) .ac-tb-dates {
    display: none !important;
}

/* Desktop (≥1280px): the whole toolbar stays on ONE line — Show N, period,
   dates, search, filters, Filter / Reset, CSV / PDF. Controls shrink to a
   readable minimum, Reset / CSV / PDF show only their icon (title + text for
   screen readers) below 1600px, and a toolbar with very many filters scrolls
   sideways instead of wrapping. Tablet / phone keep the wrapping layout. */
@media (min-width: 1280px) {
    .ac-filter-bar.ac-toolbar {
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
    }

    .ac-filter-bar.ac-toolbar > .ac-tb-main {
        flex: 1 1 0;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        /* overflow-x:auto makes overflow-y compute to auto too, so a sub-pixel
           height overflow shows a stray vertical scrollbar beside Filter. Pin
           it hidden — only the sideways scroll (for many filters) stays. */
        overflow-y: hidden;
        scrollbar-width: thin;
        padding-block: 2px;
    }

    .ac-toolbar .ac-tb-main > div {
        flex: 1 1 120px;
        min-width: 108px;
        max-width: 220px;
    }

    .ac-toolbar .ac-tb-main > .ac-tb-perpage {
        flex: 0 0 112px;
        min-width: 112px;
    }

    .ac-toolbar .ac-tb-main > .ac-tb-period {
        flex: 0 0 auto;
        min-width: max-content;
        gap: 4px;
    }

    .ac-tb-period > .form-select {
        flex: 0 0 148px;
        width: 148px;
    }

    .ac-tb-period > .ac-tb-dates {
        flex: 0 0 auto;
        gap: 4px;
    }

    .ac-tb-dates .form-control {
        flex: 0 0 128px;
        width: 128px;
        padding-left: 10px;
        padding-right: 6px;
    }

    .ac-toolbar .ac-tb-main > .ac-tb-search {
        flex: 2 1 160px;
        min-width: 130px;
        max-width: 320px;
    }

    .ac-toolbar .ac-tb-main > .ac-tb-actions {
        flex: 0 0 auto;
        min-width: 0;
        gap: 6px;
    }

    .ac-toolbar > .ac-tb-export {
        flex: 0 0 auto;
        gap: 6px;
    }

    .ac-toolbar .ac-tb-main .form-select,
    .ac-toolbar .ac-tb-main .form-control,
    .ac-toolbar .ac-tb-main .select2-container {
        min-width: 0;
        max-width: 100%;
    }

    .ac-toolbar .ac-tb-perpage .form-select,
    .ac-toolbar .ac-tb-main > .ac-filter-field .form-select {
        width: 100%;
    }
}

/* 1280–1439px (sidebar open): tighter controls so busy toolbars still fit */
@media (min-width: 1280px) and (max-width: 1439.98px) {
    .ac-filter-bar.ac-toolbar,
    .ac-filter-bar.ac-toolbar > .ac-tb-main {
        gap: 6px;
    }

    .ac-toolbar .ac-tb-main > div {
        min-width: 92px;
    }

    .ac-toolbar .ac-tb-main > .ac-tb-perpage {
        flex-basis: 100px;
        min-width: 100px;
    }

    .ac-tb-period > .form-select {
        flex-basis: 128px;
        width: 128px;
    }

    .ac-toolbar .ac-tb-main > .ac-tb-search {
        min-width: 92px;
    }

    .ac-toolbar .ac-tb-main .form-select {
        padding-left: 10px;
        padding-right: 26px;
        background-position: right 8px center;
    }

    .ac-toolbar .ac-tb-actions .theme-btn {
        padding: 0 12px !important;
    }
}

@media (min-width: 1280px) and (max-width: 1599.98px) {
    .ac-toolbar .ac-tb-reset,
    .ac-toolbar .ac-tb-export-btn {
        width: 40px;
        padding: 0 !important;
        justify-content: center;
    }

    .ac-toolbar .ac-tb-btn-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

@media (max-width: 767.98px) {
    .ac-toolbar .ac-tb-main > .ac-tb-perpage {
        flex: 0 0 104px;
    }

    /* Phone: [Show N][period] on one line, the two dates full width below */
    .ac-toolbar .ac-tb-main > .ac-tb-period:not(.ac-filter-field) {
        display: contents;
    }

    .ac-toolbar .ac-tb-main > .ac-tb-period > .form-select {
        order: -2;
        flex: 1 1 calc(100% - 114px);
        width: auto;
        min-width: 0;
    }

    .ac-toolbar .ac-tb-main > .ac-tb-period > .ac-tb-dates {
        order: -2;
        flex: 1 1 100%;
        min-width: 0;
    }

    .ac-toolbar .ac-tb-main > .ac-filter-field.ac-tb-period {
        flex: 1 1 calc(100% - 114px);
    }

    .ac-tb-dates .form-control {
        width: auto;
        flex: 1 1 0;
        min-width: 0;
    }

    .ac-toolbar .ac-tb-main > .ac-tb-search {
        flex: 1 1 100%;
        max-width: none;
    }

    .ac-toolbar .ac-tb-main > div:not(.ac-tb-perpage):not(.ac-tb-period):not(.ac-tb-search):not(.ac-tb-actions) {
        flex: 1 1 calc(50% - 5px);
    }

    .ac-toolbar > .ac-tb-export,
    .ac-toolbar .ac-tb-main > .ac-tb-actions {
        flex: 1 1 100%;
    }

    .ac-toolbar > .ac-tb-export .theme-btn,
    .ac-toolbar .ac-tb-actions .theme-btn {
        flex: 1 1 0;
        justify-content: center;
    }
}

/* Simple lists (client period mode): the from / to dates are shown only
   for "Custom…", so on laptop / desktop the whole toolbar fits one line:
   [Show N][period][search][filters…][Filter][Reset] …… [CSV][PDF].
   Filters shrink before anything wraps; only tablet / phone wrap. */
.ac-toolbar[data-ac-period-mode="client"] .ac-tb-period:not(.is-custom) > .ac-tb-dates {
    display: none;
}

@container ac-toolbar (min-width: 900px) {
    .ac-toolbar[data-ac-period-mode="client"] > .ac-tb-main:not(:has(.ac-tb-period.is-custom)) {
        flex-wrap: nowrap;
    }

    .ac-toolbar[data-ac-period-mode="client"] .ac-tb-main > .ac-tb-perpage {
        flex: 0 0 112px;
    }

    .ac-toolbar[data-ac-period-mode="client"] .ac-tb-main > .ac-tb-period:not(.is-custom) {
        flex: 0 1 140px;
        min-width: 112px;
    }

    .ac-toolbar[data-ac-period-mode="client"] .ac-tb-period > .form-select {
        flex: 0 1 140px;
        width: 140px;
        min-width: 112px;
    }

    .ac-toolbar[data-ac-period-mode="client"] .ac-tb-main > .ac-tb-search {
        flex: 1 1 180px;
        min-width: 120px;
    }

    .ac-toolbar[data-ac-period-mode="client"] .ac-tb-main > div:not(.ac-tb-perpage):not(.ac-tb-period):not(.ac-tb-search):not(.ac-tb-actions) {
        flex: 0 1 160px;
        min-width: 96px;
    }

    .ac-toolbar[data-ac-period-mode="client"] .ac-tb-main .form-select {
        text-overflow: ellipsis;
    }
}

/* Laptop widths: CSV / PDF as icon buttons (the title explains them) */
@container ac-toolbar (min-width: 900px) and (max-width: 1199.98px) {
    .ac-toolbar[data-ac-period-mode="client"] .ac-tb-export-btn {
        width: 40px;
        padding: 0 !important;
        justify-content: center;
        gap: 0;
    }

    .ac-toolbar[data-ac-period-mode="client"] .ac-tb-export-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

/* ---------- Table footer: totals line, then the pager at the left ---------- */
.ac-table-footer {
    display: block;
}

.ac-table-footer > .ac-totals {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
}

.ac-pager {
    justify-content: flex-start !important;
    flex-wrap: wrap;
    padding: 14px 22px !important;
    gap: 6px;
}

.ac-pager-arrow i {
    font-size: 12px;
}

.ac-pager-gap {
    min-width: 24px;
    text-align: center;
    color: var(--ac-faint);
    font-weight: 600;
    user-select: none;
}

@media (max-width: 767.98px) {
    .ac-pager {
        padding: 12px 16px !important;
    }

    .ac-pager-btn {
        min-width: 34px;
        height: 34px;
    }
}

/* ---------- Sidebar submenus: no box, a thin guide line with dots ---------- */
.side-bar-manu li .dropdown-menu,
.side-bar .side-bar-manu li > ul.dropdown-menu {
    position: relative !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    margin: 2px 0 6px 21px !important;
    padding: 2px 0 2px 0 !important;
}

.side-bar-manu li .dropdown-menu::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 1px;
    background: rgba(255, 255, 255, 0.10);
}

.side-bar-manu li .dropdown-menu li {
    margin: 1px 0 !important;
    position: relative;
}

.side-bar-manu li .dropdown-menu li::before {
    display: none !important;
}

.side-bar-manu li .dropdown-menu li a {
    position: relative;
    display: block;
    margin-left: 0;
    padding: 7px 10px 7px 22px !important;
    border-radius: 8px !important;
    font-size: 13.5px !important;
    color: #9aa4c3 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.side-bar-manu li .dropdown-menu li a::before {
    content: "";
    position: absolute;
    left: -2.5px;
    top: 50%;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-radius: 50%;
    background: #3a4466;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.side-bar-manu li .dropdown-menu li a:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

.side-bar-manu li .dropdown-menu li a:hover::before {
    background: #8b95b3;
}

.side-bar .side-bar-manu .dropdown .dropdown-menu li a.active {
    color: #fff !important;
    font-weight: 600;
    background: rgba(2, 135, 255, 0.16) !important;
}

.side-bar .side-bar-manu .dropdown .dropdown-menu li a.active::before {
    background: var(--ac-brand);
    box-shadow: 0 0 0 3px rgba(2, 135, 255, 0.22);
}

/* ---------- Print / PDF export page (admin/exports/print) ---------- */
.ac-print-body {
    background: #fff;
    color: #0f172a;
    font-family: var(--ac-font, "Inter", system-ui, sans-serif);
    font-size: 12px;
    margin: 0;
}

.ac-print {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.ac-print-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 16px;
}

.ac-print-bar p {
    margin: 0 auto 0 0;
    color: #64748b;
}

.ac-print-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.ac-print-company {
    font-size: 18px;
    font-weight: 800;
    margin: 0;
}

.ac-print-company-meta,
.ac-print-meta {
    margin: 2px 0 0;
    color: #475569;
}

.ac-print-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    text-align: right;
}

.ac-print-meta {
    text-align: right;
}

.ac-print-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 0 0 12px;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #334155;
}

.ac-print-filters strong {
    color: #0f172a;
}

.ac-print-section {
    font-size: 13px;
    font-weight: 700;
    margin: 16px 0 6px;
}

.ac-print-table {
    width: 100%;
    border-collapse: collapse;
}

.ac-print-table th,
.ac-print-table td {
    border: 1px solid #e2e8f0;
    padding: 5px 7px;
    text-align: left;
    vertical-align: top;
}

.ac-print-table th {
    background: #f1f5f9;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ac-print-table .is-nowrap {
    white-space: nowrap;
}

.ac-print-table .is-num {
    text-align: right;
    white-space: nowrap;
}

.ac-print-table tbody tr:nth-child(even) td {
    background: #fafbfc;
}

.ac-print-table tfoot td,
.ac-print-table tr.is-total td {
    font-weight: 700;
    background: #f1f5f9;
}

.ac-print-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 12px 0 0;
    padding: 8px 10px;
    border-top: 2px solid #0f172a;
    font-size: 12px;
}

.ac-print-note {
    margin: 10px 0 0;
    padding: 8px 10px;
    border: 1px solid #fcd34d;
    background: #fffbeb;
    color: #92400e;
    border-radius: 6px;
}

.ac-print-foot {
    margin-top: 16px;
    color: #94a3b8;
    font-size: 11px;
}

@media print {
    .ac-print-bar {
        display: none !important;
    }

    .ac-print {
        max-width: none;
        padding: 0;
    }

    .ac-print-table thead {
        display: table-header-group;
    }

    .ac-print-table tr {
        page-break-inside: avoid;
    }

    @page {
        margin: 12mm;
    }
}

/* Demo data page (System → Demo data) */
.ac-demo-facts li {
    list-style: disc;
}

.ac-demo-facts {
    margin: 0 0 16px;
    padding-left: 18px;
    list-style: disc;
    color: var(--ac-text);
    line-height: 1.7;
}

/* "Demo" badge on customer demo records (lists, detail pages) */
.ac-badge-demo {
    height: 20px;
    padding: 0 8px;
    margin-left: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
    background: #fff4d6;
    color: #8a5300;
    border: 1px dashed #e0a100;
}

.ac-demo-customers {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr);
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .ac-demo-customers {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    }
}

.ac-demo-or {
    margin: 4px 0 0;
    color: var(--ac-muted, #5b6478);
    font-size: 13px;
}

/* Maintenance links on System Settings */
.ac-maint-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---------- Footer always at the bottom of the screen, compact ---------- */
.section-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.section-container > .min-100-vh {
    flex: 1 0 auto;
}
.ac-footer {
    flex-shrink: 0;
    margin-top: 0;
    min-height: 0;
    padding: 10px var(--ac-page-pad, 25px) !important;
    font-size: 13px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}
.ac-footer p {
    line-height: 1.5;
}

/* ==========================================================================
   feat/admin-ui-2 — brand #0287FF everywhere, clear hover / selected states
   ========================================================================== */

/* ---------- Bootstrap & native controls follow the brand ---------- */
:root {
    --bs-primary: var(--ac-blue);
    --bs-primary-rgb: var(--ac-brand-rgb);
    --bs-link-color: var(--ac-blue-text);
    --bs-link-hover-color: var(--ac-blue-700);
    accent-color: var(--ac-brand);
}

.form-check-input:checked {
    background-color: var(--ac-brand) !important;
    border-color: var(--ac-brand) !important;
}

.form-check-input:focus,
.form-select:focus,
.btn:focus-visible {
    border-color: var(--ac-brand);
    box-shadow: 0 0 0 4px rgba(var(--ac-brand-rgb), 0.18) !important;
}

.form-control:focus,
.form-select:focus,
.ac-combo.is-open .ac-combo-input,
.ac-gsearch-input:focus {
    border-color: var(--ac-brand) !important;
    box-shadow: 0 0 0 4px rgba(var(--ac-brand-rgb), 0.16) !important;
}

.text-primary {
    color: var(--ac-blue-text) !important;
}

.bg-primary,
.badge.bg-primary,
.progress-bar {
    background-color: var(--ac-blue) !important;
}

.border-primary {
    border-color: var(--ac-brand) !important;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link,
.list-group-item.active,
.dropdown-item.active,
.dropdown-item:active,
.page-item.active .page-link {
    background-color: var(--ac-blue) !important;
    border-color: var(--ac-blue) !important;
    color: #fff !important;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    color: var(--ac-blue-text) !important;
    border-bottom-color: var(--ac-brand) !important;
}

.nav-tabs .nav-link:hover:not(.active),
.nav-pills .nav-link:hover:not(.active) {
    background: var(--ac-blue-100);
    color: var(--ac-blue-600) !important;
}

.form-range::-webkit-slider-thumb { background: var(--ac-brand); }
.form-range::-moz-range-thumb { background: var(--ac-brand); }

/* ---------- Primary buttons: AA-safe fill, darker on hover / press ---------- */
.theme-btn:active:not(.border-btn):not(:disabled),
.btn-primary:active,
.submit-btn:active {
    background: var(--ac-blue-700) !important;
    border-color: var(--ac-blue-700) !important;
}

.btn-outline-primary {
    color: var(--ac-blue-text) !important;
    border-color: var(--ac-brand) !important;
    background: var(--ac-surface) !important;
}

.theme-btn:disabled,
.theme-btn.disabled,
.submit-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none !important;
}

/* ---------- Outline / secondary buttons: a clear brand tint on hover ---------- */
body .theme-btn.border-btn:hover,
body .theme-btn.border-btn:focus-visible,
body .reset-btn:hover,
body .btn-light:hover,
body .btn-outline-secondary:hover,
body .btn-outline-primary:hover,
body .order-form-section .button-group a.theme-btn:not(.border-btn):hover,
body .order-form-section .button-group button[type="reset"]:hover,
body .ac-copy-btn:hover,
body .acm-btn-line:hover,
body .table-action > button:hover,
body .ac-gsearch-toggle:hover,
body .main-header-section .sidebar-opner:hover {
    background: var(--ac-blue-100) !important;
    border-color: var(--ac-blue-300) !important;
    color: var(--ac-blue-600) !important;
}

body .theme-btn.border-btn:active,
body .reset-btn:active,
body .btn-light:active,
body .btn-outline-secondary:active,
body .btn-outline-primary:active,
body .acm-btn-line:active,
body .theme-btn.border-btn.active,
body .theme-btn.border-btn[aria-pressed="true"],
body .theme-btn.border-btn[aria-expanded="true"] {
    background: var(--ac-blue-200) !important;
    border-color: var(--ac-brand) !important;
    color: var(--ac-blue-700) !important;
}

/* ---------- Segmented switches (USD / BDT, Unpaid / Paid / Partial …) ---------- */
body .srv-segment-item span {
    transition: background 0.15s, color 0.15s;
}

body .srv-segment-item:hover input:not(:checked) + span {
    background: var(--ac-blue-100);
    color: var(--ac-blue-600);
}

body .srv-segment-item input:checked + span {
    background: var(--ac-blue);
    color: #fff;
}

body .srv-segment-item:hover input:checked + span {
    background: var(--ac-blue-600);
}

body .srv-segment-item input:focus-visible + span {
    box-shadow: inset 0 0 0 2px var(--ac-brand), inset 0 0 0 4px #fff;
}

body .srv-view-toggle a:hover:not(.is-active),
body .rep-toggle-btn:hover:not(.is-active) {
    background: var(--ac-blue-100);
    color: var(--ac-blue-600) !important;
}

body .srv-view-toggle a.is-active:hover {
    background: var(--ac-blue-600);
    color: #fff;
}

body .rep-toggle-btn.is-active {
    background: var(--ac-blue);
    color: #fff !important;
}

/* Pill tabs / chips: tint on hover, solid brand when selected */
body .hrm-tab:hover:not(.is-active),
body .rep-tab:hover:not(.is-active),
body .mp-tab:hover:not(.is-active),
body .ac-chat-tab:hover:not(.is-active),
body .srv-chip:hover:not(.is-active),
body .acc-subtab:hover:not(.is-active) {
    background: var(--ac-blue-100);
    border-color: var(--ac-blue-300);
    color: var(--ac-blue-600) !important;
}

body .hrm-tab.is-active:hover,
body .rep-tab.is-active:hover,
body .mp-tab.is-active:hover,
body .ac-chat-tab.is-active:hover,
body .srv-chip.is-active:hover {
    background: var(--ac-blue-600);
    border-color: var(--ac-blue-600);
}

body .acc-subtab.is-active {
    background: var(--ac-blue);
    border-color: var(--ac-blue);
    color: #fff !important;
}

/* Underline / list tabs: tint on hover, deeper tint + brand marker when selected */
body .ac-hub-tab:hover:not(.is-active),
body .ac-editor-tab:hover:not(.is-active):not([aria-selected="true"]),
body .acc-nav-link:hover:not(.is-active),
body .acc-panel-tab:hover:not(.is-active) {
    background: var(--ac-blue-50);
    color: var(--ac-blue-600) !important;
}

body .ac-editor-tab.is-active,
body .ac-editor-tab[aria-selected="true"],
body .acc-nav-link.is-active {
    background: var(--ac-blue-100);
    color: var(--ac-blue-600) !important;
    font-weight: 600;
}

body .ac-hub-tab.is-active,
body .acc-panel-tab.is-active {
    border-bottom-color: var(--ac-brand);
    color: var(--ac-blue-text) !important;
}

/* Dropdown menu rows */
body .dropdown-menu li a:hover,
body .dropdown-item:hover,
body .dropdown-item:focus {
    background: var(--ac-blue-50) !important;
    color: var(--ac-blue-600) !important;
}

body .table-action .dropdown-menu li a.confirm-action:hover,
body .table-action .dropdown-menu li a.delete-confirm:hover {
    background: var(--ac-red-50) !important;
    color: var(--ac-red) !important;
}

/* Pager */
a.ac-pager-btn:hover {
    background: var(--ac-blue-100);
    border-color: var(--ac-blue-300);
    color: var(--ac-blue-600) !important;
}

/* Searchable dropdown rows */
.ac-combo-option:hover:not(.is-active) {
    background: var(--ac-surface-2);
}

.ac-combo-option.is-active {
    background: var(--ac-blue-100);
    color: var(--ac-blue-600);
}

/* Sidebar active item */
.side-bar-manu li.active > a,
.side-bar-manu > ul > li.active > a {
    box-shadow: 0 6px 16px rgba(var(--ac-brand-rgb), 0.32);
}

.side-bar .side-bar-manu .dropdown .dropdown-menu li a.active::before {
    background: var(--ac-brand);
    box-shadow: 0 0 0 3px rgba(var(--ac-brand-rgb), 0.28);
}

.side-bar .side-bar-manu .dropdown .dropdown-menu li a.active {
    background: rgba(var(--ac-brand-rgb), 0.18) !important;
}

/* Checkbox rows used on forms */
.srv-check:hover {
    color: var(--ac-blue-600);
}

/* ---------- Totals line: sticks to the bottom of the screen while the table
   scrolls past, so the totals are always visible; it settles back under the
   table at the end. The footer wrapper is "display: contents" so the totals'
   sticky range is the whole card, not just the footer strip. ---------- */
.ac-table-footer {
    display: contents !important;
}

.ac-table-footer > .ac-totals {
    position: sticky;
    bottom: 0;
    z-index: 6;
    background: var(--ac-surface-2);
    border-top: 1px solid var(--ac-border) !important;
    transition: box-shadow 0.15s ease;
}

.ac-table-footer > .ac-totals.is-stuck {
    background: var(--ac-surface);
    border-top-color: var(--ac-border-strong) !important;
    box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.08);
}

.ac-table-footer > .ac-totals:last-child {
    border-radius: 0 0 var(--ac-radius) var(--ac-radius);
}

.ac-table-footer > .ac-totals.is-stuck:last-child {
    border-radius: 0;
}

/* ---------- Searchable dropdown lists float above popups and tables ---------- */
.ac-combo-list.is-floating {
    position: fixed;
    right: auto;
    z-index: 1086; /* above Bootstrap modals (1055) and their backdrop */
    overscroll-behavior: contain;
}

.ac-combo-list.is-floating.is-up {
    box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.14), var(--ac-shadow-lg);
}

/* the eye button on password fields */
.ac-secret.has-toggle > input[type="password"],
.ac-secret.has-toggle > input[type="text"] {
    padding-right: 46px !important;
}

.ac-secret-toggle {
    cursor: pointer;
}

.ac-secret > input + .ac-secret-toggle {
    top: 50%;
    transform: translateY(-50%);
}

.ac-secret-toggle:focus-visible {
    outline: 2px solid var(--ac-brand);
    outline-offset: 0;
}

/* A card that holds a totals line clips instead of "overflow: hidden":
   hidden would make the card a scroll box and the totals could not stick
   to the screen bottom. */
.card:has(.ac-table-footer > .ac-totals),
[class*="-card"]:has(.ac-table-footer > .ac-totals),
section:has(> .ac-table-footer > .ac-totals) {
    overflow: clip !important;
}

/* Page wrappers add no space under the last card (it ends 25px above the footer) */
.section-container > .min-100-vh > :is(div, section):not(.card):not(.full-page-card):not([class*="-card"]) {
    padding-bottom: 0 !important;
}

/* Legacy page sections reserved a screen of height */
.section-container > .min-100-vh .erp-table-section,
.section-container > .min-100-vh .order-form-section {
    min-height: 0 !important;
}

/* The last box(es) of the page carry no bottom margin (marked by admin-ux.js),
   so the space above the footer is exactly the 25px page padding. */
.section-container > .min-100-vh .ac-tail {
    margin-bottom: 0 !important;
}

/* Short list / report pages (admin-ux.js adds the classes): the last card
   grows to 25px above the footer; its totals line + pager sit at its bottom. */
.section-container > .min-100-vh.ac-fill-root {
    display: flex;
    flex-direction: column;
}

.section-container > .min-100-vh.ac-fill-root .ac-fill {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.section-container > .min-100-vh.ac-fill-root .ac-fill-card > .card-body {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.ac-fill-card .ac-table-footer > .ac-totals {
    margin-top: auto;
}

/* select2 lists (attached to <body>) open above popups too */
.select2-container--open .select2-dropdown {
    z-index: 1086;
}

/* ==========================================================================
   Gallery of images + videos (admin/partials/media-gallery · admin-media-gallery.js)
   Services → Gallery, Products → Media & gallery → Videos
   ========================================================================== */
.ac-mg { display: grid; gap: 12px; min-width: 0; }
.ac-mg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ac-mg-actions .theme-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 14px; font-size: 13px; }
.ac-mg-count { margin-inline-start: auto; color: var(--ac-muted); font-size: 12.5px; }
.ac-mg-link { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--ac-blue-200); border-radius: var(--ac-radius-sm); background: var(--ac-blue-50); }
.ac-mg-link .form-label { margin: 0; }
.ac-mg-link-row { display: flex; gap: 8px; min-width: 0; }
.ac-mg-link-row .form-control { flex: 1 1 auto; min-width: 0; }
.ac-mg-link-row .theme-btn { flex: 0 0 auto; min-height: 38px; padding: 6px 14px; font-size: 13px; }
.ac-mg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.ac-mg-list:empty { display: none; }
.ac-mg-empty { margin: 0; padding: 18px; border: 1.5px dashed var(--ac-border-strong); border-radius: var(--ac-radius-sm); background: var(--ac-surface-2); color: var(--ac-muted); text-align: center; }
.ac-mg-item { position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--ac-border); border-radius: var(--ac-radius-sm); background: var(--ac-surface); cursor: grab; }
.ac-mg-item:focus-visible { outline: 3px solid var(--ac-brand); outline-offset: 2px; }
.ac-mg-item.is-dragging { opacity: 0.4; }
.ac-mg-item.is-failed { border-color: var(--ac-red); }
.ac-mg-thumb { position: relative; aspect-ratio: 16 / 10; background: var(--ac-navy); }
.ac-mg-thumb img, .ac-mg-thumb video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ac-mg-item:not(.is-video) .ac-mg-thumb { background: var(--ac-surface-2); }
.ac-mg-ph { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: rgba(255, 255, 255, 0.7); font-size: 28px; }
.ac-mg-play { position: absolute; inset: 50% auto auto 50%; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; background: rgba(2, 135, 255, 0.92); color: #fff; font-size: 14px; pointer-events: none; }
.ac-mg-pos, .ac-mg-badge { position: absolute; top: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; line-height: 22px; }
.ac-mg-pos { inset-inline-start: 6px; min-width: 22px; text-align: center; background: rgba(15, 23, 42, 0.72); color: #fff; }
.ac-mg-badge { inset-inline-end: 6px; max-width: calc(100% - 44px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: rgba(255, 255, 255, 0.94); color: var(--ac-ink); }
.ac-mg-badge.is-video { background: var(--ac-blue); color: #fff; }
.ac-mg-meta { display: grid; gap: 4px; padding: 8px 10px 0; min-width: 0; font-size: 12.5px; }
.ac-mg-meta:empty { display: none; }
.ac-mg-cap { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ac-ink); font-weight: 600; }
.ac-mg-status { color: var(--ac-muted); }
.ac-mg-item.is-failed .ac-mg-status { color: var(--ac-red); }
.ac-mg-progress { width: 100%; height: 6px; border: 0; border-radius: 999px; overflow: hidden; appearance: none; background: var(--ac-blue-100); }
.ac-mg-progress::-webkit-progress-bar { background: var(--ac-blue-100); }
.ac-mg-progress::-webkit-progress-value { background: var(--ac-brand); }
.ac-mg-progress::-moz-progress-bar { background: var(--ac-brand); }
.ac-mg-tools { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding: 8px 10px 10px; }
.ac-mg-tools button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--ac-border); border-radius: 8px; background: var(--ac-surface); color: var(--ac-text); font-size: 12.5px; }
.ac-mg-tools button:hover, .ac-mg-tools button:focus-visible { border-color: var(--ac-brand); color: var(--ac-blue-text); }
.ac-mg-tools button.is-danger { margin-inline-start: auto; }
.ac-mg-tools button.is-danger:hover, .ac-mg-tools button.is-danger:focus-visible { border-color: var(--ac-red); background: var(--ac-red); color: #fff; }
@media (max-width: 575.98px) {
    .ac-mg-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .ac-mg-actions .theme-btn { flex: 1 1 auto; justify-content: center; }
    .ac-mg-count { flex-basis: 100%; margin: 0; }
    .ac-mg-link-row { flex-wrap: wrap; }
    .ac-mg-link-row .form-control { flex-basis: 100%; }
    .ac-mg-tools button { width: 30px; height: 30px; }
}

/* ==========================================================================
   Unified underline tabs — every section sub-nav (Customers, Accounts,
   Affiliates, HRM …) uses one baseline-with-underline style, not pills.
   (lic-nav is styled in admin-licence.css; these override the pill bases.)
   ========================================================================== */
.acc-nav,
.af-nav,
.hrm-tabs {
    border-bottom: 1px solid var(--ac-border, #e5e8f0);
    gap: 2px;
}
.acc-nav-link,
.af-nav-link,
.hrm-tab {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    border-bottom: 2px solid transparent !important;
    margin-bottom: -1px;
    padding: 10px 16px !important;
    color: var(--ac-muted, #64748b) !important;
}
.acc-nav-link i,
.af-nav-link i,
.hrm-tab i {
    color: inherit;
}
body .acc-nav-link:hover:not(.is-active),
.af-nav-link:hover:not(.is-active),
body .hrm-tab:hover:not(.is-active) {
    background: transparent !important;
    color: var(--ac-blue, #0287ff) !important;
    border-bottom-color: #cfe3fb !important;
}
body .acc-nav-link.is-active,
.af-nav-link.is-active,
body .hrm-tab.is-active {
    background: transparent !important;
    color: var(--ac-blue, #0287ff) !important;
    border-bottom-color: var(--ac-blue, #0287ff) !important;
    font-weight: 700;
}
