/* ═══════════════════════════════════════════════════════════════
   ANTCO — Design System v2
   Elegância, minimalismo, espaço em branco, hierarquia clara.
   Referências: Stripe, Linear, Notion, Vercel.
   Todos os nomes de classe da v1 foram preservados.
═══════════════════════════════════════════════════════════════ */

:root {
    /* ── Palette ── */
    --bg:          #f8f9fb;
    --surface:     #ffffff;
    --surface2:    #f9fafb;
    --surface3:    #f2f4f7;
    --border:      #eaecf0;
    --border2:     #d0d5dd;

    /* ── Brand ── */
    --primary:     #2563eb;
    --primary-dim: rgba(37, 99, 235, 0.07);
    --primary-h:   #1d4ed8;

    /* ── Semantic ── */
    --success:     #067647;
    --success-dim: rgba(6, 118, 71, 0.08);
    --warning:     #b54708;
    --warning-dim: rgba(181, 71, 8, 0.08);
    --danger:      #d92d20;
    --danger-dim:  rgba(217, 45, 32, 0.07);
    --purple:      #6941c6;
    --purple-dim:  rgba(105, 65, 198, 0.08);

    /* ── Text ── */
    --text:        #101828;
    --text2:       #475467;
    --text3:       #98a2b3;

    /* ── Layout ── */
    --sidebar-w:   248px;
    --radius-sm:   8px;
    --radius:      10px;
    --radius-lg:   12px;
    --radius-xl:   16px;

    /* ── Shadows — discretas, estilo Stripe ── */
    --shadow-xs:   0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-sm:   0 1px 3px rgba(16, 24, 40, 0.07), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow:      0 4px 12px rgba(16, 24, 40, 0.07), 0 2px 4px rgba(16, 24, 40, 0.04);
    --shadow-lg:   0 12px 32px rgba(16, 24, 40, 0.10), 0 4px 8px rgba(16, 24, 40, 0.04);
    --glow-blue:   0 0 0 4px rgba(37, 99, 235, 0.10);

    /* ── Focus ring (a11y) ── */
    --ring:        0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* ═══════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button, .btn { cursor: pointer; font-family: inherit; }
::selection { background: rgba(37, 99, 235, 0.15); color: var(--primary-h); }

svg { flex-shrink: 0; }

/* ═══════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 200;
}

/* ── Brand ── */
.sidebar-brand {
    padding: 20px 20px 16px;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.5px;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}

.brand-name {
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text);
    line-height: 1.2;
}

.brand-sub {
    font-size: 10.5px;
    color: var(--text3);
    font-weight: 500;
    letter-spacing: 0.1px;
}

/* ── Nav ── */
.sidebar-nav {
    flex: 1;
    padding: 6px 12px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    color: var(--text3);
    text-transform: uppercase;
    padding: 12px 10px 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text2);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
    margin-bottom: 1px;
}

.nav-link:hover {
    background: var(--surface2);
    color: var(--text);
}

.nav-link.active {
    background: var(--primary-dim);
    color: var(--primary-h);
    font-weight: 600;
}

.nav-icon {
    width: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text3);
    flex-shrink: 0;
    font-size: 14px;
    transition: color 0.12s;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon { color: inherit; }

/* ── Footer ── */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--primary-dim);
    color: var(--primary-h);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    flex-shrink: 0;
}

