:root {
    --bg: #e7eeea;
    --bg-elevated: #f3f7f5;
    --surface: #fbfcfb;
    --ink: #17211e;
    --ink-muted: #5a6a64;
    --line: #d2ddd7;
    --accent: #2f6f5e;
    --accent-soft: #d7e8e1;
    --danger: #9a3e3e;
    --danger-soft: #f3e0e0;
    --sidebar: #171c1a;
    --sidebar-ink: #c9d4cf;
    --sidebar-muted: #8b9892;
    --sidebar-hover: #232a27;
    --sidebar-line: rgba(220, 234, 228, 0.08);
    --radius-sm: 0.5rem;
    --radius-md: 0.875rem;
    --radius-lg: 1.25rem;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --shadow: 0 20px 48px -28px rgba(23, 33, 30, 0.42);
    --z-overlay: 20;
    --z-topbar: 25;
    --z-sidebar: 30;
    --font: "Outfit", "Segoe UI", system-ui, sans-serif;
    --sidebar-w: 17.5rem;
    --sidebar-w-collapsed: 4.75rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: radial-gradient(1200px 520px at 12% -10%, rgba(47, 111, 94, 0.12), transparent 55%), var(--bg);
    color: var(--ink);
    min-height: 100dvh;
}

img { max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip-link {
    position: absolute; left: 0.75rem; top: -3rem; z-index: 40;
    padding: 0.5rem 0.85rem; border-radius: var(--radius-sm);
    background: var(--ink); color: var(--surface); text-decoration: none;
    font-size: 0.85rem; font-weight: 600;
}
.skip-link:focus { top: 0.75rem; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.25rem; height: 2.25rem; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: inherit; cursor: pointer;
    transition: background 220ms var(--ease), transform 180ms var(--ease);
}
.icon-btn:hover { background: var(--sidebar-hover); }
.icon-btn:active { transform: scale(0.96); }

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: 100dvh;
    padding: 0.85rem;
    gap: 0.85rem;
}
.app-shell > .topbar { display: none; }
.nav-overlay { display: none; }

.sidebar {
    grid-row: 1 / -1;
    position: sticky; top: 0.85rem;
    height: calc(100dvh - 1.7rem);
    display: flex; flex-direction: column;
    background: var(--sidebar); color: var(--sidebar-ink);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.04);
    overflow: hidden; z-index: var(--z-sidebar);
    transition: width 280ms var(--ease), transform 280ms var(--ease);
    width: 100%;
}
.sidebar::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.045;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.sidebar-head {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 1rem 0.85rem 0.75rem; position: relative; z-index: 1;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 0.7rem;
    min-width: 0; flex: 1; text-decoration: none; color: inherit;
}
.brand-mark {
    flex-shrink: 0; width: 2.1rem; height: 2.1rem; border-radius: 0.7rem;
    display: grid; place-items: center; background: var(--accent-soft);
    color: var(--accent); font-weight: 700; font-size: 0.95rem; letter-spacing: -0.04em;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-text strong { font-size: 0.98rem; font-weight: 600; letter-spacing: -0.03em; }
.brand-text small { color: var(--sidebar-muted); font-size: 0.7rem; font-weight: 500; }
.sidebar-close { display: none; }

.sidebar-search {
    display: flex; align-items: center; gap: 0.5rem;
    margin: 0 0.75rem 0.65rem; padding: 0.45rem 0.7rem;
    border-radius: var(--radius-sm); background: rgba(255,255,255,0.04);
    color: var(--sidebar-muted); position: relative; z-index: 1;
}
.sidebar-search input {
    width: 100%; border: 0; background: transparent;
    color: var(--sidebar-ink); font: inherit; font-size: 0.9375rem; outline: none;
}
.sidebar-search input::placeholder { color: var(--sidebar-muted); }

.sidebar-nav {
    flex: 1; min-height: 0; overflow-y: auto;
    padding: 0.15rem 0.6rem 0.75rem; position: relative; z-index: 1;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.14) transparent;
}
.nav-group { margin-bottom: 0.2rem; }
.nav-group-label {
    list-style: none; display: flex; align-items: center;
    justify-content: space-between; gap: 0.5rem;
    padding: 0.65rem 0.65rem 0.4rem; color: var(--sidebar-muted);
    font-size: 0.875rem; font-weight: 600; letter-spacing: 0.01em;
    line-height: 1.3; cursor: pointer; user-select: none;
}
.nav-group-label::-webkit-details-marker { display: none; }
.nav-group-label .ph { font-size: 0.95rem; transition: transform 220ms var(--ease); }
.nav-group[open] > .nav-group-label .ph { transform: rotate(180deg); }
.sidebar-nav ul { list-style: none; display: none; flex-direction: column; gap: 0.12rem; }
.nav-group[open] ul { display: flex; }

