/* ============================================================
   Imobill – Stylesheet principal
   ============================================================ */

/* ---- Reset ------------------------------------------------ */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ---- Variáveis -------------------------------------------- */
:root {
    --primary:        #0E9E84;
    --primary-light:  #15B89C;
    --primary-soft:   rgba(14, 158, 132, 0.10);
    --secondary:      #0A7A66;
    --secondary-light:#159E86;
    --secondary-soft: rgba(10, 122, 102, 0.07);
    --neutral-100:    #F6F8F6;
    --neutral-200:    #ECEFEC;
    --neutral-300:    #D7DCD7;
    --neutral-400:    #BAC2BB;
    --neutral-500:    #9AA59E;
    --neutral-600:    #6E746E;
    --neutral-700:    #46514A;
    --neutral-800:    #2A332E;
    --neutral-900:    #15231E;
    --shadow-sm:      0 10px 25px -5px rgba(21,35,30,0.06), 0 8px 10px -6px rgba(0,0,0,0.02);
    --shadow-md:      0 20px 30px -12px rgba(14,158,132,0.14), 0 4px 18px rgba(0,0,0,0.02);
    --shadow-focus:   0 0 0 4px rgba(14,158,132,0.22);
    --radius-md:      12px;
    --radius-lg:      20px;
    --transition:     all 0.2s ease;
}

/* ---- Base ------------------------------------------------- */
body {
    font-family: 'Public Sans', system-ui, -apple-system, sans-serif;
    background: linear-gradient(145deg, var(--neutral-200) 0%, #FFFFFF 100%);
    min-height: 100vh;
    color: var(--neutral-900);
    line-height: 1.5;
}

/* ---- Scrollbar (auto-hide sem layout shift) ------------- */
html {
    scrollbar-gutter: stable;
}

html,
body,
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(202, 209, 217, 0);
    border-radius: 999px;
    transition: background-color 0.22s ease-in-out;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

html:hover,
body:hover,
html:focus-within,
body:focus-within,
.sidebar:hover,
.sidebar:focus-within {
    scrollbar-color: var(--neutral-400) transparent;
}

html:hover::-webkit-scrollbar-thumb,
body:hover::-webkit-scrollbar-thumb,
html:focus-within::-webkit-scrollbar-thumb,
body:focus-within::-webkit-scrollbar-thumb,
.sidebar:hover::-webkit-scrollbar-thumb,
.sidebar:focus-within::-webkit-scrollbar-thumb {
    background-color: rgba(202, 209, 217, 0.95);
}

@media (prefers-reduced-motion: reduce) {
    html::-webkit-scrollbar-thumb,
    body::-webkit-scrollbar-thumb,
    .sidebar::-webkit-scrollbar-thumb {
        transition: none;
    }
}

h2 { font-weight: 600; font-size: 1.6rem; letter-spacing: -0.02em; color: var(--neutral-900); margin-bottom: 0.4rem; }
h3 { font-weight: 600; font-size: 1.2rem; color: var(--neutral-900); }

/* ---- Utilitários ------------------------------------------ */
.text-center            { text-align: center; }
.d-flex                 { display: flex; }
.justify-content-center { justify-content: center; }
.align-items-center     { align-items: center; }
.gap-2  { gap: 0.5rem; }
.gap-3  { gap: 1rem; }
.mt-3   { margin-top: 1rem; }
.mb-3   { margin-bottom: 1rem; }
.mb-4   { margin-bottom: 1.5rem; }
.w-100  { width: 100%; }
.hidden { display: none !important; }

/* ---- Animação --------------------------------------------- */
.fade-in { animation: fadeSlideIn 0.35s ease forwards; }
@keyframes fadeSlideIn {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ---- Input premium (admin/login) -------------------------- */
.input-premium {
    border: 1.5px solid var(--neutral-300);
    border-radius: 14px;
    padding: 0.9rem 1.2rem;
    font-size: 1rem;
    background: rgba(255,255,255,0.7);
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.01);
    width: 100%;
}
.input-premium:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
    outline: none;
    background: white;
}

/* ---- Botões ----------------------------------------------- */
.btn-modern {
    border-radius: 24px;
    padding: 0.9rem 1.5rem;
    font-weight: 500;
    font-size: 1rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: white;
    color: var(--primary);
    border: 1.5px solid var(--neutral-300);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-decoration: none;
}
.btn-modern i { font-size: 1.1rem; display: inline-block; }
.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 24px -10px rgba(10,122,102,0.2);
    border-color: var(--primary-light);
}
.btn-primary-modern {
    background: var(--primary);
    border: 1.5px solid var(--primary);
    color: white;
    box-shadow: 0 12px 22px -10px rgba(14,158,132,0.4);
}
.btn-primary-modern:hover { background: var(--primary-light); border-color: var(--primary-light); color: white; }
.btn-secondary-modern { background: var(--secondary); border: 1.5px solid var(--secondary); color: white; }
.btn-secondary-modern:hover { background: var(--secondary-light); border-color: var(--secondary-light); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; border-radius: 14px; }
.btn-danger-modern { background: #dc3545; border: 1.5px solid #dc3545; color: white; }
.btn-danger-modern:hover { background: #c82333; border-color: #c82333; }

/* ---- Alertas ---------------------------------------------- */
.alert-danger { background: #f8d7da; color: #721c24; padding: 0.75rem 1.25rem; border-radius: 8px; }

/* ---- Form label ------------------------------------------- */
.form-label { font-weight: 500; color: var(--neutral-800); margin-bottom: 0.5rem; display: block; font-size: 0.9rem; }
/* Rótulos um pouco menores no formulário "Dados da locação" (mais compacto) */
.lease-fields .form-label { font-size: 0.8rem; }
.form-label .req-star { color: var(--danger, #dc2626); font-weight: 700; }

/* ---- Layout ----------------------------------------------- */
#app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--neutral-200);
}

/* ---- Top Header ------------------------------------------- */
.top-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--neutral-300);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    z-index: 100;
    gap: 1rem;
}
.top-header .brand {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    color: var(--primary);
    background: none;
    -webkit-text-fill-color: var(--primary);
    white-space: nowrap;
}
.top-header .spacer { flex: 1; }

/* Company switcher (super-admin only) */
.company-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-soft);
    border: 1.5px solid rgba(14,158,132,0.25);
    border-radius: 30px;
    padding: 4px 10px 4px 12px;
}
.company-switcher label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    white-space: nowrap;
}
.company-switcher select {
    border: none;
    background: transparent;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--neutral-800);
    cursor: pointer;
    outline: none;
    max-width: 200px;
}
/* Seletor de empresa estilizado (.custom-select) dentro da pílula do cabeçalho */
.company-switcher .custom-select { width: auto; }
.company-switcher .custom-select-trigger {
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0 0.15rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--neutral-800);
    min-width: 150px;
    max-width: 220px;
    border-radius: 0;
}
.company-switcher .custom-select-trigger:hover,
.company-switcher .custom-select-trigger:focus,
.company-switcher .custom-select.cs-open .custom-select-trigger {
    border: none;
    box-shadow: none;
    background: transparent;
}
.company-switcher .cs-chevron { color: var(--primary); }
/* Lista do seletor de empresa um pouco mais larga que o gatilho */
.custom-select-dropdown.cs-company-dd { min-width: 250px; }
.super-admin-badge {
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 30px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.notif-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--neutral-600);
    padding: 6px;
    border-radius: 50%;
    transition: var(--transition);
    line-height: 1;
}
.notif-btn:hover { background: var(--neutral-300); color: var(--primary); }
.notif-badge {
    position: absolute;
    top: 0; right: 0;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 30px;
    transition: var(--transition);
    border: 1.5px solid transparent;
}
.user-menu:hover { background: var(--primary-soft); border-color: var(--primary); }
.user-menu .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 600; font-size: 0.85rem;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.user-menu .avatar.has-image {
    border: 1.5px solid rgba(255,255,255,.75);
    box-shadow: inset 0 0 0 1px rgba(15,23,42,.10);
}
.user-menu .user-info { line-height: 1.2; }
.user-menu .user-info .uname { font-weight: 600; font-size: 0.88rem; color: var(--neutral-800); }
.user-menu .user-info .urole { font-size: 0.72rem; color: var(--primary); }
.user-menu.open { background: var(--primary-soft); border-color: var(--primary); }
.user-dropdown {
    position: fixed;
    top: 60px;
    right: 1rem;
    background: white;
    border: 1.5px solid var(--neutral-300);
    border-radius: 14px;
    box-shadow: 0 12px 32px -8px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
    min-width: 190px;
    z-index: 1100;
    padding: 0.4rem;
    animation: dropdownIn 0.15s ease;
}
@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    font-size: 0.88rem;
    color: var(--neutral-800);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}
.user-dropdown-item:hover { background: var(--neutral-200); }
.user-dropdown-item i { width: 16px; text-align: center; color: var(--neutral-600); }
.user-dropdown-item--danger { color: #dc3545; }
.user-dropdown-item--danger i { color: #dc3545; }
.user-dropdown-item--danger:hover { background: #fff0f1; }
.user-dropdown-divider { height: 1px; background: var(--neutral-300); margin: 0.3rem 0; }
.sidebar-toggle {
    background: none; border: none; cursor: pointer;
    font-size: 1.3rem; color: var(--neutral-600);
    padding: 6px; border-radius: 8px;
    transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--neutral-300); color: var(--primary); }

/* ---- Sidebar ---------------------------------------------- */
.sidebar {
    position: fixed;
    top: 60px; left: 0; bottom: 0;
    width: 240px;
    background: white;
    border-right: 1px solid var(--neutral-300);
    overflow-y: auto;
    transition: transform 0.25s ease, width 0.25s ease;
    z-index: 90;
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed { overflow: visible; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0.75rem; }

.nav-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--neutral-400);
    padding: 1rem 1.2rem 0.4rem;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.2rem;
    cursor: pointer;
    border-radius: 10px;
    margin: 0 0.5rem;
    color: var(--neutral-600);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
    border: 1.5px solid transparent;
    text-decoration: none;
}
.nav-item i { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }
/* Sub-item de menu (ex.: Integrações sob Configurações) */
.nav-item.nav-subitem { padding-left: 2.2rem; font-size: 0.85rem; }
.nav-item.nav-subitem i { font-size: 0.9rem; }
.sidebar.collapsed .nav-item.nav-subitem { padding-left: 0.75rem; }
.nav-item:hover { background: var(--primary-soft); color: var(--primary); }
.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: rgba(14,158,132,0.2);
}

/* ---- Main Content ----------------------------------------- */
.main-content {
    margin-top: 60px;
    margin-left: 240px;
    padding: 1.5rem;
    transition: margin-left 0.25s ease;
    min-height: calc(100vh - 60px);
}
.main-content.sidebar-collapsed { margin-left: 60px; }

