/* Shared Scalymise interface. Module CSS loads first; public/print invoices never load this file. */

:root {

    --sidebar-expanded-width: 240px;

    --sidebar-collapsed-width: 72px;

    --sidebar-width: var(--sidebar-expanded-width);

    --ui-gap: 14px;

    --ui-radius: 10px;

    --ui-control-radius: 7px;

    --ui-control-height: 40px;

    --ui-ease: cubic-bezier(.2, .7, .3, 1);

    --theme-bg: #f4f6fa;

    --theme-surface: #ffffff;

    --theme-surface-soft: #f8f9fc;

    --theme-text: #14213d;

    --theme-muted: #64748b;

    --theme-border: #e1e7ef;

    --theme-shadow: 0 6px 22px rgba(20, 33, 61, .045);

    --theme-sidebar: #ffffff;

    --theme-sidebar-text: #14213d;

    --theme-sidebar-muted: #64748b;

    color-scheme: light;

    --ui-scroll-track: #f4f6fa;

    --ui-scroll-thumb: #a3afbf;

}

html[data-theme="dark"] {

    --theme-bg: #0c1424;

    --theme-surface: #14213d;

    --theme-surface-soft: #182743;

    --theme-text: #f1f5fb;

    --theme-muted: #a6b5ce;

    --theme-border: #293952;

    --theme-shadow: 0 6px 22px rgba(0, 0, 0, .1);

    --theme-sidebar: #101b31;

    --theme-sidebar-text: #f5f7fc;

    --theme-sidebar-muted: #aab8d0;

    --ui-scroll-track: #101b31;

    --ui-scroll-thumb: #52627c;

    color-scheme: dark;

}

html {
    scrollbar-gutter: stable;
    scroll-behavior: auto;
}

body {
    font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

body,
.crm-main,
.page-content {
    min-width: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

[hidden] {
    display: none !important;
}

.crm-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.crm-layout {
    min-width: 0;
}

.crm-main {
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    transition: width .2s var(--ui-ease), margin-left .2s var(--ui-ease), background-color .2s;
}

body.sidebar-collapsed {
    --sidebar-width: var(--sidebar-collapsed-width);
}

.page-content {
    padding: 24px;
}

.page-content>*,
.page-content :is([class$="-page"], [class$="-layout"], [class$="-grid"])>* {
    min-width: 0;
}

.crm-skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 12000;
    padding: 10px 14px;
    background: var(--gold);
    color: #14213d;
    border-radius: 8px;
    transform: translateY(-150%);
}

.crm-skip-link:focus {
    transform: none;
}



/* Navigation: a fixed desktop rail and an off-canvas mobile/tablet drawer. */

.sidebar {
    display: flex;
    width: var(--sidebar-width);
    height: 100dvh;
    min-height: 0;
    padding: 18px 12px 12px;
    z-index: 1000;
    overflow: hidden;
    border-color: var(--theme-border);
    background: var(--theme-sidebar);
    transition: width .2s var(--ui-ease), padding .2s var(--ui-ease), background-color .2s, color .2s, border-color .2s;
}

.sidebar .sidebar-brand {
    display: grid;
    position: relative;
    height: 56px;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    padding: 0 2px 18px;
    border: 0;
    flex: none;
    transition: height .2s var(--ui-ease);
}

.sidebar .sidebar-brand .brand-mark {
    width: 38px;
    height: 38px;
    min-width: 38px;
    flex: none;
    margin: 0;
}

.sidebar .sidebar-brand-copy {
    min-width: 0;
    padding-right: 40px;
    overflow: hidden;
    transition: opacity .12s, padding .2s;
}

.sidebar .sidebar-brand h2 {
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -.4px;
    margin: 0;
}

.sidebar .sidebar-brand span {
    font-size: 10px;
    line-height: 1.4;
    margin-top: 3px;
}

.sidebar-collapse-toggle {
    position: absolute;
    top: 21px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    min-width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--theme-sidebar-muted);
    background: transparent;
    cursor: pointer;
    z-index: 2;
}

.sidebar-collapse-toggle,
.sidebar .sidebar-logout {
    transition: background-color .16s, border-color .16s, color .16s, right .2s var(--ui-ease), top .2s var(--ui-ease), transform .2s var(--ui-ease);
}

.sidebar-collapse-toggle:hover {
    background: var(--theme-surface-soft);
    color: var(--gold);
}

.sidebar-collapse-toggle:active {
    background: var(--theme-surface-soft);
    color: var(--gold-dark);
    box-shadow: none;
}

.sidebar .sidebar-logout:hover {
    background: var(--gold);
    border-color: var(--gold);
    color: #14213d;
    transform: none;
}

.sidebar .sidebar-logout:active {
    background: var(--gold-dark);
    border-color: var(--gold-dark);
    color: #14213d;
    transform: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .18);
}

.sidebar .nav-item>span:not(.nav-icon),
.sidebar .nav-submenu a {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}

.crm-sidebar-tooltip {
    position: fixed;
    z-index: 11500;
    max-width: calc(100vw - 24px);
    padding: 7px 10px;
    border: 1px solid var(--theme-border);
    border-radius: 7px;
    background: var(--theme-surface);
    color: var(--theme-text);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: var(--theme-shadow);
    pointer-events: none;
}

.sidebar-toggle-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: block;
    background: currentColor;
    -webkit-mask: url('../images/ui/sidebar.png') center/contain no-repeat;
    mask: url('../images/ui/sidebar.png') center/contain no-repeat;
    transition: transform .2s var(--ui-ease);
}

.sidebar .sidebar-nav {
    display: flex;
    flex-direction: column;
    margin-top: 4px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar .sidebar-nav::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.sidebar .nav-item {
    min-height: 42px;
    max-height: 60px;
    padding: 10px 12px;
    margin-bottom: 4px;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    border-radius: 9px;
    overflow: hidden;
    transition: padding .2s var(--ui-ease), gap .2s var(--ui-ease), min-height .2s var(--ui-ease), max-height .2s var(--ui-ease), margin .2s var(--ui-ease), opacity .12s, background-color .16s, color .16s;
}

.sidebar .nav-item>span:not(.nav-icon):not(.nav-arrow):not(.nav-badge):not(.sidebar-sub-count) {
    max-width: 200px;
    overflow: hidden;
    transition: max-width .2s var(--ui-ease), opacity .12s;
}

.sidebar .nav-item .nav-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transform: none;
    font-size: 18px;
    line-height: 1;
}

.sidebar .nav-item:not(.active):hover {
    background: var(--theme-surface-soft) !important;
    color: var(--theme-text) !important;
    transform: none;
}

.sidebar .nav-item:not(.active):hover * {
    color: inherit !important;
}

.sidebar .nav-item.active {
    box-shadow: none;
    font-weight: 650;
}

.sidebar .nav-item:active {
    transform: none;
}

.sidebar .nav-submenu {
    padding: 3px 0 8px 27px;
}

.sidebar .add-lead-submenu {
    display: block;
    max-height: 0;
    padding-block: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: max-height .16s var(--ui-ease), padding .16s var(--ui-ease), opacity .16s var(--ui-ease), transform .16s var(--ui-ease), visibility .16s;
}

.sidebar .add-lead-submenu.open {
    max-height: 110px;
    padding-block: 3px 8px;
    opacity: 1;
    visibility: visible;
    transform: none;
}

.sidebar .nav-submenu a,
.sidebar .submenu-action {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 12px;
    transform: none;
}

.sidebar .nav-submenu a:hover,
.sidebar .submenu-action:hover {
    transform: none;
}

.sidebar .sidebar-user {
    position: relative;
    height: 52px;
    min-height: 52px;
    padding: 14px 4px 2px;
    gap: 8px;
    margin-top: 12px;
    border-top: 1px solid var(--theme-border);
    flex: none;
}

.sidebar .sidebar-user-info {
    flex: 1;
    min-width: 0;
    padding-right: 40px;
    overflow: hidden;
    transition: opacity .12s;
}

.sidebar .sidebar-user strong {
    font-size: 12px;
    font-weight: 600;
}

.sidebar .sidebar-user span {
    font-size: 11px;
}

.sidebar .sidebar-logout {
    position: absolute;
    top: 14px;
    right: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    color: var(--theme-sidebar-muted);
    background: transparent;
    margin-left: auto;
}

.sidebar-logout-icon {
    width: 19px;
    height: 19px;
}

.sidebar-resize-handle {
    z-index: 1;
    width: 4px;
    opacity: 0;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
    opacity: 1;
}

.crm-mobile-nav-toggle,
.crm-mobile-backdrop {
    display: none;
}

.crm-status-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
}

