/* HyperSoft CRM — layout administrativo (extensão do design system) */

body.page-crm {
    --sidebar-w: 260px;
    --sidebar-w-mini: 76px;
    --topbar-h: 64px;
}

/* Reset estilos globais do site (header/nav fixos e largura --container) */
body.page-crm header.crm-topbar {
    position: sticky;
    top: 0;
    left: auto;
    right: auto;
    width: 100%;
    height: var(--topbar-h);
    z-index: 100;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(11, 18, 32, 0.06);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    box-shadow: none;
}

body.page-crm header.crm-topbar::before {
    display: none;
}

body.page-crm .crm-sidebar .sidebar-nav {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
}

body.page-crm .global-bg-shape {
    opacity: 0.2;
}

.crm-shell {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.crm-sidebar {
    width: var(--sidebar-w);
    max-width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border-right: 1px solid rgba(11, 18, 32, 0.08);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    overflow: hidden;
    transition: width 0.25s var(--ease-out), transform var(--transition);
    box-sizing: border-box;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem 0.85rem;
    border-bottom: 1px solid rgba(11, 18, 32, 0.06);
    flex-shrink: 0;
}

.sidebar-brand .logo-link {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.sidebar-brand .logo-img {
    height: 32px;
    max-width: 100%;
    transition: opacity 0.2s var(--ease-out);
}

.sidebar-brand .logo-img--icon {
    display: none;
    height: 36px;
    width: 36px;
    object-fit: contain;
}

.sidebar-collapse-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-muted);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: var(--transition);
}

.sidebar-collapse-btn:hover {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-indigo);
}

.sidebar-link-label {
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s var(--ease-out), width 0.25s var(--ease-out);
}

.sidebar-user-text {
    min-width: 0;
    overflow: hidden;
    transition: opacity 0.2s var(--ease-out), width 0.25s var(--ease-out);
}

/* Sidebar minimizada (desktop) */
@media (min-width: 1025px) {
    body.page-crm.sidebar-collapsed {
        --sidebar-w: var(--sidebar-w-mini);
    }

    body.page-crm.sidebar-collapsed .crm-sidebar {
        overflow: visible;
    }

    body.page-crm.sidebar-collapsed .sidebar-brand {
        flex-direction: column;
        align-items: center;
        gap: 0.6rem;
        padding: 0.85rem 0.4rem 0.7rem;
    }

    body.page-crm.sidebar-collapsed .sidebar-brand .logo-link {
        flex: 0 0 auto;
        justify-content: center;
        width: 100%;
    }

    body.page-crm.sidebar-collapsed .sidebar-brand .logo-img--full {
        display: none;
    }

    body.page-crm.sidebar-collapsed .sidebar-brand .logo-img--icon {
        display: block;
        height: 34px;
        width: 34px;
        margin: 0 auto;
    }

    body.page-crm.sidebar-collapsed .sidebar-collapse-btn {
        width: 36px;
        height: 32px;
        border-radius: 8px;
    }

    body.page-crm.sidebar-collapsed .sidebar-collapse-btn i {
        transform: rotate(180deg);
    }

    body.page-crm.sidebar-collapsed .sidebar-nav {
        padding: 0.45rem 0.4rem;
        gap: 0.12rem;
    }

    body.page-crm.sidebar-collapsed .sidebar-nav-group {
        margin-bottom: 0;
    }

    body.page-crm.sidebar-collapsed .sidebar-nav-group + .sidebar-nav-group {
        margin-top: 0.3rem;
        padding-top: 0.4rem;
        border-top: 1px solid rgba(11, 18, 32, 0.08);
    }

    body.page-crm.sidebar-collapsed .sidebar-link-label,
    body.page-crm.sidebar-collapsed .sidebar-user-text {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
        opacity: 0;
        pointer-events: none;
    }

    body.page-crm.sidebar-collapsed .sidebar-nav-label {
        display: none;
    }

    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-link,
    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-link--logout {
        justify-content: center;
        align-items: center;
        gap: 0;
        width: 44px;
        min-width: 44px;
        height: 44px;
        min-height: 44px;
        padding: 0;
        margin-left: auto;
        margin-right: auto;
        border-radius: 10px;
        position: relative;
        box-shadow: none;
    }

    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-link i {
        width: auto;
        font-size: 1.05rem;
        line-height: 1;
    }

    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-link.active {
        box-shadow: none;
    }

    body.page-crm.sidebar-collapsed .sidebar-cta {
        justify-content: center;
        align-items: center;
        width: 44px;
        height: 44px;
        min-height: 44px;
        margin: 0.45rem auto 0;
        padding: 0;
        border-radius: 10px;
    }

    body.page-crm.sidebar-collapsed .sidebar-cta i {
        font-size: 1rem;
        margin: 0;
    }

    body.page-crm.sidebar-collapsed .sidebar-footer {
        padding: 0.65rem 0.4rem 0.85rem;
    }

    body.page-crm.sidebar-collapsed .sidebar-user {
        justify-content: center;
        padding: 0.35rem;
        margin-bottom: 0.3rem;
    }

    body.page-crm.sidebar-collapsed .sidebar-user-avatar {
        width: 38px;
        height: 38px;
        font-size: 0.88rem;
    }

    /* Tooltip ao passar o rato (usa o atributo title) */
    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-link[title]::after,
    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-cta[title]::after {
        content: attr(title);
        position: absolute;
        left: calc(100% + 10px);
        top: 50%;
        transform: translateY(-50%) translateX(-6px);
        padding: 0.42rem 0.7rem;
        background: #0f172a;
        color: #fff;
        font-size: 0.78rem;
        font-weight: 600;
        line-height: 1.2;
        white-space: nowrap;
        border-radius: 8px;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
        z-index: 500;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.22);
    }

    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-link[title]::before,
    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-cta[title]::before {
        content: '';
        position: absolute;
        left: calc(100% + 4px);
        top: 50%;
        transform: translateY(-50%);
        border: 5px solid transparent;
        border-right-color: #0f172a;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.15s ease, visibility 0.15s;
        z-index: 501;
    }

    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-link[title]:hover::after,
    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-link[title]:focus-visible::after,
    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-cta[title]:hover::after,
    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-cta[title]:focus-visible::after {
        opacity: 1;
        visibility: visible;
        transform: translateY(-50%) translateX(0);
    }

    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-link[title]:hover::before,
    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-link[title]:focus-visible::before,
    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-cta[title]:hover::before,
    body.page-crm.sidebar-collapsed .crm-sidebar .sidebar-cta[title]:focus-visible::before {
        opacity: 1;
        visibility: visible;
    }

    /* Tema enterprise (CRM) */
    body.page-crm:not(.page-helpdesk).sidebar-collapsed .sidebar-nav-group + .sidebar-nav-group {
        border-top-color: rgba(255, 255, 255, 0.1);
    }

    body.page-crm:not(.page-helpdesk).sidebar-collapsed .crm-sidebar .sidebar-link {
        width: 44px;
        margin-left: auto;
        margin-right: auto;
    }

    body.page-crm:not(.page-helpdesk).sidebar-collapsed .crm-sidebar .sidebar-link:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    body.page-crm:not(.page-helpdesk).sidebar-collapsed .crm-sidebar .sidebar-link.active {
        background: rgba(37, 99, 235, 0.38);
    }

    body.page-crm:not(.page-helpdesk).sidebar-collapsed .crm-sidebar .sidebar-link.active i {
        color: #fff;
    }

    body.page-crm:not(.page-helpdesk).sidebar-collapsed .crm-sidebar .sidebar-link--logout:hover {
        background: rgba(239, 68, 68, 0.18);
    }
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    overflow-x: hidden;
    overflow-y: auto;
}

.crm-sidebar .sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-body);
    transition: var(--transition);
    white-space: nowrap;
}

.crm-sidebar .sidebar-link i {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    transition: var(--transition);
    flex-shrink: 0;
}

.crm-sidebar .sidebar-link:hover,
.crm-sidebar .sidebar-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-indigo);
}

.crm-sidebar .sidebar-link:hover i,
.crm-sidebar .sidebar-link.active i {
    color: var(--primary-indigo);
}

.crm-sidebar .sidebar-link.active {
    box-shadow: inset 3px 0 0 var(--primary-indigo);
}

