:root {
  --navy: #0f172a; --navy2: #1e3a5f; --blue: #2563eb; --blue2: #1d4ed8;
  --cyan: #06b6d4; --slate: #475569; --slate-l: #64748b; --line: #e2e8f0;
  --bg: #f8fafc; --green: #059669; --amber: #b45309;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
       color: var(--navy); background: #fff; line-height: 1.7; }
a { color: var(--blue); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #38bdf8; outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }
.prose { max-width: 720px; }

header.top { position: sticky; top: 0; background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
             border-bottom: 1px solid var(--line); z-index: 10; }
.nav { display: flex; align-items: center; justify-content: space-between; padding: .8rem 0; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--navy); }
.brand-mark { width: 2.1rem; height: 2.1rem; border-radius: 9px; background: linear-gradient(135deg, var(--blue), var(--blue2));
              display: flex; align-items: center; justify-content: center; color: #fff; }
.brand-name { font-weight: 800; font-size: 1.02rem; letter-spacing: -.02em; }
.brand-sub { font-size: .62rem; color: var(--slate-l); display: block; margin-top: -2px; }
.nav-links { display: flex; gap: 1.2rem; align-items: center; }
.nav-links a { color: var(--slate); text-decoration: none; font-size: .86rem; font-weight: 500; }
.btn { display: inline-block; background: linear-gradient(135deg, var(--blue), var(--blue2)); color: #fff !important;
       padding: .6rem 1.2rem; border-radius: 9px; font-weight: 700; font-size: .88rem; text-decoration: none;
       box-shadow: 0 2px 10px rgba(37,99,235,.3); transition: transform .15s ease, box-shadow .15s ease; border: 0; cursor: pointer; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(37,99,235,.38); }
.btn:active { transform: scale(.98); }
@media (max-width: 640px) { .nav-links a:not(.btn) { display: none; } }

.crumbs { font-size: .8rem; color: var(--slate-l); padding-top: 1.6rem; }
.crumbs a { color: var(--slate-l); text-decoration: none; }
.crumbs a:hover { color: var(--blue); }

article { padding: 1rem 0 3rem; }
.kicker { color: var(--blue); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; }
h1 { font-size: clamp(1.8rem, 4.2vw, 2.6rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.15; margin: .4rem 0 .9rem; text-wrap: balance; }
.lead { font-size: 1.08rem; color: var(--slate); }
.meta { font-size: .8rem; color: var(--slate-l); margin-top: .9rem; }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.6rem); font-weight: 800; letter-spacing: -.025em; margin: 2.6rem 0 .7rem; line-height: 1.25; text-wrap: balance; scroll-margin-top: 5rem; }
h3 { font-size: 1.08rem; margin: 1.6rem 0 .4rem; }
p, ul, ol { margin-bottom: 1rem; }
ul, ol { padding-left: 1.3rem; }
li { margin-bottom: .35rem; }
strong { font-weight: 700; }
code, kbd { font-family: var(--mono); font-size: .9em; background: #f1f5f9; border: 1px solid var(--line); border-radius: 5px; padding: .05em .35em; white-space: nowrap; }
pre { font-family: var(--mono); font-size: .88rem; background: var(--navy); color: #e2e8f0; border-radius: 10px;
      padding: 1rem 1.2rem; overflow-x: auto; margin-bottom: 1.2rem; line-height: 1.65; }
pre .c { color: #7c8da6; }

.toc { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.3rem; margin: 1.8rem 0; }
.toc b { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--slate-l); }
.toc ol { margin: .5rem 0 0; }
.toc a { text-decoration: none; }

.tbl { overflow-x: auto; margin: 1rem 0 1.4rem; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; min-width: 520px; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line); }
th { background: var(--bg); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--slate-l); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
td code { white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

.note { border-left: 3px solid var(--amber); background: #fffbeb; padding: .8rem 1rem; border-radius: 0 8px 8px 0; margin: 1.2rem 0; font-size: .94rem; }
.note.ok { border-color: var(--green); background: #ecfdf5; }
.note b { display: block; margin-bottom: .15rem; }

.cta-box { background: linear-gradient(160deg, var(--navy), var(--navy2)); color: #f1f5f9; border-radius: 16px;
           padding: 1.6rem 1.6rem; margin: 2.4rem 0; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.cta-box div { flex: 1 1 300px; }
.cta-box b { display: block; font-size: 1.12rem; margin-bottom: .2rem; }
.cta-box span { color: #94a3b8; font-size: .92rem; }

.related { border-top: 1px solid var(--line); padding-top: 1.6rem; margin-top: 2.4rem; }
.related ul { list-style: none; padding: 0; }
.related li { margin-bottom: .5rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin: 1.6rem 0 3rem; }
.card { display: block; border: 1px solid var(--line); border-radius: 14px; padding: 1.3rem 1.4rem; text-decoration: none; color: var(--navy);
        transition: border-color .15s ease, box-shadow .15s ease; }
.card:hover { border-color: #bfdbfe; box-shadow: 0 6px 18px rgba(15,23,42,.06); }
.card .kicker { display: block; margin-bottom: .3rem; }
.card b { display: block; font-size: 1.05rem; line-height: 1.35; margin-bottom: .35rem; }
.card span { font-size: .88rem; color: var(--slate-l); }

/* Calculadora */
.calc { border: 1px solid var(--line); border-radius: 14px; padding: 1.3rem 1.4rem; background: var(--bg); margin: 1.4rem 0 2rem; }
.calc label { display: block; font-size: .82rem; font-weight: 600; color: var(--slate); margin-bottom: .35rem; }
.calc-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.calc input[type="text"] { flex: 1 1 260px; min-width: 0; font: 500 1.05rem var(--mono); padding: .65rem .8rem; border: 1.5px solid #cbd5e1;
                           border-radius: 9px; background: #fff; color: var(--navy); }
.calc input[type="text"]:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.calc .hint { font-size: .8rem; color: var(--slate-l); margin-top: .45rem; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }
.chips button { font: 500 .78rem var(--mono); border: 1px solid var(--line); background: #fff; color: var(--slate); border-radius: 999px;
                padding: .25rem .65rem; cursor: pointer; }
.chips button:hover { border-color: var(--blue); color: var(--blue); }
.out { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem; margin-top: 1.1rem; }
.out div { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .75rem .9rem; min-width: 0; }
.out small { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--slate-l); }
.out output { display: block; font: 700 1.08rem var(--mono); color: var(--navy); overflow-wrap: anywhere; }
.calc .err { color: #b91c1c; font-size: .86rem; margin-top: .6rem; min-height: 1.2em; }

footer { border-top: 1px solid var(--line); padding: 2rem 0; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.foot small { color: var(--slate-l); font-size: .8rem; }
.foot-links { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.foot-links a { color: var(--slate); font-weight: 500; text-decoration: none; font-size: .85rem; }
.foot-links a.wa { color: var(--green); font-weight: 600; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .btn, .card { transition: none; } }
