:root {
    --bg-page: #eef2f7;
    --bg-surface: #ffffff;
    --bg-muted: #f8fafc;
    --border-soft: #e2e8f0;
    --text-primary: #334155;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --sidebar-bg: #f1f5f9;
    --sidebar-border: #dbe3ee;
    --sidebar-text: #475569;
    --sidebar-active: #dbeafe;
    --sidebar-active-text: #1e40af;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --primary: #7c9cbf;
    --primary-hover: #6b8aad;
    --success: #7fb39a;
    --success-hover: #6fa389;
    --danger: #d4a0a0;
    --danger-hover: #c48f8f;
    --warning: #d4bc8a;
    --warning-hover: #c9ae78;
    --purple: #a8a0c9;
    --purple-hover: #9890bb;
    --neutral: #b8c2ce;
    --neutral-hover: #a8b4c2;
    --entrada: #5f9a7a;
    --saida: #b86b6b;
    --saldo: #6b84b8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
}

h1, h2, h3 {
    color: #1e293b;
    font-weight: 600;
}

/* Sidebar */
.sidebar {
    width: 240px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 24px 18px;
    position: fixed;
    top: 0;
    left: 0;
    border-right: 1px solid var(--sidebar-border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    margin: 0 0 24px;
    font-size: 1.1rem;
    color: #64748b;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar button {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--sidebar-text);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    text-align: left;
    transition: all 0.2s ease;
}

.sidebar button:hover {
    background: rgba(255, 255, 255, 0.75);
    border-color: var(--border-soft);
}

.sidebar button.active {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
    border-color: #bfdbfe;
    font-weight: 600;
}

#logoutBtn {
    margin-top: 8px;
    background: #fce8e8;
    color: #9f6060;
    border-color: #f5d5d5;
}

#logoutBtn:hover {
    background: #f9dede;
    border-color: #efcccc;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-profile-btn {
    background: #eef2f6;
    color: #475569;
    border-color: #d8e0ea;
}

.sidebar-profile-btn:hover {
    background: #e6edf4;
    border-color: #c8d4e2;
}

.sidebar-profile-btn.active {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
    border-color: #bfdbfe;
    font-weight: 600;
}

.profile-meta {
    margin-top: 8px;
}

.profile-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: #eef2f8;
    border: 1px solid #d5deea;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
}

.profile-photo-box {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.profile-photo-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #d5deea;
    background: #eef2f8;
}

.profile-photo-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px dashed #cbd5e1;
    background: #f8fafc;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 600;
}

.profile-photo-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 220px;
}

.profile-photo-hint {
    margin: 0;
    color: #64748b;
    font-size: 0.85rem;
}

.msg-success {
    color: #4f7a62;
}

.ficha-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.ficha-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-soft);
}

.ficha-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.ficha-section-title {
    margin: 0 0 14px;
    font-size: 1.05rem;
    color: #334155;
}

.ficha-observacao {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}