.sidebar-footer {
    flex-shrink: 0;
    width: 100%;
    padding: 1rem 0.75rem 1.25rem;
    border-top: 1px solid rgba(11, 18, 32, 0.06);
    box-sizing: border-box;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.sidebar-user strong {
    display: block;
    font-size: 0.85rem;
    color: var(--secondary-blue);
}

.sidebar-user small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.crm-sidebar .sidebar-link--logout {
    color: var(--text-muted);
}

.crm-sidebar .sidebar-link--logout:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

/* Main area */
.crm-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s var(--ease-out);
}

.crm-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.crm-page-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--secondary-blue);
    letter-spacing: -0.02em;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-topbar-actions {
    display: flex;
    gap: 0.5rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--secondary-blue);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.sidebar-toggle:hover {
    background: var(--bg-muted);
}

.sidebar-toggle--desktop {
    display: none;
}

@media (min-width: 1025px) {
    .sidebar-toggle--desktop {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.crm-content {
    padding: 1.5rem;
    flex: 1;
}

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--gradient-dark);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-mesh);
    z-index: 0;
}

.login-card {
    position: relative;
    z-index: 2;
    width: min(420px, 100%);
    background: var(--bg-white);
    border-radius: var(--radius-2xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-card .logo-img {
    height: 40px;
    margin: 0 auto 1.5rem;
    display: block;
}

.login-card h1 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--secondary-blue);
    margin-bottom: 0.35rem;
}

.login-card .login-sub {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* Dashboard stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid rgba(11, 18, 32, 0.06);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.stat-card-icon--blue {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(59, 130, 246, 0.1));
    color: var(--primary-indigo);
}

.stat-card-icon--green {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(34, 211, 238, 0.1));
    color: var(--accent-green);
}

.stat-card-icon--orange {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(234, 88, 12, 0.1));
    color: var(--accent-orange);
}

.stat-card-icon--violet {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(99, 102, 241, 0.1));
    color: var(--primary-violet);
}

.stat-card strong {
    display: block;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--secondary-blue);
    letter-spacing: -0.02em;
}

.stat-card span {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Panels & tables */
.panel {
    background: var(--bg-white);
    border: 1px solid rgba(11, 18, 32, 0.06);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(11, 18, 32, 0.06);
}

.panel-header h2 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--secondary-blue);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.35;
}

.panel-header h2 i {
    font-size: 0.95em;
    opacity: 0.85;
    flex-shrink: 0;
    width: 1.15em;
    text-align: center;
}

.panel-body {
    padding: 1.5rem;
}

.panel-body--flush {
    padding: 0;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrap .crm-table {
    min-width: 640px;
}

.crm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.crm-table th,
.crm-table td {
    padding: 0.85rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid rgba(11, 18, 32, 0.05);
}

.crm-table th {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-muted);
}

.crm-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.03);
}

.crm-table tbody tr:last-child td {
    border-bottom: none;
}

.table-actions {
    display: flex;
    gap: 0.35rem;
}

/* Forms & campos CRM */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.1rem 1.25rem;
}

.form-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.crm-field--full,
.form-grid .crm-field--full {
    grid-column: 1 / -1;
}

.crm-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--secondary-blue);
    margin-bottom: 0.45rem;
    letter-spacing: 0.01em;
}

.crm-required {
    color: #ef4444;
}

.crm-input-wrap {
    position: relative;
}

.crm-input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.crm-input-wrap .crm-input {
    padding-left: 2.65rem;
}

.crm-input,
.crm-textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    border: 1.5px solid #e2e8f0;
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--text-dark);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    outline: none;
    box-shadow: var(--shadow-xs);
}

.crm-input:hover,
.crm-textarea:hover {
    border-color: #cbd5e1;
}

.crm-input:focus,
.crm-textarea:focus {
    border-color: var(--primary-indigo);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
    background: #fff;
}

.crm-input::placeholder,
.crm-textarea::placeholder {
    color: #94a3b8;
}

.crm-textarea {
    resize: vertical;
    min-height: 88px;
}

/* Select customizado */
.crm-select-wrap {
    position: relative;
}

.crm-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    padding: 0.8rem 2.75rem 0.8rem 1rem;
    border-radius: var(--radius-md);
    border: 1.5px solid #e2e8f0;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-dark);
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    box-shadow: var(--shadow-xs);
}

.crm-select:hover {
    border-color: rgba(99, 102, 241, 0.35);
    background: #fff;
}

.crm-select:focus {
    border-color: var(--primary-indigo);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
    background: #fff;
}

.crm-select-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--primary-indigo);
    pointer-events: none;
}

.toolbar .crm-select-wrap {
    min-width: 180px;
}

.toolbar .crm-select {
    padding: 0.55rem 2.25rem 0.55rem 0.85rem;
    font-size: 0.85rem;
}

.toolbar .crm-select-icon {
    right: 0.75rem;
}

.crm-field--no-label .crm-select-wrap {
    margin-top: 0;
}

/* Checkbox personalizado */
.crm-field--check {
    display: flex;
    align-items: flex-end;
}

.crm-check {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    user-select: none;
    padding: 0.5rem 0;
}

.crm-check-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.crm-check-box {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid #cbd5e1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.crm-check-input:checked + .crm-check-box {
    background: var(--gradient-primary);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.crm-check-input:checked + .crm-check-box::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.crm-check-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-body);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(11, 18, 32, 0.06);
}

/* Modal */
body.modal-open {
    overflow: hidden;
}

.crm-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s var(--ease-out), visibility 0.3s;
}

.crm-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.crm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 18, 32, 0.55);
    backdrop-filter: blur(6px);
}

.crm-modal-dialog {
    position: relative;
    width: min(720px, 100%);
    max-height: min(90vh, 900px);
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(16px) scale(0.98);
    transition: transform 0.35s var(--ease-out);
}

.crm-modal.is-open .crm-modal-dialog {
    transform: translateY(0) scale(1);
}

.crm-modal-dialog--lg {
    width: min(860px, 100%);
}

.crm-modal-dialog--xl {
    width: min(1100px, 100%);
    max-height: min(92vh, 960px);
}

.crm-modal-dialog--xl .licenca-modulos-grid {
    max-height: min(42vh, 420px);
}

.crm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(11, 18, 32, 0.06);
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
    flex-shrink: 0;
}

.crm-modal-header h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--secondary-blue);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.crm-modal-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-muted);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.crm-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.crm-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Acções do modal no topo (não no fundo do scroll) */
.crm-modal-body > form:not(.form-actions):not(.form-grid) {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 0;
}

.crm-modal-body .form-actions,
.crm-modal-body .cotacao-form-actions,
.crm-modal-body > form.form-actions {
    order: -1;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--pro-surface, #fff);
    margin-top: 0 !important;
    margin-bottom: 1.25rem;
    padding-top: 0 !important;
    padding-bottom: 1rem;
    border-top: none !important;
    border-bottom: 1px solid rgba(11, 18, 32, 0.06);
    flex-shrink: 0;
}

.crm-modal-body > form.form-grid .form-actions {
    grid-column: 1 / -1;
}

.crm-modal-body > form.form-actions + p,
.crm-modal-body > form.form-actions ~ p {
    margin-top: 0;
}

.crm-modal-body > form:not(.form-actions) > .cotacao-editor-layout,
.crm-modal-body > form:not(.form-actions) > .cotacao-editor-tabs,
.crm-modal-body > form:not(.form-actions) > .form-grid,
.crm-modal-body > form:not(.form-actions) > .crm-tabs,
.crm-modal-body > form:not(.form-actions) > .cotacao-totais-panel,
.crm-modal-body > form:not(.form-actions) > .crm-field:not(.form-actions) {
    flex-shrink: 0;
}

.btn-sm {
    padding: 0.5rem 1rem !important;
    font-size: 0.82rem !important;
}

.btn-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0 !important;
    border-radius: var(--radius-sm) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: #fff !important;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3) !important;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.badge-ativo { background: rgba(16, 185, 129, 0.12); color: #059669; }