/* ---- Page Header ------------------------------------------ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-header h2 { margin-bottom: 0; }

/* ---- Stat Cards ------------------------------------------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.2rem 1.1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--neutral-300);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.stat-icon.orange  { background: var(--primary-soft);    color: var(--primary); }
.stat-icon.blue    { background: var(--secondary-soft);  color: var(--secondary); }
.stat-icon.green   { background: rgba(0,200,100,0.1);    color: #00a852; }
.stat-icon.red     { background: rgba(220,53,69,0.1);    color: #dc3545; }
.stat-icon.yellow  { background: rgba(255,193,7,0.12);   color: #c79500; }
.stat-icon.purple  { background: rgba(111,66,193,0.1);   color: #6f42c1; }
.stat-value { font-weight: 700; font-size: 1.6rem; color: var(--neutral-900); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--neutral-600); margin-top: 2px; }

/* ---- Content Card ----------------------------------------- */
.content-card {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--neutral-300);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.content-card-header {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--neutral-300);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.content-card-body { padding: 1.2rem; }
.settings-layout {
    display: grid;
    gap: 1rem;
}
.settings-section .content-card-body {
    display: grid;
    gap: 1rem;
}
.settings-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
}
.settings-title-row h3 {
    margin: 0;
    font-size: 1.02rem;
    color: var(--neutral-900);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.settings-plan-badge {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--primary) 24%, transparent);
    border-radius: 999px;
    padding: 0.28rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
}
.settings-kv-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.settings-kv-item {
    border: 1px solid var(--neutral-300);
    background: #fff;
    border-radius: 12px;
    padding: 0.7rem 0.85rem;
}
.settings-kv-label {
    color: var(--neutral-600);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700;
}
.settings-kv-value {
    color: var(--neutral-900);
    margin-top: 0.25rem;
    font-size: 0.94rem;
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
}
.settings-permissions-box {
    border: 1px solid var(--neutral-300);
    border-radius: 12px;
    padding: 0.85rem;
    background: var(--neutral-200);
}
.settings-chips {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.settings-limits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.7rem;
}
.settings-limit-card {
    border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--neutral-300));
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
    background: #fff;
    display: grid;
    gap: 0.25rem;
}
.settings-limit-card span {
    font-size: 0.75rem;
    color: var(--neutral-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}
.settings-limit-card strong {
    color: var(--neutral-900);
    font-size: 1.1rem;
    line-height: 1.1;
}
.settings-note {
    border-left: 4px solid var(--secondary);
    background: color-mix(in srgb, var(--secondary-soft) 45%, #fff);
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
    color: var(--neutral-700);
    font-size: 0.85rem;
    line-height: 1.45;
}
/* ---- Table ------------------------------------------------ */
.table-wrap {
    overflow-x: auto;
    scrollbar-width: none;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s;
}
.table-wrap::-webkit-scrollbar { height: 5px; }
.table-wrap::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; transition: background 0.3s; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap.scroll-active {
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-300) transparent;
}
.table-wrap.scroll-active::-webkit-scrollbar-thumb { background: var(--neutral-300); }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--neutral-600);
    background: var(--neutral-200);
    border-bottom: 1px solid var(--neutral-300);
    white-space: nowrap;
}
.data-table tbody tr {
    border-bottom: 1px solid var(--neutral-300);
    transition: background 0.15s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--neutral-200); }
.data-table td {
    padding: 0.8rem 1rem;
    color: var(--neutral-800);
    vertical-align: middle;
}
.data-table .actions { display: flex; gap: 0.3rem; }
.data-table .actions .btn-modern i { font-size: 0.8rem; }

/* ---- Badges ----------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-received          { background: rgba(108,117,125,0.12); color: #495057; }
.badge-analyzing         { background: rgba(10,122,102,0.1);     color: var(--secondary); }
.badge-waiting_docs      { background: rgba(255,193,7,0.15);   color: #856404; }
.badge-approving         { background: rgba(111,66,193,0.12);  color: #6f42c1; }
.badge-waiting_signature { background: rgba(14,158,132,0.12);   color: var(--primary); }
.badge-executing         { background: rgba(13,202,240,0.12);  color: #0d6efd; }
.badge-completed         { background: rgba(25,135,84,0.12);   color: #198754; }
.badge-overdue           { background: rgba(220,53,69,0.12);   color: #dc3545; }
.badge-suspended         { background: rgba(108,117,125,0.1);  color: #6c757d; }
.badge-cancelled         { background: rgba(108,117,125,0.1);  color: #6c757d; }
.badge-open              { background: rgba(10,122,102,0.10);    color: var(--secondary); }
.badge-in_progress       { background: rgba(255,193,7,0.15);   color: #856404; }
.badge-waiting_customer  { background: rgba(14,158,132,0.12);   color: var(--primary); }
.badge-resolved          { background: rgba(25,135,84,0.12);   color: #198754; }
.badge-closed            { background: rgba(108,117,125,0.12); color: #495057; }
.badge-low               { background: rgba(25,135,84,0.1);    color: #198754; }
.badge-medium            { background: rgba(10,122,102,0.1);     color: var(--secondary); }
.badge-high              { background: rgba(255,193,7,0.15);   color: #856404; }
.badge-urgent            { background: rgba(220,53,69,0.12);   color: #dc3545; }
.badge-active            { background: rgba(25,135,84,0.1);    color: #198754; }
.badge-inactive          { background: rgba(108,117,125,0.1);  color: #6c757d; }

/* SLA indicator dots */
.sla-ok      { color: #198754; font-weight: 600; }
.sla-warning { color: #c79500; font-weight: 600; }
.sla-overdue { color: #dc3545; font-weight: 600; }

/* ---- Filters Bar ------------------------------------------ */
.filters-bar {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.6rem;
    margin-bottom: 1rem;
    align-items: center;
}
.filters-bar .custom-select:has(.filter-select-sm) {
    width: 125px;
    max-width: 125px;
    min-width: unset;
}
.logs-filters-grid {
    display: grid;
    grid-template-columns: minmax(280px, 2fr) repeat(3, minmax(160px, 1fr)) minmax(145px, 0.8fr) minmax(145px, 0.8fr) auto;
    align-items: center;
    gap: 0.6rem;
}
.logs-filters-grid .search-input,
.logs-filters-grid .filter-select-sm,
.logs-filters-grid .custom-select,
.logs-filters-grid input[type="date"] {
    width: 100%;
    min-width: 0;
}
.logs-filters-grid .custom-select:has(.filter-select-sm) {
    width: 100%;
    max-width: none;
}
#logs-filters #log-search {
    min-width: 0;
}
#logs-filters .btn-modern.btn-sm {
    justify-self: end;
    min-width: 44px;
}
@media (max-width: 1320px) {
    .logs-filters-grid {
        grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(150px, 1fr)) repeat(2, minmax(140px, 0.9fr));
    }
}
.filter-select {
    border: 1.5px solid var(--neutral-300);
    border-radius: 10px;
    padding: 0.5rem 0.9rem;
    font-size: 0.88rem;
    background: white;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}
.filter-select:focus { border-color: var(--primary); box-shadow: var(--shadow-focus); }
.search-input {
    border: 1.5px solid var(--neutral-300);
    border-radius: 10px;
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    background: white;
    outline: none;
    transition: var(--transition);
    min-width: 300px;
    height: 42px;
    box-sizing: border-box;
}
.search-input:focus { border-color: var(--primary); box-shadow: var(--shadow-focus); }
#proto-search {
    width: 250px !important;
    min-width: 250px;
    flex: 0 0 250px;
}
.page-tip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: -0.25rem 0 0.9rem;
    padding: 0.62rem 0.8rem;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--secondary) 20%, transparent);
    background: color-mix(in srgb, var(--secondary-soft) 62%, #fff);
    color: var(--neutral-700);
    font-size: 0.78rem;
    line-height: 1.4;
}
.page-tip i {
    color: var(--secondary);
    flex: 0 0 auto;
}

