/* rrhh-saas — sistema de diseño base. Tokens claro/oscuro, layout, componentes. Sin dependencias. */
:root {
  --bg: #f3f4f6; --surface: #ffffff; --surface-2: #f8f9fb; --ink: #171a20; --muted: #5d6471; --line: #dfe3e9; --line-strong: #c6ccd6;
  --accent: #2554c7; --accent-ink: #1d44a3; --accent-soft: #e5ecfb; --on-accent: #ffffff;
  --ok: #1b6b45; --ok-soft: #def4e7; --warn: #7a4f00; --warn-soft: #fcefd2; --bad: #b3261e; --bad-soft: #fbe3e1; --info: #2554c7; --info-soft: #e5ecfb;
  --on-ok: #ffffff; --on-warn: #ffffff; --on-bad: #ffffff; --field-line: #7a8494;
  --shadow: 0 1px 2px rgba(23, 26, 32, .06), 0 8px 24px -12px rgba(23, 26, 32, .18);
  --r: 10px; --r-sm: 7px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --side: 236px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #111418; --surface: #1a1e25; --surface-2: #20252d; --ink: #e8eaee; --muted: #9aa3b0; --line: #2c323c; --line-strong: #404854;
  --accent: #7ea2ff; --accent-ink: #a9c0ff; --accent-soft: #1f2a45; --on-accent: #0c1530;
  --ok: #6fd39a; --ok-soft: #173426; --warn: #f3c56b; --warn-soft: #3a2d12; --bad: #f59389; --bad-soft: #42211e; --info: #7ea2ff; --info-soft: #1f2a45;
  --on-ok: #0c1530; --on-warn: #1a1e25; --on-bad: #1a1e25; --field-line: #6f7a8a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #111418; --surface: #1a1e25; --surface-2: #20252d; --ink: #e8eaee; --muted: #9aa3b0; --line: #2c323c; --line-strong: #404854;
  --accent: #7ea2ff; --accent-ink: #a9c0ff; --accent-soft: #1f2a45; --on-accent: #0c1530;
  --ok: #6fd39a; --ok-soft: #173426; --warn: #f3c56b; --warn-soft: #3a2d12; --bad: #f59389; --bad-soft: #42211e; --info: #7ea2ff; --info-soft: #1f2a45;
  --on-ok: #0c1530; --on-warn: #1a1e25; --on-bad: #1a1e25; --field-line: #6f7a8a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; scroll-padding-bottom: 88px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font); min-height: 100dvh; text-wrap: pretty; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.2; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
.sub, .muted { color: var(--muted); }
.sub { max-width: 60ch; }
small, .small { font-size: 13px; }
code { font: 13px/1.4 ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); z-index: 50; }
.skip:focus { left: 8px; }

/* ---- layout público ---- */
.pub-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left)); max-width: 1120px; margin: 0 auto; }
.pub-top nav { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
.pub-top .brand { white-space: nowrap; padding-inline: 0; }
@media (max-width: 420px) { .pub-top { gap: 8px; } .pub-top nav { gap: 4px; } .pub-top nav .btn { padding-inline: 10px; } }
.pub-main { max-width: 1120px; margin: 0 auto; padding: 24px 16px 48px; }
.pub-foot { color: var(--muted); font-size: 13px; padding: 24px 16px; border-top: 1px solid var(--line); max-width: 1120px; margin: 0 auto; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 40px; align-items: center; padding: 32px 0 48px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); }
.hero .lead { font-size: 18px; color: var(--muted); max-width: 48ch; margin-top: 14px; }
.hero .acts { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.feats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 16px; }
.feat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.feat .ic { width: 22px; height: 22px; color: var(--accent); }
.mock { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.mock .bar { height: 10px; border-radius: 6px; background: var(--surface-2); }
.mock .row { display: flex; gap: 10px; align-items: center; }
.mock .dot { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); flex: none; }
.mock .bar.w1 { width: 60%; } .mock .bar.w2 { width: 35%; } .mock .bar.w3 { width: 80%; }

