:root {
    --bg: #0e1116;
    --surface: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --muted: #8b949e;
    --primary: #2f81f7;
    --primary-hover: #1f6feb;
    --danger: #f85149;
    --success: #3fb950;
    --radius: 6px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.app-header .brand {
    color: var(--text);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.app-header .brand-logo {
    height: 28px;
    width: auto;
    display: block;
}

.app-nav {
    display: flex;
    gap: 16px;
}

.app-main {
    max-width: 920px;
    margin: 0 auto;
    padding: 48px 24px;
}

.app-footer {
    text-align: center;
    padding: 24px;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

.app-footer small {
    display: block;
}

.app-footer-links {
    margin-top: 6px;
    font-size: 11px;
}

.app-footer-links a {
    color: var(--muted);
    text-decoration: none;
}

.app-footer-links a:hover {
    color: var(--text);
    text-decoration: underline;
}

.app-footer-corp {
    margin-top: 4px;
    font-size: 10px;
    color: var(--muted);
    opacity: 0.7;
}

.hero h1 {
    font-size: 44px;
    margin-bottom: 8px;
}

.hero .lead {
    font-size: 18px;
    margin: 0 0 4px;
}

.hero .muted, .muted {
    color: var(--muted);
}

.actions {
    margin-top: 28px;
    display: flex;
    gap: 12px;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
}

.btn:hover { text-decoration: none; border-color: var(--muted); }

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

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

.error-page h1 {
    font-size: 64px;
    margin: 0;
    color: var(--danger);
}

.auth-page {
    max-width: 480px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-row .form-group { flex: 1; margin-bottom: 0; }
.form-row .form-group.form-group-grow { flex: 3; }

.form label,
.form-group > label {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.form input:not([type="checkbox"]):not([type="radio"]),
.form select,
.form textarea,
.form-group > input:not([type="checkbox"]):not([type="radio"]),
.form-group > select,
.form-group > textarea {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    min-height: 36px;
    box-sizing: border-box;
    width: 100%;
}

.form input:not([type="checkbox"]):not([type="radio"]):focus,
.form select:focus,
.form textarea:focus,
.form-group > input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group > select:focus,
.form-group > textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(47, 129, 247, 0.18);
}

.mode-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin: 16px 0;
}

.mode-fieldset legend {
    color: var(--muted);
    font-size: 13px;
    padding: 0 6px;
}

.radio-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    cursor: pointer;
}

.entidade-fields {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 16px;
}

.entidade-fields h3 {
    font-size: 14px;
    color: var(--muted);
    margin: 0 0 12px;
}

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

.form-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 12px;
}

.hidden { display: none; }

.btn.link {
    background: transparent;
    border: none;
    color: var(--primary);
    padding: 8px 0;
}

.btn.link:hover { text-decoration: underline; }

.picker-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.picker-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    background: var(--surface);
}

.picker-item-main {
    display: flex;
    flex-direction: column;
}

.picker-item-main .muted {
    font-size: 12px;
    margin-top: 2px;
}

.entidade-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.entidade-header h2 { margin: 0; }
.entidade-header .muted { font-size: 14px; font-weight: normal; }

.classify-input h3, .classify-history h3 {
    margin: 24px 0 8px;
    font-size: 16px;
}

.classify-input textarea {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.classification-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-top: 18px;
}

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

.classification-card h3 { margin: 0; font-size: 16px; }

.classification-card .rationale {
    color: var(--muted);
    font-style: italic;
    margin: 8px 0 12px;
    font-size: 14px;
}

.classification-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.classification-table th, .classification-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.classification-table th {
    color: var(--muted);
    font-weight: normal;
    width: 30%;
}

.classification-table .section-header {
    color: var(--text);
    font-weight: bold;
    background: rgba(255,255,255,0.03);
    padding-top: 10px;
}

.classification-table code {
    background: rgba(47, 129, 247, 0.12);
    padding: 1px 6px;
    border-radius: 3px;
    color: var(--primary);
}