.user-email {
    font-size: 11px;
    color: var(--text3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* ═══════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════ */
.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Topbar ── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.topbar-title {
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-date {
    font-size: 12px;
    color: var(--text3);
    font-weight: 500;
}

/* ── Pill do trial (topbar) — transparência permanente ── */
.trial-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    background: var(--primary-dim);
    color: var(--primary-h);
    border: 1px solid rgba(37, 99, 235, .18);
    text-decoration: none;
    transition: background .12s;
}
a.trial-pill:hover { background: rgba(37, 99, 235, .14); }
.trial-pill.urgent {
    background: #fffaeb;
    color: #b54708;
    border-color: #fedf89;
}

/* ── Rodapé do app — discreto, só o necessário ── */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 36px;
    padding: 14px 0 4px;
    border-top: 1px solid var(--surface3);
    font-size: 11.5px;
    color: var(--text3);
}
.app-footer a { color: var(--text3); text-decoration: none; }
.app-footer a:hover { color: var(--text2); text-decoration: underline; }
.app-footer-sep { color: var(--border2); }

/* ── Seletor de empresa ativa (escritório) ── */
.company-switcher {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 8px 4px 11px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-width: 220px;
}
.company-switcher-ico { color: var(--text3); display: inline-flex; flex-shrink: 0; }
.company-switcher select {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    max-width: 175px;
    text-overflow: ellipsis;
    padding-right: 2px;
}
.company-switcher select:focus { outline: none; }
@media (max-width: 720px) {
    .company-switcher { max-width: 150px; }
    .company-switcher select { max-width: 110px; }
}

/* ── Content ── */
.content {
    padding: 32px;
    flex: 1;
    max-width: 1440px;
    width: 100%;
}

/* ═══════════════════════════════════════════
   CARDS
═══════════════════════════════════════════ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-xs);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Metric Cards ── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-xs);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.metric-card:hover {
    border-color: var(--border2);
    box-shadow: var(--shadow-sm);
}

.metric-card::after { display: none; }

.metric-icon-wrap {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    margin-bottom: 14px;
}
.metric-card.blue   .metric-icon-wrap { background: var(--primary-dim); color: var(--primary); }
.metric-card.green  .metric-icon-wrap { background: var(--success-dim); color: var(--success); }
.metric-card.yellow .metric-icon-wrap { background: var(--warning-dim); color: var(--warning); }
.metric-card.red    .metric-icon-wrap { background: var(--danger-dim);  color: var(--danger); }
.metric-card.purple .metric-icon-wrap { background: var(--purple-dim);  color: var(--purple); }

.metric-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text3);
    margin-bottom: 6px;
}

.metric-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.metric-sub {
    font-size: 11.5px;
    color: var(--text3);
    margin-top: 8px;
    font-weight: 500;
}

/* ═══════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════ */
.alerts-container { margin-bottom: 20px; }

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    animation: slide-in 0.22s ease;
}

@keyframes slide-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert-danger  {
    background: #fef3f2;
    border-color: #fecdca;
    color: #b42318;
}
.alert-warning {
    background: #fffaeb;
    border-color: #fedf89;
    color: #93370d;
}
.alert-success {
    background: #ecfdf3;
    border-color: #abefc6;
    color: #067647;
}
.alert-info {
    background: #eff4ff;
    border-color: #c7d7fe;
    color: #1d4ed8;
}

.alert-icon { flex-shrink: 0; font-size: 14px; line-height: 1.5; }