/* ---- Tickets UX ------------------------------------------- */
.ticket-shell,
.page-shell {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    animation: fadeSlideIn 0.25s ease forwards;
}
.ticket-hero,
.page-hero {
    border: 1px solid rgba(14,158,132,0.22);
    background: linear-gradient(135deg, rgba(14,158,132,0.10) 0%, rgba(10,122,102,0.08) 100%);
    border-radius: 12px;
    padding: 0.72rem 0.9rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.page-hero.page-hero-dashboard {
    border-color: rgba(10,122,102,0.24);
    background: linear-gradient(135deg, rgba(10,122,102,0.11) 0%, rgba(13,202,240,0.08) 100%);
}
.page-hero.page-hero-protocols {
    border-color: rgba(14,158,132,0.24);
    background: linear-gradient(135deg, rgba(14,158,132,0.12) 0%, rgba(10,122,102,0.08) 100%);
}
.page-hero.page-hero-leases {
    border-color: rgba(32,148,243,0.24);
    background: linear-gradient(135deg, rgba(32,148,243,0.11) 0%, rgba(59,130,246,0.07) 100%);
}
.page-hero.page-hero-tenants {
    border-color: rgba(255,157,0,0.24);
    background: linear-gradient(135deg, rgba(255,157,0,0.12) 0%, rgba(14,158,132,0.08) 100%);
}
.page-hero.page-hero-properties {
    border-color: rgba(25,135,84,0.24);
    background: linear-gradient(135deg, rgba(25,135,84,0.11) 0%, rgba(13,202,240,0.06) 100%);
}
.page-hero.page-hero-services {
    border-color: rgba(111,66,193,0.24);
    background: linear-gradient(135deg, rgba(111,66,193,0.11) 0%, rgba(32,148,243,0.07) 100%);
}
.page-hero.page-hero-reports {
    border-color: rgba(99,102,241,0.24);
    background: linear-gradient(135deg, rgba(99,102,241,0.11) 0%, rgba(32,148,243,0.07) 100%);
}
.page-hero.page-hero-users {
    border-color: rgba(59,130,246,0.24);
    background: linear-gradient(135deg, rgba(59,130,246,0.11) 0%, rgba(14,165,233,0.07) 100%);
}
.page-hero.page-hero-permissions {
    border-color: rgba(168,85,247,0.24);
    background: linear-gradient(135deg, rgba(168,85,247,0.11) 0%, rgba(99,102,241,0.07) 100%);
}
.page-hero.page-hero-logs {
    border-color: rgba(14,116,144,0.24);
    background: linear-gradient(135deg, rgba(14,116,144,0.11) 0%, rgba(32,148,243,0.07) 100%);
}
.page-hero.page-hero-settings {
    border-color: rgba(15,118,110,0.24);
    background: linear-gradient(135deg, rgba(15,118,110,0.11) 0%, rgba(13,202,240,0.07) 100%);
}
.page-hero.page-hero-appearance {
    border-color: rgba(236,72,153,0.24);
    background: linear-gradient(135deg, rgba(236,72,153,0.10) 0%, rgba(111,66,193,0.08) 100%);
}
.page-hero.page-hero-about {
    border-color: rgba(14,158,132,0.24);
    background: linear-gradient(135deg, rgba(14,158,132,0.10) 0%, rgba(14,116,144,0.08) 100%);
}
.ticket-hero i,
.page-hero i {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: rgba(255,255,255,0.72);
    border: 1px solid rgba(14,158,132,0.26);
}
.page-hero.page-hero-dashboard i {
    border-color: rgba(10,122,102,0.32);
}
.page-hero.page-hero-protocols i {
    border-color: rgba(14,158,132,0.32);
}
.page-hero.page-hero-leases i {
    border-color: rgba(32,148,243,0.32);
}
.page-hero.page-hero-tenants i {
    border-color: rgba(255,157,0,0.34);
}
.page-hero.page-hero-properties i {
    border-color: rgba(25,135,84,0.34);
}
.page-hero.page-hero-services i {
    border-color: rgba(111,66,193,0.34);
}
.page-hero.page-hero-reports i {
    border-color: rgba(99,102,241,0.34);
}
.page-hero.page-hero-users i {
    border-color: rgba(59,130,246,0.34);
}
.page-hero.page-hero-permissions i {
    border-color: rgba(168,85,247,0.34);
}
.page-hero.page-hero-logs i {
    border-color: rgba(14,116,144,0.34);
}
.page-hero.page-hero-settings i {
    border-color: rgba(15,118,110,0.34);
}
.page-hero.page-hero-appearance i {
    border-color: rgba(236,72,153,0.34);
}
.page-hero.page-hero-about i {
    border-color: rgba(14,158,132,0.34);
}
.ticket-hero strong,
.page-hero strong {
    color: var(--neutral-900);
    font-size: 0.92rem;
    letter-spacing: 0.01em;
}
.ticket-hero span,
.page-hero span {
    color: var(--neutral-700);
    font-size: 0.8rem;
}
.ticket-filters {
    padding: 0.62rem;
    border: 1px solid var(--neutral-300);
    border-radius: 12px;
    background: linear-gradient(180deg, #fff 0%, #f9fbff 100%);
    box-shadow: 0 8px 20px rgba(15,26,42,0.04);
}
.ticket-table-card {
    border: 1px solid var(--neutral-300);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 10px 26px rgba(15,26,42,0.05);
}
.ticket-form-shell {
    display: grid;
    gap: 0.75rem;
}
.ticket-form-banner {
    border: 1px solid rgba(14,158,132,0.22);
    background: linear-gradient(135deg, rgba(14,158,132,0.10) 0%, rgba(10,122,102,0.08) 100%);
    border-radius: 10px;
    padding: 0.62rem 0.72rem;
    font-size: 0.82rem;
    color: var(--neutral-800);
}
.ticket-comment-card {
    border: 1px solid var(--neutral-300);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
    box-shadow: 0 3px 10px rgba(15,26,42,0.04);
}
#rpt-from,
#rpt-to {
    width: 210px;
    min-width: 210px;
    flex: 0 0 210px;
}

/* ---- Modal ------------------------------------------------ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,26,42,0.55);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    z-index: 200;
    padding: 1rem;
    animation: fadeSlideIn 0.2s ease;
}

/* Confirm overlay — sits on top of an existing modal */
.confirm-overlay {
    position: fixed; inset: 0;
    background: rgba(15,26,42,0.45);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    z-index: 400;
    padding: 1rem;
    animation: fadeSlideIn 0.15s ease;
}
.confirm-overlay-box {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    padding: 1.75rem 2rem;
    max-width: 380px;
    width: 100%;
    display: flex; flex-direction: column; gap: 1.25rem;
}
.confirm-overlay-msg {
    margin: 0;
    font-size: 0.95rem;
    color: var(--neutral-800);
    line-height: 1.5;
}
.confirm-overlay-actions {
    display: flex; gap: 0.75rem; justify-content: flex-end;
}

/* ---- First Access Tutorial ------------------------------- */
.first-access-tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    pointer-events: none;
}
.first-access-tutorial-backdrop {
    position: absolute;
    inset: 0;
    overflow: hidden;
}
.first-access-tutorial-shade {
    position: fixed;
    background: transparent;
    pointer-events: none;
    transition: all .18s ease;
}
.first-access-tutorial-soft-edge {
    position: fixed;
    z-index: 2147483600;
    border-radius: 14px;
    pointer-events: none;
}
.first-access-tutorial-soft-edge::before {
    content: '';
    position: absolute;
    inset: -22px;
    border-radius: 24px;
    background:
        radial-gradient(ellipse at center, rgba(255,255,255,0) 48%, rgba(255,255,255,0.2) 78%, rgba(255,255,255,0.28) 100%),
        radial-gradient(ellipse at 30% 20%, rgba(14,158,132,0.08), rgba(14,158,132,0) 62%),
        radial-gradient(ellipse at 75% 80%, rgba(10,122,102,0.07), rgba(10,122,102,0) 64%);
    opacity: .55;
}
.first-access-tutorial-soft-edge::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.82),
        0 0 0 1px rgba(255,255,255,0.35);
}
.first-access-tutorial-card {
    position: fixed;
    right: 1.2rem;
    left: auto;
    bottom: 1.2rem;
    margin: 0;
    max-width: min(440px, calc(100vw - 1.6rem));
    width: min(440px, calc(100vw - 1.6rem));
    background: linear-gradient(160deg, rgba(255,255,255,0.96), rgba(255,255,255,0.92));
    border: 1px solid rgba(255,255,255,0.8);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(8,18,34,0.32);
    padding: 1rem 1rem 0.95rem;
    pointer-events: auto;
    max-height: calc(100vh - 2.4rem);
    overflow: auto;
    animation: fadeSlideIn .2s ease;
    transition: left .2s ease, top .2s ease, width .2s ease;
    will-change: left, top;
}
.first-access-tutorial-card.is-dragging {
    transition: none;
    user-select: none;
}
.first-access-tutorial-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    margin-bottom: .55rem;
    cursor: grab;
    touch-action: none;
}
.first-access-tutorial-card.is-dragging .first-access-tutorial-head {
    cursor: grabbing;
}
.first-access-tutorial-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .75rem;
    font-weight: 700;
    color: var(--secondary);
    background: var(--secondary-soft);
    border: 1px solid rgba(10,122,102,.2);
    border-radius: 999px;
    padding: .26rem .6rem;
}
.first-access-tutorial-progress {
    font-size: .76rem;
    font-weight: 700;
    color: var(--neutral-600);
}
.first-access-tutorial-card h4 {
    margin: 0 0 .5rem;
    color: var(--neutral-900);
    font-size: 1.03rem;
    letter-spacing: -.01em;
}
.first-access-tutorial-card.is-compact {
    max-width: 360px;
    width: min(360px, calc(100vw - 2rem));
    padding: .8rem .85rem .75rem;
}
.first-access-tutorial-card.is-compact h4 {
    font-size: .95rem;
    margin-bottom: .4rem;
}
.first-access-tutorial-card.is-compact .first-access-tutorial-body {
    font-size: .83rem;
    line-height: 1.45;
}
.first-access-tutorial-card.is-compact .first-access-tutorial-actions .btn-modern {
    padding: .4rem .68rem;
    font-size: .76rem;
}
.first-access-tutorial-card.is-mini {
    max-width: 300px;
    width: min(300px, calc(100vw - 1rem));
    padding: .68rem .72rem .65rem;
}
.first-access-tutorial-card.is-mini h4 {
    font-size: .88rem;
    margin-bottom: .32rem;
}
.first-access-tutorial-card.is-mini .first-access-tutorial-badge,
.first-access-tutorial-card.is-mini .first-access-tutorial-progress {
    font-size: .69rem;
}
.first-access-tutorial-card.is-mini .first-access-tutorial-body {
    font-size: .78rem;
    line-height: 1.4;
}
.first-access-tutorial-card.is-mini .first-access-tutorial-actions {
    margin-top: .5rem;
}
.first-access-tutorial-card.is-mini .first-access-tutorial-actions .btn-modern {
    padding: .34rem .58rem;
    font-size: .72rem;
}
.first-access-tutorial-body {
    color: var(--neutral-800);
    font-size: .9rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.first-access-tutorial-body p {
    margin: 0 0 .4rem;
}
.first-access-tutorial-body code {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.first-access-tutorial-actions {
    margin-top: .75rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    flex-wrap: wrap;
}
.first-access-tutorial-actions .btn-modern {
    padding: .46rem .8rem;
    font-size: .8rem;
}
.first-access-welcome-modal {
    max-width: 600px;
}
.first-access-welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .72rem;
    font-weight: 700;
    color: var(--secondary);
    background: var(--secondary-soft);
    border: 1px solid rgba(10,122,102,.2);
    border-radius: 999px;
    padding: .24rem .58rem;
}
.first-access-welcome-hero {
    border: 1px solid rgba(10,122,102,.12);
    background:
        linear-gradient(135deg, rgba(14,158,132,0.09), rgba(10,122,102,0.08));
    border-radius: 14px;
    padding: .82rem .9rem;
    margin-bottom: .78rem;
}
.first-access-welcome-hero h4 {
    margin: 0 0 .3rem;
    color: var(--neutral-900);
    font-size: .98rem;
    letter-spacing: -.01em;
}
.first-access-welcome-hero p {
    margin: 0;
    color: var(--neutral-700);
    font-size: .88rem;
    line-height: 1.5;
}
.first-access-welcome-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: .45rem;
}
.first-access-welcome-list li {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    color: var(--neutral-800);
    font-size: .87rem;
    line-height: 1.45;
}
.first-access-welcome-list li i {
    color: var(--primary);
    margin-top: .16rem;
}
.first-access-welcome-actions {
    justify-content: space-between;
}
.tutorial-highlight-target {
    position: relative;
    z-index: 2147483646 !important;
    border-radius: 12px;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.0),
        0 0 0 3px rgba(14,158,132,0.0),
        0 10px 24px rgba(0,0,0,0.0);
    animation: tutorialPulse 1.6s ease-in-out infinite;
    isolation: isolate;
}
@keyframes tutorialPulse {
    0%, 100% {
        box-shadow:
            0 0 0 1px rgba(255,255,255,0.0),
            0 0 0 3px var(--primary),
            0 10px 24px rgba(0,0,0,0.0);
    }
    50% {
        box-shadow:
            0 0 0 1px rgba(255,255,255,0.0),
            0 0 0 5px var(--primary),
            0 12px 30px rgba(0,0,0,0.0);
    }
}

body.tutorial-no-blur-sidebar #sidebar {
    z-index: 1305 !important;
}
.modal-box {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 60px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    overflow: hidden;
    display: flex; flex-direction: column;
}
.modal-box.modal-lg { max-width: 860px; }
.modal-box.modal-xl { max-width: 750px; }
.modal-box.modal-full {
    max-width: calc(100vw - 1.5rem);
    width: calc(100vw - 1.5rem);
    max-height: calc(100vh - 1.5rem);
    height: calc(100vh - 1.5rem);
}
.modal-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--neutral-300);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.modal-header h3 { margin: 0; }
.modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.3rem; color: var(--neutral-600);
    transition: var(--transition);
    padding: 4px;
    border-radius: 6px;
    line-height: 1;
}
.modal-close:hover { background: var(--neutral-300); color: var(--neutral-900); }
.modal-body {
    padding: 1.5rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--neutral-300);
    display: flex; gap: 0.75rem; justify-content: flex-end;
    flex-shrink: 0;
    background: white;
    position: sticky;
    bottom: 0;
    z-index: 1;
}