.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--border);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge-suggested { background: #3b3a1f; color: #e3b341; }
.badge-accepted  { background: #14361f; color: var(--success); }
.badge-corrected { background: #1c2d4a; color: var(--primary); }
.badge-rejected  { background: #3a1d1d; color: var(--danger); }

.citacoes {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.citacoes summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 13px;
}

.citacoes ul {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
}

.citacoes li {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border);
}

.citacoes .trecho {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-list li {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.history-list .hist-desc { color: var(--text); }
.history-list .muted { font-size: 12px; }

.app-link {
    color: var(--text);
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 14px;
}

.app-link:hover { background: rgba(255,255,255,0.06); text-decoration: none; }

.app-nav .spacer { flex: 1; }
.app-nav { gap: 8px; align-items: center; }

.entidade-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.upload-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin: 18px 0;
}

.upload-section h3 { margin: 0 0 8px; font-size: 16px; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.data-table th, .data-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.data-table th {
    color: var(--muted);
    font-weight: normal;
    background: rgba(255,255,255,0.03);
}

.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.badge-queued    { background: #2a3f5a; color: #79b8ff; }
.badge-parsing   { background: #3b3a1f; color: #e3b341; }
.badge-rules     { background: #1c2d4a; color: var(--primary); }
.badge-done      { background: #14361f; color: var(--success); }
.badge-failed    { background: #3a1d1d; color: var(--danger); }
.badge-open      { background: #3a1d1d; color: var(--danger); }
.badge-dismissed { background: rgba(255,255,255,0.06); color: var(--muted); }
.badge-resolved  { background: #14361f; color: var(--success); }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    max-width: 720px;
    width: 92%;
    max-height: 88vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { margin: 0; }

.mapping-row {
    align-items: center;
}

.mapping-row .form-group { flex: 1; margin-bottom: 8px; }
.mapping-row .remove-mapping { white-space: nowrap; }

.error-list {
    list-style: none;
    padding: 0;
    margin: 8px 0;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 12px;
    color: var(--muted);
    max-height: 280px;
    overflow: auto;
}

.error-list li {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
}

.filters-bar {
    display: flex;
    gap: 16px;
    margin: 16px 0;
    align-items: center;
    flex-wrap: wrap;
}

.filters-bar label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: var(--muted);
    gap: 4px;
}

.filters-bar select {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    font-size: 13px;
}

.sev-high   { background: #3a1d1d; color: var(--danger); }
.sev-medium { background: #3b3a1f; color: #e3b341; }
.sev-low    { background: #2a3f5a; color: #79b8ff; }

.metadata-pre {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    font-size: 11px;
    overflow: auto;
    max-height: 240px;
    color: var(--muted);
}

.explain-box {
    background: rgba(47, 129, 247, 0.06);
    border: 1px solid rgba(47, 129, 247, 0.25);
    border-radius: var(--radius);
    padding: 14px;
    margin: 16px 0;
}

.explain-box header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    font-size: 13px;
}

.explain-box p {
    margin: 6px 0 8px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
}

.explain-box-empty {
    margin: 14px 0;
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 12px;
}

.indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.indicator-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: var(--radius);
    padding: 14px 16px;
}

.indicator-card.status-ok      { border-left-color: var(--success); }
.indicator-card.status-warning { border-left-color: #e3b341; }
.indicator-card.status-danger  { border-left-color: var(--danger); }
.indicator-card.status-neutral { border-left-color: var(--border); }

.ind-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.ind-value { font-size: 28px; font-weight: 600; margin: 4px 0; }
.ind-meta { font-size: 11px; }
.ind-delta { font-size: 12px; margin-top: 6px; }

.delta-warn { color: #e3b341; }
.delta-good { color: var(--success); }

.pct-ok        { color: var(--success); }
.pct-warning   { color: #e3b341; }
.pct-over-max  { color: var(--danger); font-weight: 600; }
.pct-under-min { color: var(--danger); font-weight: 600; }

.alert-list {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}

.alert-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    background: var(--surface);
}

.alert-item.alert-closed { opacity: 0.6; }
.alert-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.alert-body strong { font-size: 14px; }
.alert-body .muted { font-size: 13px; }

.header-meta { display: flex; gap: 12px; align-items: center; }

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 16px 0 8px;
}

.juris-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 12px;
}

.juris-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    font-size: 12px;
}

.juris-score { font-family: ui-monospace, SFMono-Regular, monospace; }

.juris-titulo { margin: 4px 0; font-size: 15px; line-height: 1.4; }

.juris-meta { font-size: 12px; margin: 4px 0 8px; }

.juris-trecho { font-size: 13px; line-height: 1.5; margin: 6px 0; }

.juris-foot { display: flex; gap: 14px; margin-top: 8px; font-size: 13px; }

.juris-full { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }

.parecer-editor {
    margin: 18px 0;
}

.editor-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
}

.minuta-textarea {
    width: 100%;
    min-height: 600px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 18px 20px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 13.5px;
    line-height: 1.65;
    resize: vertical;
}

.minuta-textarea[readonly] {
    opacity: 0.85;
    background: rgba(255,255,255,0.02);
}

.parecer-meta-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

.parecer-meta-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.parecer-meta-block summary {
    cursor: pointer;
    font-size: 14px;
    color: var(--muted);
}

.parecer-meta-block[open] summary { color: var(--text); margin-bottom: 8px; }

.cit-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}

.cit-list li {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border);
}

.cit-list .trecho {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.versao-block {
    border-top: 1px dashed var(--border);
    padding-top: 10px;
    margin-top: 10px;
}

.versao-block header { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* === Relatórios fiscais === */

.rf-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.rf-narrativa {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid #5b8def;
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 16px 0;
}

.rf-narrativa h3 { margin: 0 0 8px; font-size: 15px; }
.rf-narrativa-empty { border-left-color: var(--border); }
.narrativa-text { white-space: pre-wrap; line-height: 1.55; font-size: 14px; }

.rf-totais {
    margin: 16px 0;
}

.rf-totais .data-table th {
    text-align: left;
    width: 40%;
    color: var(--muted);
    font-weight: 500;
}

.rf-anexos { margin: 24px 0; }

.anexo-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 8px;
}

.anexo-block summary {
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.anexo-block[open] summary { margin-bottom: 12px; border-bottom: 1px dashed var(--border); padding-bottom: 8px; }

.anexo-body { font-size: 13px; line-height: 1.55; }
.anexo-body p { margin: 4px 0; }
.anexo-body blockquote { border-left: 2px solid var(--border); padding-left: 10px; color: var(--muted); margin: 8px 0; }

.md-table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    font-size: 13px;
}

.md-table td {
    border: 1px solid var(--border);
    padding: 4px 8px;
    vertical-align: top;
}

.md-table tr:first-child td { background: var(--bg); font-weight: 600; }

/* form do novo relatório */
.secao-rf {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 14px;
    background: var(--surface);
}

.secao-rf legend { font-weight: 600; padding: 0 6px; }
.secao-rf.hidden { display: none; }

.flag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 6px;
    margin: 10px 0 16px;
}

.flag-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

/* === Prestação de contas === */

.pc-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 14px 0 24px;
}

.pc-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}

.pc-card-num {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}

.pc-card-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
    letter-spacing: .02em;
}

.pc-card-warning { border-left: 3px solid #d99935; }
.pc-card-danger { border-left: 3px solid #d24747; }

.rf-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin: 16px 0;
}

.rf-tab {
    background: none;
    border: none;
    padding: 8px 14px;
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
    border-bottom: 2px solid transparent;
}

.rf-tab.active {
    color: var(--text);
    border-bottom-color: var(--accent, #5b8def);
    font-weight: 600;
}

.pc-section { margin: 18px 0 28px; }
.pc-section h3 { margin: 0 0 10px; font-size: 14px; letter-spacing: .03em; color: var(--muted); }

.pc-filtros {
    margin-bottom: 12px;
}

.pc-table small { display: block; }

.btn.small {
    padding: 4px 8px;
    font-size: 12px;
}

.evento-list { list-style: none; padding: 0; }
.evento-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 8px;
}
.evento-item p { margin: 6px 0; font-size: 13px; }

.badge.sev-medium { background: #d99935; color: #fff; }
.badge.muted-bg { background: var(--muted); color: #fff; }

/* === Balancete imports / preview === */

.upload-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin: 14px 0;
}

.periodos-grid {
    display: grid;
    gap: 14px;
    margin-top: 14px;
}

.periodo-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
}

.periodo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 8px;
}

.periodo-card-header h3 { margin: 0; font-size: 16px; }
.periodo-card .form-group small { display: block; margin-top: 4px; font-size: 11px; line-height: 1.3; }
.periodo-detalhe { margin: 10px 0; }
.periodo-detalhe summary { cursor: pointer; font-size: 13px; color: var(--muted); }

.periodo-status { font-size: 13px; }

.btn-group { display: flex; gap: 6px; }

/* === Console multi-entidade === */

.console-cards {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.console-filtros { margin: 16px 0 12px; }

.console-table tbody tr { cursor: pointer; }
.console-table tbody tr.status-danger td:first-child { border-left: 3px solid #d24747; }
.console-table tbody tr.status-warning td:first-child { border-left: 3px solid #d99935; }
.console-table tbody tr.status-ok td:first-child { border-left: 3px solid #3fa663; }
.console-table tbody tr.status-erro td:first-child { border-left: 3px solid var(--muted); }
.console-table .badge.badge-done { background: #3fa663; color: #fff; }
.console-table tbody tr:hover { background: var(--bg); }

/* === Tendências === */

.tendencia-section { margin-top: 12px; }

.tendencia-switcher {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.tendencia-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin: 14px 0 24px;
}

.tendencia-table th, .tendencia-table td { font-size: 13px; }

.sparkline {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin: 12px 0;
    color: var(--accent, #5b8def);
}

.sparkline svg { width: 100%; height: 60px; }

.tendencia-sintese { margin-top: 16px; }

/* === Console drawer === */

.console-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    max-width: 90vw;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 16px rgba(0, 0, 0, .08);
    z-index: 100;
    display: flex;
    flex-direction: column;
    animation: drawerSlide .2s ease-out;
}

@keyframes drawerSlide {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.console-drawer .drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.console-drawer .drawer-body {
    flex: 1;
    padding: 16px 18px;
    overflow-y: auto;
}

.console-drawer .drawer-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
}

.drawer-output { margin-top: 12px; }

.actions-cell { display: flex; gap: 4px; flex-wrap: wrap; }

/* === Benchmarking === */

.bench-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 14px 0;
}

/* === Console — dashboard executivo === */

.exec-section { margin: 20px 0; }
.exec-section h3 { font-size: 14px; letter-spacing: .03em; color: var(--muted); margin: 0 0 8px; }

.heatmap-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 12px;
}
.heatmap-table thead th {
    background: var(--bg);
    color: var(--muted);
    font-weight: 600;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}
.heatmap-table .hm-ent-col { text-align: left; min-width: 200px; }
.heatmap-table tbody td.hm-ent-col { padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--surface); }
.heatmap-table .hm-cell {
    text-align: center;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: #fff;
}
.heatmap-table .hm-ok { background: #3fa663; }
.heatmap-table .hm-warning { background: #d99935; }
.heatmap-table .hm-danger { background: #d24747; }
.heatmap-table .hm-empty { background: var(--bg); color: var(--muted); font-weight: 400; }

.exec-chart {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
}
.exec-chart svg { width: 100%; height: auto; display: block; }
.exec-legend-bar { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.exec-legend { display: inline-flex; align-items: center; gap: 4px; }
.exec-legend-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.exec-rank-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}
.exec-rank-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.exec-rank-card h4 { margin: 0 0 8px; font-size: 13px; }
.exec-rank-list { margin: 0; padding-left: 18px; font-size: 13px; }
.exec-rank-list li { padding: 2px 0; display: flex; justify-content: space-between; gap: 8px; }

/* === Chat-RAG === */

.chat-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    height: calc(100vh - 120px);
    min-height: 500px;
}

.chat-sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-sidebar-header {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.chat-sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}

.chat-sidebar-list li {
    padding: 10px 12px;
    border-bottom: 1px dashed var(--border);
    cursor: pointer;
    font-size: 13px;
}

.chat-sidebar-list li:hover { background: var(--bg); }
.chat-sidebar-list li.active { background: var(--bg); border-left: 3px solid var(--accent, #5b8def); }

.chat-main {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-empty {
    padding: 40px 28px;
    max-width: 600px;
}

.chat-thread-header {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg-placeholder { padding: 20px; text-align: center; }

.chat-msg {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.5;
}

.chat-msg-user {
    background: var(--accent, #5b8def);
    color: #fff;
    align-self: flex-end;
}

.chat-msg-assistant {
    background: var(--bg);
    align-self: flex-start;
    color: var(--text);
}

.chat-msg-content { white-space: pre-wrap; word-wrap: break-word; }
.chat-msg-meta { font-size: 11px; margin-top: 6px; }

.chat-msg-citacoes {
    margin-top: 8px;
    font-size: 12px;
}
.chat-msg-citacoes summary { cursor: pointer; color: var(--muted); }
.chat-msg-citacoes h5 { margin: 8px 0 4px; font-size: 12px; color: var(--muted); }
.chat-msg-citacoes ol { padding-left: 18px; margin: 0; }
.chat-msg-citacoes li { margin-bottom: 6px; }
.chat-msg-citacoes p { margin: 2px 0 0; font-style: italic; color: #555; }

.chat-msg-loading { opacity: 0.7; }

.chat-form {
    border-top: 1px solid var(--border);
    padding: 10px 14px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-form textarea {
    flex: 1;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    font-family: inherit;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
}

/* === Audit log === */

.audit-resumo {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 12px 0;
    font-size: 12px;
}
.audit-resumo p { margin: 4px 0; }

/* === Conciliação === */

.classify-row {
    background: var(--bg);
    font-size: 12px;
    padding: 6px 12px;
}

/* === vigiaUI: modais + toasts === */

.vigia-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.18s ease-out;
    padding: 16px;
}

.vigia-modal-overlay.vigia-modal-open { opacity: 1; }

.vigia-modal {
    background: var(--surface);
    border-radius: 10px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 460px;
    overflow: hidden;
    transform: translateY(8px) scale(0.98);
    transition: transform 0.18s ease-out;
}

.vigia-modal-overlay.vigia-modal-open .vigia-modal {
    transform: translateY(0) scale(1);
}

.vigia-modal-header {
    padding: 18px 22px 8px;
    border-bottom: 1px solid var(--border);
}

.vigia-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text);
}

.vigia-modal-body {
    padding: 18px 22px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
}

.vigia-modal-body p { margin: 0 0 4px; }

.vigia-modal-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.vigia-modal .btn.danger {
    background: #d24747;
    color: #fff;
    border-color: #d24747;
}
.vigia-modal .btn.danger:hover { background: #c03838; }

.vigia-prompt-label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.vigia-prompt-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
}

.vigia-prompt-input:focus { outline: 2px solid #5b8def; outline-offset: -2px; }
.vigia-input-error { border-color: #d24747; }

#vigia-toast-root {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 300;
    pointer-events: none;
}

.vigia-toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--muted);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.22s ease-out, transform 0.22s ease-out;
    max-width: 360px;
}

.vigia-toast.vigia-toast-open { opacity: 1; transform: translateX(0); }

.vigia-toast-success { border-left-color: #3fa663; }
.vigia-toast-warn { border-left-color: #d99935; }
.vigia-toast-error { border-left-color: #d24747; }
.vigia-toast-info { border-left-color: #5b8def; }

/* === Folhas === */

.form-warn {
    background: #fff8e6;
    border: 1px solid #d99935;
    color: #8a5a00;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    margin: 8px 0;
}

/* === Landing page === */

.landing-hero {
    margin: -48px -24px 0;
    padding: 80px 24px 100px;
    background:
        radial-gradient(circle at 20% 20%, rgba(47, 129, 247, 0.18), transparent 50%),
        radial-gradient(circle at 80% 30%, rgba(63, 166, 99, 0.12), transparent 50%),
        linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}

.landing-hero-inner {
    max-width: 820px;
    margin: 0 auto;
    text-align: center;
}

.landing-eyebrow {
    display: inline-block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary);
    background: rgba(47, 129, 247, 0.12);
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 20px;
    font-weight: 600;
}

.landing-title {
    font-size: 52px;
    line-height: 1.1;
    margin: 0 0 16px;
    color: var(--text);
    letter-spacing: -1px;
    font-weight: 700;
}

.landing-lead {
    font-size: 17px;
    line-height: 1.6;
    color: var(--muted);
    max-width: 640px;
    margin: 0 auto 32px;
}

.landing-cta {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
}

.landing-features {
    padding: 80px 0;
}

.landing-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.landing-feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 24px;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.landing-feature:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.landing-feature-icon {
    font-size: 28px;
    margin-bottom: 12px;
}

.landing-feature h3 {
    margin: 0 0 8px;
    font-size: 17px;
    color: var(--text);
}

.landing-feature p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.landing-cta-bottom {
    margin: 0 -24px;
    padding: 70px 24px;
    text-align: center;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.landing-cta-bottom h2 {
    margin: 0 0 8px;
    font-size: 28px;
}

.landing-cta-bottom p {
    margin: 0 0 24px;
    font-size: 15px;
}

@media (max-width: 640px) {
    .landing-title { font-size: 36px; }
    .landing-lead { font-size: 15px; }
    .landing-hero { padding: 56px 24px 70px; }
    .landing-features { padding: 56px 0; }
    .landing-cta-bottom { padding: 56px 24px; }
}

/* === Páginas de autenticação (login / signup) com split === */

.auth-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin: -48px -24px;
    min-height: calc(100vh - 130px);
}

.auth-aside {
    background:
        radial-gradient(circle at 30% 20%, rgba(47, 129, 247, 0.25), transparent 60%),
        radial-gradient(circle at 70% 80%, rgba(63, 166, 99, 0.12), transparent 60%),
        var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 48px;
}

.auth-aside-inner {
    max-width: 420px;
    color: var(--text);
}

.auth-aside h2 {
    font-size: 32px;
    margin: 0 0 16px;
    line-height: 1.15;
    letter-spacing: -0.5px;
}

.auth-aside p {
    color: var(--muted);
    line-height: 1.6;
    margin: 0 0 24px;
}

.auth-bullets {
    list-style: none;
    padding: 0;
    margin: 0;
}

.auth-bullets li {
    padding: 8px 0;
    color: var(--text);
    font-size: 14px;
    border-bottom: 1px dashed var(--border);
}

.auth-bullets li:last-child { border-bottom: none; }

.auth-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 48px;
    background: var(--bg);
}

.auth-card .form,
.auth-card-header {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.auth-card-wide .form,
.auth-card-wide .auth-card-header {
    max-width: 520px;
}

.auth-card-header { margin-bottom: 24px; }
.auth-card-header h1 { margin: 0 0 6px; font-size: 28px; }
.auth-card-header p { margin: 0; }

.btn-block { display: block; width: 100%; text-align: center; }

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.auth-footer-link {
    text-align: center;
    margin-top: 14px;
    font-size: 13px;
}

.auth-footer-link a {
    color: var(--primary);
    font-weight: 600;
}

.form-section-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin: 24px 0 12px;
    font-weight: 600;
}

.form-section-title:first-child { margin-top: 0; }

.radio-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    margin-bottom: 8px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.radio-card:hover { border-color: var(--muted); }

.radio-card input[type="radio"] {
    margin-top: 2px;
    accent-color: var(--primary);
}

.radio-card:has(input:checked) {
    border-color: var(--primary);
    background: rgba(47, 129, 247, 0.05);
}

.radio-card-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.radio-card-content strong {
    font-size: 14px;
    color: var(--text);
}

.radio-card-content span {
    font-size: 12px;
}

@media (max-width: 880px) {
    .auth-split {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .auth-aside {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 48px 32px;
    }
    .auth-card { padding: 48px 32px; }
}

/* === Menu refatorado: grupos com dropdown + responsivo === */

.app-header {
    position: relative;
    flex-wrap: wrap;
    gap: 12px;
}

.app-nav {
    flex: 1;
    min-width: 0;
}

.app-nav .spacer { flex: 1; min-width: 16px; }

.nav-group {
    position: relative;
}

.nav-group-toggle {
    background: none;
    border: none;
    color: var(--text);
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.nav-group-toggle:hover { background: rgba(255,255,255,0.06); }
.nav-group-toggle[aria-expanded="true"] { background: rgba(255,255,255,0.08); }

.nav-group-caret {
    font-size: 10px;
    color: var(--muted);
    transition: transform 0.15s ease;
}

.nav-group-toggle[aria-expanded="true"] .nav-group-caret {
    transform: rotate(180deg);
}

.nav-group-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    padding: 6px;
    z-index: 80;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.nav-group.open > .nav-group-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-group-item {
    display: block;
    padding: 8px 12px;
    color: var(--text);
    font-size: 14px;
    border-radius: 4px;
    text-decoration: none;
}

.nav-group-item:hover {
    background: rgba(255,255,255,0.06);
    text-decoration: none;
}

.nav-group-item.hidden { display: none; }

/* === Hamburger mobile === */

.nav-hamburger {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
    margin-left: auto;
}

.nav-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-hamburger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.nav-hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.nav-hamburger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.nav-overlay.open {
    display: block;
    opacity: 1;
}

@media (max-width: 960px) {
    .app-header {
        padding: 12px 16px;
    }

    .nav-hamburger {
        display: flex;
    }

    .app-nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        background: var(--surface);
        border-left: 1px solid var(--border);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 64px 8px 24px;
        z-index: 100;
        transform: translateX(100%);
        transition: transform 0.2s ease-out;
        overflow-y: auto;
    }

    .app-nav.open {
        transform: translateX(0);
    }

    .app-nav .app-link,
    .app-nav .nav-group {
        width: 100%;
    }

    .app-nav .app-link {
        padding: 12px 14px;
        border-bottom: 1px solid var(--border);
        border-radius: 0;
    }

    .nav-group {
        border-bottom: 1px solid var(--border);
    }

    .nav-group-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 12px 14px;
        border-radius: 0;
        font-weight: 500;
    }

    .nav-group-menu {
        position: static;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0 0 8px 16px;
        opacity: 1;
        transform: none;
        pointer-events: auto;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.2s ease;
    }

    .nav-group.open > .nav-group-menu {
        max-height: 600px;
    }

    .nav-group-item {
        padding: 10px 14px;
        font-size: 13px;
        color: var(--muted);
    }

    .app-nav .spacer {
        display: none;
    }

    #nav-user {
        padding: 14px;
        font-size: 12px;
        border-top: 1px solid var(--border);
        margin-top: auto;
    }

    #logout-link {
        margin: 12px 14px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 10px 14px;
    }
    .app-header .brand-logo {
        height: 24px;
    }
    .app-main {
        padding: 24px 14px;
    }
}

/* === Tabelas responsivas (overflow horizontal) === */
@media (max-width: 720px) {
    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .pc-cards,
    .console-cards,
    .bench-cards,
    .tendencia-cards {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .entidade-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .header-meta {
        flex-wrap: wrap;
    }
}

/* === Página de apresentação === */

.apres-hero {
    margin: -48px -24px 0;
    padding: 80px 24px 80px;
    background:
        radial-gradient(circle at 20% 20%, rgba(47, 129, 247, 0.20), transparent 50%),
        radial-gradient(circle at 80% 30%, rgba(63, 166, 99, 0.10), transparent 50%),
        linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.apres-hero-inner {
    max-width: 800px;
    margin: 0 auto;
}

.apres-title {
    font-size: 44px;
    line-height: 1.1;
    margin: 16px 0 12px;
    letter-spacing: -1px;
    font-weight: 700;
}

.apres-lead {
    font-size: 16px;
    color: var(--muted);
    line-height: 1.6;
    margin: 0 auto 28px;
    max-width: 620px;
}

.apres-cta {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.apres-section {
    margin: 0 -24px;
    padding: 70px 24px;
    border-bottom: 1px solid var(--border);
}

.apres-section-alt {
    background: var(--surface);
}

.apres-positioning {
    margin: 0 -24px;
    padding: 56px 24px 64px;
    background: linear-gradient(180deg, rgba(47, 129, 247, 0.04) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
}

.apres-positioning-inner {
    max-width: 1080px;
    margin: 0 auto;
}

.apres-positioning-title {
    font-size: 28px;
    margin: 0 0 12px;
    color: var(--text);
    text-align: center;
}

.apres-positioning-lead {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
    text-align: center;
    max-width: 760px;
    margin: 0 auto 32px;
}

.apres-positioning-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.apres-positioning-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 26px;
}

.apres-positioning-card h3 {
    font-size: 16px;
    margin: 0 0 14px;
    letter-spacing: 0.02em;
}

.apres-positioning-yes {
    border-left: 3px solid var(--success, #4ec27d);
}

.apres-positioning-yes h3 {
    color: var(--success, #4ec27d);
}

.apres-positioning-no {
    border-left: 3px solid var(--danger, #d24747);
}

.apres-positioning-no h3 {
    color: var(--danger, #d24747);
}

.apres-positioning-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.apres-positioning-card li {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    padding: 7px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.apres-positioning-card li:first-child {
    border-top: none;
    padding-top: 0;
}

@media (max-width: 720px) {
    .apres-positioning-cols { grid-template-columns: 1fr; }
    .apres-positioning-title { font-size: 22px; }
}

.apres-coverage {
    margin: 0 -24px;
    padding: 56px 24px 64px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.apres-coverage-inner {
    max-width: 1080px;
    margin: 0 auto;
}

.apres-coverage-title,
.apres-coverage-subtitle {
    font-size: 24px;
    margin: 0 0 12px;
    color: var(--text);
    text-align: center;
}

.apres-coverage-subtitle {
    margin-top: 36px;
    font-size: 20px;
}

.apres-coverage-lead {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.65;
    text-align: center;
    max-width: 760px;
    margin: 0 auto 24px;
}

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

.apres-coverage-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px 24px;
}

.apres-coverage-tag {
    display: inline-block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(47, 129, 247, 0.12);
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.apres-coverage-card p {
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

@media (max-width: 880px) {
    .apres-coverage-grid { grid-template-columns: 1fr; }
}

/* Quando a página está em app-wide (apresentação), as bandas precisam
   estender até a borda do viewport — .app-main passa a ter padding de
   32px, então o margin negativo precisa acompanhar. */
body.app-wide .apres-hero,
body.app-wide .apres-positioning,
body.app-wide .apres-coverage,
body.app-wide .apres-section,
body.app-wide .apres-cta-final {
    margin-left: -32px;
    margin-right: -32px;
}

.apres-section .apres-content,
.apres-section .apres-video {
    max-width: 1020px;
    margin: 0 auto;
}

.apres-section .apres-content {
    margin-bottom: 28px;
}

.apres-badge {
    display: inline-block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary);
    background: rgba(47, 129, 247, 0.12);
    padding: 5px 12px;
    border-radius: 999px;
    margin-bottom: 14px;
    font-weight: 600;
}

.apres-section h2 {
    font-size: 30px;
    line-height: 1.2;
    margin: 0 0 14px;
    letter-spacing: -0.5px;
    font-weight: 700;
}

.apres-section p {
    font-size: 16px;
    line-height: 1.65;
    color: var(--muted);
    margin: 0 0 18px;
    max-width: 760px;
}

.apres-bullets {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 8px;
}

.apres-bullets li {
    padding: 8px 0 8px 24px;
    color: var(--text);
    font-size: 14px;
    position: relative;
    line-height: 1.5;
}

.apres-bullets li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 700;
}

.apres-video {
    background: #000;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    position: relative;
    aspect-ratio: 16 / 9;
}

.apres-video video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

.apres-time {
    display: block;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    margin-top: 10px;
    font-style: italic;
}

.apres-cta-final {
    margin: 0 -24px;
    padding: 80px 24px;
    text-align: center;
    background:
        radial-gradient(circle at 50% 0%, rgba(47, 129, 247, 0.15), transparent 60%),
        var(--surface);
}

.apres-cta-final h2 {
    font-size: 32px;
    margin: 0 0 8px;
}

.apres-cta-final p {
    margin: 0 0 24px;
}

@media (max-width: 760px) {
    .apres-title { font-size: 32px; }
    .apres-lead { font-size: 15px; }
    .apres-hero { padding: 56px 24px; }
    .apres-section { padding: 48px 24px; }
    .apres-section h2 { font-size: 24px; }
    .apres-section p { font-size: 15px; }
    .apres-cta-final { padding: 56px 24px; }
    .apres-cta-final h2 { font-size: 24px; }
}

/* === Layout largo para páginas que precisam (console, tabelas grandes) === */

body.app-wide .app-main {
    max-width: none;
    padding: 32px 32px;
}

body.app-wide .console-table {
    font-size: 13px;
}

body.app-wide .console-table td,
body.app-wide .console-table th {
    padding: 10px 12px;
}


body.app-wide .data-table {
    width: 100%;
}

@media (max-width: 960px) {
    body.app-wide .app-main {
        padding: 20px 16px;
    }
}

/* === Tom Select: override para tema dark do Vigia === */

.ts-wrapper {
    margin: 0;
}

.ts-wrapper .ts-control {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--radius) !important;
    padding: 6px 10px !important;
    box-shadow: none !important;
    min-height: 36px;
}

.ts-wrapper .ts-control input {
    color: var(--text) !important;
}

.ts-wrapper.focus .ts-control {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(47, 129, 247, 0.18) !important;
}

.ts-wrapper .ts-control > input::placeholder,
.ts-wrapper.has-items .ts-control > input::placeholder {
    color: var(--muted) !important;
}

.ts-dropdown {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
    border-radius: var(--radius) !important;
    margin-top: 2px;
}

.ts-dropdown .option {
    color: var(--text) !important;
    padding: 8px 12px !important;
}

.ts-dropdown .option:hover,
.ts-dropdown .active {
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--text) !important;
}

.ts-dropdown .selected,
.ts-dropdown .active.selected {
    background: rgba(47, 129, 247, 0.15) !important;
}

.ts-dropdown .no-results {
    color: var(--muted) !important;
    padding: 10px 12px !important;
    font-style: italic;
}

.ts-dropdown .optgroup-header {
    color: var(--muted) !important;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 12px 4px;
}

.ts-wrapper .ts-control .item {
    color: var(--text) !important;
}

.ts-wrapper.single .ts-control:after {
    border-top-color: var(--muted) !important;
}

.ts-wrapper.disabled .ts-control {
    opacity: 0.6;
    background: var(--bg) !important;
}

/* === Apresentação: título de resumo após o vídeo === */

.apres-summary-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin: 24px 0 12px;
    font-weight: 600;
}

/* === Console: ajustes finos da tabela === */

.console-table {
    table-layout: auto;
}

.console-table th.col-status,
.console-table tbody td:first-child {
    width: 70px;
    text-align: center;
}

.console-table th.col-pct,
.console-table th.col-num {
    text-align: center;
}

.console-table th.col-actions {
    width: 160px;
    text-align: right;
}

.console-table tbody td.actions-cell {
    display: table-cell;
    text-align: right;
    width: 160px;
    white-space: nowrap;
    vertical-align: middle;
}

.console-table .actions-cell .btn {
    display: inline-block;
    margin-left: 4px;
}

/* === Seletor de entidade inline (pra páginas tenant-scoped sem contexto) === */

.entidade-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.entidade-picker-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
    cursor: pointer;
    text-align: left;
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.entidade-picker-card:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    background: rgba(47, 129, 247, 0.06);
}

.entidade-picker-card.loading {
    opacity: 0.6;
    cursor: wait;
}

.entidade-picker-card strong {
    font-size: 15px;
    color: var(--text);
}

.entidade-picker-meta {
    font-size: 12px;
    color: var(--muted);
}

/* === Página de preços (/precos) === */

.precos-hero {
    margin: 0 -24px;
    padding: 80px 24px 56px;
    text-align: center;
    background:
        radial-gradient(circle at 20% 20%, rgba(47, 129, 247, 0.18), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(63, 166, 99, 0.10), transparent 60%),
        var(--surface);
    border-bottom: 1px solid var(--border);
}

.precos-hero-inner {
    max-width: 720px;
    margin: 0 auto;
}

.precos-title {
    font-size: 36px;
    margin: 14px 0 16px;
    color: var(--text);
    line-height: 1.15;
    letter-spacing: -0.5px;
}

.precos-lead {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
    margin: 0;
}

.precos-plans {
    padding: 56px 0 16px;
    background: var(--bg);
}

.precos-plans-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}

.precos-plans-section-title {
    font-size: 22px;
    color: var(--text);
    text-align: center;
    margin: 0 0 28px;
    font-weight: 700;
}

.precos-plans-section-title-secondary {
    margin-top: 56px;
    padding-top: 48px;
    border-top: 1px solid var(--border);
}

.precos-plans-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: stretch;
    margin-bottom: 24px;
}

.precos-plan {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.precos-plan-featured {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.18);
    transform: translateY(-8px);
}

.precos-plan-header {
    margin-bottom: 18px;
}

.precos-plan-tag {
    display: inline-block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(47, 129, 247, 0.12);
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 12px;
}

.precos-plan-badge {
    position: absolute;
    top: -14px;
    right: 16px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 999px;
}

.precos-plan-price {
    font-size: 40px;
    margin: 0 0 6px;
    color: var(--text);
    font-weight: 800;
    letter-spacing: -1px;
}

.precos-plan-period {
    font-size: 16px;
    font-weight: 400;
    color: var(--muted);
    margin-left: 4px;
}

.precos-plan-sub {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
    margin: 0;
}

.precos-plan-features {
    list-style: none;
    padding: 0;
    margin: 22px 0 28px;
    flex: 1;
}

.precos-plan-features li {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.precos-plan-features li:first-child {
    border-top: none;
    padding-top: 0;
}

.precos-plan-features li.muted-feature {
    color: var(--muted);
    font-size: 13px;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.precos-enterprise {
    padding: 56px 24px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.precos-enterprise-inner {
    max-width: 720px;
    margin: 0 auto;
}

.precos-enterprise h2 {
    font-size: 24px;
    margin: 0 0 12px;
    color: var(--text);
}

.precos-enterprise p {
    color: var(--muted);
    line-height: 1.65;
    margin: 0 0 24px;
    font-size: 15px;
}

.precos-enterprise-cta {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.precos-faq {
    padding: 56px 24px;
    background: var(--bg);
}

.precos-faq-inner {
    max-width: 820px;
    margin: 0 auto;
}

.precos-faq-title {
    font-size: 24px;
    margin: 0 0 28px;
    color: var(--text);
    text-align: center;
}

.precos-faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0;
    margin-bottom: 10px;
}

.precos-faq-item summary {
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    padding: 16px 20px;
    list-style: none;
    position: relative;
    padding-right: 40px;
}

.precos-faq-item summary::after {
    content: '+';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--muted);
}

.precos-faq-item[open] summary::after {
    content: '−';
}

.precos-faq-item p {
    padding: 0 20px 18px;
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
    font-size: 14px;
}

.precos-cta-final {
    padding: 80px 24px;
    text-align: center;
    background:
        radial-gradient(circle at 50% 0%, rgba(47, 129, 247, 0.15), transparent 60%),
        var(--surface);
}

.precos-cta-final h2 {
    font-size: 28px;
    margin: 0 0 12px;
    color: var(--text);
}

.precos-cta-final p {
    color: var(--muted);
    margin: 0 0 24px;
}

@media (max-width: 880px) {
    .precos-plans-grid { grid-template-columns: 1fr; max-width: 480px; }
    .precos-plan-featured { transform: none; }
    .precos-title { font-size: 28px; }
}

body.app-wide .precos-hero,
body.app-wide .precos-enterprise,
body.app-wide .precos-cta-final {
    margin-left: -32px;
    margin-right: -32px;
}

/* === Páginas legais (Termos de uso, Política de privacidade) === */

.legal-page {
    padding: 64px 0;
    background: var(--bg);
}

.legal-page-inner {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 24px;
}

.legal-header {
    margin-bottom: 36px;
    text-align: center;
}

.legal-header h1 {
    font-size: 36px;
    margin: 14px 0 8px;
    color: var(--text);
    letter-spacing: -0.5px;
}

.legal-toc {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 24px;
    margin-bottom: 40px;
}

.legal-toc p {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
}

.legal-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 2;
    column-gap: 24px;
    font-size: 13px;
}

.legal-toc li {
    padding: 3px 0;
    color: var(--muted);
    break-inside: avoid;
}

.legal-content h2 {
    font-size: 22px;
    margin: 40px 0 14px;
    color: var(--text);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.legal-entity {
    background: var(--surface);
    border-left: 3px solid var(--primary);
    padding: 12px 18px;
    margin: 14px 0;
    border-radius: 0 6px 6px 0;
    line-height: 1.7;
    font-size: 14px;
}

.legal-content h3 {
    font-size: 16px;
    margin: 24px 0 10px;
    color: var(--text);
}

.legal-content p {
    color: var(--text);
    line-height: 1.7;
    margin: 0 0 12px;
    font-size: 15px;
}

.legal-content ul {
    margin: 8px 0 16px 0;
    padding-left: 24px;
    color: var(--text);
    line-height: 1.7;
    font-size: 15px;
}

.legal-content ul li {
    margin: 4px 0;
}

.legal-content a {
    color: var(--primary);
}

.legal-content code {
    background: rgba(47, 129, 247, 0.12);
    padding: 1px 6px;
    border-radius: 3px;
    color: var(--primary);
    font-size: 13px;
}

.legal-content table {
    border-collapse: collapse;
    margin: 16px 0;
    width: 100%;
    font-size: 14px;
}

.legal-content table th,
.legal-content table td {
    border: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
    vertical-align: top;
}

.legal-content table th {
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
}

.legal-content hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 40px 0 20px;
}

.legal-footnote {
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

@media (max-width: 640px) {
    .legal-toc ul { columns: 1; }
    .legal-header h1 { font-size: 26px; }
    .legal-content h2 { font-size: 18px; }
}

body.app-wide .legal-page {
    margin-left: -32px;
    margin-right: -32px;
}