.sidebar-nav a, .sidebar-exit {
    display: flex; align-items: center; gap: 0.7rem; min-height: 2.15rem;
    padding: 0.35rem 0.65rem; border-radius: 0.65rem; color: var(--sidebar-ink);
    text-decoration: none; font-size: 0.9375rem; font-weight: 500;
    transition: background 220ms var(--ease), color 220ms var(--ease), transform 160ms var(--ease);
}
.sidebar-nav a .ph, .sidebar-exit .ph {
    font-size: 1.12rem; width: 1.2rem; text-align: center; color: var(--sidebar-muted);
}
.sidebar-nav a:hover, .sidebar-exit:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav a:hover .ph, .sidebar-exit:hover .ph { color: #fff; }
.sidebar-nav a:active { transform: scale(0.985); }
.sidebar-nav a.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-nav a.is-active .ph { color: var(--accent); }
.nav-empty { padding: 1rem 0.75rem; color: var(--sidebar-muted); font-size: 0.9rem; }

.sidebar-foot {
    position: relative; z-index: 1; margin-top: auto; padding: 0.75rem;
    border-top: 1px solid var(--sidebar-line);
    display: flex; flex-direction: column; gap: 0.45rem;
}
.sidebar-user {
    display: flex; align-items: center; gap: 0.65rem;
    min-width: 0; padding: 0.15rem 0.35rem;
}
.user-avatar {
    flex-shrink: 0; width: 2rem; height: 2rem; border-radius: 0.65rem;
    display: grid; place-items: center; background: #2a3330;
    color: var(--accent-soft); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
}
.sidebar-user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sidebar-user-meta strong { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-meta small { color: var(--sidebar-muted); font-size: 0.8rem; text-transform: capitalize; }
.sidebar-exit { color: #e7b4b0; }
.sidebar-exit .ph { color: #e7b4b0; }

html.nav-collapsed { --sidebar-w: var(--sidebar-w-collapsed); }
html.nav-collapsed .brand-text, html.nav-collapsed .sidebar-search,
html.nav-collapsed .nav-group-label, html.nav-collapsed .sidebar-nav a span,
html.nav-collapsed .sidebar-user-meta, html.nav-collapsed .sidebar-exit span { display: none; }
html.nav-collapsed .sidebar-head, html.nav-collapsed .sidebar-foot,
html.nav-collapsed .sidebar-nav a, html.nav-collapsed .sidebar-exit {
    justify-content: center; padding-left: 0.35rem; padding-right: 0.35rem;
}
html.nav-collapsed .sidebar-brand { justify-content: center; }
html.nav-collapsed .nav-group ul { display: flex; }
html.nav-collapsed .sidebar-collapse .ph { transform: rotate(180deg); }
html.nav-collapsed .sidebar-nav a, html.nav-collapsed .sidebar-exit { width: 2.5rem; margin-inline: auto; }

.content {
    grid-column: 2; min-width: 0; width: 100%; max-width: 1500px;
    margin: 0 auto; padding: 1.15rem 1.35rem 2.25rem;
}

.topbar-brand, .topbar-page, .user-chip { display: flex; align-items: center; gap: 0.55rem; }

.hamburger, .hamburger::before, .hamburger::after {
    display: block; width: 1.05rem; height: 1.5px; background: currentColor;
    border-radius: 99px; position: relative;
    transition: transform 240ms var(--ease), opacity 200ms var(--ease);
}
.hamburger::before, .hamburger::after { content: ""; position: absolute; left: 0; }
.hamburger::before { top: -5px; }
.hamburger::after { top: 5px; }
html.nav-open .hamburger { background: transparent; }
html.nav-open .hamburger::before { top: 0; transform: rotate(45deg); }
html.nav-open .hamburger::after { top: 0; transform: rotate(-45deg); }

@media (max-width: 1023px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; padding: 0; gap: 0; }
    .app-shell > .topbar {
        display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.65rem;
        position: sticky; top: 0; z-index: var(--z-topbar); min-height: 3.5rem;
        padding: 0.55rem 0.85rem;
        background: color-mix(in srgb, var(--bg-elevated) 86%, transparent);
        backdrop-filter: blur(16px); border-bottom: 1px solid var(--line);
    }
    .topbar-page { font-size: 0.92rem; font-weight: 600; letter-spacing: -0.02em; justify-self: end; }
    .topbar-brand span:last-child { font-weight: 600; letter-spacing: -0.03em; }
    .topbar .icon-btn { color: var(--ink); background: var(--surface); }
    .sidebar {
        position: fixed; inset: 0.65rem auto 0.65rem 0.65rem;
        width: min(19rem, calc(100vw - 1.3rem)); height: auto;
        transform: translateX(calc(-100% - 1.2rem)); pointer-events: none; border-radius: 1.1rem;
    }
    html.nav-open .sidebar { transform: translateX(0); pointer-events: auto; }
    .nav-overlay {
        display: block; position: fixed; inset: 0; z-index: calc(var(--z-overlay) - 1);
        background: rgba(23, 33, 30, 0.42); opacity: 0; pointer-events: none;
        transition: opacity 240ms var(--ease);
    }
    html.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }
    .sidebar-collapse { display: none; }
    .sidebar-close { display: inline-flex; }
    .content { grid-column: 1; grid-row: 2; max-width: none; padding: 1rem 0.9rem 2rem; }
    html.nav-collapsed { --sidebar-w: 17.5rem; }
    html.nav-collapsed .brand-text, html.nav-collapsed .sidebar-search,
    html.nav-collapsed .nav-group-label, html.nav-collapsed .sidebar-nav a span,
    html.nav-collapsed .sidebar-user-meta, html.nav-collapsed .sidebar-exit span { display: revert; }
    html.nav-collapsed .sidebar-nav a, html.nav-collapsed .sidebar-exit {
        width: auto; margin-inline: 0; justify-content: flex-start; padding: 0.35rem 0.65rem;
    }
}

.dashboard, .crud, .grafico {
    background: var(--surface);
    padding: 1.5rem 1.5rem 1.85rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.7);
}

.dashboard-header h1, .crud-header h1, .grafico .crud-header h1 {
    font-size: 1.55rem; font-weight: 600; letter-spacing: -0.035em;
    line-height: 1.15; text-wrap: balance;
}
.dashboard-header p { color: var(--ink-muted); font-size: 0.95rem; margin-top: 0.3rem; max-width: 42rem; line-height: 1.55; }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.85rem; margin-top: 1.4rem; }
.dashboard-card { background: var(--bg-elevated); border-radius: var(--radius-md); padding: 1.05rem 1.15rem 1.15rem; display: flex; flex-direction: column; justify-content: space-between; }
.dashboard-card-alert { background: var(--danger-soft); }
.dashboard-card-success { background: color-mix(in srgb, var(--accent-soft) 70%, white); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.dashboard-card-success .dashboard-metric { color: var(--accent); }
.dashboard-card h2 { font-size: 0.78rem; font-weight: 600; color: var(--ink-muted); letter-spacing: 0.02em; margin-bottom: 0.45rem; }
.dashboard-metric { font-size: 1.85rem; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.dashboard-label { font-size: 0.8rem; color: var(--ink-muted); margin-top: 0.2rem; }
.dashboard-links { margin-top: 1.35rem; display: flex; flex-wrap: wrap; gap: 0.65rem; }

.crud-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.35rem; gap: 1rem; }

.btn-primary, .btn-secondary, .btn-danger,
.crud-form button[type="submit"], .login-page button[type="submit"] {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    width: auto; padding: 0.5rem 1rem; border: 0; border-radius: 999px;
    font: inherit; font-size: 0.88rem; font-weight: 600; text-decoration: none;
    cursor: pointer; transition: transform 180ms var(--ease), background 220ms var(--ease), filter 220ms var(--ease);
}
.btn-primary, .crud-form button[type="submit"], .login-page button[type="submit"] {
    background: var(--accent); color: #f4faf7;
}
.btn-secondary { background: var(--accent-soft); color: var(--accent); }
.btn-danger { background: var(--danger); color: #f4faf7; }

.btn-primary:hover, .btn-danger:hover,
.crud-form button[type="submit"]:hover, .login-page button[type="submit"]:hover,
.btn-secondary:hover { filter: brightness(1.05); transform: translateY(-1px); }

.btn-primary:active, .btn-danger:active,
.crud-form button[type="submit"]:active, .login-page button[type="submit"]:active,
.btn-secondary:active { transform: scale(0.98); }

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.filter-actions .btn-primary,
.filter-actions .btn-secondary,
.crud-form .filter-actions button[type="submit"],
.crud-form .filter-actions a.btn-secondary {
    min-width: 96px;
    height: 38px;
    padding: 0 1.15rem;
    margin: 0;
    align-self: auto;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

.crud-empty { color: var(--ink-muted); padding: 1.5rem 0.15rem; line-height: 1.5; }

.crud-table, .chart-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.crud-table th, .crud-table td, .chart-table th, .chart-table td {
    padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle;
}
.crud-table th, .chart-table th {
    font-weight: 600; color: var(--ink-muted); font-size: 0.78rem; background: var(--bg-elevated);
}
.crud-table tbody tr, .chart-table tbody tr { transition: background-color 140ms var(--ease); }
.crud-table tbody tr:hover, .chart-table tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 60%, white); }

.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.crud-actions-col { width: 10rem; white-space: nowrap; }
.crud-actions { display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
td.crud-actions { vertical-align: middle; white-space: nowrap; }
.inline-form { display: inline-flex; margin: 0; }

.crud-form { max-width: 32rem; display: flex; flex-direction: column; gap: 0.15rem; }
.crud-form button[type="submit"] { margin-top: 0.5rem; align-self: flex-start; }

.field { margin-bottom: 0.95rem; }
.field label { display: block; margin-bottom: 0.35rem; font-size: 0.82rem; font-weight: 500; color: var(--ink); }
.field input, .field select, .field textarea {
    width: 100%; padding: 0.55rem 0.75rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    font: inherit; font-size: 0.95rem;
    transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 111, 94, 0.18);
}

.error {
    background: var(--danger-soft); color: var(--danger);
    padding: 0.6rem 0.8rem; border-radius: var(--radius-sm);
    font-size: 0.85rem; margin-bottom: 1rem;
}

.chart-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); padding-bottom: 0.85rem; }
.chart-nav-item {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.45rem 0.95rem; border-radius: 999px;
    font-size: 0.85rem; font-weight: 500; color: var(--ink-muted);
    text-decoration: none; background: var(--bg-elevated);
    transition: all 180ms var(--ease);
}
.chart-nav-item:hover { color: var(--ink); background: color-mix(in srgb, var(--accent-soft) 50%, var(--bg-elevated)); }
.chart-nav-item.is-active { color: #f4faf7; background: var(--accent); font-weight: 600; }

.chart-summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.85rem; margin-bottom: 1.25rem; }
.chart-summary-card { background: var(--bg-elevated); border-radius: var(--radius-md); padding: 0.95rem 1.15rem; }
.chart-summary-card.highlight { background: color-mix(in srgb, var(--accent-soft) 60%, white); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.chart-summary-card h3 { font-size: 0.76rem; font-weight: 600; color: var(--ink-muted); letter-spacing: 0.02em; margin-bottom: 0.35rem; }
.chart-summary-card .metric { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--ink); }
.chart-summary-card.highlight .metric { color: var(--accent); }
.chart-summary-card .label { font-size: 0.78rem; color: var(--ink-muted); margin-top: 0.2rem; }

