/* Estilos do app (antes embutidos em templates/base.html, 4.600 linhas em
   toda pagina). Servidos por /static/ com cache de 30 dias; a versao no ?v=
   vem do hash do arquivo (octoplanner3/assets.py). */
/* =====================================================================
   FUNDACAO DO PADRAO VISUAL
   Tokens, reset e componentes globais: UMA definicao por componente,
   valendo nas duas cores de tema. O markup de cada componente e o
   contrato com as telas estao em COMPONENTES.md (pasta ui do squad).
   CSS de tela fica escopado na classe da tela e nao redefine estes
   seletores soltos.
   ===================================================================== */

/* ---------- Tokens (tema escuro e o padrao) ---------- */
:root {
    color-scheme: dark;
    --font: 'Plus Jakarta Sans', -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;

    /* Espaco: grade de 4px */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 24px;
    --s-6: 32px;
    --s-7: 48px;
    --s-8: 64px;

    /* Raio: badge, controle, card e chip/indicador. Nada fora disso. */
    --r-badge: 6px;
    --r-control: 10px;
    --r-card: 16px;
    --r-pill: 999px;

    /* Tipografia */
    --fs-12: 12px;
    --fs-13: 13px;
    --fs-14: 14px;
    --fs-16: 16px;
    --fs-20: 20px;
    --fs-24: 24px;
    --fs-32: 32px;

    /* Altura de controle (botao, campo, segmentado) */
    --h-control: 40px;
    --h-control-sm: 32px;

    /* Cor semantica: a mesma nos dois temas */
    --c-info: #06B6D4;
    --c-sucesso: #10B981;
    --c-atencao: #F59E0B;
    --c-erro: #F43F5E;
    --c-neutro: #94A3B8;
    --c-violeta: #8B5CF6;
    /* Texto na cor semantica (no claro escurece para contraste AA) */
    --c-info-texto: #22D3EE;
    --c-sucesso-texto: #34D399;
    --c-atencao-texto: #FBBF24;
    --c-erro-texto: #FB7185;

    /* Superficie e texto */
    --bg-primary: #0B0F1A;
    --surface-1: #0F1526;
    --surface-2: #141B2D;
    --border: #222D47;
    --border-strong: #33415F;
    --text-primary: #E6ECFF;
    --text-secondary: #94A3B8;
    --text-muted: #7A879D;
    --accent: #06B6D4;
    --accent-hover: #22D3EE;
    --accent-texto: #22D3EE;
    --accent-contraste: #0B0F1A;
    --hover: rgba(148, 163, 184, 0.08);
    --foco: rgba(6, 182, 212, 0.2);
    --overlay-color: rgba(2, 6, 23, 0.72);
    --modal-shadow: 0 24px 48px -16px rgba(2, 6, 23, 0.7);
    --app-h: 56px;

    /* Nomes antigos: alias para o que ja existe. Codigo novo usa os de cima. */
    --bg-secondary: var(--surface-1);
    --bg-elevated: var(--surface-2);
    --bg-surface: var(--surface-2);
    --bg-glass: var(--surface-2);
    --border-color: var(--border);
    --border-subtle: var(--border);
    --border-glow: var(--border-strong);
    --accent-cyan: var(--c-info);
    --accent-violet: var(--c-violeta);
    --accent-emerald: var(--c-sucesso);
    --accent-amber: var(--c-atencao);
    --accent-rose: var(--c-erro);
    --danger: var(--c-erro);
    --modal-surface: var(--surface-2);
    --dropdown-surface: var(--surface-2);
    --dropdown-hover: var(--hover);
    --chrome-bg: var(--bg-primary);
    --chrome-overlay: none;
    --nav-active: rgba(6, 182, 212, 0.12);
    --shadow-soft: none;
    --card-radius: var(--r-card);
    --h1: 24px;
    --h2: 16px;
    --body: 14px;
    --small: 13px;
    --icon: 18px;
}

html[data-theme="light"] {
    color-scheme: light;
    --c-info-texto: #0E7490;
    --c-sucesso-texto: #047857;
    --c-atencao-texto: #B45309;
    --c-erro-texto: #BE123C;
    --bg-primary: #F3F5F9;
    --surface-1: #F8FAFC;
    --surface-2: #FFFFFF;
    --border: #E2E8F0;
    --border-strong: #CBD5E1;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #5E6B80;
    --accent-hover: #0891B2;
    --accent-texto: #0E7490;
    --hover: rgba(15, 23, 42, 0.05);
    --overlay-color: rgba(15, 23, 42, 0.45);
    --modal-shadow: 0 24px 48px -20px rgba(15, 23, 42, 0.35);
    --nav-active: rgba(6, 182, 212, 0.10);
}

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

[x-cloak] {
    display: none !important;
}

/* hidden vale sempre: classe com display propria nao pode reexibir */
[hidden] {
    display: none !important;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: var(--fs-14);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* O navegador nao herda a fonte nos controles (saiam em Arial) */
button, input, select, textarea {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
}

:where(a, button, [role="button"], summary):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Icone Lucide: o <i data-lucide> vira <svg class="lucide ...">, entao
   o CSS mira o svg. Tamanho padrao 16px; contexto ajusta (20px em aviso
   e cabecalho de card, 24px em estado vazio). Sem especificidade: a
   classe da tela ganha sempre. */
:where(svg.lucide) {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke-width: 1.75;
}

:where(input[type="checkbox"], input[type="radio"]) {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ---------- Card ---------- */
.card,
.glass-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: var(--s-5);
}

a.card,
button.card,
.card--clicavel {
    display: block;
    color: inherit;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

a.card:hover,
button.card:hover,
.card--clicavel:hover {
    border-color: var(--border-strong);
}

.equal-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    margin-bottom: var(--s-4);
}

.card__titulo {
    margin: 0;
    font-size: var(--fs-16);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.card__header svg.lucide {
    width: 20px;
    height: 20px;
}

.card__divisor {
    height: 1px;
    border: 0;
    background: var(--border);
    margin: var(--s-4) 0;
}

/* Rotulo de secao: 13px em frase, sem caixa alta */
.rotulo-secao {
    display: block;
    margin: 0 0 var(--s-3);
    font-size: var(--fs-13);
    font-weight: 600;
    color: var(--text-secondary);
}

/* Lista em linhas com divisor (dentro de card, sem caixa por item) */
.linhas {
    display: flex;
    flex-direction: column;
}

.linha {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-4);
    min-height: 52px;
    padding: var(--s-3) 0;
}

.linhas > .linha + .linha {
    border-top: 1px solid var(--border);
}

/* No card, a primeira e a ultima linha encostam no padding dele */
.card > .linhas > .linha:first-child,
.glass-card > .linhas > .linha:first-child { padding-top: 0; }
.card > .linhas > .linha:last-child,
.glass-card > .linhas > .linha:last-child { padding-bottom: 0; }

.linha__texto {
    min-width: 0;
    flex: 1 1 auto;
}

.linha__titulo {
    display: block;
    font-size: var(--fs-14);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}

.linha__meta {
    display: block;
    margin-top: 2px;
    font-size: var(--fs-13);
    color: var(--text-secondary);
    line-height: 1.4;
}

.linha__fim {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    flex-shrink: 0;
}

/* ---------- Botao ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    height: var(--h-control);
    padding: 0 var(--s-4);
    border: 1px solid transparent;
    border-radius: var(--r-control);
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--fs-14);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-contraste);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--accent-contraste);
}

.btn-secondary {
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--hover);
}

.btn-ghost {
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--hover);
    color: var(--text-primary);
}

.btn-danger {
    border-color: rgba(244, 63, 94, 0.4);
    color: var(--c-erro-texto);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(244, 63, 94, 0.08);
}

/* Rosa cheio: so no botao de confirmar de um modal de exclusao */
/* Branco sobre o --c-erro (#F43F5E) dava 3,7:1; um tom acima passa de 4,5 */
.btn-danger-solid {
    background: #E11D48;
    border-color: #E11D48;
    color: #FFFFFF;
}

.btn-danger-solid:hover:not(:disabled) {
    background: #BE123C;
    border-color: #BE123C;
}

.btn-sm {
    height: var(--h-control-sm);
    padding: 0 var(--s-3);
    font-size: var(--fs-13);
}

.btn-lg {
    height: 48px;
    padding: 0 20px;
    font-size: var(--fs-16);
}

/* So icone: quadrado, nunca circulo */
.btn-icon {
    width: var(--h-control);
    padding: 0;
}

.btn-icon.btn-sm {
    width: var(--h-control-sm);
}

.btn-bloco {
    display: flex;
    width: 100%;
}

/* So em bloco: td.acoes (coluna de acoes da tabela) virava flex e quebrava a linha. */
.acoes:not(td):not(th) {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--s-2);
    flex-wrap: wrap;
}

/* ---------- Campo ---------- */
.form-group {
    margin-bottom: var(--s-4);
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--fs-13);
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    height: var(--h-control);
    padding: 0 var(--s-3);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-control);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--fs-14);
    line-height: 1.4;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--foco);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

select.form-input,
.form-select {
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
}

textarea.form-input,
.form-textarea {
    height: auto;
    min-height: 96px;
    padding: 10px var(--s-3);
    resize: vertical;
}

.form-input.is-invalid,
.form-input[aria-invalid="true"],
.form-select[aria-invalid="true"],
.form-textarea[aria-invalid="true"] {
    border-color: var(--c-erro);
}

.form-field-error,
.form-erro {
    margin-top: var(--s-1);
    font-size: var(--fs-12);
    font-weight: 500;
    color: var(--c-erro-texto);
}

.form-ajuda {
    margin-top: var(--s-1);
    font-size: var(--fs-12);
    color: var(--text-muted);
}

/* "É reembolso de um gasto" dos formulários de lançamento (extrato/_reembolso_campo.html) */
.reembolso-campo {
    margin-top: var(--s-2);
    padding: var(--s-2) var(--s-3);
    border: 1px solid var(--border-color);
    border-radius: var(--r-control);
    background: var(--surface-2);
}
.reembolso-campo__check {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    font-size: var(--fs-14);
    color: var(--text-primary);
    cursor: pointer;
}
.reembolso-campo .form-ajuda { margin-top: var(--s-1); }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-4);
}

.form-grid > .form-group {
    margin-bottom: 0;
}

/* Numero com - e + (conexoes extras): 40px, mesmo raio do campo */
.stepper {
    display: inline-flex;
    align-items: stretch;
    height: var(--h-control);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-control);
    background: var(--surface-2);
    overflow: hidden;
    flex-shrink: 0;
}