/* ---- Form Grid -------------------------------------------- */
.form-grid { display: grid; gap: 1rem; }
.form-grid > * { min-width: 0; }
/* Imóvel: respiro extra entre as linhas dos campos */
#property-form .form-grid { row-gap: 1.4rem; }

/* Dados bancários: Banco/Agência/Conta mais estreitos, Chave PIX mais larga */
.lease-bank-grid { grid-template-columns: repeat(3, 1fr) 1.6fr; }

/* Campo somente leitura (ex.: Caução calculada) */
.form-control[readonly] { background: var(--neutral-200); cursor: not-allowed; }

/* Vistorias: galeria de fotos */
.insp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.5rem; margin-top: 0.6rem; }
.insp-photo { position: relative; margin: 0; }
.insp-photo img { width: 100%; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--neutral-300); cursor: zoom-in; }
.insp-photo-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: none; border-radius: 50%;
    background: rgba(220,53,69,0.92); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Formatação das variáveis do contrato (negrito/maiúsculas) */
.vf-list { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.4rem 0 0.6rem; }
.vf-row { display: flex; align-items: center; gap: 1rem; padding: 0.4rem 0.6rem; border: 1px solid var(--neutral-300); border-radius: 8px; }
.vf-key { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.82rem; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vf-opt { display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; white-space: nowrap; cursor: pointer; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid-5 { grid-template-columns: repeat(5, 1fr); }

.form-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--neutral-500);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
    margin-bottom: 0.75rem;
}
.form-section-pill {
    text-align: center;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    background: transparent;
    width: fit-content;
    display: block;
    margin: 0 auto 0.9rem;
    font-size: 0.8rem;
}
.form-group { display: flex; flex-direction: column; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: span 3; }
.form-group.span-4 { grid-column: span 4; }
.rep-address-collapse {
    margin-top: 0.75rem;
    max-height: 760px;
    opacity: 1;
    transform: translateY(0);
    overflow: hidden;
    transition: max-height 0.28s ease, opacity 0.22s ease, transform 0.22s ease, margin-top 0.22s ease;
}
.rep-address-collapse.rep-address-collapse--closed {
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    margin-top: 0;
    pointer-events: none;
}
.form-control {
    border: 1.5px solid var(--neutral-300);
    border-radius: 10px;
    padding: 0.65rem 0.9rem;
    font-size: 0.9rem;
    font-family: inherit;
    background: white;
    transition: var(--transition);
    width: 100%;
    color: var(--neutral-800);
}
.form-control:focus { border-color: var(--primary); box-shadow: var(--shadow-focus); outline: none; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ---- Select Modern (global) ------------------------------ */
select.form-control:not(.custom-select-native) {
    height: 42px;
    padding-right: 2.35rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--primary) 50%),
        linear-gradient(135deg, var(--primary) 50%, transparent 50%);
    background-position:
        calc(100% - 16px) calc(50% - 2px),
        calc(100% - 10px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
select.form-control:not(.custom-select-native):hover {
    border-color: var(--neutral-400);
    background-color: #fcfdff;
}
select.form-control:not(.custom-select-native):focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
    background-color: #fff;
}
select.form-control:not(.custom-select-native) option,
select.form-control:not(.custom-select-native) optgroup,
select.adm-native-select-modern option,
select.adm-native-select-modern optgroup {
    background: #ffffff;
    color: var(--neutral-800);
}
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--neutral-400);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    display: inline-grid;
    place-content: center;
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease, transform .12s ease;
}
input[type="checkbox"]::after {
    content: '';
    width: 10px;
    height: 10px;
    opacity: 0;
    transform: scale(.6);
    transition: opacity .18s ease, transform .18s ease;
    background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 20 20%22 fill=%22none%22%3E%3Cpath d=%22M5 10.5 8.5 14 15 7%22 stroke=%22%23ffffff%22 stroke-width=%222.6%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22/%3E%3C/svg%3E");
}
input[type="checkbox"]:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11,102,177,.16);
}
input[type="checkbox"]:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
}
input[type="checkbox"]:active {
    transform: scale(.96);
}
input[type="checkbox"]:checked {
    border-color: var(--primary);
    background: var(--primary);
}
input[type="checkbox"]:checked::after {
    opacity: 1;
    transform: scale(1);
}
input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: .55;
    border-color: var(--neutral-300);
    background: var(--neutral-100);
}
.code-lite-wrap {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    border: 1.5px solid var(--neutral-300);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}
.code-lite-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
}
.code-lite-gutter {
    background: var(--neutral-100);
    border-right: 1px solid var(--neutral-300);
    color: var(--neutral-500);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.55;
    padding: 0.6rem 0.35rem;
    overflow: hidden;
    user-select: none;
    text-align: right;
}
.code-lite-gutter span {
    display: block;
    min-height: 1.55em;
}
.code-lite-textarea {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.76rem;
    line-height: 1.55;
    resize: vertical;
    min-height: 180px;
    white-space: pre;
}
.code-lite-textarea:focus {
    border: none !important;
    box-shadow: none !important;
    outline: none;
}
input[type="date"].form-control {
    appearance: none;
    -webkit-appearance: none;
    min-height: 44px;
    padding-right: 2.75rem;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,247,250,0.98));
    color-scheme: light;
    position: relative;
}
input[type="date"].form-control::-webkit-date-and-time-value {
    text-align: left;
    color: var(--neutral-800);
}
input[type="date"].form-control::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.72;
    padding: 0.2rem;
    border-radius: 8px;
    transition: var(--transition);
    filter: sepia(1) saturate(6) hue-rotate(-10deg);
}
input[type="date"].form-control::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    background: var(--primary-soft);
}
input[type="date"].form-control::-webkit-inner-spin-button {
    display: none;
}
input[type="date"].form-control::-webkit-clear-button {
    display: none;
}

/* ---- Custom Date Picker ----------------------------------- */
.date-picker { position: relative; width: 100%; user-select: none; }
.date-picker-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border: 1.5px solid var(--neutral-300);
    border-radius: 10px;
    padding: 0.65rem 0.9rem;
    font-size: 0.9rem;
    font-family: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,247,250,0.98));
    color: var(--neutral-800);
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
    text-align: left;
}
.date-picker-trigger:hover { border-color: var(--neutral-400); }
.date-picker.dp-open .date-picker-trigger,
.date-picker-trigger:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
    outline: none;
}
.date-picker-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-picker-label.date-picker-placeholder { color: var(--neutral-400); }
.date-picker-icon { color: var(--primary); font-size: 1rem; flex-shrink: 0; }
.date-picker-dropdown {
    display: none;
    position: fixed;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(14,158,132,0.16);
    border-radius: 16px;
    box-shadow: 0 24px 40px -20px rgba(15,26,42,0.35), 0 12px 24px rgba(14,158,132,0.08);
    z-index: 99999;
    padding: 0.9rem;
    min-width: 320px;
}
.date-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
    gap: 0.75rem;
}
.date-picker-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--neutral-900);
    text-transform: capitalize;
    text-align: center;
    flex: 1;
}
/* Título clicável (abre a grade de meses/anos) */
button.date-picker-title {
    border: none; background: transparent; cursor: pointer; border-radius: 8px;
    padding: 0.3rem 0.5rem; transition: var(--transition, all .15s ease);
}
button.date-picker-title:hover { background: var(--primary-soft, rgba(14,158,132,.12)); color: var(--primary); }
/* Grade de meses/anos (faixas de opções estilizadas) */
.date-grid-cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.date-cell {
    border: 1px solid transparent; background: transparent; cursor: pointer;
    border-radius: 10px; padding: 0.6rem 0.2rem; font-size: 0.86rem; font-weight: 600;
    color: var(--neutral-800); transition: var(--transition, all .15s ease);
}
.date-cell:hover { background: var(--primary-soft, rgba(14,158,132,.12)); color: var(--primary); }
.date-cell.is-today { border-color: var(--primary-light, var(--primary)); color: var(--primary); }
.date-cell.is-selected { background: var(--primary); color: #fff; }
.date-nav {
    width: 34px;
    height: 34px;
    border: 1px solid var(--neutral-300);
    border-radius: 10px;
    background: white;
    color: var(--neutral-800);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.date-nav:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: var(--primary-soft);
}
.date-weekdays,
.date-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.3rem;
}
.date-weekdays {
    margin-bottom: 0.45rem;
}
.date-weekdays span {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--neutral-600);
    text-align: center;
    padding: 0.2rem 0;
}
.date-day {
    border: none;
    background: transparent;
    min-height: 36px;
    border-radius: 10px;
    font-size: 0.88rem;
    color: var(--neutral-800);
    cursor: pointer;
    transition: var(--transition);
}
.date-day:hover {
    background: var(--primary-soft);
    color: var(--primary);
}
.date-day.is-muted {
    color: var(--neutral-400);
    cursor: default;
}
.date-day.is-today {
    box-shadow: inset 0 0 0 1.5px rgba(10,122,102,0.25);
    color: var(--secondary);
    font-weight: 700;
}
.date-day.is-selected {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    font-weight: 700;
    box-shadow: 0 10px 18px -10px rgba(14,158,132,0.6);
}
.date-picker-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--neutral-300);
}
.date-link-btn {
    border: none;
    background: transparent;
    color: var(--secondary);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.25rem 0.1rem;
    transition: var(--transition);
}
.date-link-btn:hover { color: var(--primary); }

/* ---- Custom Select ---------------------------------------- */
.custom-select { position: relative; width: 100%; user-select: none; }

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: 1.5px solid var(--neutral-300);
    border-radius: 10px;
    padding: 0.54rem 0.9rem;
    font-size: 0.9rem;
    font-family: inherit;
    background: white;
    color: var(--neutral-800);
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}
.custom-select-trigger:hover { border-color: var(--neutral-400); }
.custom-select-trigger:focus { border-color: var(--primary); box-shadow: var(--shadow-focus); }
.custom-select.cs-open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.custom-select.cs-open.cs-up .custom-select-trigger {
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.custom-select-trigger > .cs-trigger-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-select-trigger > .cs-trigger-label.cs-label-placeholder { color: var(--neutral-400); }
.custom-select.cs-right .custom-select-trigger > .cs-trigger-label { text-align: right; }
.cs-label-meta { color: var(--neutral-400); }
.cs-option-meta { color: var(--neutral-400); }
.cs-label-meta,
.cs-option-meta {
    font-size: 0.78em;
    margin-left: 0.15rem;
}

.cs-chevron {
    font-size: 0.78rem;
    color: var(--neutral-600);
    transition: transform 0.2s ease, color 0.2s;
    flex-shrink: 0;
}
.custom-select.cs-open .cs-chevron { transform: rotate(180deg); color: var(--primary); }

.custom-select-dropdown {
    display: none;
    position: fixed;
    background: white;
    border: 1.5px solid var(--primary);
    border-top: none;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    box-shadow: 0 8px 24px -4px rgba(14,158,132,0.12), 0 4px 12px rgba(0,0,0,0.06);
    z-index: 99999;
    max-height: 220px;
    overflow: hidden auto;
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-300) transparent;
}
/* Dropdown renderizado no body: a classe de "abrir p/ cima" vai no próprio dropdown. */
.custom-select-dropdown.cs-dd-up {
    border-top: 1.5px solid var(--primary);
    border-bottom: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    box-shadow: 0 -8px 24px -4px rgba(14,158,132,0.12), 0 -4px 12px rgba(0,0,0,0.06);
}

