/* Portal del empleado — tokens de fibex-blueprint (src/styles/tokens.css), claro y oscuro. */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-display: swap; src: url('fonts/poppins-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 600; font-display: swap; src: url('fonts/poppins-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 700; font-display: swap; src: url('fonts/poppins-latin-700-normal.woff2') format('woff2'); }

:root {
  color-scheme: light dark;
  --background: #f6f7f9; --surface: #ffffff; --surface-raised: #ffffff; --surface-muted: #f2f4f7;
  --border: #e4e7ec; --border-strong: #d0d5dd; --overlay: rgb(16 24 40 / 0.45);
  --text-primary: #101828; --text-secondary: #475467; --text-muted: #667085; --text-disabled: #98a2b3;
  --primary: #1e4fbf; --primary-hover: #1a43a3; --primary-active: #163a8c; --primary-subtle: #eef3fc;
  --primary-text-on-subtle: #1e4fbf; --on-primary: #ffffff; --link: #1e4fbf; --focus-ring: #1e4fbf;
  --success-bg-subtle: #f0fdf4; --success-border: #bbf7d0; --success-text: #15803d; --success-solid: #15803d;
  --warning-bg-subtle: #fffbeb; --warning-border: #fde68a; --warning-text: #92400e; --warning-solid: #b45309;
  --danger-bg-subtle: #fef2f2; --danger-border: #fecaca; --danger-text: #b91c1c; --danger-solid: #b91c1c;
  --info-bg-subtle: #eff6ff; --info-border: #bfdbfe; --info-text: #1d4ed8; --info-solid: #1e4fbf;
  --chart-1: #1e4fbf; --ring-track: #e4e7ec;
  --radius-control: 8px; --radius-card: 12px; --radius-dialog: 16px;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.05);
  --shadow-md: 0 4px 8px -2px rgb(16 24 40 / 0.08), 0 2px 4px -2px rgb(16 24 40 / 0.04);
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Poppins', 'Inter', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #080d18; --surface: #121a2b; --surface-raised: #162034; --surface-muted: #0d1524;
    --border: #263148; --border-strong: #35425c; --overlay: rgb(0 0 0 / 0.6);
    --text-primary: #e8eef8; --text-secondary: #9dabc4; --text-muted: #8a98b3; --text-disabled: #5b6880;
    --primary: #3366e0; --primary-hover: #2d5fd3; --primary-active: #2753bc; --primary-subtle: #1a2d55;
    --primary-text-on-subtle: #c9d8fa; --on-primary: #ffffff; --link: #8db0f5; --focus-ring: #7fa6f2;
    --success-bg-subtle: #0b2a1a; --success-border: #14532d; --success-text: #86efac; --success-solid: #15803d;
    --warning-bg-subtle: #2b1d05; --warning-border: #78350f; --warning-text: #fcd34d; --warning-solid: #b45309;
    --danger-bg-subtle: #2a0b0b; --danger-border: #7f1d1d; --danger-text: #fca5a5; --danger-solid: #b91c1c;
    --info-bg-subtle: #0f1d33; --info-border: #1e3a8a; --info-text: #93c5fd; --info-solid: #3366e0;
    --chart-1: #7fa6f2; --ring-track: #263148;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--background); color: var(--text-primary);
  font: 400 16px/1.5 var(--font-body);
}
img { max-width: 100%; display: block; }
a { color: var(--link); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--primary); color: var(--on-primary); padding: 8px 12px; border-radius: var(--radius-control); z-index: 50; }
.skip:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* Barra superior */
.bar { position: sticky; top: 0; z-index: 20; height: 64px; background: var(--surface-raised); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.bar-in { max-width: 1040px; margin: 0 auto; height: 100%; padding: 0 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-primary); }
.brand img { height: 28px; width: auto; }
.brand span { font: 600 15px/1.2 var(--font-heading); color: var(--text-secondary); border-left: 1px solid var(--border); padding-left: 10px; }
.nav-top { display: none; margin-left: auto; gap: 4px; }
.nav-top a, .nav-bottom a { text-decoration: none; color: var(--text-secondary); font-weight: 500; }
.nav-top a { padding: 8px 12px; border-radius: var(--radius-control); }
.nav-top a:hover { background: var(--surface-muted); color: var(--text-primary); }
.nav-top a[aria-current='page'] { background: var(--primary-subtle); color: var(--primary-text-on-subtle); }
.bar .out { margin-left: auto; }
@media (min-width: 760px) { .nav-top { display: flex; } .bar .out { margin-left: 8px; } }

