/* ==========================================================
   Tudo Fácil BR — estilo compartilhado
   ========================================================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --brand: #1a7f5a;
    --brand-dark: #146147;
    --brand-light: #e6f4ee;
    --accent: #f5a623;
    --ink: #1a2634;
    --ink-soft: #52606d;
    --line: #dde5ec;
    --bg: #edf1f4;
    --card: #ffffff;
    --input-bg: #ffffff;
    --ok: #1a7f5a;
    --erro: #d64545;
    --radius: 14px;
    --shadow: 0 4px 20px rgba(26,38,52,0.06);
    --shadow-hover: 0 8px 30px rgba(26,38,52,0.12);
    --max: 1080px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
/* TEMA ESCURO */
html.dark {
    --brand: #2eb886;
    --brand-dark: #24996f;
    --brand-light: rgba(46,184,134,0.16);
    --ink: #e7edf4;
    --ink-soft: #a3b2c2;
    --line: #29364a;
    --bg: #0f1620;
    --card: #192434;
    --input-bg: #101a28;
    --shadow: 0 4px 20px rgba(0,0,0,0.35);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.5);
}
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.65; -webkit-font-smoothing: antialiased; transition: background 0.25s ease, color 0.25s ease; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* HEADER */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 100; }
.site-header .container { display: flex; align-items: center; gap: 12px; height: 66px; }
.main-nav { margin-left: auto; }
.nav-toggle { margin-left: auto; }
.theme-toggle { width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px; border: 1px solid var(--line); background: var(--input-bg); cursor: pointer; font-size: 1.05rem; display: flex; align-items: center; justify-content: center; transition: transform 0.15s ease; }
.theme-toggle:hover { transform: scale(1.1); border-color: var(--brand); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo-mark { width: 38px; height: 38px; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.2rem; }
.logo span { color: var(--brand); }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a { color: var(--ink-soft); font-size: 0.9rem; font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.main-nav a:hover { background: var(--brand-light); color: var(--brand-dark); text-decoration: none; }
.nav-toggle { display: none; background: none; border: none; font-size: 1.5rem; color: var(--ink); cursor: pointer; }

/* HERO */
.hero { background: linear-gradient(135deg, #dcefe6 0%, #e2ebf6 55%, #ece6f5 100%); padding: 60px 0 50px; text-align: center; border-bottom: 1px solid var(--line); }
html.dark .hero { background: linear-gradient(135deg, #13251d 0%, #142030 55%, #1c1a2e 100%); }
.hero h1 { font-size: 2.4rem; font-weight: 800; line-height: 1.15; margin-bottom: 16px; letter-spacing: -0.02em; }
.hero p { font-size: 1.1rem; color: var(--ink-soft); max-width: 640px; margin: 0 auto; }

/* GRID DE FERRAMENTAS */
.tools-section { padding: 50px 0; }
.section-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 8px; text-align: center; }
.section-sub { text-align: center; color: var(--ink-soft); margin-bottom: 36px; }
.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.tool-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); transition: transform 0.2s ease, box-shadow 0.2s ease; display: block; color: var(--ink); }
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); text-decoration: none; border-color: var(--brand); }
.tool-icon { width: 52px; height: 52px; border-radius: 12px; background: var(--brand-light); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: 16px; }
/* Cores por ferramenta (quebra a claridade do tema claro) */
.tools-grid .tool-card:nth-child(1) { border-top: 3px solid #1a7f5a; }
.tools-grid .tool-card:nth-child(2) { border-top: 3px solid #e08a1e; }
.tools-grid .tool-card:nth-child(3) { border-top: 3px solid #2563ac; }
.tools-grid .tool-card:nth-child(4) { border-top: 3px solid #c0392b; }
.tools-grid .tool-card:nth-child(5) { border-top: 3px solid #7c3aed; }
.tools-grid .tool-card:nth-child(6) { border-top: 3px solid #94a3b8; }
.tools-grid .tool-card:nth-child(1) .tool-icon { background: #e0f0e9; color: #1a7f5a; }
.tools-grid .tool-card:nth-child(2) .tool-icon { background: #fcefdc; color: #c76b1d; }
.tools-grid .tool-card:nth-child(3) .tool-icon { background: #e2ecf9; color: #2563ac; }
.tools-grid .tool-card:nth-child(4) .tool-icon { background: #fbe5e3; color: #c0392b; }
.tools-grid .tool-card:nth-child(5) .tool-icon { background: #eee6fa; color: #7c3aed; }
.tools-grid .tool-card:nth-child(6) .tool-icon { background: #eaeef2; color: #52606d; }
html.dark .tools-grid .tool-card:nth-child(1) .tool-icon { background: rgba(46,184,134,0.15); color: #6ee7b7; }
html.dark .tools-grid .tool-card:nth-child(2) .tool-icon { background: rgba(245,166,35,0.15); color: #fbbf24; }
html.dark .tools-grid .tool-card:nth-child(3) .tool-icon { background: rgba(59,130,246,0.15); color: #93c5fd; }
html.dark .tools-grid .tool-card:nth-child(4) .tool-icon { background: rgba(239,68,68,0.15); color: #fca5a5; }
html.dark .tools-grid .tool-card:nth-child(5) .tool-icon { background: rgba(139,92,246,0.15); color: #c4b5fd; }
html.dark .tools-grid .tool-card:nth-child(6) .tool-icon { background: rgba(148,163,184,0.12); color: #94a3b8; }
.tool-card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.tool-card p { font-size: 0.92rem; color: var(--ink-soft); }
.tool-card .go { margin-top: 14px; font-weight: 600; color: var(--brand); font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; }

/* PÁGINA DE FERRAMENTA */
.tool-page { padding: 40px 0 60px; }
.breadcrumb { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 18px; }
.breadcrumb a { color: var(--ink-soft); }
.tool-header { margin-bottom: 28px; }
.tool-header h1 { font-size: 2rem; font-weight: 800; line-height: 1.15; margin-bottom: 10px; }
.tool-header .lead { color: var(--ink-soft); font-size: 1.05rem; }
.layout { display: grid; grid-template-columns: 1fr 300px; gap: 30px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

/* CARD DE FORMULÁRIO / CALCULADORA */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.card + .card { margin-top: 24px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 7px; }
.field .hint { font-weight: 400; color: var(--ink-soft); font-size: 0.82rem; }
.field input, .field select { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; font-family: var(--font); color: var(--ink); background: var(--input-bg); transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--brand); color: #fff; border: none; border-radius: 10px; padding: 13px 26px; font-size: 1rem; font-weight: 700; font-family: var(--font); cursor: pointer; transition: background 0.15s ease; width: 100%; }
.btn:hover { background: var(--brand-dark); }
.btn-ghost { background: var(--input-bg); color: var(--brand); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--brand-light); }

/* RESULTADO */
.result { margin-top: 24px; padding-top: 24px; border-top: 1px dashed var(--line); display: none; }
.result.show { display: block; animation: fade 0.3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.result-highlight { background: var(--brand-light); border-radius: 12px; padding: 20px; text-align: center; margin-bottom: 20px; }
.result-highlight .label { font-size: 0.9rem; color: var(--brand-dark); font-weight: 600; }
.result-highlight .value { font-size: 2.2rem; font-weight: 800; color: var(--brand-dark); letter-spacing: -0.02em; }
.breakdown { width: 100%; border-collapse: collapse; }
.breakdown th, .breakdown td { text-align: left; padding: 11px 4px; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.breakdown th { color: var(--ink-soft); font-weight: 500; }
.breakdown td { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.breakdown tr.total td, .breakdown tr.total th { font-weight: 800; font-size: 1.05rem; border-bottom: none; color: var(--brand-dark); }
.breakdown td.neg { color: var(--erro); }
.msg-erro { color: var(--erro); font-size: 0.9rem; margin-top: 12px; display: none; }
.msg-erro.show { display: block; }

/* RESULTADO DE CONSULTA (CNPJ/CEP) */
.data-list { list-style: none; }
.data-list li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.data-list li:last-child { border-bottom: none; }
.data-list .k { color: var(--ink-soft); flex-shrink: 0; }
.data-list .v { font-weight: 600; text-align: right; }
.badge { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; }
.badge.ativa { background: #e3f7ec; color: #1a7f5a; }
.badge.inativa { background: #fdeaea; color: #d64545; }
.loading { text-align: center; padding: 20px; color: var(--ink-soft); display: none; }
.loading.show { display: block; }

/* SIDEBAR */
.sidebar-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.sidebar-box + .sidebar-box { margin-top: 20px; }
.sidebar-box h3 { font-size: 1rem; font-weight: 700; margin-bottom: 14px; }
.sidebar-links { list-style: none; }
.sidebar-links li { margin-bottom: 4px; }
.sidebar-links a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink-soft); font-size: 0.9rem; font-weight: 500; }
.sidebar-links a:hover { background: var(--brand-light); color: var(--brand-dark); text-decoration: none; }
.ad-slot { background: repeating-linear-gradient(45deg, #f0f3f7, #f0f3f7 10px, #e9edf2 10px, #e9edf2 20px); border: 1px dashed #cbd5e0; border-radius: 12px; min-height: 250px; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 0.82rem; text-align: center; padding: 20px; }

/* CONTEÚDO EXPLICATIVO (SEO) */
.article { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow); margin-top: 24px; }
.article h2 { font-size: 1.35rem; font-weight: 800; margin: 8px 0 14px; }
.article h3 { font-size: 1.1rem; font-weight: 700; margin: 22px 0 10px; }
.article p { margin-bottom: 14px; color: var(--ink-soft); }
.article ul, .article ol { margin: 0 0 16px 22px; color: var(--ink-soft); }
.article li { margin-bottom: 6px; }
.article table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.92rem; }
.article th, .article td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; }
.article th { background: var(--brand-light); font-weight: 700; color: var(--brand-dark); }
.faq details { border: 1px solid var(--line); border-radius: 10px; padding: 4px 18px; margin-bottom: 12px; }
.faq summary { font-weight: 600; cursor: pointer; padding: 12px 0; }
.faq details p { margin: 0 0 14px; }

/* FOOTER (escuro nos dois temas) */
.site-footer { background: #16202d; color: #cbd5e0; padding: 44px 0 24px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 36px; padding-bottom: 30px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.footer-brand .logo { color: #fff; margin-bottom: 12px; }
.footer-brand p { font-size: 0.9rem; color: #94a3b8; max-width: 340px; }
.footer-col h4 { color: #fff; font-size: 0.9rem; margin-bottom: 14px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 9px; }
.footer-col a { color: #cbd5e0; font-size: 0.88rem; }
.footer-col a:hover { color: #fff; }
.footer-bottom { padding-top: 22px; text-align: center; font-size: 0.82rem; color: #94a3b8; }
.footer-bottom .disclaimer { max-width: 720px; margin: 0 auto 12px; line-height: 1.6; }

/* AJUSTES DO TEMA ESCURO */
html.dark .result-highlight .label, html.dark .result-highlight .value { color: #6ee7b7; }
html.dark .breakdown tr.total td, html.dark .breakdown tr.total th { color: #6ee7b7; }
html.dark .article th { color: #6ee7b7; }
html.dark .badge.ativa { background: rgba(46,184,134,0.15); color: #6ee7b7; }
html.dark .badge.inativa { background: rgba(239,68,68,0.15); color: #fca5a5; }
html.dark .ad-slot { background: repeating-linear-gradient(45deg, #1a2433, #1a2433 10px, #16202d 10px, #16202d 20px); border-color: #2a3648; color: #64748b; }
html.dark .tab { background: var(--card); }
html.dark .mr-content h4, html.dark .tool-card h3 { color: var(--ink); }
html.dark .card, html.dark .sidebar-box, html.dark .article, html.dark .tool-card { transition: background 0.25s ease; }

@media (max-width: 760px) {
    .main-nav { display: none; position: absolute; top: 66px; left: 0; right: 0; background: var(--card); border-bottom: 1px solid var(--line); flex-direction: column; padding: 10px; gap: 2px; box-shadow: var(--shadow); }
    .main-nav.open { display: flex; }
    .main-nav a { padding: 12px 14px; }
    .nav-toggle { display: block; }
    .tools-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.8rem; }
    .footer-grid { grid-template-columns: 1fr; gap: 26px; }
}
@media (max-width: 980px) and (min-width: 761px) { .tools-grid { grid-template-columns: repeat(2, 1fr); } }