.stepper button {
    width: var(--h-control);
    border: 0;
    background: transparent;
    color: var(--text-primary);
    font-size: var(--fs-16);
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.stepper button:hover {
    background: var(--hover);
}

.stepper input {
    width: 44px;
    border: 0;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    text-align: center;
    font-size: var(--fs-14);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
}

.stepper input:focus {
    outline: none;
    background: var(--hover);
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ---------- Valor em dinheiro ---------- */
.valor {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.valor small {
    margin-left: 1px;
    font-size: 0.8em;
    font-weight: 500;
    color: var(--text-secondary);
}

.valor--negativo {
    color: var(--c-erro-texto);
}

.valor--positivo {
    color: var(--c-sucesso-texto);
}

/* ---------- Cabecalho de pagina ---------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--s-3) var(--s-4);
    margin-bottom: var(--s-6);
}

.page-header__texto {
    min-width: 0;
    flex: 1 1 320px;
}

.page-header__voltar {
    display: inline-flex;
    align-items: center;
    gap: var(--s-1);
    height: 32px;
    margin: 0 0 var(--s-2) -8px;
    padding: 0 10px 0 4px;
    border-radius: var(--r-control);
    font-size: var(--fs-13);
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    background: none;
    border: 0;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.page-header__voltar:hover {
    background: var(--hover);
    color: var(--text-primary);
}

.page-header__voltar svg.lucide {
    width: 20px;
    height: 20px;
}

.page-title,
.page-header__titulo {
    margin: 0 0 var(--s-1);
    font-size: var(--fs-24);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.page-subtitle,
.page-header__sub {
    margin: 0 0 var(--s-6);
    font-size: var(--fs-14);
    line-height: 1.45;
    color: var(--text-secondary);
}

.page-header .page-title,
.page-header__titulo {
    margin: 0;
}

.page-header .page-subtitle,
.page-header__sub {
    margin: var(--s-1) 0 0;
}

.page-header__acoes {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    flex-shrink: 0;
}

/* ---------- KPI ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--s-4);
    margin-bottom: var(--s-6);
    align-items: stretch;
}

.kpi-card {
    position: relative;
    min-width: 0;
}

.kpi-card--heroi {
    grid-column: span 2;
}

/* Rotulo no padrao dos posts: mono, caixa alta, discreto. */
.kpi-label {
    margin-bottom: var(--s-2);
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1.3;
    color: var(--text-muted);
}

.kpi-value {
    font-size: var(--fs-24);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.kpi-card--heroi .kpi-value {
    font-size: var(--fs-32);
    font-weight: 700;
}

.kpi-legenda {
    margin-top: var(--s-1);
    font-size: var(--fs-12);
    color: var(--text-muted);
}

.kpi-value--negativo,
.kpi-value--negative,
.kpi-value-rose { color: var(--c-erro-texto); }
.kpi-value--positivo,
.kpi-value-emerald { color: var(--c-sucesso-texto); }
.kpi-value-cyan { color: var(--accent-texto); }
.kpi-value-amber { color: var(--c-atencao-texto); }

.kpi-change {
    display: flex;
    align-items: center;
    gap: var(--s-1);
    font-size: var(--fs-12);
}

.kpi-change.positive { color: var(--c-sucesso-texto); }
.kpi-change.negative { color: var(--c-erro-texto); }

.kpi-icon {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

/* ---------- Seletor segmentado (2 a 4 opcoes, lados iguais) ---------- */
.segmented {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 2px;
    height: 36px;
    padding: 3px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-control);
    vertical-align: middle;
}

.segmented--bloco {
    display: grid;
    width: 100%;
}

.segmented > button,
.segmented > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    height: 100%;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--fs-13);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.segmented > button:hover,
.segmented > a:hover {
    color: var(--text-primary);
}

.segmented > [aria-pressed="true"],
.segmented > [aria-selected="true"],
.segmented > .active {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.segmented .badge {
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
}

/* ---------- Abas (5 ou mais opcoes) ---------- */
.tabs {
    display: flex;
    gap: var(--s-1);
    margin-bottom: var(--s-5);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    flex-shrink: 0;
    height: 40px;
    margin-bottom: -1px;
    padding: 0 var(--s-3);
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: var(--fs-14);
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active,
.tab[aria-selected="true"] {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

/* ---------- Badge ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--s-1);
    height: 22px;
    padding: 0 var(--s-2);
    border-radius: var(--r-badge);
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    font-size: var(--fs-12);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
}

.badge svg.lucide {
    width: 12px;
    height: 12px;
}

.badge--info,
.badge-cyan {
    background: rgba(6, 182, 212, 0.12);
    color: var(--c-info-texto);
}

.badge--sucesso,
.badge-emerald {
    background: rgba(16, 185, 129, 0.12);
    color: var(--c-sucesso-texto);
}

.badge--atencao,
.badge-amber {
    background: rgba(245, 158, 11, 0.12);
    color: var(--c-atencao-texto);
}

.badge--erro,
.badge-rose {
    background: rgba(244, 63, 94, 0.12);
    color: var(--c-erro-texto);
}

.badge--violeta,
.badge-violet {
    background: rgba(139, 92, 246, 0.12);
    color: var(--c-violeta);
}

.badge-parcela {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    border-radius: var(--r-badge);
    font-size: 11px;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.12);
    color: var(--c-violeta);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---------- Aviso de conta (CEP, cadastro, teste, cobranca...) ---------- */
.avisos {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    margin-bottom: var(--s-5);
}

.avisos:not(:has(> .aviso:not([hidden]))) {
    display: none;
}

.aviso {
    --tom: var(--c-info);
    --tom-texto: var(--c-info-texto);
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto 32px;
    align-items: center;
    column-gap: var(--s-3);
    min-height: 56px;
    padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
    border-radius: var(--r-control);
    border: 1px solid color-mix(in srgb, var(--tom) 30%, transparent);
    background: color-mix(in srgb, var(--tom) 8%, transparent);
    color: var(--text-primary);
}

.aviso--sucesso { --tom: var(--c-sucesso); --tom-texto: var(--c-sucesso-texto); }
.aviso--atencao { --tom: var(--c-atencao); --tom-texto: var(--c-atencao-texto); }
.aviso--erro { --tom: var(--c-erro); --tom-texto: var(--c-erro-texto); }
.aviso--neutro { --tom: var(--c-neutro); --tom-texto: var(--text-secondary); }

.aviso__icone {
    grid-column: 1;
    width: 20px;
    height: 20px;
    color: var(--tom-texto);
}

.aviso__texto {
    grid-column: 2;
    min-width: 0;
    line-height: 1.4;
}

.aviso__titulo {
    display: block;
    font-size: var(--fs-14);
    font-weight: 600;
    color: var(--text-primary);
}

.aviso__frase {
    display: block;
    margin-top: 2px;
    font-size: var(--fs-13);
    color: var(--text-secondary);
}

.aviso__acao {
    grid-column: 3;
    justify-self: end;
}

.aviso__fechar {
    grid-column: 4;
}

/* Sem o X a coluna dele sai: a acao encosta na borda, com a mesma folga da esquerda. */
.aviso:not(:has(.aviso__fechar)) {
    grid-template-columns: 20px minmax(0, 1fr) auto;
    padding-right: var(--s-4);
}

@media (max-width: 559px) {
    .aviso {
        grid-template-columns: 20px minmax(0, 1fr) 32px;
        grid-template-areas:
            "icone texto fechar"
            ".     acao  acao";
        align-items: start;
        row-gap: var(--s-3);
    }
    .aviso__icone { grid-area: icone; margin-top: 6px; }
    .aviso__texto { grid-area: texto; align-self: center; }
    .aviso__acao { grid-area: acao; justify-self: start; }
    .aviso__fechar { grid-area: fechar; }
    .aviso:not(:has(.aviso__fechar)) {
        grid-template-columns: 20px minmax(0, 1fr);
        grid-template-areas:
            "icone texto"
            ".     acao";
    }
}

/* ---------- Modal ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: var(--s-5);
    background: var(--overlay-color);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: var(--s-5);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--modal-shadow);
    animation: modalSlideIn 0.18s ease-out;
}

.modal-content--confirmacao {
    max-width: 400px;
}

.modal__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px;
    align-items: start;
    gap: var(--s-3);
}

.modal__titulo {
    margin: 0;
    padding-top: 2px;
    font-size: var(--fs-20);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.modal__sub {
    margin: var(--s-1) 0 0;
    font-size: var(--fs-14);
    line-height: 1.5;
    color: var(--text-secondary);
}

.modal__fechar {
    margin: -2px -6px 0 0;
}

.modal__corpo {
    margin-top: var(--s-5);
    font-size: var(--fs-14);
}

.modal__acoes {
    display: flex;
    justify-content: flex-end;
    gap: var(--s-2);
    margin-top: var(--s-5);
}

/* "Instalar o app" some quando o Octoplanner ja esta instalado (PWA aberto pelo icone). */
@media (display-mode: standalone) { [data-so-no-navegador] { display: none !important; } }

/* Rascunho recuperado num modal (base.js): uma linha discreta no topo do formulario. */
.rascunho-aviso { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s-2); margin: 0 0 var(--s-3); font-size: var(--fs-12); color: var(--text-muted); }
.rascunho-aviso button { padding: 0; border: 0; background: none; color: var(--accent-texto); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Celular: centralizado como no desktop (pedido do dono), com 16px de
   margem; acoes empilhadas em largura total, primary em cima. */
@media (max-width: 640px) {
    .modal-overlay {
        align-items: center;
        padding: var(--s-4);
    }
    .modal-content {
        max-width: none;
        max-height: calc(100dvh - 32px);
        padding: 20px var(--s-4);
    }
    .modal__acoes {
        flex-direction: column-reverse;
    }
    .modal__acoes > .btn {
        width: 100%;
    }
}


/* ---------- Tabela ---------- */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th,
td {
    height: 52px;
    padding: var(--s-3) var(--s-4);
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

th {
    height: 40px;
    color: var(--text-muted);
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

tbody tr:hover {
    background: var(--hover);
}

td.num,
th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---------- Toast ----------
   Em cima, como as notificacoes dos outros sites: no desktop no canto
   superior direito, abaixo da barra; no celular centralizado no topo. */
.toast-container {
    position: fixed;
    right: var(--s-5);
    top: calc(var(--app-h, 56px) + var(--s-3));
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    --tom: var(--c-info);
    --tom-texto: var(--c-info-texto);
    display: flex;
    align-items: center;
    gap: var(--s-3);
    min-height: 48px;
    padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-control);
    box-shadow: 0 12px 32px -8px rgba(2, 6, 23, 0.45);
    color: var(--text-primary);
    font-size: var(--fs-14);
    line-height: 1.4;
    pointer-events: auto;
    animation: toastIn 0.2s ease-out;
}

.toast.success { --tom: var(--c-sucesso); --tom-texto: var(--c-sucesso-texto); }
.toast.error { --tom: var(--c-erro); --tom-texto: var(--c-erro-texto); }
.toast.warning { --tom: var(--c-atencao); --tom-texto: var(--c-atencao-texto); }

.toast-icon,
.toast__icone {
    width: 20px;
    height: 20px;
    color: var(--tom-texto);
}

.toast-content,
.toast-message {
    flex: 1;
    min-width: 0;
}

.toast-close,
.toast__fechar {
    margin-left: auto;
}

.toast.hiding {
    animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn {
    from { transform: translateY(-8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes toastOut {
    to { transform: translateY(-8px); opacity: 0; }
}

/* ---------- Estado vazio ---------- */
/* ── Lista limpa, no padrao dos posts (compartilhada por todas as telas):
   rotulo mono em caixa alta (.ol-mono), resumo em celulas iguais (.ol-resumo),
   linha em grade icone | texto | valor | acoes (.ol-linha), progresso, grade
   mes a mes, bloco dobravel. No celular: nome e valor na primeira linha, meta
   embaixo, acoes na ultima. Nasceu em Recorrencias (11/10/2026). */
.ol-mono { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }

/* Resumo: tres celulas iguais */
.ol-resumo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.ol-kpi { display: flex; flex-direction: column; gap: 6px; padding: var(--s-4) var(--s-5); min-width: 0; }
.ol-kpi__valor { font-size: clamp(var(--fs-20), 2.1vw, var(--fs-32)); font-weight: 700; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ol-kpi__sub { font-size: var(--fs-13); color: var(--text-secondary); }
.ol-kpi--anel { flex-direction: row; align-items: center; gap: var(--s-4); }
.ol-kpi--anel > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ol-anel { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.ol-anel svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ol-anel__trilho { fill: none; stroke: var(--border); stroke-width: 7; }
.ol-anel__arco { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; }
.ol-anel__n { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: var(--fs-13); font-variant-numeric: tabular-nums; }

/* Linhas em grade: icone | texto | valor | acoes */
.ol-lista { display: flex; flex-direction: column; }
.ol-linha { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: var(--s-2) var(--s-4); align-items: center; padding: var(--s-3) 0; border-top: 1px solid var(--border-subtle, var(--border)); }
.ol-linha:first-child { border-top: 0; }
.ol-icone, .ol-estado { width: 40px; height: 40px; border-radius: var(--r-control); background: var(--surface-1); color: var(--text-secondary); display: grid; place-items: center; }
.ol-icone svg.lucide, .ol-estado svg.lucide { width: 18px; height: 18px; }
.ol-estado { border-radius: 50%; width: 34px; height: 34px; margin: 0 auto; }
.ol-estado--ok { background: color-mix(in srgb, var(--c-sucesso) 18%, transparent); color: var(--c-sucesso-texto, var(--c-sucesso)); }
.ol-estado--aviso { background: color-mix(in srgb, var(--c-atencao) 20%, transparent); color: var(--c-atencao-texto, var(--c-atencao)); }
.ol-estado--erro { background: color-mix(in srgb, var(--c-erro) 18%, transparent); color: var(--c-erro-texto, var(--c-erro)); }
.ol-texto { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ol-nome { display: flex; align-items: center; gap: var(--s-2); min-width: 0; font-weight: 600; color: var(--text-primary); }
.ol-nome__t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ol-nome .badge { flex-shrink: 0; }
.ol-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s-2); font-size: var(--fs-13); color: var(--text-secondary); }
.ol-meta .badge { font-size: 11px; }
.ol-meta__extra { display: none; color: var(--text-muted); }
.ol-valor { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ol-valor b { display: block; font-size: var(--fs-16); color: var(--text-primary); }
.ol-valor b small { font-size: var(--fs-12); font-weight: 400; color: var(--text-secondary); }
.ol-valor span { display: block; font-size: var(--fs-12); color: var(--text-muted); }
.ol-acoes { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.ol-acoes form { display: inline-flex; }
.ol-dica { grid-column: 2 / -1; font-size: var(--fs-13); color: var(--text-secondary); }
.ol-dica summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; color: var(--text-muted); font-size: var(--fs-12); }
.ol-dica summary::-webkit-details-marker { display: none; }
.ol-dica summary svg.lucide { width: 13px; height: 13px; }
.ol-dica p { margin: var(--s-2) 0 0; line-height: 1.55; max-width: 70ch; }

/* Progresso do mes */
.ol-prog { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-3) 0 var(--s-2); font-size: var(--fs-13); color: var(--text-secondary); }
.ol-prog b { color: var(--text-primary); white-space: nowrap; }
.ol-prog__barra { flex: 1; height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.ol-prog__barra i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-cyan, var(--accent))); }

/* Grade mes a mes, como no post */
.ol-grade { display: grid; grid-template-columns: minmax(0, 2.4fr) repeat(6, minmax(28px, 1fr)); gap: 10px 4px; align-items: center; margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--border-subtle, var(--border)); }
.ol-grade__h { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); text-align: center; }
.ol-grade__n { min-width: 0; font-size: var(--fs-13); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ol-grade__n small { display: block; font-weight: 400; color: var(--text-muted); font-size: 11px; font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); }
.ol-grade:not(.is-aberta) .ol-grade--extra { display: none; }
.ol-grade__mais { grid-column: 1 / -1; justify-self: center; }
.ol-grade__q { width: 14px; height: 14px; border-radius: 4px; margin: 0 auto; }
.ol-grade__q--pago { background: var(--accent); box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 45%, transparent); }
.ol-grade__q--pendente { border: 1.5px dashed var(--c-atencao); }
.ol-grade__q--vazio { background: var(--border); opacity: .5; }
.ol-grade__legenda { grid-column: 1 / -1; display: flex; gap: var(--s-4); font-size: 11px; color: var(--text-muted); }
.ol-grade__legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }

/* Bloco dobravel (pagas, nao sao recorrencias) */
.ol-dobra > summary { display: flex; align-items: center; gap: var(--s-2); cursor: pointer; list-style: none; font-size: var(--fs-14); font-weight: 600; color: var(--text-secondary); }
.ol-dobra > summary::-webkit-details-marker { display: none; }
.ol-dobra > summary svg.lucide { width: 16px; height: 16px; transition: transform .15s ease; }
.ol-dobra[open] > summary svg.lucide { transform: rotate(90deg); }
.ol-dobra .ol-lista { margin-top: var(--s-3); }

/* Convite ao aviso no celular e ajuda */
.ol-push { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--r-control); background: var(--surface-1); font-size: var(--fs-13); color: var(--text-secondary); }
.ol-push svg.lucide { width: 16px; height: 16px; flex-shrink: 0; }
.ol-push span { flex: 1; min-width: 0; }
.ol-ajuda { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.ol-ajuda p { margin: 2px 0 0; font-size: var(--fs-13); color: var(--text-secondary); }
.ol-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.ol-cab__acoes { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.ol-cab__total { font-weight: 700; font-size: var(--fs-16); font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (min-width: 900px) { .ol-meta__extra { display: inline; } }
@media (max-width: 900px) { .ol-resumo { grid-template-columns: 1fr 1fr; } .ol-kpi--anel { grid-column: 1 / -1; } }
@media (max-width: 600px) {
    .ol-resumo { grid-template-columns: 1fr; }
    .ol-kpi__valor { font-size: var(--fs-24); }
    /* Celular: nome e valor na primeira linha, meta embaixo, acoes na ultima. */
    .ol-linha { grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-2) var(--s-3); }
    .ol-icone, .ol-estado { display: none; }
    .ol-texto { grid-column: 1; }
    .ol-valor { grid-column: 2; align-self: start; }
    .ol-valor span { display: none; }
    .ol-valor b { font-size: var(--fs-14); }
    .ol-acoes, .ol-dica { grid-column: 1 / -1; }
    .ol-grade { grid-template-columns: minmax(0, 1.5fr) repeat(6, minmax(0, 1fr)); gap: 8px 2px; }
    .ol-grade__n small { display: none; }
    .ol-grade__q { width: 12px; height: 12px; }
    .ol-cab__acoes { width: 100%; justify-content: space-between; }
}


.estado-vazio {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-7) var(--s-5);
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--fs-14);
}

.estado-vazio svg.lucide {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
}

.estado-vazio__frase {
    max-width: 40ch;
    line-height: 1.5;
}

/* ---------- Celular ---------- */
@media (max-width: 768px) {
    .card,
    .glass-card {
        padding: var(--s-4);
    }
    .btn {
        height: 44px;
    }
    .btn-icon {
        width: 44px;
    }
    .btn-sm {
        position: relative;
        height: var(--h-control-sm);
    }
    .btn-icon.btn-sm {
        width: var(--h-control-sm);
    }
    /* alvo de toque de 44px sem crescer na tela */
    .btn-sm::after {
        content: "";
        position: absolute;
        inset: -6px;
    }
    .form-input,
    .form-select {
        height: 44px;
        font-size: var(--fs-16);
    }
    .form-textarea,
    textarea.form-input {
        height: auto;
        font-size: var(--fs-16);
    }
    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .stepper {
        height: 44px;
    }
    .stepper button {
        width: 44px;
    }
    .page-header {
        margin-bottom: var(--s-5);
    }
    .page-subtitle {
        margin-bottom: var(--s-5);
    }
    .segmented {
        height: 40px;
    }
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--s-3);
        margin-bottom: var(--s-5);
    }
    .kpi-card--heroi {
        grid-column: 1 / -1;
    }
    .kpi-value {
        font-size: var(--fs-20);
    }
    .kpi-card--heroi .kpi-value {
        font-size: 28px;
    }
}

/* Celular e tablet: o titulo da pagina vai para a barra de cima */
@media (max-width: 980px) {
    .page-title,
    .page-header__titulo {
        display: none !important;
    }
    .page-header__acoes {
        width: 100%;
    }
    .toast-container {
        left: var(--s-4);
        right: var(--s-4);
        top: calc(56px + var(--s-2) + env(safe-area-inset-top, 0px));
        width: auto;
    }
}

.main-content {
    max-width: none;
    margin: 0;
    width: 100%;
    min-width: 0;   /* item de grid/flex: sem isto nao encolhe abaixo do conteudo */
    overflow: visible;
    flex: 1;
}


.resumo-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.resumo-cabecalho {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.barra-progresso {
    width: 100%;
    height: 10px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 999px;
    overflow: hidden;
}

.barra-progresso span {
    display: block;
    height: 100%;
    border-radius: 999px;
}

.resumo-botoes {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.resumo-chip {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-elevated);
}

/* Perfil: menu em linhas, uma secao por vez */
.perfil-menu {
    display: flex;
    flex-direction: column;
    margin-top: var(--s-5);
}

.perfil-foto {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 16px 0 20px;
}

.perfil-foto-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    flex-shrink: 0;
}

.perfil-foto-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.perfil-foto-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.perfil-foto-input {
    display: none;
}

.perfil-foto-remove {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.perfil-item {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    padding: 0 var(--s-3);
    border: 0;
    border-radius: var(--r-control);
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.perfil-item span { font-size: var(--fs-14); font-weight: 500; }
.perfil-item svg.lucide { width: 18px; height: 18px; color: var(--text-secondary); }
.perfil-item .lucide-chevron-right { width: 16px; height: 16px; color: var(--text-muted); }
.perfil-item:hover { background: var(--hover); }
a.perfil-item { text-decoration: none; }

/* Grupos separados por divisor; grupo sem item nao desenha nada */
.perfil-menu-group {
    display: flex; flex-direction: column; gap: 2px;
}
.perfil-menu-group:not(:has(.perfil-item)) { display: none; }
.perfil-menu-group + .perfil-menu-group {
    margin-top: var(--s-2);
    padding-top: var(--s-2);
    border-top: 1px solid var(--border);
}
.perfil-menu-group-danger .perfil-item,
.perfil-menu-group-danger .perfil-item svg.lucide { color: var(--c-erro-texto); }

.perfil-section {
    display: none;
}

    .perfil-section.active {
display: block;
    }

.perfil-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

    .perfil-back {
background: transparent;
border: 1px solid var(--border-color);
color: var(--text-primary);
border-radius: 12px;
padding: 6px 10px;
cursor: pointer;
    }

    .perfil-top-actions {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
    }

    .perfil-header-card {
display: flex;
align-items: center;
gap: var(--s-4);
    }

    .perfil-foto-wrapper {
display: inline-flex;
    }

    .perfil-foto-button {
border: none;
background: transparent;
padding: 0;
cursor: pointer;
border-radius: 999px;
    }

    .perfil-foto-preview {
width: 56px;
height: 56px;
border-radius: 50%;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
background: var(--surface-1);
border: 1px solid var(--border-strong);
font-weight: 600;
color: var(--text-primary);
font-size: var(--fs-20);
    }

    .perfil-foto-preview img {
width: 100%;
height: 100%;
object-fit: cover;
    }

    .perfil-foto-actions {
display: none;
    }

    .foto-panel {
position: absolute;
top: 50%;
left: calc(100% + 10px);
transform: translateY(-50%);
min-width: 180px;
background: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: 14px;
box-shadow: 0 14px 30px rgba(2, 6, 23, 0.18);
z-index: 60;
display: none;
padding: 8px;
    }

    .foto-panel.is-open {
display: block;
    }

    @media (max-width: 640px) {
.foto-panel {
    top: calc(100% + 8px);
    left: 0;
    transform: none;
}
    }

    .foto-panel-actions {
display: grid;
gap: 6px;
    }

    .foto-panel-actions .btn {
width: 100%;
justify-content: flex-start;
border-radius: 10px;
padding: 10px 12px;
font-weight: 600;
    }

    .foto-panel-actions .btn.btn-secondary {
background: transparent;
border: 1px solid transparent;
    }

    .foto-panel-actions .btn.btn-secondary:hover {
background: var(--bg-elevated);
border-color: var(--border-color);
    }

    .foto-panel-actions .btn.btn-primary {
background: var(--bg-elevated);
color: var(--text-primary);
border: 1px solid var(--border-color);
    }

    .foto-panel-actions .btn.btn-danger {
color: var(--accent-rose);
background: transparent;
border: 1px solid transparent;
    }

    .foto-panel-actions .btn.btn-danger:hover {
background: rgba(244, 63, 94, 0.08);
border-color: rgba(244, 63, 94, 0.2);
    }

    .foto-editor {
display: none;
flex-direction: column;
gap: 12px;
background: transparent;
border: none;
border-radius: 0;
padding: 0;
overflow: visible;
align-items: center;
width: min(420px, 92vw);
box-shadow: none;
    }

    .foto-editor.is-open {
display: flex;
    }

    .foto-editor-card {
width: 100%;
background: var(--bg-elevated);
border: 1px solid var(--border-color);
border-radius: 16px;
padding: 16px 18px;
box-shadow: 0 20px 60px rgba(2, 6, 23, 0.2);
display: flex;
flex-direction: column;
gap: 12px;
align-items: center;
    }

    .foto-editor-overlay {
position: fixed;
inset: 0;
background: rgba(2, 6, 23, 0.55);
display: none;
align-items: center;
justify-content: center;
z-index: 1600;
padding: 20px;
    }

    .foto-editor-overlay.is-open {
display: flex;
    }

    .foto-crop-area {
width: 300px;
height: 300px;
border-radius: 18px;
overflow: hidden;
position: relative;
margin: 0 auto 6px;
border: 1px solid var(--border-color);
background: #1f2933;
touch-action: none;
    }

    .foto-crop-area::before {
content: "";
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.55);
-webkit-mask: radial-gradient(circle at center, transparent 120px, #000 121px);
mask: radial-gradient(circle at center, transparent 120px, #000 121px);
pointer-events: none;
z-index: 2;
    }

    .foto-crop-area::after {
content: "";
position: absolute;
inset: 0;
border-radius: 50%;
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
pointer-events: none;
z-index: 3;
    }

    .foto-crop-area img {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
user-select: none;
cursor: grab;
will-change: transform;
z-index: 1;
max-width: none;
max-height: none;
    }

    .foto-crop-area img.is-dragging {
cursor: grabbing;
    }

    .foto-zoom {
width: 100%;
    }

    .foto-editor-actions {
display: flex;
gap: 10px;
justify-content: flex-end;
    }

    .foto-panel-overlay {
display: none;
    }

.pais-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.7);
    z-index: 140;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pais-modal.active {
    display: flex;
}

.pais-modal-content {
    width: 100%;
    max-width: 520px;
    background: var(--bg-secondary);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 20px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pais-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pais-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 10px 12px;
}

.pais-search input {
    border: none;
    background: transparent;
    color: var(--text-primary);
    width: 100%;
    outline: none;
}

.pais-lista {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.pais-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-elevated);
    cursor: pointer;
}

.pais-item span {
    color: var(--text-primary);
}

.pais-item strong {
    color: var(--text-secondary);
}

.mobile-page-title {
    display: none;
}

.mobile-cards {
    display: none;
}

.mobile-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
}

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

.mobile-card-title {
    font-weight: 600;
    font-size: 16px;
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
}

.mobile-card-label {
    color: var(--text-muted);
}

.mobile-card-value {
    font-weight: 500;
}

.desktop-table {
    display: block;
}

.chart-container {
    position: relative;
    height: 240px;
    width: 100%;
}

.compass-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.compass-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.compass-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.compass-value {
    font-weight: 700;
    font-size: 18px;
}

.compass-pill {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid transparent;
}

@media (max-width: 768px) {
    .compass-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Seletor Família no header ─────────────────────────────────── */
.familia-selector { position: relative; }
.familia-selector-btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 36px; padding: 0 10px 0 12px;
    background: transparent; border: 1px solid var(--border);
    border-radius: var(--r-control);
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    white-space: nowrap; cursor: pointer;
    transition: background-color 0.15s ease;
}
.familia-selector-btn:hover { background: var(--hover); }
.familia-selector-btn .lucide-users { color: var(--text-secondary); }
.familia-selector-btn .familia-chev { color: var(--text-muted); transition: transform 0.15s; }
.familia-selector.is-open .familia-chev { transform: rotate(180deg); }
.familia-readonly-chip {
    display: inline-flex; align-items: center; padding: 2px 4px;
    background: rgba(148, 163, 184, 0.12); color: var(--text-secondary); border-radius: var(--r-badge);
}
.familia-readonly-chip svg.lucide { width: 12px; height: 12px; }
.familia-selector-menu {
    position: absolute; top: calc(100% + 8px); right: 0;
    min-width: 280px; max-width: 320px;
    background: var(--modal-surface); border: 1px solid var(--border-subtle);
    border-radius: 12px; box-shadow: var(--modal-shadow);
    padding: 8px; z-index: 100;
    display: none;
}
.familia-selector.is-open .familia-selector-menu { display: block; }
.familia-selector-sec {
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    padding: 8px 10px 4px;
}
.familia-selector-sec-bottom {
    border-top: 1px solid var(--border-subtle);
    margin-top: 6px; padding-top: 6px;
}
.familia-selector-sec-bottom a {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; color: var(--text-secondary);
    font-size: 12px; font-weight: 500; text-decoration: none;
    border-radius: 8px;
}
.familia-selector-sec-bottom a:hover { background: var(--bg-elevated); color: var(--text-primary); }

.familia-selector-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 8px 10px;
    background: transparent; border: none; border-radius: 8px;
    text-align: left; cursor: pointer; transition: background 0.15s;
}
.familia-selector-item:hover { background: var(--bg-elevated); }
.familia-selector-item.is-active { background: rgba(6,182,212,0.10); }
.familia-selector-item .familia-selector-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent-cyan); flex-shrink: 0;
}
.familia-dot-self { background: var(--accent-emerald) !important; }
.familia-dot-ambos { background: var(--accent-violet) !important; }
.familia-selector-meta { flex: 1; min-width: 0; }
.familia-selector-meta strong { display: block; font-size: 13px; color: var(--text-primary); }
.familia-selector-meta small { display: block; font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.familia-selector-item .lucide-check { color: var(--accent-texto); }

@media (max-width: 768px) {
    /* Mobile: o seletor vira chip compacto, e o menu abre centralizado */
    .familia-selector-btn { height: 32px; padding: 0 8px 0 10px; font-size: 12px; }
    .familia-selector-btn .familia-selector-label { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .familia-selector.is-open .familia-selector-menu {
        position: fixed; top: 50%; bottom: auto; right: var(--s-4); left: var(--s-4);
        max-width: none; min-width: 0;
        transform: translateY(-50%);
        border-radius: var(--r-card);
        padding: var(--s-3);
        box-shadow: var(--modal-shadow);
        z-index: 200;
        animation: none;
    }
    .familia-selector.is-open::before {
        content: ""; position: fixed; inset: 0;
        background: rgba(0,0,0,0.4); z-index: 199;
    }
    .familia-selector-item { padding: 12px 10px; }
}

.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(6, 182, 212, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
    z-index: 1000;
}

.chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 40px rgba(6, 182, 212, 0.5);
}

.chat-fab svg {
    color: white;
    width: 28px;
    height: 28px;
}

.chat-drawer {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    max-height: 70vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    display: none;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(2, 6, 23, 0.34);
}

.chat-drawer.open {
    display: flex;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
    max-height: 400px;
    background:
        radial-gradient(circle at 50% 0, rgba(6, 182, 212, 0.05), transparent 24%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.18), transparent 22%);
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
}

.chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
    color: white;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow:
        0 16px 36px rgba(79, 112, 255, 0.22),
        inset 0 1px 0 rgba(255,255,255,0.14);
}

.chat-message.assistant {
    align-self: flex-start;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
}

.chat-message.admin {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
    color: white;
}

.chat-message.client {
    align-self: flex-start;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.chat-message.assistant h1,
.chat-message.assistant h2,
.chat-message.assistant h3 {
    margin: 12px 0 8px 0;
    font-weight: 600;
}

.chat-message.assistant h1 {
    font-size: 18px;
}

.chat-message.assistant h2 {
    font-size: 16px;
}

.chat-message.assistant h3 {
    font-size: 15px;
}

.chat-message.assistant p {
    margin: 8px 0;
}

.chat-message.assistant ul,
.chat-message.assistant ol {
    margin: 8px 0;
    padding-left: 20px;
}

.chat-message.assistant li {
    margin: 4px 0;
}

.chat-message.assistant strong {
    color: var(--accent-cyan);
    font-weight: 600;
}

.chat-message.assistant em {
    color: var(--text-secondary);
}

.chat-message.assistant code {
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}

.chat-message.assistant pre {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.chat-message.assistant pre code {
    background: transparent;
    padding: 0;
}

.chat-message.assistant blockquote {
    border-left: 3px solid var(--accent-cyan);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-muted);
}

.chat-message.assistant table {
    min-width: auto;
    margin: 8px 0;
    font-size: 13px;
}

.chat-message.assistant th,
.chat-message.assistant td {
    padding: 8px 12px;
}

.chat-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-bottom: 6px;
    opacity: 0.85;
    color: rgba(255, 255, 255, 0.85);
}