.ficha-observacao span {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.ficha-observacao p {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
}

.ficha-vazio {
    margin: 0;
    padding: 12px 0;
}

.danger-zone {
    border-color: #f0cccc;
    background: #fdf8f8;
}

.danger-panel {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid #f0cccc;
    border-radius: var(--radius);
    background: #fffafa;
}

.sub-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sub-tab-btn {
    padding: 9px 16px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--bg-muted);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sub-tab-btn:hover {
    background: #fff;
    border-color: #c7d7ea;
}

.sub-tab-btn.active {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
    border-color: #bfdbfe;
    font-weight: 600;
}

.char-count {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: var(--text-light);
    text-align: right;
}

.char-hint {
    font-weight: 400;
    font-size: 0.82rem;
    color: var(--text-light);
}

/* Layout */
.content {
    margin-left: 260px;
    padding: 28px 32px;
    max-width: 1100px;
}

.content-wide {
    max-width: 1200px;
}

.content-box,
form.content-form {
    background: var(--bg-surface);
    padding: 28px;
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.page-title {
    margin-top: 0;
    margin-bottom: 24px;
}

/* Forms */
label {
    display: block;
    margin-top: 14px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

input,
select,
textarea,
.form-field {
    width: 100%;
    padding: 11px 14px;
    margin-top: 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    background: var(--bg-muted);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #c7d7ea;
    box-shadow: 0 0 0 3px rgba(124, 156, 191, 0.15);
    background: #fff;
}

textarea {
    resize: vertical;
    min-height: 90px;
}

.form-field {
    display: block;
}

.form-narrow {
    max-width: 680px;
}

#valor {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Buttons */
button,
.btn {
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary,
button[type="submit"],
.submit-btn {
    background: var(--primary);
    color: #fff;
    border-color: #6f8fb0;
}

.btn-primary:hover,
button[type="submit"]:hover,
.submit-btn:hover {
    background: var(--primary-hover);
}

.btn {
    background: var(--primary);
    color: #fff;
    width: auto;
    min-width: 160px;
}

.btn:hover {
    background: var(--primary-hover);
}

.btn-clear,
.btn-voltar,
.btn-close {
    background: var(--neutral);
    color: #fff;
    border-color: #a8b4c2;
}

.btn-clear:hover,
.btn-voltar:hover,
.btn-close:hover {
    background: var(--neutral-hover);
}

.btn-voltar {
    display: inline-block;
    margin-bottom: 20px;
    text-decoration: none;
}

.btn-save {
    background: var(--success);
    color: #fff;
    border-color: #6f9f87;
}

.btn-save:hover {
    background: var(--success-hover);
}

.btn-update {
    background: var(--warning);
    color: #fff;
    border-color: #bca874;
    margin-right: 10px;
}

.btn-update:hover {
    background: var(--warning-hover);
}

.btn-delete {
    background: var(--danger);
    color: #fff;
    border-color: #b88888;
    margin-right: 10px;
}

.btn-delete:hover {
    background: var(--danger-hover);
}

.btn-pdf {
    background: var(--purple);
    color: #fff;
    border-color: #8f87ad;
    margin-right: 10px;
}

.btn-pdf:hover {
    background: var(--purple-hover);
}

.btn-area {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Filters */
.filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.filtros div {
    flex: 1;
    min-width: 200px;
}

.search-box {
    display: flex;
    gap: 8px;
    margin: 8px 0 20px;
    max-width: 420px;
}

.search-box input {
    flex: 1;
    margin-top: 0;
}

.search-box button {
    min-width: auto;
    padding: 10px 16px;
}

/* Cards */
.card {
    background: var(--bg-surface);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-sm);
}

.card h3 {
    margin-top: 0;
}

.tipo-entrada {
    color: var(--entrada);
    font-weight: 600;
}

.tipo-saida {
    color: var(--saida);
    font-weight: 600;
}

.sem-pdf {
    color: var(--text-light);
    font-size: 0.9rem;
}

.acoes-card,
.acoes-botoes {
    margin-top: 12px;
}

.mensagem {
    margin-top: 12px;
    color: var(--text-secondary);
}

#msg.erro,
#msgCadastro.erro {
    color: #a86868;
}

#msg.sucesso,
#msgCadastro.sucesso {
    color: var(--entrada);
}

/* Totals highlight frame */
.totais-frame {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 24px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
    border: 1px solid #d9e2ec;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.total-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 20px 18px;
    text-align: center;
    backdrop-filter: blur(4px);
}

.total-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.total-value {
    display: block;
    font-size: 1.45rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.total-entrada {
    border-color: #c8e0d4;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(232, 245, 237, 0.9));
}

.total-entrada .total-value {
    color: var(--entrada);
}

.total-saida {
    border-color: #ecd4d4;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(252, 236, 236, 0.9));
}

.total-saida .total-value {
    color: var(--saida);
}

.total-saldo {
    border-color: #cdd8ea;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(235, 241, 251, 0.9));
}

.total-saldo .total-value {
    color: var(--saldo);
}

@media (max-width: 768px) {
    .totais-frame {
        grid-template-columns: 1fr;
    }
}

/* Action cards (Financeiro) */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.action-card {
    width: 240px;
    min-height: 170px;
    background: var(--bg-muted);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 20px;
}

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    background: #fff;
    border-color: #cfd8e3;
}

.action-card i {
    font-size: 2.4rem;
    margin-bottom: 12px;
    opacity: 0.85;
}

.action-card h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.register { color: #7c9cbf; }
.search { color: #7fb39a; }
.bank { color: #a8a0c9; }
.fav { color: #c9a882; }

.empresa-btn {
    width: min(100%, 320px);
    padding: 16px 20px;
    margin: 12px auto;
    display: block;
    background: var(--primary);
    color: #fff;
    border: 1px solid #6f8fb0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.empresa-btn:hover {
    background: var(--primary-hover);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: var(--bg-surface);
    padding: 28px;
    border-radius: var(--radius);
    width: min(420px, 92vw);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-md);
}

.modal-content h2 {
    margin-top: 0;
}

.modal-content button {
    width: 100%;
    margin-top: 10px;
}

/* Login */
body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(160deg, #eef2f7 0%, #e2e8f0 100%);
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 16px;
    width: 400px;
    max-width: 92%;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.login-box input {
    margin: 10px 0;
}

.login-box button {
    width: 100%;
    margin-top: 12px;
    padding: 14px;
}

.login-box .error {
    color: #a86868;
    margin-top: 12px;
}

.logo {
    width: 140px;
    height: 140px;
    border-radius: 16px;
    object-fit: contain;
    background: white;
    padding: 6px;
    border: 1px solid var(--border-soft);
}

@keyframes flutuar {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.logo-area .logo {
    animation: flutuar 3s ease-in-out infinite;
}

.welcome-box {
    background: var(--bg-surface);
    padding: 32px;
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-sm);
    max-width: 640px;
}

.welcome-box-wide {
    max-width: none;
    margin-bottom: 24px;
}

.welcome-subtitle {
    margin: 8px 0 0;
    color: var(--text-secondary);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 24px;
}

.chart-box {
    min-height: 420px;
    display: flex;
    flex-direction: column;
}

.chart-header {
    margin-bottom: 16px;
}

.section-title {
    margin: 0 0 6px;
    font-size: 1.15rem;
}

.chart-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.chart-wrap {
    position: relative;
    flex: 1;
    min-height: 300px;
}

.chart-wrap-pie {
    min-height: 320px;
    max-width: 420px;
    margin: 0 auto;
    width: 100%;
}

.chart-box-wide {
    margin-top: 24px;
}

.chart-wrap-jp {
    min-height: 280px;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

.chart-empty {
    margin-top: auto;
    text-align: center;
}

.jp-header {
    margin-bottom: 8px;
}

.pessoa-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.pessoa-tab {
    padding: 10px 20px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: var(--bg-muted);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s ease;
}

.pessoa-tab:hover {
    background: #eef2f7;
    color: var(--text-primary);
}

.pessoa-tab.active {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
    border-color: #bfdbfe;
}

.jp-cadastro-panel {
    background: var(--bg-muted);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 24px;
}

.jp-saldos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.jp-saldo-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #d9e2ec;
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.jp-saldo-nome {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.jp-saldo-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.jp-saldo-valor {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-bottom: 10px;
}

.jp-saldo-detalhe {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.saldo-positivo {
    color: var(--entrada);
}

.saldo-negativo {
    color: var(--saida);
}

.jp-pessoa-section {
    margin-top: 28px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.jp-pessoa-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
    border-bottom: 1px solid var(--border-soft);
}

.jp-pessoa-header .section-title {
    margin: 0;
}

.jp-pessoa-resumo {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.jp-table-wrap {
    overflow-x: auto;
}

.jp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.jp-table thead {
    background: #f1f5f9;
}

.jp-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}

.jp-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
}

.jp-table tbody tr:hover {
    background: #fafbfc;
}

.jp-col-descricao {
    max-width: 320px;
    word-break: break-word;
}

.jp-col-valor {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.valor-credito {
    color: var(--entrada);
}

.valor-debito {
    color: var(--saida);
}

.jp-col-acoes {
    white-space: nowrap;
}

.jp-col-acoes .btn-sm {
    padding: 6px 10px;
    font-size: 0.82rem;
    margin-right: 6px;
}

.jp-empty-row {
    text-align: center;
    color: var(--text-secondary);
    padding: 24px !important;
}

.status-credito {
    background: #e8f5ee;
    color: #3d7a5c;
    border: 1px solid #b8dcc8;
}

.status-debito {
    background: #fceeee;
    color: #9f6060;
    border: 1px solid #f0cccc;
}

.status-vencido {
    background: #fceeee;
    color: #9f6060;
    border: 1px solid #f0cccc;
}

.status-irregular {
    background: #fbf4e8;
    color: #9a7b3c;
    border: 1px solid #ead9b8;
}

.row-clickable {
    cursor: pointer;
}

.row-clickable:hover {
    background: #f8fafc;
}

.form-atualizar-ipva {
    margin-top: 12px;
}

.update-section {
    margin-bottom: 28px;
}

.update-empty-state {
    text-align: center;
    padding: 48px 24px;
    background: var(--bg-muted);
    border: 1px dashed var(--border-soft);
    border-radius: var(--radius);
}

.update-empty-state .btn {
    margin-top: 16px;
}

.update-panel-form {
    margin-top: 0;
}

.update-select-ipva {
    margin: 16px 0;
    max-width: 420px;
}

#msgIpvasVeiculo.erro {
    color: #a86868;
}

.update-panel {
    margin-top: 28px;
    padding: 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #d9e2ec;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.update-info-box {
    background: var(--bg-muted);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
}

.update-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.update-info-grid span {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.update-info-grid strong {
    color: #1e293b;
    font-size: 0.95rem;
}

.update-form-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    align-items: start;
}

.update-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.update-field select,
.update-field input[type="file"] {
    width: 100%;
}

.file-upload-box {
    background: #fff;
    border: 2px dashed #c7d7ea;
    border-radius: var(--radius-sm);
    padding: 18px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.file-upload-box:hover {
    border-color: #7c9cbf;
    background: #fafcff;
}

.file-upload-hint {
    margin: 10px 0 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.file-upload-name {
    margin: 0;
    font-size: 0.88rem;
    color: #1e40af;
    font-weight: 600;
}

.row-selected {
    background: #eef4ff !important;
}

.row-selected td {
    border-bottom-color: #c7d7ea;
}

#msgSalvarAtualizacao.erro {
    color: #a86868;
}

#msgSalvarAtualizacao.sucesso {
    color: var(--entrada);
}

@media (max-width: 768px) {
    .update-form-grid {
        grid-template-columns: 1fr;
    }
}

.divider {
    width: 100%;
    height: 1px;
    background: var(--border-soft);
    margin: 28px 0;
}

.form-field-narrow {
    max-width: 75%;
}

        .form-field-half button[type="submit"] {
            width: 100%;
        }

.content-box.text-center {
    text-align: center;
}

.transicao-box {
    text-align: center;
}

.delete-btn {
    background: var(--danger);
    color: #fff;
    border: 1px solid #b88888;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-top: 8px;
}

.delete-btn:hover {
    background: var(--danger-hover);
}

.card .btn-pdf,
.card button {
    margin-top: 8px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 4px;
}

.tab-btn {
    padding: 10px 18px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
    font-weight: 500;
}

.tab-btn:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
    border-color: #bfdbfe;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.extrato-meta {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin: 4px 0;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
}

.status-pago {
    background: #e8f5ee;
    color: #4a7d62;
    border: 1px solid #c8e0d4;
}

.status-parcelado {
    background: #fbf4e8;
    color: #9a7b3c;
    border: 1px solid #ead9b8;
}

.status-devendo {
    background: #fceeee;
    color: #9f6060;
    border: 1px solid #f0cccc;
}

.status-ativo {
    background: #e8f5ee;
    color: #3d7a5c;
    border: 1px solid #b8dcc8;
}

.status-finalizado {
    background: #eef2f7;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.update-status-row {
    align-items: flex-end;
    margin-top: 12px;
}

.card-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-clickable:hover {
    border-color: #c7d7ea;
    box-shadow: var(--shadow-md);
}

.card-clickable.selected {
    border-color: #93b4d9;
    background: #f8fbff;
}

.iptu-resumo {
    margin-bottom: 20px;
}

.iptu-resumo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.resumo-item {
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-soft);
    background: var(--bg-muted);
}

.resumo-item span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.resumo-item strong {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.resumo-pago { background: #eef8f2; border-color: #c8e0d4; }
.resumo-parcelado { background: #fdf8ee; border-color: #ead9b8; }
.resumo-devendo { background: #fdf0f0; border-color: #f0cccc; }
.resumo-total { background: #eef2f8; border-color: #cdd8ea; }

.row-clickable {
    cursor: pointer;
}

.row-clickable:hover td {
    background: #f8fafc;
}

.patrimonio-nota {
    margin: 14px 0 0;
}

.patrimonio-table td {
    vertical-align: top;
}

.loteamento-mapa-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.loteamento-mapa-wrap {
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: #fff;
    overflow: auto;
}

.loteamento-mapa-img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

.mapa-header-acoes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mapa-legenda {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 14px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.mapa-legenda span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mapa-legenda-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.mapa-calibrar-panel {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px dashed #c8d0da;
    border-radius: var(--radius);
    background: #f8fafc;
}

.mapa-calib-status {
    margin: 12px 0 4px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: #eef2f8;
    border: 1px solid #cdd8ea;
    color: #334155;
    font-size: 0.92rem;
    line-height: 1.5;
}

.mapa-hotspot-calibrando {
    box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.55) !important;
    z-index: 6;
}

.mapa-painel-calibracao {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}

.mapa-lote-selecionado td {
    background: #eef2f8;
}

.loteamento-mapa-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: start;
}

.loteamento-mapa-stage {
    position: relative;
    width: 100%;
    line-height: 0;
}

.loteamento-mapa-hotspots {
    position: absolute;
    inset: 0;
}

.mapa-hotspot {
    position: absolute;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    min-height: 18px;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.mapa-hotspot span {
    font-size: clamp(0.45rem, 0.7vw, 0.62rem);
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    line-height: 1;
}

.mapa-hotspot:hover,
.mapa-hotspot-ativo {
    transform: translate(-50%, -50%) scale(1.15);
    z-index: 5;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.mapa-hotspot-venda { background: #d4a017; }
.mapa-hotspot-vendido { background: #4f7a62; }
.mapa-hotspot-sem-cadastro { background: #94a3b8; }

.mapa-modo-calibrar {
    cursor: crosshair;
}

.mapa-modo-calibrar .mapa-hotspot {
    pointer-events: auto;
}

.mapa-painel-lote {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: #fff;
    padding: 16px;
    position: sticky;
    top: 16px;
}

.mapa-painel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.mapa-painel-header .section-title {
    margin: 0;
    font-size: 1rem;
}

@media (max-width: 1024px) {
    .loteamento-mapa-layout {
        grid-template-columns: 1fr;
    }

    .mapa-painel-lote {
        position: static;
    }
}

@media (max-width: 768px) {
    .iptu-resumo-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Impressão global */
.print-page-btn {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 1200;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border: 1px solid #c8d0da;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f6f8 100%);
    color: #475569;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow:
        0 0 0 4px rgba(148, 163, 184, 0.18),
        0 0 0 1px rgba(100, 116, 139, 0.12),
        var(--shadow-md);
    transition: all 0.2s ease;
}

.print-page-btn:hover {
    background: linear-gradient(180deg, #ffffff 0%, #eef2f6 100%);
    border-color: #b8c2ce;
    color: #334155;
    transform: translateY(-1px);
    box-shadow:
        0 0 0 5px rgba(148, 163, 184, 0.24),
        0 0 0 1px rgba(100, 116, 139, 0.18),
        0 10px 28px rgba(15, 23, 42, 0.12);
}

.print-page-btn-icon {
    font-size: 1.05rem;
    line-height: 1;
}

.sidebar-print-btn {
    margin-top: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f6f8 100%);
    color: #4b5563;
    border-color: #c8d0da;
    box-shadow:
        0 0 0 3px rgba(148, 163, 184, 0.16),
        0 0 0 1px rgba(100, 116, 139, 0.1);
}

.sidebar-print-btn:hover {
    background: linear-gradient(180deg, #ffffff 0%, #eef2f6 100%);
    border-color: #b8c2ce;
    box-shadow:
        0 0 0 4px rgba(148, 163, 184, 0.22),
        0 0 0 1px rgba(100, 116, 139, 0.15);
}

@media print {
    .sidebar,
    .print-page-btn,
    .sidebar-print-btn,
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .content,
    .content-wide {
        margin: 0 !important;
        padding: 0 !important;
        max-width: none !important;
    }

    .content-box,
    .tab-panel,
    .table-wrap,
    table {
        box-shadow: none !important;
    }

    .tabs,
    .filtros,
    .btn-area,
    .action-buttons,
    .form-grid,
    button,
    form:not(.print-keep) {
        display: none !important;
    }

    .tab-panel[style*="display: none"],
    .tab-panel.hidden {
        display: none !important;
    }

    table {
        width: 100% !important;
        border-collapse: collapse !important;
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    th,
    td {
        border: 1px solid #cbd5e1 !important;
        color: #000 !important;
        background: #fff !important;
    }

    th {
        background: #f1f5f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