.cs-option {
    padding: 0.4rem 0.9rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    color: var(--neutral-600);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cs-option + .cs-option { border-top: 1px solid var(--neutral-300); }
.cs-option:hover:not(.cs-disabled):not(.cs-selected) { background: var(--primary-soft); color: var(--primary); }
.cs-option.cs-selected { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.cs-option.cs-selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
    margin-left: auto;
    color: var(--primary);
}
.cs-option.cs-placeholder { color: var(--neutral-400); font-style: italic; }
.cs-option.cs-disabled    { color: var(--neutral-400); cursor: default; pointer-events: none; }
.custom-select-dropdown.cs-right .cs-option { justify-content: flex-end; text-align: right; }

.cs-search-wrap {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--neutral-300);
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}
.cs-search-input {
    width: 100%;
    border: 1.5px solid var(--neutral-300);
    border-radius: 7px;
    padding: 0.4rem 0.7rem 0.4rem 2rem;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--neutral-800);
    background: var(--neutral-200) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236C7A8A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 0.55rem center;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.cs-search-input:focus { border-color: var(--primary); box-shadow: var(--shadow-focus); background-color: white; }

.cs-empty {
    padding: 0.75rem 0.9rem;
    font-size: 0.85rem;
    color: var(--neutral-600);
    text-align: center;
    font-style: italic;
}

/* ---- Notification Dropdown -------------------------------- */
.notif-dropdown {
    position: fixed;
    top: 60px; right: 1rem;
    width: 360px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px rgba(0,0,0,0.18);
    border: 1px solid var(--neutral-300);
    z-index: 150;
    max-height: 480px;
    display: flex; flex-direction: column;
    animation: fadeSlideIn 0.2s ease;
}
.notif-dropdown-header {
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--neutral-300);
    display: flex; align-items: center; justify-content: space-between;
}
.notif-list { overflow-y: auto; flex: 1; }
.notif-item {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--neutral-300);
    cursor: pointer;
    transition: background 0.15s;
    display: flex; gap: 0.75rem;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--neutral-200); }
.notif-item.unread { background: var(--primary-soft); }
.notif-item .notif-icon {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--secondary-soft);
    color: var(--secondary);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.95rem; flex-shrink: 0;
}
.notif-item.unread .notif-icon { background: var(--primary-soft); color: var(--primary); }
.notif-title { font-weight: 600; font-size: 0.85rem; color: var(--neutral-800); }
.notif-msg   { font-size: 0.8rem; color: var(--neutral-600); margin-top: 2px; }
.notif-time  { font-size: 0.72rem; color: var(--neutral-400); margin-top: 4px; }

/* ---- Dashboard Grid --------------------------------------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.dash-grid .span-2 { grid-column: span 2; }

/* ---- Activity Feed ---------------------------------------- */
.activity-item { display: flex; gap: 0.75rem; padding: 0.7rem 0; border-bottom: 1px solid var(--neutral-300); }
.activity-item:last-child { border-bottom: none; }
.activity-item-link { cursor: pointer; border-radius: 6px; transition: background 0.15s; }
.activity-item-link:hover { background: var(--neutral-100, #f5f5f5); padding-left: 0.4rem; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 6px; }
.activity-info { flex: 1; }
.activity-action { font-weight: 600; font-size: 0.85rem; color: var(--neutral-800); }
.activity-meta { font-size: 0.78rem; color: var(--neutral-600); margin-top: 2px; }

/* ---- Detail Panel ----------------------------------------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1.5rem; font-size: 0.9rem; }
.detail-label { font-weight: 600; font-size: 0.78rem; text-transform: uppercase; color: var(--neutral-600); letter-spacing: 0.05em; }
.detail-value { color: var(--neutral-900); margin-top: 2px; }
.detail-section { margin-top: 1.2rem; }
.detail-section h4 { font-size: 0.95rem; font-weight: 600; color: var(--neutral-800); margin-bottom: 0.75rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--neutral-300); }

/* ---- History Timeline ------------------------------------- */
.timeline { padding-left: 1rem; border-left: 2px solid var(--neutral-300); }
.timeline-item { position: relative; padding: 0 0 1rem 1.2rem; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px; top: 5px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--primary);
}
.timeline-item .t-action { font-weight: 600; font-size: 0.88rem; color: var(--neutral-800); }
.timeline-item .t-desc   { font-size: 0.82rem; color: var(--neutral-600); margin-top: 2px; }
.timeline-item .t-meta   { font-size: 0.75rem; color: var(--neutral-400); margin-top: 4px; }

/* ---- Login Screen ----------------------------------------- */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(145deg, var(--neutral-200) 0%, #FFFFFF 100%);
    padding: 1.5rem 1rem;
}
.login-card {
    max-width: 420px;
    width: 100%;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2.5rem 2rem;
    animation: loginCardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .brand-name {
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: -0.03em;
    background: linear-gradient(140deg, var(--secondary) 0%, var(--primary) 90%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-logo p { color: var(--neutral-600); font-size: 0.95rem; }

/* ---- Empty State ------------------------------------------ */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--neutral-600); }
.empty-state i { font-size: 3rem; opacity: 0.3; margin-bottom: 1rem; }
.empty-state p { font-size: 0.95rem; }

/* ---- Loading Spinner -------------------------------------- */
.spinner {
    display: inline-block;
    width: 28px; height: 28px;
    border: 3px solid var(--neutral-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; align-items: center; justify-content: center; padding: 2rem; }

/* ---- Tooltip ---------------------------------------------- */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::before,
[data-tooltip]::after {
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 2147483647;
}
/* Bubble */
[data-tooltip]::before {
    content: attr(data-tooltip);
    bottom: calc(100% + 10px);
    background: linear-gradient(135deg, var(--neutral-900) 0%, #1e3248 100%);
    color: #fff;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    padding: 0.42rem 0.75rem;
    border-radius: 8px;
    box-shadow: 0 8px 24px -4px rgba(15,26,42,0.35), 0 2px 8px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.07);
    letter-spacing: 0.01em;
}
/* Arrow */
[data-tooltip]::after {
    content: '';
    bottom: calc(100% + 4px);
    border: 5px solid transparent;
    border-top-color: var(--neutral-900);
    transform: translateX(-50%) translateY(-6px);
    width: 0;
    height: 0;
}

/* Show on hover/focus */
[data-tooltip]:hover::before,
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::before,
[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Position: bottom */
[data-tooltip][data-tooltip-pos="bottom"]::before {
    bottom: auto;
    top: calc(100% + 10px);
}
[data-tooltip][data-tooltip-pos="bottom"]::after {
    bottom: auto;
    top: calc(100% + 4px);
    border-top-color: transparent;
    border-bottom-color: var(--neutral-900);
    transform: translateX(-50%) translateY(6px);
}
[data-tooltip][data-tooltip-pos="bottom"]:hover::before,
[data-tooltip][data-tooltip-pos="bottom"]:hover::after,
[data-tooltip][data-tooltip-pos="bottom"]:focus-visible::before,
[data-tooltip][data-tooltip-pos="bottom"]:focus-visible::after {
    transform: translateX(-50%) translateY(0);
}

/* Position: left */
[data-tooltip][data-tooltip-pos="left"]::before {
    bottom: auto;
    top: 50%;
    left: auto;
    right: calc(100% + 10px);
    transform: translateY(-50%) translateX(6px);
}
[data-tooltip][data-tooltip-pos="left"]::after {
    bottom: auto;
    top: 50%;
    left: auto;
    right: calc(100% + 4px);
    border-top-color: transparent;
    border-left-color: var(--neutral-900);
    border-right-color: transparent;
    transform: translateY(-50%) translateX(6px);
}
[data-tooltip][data-tooltip-pos="left"]:hover::before,
[data-tooltip][data-tooltip-pos="left"]:hover::after,
[data-tooltip][data-tooltip-pos="left"]:focus-visible::before,
[data-tooltip][data-tooltip-pos="left"]:focus-visible::after {
    transform: translateY(-50%) translateX(0);
}

/* Position: right */
[data-tooltip][data-tooltip-pos="right"]::before {
    bottom: auto;
    top: 50%;
    left: calc(100% + 10px);
    transform: translateY(-50%) translateX(-6px);
}
[data-tooltip][data-tooltip-pos="right"]::after {
    bottom: auto;
    top: 50%;
    left: calc(100% + 4px);
    border-top-color: transparent;
    border-right-color: var(--neutral-900);
    border-left-color: transparent;
    transform: translateY(-50%) translateX(-6px);
}
[data-tooltip][data-tooltip-pos="right"]:hover::before,
[data-tooltip][data-tooltip-pos="right"]:hover::after,
[data-tooltip][data-tooltip-pos="right"]:focus-visible::before,
[data-tooltip][data-tooltip-pos="right"]:focus-visible::after {
    transform: translateY(-50%) translateX(0);
}

/* Variant: primary (laranja) */
[data-tooltip][data-tooltip-theme="primary"]::before {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    box-shadow: 0 8px 24px -4px rgba(14,158,132,0.4), 0 2px 8px rgba(14,158,132,0.2);
    border-color: rgba(255,255,255,0.15);
}
[data-tooltip][data-tooltip-theme="primary"]::after {
    border-top-color: var(--primary);
}
[data-tooltip][data-tooltip-theme="primary"][data-tooltip-pos="bottom"]::after {
    border-top-color: transparent;
    border-bottom-color: var(--primary);
}
[data-tooltip][data-tooltip-theme="primary"][data-tooltip-pos="left"]::after {
    border-top-color: transparent;
    border-left-color: var(--primary);
}
[data-tooltip][data-tooltip-theme="primary"][data-tooltip-pos="right"]::after {
    border-top-color: transparent;
    border-right-color: var(--primary);
}

/* ---- Contract Templates ---------------------------------- */
.ct-shell {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.ct-tabs-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.55rem 0.65rem 0;
    box-shadow: 0 8px 24px rgba(15,23,42,0.04);
}
.ct-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid var(--neutral-200);
    padding-bottom: 0;
}
.ct-tab {
    padding: 0.58rem 0.95rem;
    border: none;
    background: none;
    color: var(--neutral-600);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px 10px 0 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.15s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.ct-tab:hover { background: var(--neutral-100); color: var(--neutral-800); transform: translateY(-1px); }
.ct-tab--active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: color-mix(in srgb, var(--primary-soft) 65%, #fff);
}
.ct-shared-type-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0 0 0.9rem;
    padding: 0.65rem 0.8rem;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--primary) 26%, transparent);
    background: color-mix(in srgb, var(--primary-soft) 55%, #fff);
    color: var(--neutral-700);
    font-size: 0.76rem;
    line-height: 1.35;
}
.ct-shared-type-note i {
    color: var(--primary);
    margin-top: 0.05rem;
}
.ct-workspace-note {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid color-mix(in srgb, var(--secondary) 22%, transparent);
    background: color-mix(in srgb, var(--secondary) 8%, #fff);
    border-radius: 10px;
    color: var(--neutral-700);
    font-size: 0.77rem;
}
.ct-workspace-note i { color: var(--secondary); }

/* Upload zone */
.ct-upload-zone {
    border: 2px dashed var(--neutral-300);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.ct-upload-zone--over {
    border-color: var(--primary);
    background: var(--primary-soft);
}

/* Editor layout */
.ct-editor {
    display: grid;
    grid-template-columns: minmax(265px, 300px) minmax(0, 1fr);
    gap: 0.85rem;
    height: calc(100vh - 240px);
    min-height: 540px;
}

/* Field panel */
.ct-field-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ct-field-panel-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--neutral-700);
    background: linear-gradient(180deg, #fff 0%, var(--neutral-50) 100%);
    flex-shrink: 0;
}
.ct-field-panel-body {
    overflow-y: auto;
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.ct-field-group-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--neutral-500);
    margin-bottom: 0.4rem;
}
.ct-field-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.ct-chip {
    padding: 0.3rem 0.62rem;
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
    border-radius: 6px;
    font-size: 0.67rem;
    font-weight: 500;
    font-family: monospace;
    cursor: grab;
    user-select: none;
    transition: background 0.15s, transform 0.1s;
    line-height: 1.4;
}
.ct-chip:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); transform: scale(1.04); }
.ct-chip:active { cursor: grabbing; transform: scale(0.97); }