.crm-status-nav-label {
    flex: 0 0 100%;
    color: var(--theme-muted);
    font-size: 12px;
    font-weight: 600;
}

.crm-status-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--theme-border);
    border-radius: var(--ui-control-radius);
    background: var(--theme-surface-soft);
    color: var(--theme-text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .14s, color .14s, border-color .14s;
}

.crm-status-button:hover,
.crm-status-button.is-current {
    background: var(--gold);
    color: #14213d;
    border-color: var(--gold);
}

.crm-status-button:active {
    background: var(--gold-dark);
    color: #14213d;
    border-color: var(--gold-dark);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .16);
}

.crm-status-count {
    padding: 1px 6px;
    border-radius: 5px;
    background: color-mix(in srgb, currentColor 9%, transparent);
    font-size: 11px;
}

.crm-result-scope,
.crm-record-reference {
    display: block;
    margin: 5px 0 12px;
    color: var(--theme-muted);
    font-size: 12px;
}

:is(.leads-bulk-toolbar, .recycle-bulkbar, .assignment-bulk-bar) {
    flex-wrap: wrap;
    gap: 10px;
}

:is(.leads-bulk-toolbar, .recycle-bulkbar, .assignment-bulk-bar):not(.has-selection) :is(.leads-selected-count, .recycle-select-count, .assignment-selected-count) {
    display: none;
}

:is(.leads-bulk-toolbar, .recycle-bulkbar):not(.has-selection) :is(.leads-bulk-delete-btn, .recycle-delete-selected) {
    display: none;
}

.leads-bulk-toolbar:not(.has-selection),

.recycle-bulkbar:not(.has-selection) {
    display: none;
}

.assignment-bulk-bar:not(.has-selection) :is(#assignmentUserSelect, #assignSelectedLeads) {
    display: none;
}

/* Native controls keep existing bulk handlers while reducing table noise. */

.crm-row-select-head {
    width: 48px;
    text-align: center !important;
}

.crm-row-select-cell {
    width: 48px;
    text-align: center !important;
}

.crm-row-select-cell input,

.crm-row-select-head input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--gold);
    cursor: pointer;
}

tr.crm-row-selected {
    background: color-mix(in srgb, var(--gold) 8%, var(--theme-surface)) !important;
}

@media (hover:hover) and (pointer:fine) {

    .crm-row-select-cell input:not(:checked) {
        opacity: 0;
        transform: translate(-50%, -50%) scale(.88);
        pointer-events: none;
        transition: opacity .14s ease, transform .14s ease;
    }

    tr:hover .crm-row-select-cell input,

    tr:focus-within .crm-row-select-cell input,

    tr.crm-row-selected .crm-row-select-cell input {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        pointer-events: auto;
    }

}

.crm-row-menu {
    position: relative;
    display: inline-flex;
    justify-content: flex-end;
}

.crm-row-menu-trigger {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--theme-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: opacity .14s ease, background-color .14s ease, border-color .14s ease, color .14s ease;
}

.crm-row-menu-trigger:hover,

.crm-row-menu-trigger:focus-visible,

.crm-row-menu-trigger[aria-expanded="true"] {
    border-color: var(--theme-border);
    background: var(--theme-surface-soft);
    color: var(--theme-text);
    outline: none;
}

.crm-row-menu-popover {
    position: fixed;
    min-width: 196px;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 6px;
    display: grid;
    gap: 2px;
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    background: var(--theme-surface);
    box-shadow: 0 16px 36px rgba(5, 17, 40, .22);
    z-index: 11000;
    transform-origin: top right;
}