/* ---- layout de acceso ---- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 18px; box-shadow: var(--shadow); }
.auth .brand { justify-content: center; }
.auth h1 { font-size: 22px; text-align: center; }
.auth .links { display: flex; flex-direction: column; gap: 6px; text-align: center; font-size: 14px; }

/* ---- layout de la app ---- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100dvh; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; padding: 16px 12px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: var(--ink); text-decoration: none; padding: 4px 8px; }
.brand .mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.brand .mark svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; }
.tenant-pick { display: flex; align-items: center; gap: 8px; padding: 10px 8px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink); border: 1px solid var(--line); margin: 6px 0; min-width: 0; }
.tenant-pick:hover { border-color: var(--line-strong); }
.tenant-pick .who { min-width: 0; flex: 1; }
.veil { display: none; }
.tenant-pick b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tenant-pick small { color: var(--muted); display: block; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .nav-title { margin: 12px 8px 4px; font: 600 11px var(--font); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-weight: 500; min-height: 40px; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.nav a .ic { color: var(--muted); } .nav a[aria-current="page"] .ic { color: var(--accent-ink); }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--accent); color: var(--on-accent); border-radius: 20px; padding: 1px 7px; min-width: 20px; text-align: center; }
.side .grow { flex: 1; }
.side .me { display: flex; align-items: center; gap: 10px; padding: 8px; border-top: 1px solid var(--line); margin-top: 6px; }
.side .me .who { min-width: 0; }
.av { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font: 600 12px var(--font); flex: none; }
.who b, .who span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who b { font-weight: 600; font-size: 14px; } .who span { color: var(--muted); font-size: 12px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.content { padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 1180px; width: 100%; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.head .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 24px; font-size: 14px; border-bottom: 1px solid var(--line); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner form { margin-left: auto; }

/* ---- componentes ---- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel > h2, .panel > .row > h2 { display: flex; align-items: center; gap: 8px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 20px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.kpi { background: var(--surface); padding: 14px 16px; min-width: 0; }
.kpi b { display: block; font: 700 26px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 600 14px var(--font); min-height: 40px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.pri:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.quiet:hover { background: var(--surface-2); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.lg { min-height: 46px; padding: 10px 20px; font-size: 15px; }
.btn.full { width: 100%; }
.btn:disabled, .btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; }
.btn[aria-busy="true"]::before { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .lbl { font-size: 13px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field .err { font-size: 13px; color: var(--bad); display: flex; gap: 5px; align-items: center; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { font: 400 15px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--field-line); border-radius: var(--r-sm); padding: 9px 11px; min-height: 40px; width: 100%; max-width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--bad); }
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 14px; }
.form .wide { grid-column: 1 / -1; }
.form-acts { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th { font: 600 11.5px var(--font); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td .btn { vertical-align: middle; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 20px; white-space: nowrap; line-height: 1.5; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.info { background: var(--info-soft); color: var(--info); }
.pill.mute { background: var(--surface-2); color: var(--muted); }
.list { display: flex; flex-direction: column; }
.item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .t { min-width: 0; flex: 1 1 240px; }
.item .t small { display: block; color: var(--muted); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); font-size: 14px; border: 1px solid transparent; }
.alert .ic { margin-top: 2px; }
.alert.ok { background: var(--ok-soft); color: var(--ok); } .alert.error, .alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.aviso, .alert.warn { background: var(--warn-soft); color: var(--warn); } .alert.info { background: var(--info-soft); color: var(--info); }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty .ic { width: 28px; height: 28px; color: var(--line-strong); }
.empty b { color: var(--ink); }
.steps { display: flex; flex-direction: column; gap: 2px; }
.steps a { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink); min-height: 40px; }
.steps a:hover { background: var(--surface-2); }
.steps .ok { color: var(--muted); text-decoration: line-through; }
.steps .mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; flex: none; }
.steps .ok .mark { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.steps .mark .ic { width: 14px; height: 14px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); z-index: 60; display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100% - 32px)); padding: 11px 14px; border-radius: var(--r-sm); background: var(--ink); color: var(--bg); box-shadow: var(--shadow); font-size: 14px; }
.toast.error { background: var(--bad); color: var(--on-bad); } .toast.aviso { background: var(--warn); color: var(--on-warn); }
.toast button { background: none; border: 0; color: inherit; cursor: pointer; padding: 4px; margin-left: 4px; display: grid; place-items: center; min-width: 32px; min-height: 32px; }
.offline { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 70; background: var(--warn); color: var(--on-warn); text-align: center; padding: 8px 12px; font-size: 14px; font-weight: 600; }
html.is-offline .offline { display: block; }
dialog.dlg { border: 0; border-radius: 14px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); width: min(440px, calc(100% - 32px)); }
dialog.dlg::backdrop { background: rgba(10, 12, 16, .5); }
dialog.dlg .in { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
dialog.dlg .acts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.skel { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: skel 1.2s infinite; border-radius: 6px; min-height: 14px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.qr { background: #fff; padding: 12px; border-radius: var(--r); width: fit-content; border: 1px solid var(--line); }
.qr svg { display: block; width: 200px; height: 200px; }
.codes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr)); gap: 8px; font: 15px ui-monospace, Consolas, monospace; }
.codes span { background: var(--surface-2); padding: 8px 10px; border-radius: var(--r-sm); text-align: center; letter-spacing: .05em; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips a { font: 500 13px var(--font); border: 1px solid var(--line-strong); border-radius: 20px; padding: 5px 12px; text-decoration: none; color: var(--muted); min-height: 32px; display: inline-flex; align-items: center; }
.chips a[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.json { font: 12.5px/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; color: var(--muted); margin: 0; max-width: 60ch; }
.prose { max-width: 68ch; display: flex; flex-direction: column; gap: 12px; }
.prose h2 { margin-top: 10px; }
.sel-inline { display: inline-flex; gap: 6px; align-items: center; }
.sel-inline select { min-height: 32px; padding: 3px 8px; font-size: 13px; width: auto; }
.theme { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; padding: 4px 8px; }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: none; }
  .side:not(.open) { visibility: hidden; transition: transform .2s, visibility 0s .2s; }
  .side.open { transform: none; box-shadow: var(--shadow); visibility: visible; transition: transform .2s; }
  .veil { position: fixed; inset: 0; background: rgba(10, 12, 16, .45); z-index: 30; }
  .veil.open { display: block; }
  .topbar { display: flex; }
  .content { padding: 16px; gap: 16px; }
  .banner { padding: 10px 16px; }
  h1 { font-size: 22px; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 16px 0 32px; }
  .mock { display: none; }
  table.cards thead { display: none; }
  table.cards tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.cards td { display: block; padding: 2px 0; border: 0; }
  table.cards td[data-l]::before { content: attr(data-l) " "; color: var(--muted); font-size: 12px; }
  table.cards td.acts { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; }
}
/* ---- utilidades (la CSP no permite style="" en línea) ---- */
.centro { text-align: center; margin-inline: auto; }
.angosto { max-width: 620px; margin: 0 auto; }
.w-sm { max-width: 200px; } .w-md { max-width: 340px; }
.mt-sm { margin-top: 12px; } .mt-lg { margin-top: 28px; }
.mayus { text-transform: uppercase; }
.inline { display: inline; }
.sin-liga { text-decoration: none; color: inherit; }
.sin-liga:hover { color: inherit; background: var(--surface-2); }
.holgado { padding: 40px 16px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.secreto { font-size: 15px; letter-spacing: .08em; }
.otp { font-size: 22px; letter-spacing: .2em; max-width: 200px; }

/* Objetivos táctiles ≥ 44 px en pantallas de toque (regla 4). */
@media (pointer: coarse), (max-width: 860px) {
  .btn, .btn.sm, .nav a, .steps a, .chips a, .toast button,
  input:not([type="checkbox"]):not([type="radio"]), select, .sel-inline select { min-height: 44px; }
  .check { min-height: 44px; align-items: center; }
  summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
  .check input { margin-top: 0; width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) { .side, .side:not(.open), .side.open { transition: none; } .skel, .btn[aria-busy="true"]::before { animation: none; } .btn:active { transform: none; } }
@media print { .side, .topbar, .toast, .offline { display: none !important; } .app { display: block; } }

.opt { font-weight: 400; color: var(--muted); }