/* Viewer */
.ct-viewer-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.65rem;
    box-shadow: 0 8px 24px rgba(15,23,42,0.04);
}
.ct-viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    flex-shrink: 0;
    position: relative;
    z-index: 50;
    background: var(--neutral-50);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.45rem 0.5rem;
    position: sticky;
    top: 0;
}
.ct-viewer-toolbar-left, .ct-viewer-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.ct-viewer-toolbar [data-tooltip] {
    position: relative;
    z-index: 60;
}
.ct-viewer-toolbar [data-tooltip]:hover,
.ct-viewer-toolbar [data-tooltip]:focus-visible {
    z-index: 70;
}
.ct-btn-danger {
    background: var(--danger-soft, #fee2e2) !important;
    color: var(--danger, #dc2626) !important;
    border-color: color-mix(in srgb, var(--danger, #dc2626) 30%, transparent) !important;
}
.ct-btn-danger:hover { background: var(--danger, #dc2626) !important; color: #fff !important; }
.ct-tool-active {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}

.ct-pdf-outer {
    flex: 1;
    overflow: auto;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.75), rgba(255,255,255,0.75)),
        repeating-linear-gradient(
            45deg,
            rgba(15,23,42,0.03) 0,
            rgba(15,23,42,0.03) 10px,
            rgba(15,23,42,0.05) 10px,
            rgba(15,23,42,0.05) 20px
        );
    border-radius: 12px;
    padding: 1rem;
    position: relative;
    z-index: 1;
    border: 1px solid var(--border);
}
.ct-pdf-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.ct-pdf-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--neutral-500);
    padding: 3rem;
    font-size: 0.9rem;
}

/* PDF page with overlay */
.ct-pdf-page {
    position: relative;
    display: block;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
    border-radius: 4px;
    overflow: visible;
    cursor: crosshair;
    flex-shrink: 0;
}
.ct-pdf-page canvas {
    display: block;
    border-radius: 4px;
    pointer-events: none;
}

/* Placed token */
.ct-token {
    position: absolute;
    transform: translate(-4px, -50%);
    background: var(--primary);
    color: #fff;
    border-radius: 5px;
    padding: 2px 6px 2px 7px;
    font-size: 0.65rem;
    font-family: monospace;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: move;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    z-index: 10;
    user-select: none;
    transition: box-shadow 0.1s;
}
.ct-token:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.35); z-index: 20; }
.ct-token-field {
    transform: translate(-50%, -50%);
    padding: 0;
    border-radius: 4px;
    background: rgba(14,158,132, 0.88);
    border: 1px solid rgba(255,255,255,0.45);
    overflow: visible;
}
.ct-token-label {
    display: block;
    width: 100%;
    text-align: left;
    padding: 1px 4px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}