.crm-row-menu-item {
    min-height: 36px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    width: 100%;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--theme-text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.crm-row-menu-item:hover,

.crm-row-menu-item:focus-visible {
    background: var(--theme-surface-soft);
    color: var(--gold);
    outline: none;
}

.crm-row-menu-item.danger {
    color: #d95b68;
}

.crm-row-menu-item.danger:hover,

.crm-row-menu-item.danger:focus-visible {
    background: color-mix(in srgb, #d95b68 10%, var(--theme-surface));
    color: #c54b59;
}

@media (hover:hover) and (pointer:fine) {

    .crm-row-menu-trigger {
        opacity: 0;
        pointer-events: none;
    }

    tr:hover .crm-row-menu-trigger,

    tr:focus-within .crm-row-menu-trigger,

    .crm-row-menu-trigger[aria-expanded="true"] {
        opacity: 1;
        pointer-events: auto;
    }

}

@media (max-width:900px) {

    .crm-row-select-cell input:not(:checked) {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        pointer-events: auto;
    }

    .crm-row-menu-trigger {
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }

}

@media(min-width:901px) {

    body.sidebar-collapsed .sidebar {
        padding: 18px 8px 12px;
    }

    /* Collapsed rail: logo stays at the top; toggle gets its own nav-sized tile above Dashboard. */
    body.sidebar-collapsed .sidebar .sidebar-brand {
        height: 56px;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
        margin: 0;
    }

    body.sidebar-collapsed .sidebar .sidebar-brand .brand-mark {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }

    body.sidebar-collapsed .sidebar-brand-copy {
        display: none;
    }

    body.sidebar-collapsed .sidebar-user-info {
        opacity: 0;
        pointer-events: none;
    }

    body.sidebar-collapsed .sidebar .sidebar-collapse-toggle {
        position: relative;
        top: auto;
        right: auto;
        left: auto;
        align-self: center;
        flex: 0 0 50px;
        width: 50px;
        min-width: 50px;
        height: 48px;
        margin: 0 auto 4px;
        padding: 12px 13px;
        border: 1px solid transparent;
        border-radius: 9px;
        transform: none;
        z-index: 1;
    }

    body.sidebar-collapsed .sidebar .sidebar-collapse-toggle:hover,
    body.sidebar-collapsed .sidebar .sidebar-collapse-toggle:focus-visible {
        background: var(--theme-surface-soft);
        border-color: var(--theme-border);
    }

    body.sidebar-collapsed .sidebar .nav-item>span:not(.nav-icon) {
        max-width: 0;
        opacity: 0;
    }

    body.sidebar-collapsed .sidebar .nav-arrow,

    body.sidebar-collapsed .sidebar .nav-badge,
    body.sidebar-collapsed .sidebar .sidebar-sub-count,

    body.sidebar-collapsed .sidebar .nav-submenu,
    body.sidebar-collapsed .sidebar .add-lead-submenu,

    body.sidebar-collapsed .sidebar .user-avatar,
    body.sidebar-collapsed .sidebar-resize-handle {
        display: none !important;
    }

    body.sidebar-collapsed .sidebar .nav-item {
        width: 50px;
        min-height: 48px;
        padding: 12px 13px;
        margin-inline: auto;
        justify-content: center;
        gap: 0;
    }

    body.sidebar-collapsed .sidebar .nav-item .nav-icon {
        width: 24px;
        flex-basis: 24px;
        height: 24px;
    }

    body.sidebar-collapsed .sidebar .nav-item:not([data-sidebar-primary]) {
        min-height: 0;
        max-height: 0;
        padding-block: 0;
        margin: 0;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    body.sidebar-collapsed .sidebar .sidebar-user {
        padding-inline: 0;
    }

    body.sidebar-collapsed .sidebar .sidebar-logout {
        margin: 0;
        right: calc(50% - 18px);
    }

    body.sidebar-collapsed .sidebar-toggle-icon {
        transform: scaleX(-1);
    }

}

body.sidebar-resizing :is(.sidebar, .crm-main) {
    transition: none;
}



/* Header and page hierarchy. */

.topbar {
    height: 72px;
    padding: 12px 24px;
    gap: 16px;
    z-index: 900;
    border-bottom: 1px solid var(--theme-border);
}

.topbar-search {
    flex: 1 1 320px;
    width: auto;
    max-width: 460px;
    min-width: 0;
    position: relative;
}

.topbar-search input {
    height: 40px;
    font-size: 13px;
    background: var(--theme-surface-soft);
}

.topbar-right {
    gap: 12px;
    flex: none;
}

.topbar-right :is(.theme-toggle, .notification-toggle) {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    transform: none;
    box-shadow: none;
}

.topbar-right .notification-bell-svg {
    transform: none;
}

.topbar-user {
    min-width: 0;
}

.topbar-user strong {
    font-size: 12px;
    font-weight: 600;
}

.topbar-user span,
.topbar-date {
    font-size: 12px;
}

.topbar-avatar,
.user-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    font-size: 13px;
    font-weight: 650;
}

.page-content :is(.page-title, .leads-page-head, .invoice-page-head, .followups-page-head, .assignment-page-head, .team-page-title, .settings-page-head, .recycle-page-head) {
    margin-bottom: 22px;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.page-content h1 {
    font-size: 28px;
    font-weight: 650;
    letter-spacing: -.65px;
    line-height: 1.2;
    margin: 0 0 6px;
}

.page-content h1:last-child {
    margin-bottom: 0;
}

.page-content h2 {
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -.25px;
    line-height: 1.35;
}

.page-content h3 {
    font-size: 16px;
    font-weight: 600;
}

.page-content :is(.page-title, .leads-page-head, .invoice-page-head, .followups-page-head, .team-page-title, .settings-page-head) p {
    font-size: 13px;
    font-weight: 400;
    color: var(--theme-muted);
    line-height: 1.5;
}

.page-content :is(.card, .invoice-card, .invoice-edit-card, .team-card, .leads-table-card, .leads-filter-card, .followup-filter-card, .settings-section, .assignment-card, .recycle-card) {
    min-width: 0;
    border: 1px solid var(--theme-border);
    background: var(--theme-surface);
    box-shadow: var(--theme-shadow);
}

.page-content .card {
    padding: 20px;
}

.page-content :is(.card-heading, .invoice-card-head, .team-card-header) {
    gap: 12px;
    flex-wrap: wrap;
}

.page-content :is(.card-heading, .invoice-card-head, .team-card-header) h2 {
    font-size: 18px;
}

.page-content :is(.card-heading, .invoice-card-head, .team-card-header) p {
    font-size: 12px;
}

.page-content :is(.dashboard-grid, .calling-layout, .settings-layout) {
    gap: var(--ui-gap);
}

.page-content .dashboard-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}

.page-content :is(.dashboard-stats, .calling-summary-grid, .team-stats, .assignment-stats, .followup-stats) {
    gap: 12px;
    margin-bottom: 18px;
}

.page-content .dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.page-content :is(.dashboard-stat-card, .calling-summary-card, .team-stat-card, .assignment-stat-card, .followup-stat-card) {
    padding: 16px 18px;
    min-height: 104px;
    border: 1px solid var(--theme-border);
    box-shadow: var(--theme-shadow);
    background: var(--theme-surface);
    transform: none;
    text-align: left;
}

.page-content :is(.dashboard-stat-card, .calling-summary-card, .team-stat-card, .assignment-stat-card, .followup-stat-card):hover {
    transform: none;
    box-shadow: var(--theme-shadow);
    border-color: color-mix(in srgb, var(--gold) 50%, var(--theme-border));
}

.page-content :is(.dashboard-stat-card, .calling-summary-card, .team-stat-card, .assignment-stat-card, .followup-stat-card) strong {
    font-size: 29px;
    line-height: 1.15;
    font-weight: 650;
    margin: 6px 0;
}

.page-content :is(.stat-label, .stat-help) {
    font-size: 12px;
    line-height: 1.4;
}

.page-content .stat-help {
    margin-top: 5px;
    color: var(--theme-muted);
}

.page-content .dashboard-call-report {
    margin: 0 0 22px;
}

.page-content .dashboard-call-report h2 {
    margin-bottom: 12px;
}

.page-content .dashboard-report-cards {
    gap: 16px;
}

.page-content :is(.dashboard-report-form, .leads-filter-form, .invoice-filter-form, .assignment-filter-form, .recycle-filter-form) {
    gap: 12px;
    align-items: end;
}

.page-content .dashboard-report-form {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.page-content .dashboard-report-form>label {
    display: grid;
    gap: 5px;
    min-width: 120px;
    font-size: 12px;
}

.page-content .leads-filter-form {
    display: grid;
    grid-template-columns: minmax(210px, 1.4fr) repeat(2, minmax(150px, 1fr)) minmax(230px, 1.1fr);
}

.page-content .leads-filter-form.is-status-module {
    grid-template-columns: minmax(240px, 1fr) minmax(260px, .7fr);
}

.page-content .leads-filter-actions {
    min-height: 40px;
    padding-top: 0;
    gap: 8px;
    align-items: center;
}



.page-content :is(.card, .dashboard-stat-card, .calling-summary-card, .calling-queue-card, .calling-workspace-card, .calling-history-card, .calling-timeline-card, .invoice-card, .invoice-edit-card, .team-card, .team-stat-card, .team-leads-card, .leads-table-card, .leads-filter-card, .followup-filter-card, .followup-filter-summary, .followup-section, .followup-stat-card, .settings-section, .assignment-card, .assignment-stat-card, .recycle-card) {
    border-radius: var(--ui-radius);
}



/* Controls: sizes are shared without overriding method-specific controls or hidden fields. */

:is(.page-content, .crm-modal, .crm-lead-modal, .followup-modal, .team-modal, .invoice-modal, .crm-popover) :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea) {

    min-width: 0;
    max-width: 100%;
    min-height: 40px;
    border-radius: var(--ui-control-radius);
    border: 1px solid var(--theme-border);

    padding: 9px 12px;
    background-color: var(--theme-surface-soft);
    color: var(--theme-text);
    font-size: 13px;
    box-shadow: none;

}

:is(.page-content, .crm-modal, .crm-lead-modal, .followup-modal, .team-modal, .invoice-modal) textarea {
    min-height: 88px;
    resize: vertical;
}

:is(.page-content, .crm-modal, .crm-lead-modal, .followup-modal, .team-modal, .invoice-modal) label {
    font-size: 12px;
    font-weight: 500;
}

:is(.page-content, .crm-modal, .crm-lead-modal, .followup-modal, .team-modal, .invoice-modal) small {
    font-size: 12px;
    line-height: 1.45;
}

input::placeholder,
textarea::placeholder {
    color: var(--theme-muted);
    opacity: .8;
}

input:disabled,
select:disabled,
button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* Standard actions share states; destructive actions and selected toggles retain their own colors. */

:is(.btn-primary, .btn-secondary, .invoice-btn, .invoice-ui-btn, .assignment-btn, .team-btn, .leads-filter-btn, .leads-edit-row-btn, .edit-lead-btn, .recycle-btn, .recycle-action-btn, .settings-btn, .settings-save-btn, .followup-btn, .calling-btn):not(.danger):not(.delete):not(.campaign-delete-btn) {

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 8px;

    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    background: var(--theme-surface-soft);
    border: 1px solid var(--theme-border);
    color: var(--theme-text);

    box-shadow: none;
    transform: none;
    transition: transform .3s var(--ui-ease), background-color .2s, border-color .2s, color .2s, box-shadow .2s;

}

:is(.btn-primary, .btn-secondary, .invoice-btn, .invoice-ui-btn, .assignment-btn, .team-btn, .leads-filter-btn, .leads-edit-row-btn, .edit-lead-btn, .recycle-btn, .recycle-action-btn, .settings-btn, .settings-save-btn, .followup-btn, .calling-btn):not(.danger):not(.delete):not(.campaign-delete-btn):hover:not(:disabled):not([aria-disabled="true"]):not([aria-busy="true"]) {
    background: var(--gold);
    border-color: var(--gold);
    color: #14213d;
    transform: translateY(-1px);
    box-shadow: none;
}

:is(.btn-primary, .btn-secondary, .invoice-btn, .invoice-ui-btn, .assignment-btn, .team-btn, .leads-filter-btn, .leads-edit-row-btn, .edit-lead-btn, .recycle-btn, .recycle-action-btn, .settings-btn, .settings-save-btn, .followup-btn, .calling-btn):not(.danger):not(.delete):not(.campaign-delete-btn):active:not(:disabled):not([aria-disabled="true"]):not([aria-busy="true"]) {
    background: var(--gold-dark);
    border-color: var(--gold-dark);
    color: #14213d;
    transform: translateY(0);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .18);
}

:is(.btn-primary, .btn-secondary, .invoice-btn, .invoice-ui-btn, .assignment-btn, .team-btn, .leads-filter-btn, .leads-edit-row-btn, .edit-lead-btn, .recycle-btn, .recycle-action-btn, .settings-btn, .settings-save-btn, .followup-btn, .calling-btn):not(.danger):not(.delete):not(.campaign-delete-btn):is(:disabled, [aria-disabled="true"], [aria-busy="true"]) {
    background: var(--theme-surface-soft);
    border-color: var(--theme-border);
    color: var(--theme-muted);
    opacity: .55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.page-content :is(.status-badge, .lead-status-badge, .invoice-status, .followup-filter-badge, .settings-admin-badge) {
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    min-height: 24px;
}

.page-content :is(.form-row, .invoice-form-grid, .invoice-client-grid, .team-form-grid, .edit-lead-grid, .followup-form-grid, .calling-form-grid) {
    gap: 16px;
}

.page-content :is(.invoice-payment-fields, .invoice-discount-fields) {
    gap: 14px;
}

.page-content .invoice-row-input {
    font-size: 13px;
}

.page-content .calling-layout {
    grid-template-columns: minmax(230px, 270px) minmax(0, 1fr) minmax(210px, 250px);
}

.page-content .calling-queue-search-wrap {
    min-width: 0;
}

.page-content .calling-queue-search-wrap #callingQueueSearch {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.page-content .calling-contact-number {
    font-size: 24px;
}

.page-content :is(.calling-queue-card, .calling-workspace-card, .calling-history-card) {
    min-width: 0;
}

.page-content .calling-summary-card :is(span, small) {
    font-size: 12px;
}

.page-content .calling-detail-row>span {
    font-size: 12px;
}

.page-content .calling-detail-value {
    font-size: 13px;
}

.page-content .call-status-btn {
    min-height: 40px;
    font-size: 12px;
    font-weight: 500;
}

.page-content .invoice-discount-panel,
.page-content .invoice-payment-panel {
    padding: 18px;
    box-shadow: none;
    background: var(--theme-surface-soft);
}

.page-content .invoice-discount-heading h4 {
    font-size: 14px;
}

.page-content .settings-section {
    padding: 20px;
    margin-bottom: 18px;
}

.page-content .settings-section h2 {
    font-size: 18px;
}

.page-content .settings-section :is(p, small) {
    font-size: 12px;
}

.page-content .settings-nav {
    position: static;
}

.page-content .settings-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}