.chat-input-container {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    flex-shrink: 0;
    background:
        linear-gradient(180deg, rgba(10, 15, 30, 0.32), rgba(10, 15, 30, 0)),
        var(--bg-secondary);
}

.chat-input-container.readonly {
    flex-direction: column;
    align-items: stretch;
}

.chat-lock-banner {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--accent-amber);
    background: rgba(217, 119, 6, 0.08);
    color: var(--accent-amber);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
}

.chat-lock-banner i {
    width: 18px;
    height: 18px;
    color: var(--accent-amber);
}

.chat-input {
    flex: 1;
    min-height: 54px;
    padding: 0 18px;
    background: linear-gradient(180deg, rgba(22, 31, 54, 0.92), rgba(18, 25, 43, 0.96));
    border: 1px solid rgba(84, 106, 196, 0.24);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 15px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 14px 28px rgba(2, 6, 23, 0.22);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input:focus {
    border-color: var(--accent-cyan);
    box-shadow:
        0 0 0 4px rgba(6, 182, 212, 0.12),
        inset 0 1px 0 rgba(255,255,255,0.05),
        0 14px 28px rgba(2, 6, 23, 0.26);
}

.chat-send-btn {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
    border: none;
    border-radius: 18px;
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 14px 30px rgba(79, 112, 255, 0.22),
        inset 0 1px 0 rgba(255,255,255,0.16);
    transition: transform 0.2s, opacity 0.2s;
}

.chat-send-btn:hover {
    transform: translateY(-1px);
}

.mode-toggle {
    display: flex;
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 4px;
}

.mode-toggle button {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s;
}

.mode-toggle button.active {
    background: var(--accent-cyan);
    color: white;
}

/* Rodapé FIXO no pé: altura constante (46px), nunca cresce. O wrapper do
   conteúdo vira coluna flex e o margin-top:auto empurra o rodapé pro fundo
   da tela mesmo em página curta. */
.octo-footer {
    /* 32px de respiro acima da linha: o ultimo card nao encosta no rodape.
       Fica no fim da pagina (margin-top: auto no flex do view), colado na
       borda de baixo: o espaco embaixo e dele, nao do conteudo. */
    position: relative;
    margin-top: auto;
    min-height: 78px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    flex-wrap: wrap; gap: 6px 16px;
    padding: 32px 16px 20px;
}
/* Cada link inteiro, mas a linha quebra quando falta largura: em 1024 o
   rodape numa linha so passava 53px da tela em todas as paginas. */
.octo-footer > * { white-space: nowrap; }
.octo-footer::before {
    content: "";
    position: absolute;
    top: 32px; left: 0; right: 0;
    height: 1px;
    background: var(--border);
}
.octo-footer a { font-size: 12px; color: var(--text-muted); text-decoration: none; }
.octo-footer a:hover { color: var(--accent-cyan); }
.octo-footer__legal { font-size: 11px; color: var(--text-muted); }
@media (max-width: 1023px) {
    /* Uma linha so de 46px: no tablet o CNPJ nao cabia e os links eram
       cortados nas duas pontas (o rodape e centralizado). A Central de
       Privacidade, que e a obrigatoria, continua visivel. */
    .octo-footer__legal { display: none; }
}

@media (max-width: 760px) {
    .octo-footer { gap: 12px; }
    /* Mobile: rodapé é UMA linha de 46px - esconde os docs (a Central de
       Privacidade, obrigatória no rodapé pela Política de Cookies, alcança
       todos eles) e encurta "Dúvidas frequentes" pra caber. */
    .octo-footer__doc { display: none; }
    .octo-footer__long { display: none; }
}
.main-content { display: flex; flex-direction: column; }
#view-admin, #view-consultor, #view-cliente, .public {
    flex: 1; display: flex; flex-direction: column; min-height: 0;
}
/* flex-shrink:0 protege a ALTURA dos cards; min-width:0 e obrigatorio junto:
   sem ele o item flex nunca encolhe abaixo do proprio min-content e qualquer
   conteudo largo (ex: barra de abas do perfil) empurra o card pra fora da
   tela no celular, sem como rolar ate ele. */
#view-admin > *:not(.octo-footer), #view-consultor > *:not(.octo-footer),
#view-cliente > *:not(.octo-footer), .public > *:not(.octo-footer) {
    flex-shrink: 0;
    min-width: 0;
    /* width:100% restaura o comportamento de BLOCO que existia antes deste
       wrapper virar flex: card com "margin: 0 auto" nao estica no eixo
       transversal do flex, entao adotava a largura do proprio conteudo e
       vazava da tela no celular. Nao conflita com o max-width inline das
       paginas (que continua limitando no desktop). */
    width: 100%;
}
.footer {
    background: var(--bg-glass);
    border-top: 1px solid var(--border-color);
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    /* 16px nos campos: menos que isso o iOS da zoom ao focar */
    input,
    select,
    textarea {
        font-size: 16px;
    }

    .chat-drawer {
        left: 16px;
        right: 16px;
        bottom: 90px;
        width: auto;
        max-width: none;
    }

    .desktop-table {
        display: none;
    }

    .mobile-cards {
        display: block;
    }

    .main-content {
        overflow-x: hidden;
    }

    .mobile-page-title {
        display: block;
        font-size: 28px;
        font-weight: 600;
        margin: 8px 0 18px;
    }

    .transacoes-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .transacoes-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .transacoes-nova-btn {
        margin-top: 6px;
    }

    .transacoes-search form {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .transacoes-search .form-input {
        flex: 1;
        width: auto;
    }

    .transacoes-search .btn {
        flex: 0 0 auto;
        width: auto;
    }

    #toggleFiltros {
        display: inline-flex;
    }

    #filtrosForm {
        display: none;
    }

    #filtrosForm.is-open {
        display: block;
    }

    #extratoFab {
        display: none;
    }
}