/* ═══════════════════════════════════════════
   TABLES
═══════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead tr { border-bottom: 1px solid var(--border); }

th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text3);
    white-space: nowrap;
    background: var(--surface2);
}

th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
th:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

tbody tr {
    border-bottom: 1px solid var(--surface3);
    transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

td {
    padding: 13px 16px;
    color: var(--text);
    vertical-align: middle;
}

/* ═══════════════════════════════════════════
   BADGES
═══════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-pago {
    background: #ecfdf3;
    color: #067647;
    border-color: #abefc6;
}
.badge-pago .badge-dot { background: #17b26a; }

.badge-pendente {
    background: #fffaeb;
    color: #b54708;
    border-color: #fedf89;
}
.badge-pendente .badge-dot { background: #f79009; }

.badge-atrasado {
    background: #fef3f2;
    color: #b42318;
    border-color: #fecdca;
}
.badge-atrasado .badge-dot { background: #f04438; }

.badge-risk-baixo {
    background: #ecfdf3;
    color: #067647;
    border-color: #abefc6;
}
.badge-risk-medio {
    background: #fffaeb;
    color: #b54708;
    border-color: #fedf89;
}
.badge-risk-alto {
    background: #fef3f2;
    color: #b42318;
    border-color: #fecdca;
}

/* ═══════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.45;
    transition: background 0.13s, border-color 0.13s, box-shadow 0.13s, color 0.13s;
    white-space: nowrap;
    letter-spacing: -0.1px;
}

.btn:focus-visible,
.form-control:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:active { transform: translateY(0.5px); }

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
    background: var(--primary-h);
    border-color: var(--primary-h);
}

.btn-success {
    background: var(--surface);
    color: var(--success);
    border-color: #abefc6;
}
.btn-success:hover { background: var(--success-dim); }

.btn-danger {
    background: var(--surface);
    color: var(--danger);
    border-color: #fecdca;
}
.btn-danger:hover { background: var(--danger-dim); }

.btn-ghost {
    background: var(--surface);
    color: var(--text2);
    border-color: var(--border2);
    box-shadow: var(--shadow-xs);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-excel {
    background: var(--surface);
    color: #067647;
    border-color: #abefc6;
    box-shadow: var(--shadow-xs);
}
.btn-excel:hover { background: var(--success-dim); }

.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }

/* ═══════════════════════════════════════════
   FORMS
═══════════════════════════════════════════ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text2);
    letter-spacing: -0.1px;
}

.form-control {
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border2);
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    font-family: inherit;
    width: 100%;
    transition: border-color 0.13s, box-shadow 0.13s;
    outline: none;
    box-shadow: var(--shadow-xs);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.form-control::placeholder { color: var(--text3); }
select.form-control option { background: var(--surface); }

/* ── File Input ── */
.file-drop-zone {
    border: 1.5px dashed var(--border2);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: var(--surface2);
    display: block;
}

.file-drop-zone:hover, .file-drop-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-dim);
}

.file-drop-zone input[type="file"] {
    display: none;
}

/* ═══════════════════════════════════════════
   SEARCH BAR / TOOLBAR
═══════════════════════════════════════════ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 340px;
}

.search-wrap .search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text3);
    font-size: 13px;
    pointer-events: none;
    display: inline-flex;
}

.search-wrap .form-control { padding-left: 34px; }

/* ═══════════════════════════════════════════
   LAYOUT HELPERS
═══════════════════════════════════════════ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.4px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.risk-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 130px;
}

.risk-bar {
    flex: 1;
    height: 5px;
    border-radius: 3px;
    background: var(--surface3);
    overflow: hidden;
}

.risk-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.risk-bar-fill.alto  { background: var(--danger); }
.risk-bar-fill.medio { background: #f79009; }
.risk-bar-fill.baixo { background: #17b26a; }

/* ── Empty states ── */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--text3);
}

.empty-state-icon {
    font-size: 24px;
    margin: 0 auto 14px;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--surface3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text3);
}

.empty-state-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.empty-state-sub   { font-size: 13px; color: var(--text3); max-width: 380px; margin: 0 auto; line-height: 1.6; }

