:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --error: #dc2626;
    --warning: #d97706;
    --info: #0284c7;
    --bg: #f1f5f9;
    --card: #ffffff;
    --sidebar: #1e293b;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --whatsapp: #25d366;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.admin-body { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--sidebar);
    color: white;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    padding: 1.5rem 0;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-nav { padding: 1rem 0; }
.sidebar-nav a {
    display: block;
    padding: 0.625rem 1.25rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9375rem;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}
.sidebar-logout { margin-top: 2rem; color: rgba(255,255,255,0.4) !important; }
.sidebar-public { color: rgba(255,255,255,0.55) !important; font-size: 0.8125rem !important; margin-top: 1rem; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 1rem !important; }
.login-footer-link { margin-top: 1.25rem; text-align: center; font-size: 0.875rem; }
.login-footer-link a { color: var(--text-muted); }

.main-wrap {
    flex: 1;
    margin-left: 220px;
    min-height: 100vh;
}

.main-content { padding: 2rem; max-width: 1200px; }

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar);
}

.login-card {
    background: var(--card);
    padding: 2.5rem;
    border-radius: 12px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}

.login-card h1 { margin-bottom: 0.25rem; }
.login-sub { color: var(--text-muted); margin-bottom: 1.5rem; }

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 { font-size: 1.5rem; }
.page-desc { color: var(--text-muted); font-size: 0.9375rem; margin-top: 0.25rem; }
.header-actions { display: flex; gap: 0.5rem; }
.link-back { color: var(--text-muted); text-decoration: none; font-size: 0.875rem; display: block; margin-bottom: 0.25rem; }
.link-back:hover { color: var(--primary); }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--border);
}

.stat-num { display: block; font-size: 1.75rem; font-weight: 700; }
.stat-label { font-size: 0.8125rem; color: var(--text-muted); }
.stat-warning .stat-num { color: var(--warning); }
.stat-info .stat-num { color: var(--info); }
.stat-success .stat-num { color: var(--success); }
.stat-money .stat-num { color: var(--primary); font-size: 1.25rem; }

/* Sections */
.section { margin-bottom: 1.5rem; }
.section h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }

.card-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Pipeline */
.pipeline {
    display: flex;
    align-items: center;
    overflow-x: auto;
    padding: 1rem 0;
    gap: 0;
}

.pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    text-align: center;
}

.pipeline-dot {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
}

.pipeline-step.done .pipeline-dot { background: var(--success); color: white; }
.pipeline-step.current .pipeline-dot { background: var(--primary); color: white; box-shadow: 0 0 0 3px rgba(37,99,235,0.3); }

.pipeline-label { font-size: 0.6875rem; color: var(--text-muted); max-width: 80px; }
.pipeline-step.current .pipeline-label { color: var(--primary); font-weight: 600; }
.pipeline-step.done .pipeline-label { color: var(--success); }

.pipeline-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    min-width: 20px;
    margin-bottom: 1.25rem;
}
.pipeline-line.done { background: var(--success); }

/* Actions */
.action-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.action-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.inline-form { display: inline-flex; gap: 0.5rem; align-items: center; }

.action-list { display: flex; flex-direction: column; gap: 0.5rem; }
.action-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
}

/* Copy box */
.copy-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    font-size: 0.8125rem;
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 0.75rem;
}