/* Destructive actions retain red feedback and do not inherit gold hover. */

:is(.invoice-btn.danger, .invoice-ui-btn.danger, .team-btn.danger, .edit-lead-btn.danger, .recycle-action-btn.delete, .campaign-delete-btn, .btn-primary.danger) {
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid #c54b59;
    border-radius: 8px;
    color: #c54b59;
    background: var(--theme-surface-soft);
    transition: transform .3s var(--ui-ease), background-color .2s, color .2s, border-color .2s;
    transform: none;
}

:is(.invoice-btn.danger, .invoice-ui-btn.danger, .team-btn.danger, .edit-lead-btn.danger, .recycle-action-btn.delete, .campaign-delete-btn, .btn-primary.danger):hover:not(:disabled) {
    color: #fff;
    background: #c54b59;
    border-color: #c54b59;
    transform: translateY(-1px);
}

:is(.invoice-btn.danger, .invoice-ui-btn.danger, .team-btn.danger, .edit-lead-btn.danger, .recycle-action-btn.delete, .campaign-delete-btn, .btn-primary.danger):active:not(:disabled) {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2);
    transform: none;
}

/* Status labels need their intrinsic width; other table content may still wrap. */

:is(.leads-status-pill, .leads-outcome-pill, .leads-attempt-pill, .calling-status-pill, .calling-attempt-pill, .assignment-pill, .team-status-badge, .status-pill, .status-badge, .lead-status-badge, .invoice-status, .followup-filter-badge, .crm-select-option) {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    flex-shrink: 0;
    max-width: none;
}

.page-content .leads-status-pill {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.dashboard-stat-card[href*="not-responding"] .stat-label {
    white-space: nowrap;
}

.crm-search-input,
.topbar-search input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http\://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23808da1' stroke-width='1.8'%3E%3Ccircle cx='10' cy='10' r='6'/%3E%3Cpath d='m15 15 5 5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 17px;
    padding-left: 38px !important;
}



/* Module tables shrink within their cards instead of forcing nested horizontal scrollbars. */

:is(.leads-table-wrap, .team-table-wrap, .assignment-table-wrap, .followup-filter-table-wrap, .recycle-table-wrap, .table-responsive, .crm-table-wrapper, .crm-table-scroll) {
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.page-content table {
    border-collapse: collapse;
    font-size: 13px;
}

.page-content table th {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .025em;
    color: var(--theme-muted);
    background: var(--theme-surface-soft);
}

.page-content table td {
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.45;
}

.page-content table :is(td, th) {
    border-color: var(--theme-border);
}

.page-content .invoice-table {
    min-width: 0;
    overflow-x: hidden;
    max-width: 100%;
}

.page-content .invoice-table :is(.invoice-table-head, .invoice-table-row) {
    min-width: 0;
}

.page-content :is(.assignment-actions, .leads-filter-actions) {
    gap: 8px;
    flex-wrap: wrap;
}

.page-content :is(.invoice-card-head, .team-card-header) {
    padding: 18px 20px;
}

.page-content :is(.invoice-table-head, .invoice-table-row) {
    font-size: 13px;
}

.crm-table-scroll>table {
    width: 100%;
}



/* Dialogs and custom menus share motion and viewport boundaries. */

:is(.crm-modal, .crm-lead-modal, .followup-modal, .team-modal, .invoice-modal) {
    padding: 24px;
    align-items: center;
    justify-content: center;
}

:is(.crm-modal.open, .crm-lead-modal.open, .followup-modal.open, .team-modal.open, .invoice-modal.open) {
    display: flex;
}

:is(.crm-modal-box, .crm-lead-modal-body, .followup-modal-box, .team-modal-box, .invoice-modal-box) {
    min-width: 0;
    max-width: 100%;
    max-height: calc(100dvh - 48px);
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .18);
}

:is(.crm-modal-box, .followup-modal-box, .team-modal-box, .invoice-modal-box) {
    position: relative;
}

:is(.crm-modal-header, .crm-lead-modal-head, .followup-modal-head, .team-modal-header, .invoice-modal-head) {
    padding: 18px 20px;
    gap: 12px;
}

:is(.crm-modal-header, .crm-lead-modal-head, .followup-modal-head, .team-modal-header, .invoice-modal-head) h2 {
    font-size: 19px;
    font-weight: 650;
}

:is(.crm-modal-header, .followup-modal-head, .team-modal-header, .invoice-modal-head) p {
    font-size: 12px;
}

:is(.crm-form, .invoice-form, .team-form) {
    padding: 20px;
}

:is(.modal-close, .followup-modal-close, .team-modal-close, .invoice-close, .crm-lead-modal-close) {
    width: 36px;
    height: 36px;
    flex: none;
    padding: 0;
    font-size: 22px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    transform: none !important;
    box-shadow: none !important;
}

.ui-overlay-enter {
    animation: ui-overlay-in .16s var(--ui-ease);
}

.ui-overlay-enter>:is(.crm-modal-box, .followup-modal-box, .team-modal-box, .invoice-modal-box) {
    animation: ui-panel-in .18s var(--ui-ease);
}

.ui-overlay-closing {
    display: flex !important;
    pointer-events: none;
    animation: ui-overlay-out .16s ease forwards;
}

.ui-overlay-closing>:is(.crm-modal-box, .followup-modal-box, .team-modal-box, .invoice-modal-box) {
    animation: ui-panel-out .16s ease forwards;
}

.invoice-modal.open,
.invoice-modal.open .invoice-modal-box,
.invoice-modal.closing,
.invoice-modal.closing .invoice-modal-box {
    animation: none;
}

dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    height: fit-content;
    color: var(--theme-text);
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 16px;
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 32px);
    overflow: auto;
    overscroll-behavior: contain;
}

dialog::backdrop {
    background: rgba(5, 12, 25, .58);
}

dialog[open] {
    animation: ui-panel-in .18s var(--ui-ease);
}

dialog.ui-dialog-closing {
    animation: ui-panel-out .16s ease forwards;
}

.crm-lead-workspace {
    width: min(1100px, calc(100vw - 32px));
    height: calc(100dvh - 48px);
    padding: 14px;
}

.crm-lead-workspace iframe {
    min-width: 0;
    width: 100%;
    height: calc(100% - 48px);
    border: 0;
}

.crm-confirm {
    width: min(420px, calc(100vw - 32px));
    padding: 24px;
}

.crm-confirm h2 {
    font-size: 19px;
    font-weight: 650;
    margin: 0 0 10px;
}

.crm-confirm p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--theme-muted);
    white-space: pre-line;
    margin: 0 0 24px;
}

.crm-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.crm-confirm-actions button {
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
}

.crm-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 13000;
    height: 3px;
    background: var(--gold);
    transform-origin: left;
    animation: ui-loading 1.1s ease-in-out infinite;
    pointer-events: none;
}

.crm-loading-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