/* ═══════════════════════════════════════════
   TYPOGRAPHY HELPERS
═══════════════════════════════════════════ */
.fw-700 { font-weight: 700; }
.fw-600 { font-weight: 600; }
.text-muted   { color: var(--text2); }
.text-dimmed  { color: var(--text3); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-sm  { font-size: 12px; }
.text-xs  { font-size: 11px; }
.mb-4   { margin-bottom: 4px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.mb-20  { margin-bottom: 20px; }
.mb-24  { margin-bottom: 24px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.gap-8  { gap: 8px; }
.flex   { display: flex; }
.items-center { align-items: center; }

/* ═══════════════════════════════════════════
   LOADING SPINNER
═══════════════════════════════════════════ */
.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn-primary .spinner,
.btn-cobrar .spinner {
    border-color: rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
}

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

/* ═══════════════════════════════════════════
   TOOLTIP
═══════════════════════════════════════════ */
[data-tip] {
    position: relative;
    cursor: help;
}

[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #101828;
    color: #f9fafb;
    font-size: 11.5px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    box-shadow: var(--shadow);
    z-index: 999;
    transition: opacity 0.15s;
}

[data-tip]:hover::after { opacity: 1; }

/* ═══════════════════════════════════════════
   IMPORT PREVIEW TABLE
═══════════════════════════════════════════ */
.preview-row-ok  { background: rgba(23, 178, 106, 0.04); }
.preview-row-err { background: rgba(240, 68, 56, 0.04); }

.error-list {
    list-style: none;
    padding: 0;
    margin: 2px 0 0;
}

.error-list li {
    font-size: 11.5px;
    color: var(--danger);
    font-weight: 500;
}

/* ═══════════════════════════════════════════
   DIVIDER
═══════════════════════════════════════════ */
.divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

/* ═══════════════════════════════════════════
   URGENCY SYSTEM — filas de cobrança
═══════════════════════════════════════════ */

tr.row-overdue td {
    background: rgba(240, 68, 56, 0.03);
}
tr.row-overdue:hover td {
    background: rgba(240, 68, 56, 0.06);
}
tr.row-overdue td:first-child {
    border-left: 3px solid var(--danger);
    padding-left: 13px;
}

.days-overdue-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    border-radius: 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.1px;
    background: #fef3f2;
    color: #b42318;
    border: 1px solid #fecdca;
    white-space: nowrap;
}

.days-soon-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    border-radius: 5px;
    font-size: 10.5px;
    font-weight: 700;
    background: #fffaeb;
    color: #b54708;
    border: 1px solid #fedf89;
    white-space: nowrap;
}

/* Botão "Cobrar" — ação dominante */
.btn-cobrar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: 1px solid var(--danger);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    background: var(--danger);
    color: #fff;
    box-shadow: var(--shadow-xs);
    transition: background 0.13s, border-color 0.13s;
    font-family: inherit;
    line-height: 1.45;
}
.btn-cobrar:hover {
    background: #b42318;
    border-color: #b42318;
}
.btn-cobrar:active { transform: translateY(0.5px); }

/* Botão "Pagar" */
.btn-pagar {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid #abefc6;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    background: var(--surface);
    color: var(--success);
    transition: background 0.13s, border-color 0.13s;
    font-family: inherit;
    line-height: 1.45;
    box-shadow: var(--shadow-xs);
}
.btn-pagar:hover {
    background: var(--success-dim);
}

