﻿
:root {
--navy: #0c1f3f;
--navy-light: #162d5a;
--gold: #c9a84c;
--gold-light: #e8d5a0;
--green: #16a34a;
--green-bg: #f0fdf4;
--orange: #ea580c;
--orange-bg: #fff8f0;
--red: #dc2626;
--gray: #475569;
--gray-light: #f8fafc;
--border: #e2e8f0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: #f0f4f8; color: #1e293b; }
.container { max-width: 1280px; margin: 0 auto; padding: 20px; }

/* Header */
.header {
background: linear-gradient(135deg, var(--navy), var(--navy-light));
color: #fff; padding: 20px 28px; border-radius: 14px 14px 0 0;
display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.header .logo-area { display: flex; align-items: center; gap: 16px; flex: 1; }
.header .logo-area img { height: 48px; }
.header .logo-area .divider { width: 1px; height: 44px; background: rgba(255,255,255,0.2); }
.header .logo-area .brand-text h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.header .logo-area .brand-text p { font-size: 13px; color: #a3c4ff; margin-top: 2px; }
.header .badge { background: rgba(201,168,76,0.2); border: 1px solid rgba(201,168,76,0.4); border-radius: 6px; padding: 6px 14px; font-size: 11px; color: var(--gold-light); text-align: center; }

/* Tabs */
.tabs { background: #fff; border: 1px solid var(--border); border-top: none; display: flex; }
.tab-btn { flex: 1; padding: 14px 20px; border: none; background: var(--gray-light); cursor: pointer; font-size: 14px; font-weight: 500; color: #64748b; transition: all 0.2s; border-bottom: 3px solid transparent; }
.tab-btn:hover { background: #f1f5f9; color: var(--navy); }
.tab-btn.active { background: #fff; color: var(--navy); border-bottom-color: var(--gold); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Cards */
.card { background: #fff; border-radius: 12px; padding: 24px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid var(--border); }
.card-title { font-size: 15px; font-weight: 600; color: var(--navy); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--border); display: flex; align-items: center; gap: 8px; }
.card-title .gold { color: var(--gold); }

/* Consulta Toggle */
.consulta-toggle { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 8px 12px; background: var(--gray-light); border-radius: 8px; border: 1px solid var(--border); }
.consulta-toggle .toggle-label { font-size: 12px; color: var(--gray); font-weight: 500; margin-right: 4px; }
.consulta-toggle .toggle-btn { padding: 5px 16px; border: 1.5px solid #d1d9e6; background: #fff; border-radius: 6px; font-size: 12px; font-weight: 600; color: #64748b; cursor: pointer; transition: all 0.15s; }
.consulta-toggle .toggle-btn:hover { border-color: var(--navy); color: var(--navy); }
.consulta-toggle .toggle-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Grids */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 14px; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #334155; margin-bottom: 3px; }
.form-group .helper { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.form-group input, .form-group select { width: 100%; padding: 9px 12px; border: 1.5px solid #d1d9e6; border-radius: 8px; font-size: 14px; color: #0f172a; background: #fff; transition: border-color 0.2s; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(12,31,63,0.1); }
.form-group input:read-only { background: var(--gray-light); cursor: not-allowed; }
.input-wrap { position: relative; }
.input-wrap .prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #64748b; font-weight: 500; font-size: 14px; pointer-events: none; }
.input-wrap input { padding-left: 32px !important; }
.input-wrap .suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #64748b; font-size: 13px; pointer-events: none; }

/* CNAE Pills */
.cnae-pills { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; padding-top: 6px; border-top: 1px dashed #d1d9e6; }
.cnae-pill { cursor: pointer; padding: 3px 8px; border-radius: 4px; font-size: 10px; background: #f8fafc; border: 1px solid #e2e8f0; color: #475569; transition: all 0.15s; }
.cnae-pill:hover { background: #eff6ff; border-color: #93c5fd; }
.cnae-pill.active { background: #dbeafe; border-color: #93c5fd; color: #1e40af; font-weight: 600; cursor: default; }

/* Alert Warning */
.alert-warning { padding: 10px 14px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; font-size: 13px; color: #991b1b; }

/* CNAE Search */
.cnae-wrap { position: relative; }
.cnae-wrap input { padding-right: 36px; }
.cnae-wrap .search-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 16px; pointer-events: none; }
.cnae-results { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 0 0 8px 8px; max-height: 220px; overflow-y: auto; z-index: 100; display: none; box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.cnae-results.open { display: block; }
.cnae-item { padding: 8px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; gap: 8px; }
.cnae-item:hover { background: #eff6ff; }
.cnae-item .code { font-weight: 600; color: var(--navy); white-space: nowrap; font-size: 12px; }
.cnae-item .desc { color: var(--gray); flex: 1; }
.cnae-item .tag { font-size: 10px; padding: 1px 6px; border-radius: 3px; white-space: nowrap; }
.cnae-loading { padding: 12px; text-align: center; color: #94a3b8; font-size: 13px; }

/* Autocomplete dropdown (API) */
.autocomplete-list { position: relative; }
.autocomplete-list .dropdown { position: absolute; z-index: 10; background: #fff; border: 1px solid #d1d9e6; width: 100%; max-height: 220px; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-radius: 0 0 8px 8px; }
.autocomplete-list .dropdown div { padding: 8px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
.autocomplete-list .dropdown div:hover { background: #eff6ff; }
.autocomplete-list .dropdown div:last-child { border-bottom: none; }

/* Results */
.result-card { border-radius: 12px; padding: 20px; position: relative; display: flex; flex-direction: column; }
.result-card.sn { background: var(--orange-bg); border: 1px solid #fed7aa; }
.result-card.hibrido { background: var(--green-bg); border: 1px solid #bbf7d0; }
.result-card.winner { border: 2px solid #22c55e !important; background: #f0fdf4 !important; }
.result-card.loser { border: 2px solid #f87171 !important; background: #fef2f2 !important; }
.result-card h3 { font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.result-card.sn h3 { color: var(--orange); }
.result-card.hibrido h3 { color: var(--green); }
.result-value { font-size: 26px; font-weight: 700; margin: 4px 0 10px; }
.result-card.sn .result-value { color: var(--orange); }
.result-card.hibrido .result-value { color: var(--green); }
.result-detail { font-size: 13px; color: var(--gray); line-height: 1.7; }
.result-detail .tax-breakdown { margin-top: 6px; padding-top: 6px; border-top: 1px dashed #d1d9e6; font-size: 12px; }
.result-detail .tax-breakdown span { display: inline-block; margin-right: 10px; }
.result-detail .formula { font-size: 12px; color: #64748b; margin: 2px 0 4px 12px; }

/* Main page Prós/Contras */
.main-procon { display:flex; gap:16px; margin:14px 0; }
.main-procon-box { flex:1; border-radius:10px; border:2px solid #e2e8f0; overflow:hidden; background:#fff; }
.main-procon-box.winner { border-color:#22c55e; background:#f0fdf4; }
.main-procon-box.loser { border-color:#f87171; background:#fef2f2; }
.main-procon-header { padding:10px 14px; font-size:14px; font-weight:700; text-transform:uppercase; letter-spacing:0.3px; color:#fff; }
.main-procon-box.winner .main-procon-header { background:#16a34a; }
.main-procon-box.loser .main-procon-header { background:#dc2626; }
.main-procon-body { padding:12px 14px; }
.main-procon-row { display:flex; align-items:center; padding:4px 0; font-size:14px; }
.main-procon-label { flex:1; text-align:left; color:#64748b; }
.main-procon-val { text-align:right; white-space:nowrap; font-weight:600; color:#0f172a; margin-left:auto; }
.main-procon-divider { height:1px; background:#e2e8f0; margin:8px 0; }
.main-procon-points { font-size:13px; color:#475569; line-height:1.6; }
.main-procon-points .pro { color:#16a34a; }
.main-procon-points .con { color:#dc2626; }
.main-procon-breakeven { margin-top:8px; padding:8px 10px; background:#f1f5f9; border-radius:6px; border-left:3px solid #c9a84c; font-size:13px; color:#475569; }

.tag { display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.tag-sn { background: #fed7aa; color: #9a3412; }
.tag-hibrido { background: #bbf7d0; color: #166534; }
.tag-beneficio { background: #dbeafe; color: #1e40af; font-size: 10px; padding: 1px 6px; border-radius: 3px; }

/* Winner Banner */
.winner-banner {
border-radius: 12px; padding: 20px; margin-bottom: 16px;
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
font-size: 14px; line-height: 1.4; text-align: center;
border: 2px solid;
}
.winner-banner .icon { font-size: 36px; }
.winner-banner .text .title { font-size: 19px; font-weight: 700; margin-bottom: 3px; }
.winner-banner .text .detail { font-size: 13px; opacity: 0.85; }
.winner-banner.economy { background: linear-gradient(135deg, #eef2ff, #e0e7ff); border-color: #818cf8; color: #3730a3; }
.winner-banner.loss { background: linear-gradient(135deg, #f8fafc, #f1f5f9); border-color: #94a3b8; color: #334155; }
.winner-banner.neutral { background: linear-gradient(135deg, var(--gray-light), #f1f5f9); border-color: #94a3b8; color: var(--gray); }

/* Progress Bar */
.comparison-bar { margin-top: auto; }
.comparison-bar .bar-label { display: flex; font-size: 12px; margin-bottom: 3px; }
.comparison-bar .bar-label span:first-child { flex: 1; text-align: left; }
.comparison-bar .bar-label span:last-child { text-align: right; white-space: nowrap; margin-left: auto; }
.comparison-bar .bar-track { height: 26px; background: #e2e8f0; border-radius: 13px; overflow: hidden; }
.comparison-bar .bar-fill { height: 100%; border-radius: 13px; transition: width 0.4s; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-size: 11px; font-weight: 600; color: #fff; min-width: 36px; }
.bar-fill.sn { background: linear-gradient(90deg, #fb923c, var(--orange)); }
.bar-fill.hibrido { background: linear-gradient(90deg, #4ade80, var(--green)); }

/* Allocation Table */
.allocation-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.allocation-table th, .allocation-table td { padding: 5px 8px; text-align: center; border-bottom: 1px solid #f1f5f9; }
.allocation-table th { font-weight: 600; color: var(--gray); font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; background: var(--gray-light); }
.allocation-table tr.stays { background: #eff6ff; }
.allocation-table tr.moves { background: #fdf2f8; }
.allocation-table tr.nao-cobrado { background: var(--gray-light); color: #94a3b8; font-style: italic; }
.allocation-table tr.total-row { font-weight: 600; background: var(--gray-light); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 500; }
.badge.stays { background: #dbeafe; color: #1e40af; }
.badge.moves { background: #fce7f3; color: #be185d; }
.badge.nao-cobrado { background: #f1f5f9; color: #64748b; }

.btn { background: var(--navy); color: #fff; border: none; padding: 10px 28px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.btn:hover { background: var(--navy-light); }
.btn:active { transform: scale(0.98); }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-outline:hover { background: #f1f5f9; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 16px; font-size: 12px; }
.btn-print { background: #475569; }
.btn-print:hover { background: #334155; }
.btn-calc { background: var(--navy); color: #fff; border: none; padding: 10px 28px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; width: 100%; }
.btn-calc:hover { background: var(--navy-light); }

/* Reductions Table */
.reductions-wrapper { overflow-x: auto; }
.reductions-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.reductions-table th, .reductions-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #f1f5f9; }
.reductions-table th { font-weight: 600; color: var(--gray); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; background: var(--gray-light); position: sticky; top: 0; }
.reductions-table tr:hover { background: var(--gray-light); }
.reductions-table tr.active-row { background: #eff6ff; border-left: 3px solid var(--navy); }
.pct-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.pct-60 { background: #dcfce7; color: #166534; }
.pct-30 { background: #fef3c7; color: #92400e; }
.pct-0 { background: #dbeafe; color: #1e40af; }
.pct-full { background: #f1f5f9; color: #64748b; }

/* Glossary */
.glossary-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.glossary-card { border: 1px solid var(--border); border-radius: 10px; padding: 18px; border-top: 3px solid var(--gold); }
.glossary-card h3 { font-size: 16px; color: var(--navy); margin-bottom: 6px; }
.glossary-card p { font-size: 13px; color: var(--gray); line-height: 1.6; }
.glossary-card .aliquota { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--navy); background: #f1f5f9; padding: 3px 10px; border-radius: 4px; }
.timeline { margin-top: 16px; }
.timeline-item { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.timeline-year { font-weight: 700; color: var(--navy); min-width: 60px; font-size: 14px; }
.timeline-desc { font-size: 13px; color: var(--gray); line-height: 1.5; }
.annual-row { display: flex; gap: 24px; flex-wrap: wrap; font-size: 13px; color: var(--gray); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.annual-note { font-size: 11px; color: #94a3b8; margin-top: 8px; }

/* Controlled by JS — shown after calculation */
.annual-row { display: none; }

/* CNAE Benefits Summary */
.cnae-benefits { margin-top: 12px; padding: 14px; border-radius: 8px; border: 1px solid var(--border); }
.cnae-benefits h4 { font-size: 13px; color: var(--navy); margin-bottom: 8px; }
.cnae-benefits .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 13px; }
.cnae-benefits .item { padding: 6px 10px; background: var(--gray-light); border-radius: 6px; }
.cnae-benefits .item strong { color: var(--navy); }
.cnae-benefits .item .highlight { color: var(--green); font-weight: 600; }

/* ============================================================
PRINT STYLES — Injetados dinamicamente pelo JavaScript
(removido @media print para evitar conflito com JS)
============================================================ */
.ncm-card { margin-top: 8px; padding: 10px; background: #f0f7ff; border: 1px solid #bfdbfe; border-radius: 6px; font-size: 12px; }


/* NCM badge */
.ncm-source-badge { font-size: 9px; padding: 1px 6px; border-radius: 3px; }
.ncm-source-badge.siscomex { background: #dbeafe; color: #1e40af; }
.ncm-source-badge.local { background: #f1f5f9; color: #64748b; }

@media (max-width: 768px) {
.grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
body { padding: 0; }
.container { padding: 10px; }
.card { padding: 16px; }
.header { flex-direction: column; text-align: center; padding: 16px; }
.header .logo-area { flex-direction: column; text-align: center; }
.header .logo-area .divider { display: none; }
.tab-btn { font-size: 12px; padding: 10px 8px; }
.glossary-grid { grid-template-columns: 1fr; }
.cnae-benefits .grid { grid-template-columns: 1fr; }
}
