/* Judici — tema enterprise dark-first (CLAUDE.md §19.1) */
:root {
    --bg-0: #0a0e17;
    --bg-1: #0f1524;
    --bg-2: #151d31;
    --bg-3: #1c2740;
    --border: #24304d;
    --text-0: #e8edf7;
    --text-1: #aab6cf;
    --muted: #8593b3;  /* WCAG AA: 5.9:1 sobre bg-1, 5.4:1 sobre bg-2 (era #6b7896 = 4.1/3.8, reprovava) */
    --accent: #3b82f6;
    --accent-2: #22d3ee;
    --positive: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;
    --radius: 14px;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    /* Escala de tokens (consolidação CS1 — adotar incrementalmente em novos componentes) */
    --r-sm: 8px; --r-md: 10px; --r-lg: 14px;
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
    --z-nav: 30; --z-topbar: 20; --z-modal: 200;
    font-synthesis: none;
}

* { box-sizing: border-box; }

body.app {
    margin: 0;
    background: radial-gradient(1200px 600px at 80% -10%, #14203a 0%, var(--bg-0) 55%);
    color: var(--text-0);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh; /* iOS/Android: viewport dinâmico (evita barra de endereço) */
}

[x-cloak] { display: none !important; }
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; min-height: 100dvh; }
.nav-backdrop { display: none; }

/* Ícones (sprite SVG) */
.nav-ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor;
    stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Sidebar */