.badge-simulacao { background: rgba(99, 102, 241, 0.12); color: var(--primary-indigo); }
.badge-suspenso { background: rgba(251, 191, 36, 0.15); color: #b45309; }
.badge-cancelado { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.badge-expirado { background: rgba(100, 116, 139, 0.15); color: #475569; }
.badge-default { background: var(--bg-muted); color: var(--text-muted); }
.badge-inactive { background: rgba(100, 116, 139, 0.12); color: #64748b; }

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-info {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-indigo);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Search bar */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.toolbar .crm-field {
    margin: 0;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    border-radius: var(--radius-md);
    border: 1.5px solid #e2e8f0;
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--bg-muted) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.1a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 0.85rem center;
    background-size: 14px;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary-indigo);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

/* Detail view */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.detail-item label {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.detail-item span {
    font-weight: 600;
    color: var(--secondary-blue);
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state-action {
    margin-top: 1rem;
}

/* Licenciamento */
.modal-hint {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 1.25rem;
    padding: 0.85rem 1rem;
    background: rgba(99, 102, 241, 0.06);
    border-radius: var(--radius-md);
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.licence-key {
    font-size: 0.78rem;
    font-family: ui-monospace, 'Cascadia Code', monospace;
    background: var(--bg-muted);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    color: var(--primary-indigo);
    word-break: break-all;
}

.licence-key--lg {
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    display: inline-block;
}

.licence-summary-block {
    margin-bottom: 1.25rem;
}

.licence-summary-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.contrato-totais {
    margin-top: 1.25rem;
    padding: 1.25rem;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    border: 1px solid rgba(11, 18, 32, 0.06);
    border-radius: var(--radius-lg);
}

.contrato-totais-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0;
    font-size: 0.9rem;
    color: var(--text-body);
    border-bottom: 1px dashed rgba(11, 18, 32, 0.06);
}

.contrato-totais-row:last-child {
    border-bottom: none;
}

.contrato-totais-row--total {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 2px solid rgba(99, 102, 241, 0.15);
    border-bottom: none;
    font-size: 1rem;
}

.contrato-totais-row--total strong {
    font-size: 1.2rem;
    color: var(--primary-indigo);
}

.text-muted {
    color: var(--text-muted);
}

/* Sidebar overlay (mobile) */
.crm-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(11, 18, 32, 0.45);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s var(--ease-out);
}

.crm-sidebar-backdrop.is-visible {
    display: block;
    opacity: 1;
}

body.sidebar-open {
    overflow: hidden;
}

@media (max-width: 1024px) {
    body.page-crm.sidebar-collapsed {
        --sidebar-w: 0px;
    }

    .sidebar-collapse-btn {
        display: none;
    }

    .crm-sidebar {
        transform: translateX(-100%);
    }
    .crm-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .crm-main {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-toggle--desktop {
        display: none;
    }
    .form-grid,
    .form-grid--3 {
        grid-template-columns: 1fr;
    }

    .crm-modal {
        padding: 0;
        align-items: flex-end;
    }

    .crm-modal-dialog {
        width: 100%;
        max-height: 92vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }

    .crm-modal-dialog--lg {
        width: 100%;
    }

    .panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .panel-header .toolbar {
        width: 100%;
    }

    .panel-header h2 {
        line-height: 1.35;
    }
}

@media (max-width: 768px) {
    body.page-crm header.crm-topbar {
        padding: 0 1rem;
        gap: 0.65rem;
    }

    .crm-content {
        padding: 1rem;
    }

    .panel-header,
    .panel-body {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .panel-header {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .crm-table th,
    .crm-table td {
        padding: 0.75rem 0.85rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.85rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card strong {
        font-size: 1.35rem;
    }

    .toolbar form {
        flex: 1 1 100%;
        max-width: none !important;
    }

    .toolbar .crm-select-wrap {
        min-width: 0;
        flex: 1;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .crm-topbar-actions .btn-text {
        display: none;
    }

    .crm-topbar-actions .btn-outline,
    .crm-topbar-actions .btn-support {
        padding: 0.5rem 0.65rem !important;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 1.75rem 1.25rem;
    }

    .crm-modal-header {
        padding: 1rem;
    }

    .crm-modal-body {
        padding: 1rem;
    }

    .crm-modal-header h2 {
        font-size: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn-support,
    .form-actions .btn-outline {
        width: 100%;
        justify-content: center;
    }

    .table-actions {
        flex-wrap: wrap;
    }
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

.page-subnav a:target,
.panel:target {
    scroll-margin-top: calc(var(--topbar-h) + 1rem);
}

.crm-topbar-head {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.sidebar-nav-group {
    margin-bottom: 0.35rem;
}

.sidebar-nav-label {
    display: block;
    padding: 0.65rem 1rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    opacity: 0.85;
}

body.page-crm.sidebar-collapsed .sidebar-nav-label {
    display: none;
}

.sidebar-cta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0.75rem 0;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    color: #fff !important;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.88rem;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.28);
    transition: var(--transition);
}

.sidebar-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}

.sidebar-cta.active {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

body.page-crm.sidebar-collapsed .sidebar-cta {
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    min-height: 44px;
    margin: 0.45rem auto 0;
    padding: 0;
    border-radius: 10px;
}

body.page-crm.sidebar-collapsed .sidebar-cta:hover {
    transform: none;
}

body.page-crm.sidebar-collapsed .sidebar-cta .sidebar-link-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    opacity: 0;
}

/* Stat cards — mais sóbrios */
.stat-card {
    border-left: 3px solid transparent;
}

.stat-card:hover {
    transform: none;
    border-left-color: var(--primary-indigo);
}

.stat-card-icon {
    width: 42px;
    height: 42px;
    font-size: 1rem;
    margin-bottom: 0.85rem;
}

/* Tabs de filtro */
.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.85rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(11, 18, 32, 0.06);
}

.panel-header + .filter-tabs {
    padding-top: 0.9rem;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: 99px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    background: var(--bg-muted);
    border: 1px solid transparent;
    transition: var(--transition);
}

.filter-tab:hover {
    color: var(--primary-indigo);
    border-color: rgba(99, 102, 241, 0.2);
}

.filter-tab.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-indigo);
    border-color: rgba(99, 102, 241, 0.25);
}

/* Sub-navegação em páginas de detalhe */
.page-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.35rem;
    background: var(--bg-white);
    border: 1px solid rgba(11, 18, 32, 0.06);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.page-subnav a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.95rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-body);
    text-decoration: none;
    transition: var(--transition);
}

.page-subnav a:hover {
    background: var(--bg-muted);
    color: var(--primary-indigo);
}

.page-subnav a i {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Ticket badges */
.badge-ticket,
.badge-priority {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.65rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.badge-ticket--open { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.badge-ticket--progress { background: rgba(99, 102, 241, 0.12); color: #4338ca; }
.badge-ticket--waiting { background: rgba(251, 191, 36, 0.15); color: #b45309; }
.badge-ticket--resolved { background: rgba(16, 185, 129, 0.12); color: #047857; }
.badge-ticket--closed { background: rgba(100, 116, 139, 0.12); color: #475569; }
.badge-ticket--default { background: var(--bg-muted); color: var(--text-muted); }

.badge-priority--low { background: rgba(148, 163, 184, 0.15); color: #64748b; }
.badge-priority--normal { background: rgba(59, 130, 246, 0.1); color: #2563eb; }
.badge-priority--high { background: rgba(249, 115, 22, 0.12); color: #c2410c; }
.badge-priority--urgent { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }

/* Thread de mensagens */
.ticket-thread {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
    max-height: min(480px, 55vh);
    overflow-y: auto;
    padding: 0.25rem 0.15rem 0.25rem 0;
}

.ticket-msg {
    max-width: min(88%, 640px);
    padding: 0.95rem 1.1rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(11, 18, 32, 0.06);
    background: #f8fafc;
}

.ticket-msg--own {
    margin-left: auto;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(59, 130, 246, 0.06));
    border-color: rgba(99, 102, 241, 0.12);
}

.ticket-msg-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.65rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
}

.ticket-msg-author {
    font-weight: 800;
    color: var(--secondary-blue);
}

.ticket-msg-role {
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.1rem 0.45rem;
    background: rgba(11, 18, 32, 0.04);
    border-radius: 4px;
}

.ticket-msg-time {
    margin-left: auto;
    color: var(--text-muted);
    font-weight: 600;
}

.ticket-msg-body {
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-body);
}

.content-block {
    margin-top: 1.25rem;
    padding: 1.1rem 1.25rem;
    background: var(--bg-muted);
    border-radius: var(--radius-md);
    border: 1px solid rgba(11, 18, 32, 0.05);
    line-height: 1.6;
    font-size: 0.92rem;
}

.ticket-layout {
    display: grid;
    grid-template-columns: 1fr min(320px, 32%);
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 960px) {
    .ticket-layout {
        grid-template-columns: 1fr;
    }
}

.panel-header h2 i {
    margin-right: 0.4rem;
    opacity: 0.65;
    font-size: 0.95em;
}

.welcome-banner {
    margin-bottom: 1.5rem;
    padding: 1.5rem 1.75rem;
    background: linear-gradient(135deg, #0f2744 0%, #1a4a6e 100%);
    border-radius: var(--radius-xl);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(15, 39, 68, 0.2);
}

.welcome-banner h2 {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.welcome-banner p {
    margin: 0;
    opacity: 0.88;
    font-size: 0.92rem;
}

.welcome-banner-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.82rem;
    font-weight: 600;
}

.welcome-banner-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    opacity: 0.9;
}

/* ═══════════════════════════════════════════════════════════════
   Tema profissional — CRM & portais administrativos
   ═══════════════════════════════════════════════════════════════ */
body.page-crm {
    --pro-brand: #0f2744;
    --pro-brand-mid: #163a5c;
    --pro-accent: #2563eb;
    --pro-accent-hover: #1d4ed8;
    --pro-surface: #ffffff;
    --pro-border: #e2e8f0;
    --pro-border-soft: #f1f5f9;
    --radius-pro-sm: 8px;
    --radius-pro-md: 10px;
    --radius-pro-lg: 12px;
    --shadow-pro: 0 1px 3px rgba(15, 39, 68, 0.06), 0 1px 2px rgba(15, 39, 68, 0.04);
    --shadow-pro-md: 0 4px 12px rgba(15, 39, 68, 0.08);

    --gradient-primary: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    --primary-indigo: #2563eb;
    --bg-base: #f1f5f9;
    --bg-muted: #f8fafc;
    --radius-sm: var(--radius-pro-sm);
    --radius-md: var(--radius-pro-md);
    --radius-lg: var(--radius-pro-lg);
    --radius-xl: 14px;
    --shadow-card: var(--shadow-pro);
}

body.page-crm .global-bg-shape {
    display: none;
}

body.page-crm ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

/* Scrollbar sidebar (fundo escuro) */
body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(147, 197, 253, 0.5) rgba(255, 255, 255, 0.06);
}

body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    margin: 4px 0;
}

body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-nav::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(147, 197, 253, 0.55), rgba(96, 165, 250, 0.45));
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(191, 219, 254, 0.75), rgba(147, 197, 253, 0.65));
}

body.page-crm #scroll-progress {
    background: var(--pro-accent);
    box-shadow: none;
    height: 2px;
}

/* Sidebar enterprise */
body.page-crm:not(.page-helpdesk) .crm-sidebar {
    background: var(--pro-brand);
    backdrop-filter: none;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 2px 0 24px rgba(15, 39, 68, 0.12);
}

body.page-crm:not(.page-helpdesk) .sidebar-brand {
    border-bottom-color: rgba(255, 255, 255, 0.08);
    padding: 1.1rem 1rem;
}

body.page-crm:not(.page-helpdesk) .sidebar-brand .logo-img--full {
    filter: brightness(0) invert(1);
    opacity: 0.95;
    height: 28px;
}

body.page-crm:not(.page-helpdesk) .sidebar-nav-label {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    padding-top: 0.85rem;
}

body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-link {
    color: rgba(255, 255, 255, 0.78);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-pro-sm);
    margin: 0 0.5rem;
    width: calc(100% - 1rem);
}

body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-link i {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.9rem;
}

body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-link:hover,
body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-link.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-link:hover i,
body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-link.active i {
    color: #93c5fd;
}

body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-link.active {
    background: rgba(37, 99, 235, 0.22);
    box-shadow: inset 3px 0 0 #3b82f6;
}

body.page-crm:not(.page-helpdesk) .sidebar-collapse-btn {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
}

body.page-crm:not(.page-helpdesk) .sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

body.page-crm:not(.page-helpdesk) .sidebar-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
}

body.page-crm:not(.page-helpdesk) .sidebar-user strong {
    color: #fff;
}

body.page-crm:not(.page-helpdesk) .sidebar-user small {
    color: rgba(255, 255, 255, 0.5);
}

body.page-crm:not(.page-helpdesk) .sidebar-user-avatar {
    background: rgba(37, 99, 235, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-link--logout {
    color: rgba(255, 255, 255, 0.5);
}

body.page-crm:not(.page-helpdesk) .crm-sidebar .sidebar-link--logout:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
}

/* Topbar */
body.page-crm header.crm-topbar {
    background: var(--pro-surface);
    backdrop-filter: none;
    border-bottom: 1px solid var(--pro-border);
    box-shadow: var(--shadow-pro);
    height: 60px;
    padding: 0 1.75rem;
}

body.page-crm .crm-page-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--pro-brand);
    letter-spacing: -0.01em;
}

body.page-crm .crm-content {
    padding: 1.25rem 1.5rem;
    max-width: none;
    width: 100%;
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

body.page-crm .crm-main {
    min-width: 0;
    width: 100%;
}

/* Botões corporativos */
body.page-crm .btn-support {
    background: var(--pro-accent);
    border-radius: var(--radius-pro-sm);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.55rem 1.1rem;
    box-shadow: var(--shadow-pro);
}

body.page-crm .btn-support::after {
    display: none;
}

body.page-crm .btn-support:hover {
    background: var(--pro-accent-hover);
    transform: none;
    box-shadow: var(--shadow-pro-md);
}

body.page-crm .btn-outline {
    color: var(--pro-brand) !important;
    border: 1px solid var(--pro-border);
    border-radius: var(--radius-pro-sm);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

body.page-crm .btn-outline:hover {
    background: var(--bg-muted);
    border-color: #cbd5e1;
    transform: none;
}

/* Painéis e tabelas */
body.page-crm .panel {
    border: 1px solid var(--pro-border);
    border-radius: var(--radius-pro-lg);
    box-shadow: var(--shadow-pro);
}

body.page-crm .panel-header {
    padding: 1rem 1.35rem;
    background: var(--bg-muted);
    border-bottom: 1px solid var(--pro-border);
}

body.page-crm .panel-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--pro-brand);
    letter-spacing: -0.01em;
}

body.page-crm .panel-body {
    padding: 1.35rem;
}

body.page-crm .crm-table th {
    background: var(--bg-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #64748b;
    border-bottom: 1px solid var(--pro-border);
    padding: 0.75rem 1.25rem;
}

body.page-crm .crm-table td {
    padding: 0.8rem 1.25rem;
    font-size: 0.875rem;
    color: var(--text-body);
    border-bottom: 1px solid var(--pro-border-soft);
}

body.page-crm .crm-table tbody tr:hover {
    background: #f8fafc;
}

body.page-crm .stat-card {
    border: 1px solid var(--pro-border);
    border-left: 3px solid var(--pro-accent);
    border-radius: var(--radius-pro-lg);
    box-shadow: var(--shadow-pro);
    padding: 1.25rem 1.35rem;
}

body.page-crm .stat-card strong {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--pro-brand);
}

body.page-crm .stat-card span {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
}

body.page-crm .stat-card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pro-sm);
    margin-bottom: 0.75rem;
}

body.page-crm .badge {
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.68rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

body.page-crm .crm-input,
body.page-crm .crm-textarea,
body.page-crm .crm-select {
    border-radius: var(--radius-pro-sm);
    border-color: var(--pro-border);
    font-size: 0.875rem;
    box-shadow: none;
}

body.page-crm .crm-input:focus,
body.page-crm .crm-textarea:focus,
body.page-crm .crm-select:focus {
    border-color: var(--pro-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

body.page-crm .alert {
    border-radius: var(--radius-pro-sm);
    font-weight: 600;
    font-size: 0.875rem;
}

body.page-crm .filter-tab {
    border-radius: var(--radius-pro-sm);
    font-weight: 600;
}

body.page-crm .filter-tab.active {
    background: var(--pro-brand);
    color: #fff;
    border-color: var(--pro-brand);
}

body.page-crm .page-subnav {
    border-radius: var(--radius-pro-lg);
    padding: 0.25rem;
}

body.page-crm .page-subnav a {
    border-radius: var(--radius-pro-sm);
    font-weight: 600;
    font-size: 0.82rem;
}

body.page-crm .page-subnav a:hover {
    background: var(--pro-brand);
    color: #fff;
}

body.page-crm .ticket-msg {
    border-radius: var(--radius-pro-md);
}

body.page-crm .content-block {
    border-radius: var(--radius-pro-sm);
    background: var(--bg-muted);
}

/* Login profissional — split screen */
.login-page--pro {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
    padding: 0;
    background: var(--pro-surface);
}

.login-page--pro::before {
    display: none;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: clamp(2rem, 4vw, 3.5rem) clamp(1.75rem, 4vw, 3.5rem);
    background: linear-gradient(165deg, var(--pro-brand) 0%, var(--pro-brand-mid) 55%, #1e4976 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 50% at 80% 20%, rgba(37, 99, 235, 0.25), transparent),
        radial-gradient(ellipse 50% 40% at 10% 90%, rgba(255, 255, 255, 0.05), transparent);
    pointer-events: none;
}

.login-brand-inner {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    margin: 0 auto;
}

.login-brand .logo-img {
    height: 36px;
    filter: brightness(0) invert(1);
    margin: 0 0 2.5rem;
    opacity: 0.95;
}

.login-brand h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.25;
    margin-bottom: 0.75rem;
}

.login-brand p {
    font-size: 0.95rem;
    line-height: 1.6;
    opacity: 0.82;
    margin-bottom: 2rem;
    max-width: 38ch;
}

.login-brand-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 0.25rem;
}

.login-brand-features li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0.9;
}

.login-brand-features li i {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.75rem;
    color: #93c5fd;
}

.login-form-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    min-height: 100dvh;
    padding: clamp(1.75rem, 4vw, 3rem) clamp(1.5rem, 5vw, 4rem);
    background:
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    position: relative;
}

.login-form-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.06), transparent 42%),
        radial-gradient(circle at 80% 80%, rgba(37, 99, 235, 0.05), transparent 40%);
    pointer-events: none;
}