/* Navegación inferior (teléfono) */
.nav-bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface-raised); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.nav-bottom a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 10px; font-size: 12px; }
.nav-bottom svg { width: 22px; height: 22px; }
.nav-bottom a[aria-current='page'] { color: var(--primary-text-on-subtle); }
.nav-bottom a[aria-current='page'] svg { stroke: var(--primary); }
@media (min-width: 760px) { .nav-bottom { display: none; } }

main { max-width: 1040px; margin: 0 auto; padding: 20px 16px 104px; }
@media (min-width: 760px) { main { padding: 32px 40px 48px; } }
.narrow { max-width: 440px; margin: 0 auto; }

h1, h2, h3 { font-family: var(--font-heading); margin: 0; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 600; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--text-secondary); }
.small { font-size: 14px; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.head { margin-bottom: 20px; }
.head p { margin-top: 4px; color: var(--text-secondary); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); padding: 20px; }
.card + .card { margin-top: 16px; }

/* Campos */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .legend { font-weight: 500; font-size: 14px; color: var(--text-primary); }
.field .help { font-size: 13px; color: var(--text-muted); }
.field .err { font-size: 13px; color: var(--danger-text); min-height: 0; }
.input, select.input { width: 100%; height: 44px; padding: 0 12px; font: 400 16px var(--font-body); color: var(--text-primary);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-control); }
.input:focus { outline: 2px solid var(--focus-ring); outline-offset: 0; border-color: var(--focus-ring); }
.input[aria-invalid='true'] { border-color: var(--danger-text); }
textarea.input { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
.doc { display: grid; grid-template-columns: 76px 1fr; gap: 8px; }
.pin { letter-spacing: 0.4em; font-size: 20px; text-align: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.unit { position: relative; }
.unit .input { padding-right: 52px; }
.unit span { position: absolute; right: 12px; top: 11px; color: var(--text-muted); font-size: 14px; }
.badge-read { font-size: 12px; color: var(--success-text); }
.badge-miss { font-size: 12px; color: var(--warning-text); }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  font: 600 15px var(--font-heading); border-radius: var(--radius-control); border: 1px solid transparent; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-active); }
.btn-secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-muted); }
.btn-ghost { background: transparent; color: var(--link); padding: 0 8px; min-height: 36px; }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 16px; }
.btn[aria-busy='true'] { opacity: 0.85; cursor: progress; }
.btn:disabled { cursor: not-allowed; opacity: 0.6; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: rot 0.8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }

/* Avisos */
.notice { border-radius: var(--radius-control); padding: 12px 14px; border: 1px solid; font-size: 14px; }
.notice b { display: block; margin-bottom: 2px; }
.n-danger { background: var(--danger-bg-subtle); border-color: var(--danger-border); color: var(--danger-text); }
.n-warning { background: var(--warning-bg-subtle); border-color: var(--warning-border); color: var(--warning-text); }
.n-success { background: var(--success-bg-subtle); border-color: var(--success-border); color: var(--success-text); }
.n-info { background: var(--info-bg-subtle); border-color: var(--info-border); color: var(--info-text); }