.sidebar {
    background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 18px 12px;
    position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-mark { color: var(--accent-2); font-size: 20px; }
.brand-name { font-weight: 700; letter-spacing: 0.3px; }
/* Logo Solit em chip claro (símbolo azul destaca no tema dark) */
.brand-logo { width: 34px; height: 24px; object-fit: contain; background: linear-gradient(180deg,#fff,#eef3fb);
    border-radius: 8px; padding: 3px 4px; border: 1px solid var(--border); box-shadow: 0 6px 16px -8px rgba(59,130,246,0.5); }
.brand-by { font-size: 10px; color: var(--muted); font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-group { display: flex; flex-direction: column; margin-bottom: 8px; }
.nav-label { display: flex; align-items: center; justify-content: space-between; width: 100%;
    margin: 6px 0 2px; padding: 6px 12px; background: transparent; border: 0; cursor: pointer;
    font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--muted); opacity: 0.85; border-radius: 8px; transition: color .15s, background .15s; }
.nav-label:hover { color: var(--text-1); background: var(--bg-2); }
.nav-chev { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2;
    stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.nav-group.collapsed .nav-chev { transform: rotate(-90deg); }
.nav-group-items { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .22s ease; }
.nav-group.collapsed .nav-group-items { grid-template-rows: 0fr; }
.nav-group-inner { overflow: hidden; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 11px; position: relative;
    color: var(--text-1); text-decoration: none; padding: 9px 12px;
    border-radius: 10px; font-weight: 500; font-size: 13.5px;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.nav-item .nav-ic { color: var(--muted); transition: color 0.15s, transform 0.15s; }
.nav-item span { flex: 1; }
.nav-item:hover { background: var(--bg-2); color: var(--text-0); }
.nav-item:hover .nav-ic { color: var(--accent-2); }
.nav-item.is-active { color: #fff;
    background: linear-gradient(90deg, rgba(59,130,246,0.22), rgba(34,211,238,0.06));
    box-shadow: inset 0 0 0 1px rgba(59,130,246,0.25); }
.nav-item.is-active::before { content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--accent), var(--accent-2)); }
.nav-item.is-active .nav-ic { color: var(--accent-2); }
.nav-item[data-soon]::after { content: "em breve"; font-size: 9.5px; color: var(--muted);
    border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; }
.nav-badge-slot:empty { display: none; }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 4px; margin-top: 8px; border-top: 1px solid var(--border); }

/* Content */
.content { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 26px; border-bottom: 1px solid var(--border);
    background: rgba(15, 21, 36, 0.72); backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 20;
}
.topbar-burger { display: none; background: transparent; border: 1px solid var(--border);
    color: var(--text-1); border-radius: 10px; padding: 7px; cursor: pointer;
    min-width: 40px; min-height: 40px; align-items: center; justify-content: center; }
/* Safe-area (notch/home indicator do iPhone) — respeita as bordas seguras */
.topbar { padding-right: max(26px, env(safe-area-inset-right)); }
.sidebar { padding-left: max(12px, env(safe-area-inset-left)); }
@supports (padding: max(0px)) {
  @media (max-width: 1024px) {
    .sidebar { padding-top: max(18px, env(safe-area-inset-top)); }
    .page-body { padding-left: max(16px, env(safe-area-inset-left));
                 padding-right: max(16px, env(safe-area-inset-right)); }
  }
}
.topbar-title { min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.page-title { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.page-subtitle { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; }

/* Busca global no topo */
.topbar-search { display: flex; align-items: center; gap: 8px; background: var(--bg-2);
    border: 1px solid var(--border); border-radius: 10px; padding: 7px 12px; width: 300px;
    transition: border-color 0.15s, box-shadow 0.15s; }
.topbar-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.topbar-search .nav-ic { color: var(--muted); width: 16px; height: 16px; }
.topbar-search input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--text-0); font-size: 13px; min-width: 0; }
.topbar-search input::placeholder { color: var(--muted); }

/* Sino de notificações */
.topbar-bell { position: relative; display: inline-flex; padding: 8px; border-radius: 10px;
    color: var(--text-1); border: 1px solid var(--border); background: var(--bg-2); transition: color 0.15s, border-color 0.15s; }
.topbar-bell:hover { color: var(--accent-2); border-color: var(--accent-2); }
.bell-slot:empty { display: none; }
.bell-slot .nav-badge { position: absolute; top: -5px; right: -5px; margin: 0; }
.topbar-bell.is-open { color: var(--accent-2); border-color: var(--accent-2); }

/* Painel de notificações do sino */
.bell-menu { position: relative; }
.notif-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 340px; max-width: 92vw; z-index: 40;
    transform-origin: top right;
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1)); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: 0 24px 60px -18px rgba(0,0,0,0.72); overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.notif-head b { font-size: 14px; color: var(--text-0); }
.notif-count { font-size: 11px; color: var(--danger); font-weight: 600; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: 11px; padding: 12px 16px; text-decoration: none; border-bottom: 1px solid var(--border); transition: background .12s; }
.notif-item:hover { background: var(--bg-3); }
.notif-item.is-unread { background: rgba(59,130,246,0.05); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--muted); }
.notif-dot.notif-critical { background: var(--danger); box-shadow: 0 0 8px rgba(248,113,113,.6); }
.notif-dot.notif-warning { background: var(--warning); }
.notif-dot.notif-info { background: var(--info); }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { font-size: 12.5px; font-weight: 600; color: var(--text-0); line-height: 1.35; }
.notif-snip { font-size: 11.5px; color: var(--text-1); line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-meta { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.notif-all { display: block; text-align: center; padding: 11px; font-size: 12.5px; font-weight: 600; color: var(--accent-2);
    text-decoration: none; border-top: 1px solid var(--border); background: var(--bg-2); }
.notif-all:hover { background: var(--bg-3); }
.notif-loading, .notif-empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* Chip do usuário */
.user-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
    font-size: 13px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.page-body { padding: 24px 28px; display: flex; flex-direction: column; gap: 20px; }
.footer { margin-top: auto; padding: 18px 28px; border-top: 1px solid var(--border); }

/* Cards */
.card {
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px;
}

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi-label { margin: 0 0 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.kpi-value { margin: 0; font-size: 24px; font-weight: 700; }
.kpi { position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--muted); }
.kpi--positive::before { background: var(--positive); }
.kpi--warning::before { background: var(--warning); }
.kpi--danger::before { background: var(--danger); }
.kpi--info::before { background: var(--info); }

/* Panels */
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.empty-state { padding: 28px 8px; text-align: center; color: var(--text-1); }
.status-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.status-list li { display: flex; align-items: center; gap: 10px; color: var(--text-1); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot-idle { background: var(--muted); }
.dot-ok { background: var(--positive); }
.dot-warn { background: var(--warning); }
.dot-err { background: var(--danger); }

/* Tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text-1); }
.empty-row td { text-align: center; color: var(--muted); padding: 24px; }

/* Bits */
.muted { color: var(--muted); font-size: 12px; }
.badge { font-size: 10px; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-env { background: var(--bg-3); color: var(--accent-2); border: 1px solid var(--border); }
.pill { font-size: 12px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); }
.pill-ok { color: var(--positive); }

/* Auth / login */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 24px; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card { padding: 32px; }
.auth-brand { justify-content: center; padding: 0 0 20px; }
.auth-title { margin: 0 0 4px; font-size: 20px; font-weight: 700; text-align: center; }
.auth-subtitle { margin: 0 0 22px; color: var(--muted); font-size: 13px; text-align: center; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; color: var(--text-1); }
.input {
    background: var(--bg-0); border: 1px solid var(--border); border-radius: 10px;
    color: var(--text-0); padding: 11px 12px; font-size: 14px; outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }
.btn {
    border: 1px solid var(--border); border-radius: 10px; padding: 11px 16px;
    font-size: 14px; font-weight: 600; cursor: pointer; background: var(--bg-3); color: var(--text-0);
    transition: filter 0.15s, background 0.15s;
}
.btn:hover { filter: brightness(1.1); }
.btn-primary { background: linear-gradient(180deg, var(--accent), #2563eb); border-color: #2563eb; color: #fff; margin-top: 4px; }
.btn-ghost { background: transparent; }
.btn-danger { background: rgba(248,113,113,0.12); color: #fecaca; border-color: rgba(248,113,113,0.4); }
.btn-danger:hover { background: rgba(248,113,113,0.2); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.auth-foot { text-align: center; margin: 20px 0 0; display: flex; gap: 8px; align-items: center; justify-content: center; }
.alert { border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.4); color: #fecaca; }
.alert-ok { background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.4); color: #bbf7d0; }

/* Inline form (ingestão) */
.inline-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1; min-width: 200px; }

/* Status tags */
.tag { font-size: 11px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.3px; }
.tag-pending { color: var(--muted); }
.tag-running { color: var(--info); border-color: var(--info); }
.tag-succeeded { color: var(--positive); border-color: var(--positive); }
.tag-failed { color: var(--danger); border-color: var(--danger); }
.tag-partial { color: var(--warning); border-color: var(--warning); }
.tag-dead_letter { color: var(--danger); }

/* User chip / logout */
/* Menu do usuário (dropdown profissional) */
.user-menu { position: relative; }
.user-chip { display: flex; flex-direction: row; align-items: center; gap: 9px; line-height: 1.2;
    background: transparent; border: 1px solid transparent; border-radius: 11px; padding: 4px 8px 4px 4px; cursor: pointer; transition: background .15s, border-color .15s; }
.user-chip:hover, .user-chip.is-open { background: var(--bg-2); border-color: var(--border); }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--text-0); }
.user-role { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.user-chev { width: 14px; height: 14px; color: var(--muted); transition: transform .2s; }
.user-chip.is-open .user-chev { transform: rotate(180deg); }
.user-dropdown { position: absolute; top: calc(100% + 8px); right: 0; width: 268px; z-index: 40;
    transform-origin: top right;
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1)); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: 0 24px 60px -18px rgba(0,0,0,0.7); overflow: hidden; }
.ud-head { display: flex; gap: 12px; align-items: center; padding: 16px; border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(59,130,246,0.12), transparent); }
.user-avatar-lg { width: 44px; height: 44px; font-size: 17px; border-radius: 12px; flex: none; }
.ud-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ud-id b { font-size: 14px; color: var(--text-0); }
.ud-email { font-size: 11.5px; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ud-role { font-size: 10px; color: var(--accent-2); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.ud-links { padding: 6px; display: flex; flex-direction: column; gap: 1px; }
.ud-logout { padding: 6px; border-top: 1px solid var(--border); }
.ud-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 9px;
    color: var(--text-1); text-decoration: none; font-size: 13px; background: transparent; border: 0; cursor: pointer; text-align: left; transition: background .12s, color .12s; }
.ud-link:hover { background: var(--bg-3); color: var(--text-0); }
.ud-link .nav-ic { color: var(--muted); }
.ud-link:hover .nav-ic { color: var(--accent-2); }
.ud-danger { color: #fca5a5; }
.ud-danger:hover { background: rgba(248,113,113,0.12); color: #fecaca; }
.ud-danger .nav-ic { color: #fca5a5; }
.logout-form { margin: 0; }

/* Inline mini forms (admin table) */
.inline-mini { margin: 0; display: inline; }
.input-mini { padding: 4px 6px; font-size: 12px; }
.btn-mini { padding: 4px 10px; font-size: 12px; }

/* Tasks / SLA / comments */
.sla-overdue { color: var(--danger); font-weight: 600; }
.tag-open { color: var(--info); border-color: var(--info); }
.tag-in_progress { color: var(--accent-2); border-color: var(--accent-2); }
.tag-blocked { color: var(--warning); border-color: var(--warning); }
.tag-done { color: var(--positive); border-color: var(--positive); }
.tag-cancelled { color: var(--muted); }
.comments { display: flex; flex-direction: column; gap: 10px; }
.comment { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); }
.comment-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 4px; }
.comment-author { font-weight: 600; font-size: 13px; }
.comment-body { font-size: 13px; color: var(--text-1); white-space: pre-wrap; }

/* Notifications */
.nav-badge { display: inline-block; margin-left: 6px; min-width: 18px; height: 18px; line-height: 18px; text-align: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--danger); border-radius: 999px; padding: 0 5px; }
.notif-list { display: flex; flex-direction: column; gap: 8px; }
.notif { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: inherit; background: var(--bg-2); border-left-width: 3px; }
.notif:hover { background: var(--bg-3); }
.notif-critical { border-left-color: #b91c1c; }
.notif-warning { border-left-color: var(--warning); }
.notif-info { border-left-color: var(--info); }
.notif-unread { box-shadow: inset 0 0 0 1px rgba(59,130,246,0.25); }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-top: 5px; flex-shrink: 0; }
.notif-unread .notif-dot { background: var(--danger); }
.notif:not(.notif-unread) .notif-dot { background: var(--muted); }
.notif-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.notif-cat { font-size: 11px; color: var(--muted); font-family: monospace; }
.notif-title { font-weight: 600; font-size: 14px; }
.notif-desc { margin-top: 2px; }

/* Findings / severity */
.sev-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.sev { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.3px; }
.sev-critical { color: #fff; background: #b91c1c; border-color: #b91c1c; }
.sev-high { color: #fecaca; background: rgba(248,113,113,0.14); border-color: rgba(248,113,113,0.5); }
.sev-medium { color: #fcd34d; background: rgba(251,191,36,0.12); border-color: rgba(251,191,36,0.45); }
.sev-low { color: var(--text-1); }
.findings { display: flex; flex-direction: column; gap: 10px; }
.finding { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); border-left-width: 3px; }
.finding-critical { border-left-color: #b91c1c; }
.finding-high { border-left-color: var(--danger); }
.finding-medium { border-left-color: var(--warning); }
.finding-low { border-left-color: var(--muted); }
.finding-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.finding-rule { font-size: 11px; color: var(--muted); font-family: monospace; }
.finding-title { font-weight: 600; font-size: 14px; }
.finding-desc { margin: 4px 0 6px; }
.finding-actions { display: flex; gap: 6px; flex-shrink: 0; margin: 0; }
.finding-actions .btn { padding: 6px 10px; font-size: 12px; }

/* Graph */
.graph-canvas { height: 620px; width: 100%; background: radial-gradient(600px 400px at 50% 0%, #0f1524, var(--bg-0)); border-radius: 12px; border: 1px solid var(--border); }
.graph-legend { display: flex; gap: 8px; flex-wrap: wrap; }
.lg { font-size: 11px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-1); }
.lg::before { content: "●"; margin-right: 5px; }
.lg-case::before { color: #3b82f6; } .lg-org::before { color: #22d3ee; }
.lg-deposit::before { color: #34d399; } .lg-bank::before { color: #a78bfa; }
.lg-opportunity::before { color: #fbbf24; } .lg-cash::before { color: #2dd4bf; }
.lg-event::before { color: #c084fc; } .lg-document::before { color: #fb923c; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.tl-item { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--border); }
.tl-item:last-child { border-left-color: transparent; }
.tl-dot { position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); border: 2px solid var(--bg-1); }
.tl-movimentação .tl-dot { background: var(--info); }
.tl-publicação .tl-dot { background: var(--accent-2); }
.tl-documento .tl-dot { background: var(--warning); }
.tl-flagged .tl-dot { background: var(--positive); box-shadow: 0 0 0 3px rgba(52,211,153,0.2); }
.tl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tl-date { font-size: 12px; color: var(--text-0); font-weight: 600; }
.tl-kind { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.tl-label { font-size: 13px; color: var(--text-1); margin-top: 2px; }

/* Chart.js canvas box */
.chart-box { position: relative; height: 260px; width: 100%; }
.chart-box canvas { max-height: 260px; }

/* Dossiê — desdobramentos e tese de recuperação */
.breakdown-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 16px; }
.breakdown-block h4 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text-1); }
.bd-row { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.bd-label { color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-track { height: 8px; background: var(--bg-0); border-radius: 999px; overflow: hidden; }
.bd-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 999px; }
.bd-value { color: var(--muted); font-variant-numeric: tabular-nums; }
.opp-hero { border: 1px solid rgba(59,130,246,0.4); background: linear-gradient(180deg, #12203c, var(--bg-1)); }
.opp-hero-title { margin: 0; font-size: 22px; font-weight: 800; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.opp-hero-value { color: var(--positive); font-size: 22px; }
.opp-hero-desc { margin: 6px 0 0; color: var(--text-1); font-size: 14px; }
.opp-ai { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }
.opp-ai-frase { font-size: 15px; font-weight: 600; margin: 0 0 12px; color: var(--text-0); }
.opp-ai .ai-cols p { margin: 2px 0 0; font-size: 13px; line-height: 1.55; color: var(--text-1); }
/* Editor WYSIWYG de e-mail */
.wyed-toolbar { display: flex; gap: 4px; flex-wrap: wrap; }
.wyed-toolbar button { background: var(--bg-3); border: 1px solid var(--border); color: var(--text-0); border-radius: 8px; padding: 5px 10px; font-size: 13px; cursor: pointer; }
.wyed-toolbar button:hover { filter: brightness(1.15); }
.wyed-toolbar button:disabled { opacity: 0.4; cursor: not-allowed; }
.wyed-frame { width: 100%; height: 520px; border: 1px solid var(--border); border-radius: 10px; background: #fff; margin-top: 12px; }
.wyed-src { display: none; width: 100%; height: 520px; font-family: ui-monospace, monospace; font-size: 12px; margin-top: 12px; }
.cash-flow { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; }
.cash-step { flex: 1; min-width: 150px; background: var(--bg-0); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.cash-step.is-cash { border-color: rgba(52,211,153,0.5); box-shadow: 0 6px 20px -12px rgba(52,211,153,0.5); }
.cash-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; }
.cash-value { font-size: 20px; font-weight: 800; }
.cash-step.is-cash .cash-value { color: var(--positive); }
.cash-arrow { align-self: center; color: var(--muted); font-size: 20px; }
@media (max-width: 640px) { .cash-arrow { display: none; } }
.cmd-center { border: 1px solid rgba(59,130,246,0.4); background: linear-gradient(180deg, #12203c, var(--bg-1)); }
.cmd-resumo { font-size: 14px; line-height: 1.6; margin: 0 0 14px; color: var(--text-0); }
.cmd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.cmd-kpi { background: var(--bg-0); border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.cmd-k-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; }
.cmd-k-value { font-size: 20px; font-weight: 800; }
.cmd-k-value.pos { color: var(--positive); }
.cmd-overdue { font-size: 11px; color: var(--danger); font-weight: 600; }
.cmd-signals { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cmd-sig { font-size: 12px; color: var(--text-1); background: var(--bg-0); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }
.cmd-acoes { margin-top: 14px; }
.signals-panel { border: 1px solid rgba(52,211,153,0.35); box-shadow: 0 8px 30px rgba(52,211,153,0.08); }
.signals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.signal-card { background: var(--bg-0); border: 1px solid var(--border); border-radius: 12px; padding: 14px; text-align: center; }
.signal-count { margin: 0; font-size: 28px; font-weight: 800; color: var(--positive); }
.signal-label { margin: 4px 0 0; font-size: 11px; color: var(--text-1); }
.pipeline-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pipeline-meta { font-size: 12px; color: var(--text-1); }
.pipeline-stages { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pipeline-stages li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-1); flex-wrap: wrap; }
.thesis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.ranking-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 16px; }
.ranking-cols h4 { margin: 0 0 8px; font-size: 13px; color: var(--text-1); }
.ranking-list { margin: 0; padding-left: 20px; color: var(--text-1); font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 720px) { .ranking-cols { grid-template-columns: 1fr; } .bd-row { grid-template-columns: 110px 1fr auto; } }

/* Horizontal bar charts */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 120px; align-items: center; gap: 10px; }
.bar-label { font-size: 12px; color: var(--text-1); }
.bar-track { height: 10px; background: var(--bg-0); border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); min-width: 2px; }
.bar-fill-2 { background: linear-gradient(90deg, #34d399, #22d3ee); }
.bar-value { font-size: 12px; text-align: right; color: var(--text-0); }

/* Detail topbar */
.detail-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Reconciliation box */
.recon-box { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(52,211,153,0.10); border: 1px solid rgba(52,211,153,0.35); color: #bbf7d0; font-size: 13px; }

/* Document text */
.doc-text { white-space: pre-wrap; word-break: break-word; max-height: 480px; overflow: auto; background: var(--bg-0); border: 1px solid var(--border); border-radius: 10px; padding: 14px; color: var(--text-1); font-size: 12.5px; line-height: 1.8; }
.hl { padding: 1px 3px; border-radius: 4px; font-weight: 600; color: #0a0e17; }
.hl-valor { background: #34d399; }
.hl-processo { background: #60a5fa; }
.hl-data { background: #fbbf24; }
.hl-alvara { background: #c084fc; }
.hl-guia { background: #22d3ee; }
input[type="file"].input { padding: 8px; }

/* Score badges */
.score { display: inline-block; min-width: 36px; text-align: center; font-weight: 700; padding: 4px 8px; border-radius: 8px; }
.score-hi { background: rgba(52, 211, 153, 0.16); color: #6ee7b7; border: 1px solid rgba(52,211,153,0.4); }
.score-mid { background: rgba(251, 191, 36, 0.14); color: #fcd34d; border: 1px solid rgba(251,191,36,0.4); }
.score-lo { background: rgba(107, 120, 150, 0.14); color: var(--text-1); border: 1px solid var(--border); }

/* Clickable rows */
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:hover td { background: var(--bg-2); }

/* Definition list (kv) */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; }
.explanation { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--text-1); }

/* Forms: stacks and button rows */
.stack { display: flex; flex-direction: column; gap: 12px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
textarea.input { resize: vertical; font-family: inherit; }
select.input { appearance: none; }

/* Extra status tags for opportunity states */
.tag-draft_detected, .tag-needs_evidence { color: var(--muted); }
.tag-ready_for_legal_review { color: var(--info); border-color: var(--info); }
.tag-legal_confirmed, .tag-recovered, .tag-partially_recovered { color: var(--positive); border-color: var(--positive); }
.tag-legal_rejected, .tag-closed_false_positive, .tag-closed_not_recoverable { color: var(--danger); border-color: var(--danger); }

@media (max-width: 1080px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) { .topbar-search { width: 190px; } }
/* Menu em drawer até 1024px: cobre iPhone (retrato/paisagem), iPad retrato e
   iPad mini/Air paisagem (1024). Acima disso, sidebar fixa (iPad Pro/laptop). */
@media (max-width: 1024px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: fixed; top: 0; left: 0; width: 262px; height: 100vh; height: 100dvh;
        transform: translateX(-100%); transition: transform 0.25s ease; }
    .layout.nav-open .sidebar { transform: translateX(0); box-shadow: 0 10px 50px rgba(0,0,0,0.6); }
    .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 25;
        background: rgba(0,0,0,0.55); backdrop-filter: blur(2px); }
    .topbar-burger { display: inline-flex; }
    .topbar-search { display: none; }
    .topbar { padding: 12px 16px; }
    .page-body { padding: 18px 16px; }
    .user-meta { display: none; }
}
/* Paisagem baixa (celular deitado): compacta o menu p/ caber sem cortar itens. */
@media (max-width: 1024px) and (max-height: 500px) {
    .sidebar { padding: 10px 12px; }
    .nav-group { margin-bottom: 3px; }
    .nav-item { padding: 7px 12px; }
    .nav-label { margin: 3px 0 1px; }
}
@media (max-width: 520px) {
    .pill-ok, .page-subtitle { display: none; }
    .kpi-grid { grid-template-columns: 1fr; }
}

/* Client 360 — central de inteligência */
.panel-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin: 16px 0; }
.c360-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.c360-title { font-size: clamp(20px, 2.6vw, 30px); letter-spacing: -0.02em; font-weight: 800; }
.live-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted);
    border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; white-space: nowrap; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52,211,153,.7);
    animation: livepulse 1.8s infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); } 70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }

/* Estimativa de potencial de recuperação */
.estimate-panel { border: 1px solid rgba(52,211,153,.25); }
.estimate-hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; }
.estimate-value { font-size: clamp(28px, 4vw, 44px); font-weight: 800; letter-spacing: -0.02em;
    background: linear-gradient(120deg, #34d399, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.estimate-side { display: flex; gap: 24px; }
.estimate-side div { display: flex; flex-direction: column; }
.estimate-side b { font-size: 18px; }
.estimate-note { margin-top: 12px; font-size: 12px; line-height: 1.5; }

/* White-label por tenant */
.brand-logo--tenant { object-fit: contain; border-radius: 8px; }
.c360-ident { display: flex; align-items: center; gap: 14px; }
.c360-logo { background: #fff; border-radius: 10px; padding: 8px 12px; display: inline-flex; }
.c360-logo img { height: 34px; width: auto; display: block; }

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

/* Painel de análise crítica de IA */
.ai-panel { border: 1px solid rgba(34,211,238,.22); }
.ai-critique { background: var(--bg-2); border-left: 3px solid var(--accent-2); padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.ai-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 18px; margin-top: 8px; }
.ai-list { margin: 6px 0 0; padding-left: 18px; line-height: 1.6; }
.ai-action { margin-top: 10px; }

/* Painel financeiro-executivo (hero) */
.kpi-hero .kpi-value { font-size: clamp(20px, 2.4vw, 30px); }
.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.kpi--highlight { border: 1px solid rgba(52,211,153,.35); box-shadow: 0 10px 30px -16px rgba(52,211,153,.5); }
.methodology-note { font-size: 11.5px; line-height: 1.55; margin: -4px 0 4px; }

/* Explicabilidade — contribuições do modelo */
.contrib-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.contrib-row { display: grid; grid-template-columns: 200px 1fr 56px; align-items: center; gap: 10px; }
.contrib-label { font-size: 13px; color: var(--text-1); }
.contrib-bar { background: var(--bg-2); border-radius: 6px; height: 14px; overflow: hidden; position: relative; }
.contrib-fill { display: block; height: 100%; border-radius: 6px; }
.contrib-fill.contrib-up { background: var(--positive); }
.contrib-fill.contrib-down { background: var(--danger); }
.contrib-val { font-variant-numeric: tabular-nums; font-size: 12px; text-align: right; }
.contrib-val.contrib-up { color: var(--positive); }
.contrib-val.contrib-down { color: var(--danger); }

/* Feedback global de carregamento — barra superior + spinner de botão (§19 UX).
   Cobre POST de formulário, navegação por link e requisições HTMX que demoram. */
#app-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 9999;
    overflow: hidden; opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease; background: rgba(59,130,246,0.14);
}
#app-progress.is-active { opacity: 1; box-shadow: 0 0 12px rgba(59,130,246,0.5); }
#app-progress::before {
    content: ""; position: absolute; top: 0; height: 100%; width: 38%; left: -38%;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
    animation: app-progress-slide 1.05s ease-in-out infinite;
}

/* ===== Spinner reutilizável (estados de carregamento inline) ===== */
.spinner {
    display: inline-block; width: 18px; height: 18px; vertical-align: middle;
    border: 2.5px solid var(--border); border-top-color: var(--accent);
    border-right-color: var(--accent-2); border-radius: 50%;
    animation: app-spin 0.7s linear infinite;
}
.spinner--lg { width: 34px; height: 34px; border-width: 3.5px; }
.spinner--sm { width: 13px; height: 13px; border-width: 2px; }
.loading-block {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 34px 16px; color: var(--muted); font-size: 13px; text-align: center;
}
.loading-inline { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.loading-block .spinner { border-top-color: var(--accent); }
/* pulsar suave do texto enquanto carrega */
.loading-block .lp, .loading-inline .lp { animation: app-loadpulse 1.4s ease-in-out infinite; }
@keyframes app-loadpulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 0.01ms; }
    .loading-block .lp, .loading-inline .lp { animation: none; }
}
@keyframes app-progress-slide { 0% { left: -38%; } 100% { left: 100%; } }

.btn.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.is-loading::after {
    content: ""; position: absolute; top: 50%; left: 50%; width: 15px; height: 15px;
    margin: -8px 0 0 -8px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
    animation: app-spin 0.6s linear infinite;
}
@keyframes app-spin { to { transform: rotate(360deg); } }

body.app.is-busy { cursor: progress; }

@media (prefers-reduced-motion: reduce) {
    #app-progress::before, .btn.is-loading::after { animation-duration: 0.01ms; }
}

/* ===== Command palette (Cmd-K) + trigger — docs/plano-navegabilidade.md ===== */
.topbar-search-btn {
    display: flex; align-items: center; gap: 8px; cursor: pointer; text-align: left;
    background: var(--bg-1); border: 1px solid var(--border); border-radius: 10px;
    padding: 0 10px; height: 38px; min-width: 300px; color: var(--muted);
    transition: border-color .12s, background .12s;
}
.topbar-search-btn:hover { border-color: var(--accent); background: var(--bg-2); }
.topbar-search-btn .ts-placeholder { flex: 1; font-size: 13px; }
.ts-kbd, .cmdk-kbd, .cmdk-foot kbd {
    font: 600 10px/1 ui-monospace, monospace; color: var(--muted);
    background: var(--bg-3); border: 1px solid var(--border); border-radius: 5px;
    padding: 3px 6px; white-space: nowrap;
}
@media (max-width: 1024px) { .topbar-search-btn { min-width: 0; }
    .topbar-search-btn .ts-placeholder, .ts-kbd { display: none; } }

.cmdk {
    position: fixed; inset: 0; z-index: 200; display: flex; justify-content: center;
    align-items: flex-start; padding-top: 12vh;
    background: rgba(3, 7, 18, 0.62); backdrop-filter: blur(3px);
}
.cmdk-box {
    width: min(640px, 92vw); max-height: 68vh; display: flex; flex-direction: column;
    background: var(--bg-1); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.7); overflow: hidden;
}
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px;
    border-bottom: 1px solid var(--border); }
.cmdk-input .nav-ic { width: 18px; height: 18px; color: var(--muted); flex: none; }
.cmdk-input input { flex: 1; background: transparent; border: 0; outline: none;
    color: var(--text-0); font-size: 15px; }
.cmdk-input input::placeholder { color: var(--muted); }
.cmdk-results { overflow-y: auto; padding: 6px; }
.cmdk-group { margin-bottom: 4px; }
.cmdk-glabel { font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); padding: 8px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    border-radius: 9px; text-decoration: none; color: var(--text-0); }
.cmdk-item.is-active { background: var(--bg-3); }
.cmdk-badge { font: 700 9px/1 ui-monospace, monospace; text-transform: uppercase;
    letter-spacing: .03em; padding: 3px 6px; border-radius: 5px; flex: none;
    background: var(--bg-3); color: var(--muted); min-width: 34px; text-align: center; }
.cmdk-badge.cb-processo { background: rgba(96,165,250,.16); color: #bcd7ff; }
.cmdk-badge.cb-oportunidade { background: rgba(52,211,153,.16); color: #a7f3cf; }
.cmdk-badge.cb-cliente { background: rgba(251,191,36,.16); color: #fcd9a3; }
.cmdk-badge.cb-documento { background: rgba(167,139,250,.18); color: #d6c9ff; }
.cmdk-text { display: flex; flex-direction: column; min-width: 0; }
.cmdk-title { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-empty { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.cmdk-foot { display: flex; gap: 14px; align-items: center; padding: 8px 14px;
    border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }
.cmdk-foot .cmdk-brand { margin-left: auto; font-weight: 600; opacity: .7; }

/* ===== Breadcrumbs (QW2) ===== */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
    padding: 12px 28px 0; font-size: 12px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs .crumb-sep { opacity: .5; }
.crumbs .crumb-cur { color: var(--text-1); font-weight: 500; }
@media (max-width: 1024px) { .crumbs { padding: 10px 16px 0; } }

/* ===== Skeleton loaders (QW3) ===== */
@keyframes sk-shimmer { 0% { background-position: -420px 0; } 100% { background-position: 420px 0; } }
.skeleton {
    background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
    background-size: 840px 100%; animation: sk-shimmer 1.3s infinite linear; border-radius: 8px;
    display: block;
}
/* Placeholder animado enquanto o ECharts não pintou o canvas (auto-some com :has). */
.dash-chart:not(:has(canvas)):not(:has(svg)) { position: relative; }
.dash-chart:not(:has(canvas)):not(:has(svg))::after {
    content: ""; position: absolute; inset: 6px; border-radius: 8px;
    background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
    background-size: 840px 100%; animation: sk-shimmer 1.3s infinite linear;
}
.notif-sk { padding: 6px; }
.notif-sk .skeleton { height: 40px; margin: 8px 6px; }

/* ===== Acessibilidade WCAG AA (ST4) ===== */
/* Foco visível por teclado (não aparece em clique de mouse). */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }
a.skip-link {
    position: fixed; top: 8px; left: 8px; z-index: 300; transform: translateY(-160%);
    background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 8px;
    font-size: 13px; font-weight: 600; text-decoration: none; transition: transform .15s;
}
a.skip-link:focus { transform: translateY(0); }

/* ===== Fixados / pinning (ST3) ===== */
.nav-label--static { cursor: default; color: var(--accent-2); opacity: 1; }
.nav-label--static:hover { background: transparent; }
.pin-btn.is-pinned { color: var(--warning); border-color: var(--warning); }
.pin-item { position: relative; }
.pin-item .pin-x { position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: transparent; border: 0; color: var(--muted); font-size: 15px; line-height: 1;
    cursor: pointer; padding: 2px 5px; border-radius: 6px; opacity: 0; transition: opacity .12s, color .12s; }
.pin-item:hover .pin-x { opacity: 1; }
.pin-item .pin-x:hover { color: var(--danger); background: var(--bg-2); }

/* ===== Rodapé + páginas legais ===== */
.footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 26px; }
.footer-links { display: flex; gap: 14px; }
.footer-links a, .legal-nav a { color: var(--muted); text-decoration: none; font-size: 12px; }
.footer-links a:hover, .legal-nav a:hover { color: var(--accent); }
.legal-body { background: radial-gradient(1000px 500px at 80% -10%, #14203a 0%, var(--bg-0) 55%); }
.legal-wrap { max-width: 860px; margin: 0 auto; padding: 28px 20px 48px; }
.legal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.legal-head .brand { text-decoration: none; }
.legal-card { padding: 34px 38px; }
.legal-h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.01em; }
.legal-updated { color: var(--muted); font-size: 12px; margin: 0 0 4px; }
.legal-card h2 { font-size: 16px; margin: 24px 0 8px; color: var(--text-0); }
.legal-card p, .legal-card li { color: var(--text-1); line-height: 1.7; font-size: 14px; }
.legal-card ul { padding-left: 20px; }
.legal-card a { color: var(--accent); }
.legal-foot { margin-top: 26px; text-align: center; }
.legal-nav { display: flex; gap: 18px; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }
@media (max-width: 640px) { .legal-card { padding: 22px 18px; } }

/* ===== Modal de ajuda (atalhos ?) ===== */
.help-box { width: min(560px, 92vw); }
.help-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.help-head h2 { margin: 0; font-size: 15px; }
.help-close { background: var(--bg-3); border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 3px 9px; font-size: 11px; cursor: pointer; }
.help-grid { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; padding: 16px 20px; align-items: center; }
.help-keys { display: flex; align-items: center; gap: 5px; justify-content: flex-end; white-space: nowrap; }
.help-keys kbd { font: 600 11px/1 ui-monospace, monospace; color: var(--text-1); background: var(--bg-3); border: 1px solid var(--border); border-radius: 5px; padding: 4px 7px; }
.help-or { color: var(--muted); font-size: 11px; }
.help-desc { color: var(--text-1); font-size: 13px; }

/* Fix: atributo hidden precisa vencer .cmdk{display:flex} */
.cmdk[hidden] { display: none !important; }

/* Indicador de tendência 24h nos KPIs da central de comando */
.cmd-trend { font-size: 11px; font-weight: 700; color: var(--positive);
  background: rgba(52,211,153,.12); border-radius: 5px; padding: 2px 6px;
  margin-left: 6px; vertical-align: middle; letter-spacing: .01em; }

/* ============================================================================
   Explicabilidade / "hidden school" — tooltips no hover + explicador de painel.
   Padrão da plataforma: todo dashboard explica o que é, como usar e como ler.
   ============================================================================ */

/* Ícone de ajuda ⓘ (macro h.tip) — gatilho de tooltip inline, focável por teclado */
.tipi {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; margin-left: 4px; border-radius: 50%;
    font-size: 10px; font-weight: 700; font-style: normal; line-height: 1;
    color: var(--muted); border: 1px solid var(--border);
    background: var(--bg-3); cursor: help; vertical-align: middle;
    user-select: none; transition: color .15s, border-color .15s, background .15s;
}
.tipi:hover, .tipi:focus-visible {
    color: var(--accent); border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, var(--bg-3)); outline: none;
}
/* qualquer elemento explicável ganha um leve affordance ao passar o mouse */
[data-tip] { cursor: help; }
th[data-tip], .kpi-label[data-tip], label[data-tip] {
    text-decoration: underline dotted color-mix(in srgb, var(--muted) 60%, transparent);
    text-underline-offset: 3px;
}

/* Popover flutuante (injetado por tooltips.js) */
.tip-pop {
    position: absolute; z-index: 9999; display: none; max-width: 300px;
    padding: 9px 12px; border-radius: 10px; font-size: 12px; line-height: 1.5;
    color: var(--text-0); background: var(--bg-3);
    border: 1px solid var(--border);
    box-shadow: 0 10px 34px rgba(0,0,0,.5); pointer-events: none;
    opacity: 0; transform: translateY(3px); transition: opacity .14s ease, transform .14s ease;
    white-space: normal; text-align: left;
}
.tip-pop.is-shown { opacity: 1; transform: translateY(0); }
.tip-pop::after {
    content: ""; position: absolute; left: var(--tip-arrow, 50%); bottom: -5px;
    width: 9px; height: 9px; background: var(--bg-3);
    border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
    transform: translateX(-50%) rotate(45deg);
}
.tip-pop.tip-below::after { bottom: auto; top: -5px; transform: translateX(-50%) rotate(225deg); }
@media (prefers-reduced-motion: reduce) {
    .tip-pop { transition: none; transform: none; }
    .tip-pop.is-shown { transform: none; }
}

/* Explicador de painel (macro h.explainer) — "O que é / Como usar / Como interpretar" */
.dash-explain {
    background: linear-gradient(155deg, var(--bg-2), var(--bg-1));
    border: 1px solid var(--border); border-left: 3px solid var(--accent);
    border-radius: 12px; margin-bottom: 16px; overflow: hidden;
}
.dash-explain > summary {
    list-style: none; cursor: pointer; padding: 11px 15px;
    font-size: 12.5px; font-weight: 600; color: var(--text-0);
    display: flex; align-items: center; gap: 8px; user-select: none;
}
.dash-explain > summary::-webkit-details-marker { display: none; }
.dash-explain > summary .de-ic {
    display: inline-flex; align-items: center; justify-content: center;
    width: 17px; height: 17px; border-radius: 50%; font-size: 11px; font-weight: 800;
    color: #fff; background: var(--accent); flex: none;
}
.dash-explain > summary .de-chev { margin-left: auto; color: var(--muted); font-size: 11px; transition: transform .18s; }
.dash-explain[open] > summary .de-chev { transform: rotate(180deg); }
.dash-explain .de-body {
    padding: 4px 15px 15px; display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.dash-explain .de-item { font-size: 12px; color: var(--text-1); line-height: 1.55; }
.dash-explain .de-item b {
    display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); margin-bottom: 3px; font-weight: 700;
}
.dash-explain .de-item p { margin: 0; }
.dash-explain .de-tip {
    grid-column: 1 / -1; font-size: 11.5px; color: var(--text-1);
    background: color-mix(in srgb, var(--accent) 9%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: 8px; padding: 8px 11px; line-height: 1.5;
}

/* ── Seletor de instituição (multi-tenant, platform-admin) ───────────────── */
.tenant-switch { position: relative; }
.tenant-switch-btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 38px; padding: 0 10px; border-radius: 10px;
    background: var(--bg-2); border: 1px solid var(--border);
    color: var(--text-0); cursor: pointer; font-weight: 600; font-size: 13px;
    transition: background .15s, border-color .15s;
}
.tenant-switch-btn:hover, .tenant-switch-btn.is-open { background: var(--bg-3); border-color: var(--accent); }
.tenant-switch-logo { height: 20px; width: auto; max-width: 60px; background: #fff; border-radius: 4px; padding: 2px 4px; }
.tenant-switch-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-switch-btn .nav-chev { width: 14px; height: 14px; opacity: .7; }
.tenant-switch-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
    min-width: 240px; background: var(--bg-1); border: 1px solid var(--border);
    border-radius: 12px; padding: 6px; box-shadow: 0 18px 40px -12px rgba(0,0,0,.6);
}
.tsm-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 6px 10px 4px; }
.tsm-form { margin: 0; }
.tsm-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 10px; border-radius: 8px; border: 0; background: transparent;
    color: var(--text-1); cursor: pointer; font-size: 13px; font-weight: 600; text-align: left;
    transition: background .12s, color .12s;
}
.tsm-item:hover { background: var(--bg-2); color: var(--text-0); }
.tsm-item.is-current { color: var(--text-0); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tsm-logo { height: 22px; width: auto; max-width: 64px; background: #fff; border-radius: 4px; padding: 2px 5px; }
.tsm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); flex: 0 0 auto; }
.tsm-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsm-check { width: 16px; height: 16px; color: var(--accent-2); }
@media (max-width: 1024px) { .tenant-switch-name { display: none; } .tenant-switch-btn { padding: 0 8px; } }