.crm-popover {
    position: fixed;
    z-index: 11000;
    width: min(308px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    overflow: auto;
    padding: 14px;
    background: var(--theme-surface);
    color: var(--theme-text);
    border: 1px solid var(--theme-border);
    border-radius: 12px;
    box-shadow: 0 10px 36px rgba(0, 0, 0, .18);
}

.crm-picker-head {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.crm-picker-head strong {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}

.crm-picker-nav,
.crm-picker-day {
    border: 0;
    background: transparent;
    color: var(--theme-text);
    border-radius: 7px;
    min-height: 36px;
    padding: 5px;
    cursor: pointer;
}

.crm-picker-nav {
    font-size: 20px;
}

.crm-picker-nav:hover,
.crm-picker-day:hover {
    background: var(--theme-surface-soft);
}

.crm-picker-weekdays,
.crm-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
}

.crm-picker-weekdays span {
    text-align: center;
    padding: 6px 0;
    font-size: 11px;
    color: var(--theme-muted);
}

.crm-picker-day {
    font-size: 12px;
}

.crm-picker-day.outside {
    opacity: .45;
}

.crm-picker-day.today {
    box-shadow: inset 0 0 0 1px var(--gold);
}

.crm-picker-day[aria-selected="true"] {
    background: var(--gold);
    color: #14213d;
    font-weight: 650;
}

.crm-picker-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--theme-border);
}

.crm-picker-footer button {
    border: 0;
    background: transparent;
    color: var(--theme-text);
    padding: 7px 9px;
    font-size: 12px;
    min-height: 36px;
}

.crm-date-control {
    position: relative;
    display: block;
    min-width: 0;
}

.crm-date-button {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    background: var(--theme-surface-soft);
    color: var(--theme-text);
    text-align: left;
    font-size: 13px;
}

.crm-date-button svg {
    width: 16px;
    height: 16px;
    flex: none;
    stroke: var(--gold);
    fill: none;
    stroke-width: 1.6;
}

.crm-date-button[aria-invalid="true"] {
    border-color: var(--red);
}

.crm-field-error {
    display: block;
    margin-top: 5px;
    color: var(--red);
    font-size: 12px;
    line-height: 1.4;
}

.crm-native-date {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    min-height: 0 !important;
    opacity: 0;
    pointer-events: none;
    clip-path: inset(50%);
}

.crm-control-arrow,

.sidebar .nav-arrow,

.calling-priority-chevron {

    width: 12px;

    height: 12px;

    flex: 0 0 12px;

    display: inline-block;

    border: 0;

    background-color: currentColor;

    -webkit-mask: url('../images/ui/right-arrow.png') center/contain no-repeat;

    mask: url('../images/ui/right-arrow.png') center/contain no-repeat;

    transform: rotate(90deg);

    transition: transform .3s var(--ui-ease);

}

.crm-control-arrow {

    -webkit-mask-image: url('../images/ui/down.png');

    mask-image: url('../images/ui/down.png');

    transform: none;

}

.crm-select-chevron {

    width: 12px !important;

    height: 12px !important;

    display: inline-block !important;

    border: 0 !important;

    background: currentColor !important;

    -webkit-mask: url('../images/ui/down.png') center/contain no-repeat;

    mask: url('../images/ui/down.png') center/contain no-repeat;

    transform: none;

    transition: transform .3s var(--ui-ease);

}

.crm-select-chevron svg {
    display: none;
}

.crm-select.open .crm-select-chevron {
    transform: rotate(180deg);
}

.crm-date-button[aria-expanded="true"] .crm-control-arrow,

.nav-dropdown-toggle.expanded .nav-arrow,

.calling-priority-control.open .calling-priority-chevron {
    transform: rotate(-90deg);
}

.crm-date-button[aria-expanded="true"] .crm-control-arrow {
    transform: rotate(180deg);
}

.sidebar .nav-arrow {
    margin-left: auto;
    color: currentColor;
    font-size: 0;
}

.crm-select-popover+.crm-control-arrow,

.crm-control-arrow:hover,

.sidebar .nav-arrow:hover,

.calling-priority-chevron:hover {
    background-color: currentColor;
}



/* One shared range control replaces paired date fields without changing backend parameters. */

.crm-date-range {
    min-width: 230px;
    position: relative;
}

.crm-date-range-trigger {

    width: 100%;

    min-height: 40px;

    padding: 9px 12px;

    display: flex;

    align-items: center;

    gap: 9px;

    border: 1px solid var(--theme-border);

    border-radius: var(--ui-control-radius);

    background: var(--theme-surface-soft);

    color: var(--theme-text);

    font: inherit;

    text-align: left;

    cursor: pointer;

}

.crm-date-range-trigger:hover,

.crm-date-range-trigger[aria-expanded="true"] {
    border-color: color-mix(in srgb, var(--gold) 72%, var(--theme-border));
}

.crm-date-range-trigger svg {
    width: 17px;
    height: 17px;
    flex: none;
    fill: none;
    stroke: var(--gold);
    stroke-width: 1.7;
}

.crm-date-range-trigger-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-range-picker {
    width: min(760px, calc(100vw - 24px));
    padding: 0;
    overflow: hidden;
}

.crm-range-picker-layout {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    min-height: 360px;
}

.crm-range-presets {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    border-right: 1px solid var(--theme-border);
}

.crm-range-preset {

    min-height: 34px;

    padding: 7px 9px;

    border: 0;

    border-radius: 6px;

    background: transparent;

    color: var(--theme-text);

    font: inherit;

    font-size: 12px;

    text-align: left;

    cursor: pointer;

}

.crm-range-preset:hover,

.crm-range-preset:focus-visible {
    background: var(--theme-surface-soft);
    outline: none;
}

.crm-range-preset[aria-pressed="true"] {
    background: color-mix(in srgb, var(--gold) 18%, var(--theme-surface));
    color: var(--theme-text);
    font-weight: 650;
}

.crm-range-calendar {
    min-width: 0;
    padding: 14px;
}

.crm-range-calendar-head {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.crm-range-calendar-title {
    text-align: center;
    font-size: 13px;
    font-weight: 650;
}

.crm-range-months {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.crm-range-month-title {
    margin: 0 0 7px;
    text-align: center;
    font-size: 12px;
    font-weight: 650;
}

.crm-range-weekdays,

.crm-range-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
}

.crm-range-weekdays span {
    padding: 5px 0;
    color: var(--theme-muted);
    text-align: center;
    font-size: 10px;
}

.crm-range-day {

    min-width: 0;

    min-height: 31px;

    padding: 4px;

    border: 0;

    border-radius: 5px;

    background: transparent;

    color: var(--theme-text);

    font: inherit;

    font-size: 11px;

    cursor: pointer;

}

.crm-range-day:hover,

.crm-range-day:focus-visible {
    background: var(--theme-surface-soft);
    outline: 1px solid var(--gold);
}

.crm-range-day.outside {
    opacity: .38;
}

.crm-range-day.today {
    box-shadow: inset 0 0 0 1px var(--gold);
}

.crm-range-day.in-range {
    border-radius: 0;
    background: color-mix(in srgb, var(--gold) 16%, var(--theme-surface));
}

.crm-range-day.range-start,

.crm-range-day.range-end {
    border-radius: 5px;
    background: var(--gold);
    color: #14213d;
    font-weight: 700;
}

.crm-range-summary {
    min-height: 36px;
    margin-top: 12px;
    padding-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--theme-border);
    color: var(--theme-muted);
    font-size: 12px;
}

.crm-range-summary strong {
    color: var(--theme-text);
    font-weight: 600;
}



/* Number fields keep validation and keyboard entry while hiding browser steppers. */

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,

input[type="number"]::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}



/* Supplied monochrome sidebar assets inherit the current navigation color. */

.sidebar .nav-icon.nav-icon-asset {
    display: inline-block;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    background-color: currentColor;
    background-image: none;
    color: inherit;
}

.nav-icon-dashboard {
    -webkit-mask: url('../images/ui/dashboard.png') center/contain no-repeat;
    mask: url('../images/ui/dashboard.png') center/contain no-repeat;
}

.nav-icon-leads {
    -webkit-mask: url('../images/ui/people.png') center/contain no-repeat;
    mask: url('../images/ui/people.png') center/contain no-repeat;
}

.nav-icon-calling {
    -webkit-mask: url('../images/ui/not-responding.png') center/contain no-repeat;
    mask: url('../images/ui/not-responding.png') center/contain no-repeat;
}

.nav-icon-add-lead {
    -webkit-mask: url('../images/ui/filter.png') center/contain no-repeat;
    mask: url('../images/ui/filter.png') center/contain no-repeat;
}

.nav-icon-followups {
    -webkit-mask: url('../images/ui/followups.png') center/contain no-repeat;
    mask: url('../images/ui/followups.png') center/contain no-repeat;
}

.nav-icon-not-responding {
    -webkit-mask: url('../images/ui/not-responding.png') center/contain no-repeat;
    mask: url('../images/ui/not-responding.png') center/contain no-repeat;
}

.nav-icon-lost {
    -webkit-mask: url('../images/ui/add-lead.png') center/contain no-repeat;
    mask: url('../images/ui/add-lead.png') center/contain no-repeat;
}