.chart-wrapper { margin-top: 0.5rem; overflow-x: auto; }
.chart-pos-header { width: 70px; text-align: center; }
.chart-pos { width: 70px; text-align: center; font-weight: 700; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.chart-bar-header { width: 45%; }
.chart-value-header { width: 80px; text-align: right; }
.chart-money-header { width: 140px; text-align: right; }
.chart-label { white-space: nowrap; padding-right: 0.5rem; font-weight: 500; }
.chart-bar-cell { width: 100%; min-width: 120px; }
.chart-bar { height: 0.75rem; border-radius: 999px; background: var(--accent); transition: width 300ms ease; }
.chart-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-money { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); white-space: nowrap; }

.chart-table tfoot tr { background: var(--bg-elevated); border-top: 2px solid var(--line); }
.chart-table tfoot th, .chart-table tfoot td { font-weight: 700; padding: 0.85rem 0.75rem; color: var(--ink); }

.login-page {
    min-height: 100dvh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(900px 600px at 30% 20%, rgba(47, 111, 94, 0.14), transparent 55%), var(--bg);
}
.login-container {
    background: var(--surface); padding: 2.25rem 2.5rem 2.5rem;
    border-radius: var(--radius-lg); box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.7);
    width: 100%; max-width: 22rem;
}
.login-container h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.035em; margin-bottom: 1.65rem; text-align: center; }

