:root {
    --navy: #10233d;
    --navy-2: #173252;
    --navy-3: #1f4066;
    --gold: #c4a056;
    --gold-soft: #f4e8c8;
    --gold-deep: #a8863f;
    --bg: #e8eef4;
    --bg-subtle: #f3f6f9;
    --card: #ffffff;
    --text: #172033;
    --muted: #5d6b7c;
    --line: #d5dde7;
    --line-soft: #e8eef4;
    --success: #1b7a4a;
    --success-bg: #e5f6ec;
    --danger: #b42318;
    --danger-bg: #fde8e6;
    --warning: #b54708;
    --warning-bg: #feefd6;
    --info: #175cd3;
    --info-bg: #e7effc;
    --shadow-sm: 0 1px 2px rgba(16, 35, 61, 0.04);
    --shadow: 0 8px 24px rgba(16, 35, 61, 0.06);
    --shadow-md: 0 16px 40px rgba(16, 35, 61, 0.1);
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 20px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --focus-ring: 0 0 0 3px rgba(196, 160, 86, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    background:
        radial-gradient(ellipse 80% 50% at 100% -10%, rgba(196, 160, 86, 0.07), transparent 50%),
        linear-gradient(180deg, #e4ebf3 0%, var(--bg) 40%, #eef2f6 100%);
    background-attachment: fixed;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.45;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }
input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="tel"], textarea { text-transform: uppercase; }

.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
    background:
        linear-gradient(165deg, rgba(196, 160, 86, 0.08) 0%, transparent 42%),
        linear-gradient(180deg, var(--navy) 0%, #0b1a2e 100%);
    color: #f3f6fb;
    padding: 26px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}
.sidebar .nav-group {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 4px 4px; }
.brand > div { min-width: 0; flex: 1; }
.brand strong { font-size: 15px; letter-spacing: -0.01em; }
.brand-logo {
    display: block;
    width: auto;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}
.sidebar-backdrop,
.sidebar-close,
.mobile-topbar { display: none; }
.menu-toggle {
    width: 42px; height: 42px; padding: 10px;
    border: 0; border-radius: 12px;
    background: rgba(255,255,255,.12); color: #fff;
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    cursor: pointer; flex-shrink: 0;
    transition: background .18s var(--ease);
}
.menu-toggle:hover { background: rgba(255,255,255,.2); }
.menu-toggle span {
    display: block; height: 2px; width: 100%;
    background: #fff; border-radius: 2px;
}
.brand-login { margin-bottom: 8px; }
.brand-login strong { color: var(--text); font-size: 16px; }
.brand-login small { color: var(--muted); }
.brand small { display: block; color: #b7c4d6; font-size: 12px; margin-top: 2px; }
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-group h4 {
    margin: 18px 10px 6px; font-size: 11px; letter-spacing: .14em;
    text-transform: uppercase; color: #8ea0b8; font-weight: 600;
}
.nav-group h4:first-child { margin-top: 4px; }
.nav-group a, .logout-btn {
    display: block; padding: 9px 12px; border-radius: var(--radius-sm);
    text-decoration: none; color: #dbe4f0; background: transparent; border: 0; width: 100%; text-align: left; cursor: pointer;
    font-size: 14px; font-weight: 500;
    transition: background .16s var(--ease), color .16s var(--ease), box-shadow .16s var(--ease);
}
.nav-group a:hover, .logout-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-group a.active {
    background: linear-gradient(90deg, rgba(196, 160, 86, 0.22) 0%, rgba(31, 64, 102, 0.85) 100%);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--gold);
}
.sidebar-footer { flex-shrink: 0; color: #9aabc0; font-size: 13px; display: flex; flex-direction: column; gap: 10px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.06); }
.online-widget {
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    padding: 10px 12px;
}
.online-widget-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #8ea0b8;
    margin-bottom: 8px;
}
.online-widget-head span:last-child { margin-left: auto; letter-spacing: 0; }
.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #3dd68c;
    box-shadow: 0 0 0 3px rgba(61, 214, 140, .18);
}
.online-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 180px; overflow: auto; }
.online-list li { display: flex; flex-direction: column; gap: 1px; }
.online-list strong { color: #f3f6fb; font-size: 13px; font-weight: 600; text-transform: uppercase; }
.online-list small { color: #8ea0b8; font-size: 11px; text-transform: uppercase; }
.online-empty { color: #8ea0b8; font-size: 12px; }

.main { padding: 28px 32px 48px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.topbar-heading-row {
    display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px;
}
.help-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    height: 34px; padding: 0 12px 0 8px;
    border: 1px solid var(--line); border-radius: 999px;
    background: #fff; color: var(--navy); cursor: pointer;
    font-size: 13px; font-weight: 600; text-transform: none;
    box-shadow: 0 1px 2px rgba(16, 35, 61, .04);
    transition: background .16s ease, border-color .16s ease, transform .12s ease;
}
.help-trigger:hover { background: #f7fafc; border-color: #c5d0de; }
.help-trigger:active { transform: translateY(1px); }
.help-trigger-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 999px;
    background: var(--navy); color: #fff; font-size: 13px; font-weight: 700;
}
.module-help { display: flex; flex-direction: column; gap: 16px; }
.module-help h3 {
    margin: 0 0 6px; font-size: 13px; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted); font-weight: 700;
}
.module-help p, .module-help li {
    margin: 0; font-size: 14px; line-height: 1.5; text-transform: none; color: var(--text);
}
.module-help ol, .module-help ul { margin: 0; padding-left: 18px; }
.module-help li + li { margin-top: 6px; }
.module-help-tips {
    padding: 12px 14px; border-radius: 12px;
    background: linear-gradient(180deg, #fffaf0 0%, #f7f1e4 100%);
    border: 1px solid #ead9b5;
}
.module-help-tips h3 { color: #8a6a2b; }
.topbar h1 {
    margin: 0 0 6px; font-size: 28px; font-weight: 700;
    letter-spacing: -0.02em; color: var(--navy); line-height: 1.2;
}
.topbar p { margin: 0; color: var(--muted); font-size: 14px; max-width: 52ch; }
.user-chip {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 14px; font-size: 13px; font-weight: 500;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}
.user-chip, table td, .card p { text-transform: uppercase; }

.grid { display: grid; gap: 16px; }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 .kpi { padding-left: 16px; padding-right: 16px; }
.grid-5 .kpi strong { font-size: 21px; overflow-wrap: anywhere; }
@media (min-width: 1101px) and (max-width: 1500px) {
    .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card, .kpi, .table-wrap, .form-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm), var(--shadow);
}
.kpi {
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.kpi::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--navy) 0%, var(--gold) 100%);
    opacity: .85;
}
.kpi:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #c8d2de;
}
.kpi span { color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: .01em; }
.kpi strong { display: block; margin-top: 8px; font-size: 26px; letter-spacing: -0.02em; color: var(--navy); }
.card, .form-card {
    padding: 22px;
    transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.card:hover, .form-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #c8d2de;
}
.card h2, .form-card h2 {
    margin: 0 0 16px; font-size: 17px; font-weight: 600;
    color: var(--navy); letter-spacing: -0.01em;
}

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); text-align: left; font-size: 14px; }
th {
    color: var(--muted); font-weight: 600; font-size: 12px;
    letter-spacing: .04em; text-transform: uppercase;
    background: var(--bg-subtle);
}
tbody tr { transition: background .14s var(--ease); }
tbody tr:hover { background: #f7fafc; }
tr:last-child td { border-bottom: 0; }

.badge {
    display: inline-flex; align-items: center; padding: 4px 10px;
    border-radius: 999px; font-size: 12px; font-weight: 600;
    letter-spacing: .01em;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: #eef2f6; color: var(--muted); }
.badge-role-admin { background: #e8eef8; color: var(--navy); }
.badge-role-sdr { background: #e5f6ec; color: #1b7a4a; }
.badge-role-closer { background: var(--gold-soft); color: #7a5c28; }
.badge-role-client { background: #eef2f6; color: #5d6b7c; }

.btn, .btn-secondary, .btn-danger {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 0; border-radius: 12px; padding: 10px 16px; text-decoration: none; cursor: pointer; font-weight: 600;
    transition: background .16s var(--ease), border-color .16s var(--ease), box-shadow .16s var(--ease), transform .12s var(--ease), color .16s var(--ease);
}
.btn { background: var(--navy); color: #fff; box-shadow: 0 1px 2px rgba(16, 35, 61, .18); }
.btn:hover { background: var(--navy-2); box-shadow: 0 4px 12px rgba(16, 35, 61, .22); }
.btn:active, .btn-secondary:active, .btn-danger:active { transform: translateY(1px); }
.btn-secondary {
    background: #fff; color: var(--navy); border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { border-color: var(--navy-3); background: var(--bg-subtle); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #9b1c14; }
.btn:disabled, .btn-secondary:disabled, .btn-danger:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-danger:disabled:hover { background: var(--danger); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.client-actions-cell { min-width: 150px; }
.clients-table-wrap { overflow-x: auto; }
.client-name-cell small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.users-table-wrap { overflow-x: auto; }
.users-table-wrap table { table-layout: fixed; }
.users-table-wrap th:nth-child(1), .users-table-wrap td:nth-child(1) { width: 13%; }
.users-table-wrap th:nth-child(2), .users-table-wrap td:nth-child(2) { width: 17%; }
.users-table-wrap th:nth-child(3), .users-table-wrap td:nth-child(3) { width: 11%; }
.users-table-wrap th:nth-child(4), .users-table-wrap td:nth-child(4) { width: 12%; }
.users-table-wrap th:nth-child(5), .users-table-wrap td:nth-child(5) { width: 7%; }
.users-table-wrap th:nth-child(6), .users-table-wrap td:nth-child(6) { width: 16%; overflow-wrap: anywhere; }
.users-table-wrap th:nth-child(7), .users-table-wrap td:nth-child(7) { width: 10%; }
.users-table-wrap th:nth-child(8), .users-table-wrap td:nth-child(8) { width: 6%; }
.users-table-wrap th:nth-child(9), .users-table-wrap td:nth-child(9) { width: 8%; }
.user-name-cell { min-width: 150px; }
.user-actions-cell { min-width: 130px; }
.administrator-actions-cell, .administrator-actions-heading { min-width: 130px; text-align: right; }
.client-list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.client-search-form { display: flex; align-items: center; gap: 10px; margin: 0; }
.client-search-form input { width: min(380px, 44vw); min-width: 280px; }
.action-dropdown { position: relative; display: inline-block; }
.action-dropdown summary { list-style: none; user-select: none; }
.action-dropdown summary::-webkit-details-marker { display: none; }
.action-dropdown summary span { font-size: 12px; }
.action-dropdown summary:focus-visible { outline: 3px solid rgba(16, 35, 61, .35); outline-offset: 2px; }
.action-dropdown:not([open]) > .action-dropdown-menu { display: none; }
.action-dropdown-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; min-width: 36px; height: 36px; padding: 0;
    line-height: 1;
}
.action-sandwich {
    display: inline-block; font-size: 18px; font-weight: 700; line-height: 1;
    color: var(--navy);
}
.action-dropdown-menu {
    position: fixed; left: 0; top: 0; z-index: 100;
    display: flex; flex-direction: column; min-width: 210px; padding: 6px;
    border: 1px solid var(--line); border-radius: 12px; background: #fff;
    box-shadow: 0 12px 28px rgba(16, 35, 61, .16);
}
.action-dropdown-menu a, .action-dropdown-menu button {
    display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px;
    background: transparent; color: var(--text); text-align: left; text-decoration: none;
    font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; text-transform: none;
}
.action-dropdown-menu a:hover, .action-dropdown-menu button:hover { background: #f3f6f9; }
.action-dropdown-menu .action-danger { color: var(--danger); }
.payable-actions-cell { width: 56px; text-align: right; }
th.bulk-check-cell, td.bulk-check-cell {
    width: 40px; min-width: 40px; max-width: 40px;
    padding-left: 14px; padding-right: 0; text-align: center; vertical-align: middle;
}
.bulk-check-cell input[type="checkbox"] {
    width: 16px; height: 16px; margin: 0; padding: 0; border-radius: 4px; cursor: pointer;
    accent-color: var(--navy); vertical-align: middle;
}
tbody tr.is-bulk-selected { background: #eef3fa; }
tbody tr.is-bulk-selected:hover { background: #e6edf7; }
.bulk-bar {
    position: sticky; top: 8px; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin: 0 0 12px; padding: 10px 14px;
    background: #fff; border: 1px solid var(--danger); border-radius: var(--radius);
    box-shadow: var(--shadow-sm), var(--shadow);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar-count { color: var(--text); font-size: 14px; }
.bulk-bar-count strong { color: var(--danger); font-size: 16px; }
.bulk-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); }

.pager {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px 20px; margin: 18px 0 24px; padding: 10px 14px;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.pager-summary { margin: 0; color: var(--muted); font-size: 13px; text-transform: none !important; }
.pager-summary strong { color: var(--navy); font-weight: 600; }
.pager-nav { margin: 0; }
.pagination {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin: 0; padding: 0; list-style: none;
}
.pagination .page-link-step { padding: 0 14px; }
.pagination .page-item-gap .page-link { border-color: transparent; background: transparent; box-shadow: none; min-width: 24px; padding: 0 4px; }
@media (max-width: 760px) {
    .pager { justify-content: center; text-align: center; }
    .pagination .page-item-number { display: none; }
    .pagination .page-item-gap { display: none; }
}
.pagination .page-item { list-style: none; margin: 0; padding: 0; }
.pagination .page-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 38px; height: 38px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: 10px;
    background: #fff; color: var(--navy); font-size: 14px; font-weight: 600;
    text-decoration: none; text-transform: none;
    box-shadow: var(--shadow-sm);
    transition: background .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease);
}
.pagination a.page-link:hover { border-color: var(--navy-3); background: var(--bg-subtle); }
.pagination .page-item.active .page-link {
    background: var(--navy); border-color: var(--navy); color: #fff;
    box-shadow: 0 2px 8px rgba(16, 35, 61, .2);
}
.pagination .page-item.disabled .page-link {
    color: var(--muted); background: var(--bg-subtle); box-shadow: none; cursor: default;
}

.form-card { padding: 24px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.user-form-fields { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 16px; }
.user-form-fields .field { min-width: 0; }
.user-form-fields input, .user-form-fields select { width: 100%; min-width: 0; }
.user-name-field, .user-email-field { grid-column: span 8; }
.user-role-field { grid-column: span 5; }
.user-status-field { grid-column: span 3; }
.user-password-toggle { grid-column: 1 / -1; }
.user-password-field, .user-password-confirm-field { grid-column: span 12; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check-line input { width: auto; min-width: 0; }
.user-contact-field { grid-column: span 6; }
.user-whatsapp-field, .user-cpf-field { grid-column: span 5; }
.user-pix-field { grid-column: span 8; }
.user-role-details { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(180px, 1.2fr) repeat(3, minmax(140px, 1fr)); align-items: end; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
.user-role-details[hidden] { display: none !important; }
.user-role-details p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.user-commission-field,
.user-goal-amount-field,
.user-goal-rate-field { min-width: 0; }
.user-commission-field input,
.user-goal-amount-field input,
.user-goal-rate-field input { width: 100%; }

.goal-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.goal-card-head h2 { margin: 0 0 4px; }
.goal-period { margin: 0; color: var(--muted); font-size: 13px; }
.goal-badge {
    display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px;
    font-size: 12px; font-weight: 700; background: var(--warning-bg); color: var(--warning); white-space: nowrap;
}
.goal-badge.is-reached { background: var(--success-bg); color: var(--success); }
.goal-progress-track {
    height: 12px; border-radius: 999px; background: #e7edf5; overflow: hidden;
}
.goal-progress-fill {
    height: 100%; border-radius: inherit;
    background: linear-gradient(90deg, var(--navy) 0%, var(--gold) 100%);
    transition: width .35s ease;
}
.goal-progress-meta {
    display: flex; justify-content: space-between; gap: 12px; margin-top: 8px;
    color: var(--muted); font-size: 13px;
}
.goal-progress-meta strong { color: var(--text); }
.goal-note { margin: 16px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.user-role-meta { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.sale-entry-grid { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 16px; }
.sale-entry-grid > .sale-client-field { grid-column: span 10; }
.sale-entry-grid > .sale-administrator-field { grid-column: span 8; }
.sale-entry-grid > .sale-date-field { grid-column: span 6; }
.sale-entry-grid > .sale-credit-field { grid-column: span 6; }
.sale-entry-grid > .sale-closer-field,
.sale-entry-grid > .sale-sdr-field { grid-column: span 9; }
.sale-entry-grid > .sale-rates,
.sale-entry-grid > .sale-info-card { grid-column: span 12; }
.sale-entry-grid > .sale-observation-field { grid-column: span 12; }
.sale-rates {
    gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 14px;
    background: #f8fafc;
}
.sale-rates-heading h3 { margin: 0; font-size: 15px; }
.sale-rates-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.sale-rate-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sale-rates-subheading { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.sale-rate-grid .field { min-width: 0; }
.sale-rate-grid input { width: 100%; min-width: 0; }
.sale-info-card {
    gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 14px;
    background: #f8fafc;
}
.sale-info-fields { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; }
.sale-info-fields .field, .sale-info-fields input { min-width: 0; width: 100%; }
.sale-info-fields > .sale-info-half-field { grid-column: span 6; }
.sale-info-fields > .sale-info-full-field { grid-column: 1 / -1; }
.sale-contract-details dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; }
.sale-contract-details dt { color: var(--muted); font-size: 13px; }
.sale-contract-details dd { margin: 4px 0 0; font-weight: 600; }
.sale-form textarea { min-height: 76px; }
.sale-form-errors { margin-bottom: 16px; }
.sale-submit-feedback { margin: 0; color: var(--muted); font-size: 13px; }
.sale-submit-feedback:empty { display: none; }
.searchable-select { position: relative; width: 100%; }
.searchable-select-native {
    position: absolute !important; left: 0 !important; top: 0 !important;
    width: 1px !important; min-width: 0 !important; max-width: 1px !important; height: 1px !important;
    overflow: hidden !important;
    padding: 0 !important; border: 0 !important; opacity: 0 !important; pointer-events: none;
}
.searchable-select-input { width: 100%; }
.searchable-select-options {
    position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0;
    max-height: 240px; overflow-y: auto; padding: 5px; border: 1px solid var(--line);
    border-radius: 10px; background: #fff; box-shadow: var(--shadow);
}
.searchable-select-options[hidden] { display: none; }
.searchable-select-options.opens-up { top: auto; bottom: calc(100% + 4px); }
.searchable-select-option {
    display: block; width: 100%; padding: 9px 11px; border: 0; border-radius: 7px;
    background: transparent; color: var(--text); text-align: left; cursor: pointer;
}
.searchable-select-option:hover,
.searchable-select-option.is-active { background: #f1f5f9; }
.searchable-select-option.is-selected {
    background: #e7effc;
    color: #175cd3;
    font-weight: 600;
}
.searchable-select-option.is-selected::before { content: "✓ "; }
.searchable-select.is-multiple .searchable-select-input { cursor: pointer; }
.searchable-select-divider { padding: 3px 10px; color: var(--muted); text-align: center; }
.searchable-select-empty { padding: 10px; color: var(--muted); font-size: 14px; }
.client-form-fields { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.client-form-fields > .client-type-field { grid-column: span 2; }
.client-form-fields > .client-name-field,
.client-form-fields > .client-trade-field { grid-column: span 5; }
.client-form-fields > .client-document-field { grid-column: span 3; }
.client-form-fields > .client-email-field { grid-column: span 5; }
.client-form-fields > .client-phone-field { grid-column: span 4; }
.client-form-fields > .client-cep-field { grid-column: span 2; }
.client-form-fields > .client-address-field { grid-column: span 5; }
.client-form-fields > .client-number-field { grid-column: span 2; }
.client-form-fields > .client-complement-field { grid-column: span 3; }
.client-form-fields > .client-city-field { grid-column: span 8; }
.client-form-fields > .client-state-field { grid-column: span 4; }
.client-form-fields > .client-status-field { grid-column: span 4; }
.client-form-fields > .client-access-field,
.client-form-fields > .client-password-field,
.client-form-fields > .client-password-confirm-field { grid-column: span 4; }
.client-cep-feedback { min-height: 0; color: var(--muted); font-size: 12px; }
.client-cep-feedback:empty { display: none; }
.client-password-field.is-disabled,
.client-password-confirm-field.is-disabled { opacity: .55; }
.money-input {
    display: flex; align-items: center; gap: 8px; min-width: 0;
    padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.money-input:focus-within { border-color: var(--gold); box-shadow: var(--focus-ring); }
.money-input > span { color: var(--muted); font-size: 14px; font-weight: 600; }
.money-input input { flex: 1; width: 100%; min-width: 0; border: 0; background: transparent; box-shadow: none; }
.money-input input:focus { outline: none; }
label { font-size: 13px; color: var(--muted); font-weight: 600; }
input, select, textarea {
    border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff;
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: var(--focus-ring);
}
textarea { min-height: 90px; resize: vertical; }
.filters {
    display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: center;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.filters input, .filters select { min-width: 160px; }
.report-filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 220px) auto;
    align-items: center;
}
.report-filters-range {
    grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(150px, 190px)) auto auto;
    align-items: end;
}
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter-field > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.filter-field input, .filter-field .searchable-select { width: 100%; min-width: 0; }
.report-period { margin: 0 0 14px; color: var(--muted); font-size: 14px; text-transform: none !important; }
.report-period strong { color: var(--navy); }
.report-filters > .searchable-select,
.report-filters > input,
.report-filters > button { width: 100%; min-width: 0; }
.report-filters > button { width: auto; white-space: nowrap; }
.sales-report-filters {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
}
.sales-report-filters > input {
    flex: 0 1 180px;
    min-width: 140px;
    width: auto;
}
.sales-report-filters > .btn,
.sales-report-filters > .btn-secondary { flex: 0 0 auto; white-space: nowrap; }
.sales-report-links {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-right: 4px;
    flex: 0 0 auto;
}
.sales-filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(150px, 1.2fr)) minmax(175px, 1.3fr) repeat(2, minmax(220px, 1.6fr)) auto;
}
.sales-filters input, .sales-filters select { width: 100%; min-width: 0; }
.sales-filters button { justify-self: end; white-space: nowrap; }
.payment-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(130px, 1fr)) repeat(2, minmax(120px, .9fr)) repeat(4, minmax(135px, 1.1fr)) auto auto;
    align-items: stretch;
}
.payment-filters > * { width: 100%; min-width: 0; }
.payment-filters button { justify-self: end; white-space: nowrap; }
.payment-report-link { white-space: nowrap; }

.flash, .errors {
    padding: 13px 16px 13px 18px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px; font-weight: 500;
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm);
}
.flash {
    background: var(--success-bg); color: var(--success);
    border-color: #b7e4c7;
    border-left: 3px solid var(--success);
}
.errors {
    background: var(--danger-bg); color: var(--danger);
    border-color: #f5c4bf;
    border-left: 3px solid var(--danger);
}

.auth-wrap {
    min-height: 100vh; display: grid; place-items: center;
    background:
        radial-gradient(ellipse 70% 45% at 15% 10%, rgba(196,160,86,.22), transparent 55%),
        radial-gradient(ellipse 50% 40% at 90% 20%, rgba(31,64,102,.35), transparent 50%),
        linear-gradient(165deg, #0b1a2e 0%, #10233d 48%, #1a3352 52%, #e8eef4 52.2%);
}
.auth-shell {
    width: min(440px, calc(100% - 32px));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    animation: auth-rise .45s var(--ease) both;
}
@keyframes auth-rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.auth-logo {
    display: block;
    width: min(220px, 70%);
    height: auto;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .25));
}
.auth-card {
    width: 100%;
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 36px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(16, 35, 61, 0.04);
    position: relative;
}
.auth-card::before {
    content: "";
    position: absolute; top: 0; left: 24px; right: 24px; height: 3px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, var(--navy), var(--gold));
}
@media (max-width: 520px) {
    .auth-wrap { padding: 24px 0; align-content: start; }
    .auth-card { padding: 24px 18px; border-radius: 18px; }
    .auth-card h1 { font-size: 22px; }
}
.auth-card h1 {
    margin: 8px 0 6px; font-size: 24px; font-weight: 700;
    color: var(--navy); letter-spacing: -0.02em;
}
.auth-card p { color: var(--muted); margin-top: 0; line-height: 1.5; }
.auth-card .btn { width: 100%; min-height: 46px; margin-top: 4px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.timeline { display: flex; flex-direction: column; gap: 14px; }
.timeline-item { padding-left: 16px; border-left: 2px solid var(--gold); }
.timeline-item strong { display: block; }
.timeline-item span { color: var(--muted); font-size: 13px; }

.chart {
    display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 12px; margin-bottom: 18px;
}
.chart-bar {
    flex: 1; background: var(--navy-3); border-radius: 8px 8px 0 0; min-height: 6px; position: relative;
    transition: background .2s var(--ease), transform .2s var(--ease);
}
.chart-bar:hover { transform: scaleY(1.03); transform-origin: bottom; }
.chart-bar.is-current { background: linear-gradient(180deg, var(--gold) 0%, var(--navy-3) 100%); }
.chart-bar span { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.dashboard-filters {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}
.dashboard-filters > input[type="month"] {
    flex: 0 1 200px;
    min-width: 160px;
    width: auto;
}
.dashboard-filters > .btn,
.dashboard-filters > .btn-secondary {
    flex: 0 0 auto;
    white-space: nowrap;
}
.dashboard-section-title {
    margin: 28px 0 14px; font-size: 13px; letter-spacing: .1em;
    text-transform: uppercase; color: var(--muted); font-weight: 600;
    display: flex; align-items: center; gap: 12px;
}
.dashboard-section-title::after {
    content: "";
    flex: 1; height: 1px;
    background: linear-gradient(90deg, var(--line) 0%, transparent 100%);
}
.dashboard-section-title:first-of-type { margin-top: 0; }

.dossier-tabs {
    display: flex; flex-wrap: wrap; gap: 4px;
    margin: 0 0 20px; padding: 5px;
    background: var(--bg-subtle);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}
.dossier-tab {
    padding: 10px 16px; border-radius: 9px;
    color: var(--muted); font-weight: 600; font-size: 13px;
    text-decoration: none; text-transform: none !important;
    transition: background .16s var(--ease), color .16s var(--ease), box-shadow .16s var(--ease);
}
.dossier-tab:hover { background: #fff; color: var(--navy); }
.dossier-tab.is-active {
    background: var(--navy); color: #fff;
    box-shadow: 0 2px 8px rgba(16, 35, 61, .2);
}
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li {
    padding: 8px 0; border-bottom: 1px solid #e8ecf1;
    text-transform: none; font-size: 13px;
}
.plain-list li:last-child { border-bottom: 0; }
.onboarding-card {
    margin-bottom: 20px;
    border: 1px dashed #c5d0de;
    background: linear-gradient(180deg, #fff 0%, #f7fafc 100%);
}
.onboarding-card ol {
    margin: 8px 0 0; padding-left: 20px;
}
.onboarding-card li {
    margin: 6px 0; text-transform: none; font-size: 14px;
}
.role-templates {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.role-templates button {
    text-transform: none;
}
.role-advanced-toggle {
    margin: 8px 0 12px;
}
.role-advanced[hidden] { display: none !important; }
.kpi small {
    display: block; margin-top: 8px; color: var(--muted); font-size: 12px; font-weight: 500;
}
.kpi-delta { font-weight: 700 !important; }
.kpi-delta.is-up { color: var(--success) !important; }
.kpi-delta.is-down { color: var(--danger) !important; }
.kpi-alert { border-color: #f3b4ae; background: linear-gradient(180deg, #fff 0%, #fff7f6 100%); }
.kpi-alert::before { background: linear-gradient(90deg, var(--danger) 0%, #f3b4ae 100%); }
.kpi-alert strong { color: var(--danger); }
.muted-block { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }

body.modal-open { overflow: hidden; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal.is-open { display: flex; }
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 26, 46, 0.58);
}
.modal-dialog {
    position: relative;
    z-index: 1;
    width: min(640px, 100%);
    max-height: min(90vh, 900px);
    overflow: auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(16, 35, 61, 0.28);
}
.modal-dialog-wide { width: min(920px, 100%); }
.modal-dialog-wide:has(.sim-panel) { width: min(980px, 100%); }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px 0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}
.modal-header h2 { margin: 0; font-size: 20px; }
.modal-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: #eef2f6;
    color: var(--text);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.modal-close:hover { background: var(--line); }
.modal-body { padding: 20px 24px 24px; }
.modal-body .form-card {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.modal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.booking-public-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(196,160,86,.16), transparent 32%),
        linear-gradient(180deg, #0b1a2e 0%, #10233d 42%, #eef2f6 42%);
}
.booking-public-shell { width: min(1100px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 48px; }
.booking-public-top { margin-bottom: 20px; }
.booking-public-logo { height: 34px; width: auto; display: block; }
.booking-board {
    display: grid;
    grid-template-columns: 320px 1fr;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(16, 35, 61, 0.18);
    min-height: 560px;
}
.booking-host {
    background: linear-gradient(180deg, var(--navy) 0%, #0b1a2e 100%);
    color: #f3f6fb;
    padding: 36px 28px;
}
.booking-host-avatar {
    width: 56px; height: 56px; border-radius: 16px;
    background: var(--gold); color: var(--navy);
    display: grid; place-items: center; font-weight: 700; font-size: 22px;
    margin-bottom: 18px;
}
.booking-host-label { margin: 0 0 6px; color: #b7c4d6; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.booking-host h1 { margin: 0 0 10px; font-size: 24px; }
.booking-host h2 { margin: 0 0 12px; font-size: 18px; font-weight: 600; color: #fff; }
.booking-host-desc { color: #c5d0de; line-height: 1.5; }
.booking-meta { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; color: #dbe4f0; font-size: 14px; }
.booking-panel { padding: 28px; }
.booking-panel-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; }
.booking-month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.booking-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.booking-cal-head { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; padding: 6px 0; }
.booking-cal-empty { min-height: 42px; }
.booking-cal-day {
    min-height: 42px; border-radius: 12px; display: grid; place-items: center;
    color: #a0aec0; background: #f7fafc; text-decoration: none; font-weight: 600;
}
.booking-cal-day.is-available { color: var(--navy); background: #eef4ff; cursor: pointer; }
.booking-cal-day.is-available:hover,
.booking-cal-day.is-selected { background: var(--navy); color: #fff; }
.booking-slots h3 { margin: 0 0 8px; }
.booking-slots p { color: var(--muted); }
.booking-slot-list { display: grid; gap: 8px; max-height: 360px; overflow: auto; padding-right: 4px; }
.booking-slot-btn {
    display: block; text-align: center; text-decoration: none;
    border: 1px solid var(--line); border-radius: 12px; padding: 12px;
    font-weight: 700; color: var(--navy); background: #fff;
}
.booking-slot-btn:hover,
.booking-slot-btn.is-selected { background: var(--navy); color: #fff; border-color: var(--navy); }
.booking-guest-form {
    margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line);
}
.booking-confirm-card {
    width: min(560px, 100%);
    margin: 24px auto 0;
    background: #fff;
    border-radius: 24px;
    padding: 36px;
    box-shadow: var(--shadow);
}
.booking-confirm-logo { height: 40px; width: auto; margin-bottom: 16px; }
.booking-confirm-details { display: grid; gap: 12px; margin-top: 20px; }
.booking-confirm-details span { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.booking-confirm-details strong { font-size: 16px; }
.booking-link-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.schedule-link-bar { margin-bottom: 16px; }
.schedule-link-meta { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.schedule-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}
.schedule-col {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    min-height: 520px;
}
.schedule-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}
.schedule-col-head h2 { margin: 0; font-size: 18px; }
.schedule-col-head span {
    background: #eef2f6;
    color: var(--muted);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}
.schedule-list { display: grid; gap: 8px; max-height: 620px; overflow: auto; }
.schedule-list-item {
    width: 100%;
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 12px;
    align-items: center;
    text-align: left;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
    padding: 12px;
    cursor: pointer;
}
.schedule-list-item:hover { border-color: var(--navy-3); background: #f8fafc; }
.schedule-list-when strong { display: block; font-size: 15px; }
.schedule-list-when span { color: var(--muted); font-size: 13px; }
.schedule-list-body { display: grid; gap: 2px; min-width: 0; }
.schedule-list-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-list-body span { color: var(--muted); font-size: 12px; }
.schedule-empty {
    border: 1px dashed var(--line);
    border-radius: 14px;
    padding: 28px 16px;
    color: var(--muted);
    text-align: center;
}
.schedule-month-calendar { gap: 8px; }
.schedule-cal-day {
    min-height: 92px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 6px;
    background: #fbfcfe;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.schedule-cal-day.is-today { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(196,160,86,.35); }
.schedule-cal-day.has-items { background: #fff; }
.schedule-cal-daynum { font-size: 12px; font-weight: 700; color: var(--muted); }
.schedule-cal-events { display: grid; gap: 3px; }
.schedule-cal-chip {
    width: 100%;
    border: 0;
    border-radius: 8px;
    background: var(--navy);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 5px;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.schedule-cal-more { font-size: 11px; color: var(--muted); font-weight: 600; }
.slug-prefix {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.slug-prefix span {
    padding: 10px 10px;
    background: #eef2f6;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}
.slug-prefix input {
    border: 0;
    border-radius: 0;
    flex: 1;
    min-width: 0;
}

@media (max-width: 900px) {
    .booking-board,
    .booking-panel-grid,
    .schedule-split { grid-template-columns: 1fr; }
    .schedule-cal-day { min-height: 72px; }
}

@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 90;
        background: rgba(11, 26, 46, 0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity .22s var(--ease);
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 100;
        width: min(300px, 88vw);
        height: 100vh;
        height: 100dvh;
        transform: translateX(-105%);
        transition: transform .28s var(--ease);
        box-shadow: 16px 0 48px rgba(0, 0, 0, .32);
    }
    .sidebar .nav-group { overflow: auto; -webkit-overflow-scrolling: touch; }
    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        margin-left: auto;
        border: 0;
        border-radius: 10px;
        background: rgba(255,255,255,.1);
        color: #fff;
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
        flex-shrink: 0;
    }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 40;
        margin: -28px -16px 20px;
        padding: 12px 16px;
        background:
            linear-gradient(165deg, rgba(196, 160, 86, 0.12) 0%, transparent 45%),
            linear-gradient(180deg, var(--navy) 0%, #0b1a2e 100%);
        color: #fff;
        box-shadow: 0 8px 24px rgba(16, 35, 61, .2);
        border-bottom: 1px solid rgba(196, 160, 86, .22);
    }
    .mobile-topbar-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        flex: 1;
    }
    .mobile-topbar-brand img {
        height: 28px;
        width: auto;
        flex-shrink: 0;
    }
    .mobile-topbar-brand strong {
        font-size: 15px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mobile-topbar-user {
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        background: rgba(255,255,255,.12);
        border-radius: 999px;
        padding: 8px 12px;
        max-width: 42%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .topbar .user-chip { display: none; }
    .help-trigger { height: 32px; }
    .help-trigger-label { display: none; }
    .help-trigger { padding: 0 8px; }
    .online-widget { display: none; }

    .main { padding: 28px 16px 40px; min-width: 0; }
    .topbar { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 16px; }
    .topbar h1 { font-size: 22px; line-height: 1.2; }
    .topbar p { font-size: 13px; }

    .grid-5, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3, .grid-2, .fields { grid-template-columns: 1fr; }
    .kpi { padding: 14px 16px; }
    .kpi strong { font-size: 20px; }
    .card { padding: 16px; }
    .actions { flex-wrap: wrap; }
    .actions .btn, .actions .btn-secondary, .actions .btn-danger { flex: 1 1 auto; }

    .table-wrap,
    .clients-table-wrap,
    .users-table-wrap {
        margin-left: -4px;
        margin-right: -4px;
        border-radius: 14px;
        -webkit-overflow-scrolling: touch;
    }
    th, td { padding: 10px 12px; font-size: 13px; }
    .users-table-wrap table { table-layout: auto; min-width: 720px; }
    .users-table-wrap th,
    .users-table-wrap td { width: auto !important; }

    .dossier-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .dossier-tabs::-webkit-scrollbar { display: none; }
    .dossier-tab { flex: 0 0 auto; white-space: nowrap; }

    .filters input, .filters select { min-width: 0; flex: 1 1 140px; }
    .filters .btn, .filters .btn-secondary, .filters button { width: 100%; }
    .sale-contract-details dl { grid-template-columns: 1fr 1fr; }

    .modal { padding: 0; align-items: flex-end; }
    .modal-dialog,
    .modal-dialog-wide {
        width: 100%;
        max-height: min(92vh, 100%);
        border-radius: 20px 20px 0 0;
    }
    .modal-header { padding: 16px 16px 0; }
    .modal-body { padding: 16px; }
    .modal-actions > * { flex: 1 1 calc(50% - 6px); }

    .user-form-fields { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .user-name-field, .user-email-field, .user-password-field,
    .user-password-confirm-field, .user-contact-field { grid-column: span 3; }
    .user-role-field, .user-status-field { grid-column: span 3; }
    .user-whatsapp-field, .user-cpf-field { grid-column: span 2; }
    .user-pix-field { grid-column: span 4; }
    .user-role-details { grid-template-columns: 1fr; }
    .sale-entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sale-entry-grid > .sale-client-field,
    .sale-entry-grid > .sale-administrator-field,
    .sale-entry-grid > .sale-date-field,
    .sale-entry-grid > .sale-credit-field,
    .sale-entry-grid > .sale-closer-field,
    .sale-entry-grid > .sale-sdr-field,
    .sale-entry-grid > .sale-observation-field { grid-column: span 1; }
    .sale-entry-grid > .sale-rates,
    .sale-entry-grid > .sale-info-card { grid-column: span 1; }
    .sale-rate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .client-form-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .client-form-fields > .field { grid-column: span 1; }
    .sales-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sales-filters input[name="q"], .sales-filters select[name="status"],
    .sales-filters select[name="closer_id"], .sales-filters select[name="sdr_id"],
    .sales-filters button { grid-column: span 1; }
    .sales-filters button { grid-column: 1 / -1; justify-self: stretch; }
    .chart { gap: 4px; overflow-x: auto; }
    .searchable-select { max-width: 100%; }
}

@media (max-width: 760px) {
    .mobile-topbar { margin: -28px -16px 16px; }
    .client-list-toolbar { align-items: stretch; flex-wrap: wrap; }
    .client-search-form { width: 100%; }
    .client-search-form input { flex: 1; width: auto; min-width: 0; }
    .payment-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .payment-filters button { justify-self: stretch; }
    .report-filters, .report-filters-range { grid-template-columns: 1fr; }
    .report-filters > button, .report-filters > .btn-secondary { width: 100%; }
    .sales-report-filters { flex-wrap: wrap; }
    .sales-report-filters > input { flex: 1 1 140px; }
    .sales-report-links { width: 100%; }
    .dashboard-filters { flex-wrap: wrap; }
    .dashboard-filters > input[type="month"] { flex: 1 1 160px; }
    .dashboard-filters > .btn,
    .dashboard-filters > .btn-secondary { flex: 1 1 calc(50% - 6px); }
    .sale-contract-details dl { grid-template-columns: 1fr; }
    .role-templates { flex-direction: column; }
    .role-templates button { width: 100%; }
}

@media (min-width: 761px) and (max-width: 1750px) {
    .payment-filters { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    .grid-5, .grid-4 { grid-template-columns: 1fr; }
    .main { padding: 20px 12px 32px; }
    .mobile-topbar { margin: -20px -12px 14px; padding: 10px 12px; }
    .topbar h1 { font-size: 20px; }
    .user-form-fields { grid-template-columns: 1fr; }
    .user-name-field, .user-email-field, .user-role-field, .user-status-field,
    .user-password-field, .user-password-confirm-field, .user-contact-field,
    .user-whatsapp-field, .user-cpf-field, .user-pix-field { grid-column: span 1; }
    .client-form-fields { grid-template-columns: 1fr; }
    .client-form-fields > .field { grid-column: 1 / -1; }
    .sale-entry-grid { grid-template-columns: 1fr; }
    .sale-entry-grid > .sale-client-field,
    .sale-entry-grid > .sale-administrator-field,
    .sale-entry-grid > .sale-date-field,
    .sale-entry-grid > .sale-credit-field,
    .sale-entry-grid > .sale-closer-field,
    .sale-entry-grid > .sale-sdr-field,
    .sale-entry-grid > .sale-observation-field { grid-column: 1 / -1; }
    .sale-entry-grid > .sale-rates,
    .sale-entry-grid > .sale-info-card { grid-column: 1 / -1; }
    .sale-rate-grid { grid-template-columns: 1fr 1fr; }
    .sale-info-fields { grid-template-columns: 1fr; }
    .sale-info-fields > .sale-info-half-field,
    .sale-info-fields > .sale-info-full-field { grid-column: 1 / -1; }
    .sales-filters { grid-template-columns: 1fr; }
    .sales-filters input[name="q"], .sales-filters select[name="status"],
    .sales-filters select[name="closer_id"], .sales-filters select[name="sdr_id"],
    .sales-filters button { grid-column: 1 / -1; justify-self: stretch; }
    .payment-filters { grid-template-columns: 1fr; }
    .modal-actions { flex-direction: column; }
    .modal-actions > * { flex: 1 1 auto; width: 100%; }
    .btn, .btn-secondary, .btn-danger { min-height: 44px; }
    input, select, textarea, .searchable-select-input {
        font-size: 16px !important; /* evita zoom automático no iOS */
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .kpi:hover, .card:hover, .form-card:hover { transform: none; }
}

/* Simulador de comissões */
button.linkish {
    border: 0;
    background: transparent;
    color: var(--primary, #123e75);
    font: inherit;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
    text-align: left;
}
button.linkish:hover { text-decoration: underline; }
.sim-panel {
    max-width: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
}
.modal-body .sim-panel .form-card {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.sim-fields { margin-bottom: 8px; }
.sim-fields output { float: right; color: #123e75; font-weight: 600; }
.sim-fields input[type=range] { width: 100%; accent-color: #123e75; }
.sim-section-title {
    margin: 8px 0 0;
    font-size: 15px;
    font-weight: 700;
    color: #12305a;
}
.sim-source {
    display: block;
    margin-top: 6px;
    color: #52647b;
    font-size: 12px;
}
.sim-source a { color: #123e75; font-weight: 600; }
.sim-h2 {
    font-size: 18px;
    margin: 24px 0 12px;
    border-top: 1px solid #e0e6ed;
    padding-top: 20px;
}
.sim-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #edf0f4;
}
.sim-green { color: #087650; }
.sim-red { color: #b43c35; }
.sim-big { font-size: 28px; font-weight: 700; margin: 8px 0; }
.sim-muted { color: #52647b; margin: 6px 0; }
.sim-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.sim-tile {
    border: 1px solid #dce3ec;
    border-radius: 12px;
    padding: 16px;
}
.sim-bar {
    display: flex;
    height: 22px;
    border-radius: 8px;
    overflow: hidden;
    margin: 14px 0;
}
.sim-legend { font-size: 12px; color: #52647b; }
.sim-scroll { overflow: auto; max-height: 440px; }
.sim-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    white-space: nowrap;
}
.sim-table th,
.sim-table td {
    text-align: right;
    padding: 11px 8px;
    border-bottom: 1px solid #e3e8ef;
}
.sim-table th:first-child,
.sim-table td:first-child { text-align: left; }
.sim-table th {
    position: sticky;
    top: 0;
    background: #12305a;
    color: #fff;
}
.sim-table tfoot { font-weight: 700; background: #edf4fa; }
.sim-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.sim-note { margin-top: 12px; color: #52647b; }
.sim-status { display: block; margin-top: 8px; color: #123e75; font-weight: 600; }
@media (max-width: 640px) {
    .sim-panel { padding: 14px; }
    .sim-grid { grid-template-columns: 1fr; }
    .sim-table { font-size: 12px; }
}
@media print {
    .sidebar, .topbar, .sim-actions, .actions, .modal-backdrop, .modal-close, input[type=range] { display: none !important; }
    .modal.is-open { position: static; display: block; padding: 0; }
    .modal.is-open .modal-dialog { box-shadow: none; max-height: none; width: 100%; overflow: visible; }
    .sim-scroll { max-height: none; overflow: visible; }
    .sim-panel { border: 0; padding: 0; max-width: none; }
    .app-shell { display: block; }
    .content { margin: 0; padding: 0; }
}