.nav-icon-hold {
    -webkit-mask: url('../images/ui/hold.png') center/contain no-repeat;
    mask: url('../images/ui/hold.png') center/contain no-repeat;
}

.nav-icon-invoices {
    -webkit-mask: url('../images/ui/receipt.png') center/contain no-repeat;
    mask: url('../images/ui/receipt.png') center/contain no-repeat;
}

.nav-icon-team-leads {
    -webkit-mask: url('../images/ui/team-leads.png') center/contain no-repeat;
    mask: url('../images/ui/team-leads.png') center/contain no-repeat;
}

.nav-icon-campaigns {
    -webkit-mask: url('../images/ui/campaigns.png') center/contain no-repeat;
    mask: url('../images/ui/campaigns.png') center/contain no-repeat;
}

.nav-icon-assignment {
    -webkit-mask: url('../images/ui/lead-assignment.png') center/contain no-repeat;
    mask: url('../images/ui/lead-assignment.png') center/contain no-repeat;
}

.nav-icon-recycle {
    -webkit-mask: url('../images/ui/recycle-bin.png') center/contain no-repeat;
    mask: url('../images/ui/recycle-bin.png') center/contain no-repeat;
}

.nav-icon-team {
    -webkit-mask: url('../images/ui/team-management.png') center/contain no-repeat;
    mask: url('../images/ui/team-management.png') center/contain no-repeat;
}

.nav-icon-settings {
    -webkit-mask: url('../images/ui/settings.png') center/contain no-repeat;
    mask: url('../images/ui/settings.png') center/contain no-repeat;
}

body.page-calling .sidebar .sidebar-nav {
    scrollbar-width: none;
}

body.page-calling .sidebar .sidebar-nav::-webkit-scrollbar {
    display: none;
}

.crm-select-menu,
.crm-select-options {
    max-height: min(320px, 60dvh);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.crm-select-trigger {
    min-height: 40px;
    font-size: 13px;
}

.crm-select-option {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 36px;
    padding: 9px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--theme-text);
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    transition: background-color .14s, color .14s;
}

.crm-select-option:is(:hover, :focus-visible):not(:disabled) {
    background: color-mix(in srgb, var(--gold) 15%, var(--theme-surface));
    color: var(--theme-text);
}

.crm-select-option:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: -2px;
}

.crm-select-option.active,
.crm-select-option[aria-selected="true"] {
    background: var(--gold);
    color: #14213d;
    font-weight: 600;
}

.invoice-more summary,
.invoice-more-menu :is(a, button) {
    min-height: 40px;
    font-size: 13px;
}

.crm-select-menu,
.crm-select-options,
.invoice-more-menu,
.crm-calendar-popover,
.edit-calendar-popover {
    color: var(--theme-text);
    background: var(--theme-surface);
    border-color: var(--theme-border);
}

.crm-select-popover {
    display: flex;
    flex-direction: column;
    max-height: min(400px, calc(100dvh - 24px));
    overflow: hidden;
}

.crm-select-list {
    min-height: 0;
    max-height: min(320px, calc(100dvh - 100px));
    overflow-y: auto;
    overscroll-behavior: contain;
}

.crm-select-search {
    width: 100%;
    flex: none;
    margin-bottom: 8px;
}

@media (hover:hover) and (pointer:fine) {

    .page-content button:not(:disabled):not(.crm-row-menu-trigger):not(.crm-picker-nav):not(.crm-picker-day):not(.crm-range-day):not(.crm-range-preset):not(.crm-date-button):not(.crm-date-range-trigger):not(.crm-select-option):not(.calling-priority-trigger):not(.calling-priority-option):hover {

        transform: translateY(-1px);

        transition: transform .3s var(--ui-ease);

    }

    .page-content button:not(:disabled):active {
        transform: translateY(0);
    }

}

/* Standard and WebKit scrollbar styling keep native scrolling and a usable fallback. */

:is(dialog, .crm-modal-box, .crm-lead-modal-body, .followup-modal-box, .team-modal-box, .invoice-modal-box, .crm-select-list, .crm-select-menu, .crm-select-options, .crm-popover, .sidebar-nav) {
    scrollbar-width: thin;
    scrollbar-color: var(--ui-scroll-thumb) var(--ui-scroll-track);
}

:is(dialog, .crm-modal-box, .crm-lead-modal-body, .followup-modal-box, .team-modal-box, .invoice-modal-box, .crm-select-list, .crm-select-menu, .crm-select-options, .crm-popover)::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

:is(dialog, .crm-modal-box, .crm-lead-modal-body, .followup-modal-box, .team-modal-box, .invoice-modal-box, .crm-select-list, .crm-select-menu, .crm-select-options, .crm-popover)::-webkit-scrollbar-track {
    background: var(--ui-scroll-track);
    border-radius: 12px;
}

:is(dialog, .crm-modal-box, .crm-lead-modal-body, .followup-modal-box, .team-modal-box, .invoice-modal-box, .crm-select-list, .crm-select-menu, .crm-select-options, .crm-popover)::-webkit-scrollbar-thumb {
    background: var(--ui-scroll-thumb);
    border: 2px solid var(--ui-scroll-track);
    border-radius: 12px;
}

:is(dialog, .crm-modal-box, .crm-lead-modal-body, .followup-modal-box, .team-modal-box, .invoice-modal-box, .crm-select-list, .crm-select-menu, .crm-select-options, .crm-popover)::-webkit-scrollbar-corner {
    background: var(--ui-scroll-track);
}

.notification-panel,
.crm-global-search-results {
    max-width: calc(100vw - 32px);
    max-height: 70dvh;
    overflow: auto;
    border-radius: 12px;
}

.lead-embedded-view {
    padding: 0;
    background: var(--theme-bg);
}

.lead-embedded-view .leads-page {
    padding: 16px;
}

.lead-embedded-view .crm-lead-modal {
    padding: 12px;
}

.lead-embedded-view .crm-lead-modal-body {
    max-height: calc(100dvh - 24px);
}