@media (min-width: 769px) {
    #toggleFiltros {
        display: none;
    }
}

@media (max-width: 480px) {
    .chat-fab {
        width: 50px;
        height: 50px;
        bottom: 16px;
        right: 16px;
    }

    .chat-fab svg {
        width: 22px;
        height: 22px;
    }
}

.switch {
    position: relative;
    width: 48px;
    height: 24px;
    flex-shrink: 0;
}

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

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    transition: all 0.3s;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s;
}

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

.switch input:checked + .switch-slider:before {
    transform: translateX(24px);
    background: white;
}

.search-container {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    min-width: 180px;
    display: none;
    z-index: 100;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-elevated);
}

.hide-mobile {
    display: inline;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none;
    }
}

/* =========================
   CASCA: barra de cima, sidebar, barra de abas
   Fundo da pagina, borda de 1px, sem gradiente. Controles de 36px, raio 10.
========================== */
    .app{
      width: 100%;
      min-height: 100vh;
      display:flex;
      flex-direction:column;
      background: var(--bg-primary);
    }

    .mobile-topbar{ display: none; }
    .topbar-avatar-menu{ display: none; }

    .topbar{
      height: var(--app-h);
      display:grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      align-items:center;
      gap: var(--s-4);
      padding: 0 var(--s-4) 0 var(--s-5);
      border-bottom: 1px solid var(--border);
      background: var(--bg-primary);
      position: sticky;
      top: 0;
      z-index: 30;
    }

    .brand{
      display:flex;
      align-items:center;
      gap: 10px;
      min-width:0;
    }

    .brand-link{
      display:flex;
      align-items:center;
      gap: 10px;
      color: inherit;
      text-decoration: none;
    }

    .menu-btn{
      display:none;
    }

    .brand .word{
      font-size: 15px;
      font-weight: 700;
      letter-spacing: -0.01em;
      white-space: nowrap;
      color: var(--text-primary);
    }

    .brand-logo{
      width: 28px;
      height: 28px;
      display: block;
      flex: 0 0 auto;
      border-radius: var(--r-badge);
      object-fit: cover;
    }

    .user-area{
      grid-column: 3;
      display:flex;
      justify-content:flex-end;
      align-items:center;
      gap: var(--s-2);
      min-width:0;
    }

    /* Botao so de icone da barra (tema): 36px, raio 10 */
    .theme-btn{
      display:inline-flex;
      align-items:center;
      justify-content:center;
      width: 36px;
      height: 36px;
      padding: 0;
      border-radius: var(--r-control);
      border: 1px solid var(--border);
      background: transparent;
      color: var(--text-secondary);
      cursor:pointer;
      transition: background-color 0.15s ease, color 0.15s ease;
    }
    .theme-btn:hover{ background: var(--hover); color: var(--text-primary); }
    .theme-btn svg{ width: 18px; height: 18px; }

    /* ── Central de Notificações ──────────────────────────────────────── */
    .notif-wrapper { position: relative; }

    .notif-bell {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 36px; height: 36px;
      border-radius: var(--r-control);
      border: 1px solid var(--border);
      background: transparent;
      color: var(--text-secondary);
      cursor: pointer;
      transition: background-color 0.15s ease, color 0.15s ease;
    }
    .notif-bell:hover { background: var(--hover); color: var(--text-primary); }
    .notif-bell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    .notif-bell__icon { display: block; }

    .notif-bell__badge {
      position: absolute;
      top: -5px; right: -5px;
      min-width: 16px; height: 16px;
      padding: 0 4px;
      border-radius: 999px;
      background: var(--c-erro);
      color: #fff;
      font-size: 10px; font-weight: 700;
      line-height: 16px; text-align: center;
      border: 2px solid var(--bg-primary);
      box-sizing: content-box;
      animation: notif-pulse 1.6s ease-out 1;
    }
    @keyframes notif-pulse {
      0%   { transform: scale(0.6); }
      40%  { transform: scale(1.25); }
      100% { transform: scale(1); }
    }

    /* Painel do sino: popover no desktop, folha embaixo no celular. Itens em
       linhas com divisor, filtro no .segmented, botoes .btn (markup no
       agente/_notif_widget.html). */
    .notif-panel {
      position: fixed;
      top: 60px;
      right: 16px;
      width: min(400px, calc(100vw - 32px));
      max-height: min(600px, calc(100vh - 80px));
      background: var(--surface-2);
      border: 1px solid var(--border);
      border-radius: var(--r-card);
      box-shadow: var(--modal-shadow);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      z-index: 9000;
      transform-origin: top right;
      animation: notif-panel-in 0.16s ease-out;
    }
    @keyframes notif-panel-in {
      from { opacity: 0; transform: translateY(-6px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .notif-panel[hidden] { display: none; }
    .notif-empty[hidden] { display: none; }
    .notif-loading[hidden] { display: none; }

    @keyframes notif-card-up {
      from { opacity: 0; transform: translateY(6px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .notif-card--enter {
      animation: notif-card-up 0.2s ease-out calc(var(--i, 0) * 40ms) both;
    }

    .notif-panel__header {
      display: flex; align-items: center; justify-content: space-between;
      gap: var(--s-3);
      padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
    }
    .notif-panel__title {
      margin: 0;
      font-size: var(--fs-16); font-weight: 600;
      color: var(--text-primary);
    }
    .notif-panel__actions { display: flex; gap: var(--s-1); align-items: center; }

    .notif-panel__filters {
      padding: 0 var(--s-4) var(--s-3);
      border-bottom: 1px solid var(--border);
    }

    .notif-panel__body {
      overflow-y: auto;
      max-height: 420px;
      padding: 0 var(--s-4);
      scrollbar-width: thin;
    }
    .notif-panel__body::-webkit-scrollbar { width: 6px; }
    .notif-panel__body::-webkit-scrollbar-thumb {
      background: color-mix(in srgb, var(--text-muted) 30%, transparent);
      border-radius: var(--r-pill);
    }

    .notif-card {
      display: grid;
      grid-template-columns: 32px minmax(0, 1fr) auto;
      gap: var(--s-3);
      align-items: start;
      padding: var(--s-3) 0;
      cursor: pointer;
      position: relative;
    }
    .notif-card + .notif-card { border-top: 1px solid var(--border); }
    .notif-card:hover .notif-card__title { color: var(--accent-texto); }
    .notif-card.is-unread::before {
      content: "";
      position: absolute;
      left: -10px; top: 26px;
      width: 6px; height: 6px;
      background: var(--accent);
      border-radius: 50%;
    }

    .notif-card__icon {
      width: 32px; height: 32px;
      border-radius: var(--r-control);
      display: inline-flex; align-items: center; justify-content: center;
      flex-shrink: 0;
      background: var(--surface-1);
      border: 1px solid var(--border);
      color: var(--text-secondary);
    }
    .notif-card__icon--alerta    { color: var(--c-erro-texto); }
    .notif-card__icon--atencao   { color: var(--c-atencao-texto); }
    .notif-card__icon--sugestao  { color: var(--c-info-texto); }
    .notif-card__icon--insight   { color: var(--c-violeta); }
    .notif-card__icon--conquista { color: var(--c-sucesso-texto); }
    .notif-card__icon--lembrete  { color: var(--text-secondary); }

    .notif-card__body { min-width: 0; }
    .notif-card__title {
      font-size: var(--fs-14); font-weight: 600;
      color: var(--text-primary);
      line-height: 1.35;
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      transition: color 0.15s ease;
    }
    .notif-card__msg {
      font-size: var(--fs-13); color: var(--text-secondary);
      margin-top: 2px; line-height: 1.4;
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
    }
    .notif-card__meta {
      display: flex; align-items: center; gap: var(--s-2);
      margin-top: var(--s-1);
      font-size: var(--fs-12); color: var(--text-muted);
    }
    .notif-card__meta .badge { height: 20px; padding: 0 6px; font-size: 11px; }
    .notif-card__time { white-space: nowrap; }

    .notif-card__actions { display: flex; gap: 2px; align-items: center; }
    /* Desktop: a estrutura do arrastar (celular) fica transparente */
    .notif-card__inner  { display: contents; }
    .notif-card__action-bg { display: none; }

    .notif-empty {
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      gap: var(--s-2);
      padding: var(--s-7) var(--s-4);
      color: var(--text-secondary);
      text-align: center;
    }
    .notif-empty svg { width: 24px; height: 24px; color: var(--text-secondary); }
    .notif-empty__title { margin: 0; font-size: var(--fs-14); font-weight: 600; color: var(--text-primary); }
    .notif-empty__hint  { margin: 0; font-size: var(--fs-13); }

    .notif-loading {
      display: flex; align-items: center; justify-content: center;
      gap: var(--s-2);
      padding: var(--s-7) var(--s-4);
      color: var(--text-muted);
      font-size: var(--fs-13);
    }
    .notif-spinner {
      width: 14px; height: 14px;
      border: 2px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: notif-spin 0.7s linear infinite;
    }
    @keyframes notif-spin { to { transform: rotate(360deg); } }

    .notif-mais { width: 100%; margin: var(--s-1) 0 var(--s-3); }

    /* Modal de detalhe (montado pelo JS do sino): o mesmo desenho do .modal-content */
    .notif-detail-backdrop {
      position: fixed; inset: 0;
      background: var(--overlay-color);
      z-index: 9500;
      display: flex; align-items: center; justify-content: center;
      padding: var(--s-5);
      animation: notif-fade-in 0.18s ease-out;
    }
    @keyframes notif-fade-in { from { opacity: 0; } to { opacity: 1; } }

    .notif-detail-modal {
      width: min(480px, 100%);
      max-height: calc(100vh - 48px);
      background: var(--surface-2);
      border: 1px solid var(--border);
      border-radius: var(--r-card);
      display: flex; flex-direction: column;
      overflow: hidden;
      box-shadow: var(--modal-shadow);
      animation: notif-modal-in 0.18s ease-out;
    }
    @keyframes notif-modal-in {
      from { opacity: 0; transform: translateY(8px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .notif-detail-modal__header {
      display: grid; grid-template-columns: 32px minmax(0, 1fr) 32px;
      align-items: start; gap: var(--s-3);
      padding: var(--s-5) var(--s-5) 0;
    }
    .notif-detail-modal__icon { flex-shrink: 0; }
    .notif-detail-modal__title {
      margin: 0; padding-top: 3px;
      font-size: var(--fs-20); font-weight: 600; letter-spacing: -0.01em;
      color: var(--text-primary); line-height: 1.3;
    }
    .notif-detail-modal__close { margin: -2px -6px 0 0; }
    .notif-detail-modal__body {
      padding: var(--s-4) var(--s-5) 0;
      flex: 1;
      overflow-y: auto;
      color: var(--text-secondary);
      font-size: var(--fs-14); line-height: 1.6;
    }
    .notif-detail-modal__body p { margin: 0; }
    .notif-detail-modal__body strong { color: var(--text-primary); font-weight: 600; }
    .notif-detail-modal__resultado { padding: var(--s-4) 0; text-align: center; }
    .notif-detail-modal__footer {
      display: flex; flex-direction: row-reverse; align-items: center; justify-content: space-between;
      flex-wrap: wrap; gap: var(--s-2);
      padding: var(--s-5);
    }
    .notif-footer-cta,
    .notif-footer-dismiss { display: flex; gap: var(--s-2); flex-wrap: wrap; }

    /* .notif-sheet: transparente no desktop; no celular desce do topo, logo
       abaixo da barra (como as notificacoes dos outros sites), e a barra
       continua visivel e clicavel por cima. */
    .notif-sheet { display: contents; }
    .notif-sheet__handle { display: none; }

    @media (max-width: 980px) {
      .notif-panel {
position: fixed;
inset: calc(56px + env(safe-area-inset-top, 0px)) 0 0 0;
width: 100%;
max-height: none;
background: var(--overlay-color);
display: flex;
flex-direction: column;
justify-content: flex-start;
border-radius: 0;
border: none;
box-shadow: none;
animation: notif-backdrop-in 0.2s ease-out;
z-index: 9000;
      }
      @keyframes notif-backdrop-in {
from { opacity: 0; }
to   { opacity: 1; }
      }

      .notif-sheet {
display: flex;
flex-direction: column;
width: 100%;
max-height: min(80dvh, calc(100dvh - 56px - env(safe-area-inset-top, 0px) - 24px));
background: var(--surface-2);
border-radius: 0 0 var(--r-card) var(--r-card);
border-bottom: 1px solid var(--border);
overflow: hidden;
animation: notif-sheet-down 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
will-change: transform;
      }
      @keyframes notif-sheet-down {
from { transform: translateY(-16px); opacity: 0; }
to   { transform: translateY(0); opacity: 1; }
      }
      /* A alca fica embaixo: arrastar para cima fecha. */
      .notif-sheet .notif-sheet__handle { order: 99; }

      .notif-sheet__handle {
width: 100%; height: 24px;
display: flex; align-items: flex-start; justify-content: center;
padding-top: var(--s-2);
flex-shrink: 0; cursor: grab;
touch-action: none;
      }
      .notif-sheet__handle::after {
content: '';
width: 40px; height: 4px;
background: var(--border-strong);
border-radius: var(--r-pill);
      }

      .notif-panel__header { padding: var(--s-1) var(--s-3) var(--s-3) var(--s-4); }

      .notif-panel__body {
max-height: none;
flex: 1;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
overscroll-behavior: contain;
      }

      /* Itens: arrastar para o lado adia ou descarta */
      .notif-card {
display: block;
padding: 0;
overflow: hidden;
position: relative;
      }
      .notif-card.is-unread::before { display: none; }
      .notif-card__actions { display: none; }

      .notif-card__inner {
display: grid; grid-template-columns: 32px minmax(0, 1fr);
gap: var(--s-3); align-items: start;
padding: var(--s-3) 0;
position: relative; z-index: 2;
background: var(--surface-2);
will-change: transform;
transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
      }
      .notif-card.is-unread .notif-card__title::before {
content: "";
display: inline-block;
width: 6px; height: 6px; margin: 0 6px 2px 0;
border-radius: 50%;
background: var(--accent);
      }

      .notif-card__action-bg {
display: flex; align-items: center;
position: absolute; inset: 0; z-index: 1;
color: #fff;
      }
      .notif-card__action-bg--dismiss {
background: var(--c-erro);
justify-content: flex-end; padding-right: var(--s-5);
      }
      .notif-card__action-bg--snooze {
background: var(--c-atencao);
justify-content: flex-start; padding-left: var(--s-5);
      }
      .notif-card__action-bg svg { flex-shrink: 0; stroke-width: 2; }

      /* Detalhe da notificacao: modal centralizado, como os outros. */
      .notif-detail-backdrop {
align-items: center;
padding: var(--s-4);
      }
      .notif-detail-modal {
width: 100%;
max-height: calc(100dvh - 32px);
animation: notif-sheet-down 0.24s cubic-bezier(0.16, 1, 0.3, 1);
      }
      .notif-detail-modal__header { padding: 20px var(--s-4) 0; }
      .notif-detail-modal__body { padding: var(--s-4) var(--s-4) 0; }
      .notif-detail-modal__footer {
flex-direction: column; align-items: stretch;
padding: 20px var(--s-4) calc(20px + env(safe-area-inset-bottom, 0px));
      }
      .notif-footer-cta,
      .notif-footer-dismiss { flex-direction: column; }
      .notif-footer-cta .btn,
      .notif-footer-dismiss .btn { width: 100%; }
    }

    .notif-panel:focus-visible,
    .notif-detail-modal:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }

    /* Visitante: link Entrar */
    .topbar-entrar{
      display:inline-flex;
      align-items:center;
      height: 36px;
      padding: 0 var(--s-3);
      border-radius: var(--r-control);
      border: 1px solid var(--border-strong);
      color: var(--text-primary);
      font-size: var(--fs-14);
      font-weight: 600;
      text-decoration: none;
    }
    .topbar-entrar:hover{ background: var(--hover); }

    .user-dropdown{
      position: relative;
    }

    /* Avatar + primeiro nome numa linha so */
    .user-btn{
      position: relative;
      display:flex;
      align-items:center;
      gap: var(--s-2);
      height: 36px;
      padding: 0 var(--s-2) 0 4px;
      border-radius: var(--r-control);
      border: 1px solid var(--border);
      background: transparent;
      min-width:0;
      cursor: pointer;
      color: var(--text-primary);
      transition: background-color 0.15s ease;
    }
    .user-btn:hover{ background: var(--hover); }
    .user-btn__nome{
      max-width: 140px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: var(--fs-13);
      font-weight: 600;
    }
    .user-btn .lucide-chevron-down{ color: var(--text-muted); }

    .user-badge{
      position: absolute;
      top: -4px;
      right: -4px;
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: var(--c-erro);
      border: 2px solid var(--bg-primary);
    }

    .user-menu{
      position: absolute;
      right: 0;
      top: calc(100% + 8px);
      min-width: 220px;
      border-radius: var(--r-control);
      border: 1px solid var(--border);
      background: var(--surface-2);
      box-shadow: var(--modal-shadow);
      padding: var(--s-1);
      display: none;
      z-index: 40;
    }

    .user-menu.is-open{
      display: block;
    }

    .user-menu a{
      display: flex;
      align-items: center;
      gap: 10px;
      height: 36px;
      padding: 0 var(--s-3);
      border-radius: 8px;
      color: var(--text-primary);
      text-decoration: none;
      font-weight: 500;
      font-size: var(--fs-14);
    }
    .user-menu a svg.lucide{ color: var(--text-secondary); }

    .user-menu a:hover{
      background: var(--hover);
    }
    .user-menu .user-menu__perigo,
    .user-menu .user-menu__perigo svg.lucide{ color: var(--c-erro-texto); }

    .user-menu .user-menu-notif svg.lucide { color: var(--c-atencao-texto); }
    .user-menu-divider {
height: 1px;
background: var(--border-color, rgba(148,163,184,0.15));
margin: 6px 0;
    }
    .user-menu-header {
padding: 10px 12px 8px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
    }
    .user-menu-header-nome {
font-size: 13px;
font-weight: 600;
color: var(--text-primary);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
min-width: 0;
    }
    .user-menu-plano-chip-link { text-decoration: none; flex-shrink: 0; }
    .user-menu-plano-chip {
display: inline-flex;
align-items: center;
height: 22px;
font-size: 12px;
font-weight: 600;
padding: 0 8px;
border-radius: var(--r-badge);
white-space: nowrap;
flex-shrink: 0;
    }
    .user-menu-plano-chip--ativo { background: rgba(6, 182, 212, 0.12); color: var(--c-info-texto); }
    .user-menu-plano-chip--trial { background: rgba(6, 182, 212, 0.12); color: var(--c-info-texto); }
    .user-menu-plano-chip--cortesia { background: rgba(139, 92, 246, 0.12); color: var(--c-violeta); }
    .user-menu-plano-chip--free { background: rgba(148, 163, 184, 0.12); color: var(--text-secondary); }
    .user-menu .menu-badge{
      margin-left: auto;
      min-width: 18px;
      height: 18px;
      padding: 0 5px;
      border-radius: 999px;
      background: var(--c-erro);
      color: #fff;
      font-size: 11px;
      font-weight: 600;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .count-badge{
      margin-left: auto;
      min-width: 18px;
      height: 18px;
      padding: 0 6px;
      border-radius: 999px;
      background: var(--c-erro);
      color: #fff;
      font-size: 11px;
      font-weight: 600;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      line-height: 1;
    }

    /* Avatar sem foto: inicial num circulo */
    .avatar{
      width: 28px;
      height: 28px;
      border-radius: 999px;
      background: var(--surface-2);
      border: 1px solid var(--border-strong);
      color: var(--text-primary);
      font-size: var(--fs-12);
      font-weight: 600;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex: 0 0 auto;
    }

    .avatar-img{
      width: 28px;
      height: 28px;
      border-radius: 999px;
      border: 1px solid var(--border);
      object-fit: cover;
      display: block;
      flex: 0 0 auto;
    }

    /* =========================
       BODY (sidebar + main)
    ========================== */
    .body{
      display:grid;
      /* minmax(0, 1fr) e nao 1fr: o minimo automatico de uma faixa 1fr e o
 min-content do conteudo, entao a coluna crescia ate 941px numa tela de
 820 e TODA a pagina saia da margem no tablet (retrato e 1024 deitado).
 Em tela larga o conteudo cabia por acaso e ninguem via. */
      grid-template-columns: 220px minmax(0, 1fr);
      flex: 1;
      min-height: calc(100vh - var(--app-h));
      background: var(--bg-primary);
    }

    /* Sidebar: itens de 40px, 14px/500; ativo com fundo ciano a 12% */
    .sidebar{
      display: flex;
      flex-direction: column;
      gap: var(--s-4);
      background: var(--bg-primary);
      border-right: 1px solid var(--border);
      padding: var(--s-4) var(--s-3);
      position: sticky;
      top: var(--app-h);
      height: calc(100vh - var(--app-h));
      overflow-y: auto;
      overflow-x: hidden;
      z-index: 20;
    }

    .nav{
      display:flex;
      flex-direction:column;
      gap: 2px;
      flex: 1;
    }

    .nav a,
    .sidebar-indicacao{
      display:flex;
      align-items:center;
      gap: var(--s-3);
      height: 40px;
      padding: 0 var(--s-3);
      border-radius: var(--r-control);
      text-decoration:none;
      color: var(--text-secondary);
      font-weight: 500;
      font-size: var(--fs-14);
      line-height: 1.2;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      transition: background-color 0.15s ease, color 0.15s ease;
    }
    .nav a svg,
    .sidebar-indicacao svg{
      width: var(--icon);
      height: var(--icon);
    }
    .nav a:hover,
    .sidebar-indicacao:hover{
      background: var(--hover);
      color: var(--text-primary);
    }
    .nav a.active{
      background: var(--nav-active);
      color: var(--text-primary);
      font-weight: 600;
    }
    .nav a.active svg{ color: var(--accent-texto); }

    .nav .sep{ height: 10px; }

    /* Pe da sidebar: codigo de indicacao e convenio, no mesmo formato dos itens */
    .sidebar-pe{
      display: flex;
      flex-direction: column;
      gap: 2px;
      padding-top: var(--s-3);
      border-top: 1px solid var(--border);
    }
    .sidebar-indicacao{
      width: 100%;
      height: auto;
      min-height: 40px;
      padding: 6px var(--s-3);
      border: 0;
      background: transparent;
      text-align: left;
      cursor: pointer;
      white-space: normal;
    }
    .sidebar-indicacao__texto{
      display: flex;
      flex-direction: column;
      min-width: 0;
    }
    .sidebar-indicacao__meta{
      font-size: var(--fs-12);
      color: var(--text-muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* Area de conteudo: gutter de 32px no desktop. Sem respiro embaixo: o
       rodape fecha a pagina (o espaco abaixo da linha e dele). */
    .main{
      padding: var(--s-6) var(--s-6) 0;
    }

    /* =========================
       MOBILE: drawer + bottom nav + layout fluido
    ========================== */
    .overlay{
      display:none;
      position:fixed;
      inset:0;
      background: rgba(0,0,0,0.35);
      z-index: 40;
    }

    /* Barra de abas do celular: 64px + area segura, 5 itens iguais */
    .bottom-nav{
      display:none;
      position:fixed;
      left:0; right:0; bottom:0;
      height: calc(64px + env(safe-area-inset-bottom, 0px));
      padding-bottom: env(safe-area-inset-bottom, 0px);
      border-top: 1px solid var(--border);
      background: var(--bg-primary);
      z-index: 35;
      transition: height 0.2s ease;
    }

    .bottom-nav .items{
      height:100%;
      display:grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      align-items:center;
      padding: 0 var(--s-1);
    }
    .bottom-nav a,
    .bottom-nav .bottom-nav-more{
      display:flex;
      flex-direction:column;
      align-items:center;
      justify-content:center;
      gap: var(--s-1);
      min-height: 44px;
      border: 0;
      background: transparent;
      text-decoration:none;
      color: var(--text-secondary);
      font-weight: 500;
      font-size: 11px;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
    .bottom-nav a svg,
    .bottom-nav .bottom-nav-more svg{
      width: 22px; height: 22px;
      transition: transform 0.26s cubic-bezier(0.4,0,0.2,1);
    }
    .bottom-nav a span,
    .bottom-nav .bottom-nav-more > span:last-child{
      display: block;
      font-size: 11px;
      line-height: 1;
      max-height: 14px;
      overflow: hidden;
      transition: opacity 0.22s ease,
          max-height 0.26s cubic-bezier(0.4,0,0.2,1);
    }
    /* Com o botao Mais reativado, troque a grade para repeat(6, ...) */
    .bottom-nav a.active{ color: var(--accent-texto); }

    /* Ao rolar para baixo os rotulos recolhem */
    .bottom-nav--compact{
      height: calc(48px + env(safe-area-inset-bottom, 0px));
    }
    .bottom-nav--compact a span,
    .bottom-nav--compact .bottom-nav-more > span:last-child{
      opacity: 0;
      max-height: 0;
      pointer-events: none;
    }
    .bottom-nav--compact a,
    .bottom-nav--compact .bottom-nav-more{
      gap: 0;
    }

    .mobile-more-overlay{
      position: fixed;
      inset: 0;
      background: rgba(2, 6, 23, 0.6);
      z-index: 140;
      display: none;
    }

    .mobile-more-panel{
      position: fixed;
      inset: 0;
      background: var(--bg-primary);
      z-index: 150;
      display: none;
      padding: 18px 18px 100px;
      overflow-y: auto;
    }

    .mobile-more-panel.is-open,
    .mobile-more-overlay.is-open{
      display: block;
    }

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

    .mobile-more-theme{
      display:flex;
      align-items:center;
      gap:10px;
      padding: 12px 14px;
      border-radius: 14px;
      border: 1px solid var(--border-color);
      background: var(--bg-elevated);
      color: var(--text-primary);
      font-weight: 700;
      margin-bottom: 14px;
      cursor: pointer;
    }

    .mobile-more-logo{
      display:flex;
      align-items:center;
      gap:10px;
      font-weight: 800;
      color: var(--text-primary);
    }

    .mobile-more-close{
      border:none;
      background: transparent;
      color: var(--text-primary);
      font-size: 24px;
      cursor: pointer;
    }

    .mobile-user-row {
      border-top: 1px solid var(--border-subtle);
      border-bottom: 1px solid var(--border-subtle);
      margin-bottom: 14px;
    }

    .mobile-user-toggle {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 16px;
      cursor: pointer;
      transition: background 0.15s;
      user-select: none;
    }
    .mobile-user-toggle:active { background: rgba(255,255,255,0.04); }
    .mobile-user-chevron {
      margin-left: auto;
      width: 16px; height: 16px;
      color: var(--text-muted);
      transition: transform 0.2s;
      flex-shrink: 0;
    }
    .mobile-user-row.expanded .mobile-user-chevron { transform: rotate(180deg); }

    .mobile-user-submenu {
      display: none;
      border-top: 1px solid var(--border-subtle);
    }
    .mobile-user-row.expanded .mobile-user-submenu { display: block; }

    .mobile-user-submenu a {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 12px 20px;
      font-size: 14px;
      font-weight: 500;
      color: var(--text-secondary);
      text-decoration: none;
      transition: background 0.15s;
    }
    .mobile-user-submenu a:hover { background: rgba(255,255,255,0.04); }
    .mobile-user-submenu a svg { width: 16px; height: 16px; flex-shrink: 0; }
    .mobile-user-submenu .mobile-submenu-sair { color: var(--accent-rose); }
    .mobile-user-submenu .mobile-submenu-sair:hover { background: rgba(244,63,94,0.06); }

    .mobile-more-user{
      display:flex;
      align-items:center;
      gap:12px;
      padding: 12px 0;
      text-decoration:none;
      color: inherit;
    }

    .mobile-more-avatar{
      width: 44px;
      height: 44px;
      border-radius: 50%;
      background: var(--bg-elevated);
      border: 1px solid var(--border-color);
      display:flex;
      align-items:center;
      justify-content:center;
      font-weight: 700;
    }

    /* Ponto vermelho discreto no botão "Mais" da bottom nav */
    .notif-dot-mais {
      position: absolute; top: 0; right: -1px;
      width: 7px; height: 7px;
      background: #EF4444; border-radius: 50%;
      border: 1.5px solid var(--chrome-bg, var(--bg-primary));
    }
    .notif-dot-mais[hidden] { display: none; }

    /* Botão de notificações no drawer - clean row */
    .mobile-more-notif {
      display: flex; align-items: center; gap: 14px;
      width: 100%; padding: 14px 16px;
      border-radius: 14px;
      background: var(--bg-elevated);
      border: 1px solid var(--border-color);
      color: var(--text-primary);
      font-size: 14px; font-weight: 600;
      cursor: pointer; text-align: left;
      margin-bottom: 14px;
      transition: background 0.15s, transform 0.1s;
    }
    .mobile-more-notif:active { transform: scale(0.98); background: color-mix(in srgb, var(--accent) 8%, var(--bg-elevated)); }
    .mobile-more-notif__icon {
      width: 40px; height: 40px; border-radius: 12px;
      background: rgba(6,182,212,0.12); color: var(--accent-cyan);
      display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    }
    .mobile-more-notif__label { flex: 1; }
    .mobile-more-notif__count {
      background: #EF4444; color: #fff;
      font-size: 11px; font-weight: 800;
      padding: 2px 8px; border-radius: 999px;
      min-width: 22px; text-align: center;
      flex-shrink: 0;
    }
    .mobile-more-notif__count[hidden] { display: none; }

    .mobile-more-search{
      display:flex;
      align-items:center;
      gap:10px;
      padding: 12px 16px;
      border-radius: 16px;
      background: var(--bg-elevated);
      border: 1px solid var(--border-color);
      color: var(--text-secondary);
      margin-bottom: 16px;
    }

    .mobile-more-section-title{
      font-size: 14px;
      color: var(--text-primary);
      margin: 12px 0 8px;
      font-weight: 700;
    }

    .mobile-more-grid{
      display:grid;
      grid-template-columns: repeat(3, minmax(0,1fr));
      gap: 12px;
    }

    .mobile-more-card{
      background: var(--bg-elevated);
      border: 1px solid var(--border-color);
      border-radius: 16px;
      padding: 14px;
      min-height: 90px;
      display:flex;
      flex-direction: column;
      gap: 8px;
      color: var(--text-primary);
      text-decoration:none;
      justify-content: center;
    }

    .mobile-more-card .count-badge{
      align-self: flex-start;
      margin-left: 0;
    }

    @media (max-width: 420px){
      .mobile-more-grid{
grid-template-columns: repeat(2, minmax(0,1fr));
      }
    }

    @media (max-width: 980px){
      .topbar{
display:none;
      }

      /* Barra de cima do celular: 56px, titulo da pagina no centro */
      .mobile-topbar{
display:flex;
align-items:center;
justify-content:space-between;
padding: 0 var(--s-1) 0 var(--s-4);
height: 56px;
position: sticky;
top: 0;
z-index: 30;
background: var(--bg-primary);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
      }
      /* 44px de toque; a margem negativa deixa a imagem onde estava */
      .mobile-topbar-logo{
display: inline-grid;
place-items: center;
width: 44px;
height: 44px;
margin-left: -8px;
      }
      .mobile-topbar-logo img{
width: 28px;
height: 28px;
border-radius: var(--r-badge);
display:block;
      }
      .mobile-topbar-title{
position: absolute;
left: 50%;
transform: translateX(-50%);
max-width: calc(100% - 200px);
overflow: hidden;
text-overflow: ellipsis;
font-size: var(--fs-16);
font-weight: 600;
color: var(--text-primary);
letter-spacing: -0.01em;
white-space: nowrap;
pointer-events: none;
      }
      .mobile-topbar-end {
display: flex;
align-items: center;
gap: 0;
flex-shrink: 0;
      }
      /* Alvo de 44px nos dois botoes */
      .mobile-topbar-bell,
      .mobile-topbar-avatar {
width: 44px;
height: 44px;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
border: 0;
border-radius: var(--r-control);
background: transparent;
color: var(--text-secondary);
position: relative;
flex-shrink: 0;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
      }
      .mobile-topbar-bell:active,
      .mobile-topbar-avatar:active {
background: var(--hover);
      }
      .mobile-topbar-bell__icon { width: 20px; height: 20px; }
      .mobile-topbar-bell__dot {
position: absolute;
top: 10px;
right: 11px;
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--c-erro);
border: 1.5px solid var(--bg-primary);
animation: notif-dot-pop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
      }
      @keyframes notif-dot-pop {
from { transform: scale(0); opacity: 0; }
to   { transform: scale(1); opacity: 1; }
      }
      .mobile-topbar-avatar__circulo {
width: 32px;
height: 32px;
border-radius: 50%;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
background: var(--surface-2);
border: 1px solid var(--border-strong);
color: var(--text-primary);
font-weight: 600;
font-size: var(--fs-13);
      }
      .mobile-topbar-avatar-img{
width: 100%;
height: 100%;
object-fit: cover;
      }

      /* Anonimo: logo, titulo e link Entrar discreto */
      .mobile-topbar-entrar {
display: inline-flex;
align-items: center;
height: 44px;
padding: 0 var(--s-3);
font-size: var(--fs-14);
font-weight: 600;
color: var(--text-secondary);
text-decoration: none;
border-radius: var(--r-control);
      }
      .mobile-topbar-entrar:active { background: var(--hover); color: var(--text-primary); }
      .mobile-topbar--anonimo { padding-right: var(--s-1); }

      /* Menu do avatar: itens de 44px, rotulo de secao em frase */
      .topbar-avatar-menu {
display: block;
position: fixed;
top: 56px;
left: 0;
right: 0;
bottom: 0;
z-index: 9001;
      }
      .topbar-avatar-menu__backdrop {
position: absolute;
inset: 0;
background: var(--overlay-color);
      }
      .topbar-avatar-menu__panel {
position: absolute;
top: 0;
right: 0;
width: min(300px, calc(100vw - 32px));
max-height: calc(100dvh - 56px - env(safe-area-inset-bottom, 0px));
padding-bottom: var(--s-2);
background: var(--surface-2);
border-radius: 0 0 0 var(--r-card);
border-left: 1px solid var(--border);
border-bottom: 1px solid var(--border);
overflow-y: auto;
-webkit-overflow-scrolling: touch;
overscroll-behavior: contain;
box-shadow: var(--modal-shadow);
animation: avatar-panel-in 0.22s ease-out;
      }
      @keyframes avatar-panel-in {
from { transform: translateY(-8px); opacity: 0; }
to   { transform: translateY(0);     opacity: 1; }
      }
      .topbar-avatar-menu__user {
display: flex;
align-items: center;
gap: var(--s-3);
padding: var(--s-4);
border-bottom: 1px solid var(--border);
text-decoration: none;
-webkit-tap-highlight-color: transparent;
      }
      .topbar-avatar-menu__user:active { background: var(--hover); }
      .topbar-avatar-menu__user-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
background: var(--surface-1);
border: 1px solid var(--border-strong);
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: var(--fs-16);
color: var(--text-primary);
flex-shrink: 0;
overflow: hidden;
      }
      .topbar-avatar-menu__user-avatar img {
width: 100%; height: 100%; object-fit: cover;
      }
      .topbar-avatar-menu__user-info { min-width: 0; }
      .topbar-avatar-menu__user-name {
font-size: var(--fs-14);
font-weight: 600;
color: var(--text-primary);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
      }
      .topbar-avatar-menu__user-email {
font-size: var(--fs-12);
color: var(--text-secondary);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-top: 2px;
      }
      .topbar-avatar-menu__section {
padding: var(--s-4) var(--s-4) var(--s-1);
font-size: var(--fs-12);
font-weight: 600;
color: var(--text-muted);
      }
      .topbar-avatar-menu__item {
display: flex;
align-items: center;
gap: var(--s-3);
min-height: 44px;
padding: 0 var(--s-4);
font-size: var(--fs-14);
color: var(--text-primary);
text-decoration: none;
-webkit-tap-highlight-color: transparent;
position: relative;
      }
      .topbar-avatar-menu__item:active { background: var(--hover); }
      .topbar-avatar-menu__item svg.lucide {
width: 18px; height: 18px;
color: var(--text-secondary);
      }
      .topbar-avatar-menu__item--danger,
      .topbar-avatar-menu__item--danger svg.lucide { color: var(--c-erro-texto); }
      .topbar-avatar-menu__badge {
margin-left: auto;
min-width: 20px;
height: 20px;
padding: 0 6px;
border-radius: 999px;
background: var(--c-erro);
color: #fff;
font-size: var(--fs-12);
font-weight: 600;
line-height: 20px;
text-align: center;
      }
      .topbar-avatar-menu__divider {
height: 1px;
background: var(--border);
margin: var(--s-2) 0;
      }
      .topbar-avatar-menu__plan-link {
display: flex;
align-items: center;
gap: var(--s-3);
padding: var(--s-3) var(--s-4);
text-decoration: none;
border-bottom: 1px solid var(--border);
-webkit-tap-highlight-color: transparent;
      }
      .topbar-avatar-menu__plan-link:active { background: var(--hover); }
      .topbar-avatar-menu__plan-icon {
width: 36px; height: 36px; border-radius: var(--r-control);
background: rgba(6, 182, 212, 0.12);
color: var(--accent-texto);
display: flex; align-items: center; justify-content: center;
flex-shrink: 0;
      }
      .topbar-avatar-menu__plan-icon svg.lucide { width: 18px; height: 18px; }
      .topbar-avatar-menu__plan-body { flex: 1; min-width: 0; }
      .topbar-avatar-menu__plan-name {
display: block; font-size: var(--fs-14); font-weight: 600; color: var(--text-primary);
      }
      .topbar-avatar-menu__plan-sub {
display: block; font-size: var(--fs-12); color: var(--text-muted); margin-top: 2px;
      }
      .topbar-avatar-menu__plan-link .lucide-chevron-right { color: var(--text-muted); }

      .menu-btn{ display:none; }

      /* Cabecalho antigo (.app-header): o titulo vai para a barra de cima e
 o bloco encolhe, ficando so as acoes */
      .app-header__title-block{ display: none !important; }
      .app-header.app-header{
min-height: auto !important;
padding: 0 0 8px !important;
margin-bottom: 4px !important;
justify-content: flex-end !important;
      }

      /* Sidebar vira gaveta */
      .body{
grid-template-columns: minmax(0, 1fr);
      }
      .sidebar{
position: fixed;
top: 56px;
left: 0;
bottom: 0;
width: 260px;
transform: translateX(-110%);
transition: transform .22s ease;
box-shadow: var(--modal-shadow);
z-index: 10000;
      }
      body.drawer-open .sidebar{ transform: translateX(0); }
      body.drawer-open .overlay{ display:block; }

      /* Respiro para a barra de abas */
      .main{
padding: var(--s-5) var(--s-5) calc(64px + var(--s-6) + env(safe-area-inset-bottom, 0px));
      }

      .bottom-nav{ display:block; }
    }

    @media (max-width: 768px){
      .main{
padding: var(--s-4) var(--s-4) calc(64px + var(--s-5) + env(safe-area-inset-bottom, 0px));
      }
    }

/* Pagina sem sidebar (visitante) */
.body.no-sidebar {
    grid-template-columns: minmax(0, 1fr);
}

/* "Ver mais" da sidebar: so volta com 2 ou mais itens escondidos */
.nav-more-toggle {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    width: 100%;
    height: 40px;
    padding: 0 var(--s-3);
    border-radius: var(--r-control);
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: var(--fs-14);
    cursor: pointer;
}

.nav-more-toggle:hover {
    background: var(--hover);
    color: var(--text-primary);
}

.nav-more {
    display: none;
    flex-direction: column;
    gap: 2px;
}

body.nav-more-open .nav-more {
    display: flex;
}

body.nav-more-open .nav-more-toggle svg {
    transform: rotate(180deg);
}
/* ==== globais que moravam na secao da integracao: .tabela-cards (tabela vira lista no celular) e .btn-spinner ==== */


    @keyframes spin { to { transform: rotate(360deg); } }
    .btn-spinner {
width: 14px; height: 14px;
border: 2px solid currentColor;
border-top-color: transparent;
border-radius: 50%;
display: inline-block;
flex-shrink: 0;
animation: spin 0.7s linear infinite;
    }    @media (prefers-reduced-motion: reduce) {
.btn-spinner { animation: none; opacity: 0.5; }
    }
    /* Tabela larga vira CARD no celular. Marque a tabela com a classe
       'tabela-cards': cada linha vira um cartao com o rotulo da coluna ao
       lado do valor. Tabela com 6, 7 ou 10 colunas dentro de um celular
       virava uma caixinha com rolagem lateral, ilegivel. */
    @media (max-width: 760px) {
table.tabela-cards { display: block; width: 100% !important; min-width: 0 !important; }
table.tabela-cards thead { display: none; }
table.tabela-cards tbody { display: block; width: 100%; }
table.tabela-cards tbody tr {
    display: block; width: 100%; margin: 0 0 8px; padding: 10px 12px;
    border: 1px solid var(--border-color); border-radius: 12px;
    background: var(--bg-elevated);
}
table.tabela-cards tbody td {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; width: 100%; max-width: none !important;
    padding: 4px 0 !important; border: 0 !important;
    white-space: normal !important; text-align: right;
}
table.tabela-cards tbody td::before {
    content: attr(data-rot); flex: 0 0 auto; font-size: 10px;
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-muted); text-align: left;
}
table.tabela-cards tbody td[data-rot=""]::before { content: none; }
table.tabela-cards tbody td:first-child {
    font-weight: 700; padding-bottom: 6px !important; margin-bottom: 4px;
    border-bottom: 1px solid var(--border-color) !important;
}
    }



/* ==== templates/premium_octo.html ==== */

  .octo-premium{
    background:
      radial-gradient(circle at top, rgba(14, 116, 144, 0.25), transparent 55%),
      radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.18), transparent 55%),
      var(--bg-secondary);
    border-radius: 28px;
    padding: 36px 36px 22px; /* menor embaixo */
    color: var(--text-primary);

    /* encostar no fim da página (ajuste fino do header/topbar) */
    min-height: calc(100vh - 110px);
    height: 100%;
  }

  .octo-premium-header{
    display:flex;
    flex-direction:column;
    align-items:center;
    text-align:center;
    gap:12px;
    margin-bottom: 32px;
  }

  .octo-premium-badge{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(14, 116, 144, 0.18);
    border: 1px solid rgba(34, 211, 238, 0.3);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
  }

  .octo-premium-title{
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
  }

  .octo-premium-title span{
    color: var(--accent-cyan);
  }

  .octo-premium-subtitle{
    color: var(--text-secondary);
    font-size: 15px;
    max-width: 640px;
  }

  .octo-premium-grid{
    display:grid;
    grid-template-columns: repeat(2, minmax(0, 460px));
    justify-content: center;
    gap: 22px;
    margin: 26px 0 18px;
  }

  .octo-premium-card{
    background: rgba(2, 6, 23, 0.25);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 18px;
    padding: 22px 22px 18px;
    box-shadow: 0 18px 30px rgba(2, 6, 23, 0.22);
    backdrop-filter: blur(10px);
  }

  .octo-premium-card h4{
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .octo-premium-price{
    display:flex;
    align-items: baseline;
    gap: 10px;
    margin: 0 0 12px;
    color: var(--text-secondary);
    font-weight: 600;
  }

  .octo-premium-price strong{
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
  }

  .octo-premium-price small{
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
  }

  /* lista com bolinha azul intensa */
  .octo-premium-list{
    margin: 0;
    padding: 0;
    list-style: none;
    display:flex;
    flex-direction:column;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
  }

  .octo-premium-list li{
    display:flex;
    align-items:flex-start;
    gap: 10px;
  }

  .octo-premium-list li::before{
    content:"";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    margin-top: 5px;

    background: var(--accent-cyan);
    box-shadow:
      0 0 0 3px rgba(34, 211, 238, 0.18),
      0 10px 18px rgba(34, 211, 238, 0.18);
    flex: 0 0 auto;
  }

  .octo-premium-cta{
    display:flex;
    align-items:center;
    justify-content:center;
    margin-top: 18px;
  }

  .octo-premium-cta .btn{
    min-width: 320px;
    justify-content:center;
    font-weight: 700;
    padding: 12px 18px;
    border-radius: 14px;
  }

  /* responsivo */
  @media (max-width: 1024px){
    .octo-premium{
      min-height: calc(100vh - 96px);
    }
    .octo-premium-title{
      font-size: 34px;
    }
    .octo-premium-grid{
      grid-template-columns: minmax(0, 620px);
    }
    .octo-premium-cta .btn{
      width: 100%;
      min-width: 0;
      max-width: 620px;
    }
  }

  @media (max-width: 640px){
    .octo-premium{
      padding: 28px 18px 18px;
      min-height: calc(100vh - 88px);
    }
    .octo-premium-title{
      font-size: 28px;
    }
  }


/* ==== templates/usuario_editar.html ==== */

    .tabs-admin {
position: relative;
display: flex;
gap: 8px;
padding: 6px;
border-radius: 16px;
border: 1px solid var(--border-color);
background: rgba(15, 23, 42, 0.6);
margin: 20px 0;
overflow: hidden;
    }

    .tabs-admin button {
position: relative;
z-index: 2;
flex: 1;
background: transparent;
border: none;
color: var(--text-secondary);
font-weight: 600;
padding: 10px 12px;
border-radius: 12px;
cursor: pointer;
transition: color 0.2s ease;
    }

    .tabs-admin button.active {
color: var(--text-primary);
    }

    .tabs-admin-indicator {
position: absolute;
top: 6px;
bottom: 6px;
left: 6px;
width: 0;
border-radius: 12px;
background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(139, 92, 246, 0.2));
border: 1px solid var(--border-glow);
transition: transform 0.25s ease, width 0.25s ease;
z-index: 1;
    }

    html[data-theme="light"] .tabs-admin {
background: #f1f5f9;
border-color: rgba(15, 23, 42, 0.12);
    }

    html[data-theme="light"] .tabs-admin button {
color: #64748b;
    }

    html[data-theme="light"] .tabs-admin button.active {
color: #0f172a;
    }

    html[data-theme="light"] .tabs-admin-indicator {
background: #ffffff;
border-color: rgba(99, 102, 241, 0.25);
box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    }

    .tab-panel {
display: none;
animation: tabFade 0.2s ease;
    }

    .tab-panel.active {
display: block;
    }

    @keyframes tabFade {
from { opacity: 0; transform: translateY(6px); }
to { opacity: 1; transform: translateY(0); }
    }

    @media (max-width: 768px) {
.tabs-admin {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs-admin button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.tabs-admin::-webkit-scrollbar {
    display: none;
}
    }


/* ==== templates/sincronizar_contas.html ==== */

    .sync-container {
background: var(--bg-secondary);
border-radius: 24px;
padding: 28px 32px;
color: var(--text-primary);
min-height: 60vh;
    }

    .sync-title {
font-size: 26px;
font-weight: 600;
margin-bottom: 8px;
    }

    .sync-subtitle {
color: var(--text-secondary);
margin-bottom: 18px;
    }


/* ==== templates/aprovacoes.html ==== */

    .aprovacoes-cards {
display: none;
flex-direction: column;
gap: 12px;
margin-top: 16px;
    }

    .aprovacao-card {
background: var(--bg-elevated);
border: 1px solid var(--border-color);
border-radius: 16px;
padding: 16px;
display: flex;
flex-direction: column;
gap: 10px;
    }

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

    .aprovacao-card-title {
font-weight: 600;
font-size: 16px;
    }

    .aprovacao-card-meta {
color: var(--text-secondary);
font-size: 12px;
    }

    .aprovacao-card-actions {
display: flex;
justify-content: flex-end;
    }

    @media (max-width: 768px) {
.aprovacoes-table {
    display: none;
}

.aprovacoes-cards {
    display: flex;
}
    }


/* ==== Ajuste layout sidebar (base copy) ==== */
@media (min-width: 981px) {
    .body {
grid-template-columns: 220px minmax(0, 1fr);
    }

    .body .sidebar {
position: sticky;
top: var(--app-h);
height: calc(100vh - var(--app-h));
overflow-y: auto;
align-self: start;
width: 220px;
transform: none !important;
z-index: 20;
    }

    body.has-sidebar.sidebar-open .sidebar,
    body.has-sidebar.sidebar-collapsed .sidebar {
transform: none !important;
width: 220px;
    }

}
