/* ===== Simulador IRS OE2026 ===== */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --ink: #1c2333;
  --ink-soft: #5a6478;
  --line: #e3e8f0;
  --accent: #1d4ed8;
  --accent-soft: #eff4ff;
  --good: #047857;
  --good-bg: #ecfdf5;
  --bad: #b91c1c;
  --bad-bg: #fef2f2;
  --warn-bg: #fffbeb;
  --warn-line: #f59e0b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* Topbar */
.topbar { background: linear-gradient(135deg, #0f2c7c, #1d4ed8); color: #fff; padding: 22px 0; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 44px; height: 44px; flex-shrink: 0; object-fit: contain;
  background: #fff; border-radius: 10px; padding: 3px;
}
.brand-co { margin: 0 0 1px; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.brand h1 { margin: 0; font-size: 1.45rem; letter-spacing: .2px; }
.brand-sub { margin: 2px 0 0; font-size: .85rem; opacity: .85; }
.badge-privacy {
  font-size: .78rem; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25);
  padding: 7px 12px; border-radius: 999px; cursor: help;
}
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lang-switch { display: flex; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; overflow: hidden; }
.lang-switch button {
  background: transparent; color: #fff; border: none; padding: 7px 14px;
  font-size: .8rem; font-weight: 700; cursor: pointer;
}
.lang-switch button.active { background: #fff; color: var(--accent); }
.btn-clear {
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: 7px 14px; font-size: .8rem; font-weight: 700; cursor: pointer;
}
.btn-clear:hover { background: rgba(255,255,255,.28); }

/* Tabs */
.tabs { display: flex; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  padding: 10px 22px; border-radius: 10px 10px 0 0; font-size: .95rem; font-weight: 600;
  cursor: pointer; border-bottom: none;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab-panel { display: none; padding-top: 16px; }
.tab-panel.active { display: block; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px;
}
.card-title { margin: 0 0 14px; font-size: 1.05rem; }
.legal { color: var(--ink-soft); font-weight: 400; font-size: .82rem; }
.hint { color: var(--ink-soft); font-size: .88rem; margin: -4px 0 14px; }

/* SP panels side by side */
.sp-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.sp-grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .sp-grid.two { grid-template-columns: 1fr; } }

/* Fields */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; }
.field > span { font-weight: 600; color: var(--ink); }
.field small { color: var(--ink-soft); font-size: .76rem; }
.field-row { display: flex; gap: 8px; }
.field-row > * { flex: 1; }
input[type="number"], input[type="text"], select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: .95rem; background: #fbfcfe; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: #fff; }
input:disabled, input[readonly] { background: #eef1f6; color: var(--ink-soft); }
.check { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; cursor: pointer; padding-top: 4px; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

/* Collapsible category sections */
details.cat { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; background: #fbfcfe; }
details.cat summary {
  cursor: pointer; padding: 11px 14px; font-weight: 600; font-size: .92rem;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; list-style: none;
}
details.cat summary::-webkit-details-marker { display: none; }
details.cat summary::after { content: "▸"; color: var(--ink-soft); transition: transform .15s; }
details.cat[open] summary::after { transform: rotate(90deg); }
details.cat .cat-body { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.cat-badge { font-size: .78rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 10px; border-radius: 999px; margin-left: auto; }
.cat-badge.zero { visibility: hidden; }
.computed { font-size: .8rem; color: var(--ink-soft); background: var(--accent-soft); border-radius: 6px; padding: 6px 10px; margin-top: 8px; }

/* Tables */
.input-table, .data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.input-table th, .data-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--line); font-size: .8rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.input-table td, .data-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.input-table input { max-width: 130px; }
.input-table td:nth-child(3) { white-space: nowrap; }
.input-table td:nth-child(3) input { max-width: 70px; display: inline-block; }

/* Results */
.results { margin-top: 4px; }
.result-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin-bottom: 16px; }
.result-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; position: relative;
}
.result-card h3 { margin: 0 0 6px; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.result-card .amount { font-size: 1.7rem; font-weight: 800; margin: 2px 0; }
.result-card .sub { font-size: .8rem; color: var(--ink-soft); }
.result-card.best { border: 2px solid var(--good); background: var(--good-bg); }
.best-tag {
  position: absolute; top: -11px; right: 14px; background: var(--good); color: #fff;
  font-size: .7rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; letter-spacing: .04em;
}
.pay { color: var(--bad); }
.refund { color: var(--good); }

.breakdown { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.breakdown summary { padding: 13px 18px; font-weight: 700; cursor: pointer; font-size: .92rem; }
.breakdown table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.breakdown th { text-align: right; padding: 8px 14px; border-bottom: 2px solid var(--line); font-size: .78rem; color: var(--ink-soft); }
.breakdown th:first-child { text-align: left; }
.breakdown td { padding: 7px 14px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.breakdown td:first-child { text-align: left; color: var(--ink-soft); }
.breakdown tr.total td { font-weight: 800; background: var(--accent-soft); color: var(--ink); }
.breakdown tr.section td { font-weight: 700; color: var(--ink); background: #f6f8fc; }

/* Notices */
.notice { border-radius: 10px; padding: 12px 16px; font-size: .88rem; margin-bottom: 14px; }
.notice.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); }
.notice.good { background: var(--good-bg); border: 1px solid var(--good); }

.notes-list { font-size: .9rem; color: var(--ink-soft); margin: 0; padding-left: 20px; }
.notes-list li { margin-bottom: 6px; }

/* Print button */
.btn-print {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 10px 20px; font-size: .9rem; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.btn-print:hover { filter: brightness(1.1); }

/* Footer */
.footer { padding: 26px 20px 40px; font-size: .8rem; color: var(--ink-soft); }
.footer p { margin: 4px 0; }
.footer-brand { font-weight: 600; color: var(--ink); margin-bottom: 10px !important; }

/* ===== Print summary ===== */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; font-size: 11pt; color: #000; }
  #print-area h1 { font-size: 15pt; margin: 0 0 2pt; }
  #print-area .pr-head { display: flex; align-items: center; gap: 12pt; margin-bottom: 12pt; border-bottom: 2px solid #3d0d0d; padding-bottom: 8pt; }
  #print-area .pr-logo { width: 52pt; height: 52pt; object-fit: contain; }
  #print-area .pr-co { font-size: 9pt; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #3d0d0d; }
  #print-area .pr-sub { font-size: 9pt; color: #444; margin: 0; }
  #print-area h2 { font-size: 11.5pt; margin: 12pt 0 4pt; border-bottom: 1px solid #999; padding-bottom: 2pt; }
  #print-area table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  #print-area th, #print-area td { border: 1px solid #bbb; padding: 3pt 6pt; text-align: right; }
  #print-area th:first-child, #print-area td:first-child { text-align: left; }
  #print-area .pr-total td { font-weight: 700; background: #eee; }
  #print-area .pr-disclaimer { font-size: 8.5pt; color: #555; margin-top: 14pt; border-top: 1px solid #999; padding-top: 6pt; }
}
