/* Applies to authenticated workspace screens that use the shared header. */
@media screen {
    body {
        --crm-navy: #0b2446;
        --crm-blue: #0759cb;
        --crm-ink: #102747;
        --crm-canvas: #f1f5fb;
        --crm-surface: #fff;
        --crm-line: #dce6f4;
        --crm-table-heading: #e9f1fc;
        --crm-radius: 14px;
        --crm-control-radius: 8px;
        --crm-shadow: 0 5px 16px rgba(30, 54, 94, .08);
        --crm-font: "Inter", "Poppins", "Segoe UI", Arial, sans-serif;
        --crm-header-height: 70px;
    }
    body:has(.crm-header) .page-wrapper {
        padding-top: 0 !important;
        background: var(--crm-canvas) !important;
    }
    body:has(.crm-header) .left-sidebar {
        padding-top: var(--crm-header-height) !important;
        background: linear-gradient(165deg, #081b37, #123660);
        border-right: 0;
    }
    body:has(.crm-header) :is(.sidebar-nav, #sidebarnav ul) { background: transparent; }
    body:has(.crm-header) #sidebarnav :is(a, a i, .nav-label) { color: #eff6ff !important; }
    body:has(.crm-header) #sidebarnav a { font-size: .85rem; line-height: 1.3; }
    body:has(.crm-header) #sidebarnav li.active > a,
    body:has(.crm-header) #sidebarnav a:hover { background: #1d4678; transform: none; }
    body:has(.crm-header) #sidebarnav a.active { background: var(--crm-blue); }
    body:has(.crm-header) #sidebarnav :is(a:focus-visible, a:hover) { outline-color: white; }
    body:has(.crm-header) #sidebarnav .has-arrow::after { border-color: #9fbee5; }
    @media (min-width: 768px) {
        body:has(.crm-header).mini-sidebar #sidebarnav > li:hover > ul { background: var(--crm-navy); }
    }
    .header.crm-header, .header.crm-header .top-navbar {
        background: #fff !important;
        color: var(--crm-ink);
    }
    .header.crm-header .top-navbar {
        height: var(--crm-header-height);
        min-height: var(--crm-header-height);
        padding: 0 .75rem 0 0;
        border-radius: 0;
        box-shadow: 0 2px 10px rgba(16, 39, 71, .1);
    }
    .header.crm-header .navbar-header {
        align-self: stretch;
        background: var(--crm-navy) !important;
        box-shadow: none;
    }
    .header.crm-header .navbar-brand {
        justify-content: center;
        width: 100%;
        height: 100%;
        min-height: 0;
        margin: 0;
        padding: .55rem .9rem !important;
        background: transparent;
    }
    .header.crm-header .navbar-brand img.dark-logo {
        display: block;
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 51px;
        object-fit: contain;
    }
    .header.crm-header .navbar-collapse { min-width: 0; align-items: center; }
    .header.crm-header .nav-link,
    .header.crm-header .nav-link i,
    .header.crm-header .iv-header-clock { color: var(--crm-ink) !important; }
    .header.crm-header .iv-header-clock { margin-inline: auto; border-color: var(--crm-line); font-size: .81rem; }
    .crm-module-identity {
        display: flex;
        gap: .65rem;
        align-items: center;
        min-width: 0;
        margin-inline: .6rem;
    }
    .crm-module-identity > i {
        display: grid;
        place-items: center;
        flex: 0 0 2.25rem;
        height: 2.25rem;
        border-radius: .55rem;
        background: #eaf3ff;
        color: var(--crm-blue);
        font-size: 1.04rem;
    }
    .crm-module-identity strong, .crm-profile-name strong { display: block; line-height: 1.2; }
    .crm-module-identity strong { font-size: 1.05rem; }
    .crm-module-identity small, .crm-profile-name small { display: block; line-height: 1.25; }
    .crm-profile-name { margin-left: .45rem; }
    .header.crm-header .profile-pic { border: 1px solid var(--crm-line); }
    .header.crm-header .navbar-nav:last-child { flex-shrink: 0; }
    .header.crm-header .nav-link:has(.profile-pic) {
        width: auto;
        max-width: 13rem;
        display: flex;
        align-items: center;
        padding-inline: .3rem;
    }
    .crm-profile-name { min-width: 0; }
    .crm-profile-name :is(strong, small) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .header.crm-header .profile-pic { flex-shrink: 0; }
    body:has(.crm-header) .page-wrapper :is(button, a, input, select, textarea):focus-visible {
        outline: 2px solid var(--crm-blue);
        outline-offset: 2px;
    }
    body:has(.crm-header) :is(.page-wrapper, .modal-content) {
        font-family: var(--crm-font);
    }
    body:has(.crm-header) .page-wrapper :is(.card, .panel, .iv-module-card, .inventory-panel),
    body:has(.crm-header) .modal-content {
        border-color: var(--crm-line);
        border-radius: var(--crm-radius) !important;
        box-shadow: var(--crm-shadow) !important;
    }
    body:has(.crm-header) .page-wrapper .card-body {
        border-radius: inherit;
    }
    body:has(.crm-header) .page-wrapper :is(.page-titles, .breadcrumb) {
        background: transparent !important;
    }
    body:has(.crm-header) .page-wrapper :is(.cash-hero, .auth-hero, .abonos-hero, .ops-report-hero, .about-hero) {
        background: linear-gradient(125deg, var(--crm-navy), var(--crm-blue)) !important;
        border-radius: var(--crm-radius) !important;
        box-shadow: var(--crm-shadow) !important;
    }
    body:has(.crm-header) :is(.page-wrapper, .modal) :is(.form-control, .custom-select, .input-group-text, .btn),
    .crm-auth-surface :is(.form-control, .btn) {
        border-radius: var(--crm-control-radius);
    }
    body:has(.crm-header) :is(.page-wrapper, .modal) :is(.form-control, .custom-select):focus,
    .crm-auth-surface .form-control:focus {
        border-color: var(--crm-blue);
        box-shadow: 0 0 0 .17rem rgba(7, 89, 203, .15);
    }
    body:has(.crm-header) :is(.page-wrapper, .modal) :is(.form-control, .custom-select):disabled {
        background-color: #edf2f9;
    }
    body:has(.crm-header) .page-wrapper .page-titles h3 { color: var(--crm-ink) !important; }
    body:has(.crm-header) :is(.page-wrapper, .modal) :is(.btn-primary, .btn-info) {
        background: var(--crm-blue) !important;
        border-color: var(--crm-blue) !important;
        color: #fff !important;
    }
    body:has(.crm-header) :is(.page-wrapper, .modal) :is(.btn-primary, .btn-info) > i { color: #fff !important; }
    body:has(.crm-header) :is(.page-wrapper, .modal) .btn-outline-primary {
        color: var(--crm-blue) !important;
        border-color: var(--crm-blue);
    }
    body:has(.crm-header) :is(.page-wrapper, .modal) .btn-outline-primary:is(:hover, :active, .active) {
        background-color: var(--crm-blue);
        color: #fff !important;
    }
    body:has(.crm-header) :is(.page-wrapper, .modal) :is(.table, .dataTable) thead th {
        background-color: var(--crm-table-heading) !important;
        border-color: var(--crm-line);
    }
    body:has(.crm-header) :is(.page-wrapper, .modal) :is(.table, .dataTable) tbody td {
        border-color: var(--crm-line);
    }
    body:has(.crm-header) :is(.page-wrapper, .modal) :is(.alert, .table-responsive, .dataTables_scroll) {
        border-radius: var(--crm-control-radius);
    }
    .crm-breadcrumb { padding: .55rem 0; font-size: .83rem; }
    .crm-commercial-page .crm-list-surface { padding: clamp(.75rem, 2vw, 1.25rem); }
    .crm-list-toolbar, .crm-state-tabs, .crm-list-pagination {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: .55rem;
    }
    .crm-list-toolbar { justify-content: space-between; margin-bottom: 1rem; }
    .crm-state-tabs a {
        display: inline-flex;
        align-items: center;
        gap: .35rem;
        padding: .52rem .72rem;
        border-radius: .55rem;
        border: 1px solid var(--crm-line);
        background: #eaf2fc;
        color: var(--crm-ink);
        font-weight: 700;
        font-size: .82rem;
    }
    .crm-state-tabs a[aria-current] { background: var(--crm-blue); color: #fff; border-color: var(--crm-blue); }
    .crm-list-filters {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
        gap: .6rem;
        align-items: end;
        margin-bottom: .9rem;
    }
    .crm-list-filters label { margin: 0; font-size: .79rem; font-weight: 700; }
    .crm-list-filters :is(input, select) { margin-top: .2rem; font-family: inherit; }
    .crm-list-filter-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
    .crm-list-scroll { overflow-x: auto; border: 1px solid var(--crm-line); border-radius: .65rem; }
    .crm-list-surface .crm-list-table { min-width: 760px; font-family: inherit; }
    .crm-list-surface .crm-list-table :is(td, th) { padding: .45rem .55rem; vertical-align: middle; line-height: 1.35; font-family: inherit; }
    .crm-list-surface .crm-list-table td:last-child,
    .crm-list-surface .crm-list-table th:last-child { min-width: 10rem; text-align: left; }
    .crm-list-table :is(.order-action-buttons, .quote-action-buttons) { display: flex; flex-wrap: wrap; gap: .3rem; }
    .crm-list-surface .crm-list-table :is(.order-action-buttons, .quote-action-buttons) .btn {
        width: 1.9rem;
        min-width: 1.9rem;
        height: 1.9rem;
        min-height: 1.9rem;
        padding: 0;
        margin: 0;
        display: inline-grid;
        place-items: center;
    }
    .crm-list-surface .crm-list-table .order-action-buttons form { width: auto; }
    .crm-list-table .crm-list-money { text-align: right; white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
    .crm-list-code { display: inline-block; white-space: nowrap; background: #def0ff; padding: .15rem .42rem; border-radius: .4rem; font-weight: 700; }
    .crm-badge {
        display: inline-block;
        padding: .16rem .44rem;
        border-radius: .5rem;
        white-space: nowrap;
        font-size: .77rem;
        font-weight: 700;
    }
    .crm-badge.crm-badge--success { background: #d9f4e4; color: #125c33 !important; }
    .crm-badge.crm-badge--warning { background: #fff1c7; color: #725000 !important; }
    .crm-badge.crm-badge--info { background: #dceaff; color: #174c9b !important; }
    .crm-badge.crm-badge--danger { background: #ffe1e5; color: #8a172d !important; }
    .crm-badge.crm-badge--neutral { background: #e8edf5; color: #344763 !important; }
    .crm-list-pagination { margin-top: 1rem; font-size: .82rem; }
    .crm-list-pagination form { margin-left: auto; }
    .crm-list-pagination select { margin: 0 .2rem; }
    .crm-list-pagination nav { display: flex; align-items: center; gap: .2rem; }
    .crm-list-pagination nav > * { padding: .3rem .5rem; border: 1px solid var(--crm-line); border-radius: .3rem; }
    .crm-list-pagination nav [aria-current] { background: var(--crm-blue); color: #fff; }
    .crm-list-pagination nav [aria-disabled] { color: #697990; }

    @media (max-width: 1023px) {
        .header.crm-header .iv-header-clock, .crm-profile-name { display: none; }
    }
    @media (max-width: 767px) {
        body:has(.crm-header) { --crm-header-height: 62px; }
        body:has(.crm-header) .page-wrapper { margin-left: 0 !important; padding-top: var(--crm-header-height) !important; }
        .header.crm-header .nav-toggler.hidden-md-up { display: inline-flex !important; }
        .header.crm-header .sidebartoggler.hidden-sm-down { display: none !important; }
        .crm-state-tabs { width: 100%; flex-wrap: nowrap; overflow-x: auto; padding: .15rem .15rem .45rem; }
        .crm-state-tabs a { flex-shrink: 0; white-space: nowrap; }
        .crm-list-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .crm-list-filters :is(input, select) { min-width: 0; font-size: .8rem; }
        .crm-list-pagination form { margin-left: 0; }
        .header.crm-header .navbar-header { width: 3.25rem; flex: 0 0 3.25rem; }
        .header.crm-header .navbar-brand { padding: .3rem !important; }
        .crm-module-identity { margin-inline: .25rem; }
        .crm-module-identity > i, .crm-module-identity small { display: none; }
        .crm-module-identity strong { font-size: .82rem; overflow-wrap: anywhere; }
        .header.crm-header .nav-link { padding-inline: .3rem !important; }
    }
}

@media screen {
    .crm-dashboard-welcome, .crm-dashboard-links {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: .6rem;
    }
    .crm-dashboard-welcome { margin-bottom: 1rem; }
    .crm-dashboard-welcome h1 { font-size: clamp(1.35rem, 2.3vw, 1.8rem); color: var(--crm-ink); margin: 0 0 .2rem; }
    .crm-dashboard-welcome p { margin: 0; font-family: inherit; }
    .crm-dashboard-metrics {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: .7rem;
        margin-bottom: .8rem;
    }
    .crm-dashboard-metrics--1 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .crm-dashboard-metric {
        --metric-color: #0759cb;
        --metric-tint: #eef5ff;
        display: flex;
        align-items: center;
        gap: .7rem;
        padding: .75rem;
        border: 1px solid var(--crm-line);
        border-radius: .8rem;
        background: linear-gradient(125deg, #fff, var(--metric-tint));
        box-shadow: 0 .2rem .65rem rgba(16, 39, 71, .08);
        color: var(--crm-ink);
    }
    .crm-dashboard-metric:hover { color: var(--crm-ink); }
    .crm-dashboard-metric--green { --metric-color: #087740; --metric-tint: #eaf8f0; }
    .crm-dashboard-metric--cyan { --metric-color: #006c9e; --metric-tint: #eaf8ff; }
    .crm-dashboard-metric--purple { --metric-color: #6537bf; --metric-tint: #f6efff; }
    .crm-dashboard-metric--pink { --metric-color: #aa2469; --metric-tint: #fff1f7; }
    .crm-dashboard-metric--orange { --metric-color: #915100; --metric-tint: #fff6e8; }
    .crm-dashboard-metric--red { --metric-color: #b32532; --metric-tint: #fff0f2; }
    .crm-dashboard-metric i {
        display: grid;
        place-items: center;
        flex: 0 0 2.5rem;
        height: 2.5rem;
        border-radius: .65rem;
        background: var(--metric-color);
        color: #fff;
        font-size: 1.15rem;
    }
    .crm-dashboard-metric :is(b, strong, small) { display: block; line-height: 1.25; }
    .crm-dashboard-metric b { color: var(--metric-color); font-size: .81rem; }
    .crm-dashboard-metric strong { margin: .15rem 0; font-size: clamp(1rem, 1.45vw, 1.35rem); overflow-wrap: anywhere; }
    .crm-dashboard-activity { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: .85rem; }
    .crm-dashboard-activity-panel .dashboard-section-title { display: none; }
    .crm-dashboard-activity-panel .card-body { padding: .75rem; }
    .crm-dashboard-activity-panel .card-title { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem; }
    .crm-dashboard-activity-panel .table { min-width: 23rem; font-family: inherit; }
    .crm-dashboard-activity-panel:first-child .table { min-width: 41rem; }
    .crm-dashboard-activity-panel .table :is(td, th) { padding: .38rem .45rem; line-height: 1.3; font-family: inherit; }
    .crm-dashboard-activity-panel .table td:is(:first-child, :nth-child(2), .crm-list-money) { white-space: nowrap; }
    .crm-dashboard-activity-panel .table td.crm-list-money { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
    .crm-dashboard .crm-dashboard-alert {
        display: flex;
        gap: .65rem;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        padding: .6rem .8rem;
        margin-bottom: .55rem;
        border-radius: .55rem;
    }
    .crm-dashboard .crm-dashboard-alert--approval {
        background: #eaf2ff !important;
        border: 1px solid #c8def9 !important;
        color: #174c9b !important;
    }
    .crm-dashboard .crm-dashboard-alert :is(i, strong) { color: inherit !important; }
    .crm-dashboard-alert .btn { margin-left: auto; }
    .crm-dashboard-activity-panel :is(td, th):last-child { min-width: 0; }
    .crm-activity-link { font-size: .78rem; }
    .crm-client-details { font-size: .75rem; margin-top: .15rem; }
    @media (max-width: 1250px) {
        .crm-dashboard-metrics--0 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
        .crm-dashboard-activity { grid-template-columns: minmax(0, 1fr); }
    }
    @media (max-width: 650px) {
        .crm-dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .crm-dashboard-metric { padding: .55rem; gap: .4rem; }
        .crm-dashboard-metric i { flex-basis: 1.65rem; height: 1.65rem; font-size: .82rem; }
    }
}

@media screen {
    .crm-list-view { text-align: right; margin-bottom: .55rem; }
    .crm-list-view [aria-pressed="true"] { background: var(--crm-blue); border-color: var(--crm-blue); color: #fff; }
    .crm-card-label { display: none; }
    .crm-list-surface .crm-list-table--cards { display: block; min-width: 0; }
    .crm-list-table--cards thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
    .crm-list-table--cards tbody {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 17.5rem), 1fr));
        gap: .65rem;
        padding: .65rem;
        background: var(--crm-canvas);
    }
    .crm-list-table--cards tbody tr {
        display: flex;
        flex-direction: column;
        padding: .5rem;
        border: 1px solid var(--crm-line);
        border-radius: .65rem;
        background: #fff !important;
    }
    .crm-list-surface .crm-list-table--cards tbody td {
        display: block;
        padding: .28rem .4rem;
        border: 0;
        text-align: left;
        white-space: normal;
    }
    .crm-list-table--cards .crm-card-label { display: block; font-size: .72rem; color: #415775; }
}

@media screen {
    body .crm-auth-surface {
        background: var(--crm-surface);
        border: 1px solid var(--crm-line);
        border-radius: var(--crm-radius);
        box-shadow: var(--crm-shadow);
        font-family: var(--crm-font);
    }
    .crm-auth-surface :is(button, a, input):focus-visible { outline: 2px solid var(--crm-blue); outline-offset: 2px; }
    .crm-public-page { background: var(--crm-canvas); color: var(--crm-ink); }
}