/* ── Bloco de ação no topo das telas secundárias ── */
.page-action-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid #fecdca;
    background: #fffbfa;
    margin-bottom: 24px;
    gap: 16px;
}
.page-action-banner.is-clear {
    border-color: #abefc6;
    background: #f6fef9;
}
.pab-left { display: flex; align-items: center; gap: 14px; }
.pab-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; flex-shrink: 0;
}
.pab-icon.danger  { background: var(--danger-dim);  color: var(--danger); }
.pab-icon.success { background: var(--success-dim); color: var(--success); }
.pab-title {
    font-size: 13.5px; font-weight: 700; color: var(--text);
    letter-spacing: -0.2px;
}
.pab-sub {
    font-size: 12px; color: var(--text2); margin-top: 1px;
}
.pab-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Urgency summary strip ── */
.urgency-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.us-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-xs);
}
.us-item.is-danger { border-color: #fecdca; }
.us-label {
    font-size: 10.5px; font-weight: 600; letter-spacing: 0.4px;
    text-transform: uppercase; color: var(--text3); margin-bottom: 6px;
}
.us-value {
    font-size: 20px; font-weight: 800; letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums; color: var(--text); line-height: 1.2;
}
.us-value.danger  { color: var(--danger); }
.us-value.success { color: var(--success); }
.us-sub { font-size: 11.5px; color: var(--text3); font-weight: 500; margin-top: 3px; }

/* ── Action column ── */
.action-col {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

/* ═══════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 4px 0;
    flex-wrap: wrap;
}
.page-btn {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border2);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text2);
    background: var(--surface);
    transition: all 0.13s;
    box-shadow: var(--shadow-xs);
}
.page-btn:hover:not(.disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.disabled { opacity: 0.4; pointer-events: none; }
.page-numbers { display: flex; align-items: center; gap: 3px; }
.page-num {
    min-width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 12.5px; font-weight: 600;
    color: var(--text2);
    transition: background 0.12s;
}
.page-num:hover { background: var(--surface2); }
.page-num.active { background: var(--primary); color: #fff; }
.page-ellipsis { color: var(--text3); font-size: 12px; padding: 0 3px; }
.page-info { font-size: 11.5px; color: var(--text3); font-weight: 500; }

/* ═══════════════════════════════════════════
   MOBILE / RESPONSIVE SHELL
   Sidebar vira off-canvas abaixo de 900px.
═══════════════════════════════════════════ */
.menu-toggle {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    width: 34px; height: 34px;
    align-items: center; justify-content: center;
    font-size: 15px;
    color: var(--text2);
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}
.menu-toggle:hover { background: var(--surface2); }

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(16, 24, 40, 0.45);
    z-index: 190;
    opacity: 0;
    transition: opacity 0.2s;
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: none;
    }
    body.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 0 0 48px rgba(16, 24, 40, 0.25);
    }
    body.sidebar-open .sidebar-overlay {
        display: block;
        opacity: 1;
    }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .topbar { padding: 0 16px; gap: 10px; }
    .content { padding: 20px 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
}

/* ── Flash messages: botão fechar ── */
.alert { position: relative; padding-right: 36px; }
.alert-close {
    position: absolute; top: 10px; right: 10px;
    background: none; border: none; cursor: pointer;
    color: inherit; opacity: 0.5;
    font-size: 13px; line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
}
.alert-close:hover { opacity: 1; }
.alert.fade-out { opacity: 0; transform: translateY(-4px); transition: opacity 0.3s, transform 0.3s; }

/* ═══════════════════════════════════════════
   NAV v2 — item home + espaçamento de grupos
═══════════════════════════════════════════ */
.nav-home { margin-bottom: 2px; }
.sidebar-nav .nav-section-label { margin-top: 14px; }
.sidebar-nav .nav-section-label:first-child { margin-top: 0; }

/* ═══════════════════════════════════════════
   BUSCA GLOBAL — gatilho na topbar
═══════════════════════════════════════════ */
.search-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border2);
    background: var(--surface);
    color: var(--text3);
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: border-color 0.13s, color 0.13s;
    min-width: 180px;
}
.search-trigger:hover { border-color: var(--border2); color: var(--text2); background: var(--surface2); }
.search-trigger-label { flex: 1; text-align: left; }
.search-trigger-kbd { display: inline-flex; gap: 3px; }

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text3);
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1;
}

/* ═══════════════════════════════════════════
   BUSCA GLOBAL — command palette
═══════════════════════════════════════════ */
.palette-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.4);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 1200;
    padding: 12vh 16px 16px;
    justify-content: center;
    align-items: flex-start;
}
.palette-overlay.open { display: flex; }

.palette {
    width: 100%;
    max-width: 540px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: palette-in 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes palette-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.99); }
    to   { opacity: 1; transform: none; }
}

.palette-input-wrap {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text3);
}
.palette-input {
    flex: 1;
    border: none;
    outline: none;
    background: none;
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
}
.palette-input::placeholder { color: var(--text3); }
.palette-esc {
    font-size: 10px;
    font-weight: 600;
    color: var(--text3);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px 6px;
    background: var(--surface2);
}