.ct-token-eraser {
    background: #fff;
    color: #111;
    border: 1px dashed #9ca3af;
    transform: translate(-50%, -50%);
    padding: 0;
    min-width: 12px;
    min-height: 12px;
    border-radius: 2px;
    opacity: 0.98;
}
.ct-token-remove {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 1px;
    border-radius: 3px;
    transition: color 0.1s;
}
.ct-token-remove:hover { color: #fff; }
.ct-token-eraser .ct-token-remove { color: #111; }
.ct-token-eraser .ct-token-remove:hover { color: #000; }
.ct-token-eraser .ct-token-remove {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
}
.ct-token-eraser:hover .ct-token-remove,
.ct-token-eraser:focus-within .ct-token-remove {
    opacity: 1;
    pointer-events: auto;
}
.ct-token-resize-handle {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    border: 1px solid #9ca3af;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: nwse-resize;
}
.ct-token-field .ct-token-remove {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.18);
    color: #111;
}
.ct-token-field .ct-token-remove:hover { color: #000; }
.ct-paint-draft {
    position: absolute;
    border: 1px dashed #6b7280;
    background: rgba(255, 255, 255, 0.8);
    z-index: 14;
    pointer-events: none;
}
@media (max-width: 1260px) {
    .ct-editor {
        grid-template-columns: minmax(245px, 280px) minmax(0, 1fr);
        height: calc(100vh - 255px);
    }
}
@media (max-width: 980px) {
    .ct-editor {
        grid-template-columns: 1fr;
        height: auto;
        min-height: unset;
    }
    .ct-field-panel {
        max-height: 280px;
    }
    .ct-viewer-wrap {
        min-height: 560px;
    }
}

/* ---- Toast ------------------------------------------------ */
#toast-container {
    position: fixed;
    bottom: 1.5rem; right: 1.5rem;
    z-index: 300;
    display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
    background: var(--neutral-800);
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    font-size: 0.88rem;
    max-width: 320px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    animation: fadeSlideIn 0.3s ease;
    display: flex; align-items: center; gap: 0.5rem;
}
.toast.success { background: #58A53F; }
.toast.error   { background: #dc3545; }
.toast.warning { background: #c79500; }

/* ---- Responsive ------------------------------------------- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 240px !important; }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    .dash-grid { grid-template-columns: 1fr; }
    .dash-grid .span-2 { grid-column: span 1; }
    .form-grid-2,
    .form-grid-3,
    .form-grid-4,
    .form-grid-5 { grid-template-columns: 1fr; }
    .form-group.span-2,
    .form-group.span-3,
    .form-group.span-4 { grid-column: span 1; }
    .detail-grid { grid-template-columns: 1fr; }
    .notif-dropdown { width: calc(100vw - 2rem); right: 1rem; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .logs-filters-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
    #logs-filters .btn-modern.btn-sm {
        justify-self: stretch;
    }
    .first-access-welcome-actions {
        justify-content: flex-end;
    }
    .first-access-welcome-actions .btn-modern {
        min-width: 132px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .first-access-tutorial-card {
        transition: none;
    }
}
@media (max-width: 480px) {
    h2 { font-size: 1.5rem; }
    .btn-modern { padding: 0.8rem 1.2rem; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .filters-bar { flex-wrap: wrap; }
    .search-input { min-width: unset; }
    .page-tip { margin-top: 0; }
    .logs-filters-grid {
        grid-template-columns: 1fr;
    }
    .first-access-tutorial-card {
        right: .8rem;
        left: .8rem;
        width: auto;
        max-width: none;
    }
}

/* ============================================================
   Aprimoramento JS (Imobil): <select> nativos viram .custom-select.
   Mantém os campos de filtro com largura adequada na barra de filtros.
   ============================================================ */
.filters-bar .custom-select { flex: 0 0 auto; width: auto; min-width: 160px; }
.filters-bar .custom-select .custom-select-trigger { min-width: 160px; }
#proto-filter-status, #proto-filter-priority { min-width: 160px; }

/* ============================================================
   MODO ESCURO (Imobil) — ativado por [data-theme="dark"] no <html>.
   Redefine tokens e sobrepõe superfícies que usam branco literal.
   ============================================================ */
[data-theme="dark"] {
    --primary-soft:   rgba(14,158,132,0.16);
    --secondary-soft: rgba(10,122,102,0.20);
    --neutral-200:    #15171c;
    --neutral-300:    #2a2f37;
    --neutral-400:    #3a4049;
    --neutral-600:    #9aa3b2;
    --neutral-800:    #e6e9ee;
    --neutral-900:    #f4f6f8;
    --shadow-sm:      0 10px 25px -5px rgba(0,0,0,0.55), 0 8px 10px -6px rgba(0,0,0,0.4);
    --shadow-md:      0 20px 30px -12px rgba(0,0,0,0.6), 0 4px 18px rgba(0,0,0,0.45);
    --shadow-focus:   0 0 0 4px rgba(14,158,132,0.28);
    --surface:        #16181d;
    --surface-2:      #1c1f26;
    --app-bg:         #0c0d10;
}

[data-theme="dark"] body {
    background: linear-gradient(145deg, #0c0d10 0%, #121419 100%);
    color: var(--neutral-900);
}
[data-theme="dark"] #app-shell { background: var(--app-bg); }

[data-theme="dark"] .top-header {
    background: rgba(18,20,25,0.85);
    border-bottom-color: var(--neutral-300);
}
[data-theme="dark"] .sidebar {
    background: #121419;
    border-right-color: var(--neutral-300);
}

[data-theme="dark"] .stat-card,
[data-theme="dark"] .content-card,
[data-theme="dark"] .ticket-table-card,
[data-theme="dark"] .ticket-filters,
[data-theme="dark"] .ticket-comment-card,
[data-theme="dark"] .modal-box,
[data-theme="dark"] .confirm-overlay-box,
[data-theme="dark"] .user-dropdown,
[data-theme="dark"] .notif-dropdown,
[data-theme="dark"] .settings-kv-item,
[data-theme="dark"] .settings-limit-card,
[data-theme="dark"] .settings-permissions-box {
    background: var(--surface);
    border-color: var(--neutral-300);
}
[data-theme="dark"] .content-card-header,
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    background: var(--surface);
    border-color: var(--neutral-300);
}

[data-theme="dark"] .data-table thead th {
    background: var(--surface-2);
    color: var(--neutral-600);
    border-bottom-color: var(--neutral-300);
}
[data-theme="dark"] .data-table tbody tr { border-bottom-color: var(--neutral-300); }
[data-theme="dark"] .data-table tbody tr:hover { background: var(--surface-2); }
[data-theme="dark"] .data-table td { color: var(--neutral-800); }

[data-theme="dark"] .form-control,
[data-theme="dark"] .input-premium,
[data-theme="dark"] .search-input,
[data-theme="dark"] .filter-select,
[data-theme="dark"] .date-picker-trigger,
[data-theme="dark"] select.form-control:not(.custom-select-native) {
    background-color: var(--surface-2);
    color: var(--neutral-800);
    border-color: var(--neutral-300);
}
[data-theme="dark"] select.form-control:not(.custom-select-native) option,
[data-theme="dark"] select.adm-native-select-modern option {
    background: #1c1f26;
    color: var(--neutral-800);
}
[data-theme="dark"] input[type="checkbox"] { background: var(--surface-2); border-color: var(--neutral-400); }
[data-theme="dark"] input[type="checkbox"]:checked { background: var(--primary); border-color: var(--primary); }

[data-theme="dark"] .custom-select-trigger { background: var(--surface-2); color: var(--neutral-800); }
[data-theme="dark"] .custom-select-dropdown { background: var(--surface); }
[data-theme="dark"] .cs-search-input { background-color: var(--surface-2); color: var(--neutral-800); }
[data-theme="dark"] .cs-search-input:focus { background-color: var(--surface-2); }

[data-theme="dark"] .btn-modern {
    background: var(--surface-2);
    color: var(--neutral-800);
    border-color: var(--neutral-300);
}
[data-theme="dark"] .btn-primary-modern { background: var(--primary); color: #fff; border-color: var(--primary); }
[data-theme="dark"] .btn-secondary-modern { background: var(--secondary); color: #fff; border-color: var(--secondary); }
[data-theme="dark"] .btn-danger-modern { background: #dc3545; color: #fff; border-color: #dc3545; }

[data-theme="dark"] .user-dropdown-item { color: var(--neutral-800); }
[data-theme="dark"] .user-dropdown-item:hover { background: var(--surface-2); }
[data-theme="dark"] .user-dropdown-item--danger:hover { background: rgba(220,53,69,0.16); }

[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.62); }
[data-theme="dark"] .confirm-overlay { background: rgba(0,0,0,0.55); }

[data-theme="dark"] .login-screen .content-card { background: var(--surface); border-color: var(--neutral-300); }

[data-theme="dark"] .notif-item { border-bottom-color: var(--neutral-300); }
[data-theme="dark"] .notif-item:hover { background: var(--surface-2); }

/* Helpers com tom claro (notas, dicas, heros) */
[data-theme="dark"] .settings-note,
[data-theme="dark"] .page-tip {
    background: var(--surface-2);
    color: var(--neutral-800);
    border-color: var(--neutral-300);
}
[data-theme="dark"] .ticket-hero strong,
[data-theme="dark"] .page-hero strong { color: var(--neutral-900); }
[data-theme="dark"] .ticket-hero span,
[data-theme="dark"] .page-hero span { color: var(--neutral-600); }
[data-theme="dark"] .empty-state,
[data-theme="dark"] .cs-empty,
[data-theme="dark"] .nav-section-title { color: var(--neutral-600); }

/* ============================================================
   Assistente (wizard) de novo protocolo
   ============================================================ */
.wizard-steps { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.4rem; }
.wizard-step { display: flex; align-items: center; gap: 0.5rem; }
.wizard-step:not(:last-child) { flex: 1; }
.wizard-step .ws-dot {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.82rem; flex-shrink: 0;
    background: var(--neutral-200); color: var(--neutral-600);
    border: 1.5px solid var(--neutral-300);
    transition: var(--transition);
}
.wizard-step .ws-label { font-size: 0.82rem; color: var(--neutral-600); font-weight: 500; white-space: nowrap; }
.wizard-step .ws-line { flex: 1; height: 2px; background: var(--neutral-300); border-radius: 2px; margin: 0 0.3rem; }
.wizard-step.is-active .ws-dot { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: var(--shadow-focus); }
.wizard-step.is-active .ws-label { color: var(--primary); font-weight: 600; }
.wizard-step.is-done .ws-dot { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.wizard-step.is-done .ws-line { background: var(--primary); }

.wizard-panel { display: none; }
.wizard-panel.is-active { display: block; animation: fadeSlideIn 0.25s ease; }

.wizard-review-item { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--neutral-300); }
.wizard-review-item:last-child { border-bottom: none; }
.wizard-review-item .wr-label { color: var(--neutral-600); font-size: 0.85rem; }
.wizard-review-item .wr-value { color: var(--neutral-900); font-weight: 600; font-size: 0.9rem; text-align: right; }

/* Etapa "Plano" do assistente — cartões selecionáveis (pré/pós-pago) */
.plan-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.plan-card {
    position: relative; display: flex; flex-direction: column; gap: 0.35rem; cursor: pointer;
    border: 1.5px solid var(--neutral-300); border-radius: 14px; padding: 1.1rem 1.1rem 1.2rem; background: #fff;
    transition: var(--transition, all .15s ease);
}
.plan-card:hover { border-color: var(--primary); }
.plan-card.is-selected { border-color: var(--primary); background: var(--primary-soft, rgba(14,158,132,.10)); box-shadow: 0 6px 18px rgba(0,0,0,.06); }
.plan-card-ico { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--primary-soft, rgba(14,158,132,.12)); color: var(--primary); font-size: 1.05rem; }
.plan-card-title { font-weight: 700; font-size: 1rem; color: var(--neutral-900); }
.plan-card-desc { font-size: 0.84rem; color: var(--neutral-600); line-height: 1.35; }
.plan-card-check { position: absolute; top: 0.8rem; right: 0.9rem; color: var(--primary); font-size: 1.1rem; opacity: 0; transition: var(--transition, all .15s ease); }
.plan-card.is-selected .plan-card-check { opacity: 1; }
@media (max-width: 560px) { .plan-choice { grid-template-columns: 1fr; } }

@media (max-width: 600px) {
    .wizard-step .ws-label { display: none; }
}

/* ============================================================
   Editor de texto rico (Modelo de Contrato)
   ============================================================ */
.rte-wrap { border: 1px solid var(--neutral-300); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.rte-wrap:focus-within { border-color: var(--primary); box-shadow: var(--shadow-focus); }
.rte-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem;
    padding: 0.45rem 0.5rem; background: var(--neutral-100);
    border-bottom: 1px solid var(--neutral-300);
    position: relative; z-index: 5; /* tooltips da barra ficam acima da área do editor */
}
.rte-toolbar .rte-sep { width: 1px; align-self: stretch; background: var(--neutral-300); margin: 0.15rem 0.25rem; }
.rte-toolbar .rte-tip { display: inline-flex; align-items: center; }

/* Abas (usado na página de Integrações) */
.int-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; border-bottom: 2px solid var(--neutral-200); margin: 0.2rem 0 1.3rem; }
.int-tab { padding: 0.58rem 0.95rem; border: none; background: none; color: var(--neutral-600); font-size: 0.82rem; font-weight: 600; cursor: pointer; border-radius: 10px 10px 0 0; border-bottom: 2px solid transparent; margin-bottom: -2px; display: inline-flex; align-items: center; gap: 0.4rem; transition: color .15s, border-color .15s, background .15s; }
.int-tab:hover { background: var(--neutral-200); color: var(--neutral-800); }
.int-tab--active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-soft); }
.rte-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 30px; padding: 0 0.45rem;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    background: transparent; color: var(--neutral-700); cursor: pointer;
    font-size: 0.85rem; line-height: 1; transition: background 0.15s, color 0.15s;
}
.rte-btn:hover { background: var(--surface); color: var(--primary); border-color: var(--neutral-300); }
.rte-btn:active, .rte-btn.is-active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.rte-select {
    height: 30px; padding: 0 0.5rem; border: 1px solid var(--neutral-300);
    border-radius: var(--radius-sm); background: var(--surface); color: var(--neutral-800);
    font-family: inherit; font-size: 0.82rem; cursor: pointer;
}
.rte-color {
    display: inline-flex; align-items: center; gap: 0.25rem; height: 30px; padding: 0 0.4rem;
    border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; color: var(--neutral-700);
    position: relative;
}
.rte-color:hover { background: var(--surface); border-color: var(--neutral-300); }
.rte-color input[type="color"] {
    width: 18px; height: 18px; padding: 0; border: none; background: none; cursor: pointer;
}
.rte-editor {
    min-height: 360px; max-height: 58vh; overflow-y: auto;
    padding: 1rem 1.1rem; line-height: 1.7; font-size: 0.95rem; color: var(--neutral-900);
    outline: none; background: var(--surface);
}
.rte-editor:empty::before { content: attr(data-placeholder); color: var(--neutral-500); }
.rte-editor p { margin: 0 0 0.7rem; }
.rte-editor h1 { font-size: 1.4rem; margin: 0.4rem 0 0.7rem; }
.rte-editor h2 { font-size: 1.2rem; margin: 0.4rem 0 0.6rem; }
.rte-editor h3 { font-size: 1.05rem; margin: 0.4rem 0 0.5rem; }
.rte-editor ul, .rte-editor ol { margin: 0 0 0.7rem 1.4rem; }
.rte-editor blockquote {
    margin: 0 0 0.7rem; padding: 0.4rem 0.9rem; border-left: 3px solid var(--primary);
    background: var(--neutral-100); color: var(--neutral-700);
}
.rte-editor .rte-token {
    display: inline; position: static; transform: none; cursor: text;
    background: var(--primary-soft); color: var(--primary); border-radius: 4px;
    padding: 0.05rem 0.25rem; font-weight: 600; font-size: inherit; white-space: nowrap;
}

[data-theme="dark"] .rte-toolbar { background: var(--surface-2); }
[data-theme="dark"] .rte-btn:hover { background: var(--surface); }
[data-theme="dark"] .rte-select,
[data-theme="dark"] .rte-editor { background: var(--surface); color: var(--neutral-800); }
[data-theme="dark"] .rte-editor blockquote { background: var(--surface-2); }

/* Pré-visualização do contrato (folha estilo documento; cores fixas como papel) */
.contract-preview-sheet {
    background: #fff; border: 1px solid #E9EDF2; border-radius: 12px;
    padding: 2.4rem 2.6rem; max-width: 780px; margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}
.cp-letterhead { text-align: center; padding-bottom: 1rem; margin-bottom: 1.4rem; border-bottom: 1px solid #E9EDF2; }
.cp-letterhead .cp-lh-logo { max-height: 64px; max-width: 240px; object-fit: contain; display: inline-block; }
.cp-letterhead .cp-lh-name { font-size: 1rem; font-weight: 600; color: #6C7A8A; margin-top: 0.3rem; letter-spacing: 0.02em; }
.cp-doc-footer { margin-top: 2rem; padding-top: 0.7rem; border-top: 1px solid #E9EDF2; font-size: 0.72rem; color: #6C7A8A; line-height: 1.5; }
.cp-doc-footer .df-name { font-weight: 700; color: #1A2634; }
.contract-preview-sheet .cps-head { border-bottom: 2px solid var(--primary); padding-bottom: 0.8rem; margin-bottom: 1.4rem; }
.contract-preview-sheet .cps-head h1 { font-size: 1.2rem; margin: 0; color: #1A2634; }
.contract-preview { line-height: 1.7; font-size: 0.96rem; color: #1A2634; }
.contract-preview p { margin: 0 0 0.85rem; }
.contract-preview h1 { font-size: 1.4rem; margin: 0.4rem 0 0.8rem; }
.contract-preview h2 { font-size: 1.2rem; margin: 0.4rem 0 0.7rem; }
.contract-preview h3 { font-size: 1.05rem; margin: 0.4rem 0 0.6rem; }
.contract-preview ul, .contract-preview ol { margin: 0 0 0.85rem 1.5rem; }
.contract-preview li { margin: 0.15rem 0; }
.contract-preview blockquote { margin: 0 0 0.85rem; padding: 0.5rem 1rem; border-left: 3px solid var(--primary); background: #FAFBFC; color: #6C7A8A; }
.contract-preview img { max-width: 100%; height: auto; }
.rte-preview-var { background: var(--primary-soft); color: var(--primary); border-radius: 4px; padding: 0.02rem 0.28rem; font-weight: 600; }
/* Variável já utilizada no corpo do modelo + resumo de uso */
.ct-var.is-used { background: var(--primary-soft); color: var(--primary); }
.ct-var.is-used::after { content: '\2713'; margin-left: .35rem; font-weight: 700; }
.ct-var-status { display: flex; flex-direction: column; gap: .3rem; font-size: .74rem; margin: .1rem 0 .7rem; line-height: 1.35; }
.ct-var-status .cm-vs-ok { color: var(--neutral-600); }
.ct-var-status .cm-vs-warn { color: #b26a00; font-weight: 600; }
/* Popover / Info Card detalhado da variável */
.ct-var-pop {
    position: absolute; z-index: 4000; width: 290px; max-width: calc(100vw - 16px);
    background: #fff; border: 1px solid var(--neutral-300, #d9e0ea); border-radius: 12px;
    box-shadow: 0 14px 38px rgba(16,32,58,.18); padding: .8rem .9rem;
    font-size: .8rem; color: var(--neutral-700, #2c3a4d); line-height: 1.45;
    animation: ctPopIn .12s ease-out;
}
@keyframes ctPopIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.ct-var-pop::after {
    content: ''; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
    border: 7px solid transparent; border-top-color: #fff;
    filter: drop-shadow(0 2px 1px rgba(16,32,58,.10));
}
.ct-var-pop.below::after { bottom: auto; top: -7px; border-top-color: transparent; border-bottom-color: #fff; }
.ct-pop-head { display: flex; align-items: flex-start; gap: .6rem; margin-bottom: .5rem; }
.ct-pop-head > div { min-width: 0; flex: 1; }
.ct-pop-ico {
    flex: none; width: 30px; height: 30px; border-radius: 8px; display: inline-flex;
    align-items: center; justify-content: center; font-size: .9rem;
    background: var(--primary-soft, rgba(14,158,132,.12)); color: var(--primary, #0E9E84);
}
.ct-pop-title { font-weight: 700; color: var(--ink, #1a2634); font-size: .86rem; overflow-wrap: anywhere; }
.ct-pop-token {
    display: inline-block; max-width: 100%; margin-top: .15rem; font-size: .74rem; font-weight: 600;
    background: rgba(14,158,132,.12); color: var(--primary, #0E9E84);
    padding: .05rem .35rem; border-radius: 5px;
    white-space: normal; word-break: break-all;
}
.ct-pop-desc { margin: .15rem 0 .55rem; }
.ct-pop-meta { display: flex; gap: .4rem; align-items: flex-start; padding-top: .5rem; border-top: 1px solid var(--neutral-200, #eef2f7); font-size: .76rem; color: var(--neutral-600, #6c7a8a); }
.ct-pop-meta i { color: var(--primary, #0E9E84); margin-top: .12rem; }
.ct-pop-hint { margin-top: .45rem; font-size: .72rem; color: var(--neutral-500, #8a97a8); display: flex; align-items: center; gap: .35rem; }
/* Ícone "?" de ajuda nos rótulos de campo (tooltip ao passar o mouse) */
.field-help {
    display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; margin-left: .3rem; border-radius: 50%;
    font-size: 10px; font-weight: 700; line-height: 1; cursor: help; vertical-align: middle;
    color: var(--neutral-500, #8a97a8); border: 1px solid var(--neutral-300, #d9e0ea); background: #fff;
    position: relative; user-select: none; transition: color .12s ease, border-color .12s ease;
}
.field-help:hover, .field-help:focus { color: var(--primary, #0E9E84); border-color: var(--primary, #0E9E84); outline: none; }
/* Tooltip posicionado via JS (renderizado no body — não é cortado pelo modal) */
.field-help-tip {
    position: absolute; z-index: 6000; width: max-content; max-width: 240px;
    background: #1a2634; color: #fff; font-size: .72rem; font-weight: 500; line-height: 1.4; text-align: left;
    padding: .45rem .6rem; border-radius: 8px; box-shadow: 0 10px 26px rgba(16,32,58,.28);
    pointer-events: none; animation: fhTipIn .1s ease-out;
}
@keyframes fhTipIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.field-help-tip::after {
    content: ''; position: absolute; top: 100%; left: var(--arrow, 50%); transform: translateX(-50%);
    border: 6px solid transparent; border-top-color: #1a2634;
}
.field-help-tip.below::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #1a2634; }

/* Campo de upload de arquivo estilizado */
.file-field {
    display: flex; align-items: center; gap: 0.75rem; cursor: pointer;
    border: 1px solid var(--neutral-300); border-radius: var(--radius-md);
    background: var(--surface); padding: 0.4rem; transition: border-color 0.15s, box-shadow 0.15s;
}
.file-field:hover { border-color: var(--primary); }
.file-field:focus-within { border-color: var(--primary); box-shadow: var(--shadow-focus); }
.file-field-btn {
    display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff; font-weight: 600; font-size: 0.9rem;
    padding: 0.62rem 1.2rem; border-radius: 22px;
    box-shadow: 0 10px 18px -8px rgba(14,158,132,0.55), inset 0 1px 0 rgba(255,255,255,0.28);
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.file-field-btn i { font-size: 1rem; }
.file-field:hover .file-field-btn {
    transform: translateY(-1px); filter: brightness(1.04);
    box-shadow: 0 14px 24px -8px rgba(14,158,132,0.6), inset 0 1px 0 rgba(255,255,255,0.35);
}
.file-field:active .file-field-btn { transform: translateY(0); box-shadow: 0 6px 12px -8px rgba(14,158,132,0.5), inset 0 1px 0 rgba(255,255,255,0.2); }
.file-field-name {
    color: var(--neutral-500); font-size: 0.88rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-field.has-file .file-field-name { color: var(--neutral-900); font-weight: 500; }
[data-theme="dark"] .file-field { background: var(--surface); }

/* Logo do papel timbrado (Configurações) */
.lh-logo-row { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.lh-logo-preview {
    width: 160px; height: 96px; flex: none; display: flex; align-items: center; justify-content: center;
    border: 1px dashed var(--neutral-300); border-radius: var(--radius-md);
    background: var(--surface); overflow: hidden; padding: 0.4rem;
}
.lh-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lh-logo-empty { color: var(--neutral-400); font-size: 1.8rem; }
.lh-logo-actions { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }

/* ============================================================
   Integração externa (API JWT) — modal em Empresas
   ============================================================ */
.int-wrap { display: grid; gap: 1rem; }
.int-card { padding: 1rem 1.1rem; }
.int-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.int-hint { font-size: .8rem; color: var(--neutral-600, #6C7A8A); margin-top: .35rem; }
.int-muted { font-size: .82rem; color: var(--neutral-600, #6C7A8A); padding: .35rem 0; }
.int-status { margin-top: .6rem; font-size: .84rem; font-weight: 600; color: var(--neutral-600, #6C7A8A); }
.int-status .fa-circle-check { color: #1f9d55; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.switch .switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--neutral-300, #E9EDF2); transition: background .18s ease; }
.switch .switch-track::before { content: ""; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 999px; background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.28); transition: transform .18s ease; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::before { transform: translateX(22px); }

/* Toggle switch (checkbox estilizado) — opções de configuração */
input[type="checkbox"].toggle-switch {
    -webkit-appearance: none; appearance: none; flex: none; margin: 0; cursor: pointer;
    width: 42px !important; height: 24px !important; border-radius: 999px;
    background: var(--neutral-300); position: relative; vertical-align: middle;
    transition: background .18s ease;
}
input[type="checkbox"].toggle-switch::before {
    content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.28); transition: transform .18s ease;
}
input[type="checkbox"].toggle-switch:checked { background: var(--primary); }
input[type="checkbox"].toggle-switch:checked::before { transform: translateX(18px); }
input[type="checkbox"].toggle-switch:disabled { opacity: .5; cursor: not-allowed; }

/* Lista de credenciais */
.int-cred-list { display: grid; gap: .5rem; margin-top: .6rem; }
.int-cred { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border: 1px solid var(--neutral-300, #E9EDF2); border-radius: 10px; padding: .6rem .75rem; }
.int-cred code { font-size: .8rem; }

/* Caixa do segredo (exibido uma vez) */
.int-secret { border: 1px solid var(--primary); background: var(--primary-soft); border-radius: 10px; padding: .75rem; margin: .6rem 0; }
.int-secret-h { font-size: .82rem; font-weight: 700; color: var(--primary); margin-bottom: .5rem; }
.int-secret-row { display: flex; align-items: center; gap: .5rem; margin: .25rem 0; font-size: .82rem; }
.int-secret-row > span { width: 78px; color: var(--neutral-600, #6C7A8A); }
.int-secret-row > code { flex: 1; overflow-wrap: anywhere; }

/* Documentação de endpoints */
.int-doc { margin-top: .5rem; display: grid; gap: .2rem; }
.int-doc-h { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--neutral-600, #6C7A8A); margin: .5rem 0 .15rem; }
.int-ep { font-size: .82rem; display: flex; align-items: center; gap: .5rem; }
.int-ep code { font-size: .8rem; }
.int-ep .int-d { color: var(--neutral-600, #6C7A8A); font-size: .76rem; }
.int-m { display: inline-block; min-width: 44px; text-align: center; font-size: .68rem; font-weight: 700; border-radius: 5px; padding: .12rem .35rem; color: #fff; }
.int-m-get { background: #2563eb; }
.int-m-post { background: #1f9d55; }
.int-m-put { background: #d97706; }
.int-m-delete { background: #dc2626; }

/* ===== Imobil — identidade "O carnê": tipografia ===== */
h1, h2, h3, h4, h5, .brand { font-family: 'Bricolage Grotesque', 'Public Sans', system-ui, sans-serif; letter-spacing: -0.01em; }
code, kbd, pre, samp, .mono { font-family: 'DM Mono', ui-monospace, Menlo, Consolas, monospace; }