/* Modais */
.custom-modal {
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 0;
    max-width: 32rem;
    width: calc(100% - 2rem);
    background: var(--surface);
    position: fixed;
    inset: 0;
    margin: auto;
    max-height: 90vh;
    overflow-y: auto;
}
.custom-modal::backdrop {
    background: rgba(23, 33, 30, 0.48);
    backdrop-filter: blur(4px);
}
.wide-modal {
    max-width: 52rem;
}
.modal-content {
    padding: 1.75rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.modal-content legend {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}
.modal-footer,
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 0.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.form-grid-2cols {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
@media (max-width: 640px) {
    .form-grid-2cols {
        grid-template-columns: 1fr;
    }
}
.form-grid .full-width {
    grid-column: 1 / -1;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Header dropdowns (Renovar, Renovar c/ Email) */
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
    display: none; position: absolute; left: 0; top: calc(100% + 4px); z-index: 200;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
    box-shadow: var(--shadow); min-width: 11rem; padding: 0.4rem;
    flex-direction: column; gap: 0.2rem;
}
.dropdown-content.open { display: flex; }
.dropdown-content button {
    width: 100%; text-align: left; padding: 0.5rem 0.75rem; border: 0;
    border-radius: var(--radius-sm); background: transparent; font: inherit;
    font-size: 0.88rem; cursor: pointer; color: var(--ink);
    transition: background 180ms var(--ease);
}
.dropdown-content button:hover { background: var(--bg-elevated); color: var(--ink); }

/* Row dropdown */
.row-dropdown { position: relative; display: inline-block; }
.row-dropdown-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 99999;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    min-width: 9.5rem; padding: 0.4rem;
    flex-direction: column; gap: 0.3rem;
}
.row-dropdown-menu.open { display: flex; }
.row-dropdown-menu button {
    width: 100%; text-align: left; padding: 0.5rem 0.75rem; border: 0;
    border-radius: var(--radius-sm); background: transparent; font: inherit;
    font-size: 0.88rem; font-weight: 500; cursor: pointer; color: var(--ink);
    transition: background 180ms var(--ease), color 180ms var(--ease), filter 180ms var(--ease);
}
.row-dropdown-menu button:hover {
    background: var(--bg-elevated);
    color: var(--ink);
}
.row-dropdown-menu button.btn-primary {
    color: #ffffff !important;
    background: var(--accent) !important;
}
.row-dropdown-menu button.btn-primary:hover {
    background: var(--accent) !important;
    color: #ffffff !important;
    filter: brightness(1.12);
}
.row-dropdown-menu button.btn-danger {
    color: #ffffff !important;
    background: var(--danger) !important;
}
.row-dropdown-menu button.btn-danger:hover {
    background: var(--danger) !important;
    color: #ffffff !important;
    filter: brightness(1.12);
}

/* Quill */
.ql-toolbar { border-radius: var(--radius-sm) var(--radius-sm) 0 0; border-color: var(--line) !important; background: var(--bg-elevated); }
.ql-container { border-radius: 0 0 var(--radius-sm) var(--radius-sm); border-color: var(--line) !important; font-family: var(--font); font-size: 0.95rem; }
.ql-editor { min-height: 8rem; }

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    vertical-align: middle;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--line);
    transition: 200ms cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 22px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: 200ms cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent);
}