/* Inicio */
.hero { display: grid; gap: 20px; align-items: center; grid-template-columns: 1fr; }
@media (min-width: 760px) { .hero { grid-template-columns: 220px 1fr; } }
.ring { position: relative; width: 180px; height: 180px; margin: 0 auto; }
.ring svg { width: 180px; height: 180px; transform: rotate(-90deg); }
.ring .track { stroke: var(--ring-track); }
.ring .bar-ring { stroke: var(--primary); transition: stroke-dashoffset 0.6s ease; }
.ring.done .bar-ring { stroke: var(--success-solid); }
@media (prefers-reduced-motion: reduce) { .ring .bar-ring { transition: none; } }
.ring .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .big { font: 700 40px/1 var(--font-heading); }
.ring .of { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px 16px; }
.stat .k { font-size: 13px; color: var(--text-secondary); }
.stat .v { font: 600 22px/1.2 var(--font-heading); margin-top: 4px; }
.stat .v small { font: 500 13px var(--font-body); color: var(--text-muted); margin-left: 4px; }

/* Elegir herramienta */
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border: 0; padding: 0; margin: 0; }
.tool { position: relative; }
.tool input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tool label { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 2px solid var(--border); border-radius: var(--radius-card);
  background: var(--surface); cursor: pointer; min-height: 92px; }
.tool label b { font: 600 17px var(--font-heading); }
.tool label span { font-size: 13px; color: var(--text-secondary); }
.tool input:checked + label { border-color: var(--primary); background: var(--primary-subtle); }
.tool input:focus-visible + label { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.seg { display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border-strong); border-radius: var(--radius-control); overflow: hidden; width: 100%; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { text-align: center; padding: 10px; cursor: pointer; font-weight: 500; background: var(--surface); }
.seg input:checked + label { background: var(--primary); color: var(--on-primary); }
.seg input:focus-visible + label { outline: 2px solid var(--focus-ring); outline-offset: -3px; }

.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 28px 16px;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-card); background: var(--surface); cursor: pointer; }
.drop:hover { border-color: var(--primary); }
.drop svg { width: 36px; height: 36px; stroke: var(--primary); }
.upload-grid { display: grid; gap: 20px; }
@media (min-width: 760px) { .upload-grid { grid-template-columns: 280px 1fr; align-items: start; } }
.preview { border-radius: var(--radius-card); border: 1px solid var(--border); overflow: hidden; background: var(--surface-muted); max-height: 520px; }
.preview img { width: 100%; height: auto; object-fit: contain; max-height: 520px; }
.reading { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: var(--radius-control); background: var(--info-bg-subtle); color: var(--info-text); }

/* Mis pruebas */
.tests { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
@media (min-width: 760px) { .tests { grid-template-columns: 1fr 1fr; } }
.test { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.thumb { width: 64px; height: 96px; border-radius: 6px; background: var(--surface-muted); object-fit: cover; border: 1px solid var(--border); }
.test .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.test .vals { font: 600 15px var(--font-heading); margin-top: 4px; }
.test .vals span { font: 400 13px var(--font-body); color: var(--text-secondary); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.p-valid { background: var(--success-bg-subtle); border-color: var(--success-border); color: var(--success-text); }
.p-review { background: var(--warning-bg-subtle); border-color: var(--warning-border); color: var(--warning-text); }
.p-rejected { background: var(--danger-bg-subtle); border-color: var(--danger-border); color: var(--danger-text); }
.p-below { background: var(--surface-muted); border-color: var(--border-strong); color: var(--text-secondary); }

/* Ayuda */
.steps { margin: 0; padding-left: 22px; }
.steps li { margin: 6px 0; }
.cols { display: grid; gap: 16px; }
@media (min-width: 760px) { .cols { grid-template-columns: 1fr 1fr; } }
.mins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.skeleton { background: var(--surface-muted); border-radius: var(--radius-control); min-height: 18px; }
.center-screen { min-height: calc(100vh - 64px); display: flex; align-items: flex-start; justify-content: center; padding-top: 6vh; }
.foot { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 32px; }
.toast { position: fixed; left: 16px; right: 16px; bottom: 84px; z-index: 40; max-width: 420px; margin: 0 auto; box-shadow: var(--shadow-md); }
@media (min-width: 760px) { .toast { left: auto; right: 24px; top: 80px; bottom: auto; } }