.login-form-inner {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    margin-left: clamp(0.5rem, 5vw, 3.5rem);
    margin-right: auto;
}

.login-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
    padding: 0.35rem 0.75rem;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.92);
}

.login-card-head {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.login-card-head h1 {
    margin-bottom: 0.2rem;
}

.login-card-head .login-sub {
    margin-bottom: 0;
}

.login-portal-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.login-portal-icon--crm {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(59, 130, 246, 0.12));
    color: var(--primary-indigo, #6366f1);
    border: 1px solid rgba(99, 102, 241, 0.18);
}

.login-portal-icon--helpdesk {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.15), rgba(56, 189, 248, 0.12));
    color: #0284c7;
    border: 1px solid rgba(2, 132, 199, 0.2);
}

.login-field {
    margin-bottom: 1.1rem;
}

.login-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pro-brand, #0c2238);
    margin-bottom: 0.45rem;
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap i {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.9rem;
    pointer-events: none;
}

.login-input-wrap input {
    width: 100%;
    box-sizing: border-box;
    border-radius: var(--radius-pro-sm, 8px);
    border: 1px solid var(--pro-border, #e2e8f0);
    padding: 0.78rem 0.95rem 0.78rem 2.65rem;
    font-size: 0.925rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-input-wrap input:focus {
    border-color: var(--pro-accent, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    outline: none;
}

.login-alert {
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.login-submit {
    margin-top: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-page--pro .login-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--pro-surface);
    border-radius: var(--radius-pro-lg);
    padding: 2rem 2.1rem;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
    border: 1px solid var(--pro-border);
}

.login-form-body {
    display: flex;
    flex-direction: column;
}

.login-form-body .login-submit {
    margin-top: 0.35rem;
}

.login-page--pro .login-card .logo-img {
    display: none;
}

.login-page--auth .login-card .logo-img {
    display: block;
}

.login-page--pro .login-card h1 {
    text-align: left;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--pro-brand);
    margin-bottom: 0.25rem;
}

.login-page--pro .login-card .login-sub {
    text-align: left;
    font-size: 0.875rem;
    margin-bottom: 1.75rem;
    color: #64748b;
}

.login-page--pro .login-card-head .login-sub {
    margin-bottom: 0;
}

.login-page--pro .form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pro-brand);
    margin-bottom: 0.4rem;
}