@keyframes ui-overlay-in {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes ui-overlay-out {
    from {
        opacity: 1
    }

    to {
        opacity: 0
    }
}

@keyframes ui-panel-in {
    from {
        opacity: 0;
        transform: translateY(6px) scale(.99)
    }

    to {
        opacity: 1;
        transform: none
    }
}

@keyframes ui-panel-out {
    from {
        opacity: 1;
        transform: none
    }

    to {
        opacity: 0;
        transform: translateY(4px) scale(.99)
    }
}

@keyframes ui-loading {
    0% {
        transform: scaleX(.15)
    }

    65% {
        transform: scaleX(.8)
    }

    100% {
        transform: scaleX(.95)
    }
}



/* Login: preserve the supplied logo, theme and authentication form. */

body.scalymise-login {
    padding: 24px;
    background: var(--theme-bg) !important;
    color: var(--theme-text);
    font-family: 'Montserrat', system-ui, sans-serif;
}



/* Correction pass: quieter filters, plain table states, and row-number selection. */

.page-content :is(.leads-filter-card, .assignment-toolbar, .recycle-search, .invoice-toolbar) {

    padding: 0;

    border: 0;

    border-radius: 0;

    background: transparent;

    box-shadow: none;

}



.crm-status-count {
    display: none;
}



.crm-row-select-head,

.crm-row-select-cell {

    position: relative;

    width: 58px;

    min-width: 58px;

    height: 44px;

}



.crm-row-number {

    position: absolute;

    top: 50%;

    left: 50%;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    min-width: 28px;

    color: var(--theme-muted);

    font-size: 11px;

    font-weight: 600;

    line-height: 1;

    transform: translate(-50%, -50%);

    transition: opacity .14s ease;

}



.crm-row-select-head input,

.crm-row-select-cell input {

    position: absolute;

    inset: 50% auto auto 50%;

    transform: translate(-50%, -50%);

}



@media (hover:hover) and (pointer:fine) {

    .crm-row-select-head input:not(:checked),

    .crm-row-select-cell input:not(:checked) {

        opacity: 0;

        pointer-events: none;

    }



    .crm-row-select-head:hover .crm-row-number,

    tr:hover .crm-row-select-cell .crm-row-number,

    tr:focus-within .crm-row-select-cell .crm-row-number,

    tr.crm-row-selected .crm-row-select-cell .crm-row-number {

        opacity: 0;

    }



    .crm-row-select-head:hover input,

    tr:hover .crm-row-select-cell input,

    tr:focus-within .crm-row-select-cell input,

    tr.crm-row-selected .crm-row-select-cell input {

        opacity: 1;

        pointer-events: auto;

    }

}



.page-content table :is(.leads-status-pill, .leads-outcome-pill, .assignment-status-text, .campaign-status-text, .team-status-badge, .invoice-status, .followup-filter-badge) {

    min-height: 0;

    padding: 0;

    border: 0;

    border-radius: 0;

    background: transparent;

    box-shadow: none;

    color: var(--theme-text);

    font-size: 12px;

    font-weight: 500;

}



.page-content :is(.dashboard-stat-card, .team-stat-card, .assignment-stat-card, .followup-stat-card) {

    min-height: 84px;

    padding: 12px 14px;

}

.scalymise-login .login-card {
    width: min(800px, 100%);
    min-height: 440px;
    border-radius: 16px;
    box-shadow: var(--theme-shadow);
    animation: none;
}

.scalymise-login :is(.login-logo-panel, .login-form-panel) {
    min-height: 440px;
    padding: 36px;
    animation: none;
}

.scalymise-login .login-logo-panel {
    background: #101b31;
}

.scalymise-login .login-logo-panel::before,
.scalymise-login .login-logo-panel::after {
    display: none;
}

.scalymise-login :is(.login-logo-wrap, .login-logo, .login-heading, .login-form, .login-field, .login-submit) {
    animation: none;
}

.scalymise-login .login-heading h1 {
    font-size: 28px;
    font-weight: 650;
    letter-spacing: -.6px;
}

.scalymise-login .login-field label {
    font-size: 12px;
    font-weight: 500;
}

.scalymise-login .login-field :is(input, select),
.scalymise-login .login-submit {
    min-height: 44px;
    font-size: 14px;
    border-radius: 8px;
}

.scalymise-login .login-submit {
    box-shadow: none;
    transform: none;
    font-weight: 600;
}



@media(max-width:1280px) {

    .page-content .calling-layout {
        grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
    }

    .page-content .calling-details-card {
        grid-column: 1/-1;
    }

}

@media(max-width:1000px) {

    .topbar-date {
        display: none;
    }

    .page-content .leads-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-content .leads-filter-form.is-status-module {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-content :is(.dashboard-grid, .settings-layout) {
        grid-template-columns: minmax(0, 1fr);
    }

}

@media(max-width:900px) {

    :root,
    body.sidebar-collapsed {
        --sidebar-width: 0px;
    }

    .crm-main,
    body.sidebar-collapsed .crm-main {
        width: 100%;
        margin-left: 0;
    }

    .sidebar {
        width: min(280px, calc(100vw - 56px));
        transform: translateX(-100%);
        transition: transform .18s var(--ui-ease);
        box-shadow: none;
    }

    body.sidebar-mobile-open .sidebar {
        transform: none;
        box-shadow: 10px 0 36px rgba(0, 0, 0, .2);
    }

    .sidebar .sidebar-collapse-toggle,
    .sidebar-resize-handle {
        display: none;
    }

    .sidebar .sidebar-brand {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .crm-mobile-nav-toggle {
        display: grid;
        place-items: center;
        flex: none;
        width: 44px;
        height: 44px;
        padding: 9px;
        border: 1px solid var(--theme-border);
        background: var(--theme-surface);
        color: var(--theme-text);
        border-radius: 8px;
    }

    .crm-mobile-nav-toggle svg {
        width: 20px;
        height: 20px;
        stroke: currentColor;
        stroke-width: 1.7;
        fill: none;
    }

    .crm-mobile-backdrop:not([hidden]) {
        display: block;
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100dvh;
        border: 0;
        background: rgba(5, 12, 25, .58);
        z-index: 950;
    }

    .topbar {
        padding: 12px 20px;
    }

    .topbar-right {
        gap: 8px;
    }

    .topbar-user-info {
        display: none;
    }

}

@media(max-width:700px) {

    .page-content {
        padding: 16px;
    }

    .page-content h1 {
        font-size: 26px;
    }

    .topbar {
        height: auto;
        min-height: 72px;
        padding: 12px 16px;
        gap: 8px;
    }

    .topbar-search {
        flex: 1;
        max-width: none;
    }

    .topbar-user {
        display: none;
    }

    .page-content .dashboard-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-content :is(.team-stats, .followup-stats, .calling-summary-grid, .assignment-stats) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-content :is(.calling-layout, .settings-layout, .dashboard-grid) {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .page-content :is(.calling-contact-grid, .calling-form-grid, .invoice-form-grid, .invoice-client-grid, .team-form-grid, .edit-lead-grid, .followup-form-grid, .settings-form-grid, .form-row, .assignment-filters, .assignment-filter-form, .invoice-payment-fields, .invoice-discount-fields, .recycle-filter-form) {
        grid-template-columns: minmax(0, 1fr);
    }

    .page-content :is(.invoice-top-actions, .leads-filter-actions, .assignment-actions, .recycle-actions) {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
    }

    .page-content .dashboard-report-form>label {
        min-width: 0;
        flex: 1 1 calc(50% - 12px);
    }

    .page-content .dashboard-report-form>label:first-child {
        flex-basis: 100%;
    }

    .crm-date-range {
        width: 100%;
        min-width: 0;
    }

    .crm-range-picker {
        max-height: calc(100dvh - 24px);
        overflow: auto;
    }

    .crm-range-picker-layout {
        grid-template-columns: 1fr;
    }

    .crm-range-presets {
        max-height: 150px;
        border-right: 0;
        border-bottom: 1px solid var(--theme-border);
    }

    .crm-range-months {
        grid-template-columns: 1fr;
    }

    .crm-range-month:nth-child(2) {
        display: none;
    }

    .page-content .dashboard-report-cards {
        grid-template-columns: 1fr;
    }

    .page-content .leads-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-content .leads-filter-form>input[type="search"],
    .page-content .leads-filter-actions {
        grid-column: 1/-1;
    }

    .page-content :is(.dashboard-stat-card, .calling-summary-card, .team-stat-card, .assignment-stat-card, .followup-stat-card) {
        padding: 16px;
        min-height: 106px;
    }

    .page-content :is(.btn-primary, .btn-secondary, .invoice-btn, .team-btn, .assignment-btn, .leads-filter-btn, .recycle-btn, .settings-save-btn, .call-status-btn) {
        min-height: 44px;
    }

    .crm-date-button,
    .crm-select-trigger {
        min-height: 44px;
    }

    :is(.crm-modal, .crm-lead-modal, .followup-modal, .team-modal, .invoice-modal) {
        padding: 12px;
    }

    :is(.crm-modal-box, .crm-lead-modal-body, .followup-modal-box, .team-modal-box, .invoice-modal-box) {
        width: 100%;
        max-height: calc(100dvh - 24px);
    }

    :is(.crm-modal, .crm-lead-modal, .followup-modal, .team-modal, .invoice-modal) :is(.form-row, .invoice-form-grid, .team-form-grid, .edit-lead-grid, .followup-form-grid, .invoice-payment-fields, .invoice-discount-fields) {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    :is(.crm-form, .invoice-form, .team-form) {
        padding: 16px;
    }

    .notification-panel,
    .crm-global-search-results {
        position: fixed;
        top: 72px;
        left: 16px;
        right: 16px;
        width: auto;
    }

    .scalymise-login .login-card {
        grid-template-columns: 1fr;
    }

    .scalymise-login .login-logo-panel {
        min-height: 140px;
        padding: 24px;
    }

    .scalymise-login .login-form-panel {
        min-height: 0;
        padding: 28px 24px;
    }

    .scalymise-login .login-logo-wrap {
        width: 120px;
    }

}

@media(max-width:420px) {

    .topbar-right {
        gap: 4px;
    }

    .topbar-right :is(.theme-toggle, .notification-toggle) {
        width: 36px;
    }

    .page-content .leads-filter-form {
        grid-template-columns: 1fr;
    }

    .page-content .leads-filter-actions {
        grid-column: auto;
    }

    .page-content .dashboard-stat-card strong {
        font-size: 27px;
    }

    .page-content .call-status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media(prefers-reduced-motion:reduce) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

}



/* ==========================================================
   SCALYMISE CRM — INVOICE EDIT MODAL THEME FIX
   Keeps the invoice modal scrollbar and native dropdowns
   aligned with the active CRM theme.
   ========================================================== */

.invoice-modal,
.invoice-modal .invoice-modal-box {
    color: var(--theme-text, #14213D);
}

.invoice-modal .invoice-modal-box {
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb, var(--ui-scroll-thumb, #52627C)) var(--scroll-track, var(--ui-scroll-track, #101B31));
    overscroll-behavior: contain;
}

.invoice-modal .invoice-modal-box::-webkit-scrollbar,
.invoice-modal .invoice-modal-box *::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

.invoice-modal .invoice-modal-box::-webkit-scrollbar-track,
.invoice-modal .invoice-modal-box *::-webkit-scrollbar-track {
    background: var(--scroll-track, var(--ui-scroll-track, #101B31));
    border-radius: 10px;
}

.invoice-modal .invoice-modal-box::-webkit-scrollbar-thumb,
.invoice-modal .invoice-modal-box *::-webkit-scrollbar-thumb {
    background: var(--scroll-thumb, var(--ui-scroll-thumb, #52627C));
    border: 2px solid var(--scroll-track, var(--ui-scroll-track, #101B31));
    border-radius: 10px;
}

.invoice-modal .invoice-modal-box::-webkit-scrollbar-thumb:hover,
.invoice-modal .invoice-modal-box *::-webkit-scrollbar-thumb:hover {
    background: var(--gold, #FCA311);
}

.invoice-modal .invoice-form select,
.invoice-modal .invoice-form .form-select,
.invoice-modal .invoice-modal-box select {
    color: var(--theme-text, #F1F5FB);
    background-color: var(--theme-surface-soft, #182743);
    border: 1px solid var(--theme-border, #293952);
    border-radius: var(--ui-control-radius, 8px);
    color-scheme: dark;
}

.invoice-modal .invoice-form select:focus,
.invoice-modal .invoice-form .form-select:focus,
.invoice-modal .invoice-modal-box select:focus {
    border-color: var(--gold, #FCA311);
    outline: none;
    box-shadow: 0 0 0 3px rgba(252, 163, 17, 0.15);
}

.invoice-modal .invoice-form select option,
.invoice-modal .invoice-form .form-select option,
.invoice-modal .invoice-modal-box select option {
    color: #F1F5FB;
    background-color: #182743;
}

/* Respect light mode when the CRM theme is switched. */
html:not([data-theme="dark"]) .invoice-modal .invoice-form select,
html:not([data-theme="dark"]) .invoice-modal .invoice-form .form-select,
html:not([data-theme="dark"]) .invoice-modal .invoice-modal-box select {
    color: var(--theme-text, #14213D);
    background-color: var(--theme-surface-soft, #F8F9FC);
    color-scheme: light;
}

html:not([data-theme="dark"]) .invoice-modal .invoice-form select option,
html:not([data-theme="dark"]) .invoice-modal .invoice-form .form-select option,
html:not([data-theme="dark"]) .invoice-modal .invoice-modal-box select option {
    color: #14213D;
    background-color: #FFFFFF;
}

/* ==========================================================
   INVOICE EDIT POPUP — FINAL THEME OVERRIDES
   Keep these scoped rules at the end of ui.css so they win over
   earlier shared control and modal rules.
   ========================================================== */

/* Scrollbars for the modal shell and invoice-edit document/card. */
html:has(.invoice-edit-card),
body:has(.invoice-edit-card),
.invoice-modal,
.invoice-modal .invoice-modal-box,
.invoice-edit-card {
    scrollbar-width: thin !important;
    scrollbar-color: var(--ui-scroll-thumb, #52627c) var(--ui-scroll-track, #101b31) !important;
}

html:has(.invoice-edit-card)::-webkit-scrollbar,
body:has(.invoice-edit-card)::-webkit-scrollbar,
.invoice-modal::-webkit-scrollbar,
.invoice-modal .invoice-modal-box::-webkit-scrollbar,
.invoice-edit-card::-webkit-scrollbar,
.invoice-edit-card *::-webkit-scrollbar,
.invoice-modal .invoice-modal-box *::-webkit-scrollbar {
    width: 10px !important;
    height: 10px !important;
}

html:has(.invoice-edit-card)::-webkit-scrollbar-track,
body:has(.invoice-edit-card)::-webkit-scrollbar-track,
.invoice-modal::-webkit-scrollbar-track,
.invoice-modal .invoice-modal-box::-webkit-scrollbar-track,
.invoice-edit-card::-webkit-scrollbar-track,
.invoice-edit-card *::-webkit-scrollbar-track,
.invoice-modal .invoice-modal-box *::-webkit-scrollbar-track {
    background: var(--ui-scroll-track, #101b31) !important;
    border-radius: 10px;
}

html:has(.invoice-edit-card)::-webkit-scrollbar-thumb,
body:has(.invoice-edit-card)::-webkit-scrollbar-thumb,
.invoice-modal::-webkit-scrollbar-thumb,
.invoice-modal .invoice-modal-box::-webkit-scrollbar-thumb,
.invoice-edit-card::-webkit-scrollbar-thumb,
.invoice-edit-card *::-webkit-scrollbar-thumb,
.invoice-modal .invoice-modal-box *::-webkit-scrollbar-thumb {
    background: var(--ui-scroll-thumb, #52627c) !important;
    border: 2px solid var(--ui-scroll-track, #101b31) !important;
    border-radius: 10px;
}

html:has(.invoice-edit-card)::-webkit-scrollbar-thumb:hover,
body:has(.invoice-edit-card)::-webkit-scrollbar-thumb:hover,
.invoice-modal::-webkit-scrollbar-thumb:hover,
.invoice-modal .invoice-modal-box::-webkit-scrollbar-thumb:hover,
.invoice-edit-card::-webkit-scrollbar-thumb:hover,
.invoice-edit-card *::-webkit-scrollbar-thumb:hover,
.invoice-modal .invoice-modal-box *::-webkit-scrollbar-thumb:hover {
    background: var(--gold, #FCA311) !important;
}

/* Discount Type, Select Bank, and invoice form selects. */
:is(.invoice-edit-card, .invoice-edit-form, .invoice-form, .invoice-discount-fields, .invoice-payment-fields, .invoice-modal) select,
.invoice-edit-card select,
.invoice-modal .invoice-modal-box select {
    min-height: 40px !important;
    max-width: 100%;
    padding: 9px 12px !important;
    color: var(--theme-text, #F1F5FB) !important;
    background-color: var(--theme-surface-soft, #182743) !important;
    border: 1px solid var(--theme-border, #293952) !important;
    border-radius: 8px !important;
    color-scheme: dark;
    box-shadow: none !important;
}

:is(.invoice-edit-card, .invoice-edit-form, .invoice-form, .invoice-discount-fields, .invoice-payment-fields, .invoice-modal) select:focus,
.invoice-edit-card select:focus,
.invoice-modal .invoice-modal-box select:focus {
    color: var(--theme-text, #F1F5FB) !important;
    background-color: var(--theme-surface-soft, #182743) !important;
    border-color: var(--gold, #FCA311) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(252, 163, 17, .16) !important;
}

:is(.invoice-edit-card, .invoice-edit-form, .invoice-form, .invoice-discount-fields, .invoice-payment-fields, .invoice-modal) select option,
.invoice-edit-card select option,
.invoice-modal .invoice-modal-box select option {
    color: #F1F5FB !important;
    background: #182743 !important;
}

html:not([data-theme="dark"]) :is(.invoice-edit-card, .invoice-edit-form, .invoice-form, .invoice-discount-fields, .invoice-payment-fields) select {
    color-scheme: light;
    color: #14213D !important;
    background-color: #FFFFFF !important;
    border-color: #D8E0EC !important;
}

html:not([data-theme="dark"]) :is(.invoice-edit-card, .invoice-edit-form, .invoice-form, .invoice-discount-fields, .invoice-payment-fields) select option {
    color: #14213D !important;
    background: #FFFFFF !important;
}



/* FINAL FIX: native invoice dropdown selected-option theme */
/* Keep the native select control and its option list aligned with Scalymise navy/gold. */
:is(.invoice-edit-card, .invoice-edit-form, .invoice-form, .invoice-discount-fields, .invoice-payment-fields, .invoice-modal) select,
.invoice-modal .invoice-modal-box select {
    color-scheme: dark !important;
    accent-color: #FFCD00;
}

:is(.invoice-edit-card, .invoice-edit-form, .invoice-form, .invoice-discount-fields, .invoice-payment-fields, .invoice-modal) select option,
.invoice-modal .invoice-modal-box select option {
    color: #F7F9FC !important;
    background-color: #192844 !important;
}

:is(.invoice-edit-card, .invoice-edit-form, .invoice-form, .invoice-discount-fields, .invoice-payment-fields, .invoice-modal) select option:checked,
.invoice-modal .invoice-modal-box select option:checked {
    color: #14213D !important;
    background: #FFCD00 linear-gradient(0deg, #FFCD00 0%, #FFCD00 100%) !important;
}

:is(.invoice-edit-card, .invoice-edit-form, .invoice-form, .invoice-discount-fields, .invoice-payment-fields, .invoice-modal) select:focus,
.invoice-modal .invoice-modal-box select:focus {
    border-color: #FFCD00 !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(255, 205, 0, .16) !important;
}