.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 2px var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.text-success {
    color: var(--accent) !important;
}

.text-muted {
    color: var(--ink-muted) !important;
}

/* Linha de painel/registro inativo */
.crud-table tbody tr.row-inativo,
.crud-table tbody tr.row-inativo td {
    color: #9aa8a1;
}

.crud-table tbody tr.row-inativo td a {
    color: #9aa8a1;
}

/* Linha de plano sem logins associados */
.crud-table tbody tr.row-zero-logins {
    background-color: rgba(239, 68, 68, 0.05);
}
.crud-table tbody tr.row-zero-logins:hover {
    background-color: rgba(239, 68, 68, 0.10);
}
.crud-table tbody tr.row-zero-logins td {
    color: var(--ink-muted);
}
.badge-zero-logins {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    font-size: 0.76rem;
    font-weight: 700;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.25);
    white-space: nowrap;
}
.badge-active-logins {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    font-size: 0.76rem;
    font-weight: 700;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
    white-space: nowrap;
}

/* Cores de planos */
.color-1 { color: #4CAF50; font-weight: bold; }
.color-2 { color: #2196F3; font-weight: bold; }
.color-3 { color: #FFC107; font-weight: bold; }
.color-6 { color: #CDDC39; font-weight: bold; }
.color-12 { color: #F44336; font-weight: bold; }

/* Paginação das tabelas de consulta */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--line);
    font-size: 0.875rem;
    color: var(--ink-muted);
}

.pagination-limit {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 500;
}

.pagination-limit label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: var(--ink-muted);
    font-weight: 500;
    margin: 0;
}

.pagination-limit select.page-limit {
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--bg-elevated);
    color: var(--ink);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all 180ms var(--ease);
}

.pagination-limit select.page-limit:hover,
.pagination-limit select.page-limit:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(47, 111, 94, 0.14);
}