.login-page--pro .form-group input {
    border-radius: var(--radius-pro-sm);
    border: 1px solid var(--pro-border);
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
}

.login-page--pro .form-group input:focus {
    border-color: var(--pro-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    outline: none;
}

.login-page--pro .btn-support {
    border-radius: var(--radius-pro-sm);
    margin-top: 0.75rem;
    padding: 0.75rem 1.25rem;
}

.login-footer-link {
    text-align: left;
    margin-top: 1.25rem;
    margin-bottom: 0;
    font-size: 0.85rem;
}

.login-page--auth .login-footer-link {
    text-align: center;
}

.login-footer-link a {
    color: var(--pro-accent);
    font-weight: 600;
    text-decoration: none;
}

.login-footer-link a:hover {
    text-decoration: underline;
}

.login-page--auth {
    grid-template-columns: 1fr;
}

.login-page--auth .login-form-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    justify-content: center;
    align-items: center;
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.login-page--auth .login-form-inner {
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 900px) {
    .login-page--pro {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .login-form-wrap {
        order: -1;
        min-height: auto;
        flex: 1;
        justify-content: center;
        align-items: stretch;
        padding: clamp(1.5rem, 5vw, 2rem) clamp(1.25rem, 4vw, 1.75rem);
    }

    .login-form-inner {
        width: min(440px, 100%);
        margin-left: auto;
        margin-right: auto;
    }

    .login-brand {
        order: 1;
        min-height: auto;
        align-items: stretch;
        padding: 1.75rem clamp(1.25rem, 4vw, 1.75rem) 2rem;
    }

    .login-brand-inner {
        width: 100%;
        max-width: none;
        text-align: center;
    }

    .login-brand .logo-img {
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 1rem;
        height: 30px;
    }

    .login-brand-badge {
        margin-left: auto;
        margin-right: auto;
    }

    .login-brand h2 {
        font-size: 1.15rem;
        margin-bottom: 0.35rem;
    }

    .login-brand p {
        display: none;
    }

    .login-brand-features {
        display: none;
    }
}

@media (min-width: 901px) and (max-width: 1100px) {
    .login-page--pro {
        grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 1.15fr);
    }

    .login-brand-inner {
        width: min(380px, 100%);
    }

    .login-form-inner {
        margin-left: clamp(0.25rem, 3vw, 2rem);
    }
}

/* Select2 — alinhado ao tema CRM */
.crm-select-wrap:has(.select2-hidden-accessible) .crm-select-icon {
    display: none;
}

.select2-container--default .select2-selection--single {
    min-height: 42px;
    border: 1.5px solid var(--pro-border, #e2e8f0) !important;
    border-radius: var(--radius-pro-sm, 8px) !important;
    background: #fff !important;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 40px;
    padding-left: 0.85rem;
    padding-right: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark, #0f172a);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
    right: 0.5rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--pro-accent, #2563eb) transparent transparent transparent;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent var(--pro-accent, #2563eb) transparent;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--pro-accent, #2563eb) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.select2-dropdown {
    border: 1px solid var(--pro-border, #e2e8f0);
    border-radius: var(--radius-pro-sm, 8px);
    box-shadow: var(--shadow-pro-md, 0 8px 24px rgba(15, 23, 42, 0.12));
    overflow: hidden;
    z-index: 10050;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--pro-border, #e2e8f0);
    border-radius: var(--radius-pro-sm, 8px);
    padding: 0.45rem 0.65rem;
    font-size: 0.875rem;
}

.select2-container--default .select2-results__option {
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--pro-accent, #2563eb);
}

.toolbar .select2-container--default .select2-selection--single {
    min-height: 36px;
}

.toolbar .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px;
    font-size: 0.85rem;
}

/* Cotações — linhas tipo artigo */
.cotacao-secao {
    margin-top: 0.25rem;
}

.cotacao-secao + .cotacao-secao {
    padding-top: 0.5rem;
    border-top: 1px solid var(--pro-border-soft, rgba(0, 0, 0, 0.06));
}

.cotacao-add-btn {
    margin-top: 0.75rem;
}

.cotacao-linhas-table .crm-select-wrap,
.cotacao-linhas-table .select2-container {
    min-width: 220px;
}

.cotacao-linhas-table .crm-input {
    max-width: 6rem;
}

.cotacao-linhas-table td {
    vertical-align: middle;
}

.cotacao-linha-preco,
.cotacao-linha-subtotal {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
}

.cotacao-extra-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.cotacao-qty-input {
    max-width: 5rem;
}

.cotacao-send-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--pro-brand, #0f2744);
    margin: 0 0 1rem;
}

.cotacao-send-title i {
    color: var(--pro-accent, #2563eb);
    margin-right: 0.35rem;
}

.cotacao-doc-grid-wrap {
    overflow-x: auto;
    margin: 1rem 0;
}

.cotacao-doc-table .crm-input {
    min-width: 0;
    width: 100%;
    padding: 0.35rem 0.5rem;
    font-size: 0.8125rem;
}

.cotacao-doc-table .crm-input[readonly] {
    background: var(--pro-surface-muted, #f8fafc);
    border-color: transparent;
}

.cotacao-doc-table td,
.cotacao-doc-table th {
    vertical-align: middle;
    font-size: 0.8125rem;
}

.cotacao-doc-table .col-tipo { width: 9rem; }
.cotacao-doc-table .col-artigo { width: 14rem; }
.cotacao-doc-table .col-codigo { width: 8rem; }
.cotacao-doc-table .col-qtd { width: 5.5rem; }
.cotacao-doc-table .col-preco { width: 7rem; }
.cotacao-doc-table .col-desc { width: 4.5rem; }
.cotacao-doc-table .col-total { width: 7.5rem; }
.cotacao-doc-table .col-remove { width: 2.5rem; }

.cotacao-totais-row td {
    background: var(--pro-surface-muted, #f8fafc);
}

.cotacao-totais-row--total td {
    font-size: 0.9375rem;
}

.cotacao-form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--pro-border, rgba(0, 0, 0, 0.06));
}

.crm-modal-body .cotacao-form-actions {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.crm-tabs {
    margin-top: 1.25rem;
}

.crm-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-bottom: 1px solid var(--pro-border, rgba(0, 0, 0, 0.08));
    margin-bottom: 0;
}

.crm-tabs-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    margin-bottom: -1px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--pro-text-muted, #64748b);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.crm-tabs-btn:hover {
    color: var(--pro-text, #0f172a);
}

.crm-tabs-btn.is-active {
    color: var(--pro-primary, #0f2744);
    border-bottom-color: var(--pro-primary, #0f2744);
}

.crm-tabs-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--pro-surface-muted, #f1f5f9);
    color: var(--pro-text-muted, #64748b);
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
}

.crm-tabs-btn.is-active .crm-tabs-badge {
    background: var(--pro-primary, #0f2744);
    color: #fff;
}

.crm-tabs-panels {
    padding-top: 1rem;
}

.crm-tabs-panel {
    display: none;
}

.crm-tabs-panel.is-active {
    display: block;
}

.cotacao-editor-tabs .licenca-modulos-panel,
.cotacao-editor-tabs .cotacao-outros-panel {
    margin-top: 0;
}

.cotacao-outros-panel {
    margin-top: 1.5rem;
}

.cotacao-outros-table .col-preco,
.cotacao-outros-table .col-qtd,
.cotacao-outros-table .col-desc,
.cotacao-outros-table .col-iva,
.cotacao-outros-table .col-total {
    white-space: nowrap;
}

.cotacao-outros-table .crm-select--compact {
    min-width: 6.5rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.35rem;
}

.cotacao-totais-panel {
    margin-top: 0;
    max-width: none;
    margin-left: 0;
}

.cotacao-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 0.75rem 1rem;
    align-items: stretch;
}

.cotacao-editor-fields {
    margin-bottom: 0;
}

.cotacao-editor-aside {
    min-width: 0;
    display: flex;
}

.cotacao-editor-aside .cotacao-totais-panel {
    flex: 1;
    display: flex;
}

.cotacao-editor-tabs {
    margin-top: 1rem;
}

.cotacao-totais-card {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 0.2rem 0.6rem;
    align-content: center;
    background: var(--pro-surface-muted, #f8fafc);
    border: 1px solid var(--pro-border, rgba(0, 0, 0, 0.06));
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
}

.cotacao-totais-list {
    display: contents;
}

.cotacao-totais-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.4rem;
    font-size: 0.75rem;
    line-height: 1.25;
}

.cotacao-totais-line dt,
.cotacao-totais-line .cotacao-totais-label {
    margin: 0;
    font-weight: 600;
    color: var(--text-muted, #64748b);
}

.cotacao-totais-line dd,
.cotacao-totais-line .cotacao-totais-value {
    margin: 0;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.cotacao-totais-desconto {
    margin: 0;
    padding: 0;
    border: none;
    align-self: end;
}

.cotacao-totais-desconto .crm-field {
    margin: 0;
}

.cotacao-totais-desconto .crm-label {
    font-size: 0.6875rem;
    margin-bottom: 0.2rem;
}

.cotacao-totais-desconto .crm-input {
    padding: 0.3rem 0.45rem;
    font-size: 0.75rem;
    min-height: 1.85rem;
}

.cotacao-totais-line--total {
    grid-column: 1 / -1;
    margin-top: 0.15rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--pro-border, rgba(0, 0, 0, 0.08));
    font-size: 0.8125rem;
    font-weight: 700;
}

.cotacao-totais-line--total .cotacao-totais-label,
.cotacao-totais-line--total .cotacao-totais-value {
    color: var(--text-body, #0b1220);
}

.cotacao-totais-table td:last-child {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.cotacao-modulos-table .col-preco,
.cotacao-modulos-table .col-desc,
.cotacao-modulos-table .col-iva,
.cotacao-modulos-table .col-total {
    white-space: nowrap;
}

.cotacao-modulos-table .crm-select--compact {
    min-width: 6.5rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.35rem;
}

.cotacao-modulos-resumo {
    margin: 0;
    padding-left: 1.25rem;
}

.cotacao-modulos-resumo li {
    margin-bottom: 0.35rem;
}

.text-right {
    text-align: right;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.licenca-modulos-grid {
    display: block;
    max-height: min(44vh, 380px);
    overflow: auto;
    background: #fff;
    border: 1px solid var(--pro-border, rgba(11, 18, 32, 0.1));
    border-radius: 0 0 var(--radius-pro-sm, 8px) var(--radius-pro-sm, 8px);
}

.licenca-modulos-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: var(--radius-pro-sm, 8px);
}

.licenca-modulos-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.75rem 0.85rem;
    background: var(--bg-muted, #f8fafc);
    border: 1px solid var(--pro-border, rgba(11, 18, 32, 0.1));
    border-radius: var(--radius-pro-sm, 8px) var(--radius-pro-sm, 8px) 0 0;
}

.licenca-modulos-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.65rem 0.85rem;
    flex: 1 1 280px;
    min-width: 0;
}

.licenca-modulos-filter {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.licenca-modulos-filter--search {
    flex: 1 1 180px;
    max-width: 280px;
}

.licenca-modulos-filter-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.licenca-modulos-app-filter {
    min-width: 11rem;
    max-width: 100%;
    border: 1px solid var(--pro-border, rgba(11, 18, 32, 0.12));
    border-radius: var(--radius-pro-sm, 8px);
    padding: 0.45rem 0.65rem;
    font-size: 0.875rem;
    font-family: inherit;
    background: #fff;
    color: var(--secondary-blue);
}

.licenca-modulos-app-filter:focus {
    outline: none;
    border-color: var(--pro-accent, var(--primary-indigo));
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.licenca-modulos-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.licenca-modulos-search i {
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.licenca-modulos-search .crm-table-search-input {
    flex: 1;
    min-width: 0;
}

.licenca-modulos-summary {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    padding-bottom: 0.15rem;
}

.licenca-modulos-empty {
    margin: 0;
    padding: 1rem 0.85rem;
    border: 1px solid var(--pro-border, rgba(11, 18, 32, 0.1));
    border-top: none;
    border-radius: 0 0 var(--radius-pro-sm, 8px) var(--radius-pro-sm, 8px);
}

.licenca-modulos-table {
    width: 100%;
    min-width: 0;
    margin: 0;
    border-collapse: collapse;
    table-layout: auto;
}

.licenca-modulos-table th,
.licenca-modulos-table td {
    padding: 0.65rem 0.85rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(11, 18, 32, 0.06);
}

.licenca-modulos-table th.col-select,
.licenca-modulos-table td.licenca-modulo-check-cell,
.licenca-modulos-table th.col-users,
.licenca-modulos-table td.licenca-modulo-users-cell {
    width: 1%;
    white-space: nowrap;
    text-align: center;
}

.modulo-capacidade {
    display: inline-flex;
    align-items: baseline;
    gap: 0.15rem;
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    color: var(--text-secondary, #64748b);
}

.modulo-capacidade.is-near,
.licenca-modulo-row.is-near .modulo-capacidade {
    color: #b45309;
    font-weight: 600;
}

.modulo-capacidade.is-full,
.licenca-modulo-row.is-full .modulo-capacidade {
    color: #b91c1c;
    font-weight: 700;
}

.modulo-capacidade-hint {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.4rem;
    border-radius: 99px;
    background: rgba(185, 28, 28, 0.1);
    color: #b91c1c;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.licenca-modulos-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-muted, #f8fafc);
    font-size: 0.72rem;
    box-shadow: 0 1px 0 var(--pro-border, rgba(11, 18, 32, 0.08));
}

.licenca-modulo-app-badge {
    display: inline-block;
    max-width: 11rem;
    padding: 0.2rem 0.55rem;
    border-radius: 99px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--secondary-blue);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.licenca-modulo-name {
    font-weight: 600;
    color: var(--secondary-blue);
    white-space: nowrap;
}

.licenca-modulo-code code {
    font-size: 0.75rem;
    white-space: nowrap;
}

tr.licenca-modulo-row.is-selected > td {
    background: rgba(37, 99, 235, 0.04);
}

tr.licenca-modulo-row.is-hidden,
tr.licenca-modulo-view-row.is-hidden {
    display: none !important;
}

.licenca-modulos-grid.is-locked {
    opacity: 0.94;
}

.licenca-modulos-grid.is-locked tr.licenca-modulo-row.is-selected > td {
    background: rgba(37, 99, 235, 0.07);
}

.licenca-modulos-hint {
    margin: 0.65rem 0 0;
}

.licenca-modulos-hint[hidden] {
    display: none !important;
}

.licenca-modulo-row:not(.is-selected) .licenca-modulo-users-input:disabled {
    opacity: 0.45;
}

.crm-modal-dialog--lg .licenca-modulos-grid {
    max-height: min(40vh, 340px);
}

.licenca-modulos-table--view .licenca-modulo-app-badge {
    background: rgba(37, 99, 235, 0.06);
}

@media (max-width: 640px) {
    .licenca-modulos-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .licenca-modulos-filter--search {
        max-width: none;
    }

    .licenca-modulos-app-filter {
        width: 100%;
    }

    .licenca-modulos-grid {
        overflow-x: auto;
    }

    .licenca-modulos-table {
        min-width: 520px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   UI/UX — Controles, formulários, responsividade e acessibilidade
   ═══════════════════════════════════════════════════════════════ */

/* Radio buttons */
.crm-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1.25rem;
}

.crm-radio {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    user-select: none;
    padding: 0.35rem 0;
    min-height: 44px;
}

.crm-radio-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.crm-radio-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.crm-radio-dot::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    transform: scale(0);
    transition: transform 0.15s var(--ease-out), background 0.15s;
}

.crm-radio-input:checked + .crm-radio-dot {
    border-color: var(--primary-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.crm-radio-input:checked + .crm-radio-dot::after {
    background: var(--primary-indigo);
    transform: scale(1);
}

.crm-radio-input:focus-visible + .crm-radio-dot,
.crm-check-input:focus-visible + .crm-check-box {
    outline: 2px solid var(--primary-indigo);
    outline-offset: 2px;
}

.crm-radio-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-body);
}

body.page-crm .crm-radio-input:checked + .crm-radio-dot {
    border-color: var(--pro-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

body.page-crm .crm-radio-input:checked + .crm-radio-dot::after {
    background: var(--pro-accent);
}

body.page-crm .crm-check-input:checked + .crm-check-box {
    background: var(--gradient-primary);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.page-helpdesk .crm-radio-input:checked + .crm-radio-dot {
    border-color: var(--pro-accent);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.page-helpdesk .crm-radio-input:checked + .crm-radio-dot::after {
    background: var(--pro-accent);
}

.page-helpdesk .crm-check-input:checked + .crm-check-box {
    background: linear-gradient(180deg, var(--pro-accent) 0%, var(--pro-accent-hover) 100%);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

/* Checkbox variantes */
.crm-check--block {
    align-items: flex-start;
    padding: 0;
}

.crm-check--block .crm-check-box {
    margin-top: 0.15rem;
}

.crm-check--block .crm-check-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.crm-check--card {
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--pro-border, #e2e8f0);
    border-radius: var(--radius-pro-sm, 8px);
    background: var(--bg-muted, #f8fafc);
    transition: border-color var(--transition), background var(--transition);
}

.crm-check--card:hover {
    border-color: rgba(99, 102, 241, 0.25);
    background: #fff;
}

.crm-check--card .crm-check-label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.875rem;
}

.crm-check--card .crm-check-label strong {
    font-weight: 700;
    color: var(--secondary-blue);
}

.crm-field--hidden {
    display: none !important;
}

.form-grid--narrow {
    max-width: none;
    width: 100%;
}

.form-grid--compact {
    max-width: none;
    width: 100%;
}

.form-actions--inline {
    border: none;
    padding-top: 0;
    margin-top: 0;
}

.crm-input--compact {
    width: 4.5rem;
    min-width: 0;
    padding: 0.45rem 0.55rem;
    display: inline-block;
}

.licenca-modulos-panel--view .licenca-modulos-grid {
    border-radius: 0 0 var(--radius-pro-sm, 8px) var(--radius-pro-sm, 8px);
}

.licenca-modulos-panel--view .licenca-modulos-toolbar {
    margin: 0;
}

.crm-check--table {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.licenca-modulos-table .crm-input--compact,
.licenca-modulos-table .licenca-modulo-users-input {
    width: 4.25rem;
    text-align: center;
}

/* Notificações */
.notif-config-form {
    margin-top: 0.5rem;
}

.notif-config-category {
    margin: 1.5rem 0 0.75rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--pro-brand, var(--primary-indigo));
}

.panel-section-title {
    margin: 0;
    padding: 1rem 1.25rem 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--pro-brand, var(--primary-indigo));
}

.panel-body-pad {
    padding: 1rem 1.25rem;
}

.panel-section + .panel-section {
    border-top: 1px solid var(--pro-border, rgba(11, 18, 32, 0.08));
}

.notif-config-dest--table {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
}

.crm-table th.col-select,
.crm-table td:first-child .crm-check--table {
    width: 3rem;
    text-align: center;
}

.crm-table th.col-select {
    cursor: default;
}

.notif-config-row {
    border: 1px solid var(--pro-border, rgba(0, 0, 0, 0.08));
    border-radius: var(--radius-pro-md, 10px);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    background: var(--pro-surface, #fff);
}

.notif-config-desc {
    display: block;
    font-weight: 400;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.notif-config-details {
    margin-top: 0.85rem;
    padding-left: 2rem;
}

.notif-config-subtitle {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.notif-config-dest {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}

.notif-config-dest .crm-check-label {
    font-size: 0.875rem;
}

.notif-config-param {
    margin-top: 0.65rem;
}

.notif-config-param-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-body);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.notif-config-actions {
    margin-top: 1rem;
}

/* Grelha de módulos (planos) */
.modulo-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
    .crm-modal,
    .crm-modal-dialog {
        transition: none !important;
    }
}

/* Tabs de filtro — scroll horizontal em mobile */
@media (max-width: 768px) {
    .filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        mask-image: linear-gradient(to right, #000 95%, transparent);
    }

    .filter-tabs::-webkit-scrollbar {
        display: none;
    }

    .filter-tab {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

/* Focus visible — acessibilidade */
.btn-support:focus-visible,
.btn-outline:focus-visible,
.btn-icon:focus-visible,
.sidebar-link:focus-visible,
.filter-tab:focus-visible {
    outline: 2px solid var(--primary-indigo);
    outline-offset: 2px;
}

body.page-crm .btn-support:focus-visible,
body.page-crm .btn-outline:focus-visible,
body.page-crm .filter-tab:focus-visible {
    outline-color: var(--pro-accent);
}

.page-helpdesk .btn-support:focus-visible,
.page-helpdesk .btn-outline:focus-visible {
    outline-color: var(--pro-accent);
}

.crm-input:focus-visible,
.crm-textarea:focus-visible,
.crm-select:focus-visible {
    outline: none;
    border-color: var(--primary-indigo);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}

body.page-crm .crm-input:focus-visible,
body.page-crm .crm-textarea:focus-visible,
body.page-crm .crm-select:focus-visible {
    border-color: var(--pro-accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.page-helpdesk .crm-input:focus-visible,
.page-helpdesk .crm-textarea:focus-visible,
.page-helpdesk .crm-select:focus-visible {
    border-color: var(--pro-accent);
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.12);
}

/* Tabelas responsivas (cards em mobile) */
.table-wrap--responsive {
    overflow-x: auto;
}

@media (max-width: 768px) {
    .table-wrap--responsive {
        overflow-x: visible;
    }

    .table-wrap--responsive .crm-table {
        min-width: 0;
    }

    .table-wrap--responsive .crm-table thead {
        display: none;
    }

    .table-wrap--responsive .crm-table tbody tr {
        display: block;
        border: 1px solid var(--pro-border, rgba(11, 18, 32, 0.08));
        border-radius: var(--radius-pro-md, 10px);
        margin-bottom: 0.75rem;
        background: var(--pro-surface, #fff);
        box-shadow: var(--shadow-pro, var(--shadow-xs));
        overflow: hidden;
    }

    .table-wrap--responsive .crm-table tbody tr:hover {
        background: var(--pro-surface, #fff);
    }

    .table-wrap--responsive .crm-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        padding: 0.65rem 1rem;
        border-bottom: 1px solid var(--pro-border-soft, rgba(11, 18, 32, 0.05));
        text-align: right;
    }

    .table-wrap--responsive .crm-table td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        text-align: left;
        flex: 1;
        min-width: 0;
    }

    .table-wrap--responsive .crm-table td:last-child {
        border-bottom: none;
    }

    .table-wrap--responsive .crm-table td.table-actions,
    .table-wrap--responsive .crm-table td:has(.table-actions) {
        justify-content: flex-end;
        padding-top: 0.5rem;
        border-top: 1px solid var(--pro-border-soft, rgba(11, 18, 32, 0.06));
    }

    .table-wrap--responsive .crm-table td.table-actions::before,
    .table-wrap--responsive .crm-table td:has(.table-actions)::before {
        display: none;
    }

    .notif-config-details {
        padding-left: 0;
    }

    .modulo-checkbox-grid {
        grid-template-columns: 1fr;
    }

    .welcome-banner-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .crm-radio-group {
        flex-direction: column;
        gap: 0.25rem;
    }

    .crm-radio {
        width: 100%;
        padding: 0.25rem 0;
    }

    .btn-icon {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
}

/* Cotações — tabela documento em mobile */
@media (max-width: 1024px) {
    .cotacao-editor-layout {
        grid-template-columns: 1fr;
    }

    .cotacao-totais-card {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .cotacao-totais-line--total {
        grid-column: 1 / -1;
    }

    .cotacao-doc-grid-wrap {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .cotacao-doc-table .crm-input {
        font-size: 0.75rem;
        padding: 0.3rem 0.4rem;
    }
}

/* Overflow — evitar scroll horizontal no shell */
.crm-shell {
    overflow-x: hidden;
}

.crm-content {
    overflow-x: hidden;
    min-width: 0;
}

.crm-topbar-head {
    overflow: hidden;
}

.crm-page-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .crm-page-title {
        white-space: normal;
        line-height: 1.3;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Utilitários — substituem estilos inline dispersos pelas páginas
   ═══════════════════════════════════════════════════════════════ */
.u-mb-1 { margin-bottom: 1rem; }
.u-mb-2 { margin-bottom: 1.25rem; }
.u-mt-1 { margin-top: 1rem; }
.u-mt-2 { margin-top: 1.25rem; }

.form-actions-item {
    display: contents;
}

.toolbar--plain {
    margin: 0;
}

.toolbar--search {
    flex: 1;
    max-width: 360px;
    margin: 0;
}

.panel-header h2 .badge {
    margin-left: 0.5rem;
    vertical-align: middle;
}

.panel-lead {
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.55;
}

.field-group {
    margin-bottom: 1.25rem;
}

.field-group-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.modal-hint--flush {
    margin-bottom: 0;
}

.text-muted-note {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.empty-state--compact {
    padding: 1rem;
}

.code-block {
    display: block;
    padding: 1rem;
    background: var(--bg-muted);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    word-break: break-all;
    white-space: pre-wrap;
}

.inline-cta {
    margin-top: 1rem;
}

.login-card-logo {
    display: block;
    height: 32px;
    margin: 0 0 1.5rem;
}

/* ── Tabelas de dados (pesquisa, ordenação, paginação) ── */
.crm-data-table {
    display: flex;
    flex-direction: column;
}

.crm-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--pro-border, rgba(11, 18, 32, 0.08));
    background: var(--bg-muted);
}

.crm-table-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 220px;
    max-width: 360px;
    min-width: 0;
}

.crm-table-search i {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.crm-table-search-input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--pro-border, rgba(11, 18, 32, 0.12));
    border-radius: var(--radius-pro-sm, 8px);
    padding: 0.45rem 0.65rem;
    font-size: 0.875rem;
    font-family: inherit;
    background: #fff;
}

.crm-table-search-input:focus {
    outline: none;
    border-color: var(--pro-accent, var(--primary-indigo));
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.crm-table-meta {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.crm-table-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--pro-border, rgba(11, 18, 32, 0.08));
    background: var(--bg-muted);
}

.crm-table-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.crm-table-page-btn {
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border: 1px solid var(--pro-border, rgba(11, 18, 32, 0.12));
    border-radius: var(--radius-pro-sm, 8px);
    background: #fff;
    color: var(--secondary-blue);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.crm-table-page-btn:hover:not(:disabled) {
    border-color: var(--pro-accent, var(--primary-indigo));
    color: var(--pro-accent, var(--primary-indigo));
}

.crm-table-page-btn.is-active {
    background: var(--pro-accent, var(--primary-indigo));
    border-color: var(--pro-accent, var(--primary-indigo));
    color: #fff;
}

.crm-table-page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.crm-table th.crm-table-sortable,
.crm-table th[data-sortable] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.crm-table th.crm-table-sortable:hover,
.crm-table th[data-sortable]:hover {
    color: var(--pro-accent, var(--primary-indigo));
}

.crm-table th.is-sorted-asc::after,
.crm-table th.is-sorted-desc::after {
    margin-left: 0.35rem;
    font-size: 0.65rem;
    opacity: 0.75;
}

.crm-table th.is-sorted-asc::after {
    content: '▲';
}

.crm-table th.is-sorted-desc::after {
    content: '▼';
}

.crm-table--kv th {
    width: 34%;
    font-weight: 700;
    color: var(--text-muted);
    background: transparent;
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.82rem;
}

.crm-table--kv td {
    font-weight: 500;
}

.crm-table--kv tbody tr:hover {
    background: transparent;
}

.crm-data-table .table-wrap {
    flex: 1;
}

@media (max-width: 768px) {
    .crm-table-toolbar,
    .crm-table-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .crm-table-search {
        max-width: none;
        flex-basis: 100%;
    }
}

.is-current-session {
    background: rgba(99, 102, 241, 0.04);
}

.inline-form {
    display: inline;
}

.col-truncate {
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

