/* ==========================================================================
   Kit Integral de Gestión Humana — Estilos
   Colores tomados del logo: azul marino → azul petróleo → verde
   ========================================================================== */
:root {
  --navy-950: #061433;
  --navy-900: #081d48;
  --navy-800: #0a2463;
  --navy-700: #12317d;
  --blue: #1d5fd6;
  --blue-600: #1a4fb8;
  --teal: #0e9bb5;
  --green: #36a94a;
  --green-2: #7cc242;
  --grad-brand: linear-gradient(120deg, #12317d 0%, #1574c0 52%, #2ea65a 100%);
  --grad-active: linear-gradient(100deg, #1d5fd6, #0e9bb5);

  --bg: #f2f5fb;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --track: #e8edf6;
  --border: #e2e8f2;
  --text: #0d1b3e;
  --text-2: #475577;
  --muted: #8291ad;

  --ok: #16a34a;   --ok-bg: #e8f7ee;
  --info: #2563eb; --info-bg: #e9f0ff;
  --warn: #d97706; --warn-bg: #fff4e0;
  --bad: #dc2626;  --bad-bg: #fdecec;

  --radius: 18px;
  --radius-sm: 11px;
  --shadow-xs: 0 1px 2px rgba(13, 35, 85, .06);
  --shadow-sm: 0 1px 2px rgba(13, 35, 85, .05), 0 2px 8px -2px rgba(13, 35, 85, .07);
  --shadow: 0 10px 30px -12px rgba(13, 35, 85, .22);
  --shadow-lg: 0 24px 60px -18px rgba(8, 24, 70, .4);

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-head: 'Montserrat', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --font-hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;

  --side-w: 262px;
  --accent: var(--blue);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; font-size: .88em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.muted { color: var(--muted); }
.ico { width: 1.15em; height: 1.15em; flex: none; }
:focus-visible { outline: 3px solid rgba(29, 95, 214, .45); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Arranque ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--text-2); }
.boot img { width: 84px; animation: pulse 1.4s ease-in-out infinite; }
.boot.error { color: var(--bad); text-align: center; }
.boot.error .ico { width: 42px; height: 42px; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px; padding: 10px 18px;
  font-weight: 600; font-size: 14px; line-height: 1.2; white-space: nowrap;
  transition: transform .15s var(--ease), box-shadow .2s, background .2s, border-color .2s, color .2s;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--grad-active); color: #fff; box-shadow: 0 8px 18px -8px rgba(29, 95, 214, .7); }
.btn-primary:hover { box-shadow: 0 12px 24px -8px rgba(29, 95, 214, .8); transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 8px 18px -10px var(--accent); }
.btn-accent:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: #c9d4e6; color: var(--text); background: var(--surface-2); }
.btn-soft { background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent); }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 20%, white); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-light { background: #fff; color: var(--navy-800); box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 14px 24px; font-size: 15.5px; border-radius: 14px; }
.btn-block { width: 100%; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--text-2);
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.danger:hover { color: var(--bad); background: var(--bad-bg); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Distintivos ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.sem { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.sem::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent); }
.sem.ok { color: var(--ok); } .sem.warn { color: var(--warn); } .sem.bad { color: var(--bad); } .sem.muted { color: var(--muted); }
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: color-mix(in srgb, var(--av) 14%, white); color: var(--av); font-weight: 700; font-size: 13px; font-family: var(--font-head);
}
.stars { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: #b7791f; }
.star-ic { fill: #f5b301; stroke: #f5b301; }

/* ==========================================================================
   Inicio de sesión
   ========================================================================== */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-brand {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(1200px 600px at 10% 0%, #1a4fb8 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, #13784a 0%, transparent 55%), var(--navy-900);
  display: grid; place-items: center; padding: 48px;
}
.net { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-brand-inner { position: relative; max-width: 460px; animation: rise .9s var(--ease) both; }
.login-logo { background: #fff; border-radius: 26px; padding: 22px 26px; box-shadow: var(--shadow-lg); margin-bottom: 34px; }
.login-brand h2 { font-size: clamp(26px, 3vw, 38px); font-weight: 800; line-height: 1.15; }
.login-brand h2 span { background: linear-gradient(90deg, #7cd3ff, #8ee59b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-points { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.login-points li { display: flex; align-items: center; gap: 12px; color: #d6e2ff; }
.login-points .ico { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .1); color: #8ee59b; }
.login-form-wrap { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-form { width: 100%; max-width: 400px; display: grid; gap: 16px; animation: rise .8s .15s var(--ease) both; }
.login-mini { width: 64px; }
.login-form h1 { font-size: 30px; font-weight: 800; }
.login-form .lead { color: var(--text-2); margin-top: -8px; }
.input-ico { position: relative; }
.input-ico .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-ico input { padding-left: 42px !important; }
.form-error { color: var(--bad); background: var(--bad-bg); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.demo-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--info-bg); color: var(--info); --accent: var(--info); }
.demo-box div { flex: 1; display: grid; font-size: 13px; color: var(--text-2); }
.demo-box b { color: var(--text); }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }

/* ==========================================================================
   Pantalla de presentación
   ========================================================================== */
.splash {
  position: fixed; inset: 0; z-index: 100; color: #fff; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(1000px 600px at 50% 30%, #143a8f 0%, transparent 70%), radial-gradient(800px 500px at 90% 100%, #0f6b47 0%, transparent 60%), var(--navy-950);
  opacity: 0; transition: opacity .5s;
}
.splash.show { opacity: 1; }
.splash.leave { opacity: 0; transform: scale(1.04); transition: opacity .6s, transform .6s; }
.splash-glow { position: absolute; width: 620px; height: 620px; border-radius: 50%; background: radial-gradient(circle, rgba(46, 166, 90, .35), transparent 65%); filter: blur(10px); animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.15); opacity: .7; } }
.splash-inner { position: relative; display: grid; justify-items: center; gap: 26px; padding: 24px; text-align: center; }
.splash-logo {
  background: #fff; border-radius: 30px; padding: 20px 30px; width: min(520px, 86vw); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6), 0 0 0 8px rgba(255, 255, 255, .06);
  animation: logoIn 1.2s var(--ease) both;
}
@keyframes logoIn { 0% { opacity: 0; transform: scale(.6) rotate(-4deg); filter: blur(12px); } 60% { opacity: 1; filter: blur(0); } 100% { transform: none; } }
.splash-hand { position: relative; font-family: var(--font-hand); font-size: clamp(26px, 4vw, 42px); font-weight: 700; color: #dce8ff; animation: rise .8s 1s var(--ease) both; }
.splash-hand span { color: #8ee59b; }
.splash-hand svg { position: absolute; right: -2%; bottom: -10px; width: 58%; height: 18px; overflow: visible; }
.splash-hand path { fill: none; stroke: #8ee59b; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 320; stroke-dashoffset: 320; animation: draw 1s 1.6s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.splash-mods { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 22px; max-width: 760px; }
.splash-mod { display: grid; justify-items: center; gap: 8px; font-size: 13px; color: #c8d6f5; animation: pop .6s calc(1.9s + var(--i) * .09s) var(--ease) both; }
.splash-mod span { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: color-mix(in srgb, var(--c) 22%, transparent); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); color: #fff; }
.splash-mod .ico { width: 26px; height: 26px; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.7); } }
.splash-go { animation: rise .7s 2.7s var(--ease) both; }
.splash-go .ico { transition: transform .2s; }
.splash-go:hover .ico { transform: translateX(4px); }
.splash-hint { color: #8ea3cc; animation: rise .7s 3s var(--ease) both; }

/* ==========================================================================
   Estructura: menú lateral y barra superior
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: 18px 14px; overflow-y: auto;
  background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 60%, var(--navy-950) 100%); color: #c9d5f2; z-index: 40;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); margin-bottom: 6px; }
.brand-logo { flex: none; width: 52px; height: 52px; border-radius: 16px; background: #fff; padding: 5px; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .5); }
.brand-text { display: grid; line-height: 1.15; }
.brand-text strong { color: #fff; font-family: var(--font-head); font-size: 16.5px; font-weight: 800; }
.brand-text span { color: #dbe5ff; font-size: 13px; font-weight: 600; }
.brand-text em { font-style: normal; font-size: 11.5px; color: #8ee59b; margin-top: 2px; }
.nav { display: grid; gap: 2px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #6f83b3; padding: 12px 12px 4px; font-weight: 700; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: #c9d5f2;
  font-weight: 500; font-size: 14.5px; background: none; border: 0; width: 100%; text-align: left; transition: background .2s, color .2s;
}
.nav-item .ico { width: 20px; height: 20px; color: color-mix(in srgb, var(--c, #8fb0ff) 60%, white); transition: transform .25s var(--ease); }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item:hover .ico { transform: scale(1.12); }
.nav-item.active { background: var(--grad-active); color: #fff; box-shadow: 0 8px 20px -10px rgba(14, 155, 181, .9); }
.nav-item.active .ico { color: #fff; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 10px; }
.side-quote { font-family: var(--font-hand); font-size: 20px; line-height: 1.1; padding: 14px; border-radius: 14px; color: #c9d5f2; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .07); }
.side-quote b { color: #8ee59b; font-weight: 700; }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 28px; min-height: 66px;
  background: rgba(242, 245, 251, .82); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid rgba(226, 232, 242, .7);
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; }
.crumbs a:hover { color: var(--text); }
.crumbs > span:last-child, .crumbs > a:last-child { color: var(--text); font-weight: 600; }
.crumbs .ico { width: 15px; height: 15px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.save-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 6px 11px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.save-pill.saving { background: var(--info-bg); color: var(--info); }
.save-pill.error { background: var(--bad-bg); color: var(--bad); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.dot-count { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.user-chip span { display: grid; text-align: left; line-height: 1.2; }
.user-chip b { font-size: 13px; }
.user-chip small { font-size: 11.5px; color: var(--muted); }
.pop-wrap { position: relative; }
.popover {
  position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-height: 70vh; overflow: auto; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px;
  opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none; transition: opacity .18s, transform .18s var(--ease);
}
.popover.open { opacity: 1; transform: none; pointer-events: auto; }
.popover-menu { width: 230px; }
.popover-menu a, .popover-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 0; background: none; text-align: left; font-size: 14px; color: var(--text-2); }
.popover-menu a:hover, .popover-menu button:hover { background: var(--surface-2); color: var(--text); }
.pop-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 10px; font-weight: 700; font-family: var(--font-head); }
.pop-item { display: flex; gap: 10px; padding: 10px; border-radius: 10px; font-size: 13.5px; color: var(--text-2); align-items: flex-start; }
.pop-item:hover { background: var(--surface-2); color: var(--text); }
.pop-item .ico { color: var(--blue); margin-top: 2px; }
.pop-empty { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 18px; color: var(--ok); }
.bottom-nav { display: none; }

/* ==========================================================================
   Vista y encabezado de módulo
   ========================================================================== */
.view { padding: 24px 28px 48px; max-width: 1480px; width: 100%; margin: 0 auto; outline: none; }
.mod-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px;
}
.view.enter .card, .view.enter .tile { animation: cardIn .6s calc(var(--i, 0) * 55ms) var(--ease) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.985); } }
.view.static *, .view.static *::before { animation: none !important; }

.page-head { display: flex; align-items: center; gap: 16px; padding: 18px 22px; margin-bottom: 16px; position: relative; overflow: hidden; background: linear-gradient(100deg, var(--surface) 55%, color-mix(in srgb, var(--accent) 8%, white)); }
.view.enter .page-head { animation: cardIn .5s var(--ease) both; }
.ph-ico { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 15px; background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent); }
.ph-ico .ico { width: 26px; height: 26px; }
.ph-text { flex: 1; min-width: 0; }
.ph-text h1 { font-size: 22px; font-weight: 800; }
.ph-text p { color: var(--text-2); margin-top: 3px; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile {
  display: grid; justify-items: center; align-content: center; gap: 10px; padding: 16px 10px; text-align: center; min-height: 104px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-xs);
  font-size: 13px; font-weight: 600; color: var(--text-2); transition: transform .2s var(--ease), box-shadow .2s, border-color .2s, color .2s;
}
.tile-ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 11%, white); color: var(--accent); transition: transform .3s var(--ease), background .2s, color .2s; }
.tile-ico .ico { width: 23px; height: 23px; }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, white); color: var(--text); }
.tile:hover .tile-ico { transform: scale(1.08) rotate(-4deg); }
.tile.active { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent), var(--shadow-sm); }
.tile.active .tile-ico { background: var(--accent); color: #fff; }

/* Rejillas */
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.grid > *, .card { min-width: 0; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.g-32 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 16px; }
.kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head h3 .ico { color: var(--accent); }
.card-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.link { color: var(--accent); font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; }
.link:hover { text-decoration: underline; }

/* KPI */
.kpi { display: grid; gap: 8px; padding: 18px; position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent); }
.kpi-label { font-size: 13px; color: var(--text-2); font-weight: 600; line-height: 1.25; }
.kpi-val { font-family: var(--font-head); font-size: 30px; font-weight: 800; line-height: 1; color: var(--text); }
.kpi-val small { font-size: 16px; color: var(--text-2); font-weight: 700; margin-left: 2px; }
.kpi-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 20px; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.delta .ico { width: 13px; height: 13px; }
.delta.up { color: var(--ok); background: var(--ok-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.tbl th:first-child { border-radius: 10px 0 0 10px; } .tbl th:last-child { border-radius: 0 10px 10px 0; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, white); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .act { text-align: right; white-space: nowrap; }
.who { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.who b { display: block; font-weight: 600; }
.who small { color: var(--muted); font-size: 12.5px; }
.score { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-bar { width: 64px; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.score-bar i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 3px; }
.cell-input { width: 58px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; text-align: center; font-weight: 600; background: var(--surface); }
.cell-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.inline-select { padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; }

/* ---------- Listas ---------- */
.list { display: grid; gap: 4px; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; transition: background .15s; }
.list-item:hover { background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item b { font-weight: 600; display: block; }
.list-item small { color: var(--muted); font-size: 12.5px; }
.date-chip { flex: none; display: grid; place-items: center; width: 54px; padding: 6px 0; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, white); color: var(--accent); line-height: 1.05; }
.date-chip b { font-family: var(--font-head); font-size: 19px; font-weight: 800; }
.date-chip small { font-size: 11px; font-weight: 700; text-transform: uppercase; color: inherit; }
.ico-chip { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--c, var(--accent)) 12%, white); color: var(--c, var(--accent)); }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full, .form-grid fieldset { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .field legend { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field em { color: var(--bad); font-style: normal; }
.field small { color: var(--muted); font-size: 12px; }
fieldset.field { border: 0; padding: 0; margin: 0; }
.field input, .field select, .field textarea, .input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface);
  transition: border-color .2s, box-shadow .2s; font-size: 14.5px;
}
.field textarea { resize: vertical; min-height: 44px; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(29, 95, 214, .14); }
.invalid { border-color: var(--bad) !important; box-shadow: 0 0 0 4px rgba(220, 38, 38, .12) !important; }
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.check-grid .check { padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; transition: border-color .2s, background .2s; }
.check-grid .check:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, white); }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.search { position: relative; min-width: 220px; }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding: 9px 12px 9px 38px; border: 1px solid var(--border); border-radius: 11px; width: 100%; background: var(--surface); }
.select-sm { padding: 9px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }

/* Escala 1–5 */
.scale { display: inline-grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale-opt { position: relative; display: grid; justify-items: center; gap: 2px; cursor: pointer; }
.scale-opt input { position: absolute; opacity: 0; pointer-events: none; }
.scale-opt span {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  font-weight: 700; color: var(--text-2); transition: all .18s var(--ease);
}
.scale.compact .scale-opt span { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
.scale-opt small { font-size: 10.5px; color: var(--muted); text-align: center; }
.scale-opt:hover span { border-color: var(--accent); color: var(--accent); }
.scale-opt input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; transform: scale(1.08); box-shadow: 0 6px 14px -6px var(--accent); }
.scale-opt input:focus-visible + span { outline: 3px solid rgba(29, 95, 214, .45); outline-offset: 2px; }
.q-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px dashed var(--border); }
.q-row:last-child { border-bottom: 0; }
.q-row p { font-weight: 500; }
.q-row small { display: block; color: var(--accent); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }

/* ---------- Modales ---------- */
body.has-modal { overflow: hidden; }
.modal-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(6, 20, 51, .5); backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s; }
.modal-wrap.open { opacity: 1; }
.modal-wrap.closing { opacity: 0; }
.modal {
  width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(.97); transition: transform .3s var(--ease);
}
.modal-wrap.open .modal { transform: none; }
.modal-sm { max-width: 420px; } .modal-md { max-width: 640px; } .modal-lg { max-width: 880px; } .modal-xl { max-width: 1100px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head > div { flex: 1; }
.modal-head h3 { font-size: 18px; }
.modal-head p { color: var(--muted); font-size: 13px; }
.modal-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--info-bg); color: var(--info); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 22px 22px; }
.confirm-text { color: var(--text-2); }