.pagination-total {
    font-size: 0.82rem;
    color: var(--ink-muted);
    font-weight: 500;
}

.pagination-buttons {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    transition: transform 180ms var(--ease), background 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-elevated);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(47, 111, 94, 0.12);
}

.pagination-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink-muted);
    box-shadow: none;
}

.page-info {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink-muted);
    padding: 0.4rem 0.85rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-variant-numeric: tabular-nums;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.page-info strong {
    color: var(--ink);
    font-weight: 700;
}

@media (max-width: 640px) {
    .pagination-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }
    .pagination-limit, .pagination-buttons {
        justify-content: space-between;
        width: 100%;
    }
}

/* Login Popover (Logins Clientes) */
.login-hover-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    text-decoration: none;
    color: var(--ink);
    font-weight: 500;
    position: relative;
    border-bottom: 1px dashed var(--line);
    transition: color 150ms var(--ease), border-color 150ms var(--ease);
}

.login-hover-trigger:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.login-info-popover {
    position: fixed;
    z-index: 999999;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08);
    width: 320px;
    max-width: calc(100vw - 32px);
    padding: 1rem;
    pointer-events: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px) scale(0.98);
    transition: opacity 180ms var(--ease), transform 180ms var(--ease), visibility 180ms;
    font-family: var(--font);
    color: var(--ink);
}