.palette-results {
    max-height: 320px;
    overflow-y: auto;
    padding: 8px;
}
.palette-section {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text3);
    padding: 10px 12px 5px;
}
.palette-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text2);
}
.palette-row.active {
    background: var(--primary-dim);
    color: var(--primary-h);
}
.palette-row-label { font-weight: 500; }
.palette-row-label strong { font-weight: 700; }
.palette-row-hint {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text3);
    flex-shrink: 0;
}
.palette-row.active .palette-row-hint { color: var(--primary); }
.palette-none {
    padding: 28px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text3);
}

.palette-ft {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface2);
    font-size: 11px;
    color: var(--text3);
    font-weight: 500;
}
.palette-ft span { display: inline-flex; align-items: center; gap: 5px; }

@media (max-width: 640px) {
    .search-trigger { min-width: 0; padding: 6px 9px; }
    .search-trigger-label, .search-trigger-kbd { display: none; }
    .topbar-date { display: none; }
}

/* ═══════════════════════════════════════════
   DRAWER — painel lateral para criação de registros
═══════════════════════════════════════════ */
.drawer-root {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1100;
}
.drawer-root.open { display: block; }

.drawer-root .drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.drawer-root .drawer {
    position: absolute;
    top: 0; right: 0;
    height: 100%;
    width: 460px;
    max-width: 100%;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    animation: drawer-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes drawer-in {
    from { transform: translateX(28px); opacity: 0.4; }
    to   { transform: none; opacity: 1; }
}

.drawer-hd {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}
.drawer-title { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; }
.drawer-sub   { font-size: 12.5px; color: var(--text3); margin-top: 2px; }
.drawer-close {
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    color: var(--text3);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.drawer-close:hover { background: var(--surface3); color: var(--text); }

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
.drawer-body .form-grid { grid-template-columns: 1fr; gap: 18px; }
.drawer-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.drawer-ft {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface2);
}

@media (max-width: 560px) {
    .drawer-root .drawer { width: 100%; }
    .drawer-row-2 { grid-template-columns: 1fr; }
}

/* ══════════ Custos por centro (componente compartilhado) ══════════
   Usado por Contas a Pagar e Fluxo de Caixa via _cost_centers.html. */
.costs-hd {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; padding: 18px 22px 4px;
}
.costs-title { font-size: 15px; font-weight: 800; letter-spacing: -.3px; }
.costs-sub   { font-size: 12.5px; color: var(--text3); font-weight: 500; }
.cost-rows   { padding: 10px 22px 18px; display: flex; flex-direction: column; gap: 12px; }
.cost-row    { display: grid; grid-template-columns: 170px 1fr auto; gap: 12px; align-items: center; }
.cost-label  { font-size: 13px; font-weight: 600; color: var(--text);
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cost-bar    { height: 8px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
.cost-bar-fill { height: 100%; border-radius: 99px; background: var(--primary); }
.cost-val    { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
               white-space: nowrap; }
.cost-val .pct { color: var(--text3); font-weight: 600; margin-left: 6px; }
.costs-ft {
    padding: 12px 22px; border-top: 1px solid var(--surface3);
    font-size: 12.5px; color: var(--text2); font-weight: 500;
    display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline;
}
.costs-ft strong { color: var(--text); font-weight: 800; }
@media (max-width: 640px) {
    .cost-row { grid-template-columns: 1fr auto; }
    .cost-bar { display: none; }
}

/* ══════════ Badge de entrega (Central de Comunicações) ══════════
   Status do e-mail vindo dos webhooks do provedor: entregue/aberto/
   devolvido. Usado na Central de Cobrança e na timeline do Cliente 360. */
.dlv-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 1px 7px; border-radius: 99px;
    font-size: 10px; font-weight: 700; letter-spacing: .2px;
    white-space: nowrap;
    background: var(--surface3); color: var(--text2);
    border: 1px solid var(--border);
}
.dlv-badge.delivered { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.dlv-badge.opened,
.dlv-badge.clicked   { background: #ecfdf3; color: #067647; border-color: #abefc6; }
.dlv-badge.failed,
.dlv-badge.bounced,
.dlv-badge.complained { background: #fef3f2; color: #b42318; border-color: #fecdca; }