/* ---------- Notificaciones ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: grid; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 380px; padding: 13px 16px; border-radius: 14px;
  background: var(--navy-900); color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; animation: toastIn .35s var(--ease) both;
}
.toast .ico { color: #8ee59b; width: 20px; height: 20px; }
.toast-error .ico { color: #fca5a5; }
.toast-info .ico { color: #93c5fd; }
.toast.out { opacity: 0; transform: translateX(30px); transition: all .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.95); } }

/* ---------- Gráficos ---------- */
.donut { position: relative; flex: none; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .arc { animation: arcIn 1.3s var(--ease) both; }
@keyframes arcIn { from { stroke-dasharray: 0 var(--c); } }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center strong { font-family: var(--font-head); font-size: 30px; font-weight: 800; line-height: 1; }
.donut-center > span { font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend-list { display: grid; gap: 10px; flex: 1; }
.legend-list div { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.legend-list i { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.legend-list b { margin-left: auto; font-variant-numeric: tabular-nums; }
.donut-row { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }

.bars { display: grid; gap: 12px; }
.bars.compact { gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 48px; align-items: center; gap: 12px; font-size: 13.5px; }
.bar-label { display: flex; align-items: center; gap: 8px; color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 9px; border-radius: 6px; background: var(--track); overflow: hidden; }
.bar-fill { display: block; height: 100%; width: var(--w); background: var(--c); border-radius: 6px; animation: barIn 1s var(--ease) both; }
@keyframes barIn { from { width: 0; } }
.bar-val { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.chart-line svg { width: 100%; height: auto; overflow: visible; }
.chart-line .grid { stroke: var(--border); stroke-dasharray: 3 4; }
.chart-line .axis { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.chart-line .ln { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; animation: lineIn 1.6s var(--ease) both; }
.chart-line .ln-area { opacity: .08; }
@keyframes lineIn { from { stroke-dashoffset: 1; } }
.chart-line .dot { stroke-width: 2.5; animation: pop .4s 1.2s both; transition: r .15s; }
.chart-line .dot:hover { r: 7; }
.chart-line .dot.last { r: 5.5; stroke-width: 3; }
.chart-line .series { transition: opacity .3s; }
.chart-line .series.hidden { opacity: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: flex-end; margin-bottom: 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; font-size: 13px; color: var(--text-2); padding: 3px 6px; border-radius: 8px; }
.legend-item:hover { background: var(--surface-2); }
.legend-item i { width: 18px; height: 4px; border-radius: 2px; }
.legend-item.off { opacity: .4; text-decoration: line-through; }

.progress { height: 8px; border-radius: 5px; background: var(--track); overflow: hidden; }
.progress i { display: block; height: 100%; width: var(--w); background: var(--c, var(--accent)); border-radius: 5px; animation: barIn 1s var(--ease) both; }

/* ---------- Estados vacíos ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 36px 16px; color: var(--text-2); }
.empty-ico { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: color-mix(in srgb, var(--accent) 10%, white); color: var(--accent); margin-bottom: 4px; }
.empty-ico .ico { width: 28px; height: 28px; }
.empty h4 { font-size: 16px; color: var(--text); }
.empty p { max-width: 380px; font-size: 14px; }
.empty .btn { margin-top: 8px; }

/* ==========================================================================
   Inicio
   ========================================================================== */
.hero {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: center; overflow: hidden;
  padding: 34px 36px; background: linear-gradient(135deg, #ffffff 0%, #f1f6ff 55%, #eefaf2 100%);
}
.hero h1 { font-size: clamp(30px, 3.4vw, 46px); font-weight: 800; color: var(--navy-800); }
.hero h2 { font-size: clamp(18px, 1.7vw, 23px); font-weight: 700; margin-top: 6px; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero h3 { font-size: 16px; color: var(--text); font-weight: 700; margin-top: 8px; }
.hero p.lead { color: var(--text-2); margin-top: 14px; max-width: 560px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.hero-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-size: 13.5px; font-weight: 600; color: var(--text-2); box-shadow: var(--shadow-xs); }
.hero-chip .ico { color: var(--c); }
.hero-date { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.hero-visual { position: relative; height: 320px; display: grid; place-items: center; }
.orbit { position: absolute; border-radius: 50%; border: 1.5px dashed color-mix(in srgb, var(--blue) 25%, transparent); animation: spin 60s linear infinite; }
.orbit.o1 { width: 300px; height: 300px; }
.orbit.o2 { width: 220px; height: 220px; animation-direction: reverse; animation-duration: 40s; border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.hero-iso { position: relative; width: 170px; height: 170px; border-radius: 50%; background: #fff; padding: 18px; box-shadow: 0 20px 50px -15px rgba(13, 35, 85, .35); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-10px); } }
.float-stat {
  position: absolute; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: #fff;
  box-shadow: var(--shadow); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); animation: float 7s ease-in-out infinite;
}
.float-stat b { display: block; font-family: var(--font-head); font-size: 18px; color: var(--text); line-height: 1.1; }
.float-stat .ico-chip { width: 36px; height: 36px; border-radius: 10px; }
.fs1 { top: 14px; left: 4%; animation-delay: -1s; }
.fs2 { top: 40px; right: 2%; animation-delay: -3s; }
.fs3 { bottom: 26px; left: 0; animation-delay: -2s; }
.fs4 { bottom: 8px; right: 6%; animation-delay: -4.5s; }

.mod-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.mod-card {
  position: relative; overflow: hidden; display: grid; justify-items: center; text-align: center; gap: 6px; padding: 20px 12px 18px; border-radius: 18px; color: #fff;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 82%, white), var(--c)); box-shadow: 0 14px 28px -16px var(--c);
  transition: transform .25s var(--ease), box-shadow .25s; border: 0;
}
.mod-card::after { content: ''; position: absolute; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .12); right: -50px; top: -60px; transition: transform .5s var(--ease); }
.mod-card:hover { transform: translateY(-5px); box-shadow: 0 22px 36px -16px var(--c); }
.mod-card:hover::after { transform: scale(1.4); }
.mod-card .mc-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; border: 2px solid rgba(255, 255, 255, .6); background: rgba(255, 255, 255, .15); }
.mod-card .mc-ico .ico { width: 26px; height: 26px; }
.mod-card b { font-family: var(--font-head); font-size: 15px; margin-top: 4px; }
.mod-card small { font-size: 12px; opacity: .9; line-height: 1.3; }
.mod-card .mc-stat { position: relative; z-index: 1; margin-top: 6px; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .2); }
.hand-note { font-family: var(--font-hand); font-size: 30px; line-height: 1; color: var(--navy-800); display: grid; place-content: center; text-align: center; padding: 8px; transform: rotate(-4deg); }
.hand-note span { color: var(--green); }
.hand-note svg { width: 150px; height: 14px; margin: 4px auto 0; }
.hand-note path { fill: none; stroke: var(--green); stroke-width: 3.5; stroke-linecap: round; }

.timeline { display: grid; gap: 2px; position: relative; }
.tl-item { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding: 6px 0; position: relative; }
.tl-item::before { content: ''; position: absolute; left: 10px; top: 26px; bottom: -10px; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--c, var(--accent)) 14%, white); color: var(--c, var(--accent)); margin-top: 2px; }
.tl-dot .ico { width: 12px; height: 12px; }
.tl-item p { font-size: 14px; }
.tl-item small { color: var(--muted); font-size: 12px; }

/* ==========================================================================
   Componentes de módulos
   ========================================================================== */
.ia-card { background: linear-gradient(150deg, #f5f1ff, #eef4ff); border-color: #ddd3fb; position: relative; overflow: hidden; }
.ia-card .ia-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ia-bot { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(135deg, #6d28d9, #2563eb); color: #fff; box-shadow: 0 10px 20px -10px #6d28d9; flex: none; }
.ia-bot .ico { width: 24px; height: 24px; }
.ia-card h3 { font-size: 15.5px; }
.ia-card p { color: var(--text-2); font-size: 14px; }
.ia-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: #6d28d9; background: #ede7ff; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }
.ia-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.ia-note .ico { color: #6d28d9; margin-top: 1px; }

.feature-banner {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; min-height: 200px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, white), color-mix(in srgb, var(--accent) 22%, white));
  border-color: color-mix(in srgb, var(--accent) 25%, white);
}
.feature-banner h3 { font-size: 24px; font-weight: 800; color: var(--navy-800); }
.feature-banner p { color: var(--text-2); margin-top: 8px; max-width: 420px; }
.feature-art { width: 200px; height: 170px; position: relative; }
.feature-art svg { width: 100%; height: 100%; }
.beat { animation: beat 1.6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes beat { 15% { transform: scale(1.12); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } 60% { transform: scale(1); } }

.route { display: grid; gap: 10px; }
.route-day { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); transition: border-color .2s, transform .2s var(--ease); }
.route-day:hover { transform: translateX(4px); border-color: color-mix(in srgb, var(--accent) 40%, white); }
.route-day .rd-n { display: grid; place-items: center; padding: 6px 0; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent); font-weight: 800; font-size: 13px; font-family: var(--font-head); }
.route-day.done .rd-n { background: var(--accent); color: #fff; }
.route-day b { display: block; font-weight: 600; }
.route-day small { color: var(--muted); font-size: 12.5px; }

.welcome-card {
  position: relative; overflow: hidden; color: #fff; display: grid; align-content: end; min-height: 250px;
  background: radial-gradient(400px 220px at 80% 10%, rgba(255, 255, 255, .25), transparent 70%), linear-gradient(140deg, #0d9488, #0a2463);
}
.welcome-card h3 { font-family: var(--font-hand); font-size: 40px; line-height: 1; font-weight: 700; }
.welcome-card p { opacity: .9; margin-top: 8px; font-size: 14px; }
.welcome-card .confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; width: 8px; height: 14px; border-radius: 2px; opacity: .85; animation: fall 6s linear infinite; }
@keyframes fall { from { transform: translateY(-40px) rotate(0); } to { transform: translateY(300px) rotate(540deg); } }

.check-day { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.check-day + .check-day { margin-top: 10px; }
.check-day h4 { font-size: 14.5px; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.check-day h4 .badge { margin-left: auto; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.check-item:hover { background: var(--surface-2); }
.check-item input { width: 19px; height: 19px; accent-color: var(--accent); }
.check-item input:checked + span { color: var(--muted); text-decoration: line-through; }

.proc-card { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s; }
.proc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.proc-card.sel { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }

.recog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.recog {
  position: relative; overflow: hidden; padding: 20px; border-radius: 18px; color: var(--text);
  background: linear-gradient(160deg, #fff7ed, #fff1f2); border: 1px solid #fde2d6;
}
.recog::before { content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, rgba(244, 63, 94, .18), transparent 70%); }
.recog .medal { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, #f59e0b, #e11d48); color: #fff; box-shadow: 0 8px 18px -8px #e11d48; margin-bottom: 10px; }
.recog b { font-family: var(--font-head); font-size: 16px; display: block; }
.recog .cat { font-size: 12px; font-weight: 700; color: #e11d48; text-transform: uppercase; letter-spacing: .05em; }
.recog p { color: var(--text-2); font-size: 13.5px; margin: 8px 0 12px; }
.recog footer { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }

.aspect { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; }
.aspect .ico { flex: none; width: 20px; height: 20px; }
.aspect.good .ico { color: var(--ok); }
.aspect.bad .ico { color: var(--bad); }
.aspect b { margin-left: auto; font-variant-numeric: tabular-nums; }

.thanks { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 40px 20px; }
.thanks .big-check { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); animation: pop .5s var(--ease) both; }
.thanks .big-check .ico { width: 42px; height: 42px; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .6s .3s forwards; }

.doc-preview { border: 1px solid var(--border); border-radius: 14px; padding: 22px; background: var(--surface); font-size: 14px; }
.doc-preview h4 { font-size: 14px; margin: 14px 0 6px; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.doc-preview h4:first-child { margin-top: 0; }
.doc-preview ul { margin: 0; padding-left: 20px; }
.doc-preview li { margin: 3px 0; }
.dl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; }
.dl-grid div { display: grid; }
.dl-grid dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.dl-grid dd { margin: 0; font-weight: 600; }
.copy-box { white-space: pre-wrap; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 12px; padding: 16px; font-size: 14px; line-height: 1.6; max-height: 360px; overflow: auto; }

.perfil-card { display: grid; gap: 10px; transition: transform .2s var(--ease), box-shadow .2s; }
.perfil-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.perfil-card h4 { font-size: 16px; }
.perfil-card .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.perfil-card p { color: var(--text-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.perfil-card footer { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); }

.funnel { display: grid; gap: 8px; }
.funnel-step { display: grid; grid-template-columns: 130px 1fr 34px; gap: 12px; align-items: center; font-size: 13.5px; }
.funnel-step .bar-track { height: 26px; border-radius: 8px; }
.funnel-step .bar-fill { border-radius: 8px; }
.funnel-step b { text-align: right; }

.accordion { display: grid; gap: 10px; }
.acc { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; }
.acc summary { display: flex; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; list-style: none; font-weight: 600; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary .chev { margin-left: auto; transition: transform .25s; color: var(--muted); }
.acc[open] summary .chev { transform: rotate(180deg); }
.acc[open] summary { border-bottom: 1px solid var(--border); }
.acc .acc-body { padding: 16px 20px 20px; color: var(--text-2); font-size: 14.5px; }
.acc .acc-body ol, .acc .acc-body ul { margin: 6px 0; padding-left: 22px; }
.acc .acc-body li { margin: 6px 0; }
.acc .acc-body p + p { margin-top: 8px; }

.settings-sec h3 { font-size: 16px; margin-bottom: 4px; }
.settings-sec > p { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; }
.mode-box { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }

/* ==========================================================================
   Asistente IA
   ========================================================================== */
.chat-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.chat-side { display: grid; gap: 16px; position: sticky; top: 86px; }
.ia-hello { display: grid; justify-items: center; text-align: center; gap: 10px; }
.robot { width: 120px; height: 120px; animation: float 5s ease-in-out infinite; }
.robot .eye { animation: blink 4s infinite; transform-origin: center; transform-box: fill-box; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.suggest { display: grid; gap: 8px; }
.suggest button {
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  font-size: 13.5px; color: var(--text-2); transition: all .18s var(--ease);
}
.suggest button .ico { color: #6d28d9; }
.suggest button:hover { border-color: #c4b5fd; background: #f7f4ff; color: var(--text); transform: translateX(3px); }
.chat { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 520px; padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.chat-head .status { font-size: 12px; color: var(--ok); display: flex; align-items: center; gap: 6px; }
.chat-head .status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; background: linear-gradient(180deg, #fbfcff, #f6f8fd); }
.msg { display: flex; gap: 10px; max-width: 86%; animation: msgIn .35s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } }
.msg .bubble { padding: 12px 15px; border-radius: 16px; font-size: 14.5px; line-height: 1.55; }
.msg.bot .bubble { background: var(--surface); border: 1px solid var(--border); border-top-left-radius: 4px; box-shadow: var(--shadow-xs); }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.user .bubble { background: linear-gradient(135deg, #6d28d9, #2563eb); color: #fff; border-top-right-radius: 4px; }
.msg .mini-bot { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #6d28d9, #2563eb); color: #fff; }
.msg .mini-bot .ico { width: 17px; height: 17px; }
.bubble h5 { font-size: 14px; margin: 8px 0 4px; font-family: var(--font-head); }
.bubble h5:first-child { margin-top: 0; }
.bubble ul, .bubble ol { margin: 4px 0; padding-left: 20px; }
.bubble li { margin: 3px 0; }
.bubble p + p { margin-top: 6px; }
.bubble .btn { margin-top: 10px; }
.bubble .ia-disclaimer { display: block; margin-top: 10px; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 8px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #a78bfa; animation: typing 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.chat-form { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-form input { flex: 1; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--border); font-size: 14.5px; }
.chat-form input:focus { outline: none; border-color: #8b5cf6; box-shadow: 0 0 0 4px rgba(139, 92, 246, .14); }
.chat-form .btn { padding: 0 18px; background: linear-gradient(135deg, #6d28d9, #2563eb); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 12.5px; padding: 6px 11px; border-radius: 999px; border: 1px solid #ddd3fb; background: #f7f4ff; color: #6d28d9; font-weight: 600; }
.chip:hover { background: #ede7ff; }

/* ==========================================================================
   Impresión / PDF
   ========================================================================== */
#print-root { display: none; }
@media print {
  @page { size: letter; margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  .pdoc { color: #000; }
  .pdoc-head { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
  .pdoc-head td { border: 1px solid #333; padding: 6px 10px; font-size: 10pt; }
  .pdoc-logo { width: 80px; text-align: center; }
  .pdoc-logo img { width: 60px; margin: auto; }
  .pdoc-company { font-weight: 700; font-size: 12pt !important; }
  .pdoc-company small, .pdoc-title small { display: block; font-weight: 400; font-size: 9pt; color: #444; }
  .pdoc-title { font-weight: 800; font-size: 13pt !important; text-transform: uppercase; }
  .pdoc-meta { width: 150px; }
  .pdoc h4 { font-size: 10.5pt; background: #e9eef7; padding: 5px 8px; margin: 14px 0 6px; border-left: 4px solid #12317d; text-transform: uppercase; }
  .pdoc p, .pdoc li { font-size: 10.5pt; }
  .pdoc ul { margin: 4px 0; padding-left: 18px; }
  .ptable { width: 100%; border-collapse: collapse; margin: 6px 0; }
  .ptable th, .ptable td { border: 1px solid #555; padding: 5px 7px; font-size: 9.5pt; text-align: left; vertical-align: top; }
  .ptable th { background: #e9eef7; }
  .pgrid, .dl-grid { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 4px 20px; }
  .pgrid div { border-bottom: 1px solid #999; padding: 3px 0; font-size: 10pt; }
  .pgrid b { font-weight: 700; }
  .pline { border-bottom: 1px solid #999; height: 22px; }
  .psign { display: flex; gap: 40px; margin-top: 50px; }
  .psign div { flex: 1; text-align: center; font-size: 9.5pt; }
  .psign span { display: block; border-top: 1px solid #000; margin-bottom: 4px; }
  .pdoc-foot { margin-top: 24px; font-size: 8pt; color: #666; text-align: center; border-top: 1px solid #ccc; padding-top: 6px; }
  .pcert { border: 6px double #12317d; padding: 40px; text-align: center; margin-top: 20px; }
  .pcert h2 { font-size: 30pt; color: #12317d; margin: 10px 0; }
  .pcert .pname { font-family: var(--font-hand); font-size: 36pt; color: #2ea65a; margin: 14px 0; }
}

/* ==========================================================================
   Adaptación a pantallas
   ========================================================================== */
@media (max-width: 1280px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
}
@media (max-width: 1100px) {
  .kpis.k3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3, .g-21, .g-12, .g-32 { grid-template-columns: minmax(0, 1fr); }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-side { position: static; }
  .chat-side .ia-hello { display: none; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-105%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); }
  body.menu-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(6, 20, 51, .45); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .3s; }
  body.menu-open .scrim { opacity: 1; pointer-events: auto; }
  .only-mobile { display: inline-grid !important; }
  .topbar { padding: 10px 16px; }
  .view { padding: 18px 16px 96px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); border-top: 1px solid var(--border); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button { display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); background: none; border: 0; padding: 6px 0; border-radius: 10px; }
  .bottom-nav .ico { width: 22px; height: 22px; }
  .bottom-nav .active { color: var(--blue); }
  #toasts { bottom: 84px; left: 16px; right: 16px; }
  .toast { max-width: none; }
}
@media (min-width: 1025px) { .only-mobile { display: none !important; } }
@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 28px 20px 30px; }
  .login-logo { margin-bottom: 18px; max-width: 280px; margin-inline: auto; padding: 14px; }
  .login-brand h2 { font-size: 24px; text-align: center; }
  .login-points { display: none; }
  .g-2, .g-4, .form-grid, .dl-grid { grid-template-columns: minmax(0, 1fr); }
  .card-head .toolbar, .card-head .select-sm, .card-head .search { width: 100%; }
  .card-head .toolbar > * { flex: 1 1 100%; }
  .hide-sm { display: none !important; }
  .crumbs > *:not(:last-child) { display: none; }
  .kpis, .kpis.k3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px; }
  .kpi-val { font-size: 24px; }
  .kpi-top { flex-direction: column; align-items: flex-start; gap: 8px; }
  .kpi-label { font-size: 12.5px; }
  .mod-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hand-note { grid-column: 1 / -1; }
  .donut-row { justify-content: center; }
  .dest { grid-template-columns: 1fr !important; }
  .dest svg { max-width: 220px; }
  .save-pill span { display: none; }
  .page-head { flex-wrap: wrap; padding: 16px; }
  .ph-text h1 { font-size: 19px; }
  .ph-actions { width: 100%; }
  .tiles { display: flex; overflow-x: auto; gap: 8px; margin: 0 -16px 16px; padding: 2px 16px 8px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .tiles::-webkit-scrollbar { display: none; }
  .tile { flex: 0 0 112px; min-height: 92px; padding: 12px 6px; font-size: 11.5px; scroll-snap-align: start; }
  .tile-ico { width: 38px; height: 38px; }
  .hero { padding: 24px 20px; }
  .feature-banner { grid-template-columns: 1fr; }
  .feature-art { display: none; }
  .q-row { grid-template-columns: 1fr; gap: 8px; }
  .bar-row { grid-template-columns: minmax(90px, 40%) 1fr 42px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .msg { max-width: 94%; }
  .chat { height: calc(100vh - 230px); }
  .popover { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; }
  .route-day { grid-template-columns: 56px 1fr; }
  .route-day > :last-child { grid-column: 1 / -1; }
  .funnel-step { grid-template-columns: 100px 1fr 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
}