.login-info-popover.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.login-info-popover .popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.6rem;
    margin-bottom: 0.65rem;
    border-bottom: 1px solid var(--line);
}

.login-info-popover .popover-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
}

.login-info-popover .popover-title i {
    color: var(--accent);
    font-size: 1.1rem;
}

.login-info-popover .popover-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.login-info-popover .popover-section {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.login-info-popover .popover-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
}

.login-info-popover .popover-label i {
    font-size: 0.95rem;
}

.login-info-popover .popover-whatsapp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: var(--bg-elevated);
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
}

.login-info-popover .popover-wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #25D366;
    color: #ffffff !important;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    text-decoration: none;
    transition: background 150ms var(--ease), transform 150ms var(--ease);
}

.login-info-popover .popover-wa-btn:hover {
    background: #20ba59;
    color: #ffffff !important;
    transform: scale(1.02);
}

.login-info-popover .popover-detalhes-box {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
    line-height: 1.45;
    max-height: 140px;
    overflow-y: auto;
    word-break: break-word;
    color: var(--ink);
}

.login-info-popover .popover-detalhes-box p {
    margin: 0 0 0.4rem 0;
}
.login-info-popover .popover-detalhes-box p:last-child {
    margin-bottom: 0;
}

/* Searchable Select Component */
.searchable-select-wrapper {
    position: relative;
    width: 100%;
}

.searchable-select-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.searchable-select-input-wrap input.searchable-select-search {
    width: 100%;
    padding: 0.55rem 2.2rem 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.95rem;
    transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
    cursor: text;
}

.searchable-select-input-wrap input.searchable-select-search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 111, 94, 0.18);
}

.searchable-select-input-wrap input.searchable-select-search.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-soft);
}

.searchable-select-clear {
    position: absolute;
    right: 1.65rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--ink-muted);
    font-size: 1.15rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 150ms ease, background 150ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.searchable-select-clear:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

.searchable-select-toggle {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--ink-muted);
    font-size: 0.75rem;
    transition: transform 200ms var(--ease);
}

.searchable-select-wrapper.is-open .searchable-select-toggle {
    transform: translateY(-50%) rotate(180deg);
}

.searchable-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 99999;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.16), 0 4px 10px -2px rgba(0, 0, 0, 0.08);
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.searchable-select-list {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
}

.searchable-select-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    color: var(--ink);
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.searchable-select-item:hover,
.searchable-select-item.is-highlighted {
    background: var(--accent-soft);
    color: var(--accent);
}

.searchable-select-item.is-selected {
    font-weight: 600;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent-soft) 40%, transparent);
}

.searchable-select-item mark {
    background: rgba(250, 204, 21, 0.35);
    color: inherit;
    font-weight: 700;
    border-radius: 2px;
    padding: 0 1px;
}

.searchable-select-empty {
    padding: 0.85rem 0.75rem;
    font-size: 0.85rem;
    color: var(--ink-muted);
    text-align: center;
    font-style: italic;
}

.searchable-select-native-hidden {
    position: absolute !important;
    opacity: 0 !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    pointer-events: none !important;
    clip: rect(0 0 0 0) !important;
}

/* Compact version for filter rows / table headers */
.searchable-select-compact input.searchable-select-search {
    padding: 0.25rem 1.6rem 0.25rem 0.45rem !important;
    font-size: 0.8rem !important;
    height: 28px !important;
}

.searchable-select-compact .searchable-select-clear {
    right: 1.15rem !important;
    font-size: 0.85rem !important;
}

.searchable-select-compact .searchable-select-toggle {
    right: 0.35rem !important;
    font-size: 0.65rem !important;
}

.searchable-select-compact .searchable-select-dropdown {
    min-width: 180px !important;
    width: max-content !important;
    max-width: 280px !important;
}






