/* ===== Tokens ===== */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --ink: #1c1b19;
  --muted: #6c6862;
  --line: #e3dfd6;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #d6efec;
  --good: #15803d;
  --good-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 27, 25, .05), 0 4px 16px rgba(28, 27, 25, .04);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413;
    --surface: #1d1c1a;
    --surface-2: #262522;
    --ink: #f1efe9;
    --muted: #a7a29a;
    --line: #34322e;
    --accent: #2dd4bf;
    --accent-ink: #062a27;
    --accent-soft: #123a36;
    --good: #4ade80;
    --good-soft: #14321f;
    --warn: #fbbf24;
    --warn-soft: #3a2c0b;
    --bad: #f87171;
    --bad-soft: #3b1515;
    --shadow: none;
    color-scheme: dark;
  }
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
img { max-width: 100%; }
input, select, textarea, button { font: inherit; color: inherit; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 32px; padding-bottom: 48px; min-height: 70vh; }
.muted { color: var(--muted); }
.center { text-align: center; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 62ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 600; color: var(--accent); margin-bottom: .5em; }
.h-sm { font-size: .95rem; margin-top: 1.2em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.stack > * + * { margin-top: 20px; }

/* ===== Topbar ===== */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.brand-mark { color: var(--accent); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); background: var(--surface-2); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.topbar-actions form { margin: 0; }
.lang-form select { padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.footer { color: var(--muted); font-size: .85rem; padding-top: 24px; padding-bottom: 32px; border-top: 1px solid var(--line); }

/* ===== Botones ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, opacity .15s; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-sm { padding: 6px 12px; font-size: .88rem; border-radius: 8px; }
.btn-lg { padding: 13px 24px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ===== Tarjetas y layout ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card + .card, section + section { margin-top: 20px; }
.card.narrow { max-width: 440px; margin: 24px auto; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.grid-2 > .card + .card, .grid-3 > .card + .card, .grid-4 > .card + .card { margin-top: 0; }
.grid-2 + section, .grid-3 + section, .stats + section { margin-top: 20px; }
.page-head { margin-bottom: 28px; }
.section-title { margin-top: 32px; }

/* ===== Home ===== */
.hero { padding: 40px 0 32px; max-width: 760px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.steps { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.steps .card + .card { margin-top: 0; }
.step-num { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; margin-bottom: 12px; }
.ladder { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); counter-reset: l; }
.ladder li { padding: 14px; background: var(--surface-2); border-radius: 10px; display: flex; flex-direction: column; gap: 4px; }
.ladder span { color: var(--muted); font-size: .9rem; }

/* ===== Formularios ===== */
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 6px; font-weight: 500; font-size: .95rem; }
.form label.check { display: flex; align-items: center; gap: 8px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { resize: vertical; }
.input-sm { max-width: 90px; padding: 6px 8px !important; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.search { margin: 0 0 16px; max-width: 360px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.inline-form select { width: auto; }

/* ===== Alertas, etiquetas ===== */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-weight: 500; }
.alert-success { background: var(--good-soft); color: var(--good); }
.alert-error { background: var(--bad-soft); color: var(--bad); }
.alert-info { background: var(--accent-soft); color: var(--ink); font-weight: 400; }
.alert-info a { color: var(--accent); font-weight: 600; white-space: nowrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.tag-alt { background: var(--accent-soft); color: var(--accent); }
.tag-good { background: var(--good-soft); color: var(--good); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tags { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.pill { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--good-soft); color: var(--good); font-size: .9rem; font-weight: 500; }

/* ===== Barras ===== */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.bar-head { display: flex; justify-content: space-between; gap: 12px; font-size: .93rem; margin-bottom: 4px; }
.bar-head strong { font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-lg { height: 12px; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; opacity: .75; }
.bar-fill.is-high { opacity: 1; }
.bar-fill.is-low { background: var(--warn); opacity: .8; }
.readiness { display: grid; gap: 6px; margin: 12px 0; }

/* ===== Listas ===== */
.list { list-style: none; padding: 0; margin: 0 0 12px; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list-block li { display: block; }
.match-list { padding-left: 1.2em; margin: 0; }
.match-list li { padding: 8px 0; display: flex; justify-content: space-between; gap: 8px; }
.goal-name { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.cta-card { text-align: center; padding: 40px 24px; }

/* ===== Test ===== */
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; position: sticky; top: 60px; z-index: 5; }
.progress-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.progress-label { font-size: .85rem; margin: 6px 0 16px; text-align: right; }
.test-page { border: 0; padding: 0; margin: 0; min-width: 0; }
.question { margin-bottom: 16px; transition: border-color .2s; }
.question + .question { margin-top: 0; }
.question.is-missing { border-color: var(--bad); }
.question-text { font-weight: 600; font-size: 1.05rem; }
.likert { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.likert-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; text-align: center; }
.likert-opt input { position: absolute; opacity: 0; }
.likert-dot { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); transition: all .15s; }
.likert-opt:nth-child(1) .likert-dot, .likert-opt:nth-child(5) .likert-dot { width: 40px; height: 40px; }
.likert-opt input:checked + .likert-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.likert-opt input:focus-visible + .likert-dot { outline: 2px solid var(--accent); outline-offset: 2px; }
.likert-label { font-size: .75rem; color: var(--muted); line-height: 1.2; }
.choices { display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { accent-color: var(--accent); width: 18px; height: 18px; flex-shrink: 0; }
.test-nav { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin-top: 8px; }
.test-nav [data-next], .test-nav [data-submit] { margin-left: auto; }
.test-error { color: var(--bad); margin: 0; font-weight: 500; }

/* ===== Resultados y roles ===== */
.radar-wrap { max-width: 440px; margin: 0 auto; }
.ego { margin-top: 16px; padding: 14px; background: var(--surface-2); border-radius: 10px; }
.ego p { margin: 0; }
.role-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.role-grid .card + .card { margin-top: 0; }
.role-card { display: flex; flex-direction: column; }
.role-card.is-top { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.role-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.role-card h3 a { color: var(--ink); text-decoration: none; }
.role-card .rank { color: var(--muted); font-weight: 600; }
.role-card .score { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.reason { font-size: .9rem; margin-bottom: 6px; }
.role-card-actions { margin-top: auto; padding-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.role-card-actions form { margin: 0; }
.fit-big { display: flex; align-items: baseline; gap: 8px; color: var(--muted); }
.fit-big span { font-family: var(--font-display); font-size: 2.4rem; font-weight: 700; color: var(--accent); }
.skill-req { list-style: none; padding: 0; margin: 0; }
.skill-req li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.skill-req .level { color: var(--accent); letter-spacing: 2px; white-space: nowrap; }

/* ===== Autoevaluación ===== */
.rate-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rate-row:last-child { border-bottom: 0; }
.rate-info { flex: 1 1 300px; }
.rate-info p { margin: 2px 0 0; font-size: .9rem; }
.traffic { display: flex; gap: 6px; }
.traffic-opt { cursor: pointer; }
.traffic-opt input { position: absolute; opacity: 0; }
.traffic-opt span { display: inline-block; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); font-size: .88rem; font-weight: 500; }
.traffic-weak input:checked + span { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.traffic-improvable input:checked + span { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.traffic-strong input:checked + span { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.traffic-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Plan ===== */
.stats { margin-bottom: 20px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { color: var(--muted); font-size: .9rem; }
.plan-list { padding-left: 1.2em; margin: 0; }
.plan-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.plan-item:last-child { border-bottom: 0; }
.plan-item-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.plan-item p { margin: 4px 0; }
.plan-levels { font-size: .88rem; }
.resources { margin: 6px 0 0; padding-left: 1.2em; font-size: .9rem; }
.ai-card { border-style: dashed; }

/* ===== Informe ===== */
.prose { max-width: 760px; margin: 0 auto; font-size: 1.02rem; }
.prose h2 { font-family: var(--font-display); font-size: 1.35rem; margin-top: 1.6em; }
.prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.prose h3 { margin-top: 1.2em; }
.prose blockquote { margin: 0 0 1.2em; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; color: var(--muted); }
.prose code { font-size: .9em; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); }

/* ===== Admin ===== */
.admin { display: grid; grid-template-columns: 210px 1fr; gap: 28px; }
.admin-side { display: flex; flex-direction: column; gap: 2px; }
.admin-side a { padding: 7px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .93rem; }
.admin-side a:hover, .admin-side a[aria-current] { background: var(--surface); color: var(--ink); }
.admin-side-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin: 14px 10px 4px; }
.admin-main { min-width: 0; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-head h1 { margin: 0; font-size: 1.7rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table .actions { white-space: nowrap; }
.score-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; font-size: .85rem; }
.score-grid label { display: grid; gap: 4px; }
.tr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 8px 0; }
.tr-base p { margin: 2px 0 0; font-size: .92rem; }

@media (max-width: 760px) {
  .admin { grid-template-columns: 1fr; }
  .admin-side { flex-direction: row; flex-wrap: wrap; }
  .admin-side-title { width: 100%; margin: 8px 0 0; }
  .tr-row { grid-template-columns: 1fr; }
  .likert-label { font-size: .65rem; }
  .likert-dot { width: 28px; height: 28px; }
  .likert-opt:nth-child(1) .likert-dot, .likert-opt:nth-child(5) .likert-dot { width: 32px; height: 32px; }
  .card { padding: 18px; }
  .topbar-inner { padding-top: 8px; padding-bottom: 8px; }
}

@media print {
  .topbar, .footer, .no-print { display: none; }
  body { background: #fff; }
  .card { border: 0; box-shadow: none; }
}