.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Info list */
.info-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.375rem 1rem;
    font-size: 0.9375rem;
}
.info-list dt { color: var(--text-muted); font-weight: 500; }
.money { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.money-green { font-weight: 700; color: var(--success); }

/* Forms */
.form-card, .form-card fieldset {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.form-card { padding: 0; overflow: hidden; }
.form-card fieldset { border: none; border-bottom: 1px solid var(--border); border-radius: 0; padding: 1.25rem; margin: 0; }
.form-card fieldset:last-of-type { border-bottom: none; }
.form-card legend { font-weight: 600; font-size: 0.9375rem; padding: 0; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.875rem;
    margin-top: 0.75rem;
}
.form-grid.compact { margin-top: 0; }
.span-2 { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; }
.form-group label { font-size: 0.8125rem; font-weight: 500; margin-bottom: 0.25rem; color: var(--text-muted); }

.form-group input,
.form-group select,
.form-group textarea,
.filters input,
.filters select,
.input-sm {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }

.checkbox-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9375rem; color: var(--text); margin-top: 1.5rem; }

.form-actions { padding: 1.25rem; display: flex; gap: 0.75rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-whatsapp { background: var(--whatsapp); color: white; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* Table */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.table th, .table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.table th { background: #f8fafc; font-weight: 600; color: var(--text-muted); }
.table tr:last-child td { border-bottom: none; }
.empty { text-align: center; color: var(--text-muted); padding: 2rem !important; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e2e8f0;
    color: var(--text-muted);
}
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-cadastrado { background: #f1f5f9; color: #475569; }
.badge-aguardando_pagamento { background: #fef3c7; color: #92400e; }
.badge-pagamento_recebido { background: #d1fae5; color: #065f46; }
.badge-pedido_certificadora { background: #dbeafe; color: #1e40af; }
.badge-validacao { background: #e0e7ff; color: #3730a3; }
.badge-certificado_emitido { background: #bbf7d0; color: #14532d; }
.badge-entregue { background: #a7f3d0; color: #064e3b; }
.badge-concluido { background: #16a34a; color: white; }

/* Filters */
.filters { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 200px; }

/* Flash */
.flash-container { padding: 1rem 2rem 0; }
.flash { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 0.5rem; font-size: 0.875rem; }
.flash-error { background: #fef2f2; color: var(--error); border: 1px solid #fecaca; }
.flash-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

.hint { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.hint.success { color: var(--success); }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.hidden { display: none !important; }
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* Modal */
.modal {
    border: none;
    border-radius: 12px;
    padding: 0;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal::backdrop { background: rgba(0,0,0,0.4); }
.modal form { padding: 1.5rem; }
.modal h3 { margin-bottom: 1rem; }
.modal-steps { margin: 0 0 1rem 1.25rem; font-size: 0.875rem; color: var(--text-muted); }
.modal-steps li { margin-bottom: 0.25rem; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }

.badge-orientado { background: #dbeafe; color: #1e40af; }
.badge-instalado { background: #a7f3d0; color: #064e3b; }

.guia-grid { display: flex; flex-direction: column; gap: 1rem; }
.guia-block p { margin-bottom: 0.75rem; font-size: 0.9375rem; }
.guia-steps, .guia-list { margin-left: 1.25rem; font-size: 0.9375rem; }
.guia-steps li, .guia-list li { margin-bottom: 0.5rem; }
.guia-recomendado { border-left: 4px solid var(--success); }
.guia-destaque { font-size: 1.05rem; margin-bottom: 1rem; }
.tipo-card { background: #f8fafc; border-radius: var(--radius); padding: 1rem; margin-top: 0.75rem; }
.tipo-recomendado { border: 2px solid var(--success); background: #f0fdf4; }
.tipo-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.cert-block { margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.cert-block:last-child { border-bottom: none; margin-bottom: 0; }
.guia-nota { margin-top: 1rem; }
.alert-box { padding: 0.875rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9375rem; line-height: 1.6; }
.alert-box { padding: 0.875rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9375rem; line-height: 1.6; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.row-best { background: #f0fdf4; }
.tipo-switch { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.guia-table { font-size: 0.875rem; margin: 0.75rem 0; }
.cert-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }

.certificadora-picker label { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--text-muted); margin-bottom: 0.375rem; }
.certificadora-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.certificadora-row select { flex: 1; min-width: 200px; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9375rem; }

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-wrap { margin-left: 0; }
    .grid-2 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: 1; }
}

/* ── Site público ─────────────────────────────────────────────────────────── */
.public-body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }

.public-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.public-header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.public-brand { font-weight: 700; font-size: 1.125rem; text-decoration: none; color: var(--text); }
.public-nav { display: flex; gap: 1.25rem; }
.public-nav a { text-decoration: none; color: var(--primary); font-size: 0.9375rem; }

.public-main { flex: 1; max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem; width: 100%; }
.public-flash { max-width: 960px; margin: 0 auto; padding: 0 1.5rem; }

.public-footer {
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
}
.public-footer a { color: var(--text-muted); }

.hero { text-align: center; padding: 2rem 0 3rem; }
.hero h1 { font-size: 2rem; margin-bottom: 1rem; line-height: 1.2; }
.hero-lead { font-size: 1.125rem; color: var(--text-muted); max-width: 640px; margin: 0 auto 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.feature-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--border);
}
.feature-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.875rem; color: var(--text-muted); }

.info-box {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.public-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.public-card-wide { max-width: 640px; margin: 0 auto; }
.public-card h2 { font-size: 1.25rem; margin-bottom: 1rem; }

.text-muted { color: var(--text-muted); }
.hint { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.375rem; }

.btn-lg { padding: 0.875rem 1.5rem; font-size: 1rem; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    cursor: pointer;
    font-size: 0.875rem;
}
.btn-outline:hover { background: #f8fafc; }

.form-section { border: none; margin-bottom: 1.5rem; padding: 0; }
.form-section legend { font-weight: 600; margin-bottom: 1rem; font-size: 1rem; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.radio-group { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-top: 0.375rem; }
.radio-group.vertical { flex-direction: column; gap: 0.5rem; }
.radio-group label { font-size: 0.9375rem; cursor: pointer; }
.form-actions { margin-top: 1rem; }

.jornada-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.protocolo-badge {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.jornada-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.progress-tracker {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}
.progress-step {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    opacity: 0.5;
}
.progress-step.done { opacity: 1; }
.progress-step.current { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.2); opacity: 1; }
.step-num { display: block; font-weight: 700; font-size: 1.125rem; }
.step-label { font-size: 0.6875rem; color: var(--text-muted); }

.etapa-form { margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.etapa-form select { padding: 0.5rem; border-radius: var(--radius); border: 1px solid var(--border); }

.recomendacao-box { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius); padding: 1.25rem; }
.recomendacao-box h3 { color: #14532d; margin-bottom: 0.5rem; }
.motivo { margin-top: 0.75rem; font-size: 0.9375rem; }
.secundario { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #bbf7d0; font-size: 0.875rem; }

.card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }
.card-header-row h2 { margin-bottom: 0; }
.melhor-preco { background: #f0fdf4; padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }

.precos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.preco-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.preco-card.melhor { border-color: var(--success); background: #f0fdf4; }
.preco-valor { font-size: 1.5rem; font-weight: 700; margin: 0.5rem 0; }
.preco-obs { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.preco-erro { color: var(--error); font-size: 0.875rem; margin-bottom: 0.75rem; }

.passos-lista { margin-left: 1.25rem; }
.passos-lista li { margin-bottom: 1rem; }
.instalacao-lista { margin-left: 1.25rem; }
.instalacao-lista li { margin-bottom: 0.5rem; }

.donate-cta {
    text-align: center;
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    border-radius: var(--radius);
    padding: 2rem;
    margin-top: 1rem;
}

.doar-form { margin: 1.5rem 0; max-width: 360px; }
.pix-result { margin-top: 2rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.pix-qr { width: 220px; height: 220px; border-radius: var(--radius); }
.pix-copia { width: 100%; max-width: 480px; }
.pix-copia textarea { width: 100%; font-size: 0.75rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); margin: 0.5rem 0; }
.back-link { margin-top: 2rem; }

.alert-warning { background: #fffbeb; border: 1px solid #fde68a; padding: 1rem; border-radius: var(--radius); }

@media (max-width: 600px) {
    .two-cols { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.5rem; }
    .progress-step .step-label { display: none; }
}
