:root {
  --navy: #0b1f4f; --navy-2: #14307a; --blue: #0a5bd3; --yellow: #ffb800; --yellow-2: #ffe14d; --red: #e31e24;
  --ink: #17213a; --muted: #5b6785; --line: #e2e7f1; --bg: #f5f7fb; --card: #fff;
  --ok: #12805c; --ok-bg: #e3f6ee; --warn: #8a5a00; --warn-bg: #fff3d1; --bad: #b3141a; --bad-bg: #fde7e8; --info: #0a4fb8; --info-bg: #e5eefc;
  --radius: 14px; --shadow: 0 1px 2px rgba(11, 31, 79, .06), 0 8px 24px rgba(11, 31, 79, .07);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font: 16px/1.55 Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--blue); }
h1, h2, h3, h4 { color: var(--navy); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
.wrap { width: min(1160px, 100% - 40px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; padding: .65em 1.2em; border-radius: 10px; font: inherit; font-weight: 700; font-size: .95rem; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; transition: transform .08s, box-shadow .15s, background .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-accent { background: var(--yellow); color: var(--navy); }
.btn-accent:hover { background: #ffc633; box-shadow: 0 4px 14px rgba(255, 184, 0, .4); }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-danger { background: #fff; color: var(--bad); border-color: #f1c0c2; }
.btn-sm { padding: .4em .8em; font-size: .85rem; border-radius: 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid rgba(10, 91, 211, .45); outline-offset: 2px; }

/* header público */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 46px; width: auto; mix-blend-mode: multiply; }
.brand-name { font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; color: var(--navy); }
.brand-name span { color: var(--navy); } .brand-name small { color: var(--yellow); font-size: inherit; }
.brand-name > span:nth-of-type(1) { color: var(--navy); }
.nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav a { color: var(--navy); text-decoration: none; font-weight: 600; font-size: .95rem; }
.nav a:hover { color: var(--blue); }
.nav .btn { color: inherit; }
.nav .btn-primary { color: #fff; }
.menu-btn { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 1.2rem; }

/* hero */
.hero { background: radial-gradient(900px 420px at 85% -10%, rgba(255, 184, 0, .22), transparent 60%), radial-gradient(700px 400px at 0% 0%, rgba(10, 91, 211, .13), transparent 60%), #fff; padding: 72px 0 64px; border-bottom: 1px solid var(--line); }
.hero .wrap { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.eyebrow { display: inline-flex; gap: .5em; align-items: center; background: var(--info-bg); color: var(--info); font-weight: 700; font-size: .8rem; padding: .35em .85em; border-radius: 999px; margin-bottom: 1.2em; letter-spacing: .02em; }
.hero h1 em { font-style: normal; color: var(--blue); }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 1.6em; }
.mock { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 18px; }
.mock h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.mock-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 8px; font-size: .92rem; }
.mock-row b { color: var(--navy); }
.mock-row .date { margin-left: auto; font-weight: 700; font-size: .85rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* secciones */
.section { padding: 72px 0; }
.section.alt { background: #fff; border-block: 1px solid var(--line); }
.section-head { max-width: 46em; margin-bottom: 36px; }
.section-head p { color: var(--muted); font-size: 1.05rem; }
.grid { display: grid; gap: 18px; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }
.ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; margin-bottom: 14px; background: var(--info-bg); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps li { counter-increment: s; position: relative; padding-left: 48px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 800; display: grid; place-items: center; }
.steps b { color: var(--navy); }
.plazo { text-align: center; }
.plazo .n { font-size: 2.4rem; font-weight: 800; color: var(--blue); line-height: 1; }
.plazo .t { font-weight: 700; color: var(--navy); margin-top: 6px; }
.notice { background: var(--warn-bg); border: 1px solid #f3d98b; color: #5c3d00; padding: 14px 16px; border-radius: 12px; font-size: .92rem; }
.site-footer { background: var(--navy); color: #c9d3ee; padding: 40px 0; font-size: .9rem; }
.site-footer a { color: #fff; }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr; gap: 30px; }
.site-footer img { height: 70px; background: #fff; border-radius: 10px; padding: 4px 8px; margin-bottom: 12px; }

/* badges */
.badge { display: inline-block; padding: .15em .65em; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.verif { display: inline-block; background: var(--warn-bg); color: var(--warn); border: 1px solid #f3d98b; border-radius: 6px; padding: 0 .4em; font-size: .72rem; font-weight: 800; letter-spacing: .02em; }

/* tablas */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f0f3fa; color: var(--navy); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* guía */
.doc-layout { display: grid; grid-template-columns: 250px 1fr; gap: 40px; align-items: start; padding: 40px 0 80px; }
.toc { position: sticky; top: 88px; font-size: .92rem; max-height: calc(100vh - 110px); overflow: auto; }
.toc a { display: block; padding: 6px 12px; border-left: 3px solid var(--line); color: var(--muted); text-decoration: none; }
.toc a:hover, .toc a.on { border-color: var(--yellow); color: var(--navy); font-weight: 600; }
.toc .grp { margin: 14px 0 4px 12px; font-size: .72rem; font-weight: 800; letter-spacing: .08em; color: var(--navy); text-transform: uppercase; }
.doc h2 { margin-top: 2.2em; padding-top: .6em; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.doc h2:first-child { margin-top: 0; border: 0; }
.doc h3 { margin-top: 1.4em; scroll-margin-top: 90px; }
details.acc { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
details.acc > summary { cursor: pointer; padding: 14px 18px; font-weight: 700; color: var(--navy); list-style: none; display: flex; gap: 10px; align-items: center; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: "+"; margin-left: auto; font-size: 1.3rem; color: var(--blue); }
details.acc[open] > summary::after { content: "–"; }
details.acc .body { padding: 0 18px 18px; }
.example { background: #f7f9ff; border-left: 4px solid var(--yellow); padding: 12px 16px; border-radius: 0 10px 10px 0; font-size: .92rem; }
.example::before { content: "EJEMPLO PRÁCTICO FICTICIO"; display: block; font-size: .68rem; font-weight: 800; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.sector-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.c-azul { background: #1e6fe0; } .c-verde { background: #12a06b; } .c-naranja { background: #f08a1c; } .c-morado { background: #8b5cf6; } .c-gris { background: #8a93a8; }
ol.pasos { padding-left: 1.3em; } ol.pasos li { margin-bottom: .4em; }

/* ---- App ---- */
.app-top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 15; }
.app-top .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.app-top .brand img { height: 38px; } .app-top .brand-name { font-size: 1.1rem; }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.app-main { padding: 28px 0 80px; min-height: 70vh; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 1.7rem; margin: 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.auth-box { max-width: 460px; margin: 40px auto; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg); padding: 5px; border-radius: 12px; margin-bottom: 18px; }
.seg button { padding: 10px; border: 0; background: transparent; border-radius: 9px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.role-pick { display: grid; gap: 8px; margin-bottom: 14px; }
.role-pick label { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.role-pick label:has(input:checked) { border-color: var(--blue); background: var(--info-bg); }
.role-pick input { margin-top: 4px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; color: var(--navy); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=month], input[type=number], select, textarea { width: 100%; padding: .6em .8em; font: inherit; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(10, 91, 211, .15); }
textarea { min-height: 110px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: .92rem; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a.on { color: var(--navy); border-color: var(--yellow); }
.tabs a .badge { margin-left: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .v { font-size: 1.9rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat.bad .v { color: var(--bad); } .stat.ok .v { color: var(--ok); }
.stat .l { font-size: .82rem; color: var(--muted); }
.list { display: grid; gap: 10px; }
.item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.item .grow { flex: 1; min-width: 200px; }
.item .t { font-weight: 700; color: var(--navy); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { padding: .3em .9em; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.cat-title { margin: 24px 0 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; }
.file { display: flex; gap: 8px; align-items: center; font-size: .86rem; margin-top: 4px; }
.file a { word-break: break-all; }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); border: 2px dashed var(--line); border-radius: 14px; background: #fff; }
.code { font: 700 1.05rem ui-monospace, Menlo, monospace; background: var(--bg); padding: .25em .6em; border-radius: 8px; letter-spacing: .06em; }
.modal-bg { position: fixed; inset: 0; background: rgba(11, 31, 79, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: 92vh; overflow: auto; padding: 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.modal.wide { width: min(760px, 100%); }
.modal h3 { margin-bottom: 14px; }
.modal .foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 12px; z-index: 80; box-shadow: var(--shadow); font-weight: 600; max-width: 92vw; }
.toast.err { background: var(--bad); }
.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.editor textarea { min-height: 70vh; font: .85rem/1.5 ui-monospace, Menlo, monospace; }
.preview { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px 26px; min-height: 70vh; max-height: 80vh; overflow: auto; }
.md h1 { font-size: 1.5rem; } .md h2 { font-size: 1.2rem; margin-top: 1.4em; } .md h3 { font-size: 1.05rem; }
.md table { margin: 1em 0; border: 1px solid var(--line); } .md blockquote { margin: 1em 0; padding: .5em 1em; border-left: 4px solid var(--red); background: var(--bad-bg); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.5em 0; }
.spinner { width: 18px; height: 18px; border: 3px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }
.alert-box { border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; font-size: .92rem; }
.alert-box.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid #f1c0c2; }
.alert-box.info { background: var(--info-bg); color: var(--info); border: 1px solid #c3d6f6; }
.alert-box.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #f3d98b; }

@media (max-width: 900px) {
  .hero .wrap, .grid.c3, .grid.c2, .grid.c4, .doc-layout, .site-footer .wrap, .editor { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; display: none; }
  .nav { display: none; position: absolute; top: 68px; left: 0; right: 0; background: #fff; flex-direction: column; padding: 18px; border-bottom: 1px solid var(--line); align-items: stretch; gap: 14px; }
  .nav.open { display: flex; }
  .menu-btn { display: block; }
  .row2 { grid-template-columns: 1fr; }
  .hero { padding: 44px 0; }
  .section { padding: 48px 0; }
}
@media print { .site-header, .app-top, .tabs, .actions, .editor textarea { display: none !important; } .editor { grid-template-columns: 1fr; } .preview { border: 0; max-height: none; } }
