/* =========================================================
   LANAIS · Intranet
   Misma identidad que www.lanais.es: navy de marca, Urbanist,
   formas redondeadas, superficies translúcidas y auras azules.
   Tema oscuro por defecto; claro con html[data-theme="light"].
   ========================================================= */

@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../fonts/urbanist-normal-100-900-latin.woff2) format("woff2");
}

:root {
  --bg: #06122b;
  --bg-2: #0a1c40;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .08);
  --surface-solid: #0c1f47;
  --stroke: rgba(255, 255, 255, .1);
  --stroke-2: rgba(255, 255, 255, .2);
  --ink: #f2f6ff;
  --ink-2: #c9d5ee;
  --muted: #8fa1c4;
  --brand: #3d7bff;
  --brand-2: #79a6ff;
  --brand-soft: rgba(61, 123, 255, .16);
  --glow: rgba(61, 123, 255, .35);
  --violet: #a77bff;
  --cyan: #19b4ff;
  --ok: #2fd3a0;
  --ok-soft: rgba(47, 211, 160, .14);
  --warn: #ffb547;
  --warn-soft: rgba(255, 181, 71, .14);
  --alert: #ff6b6b;
  --alert-soft: rgba(255, 107, 107, .14);
  --slate-soft: rgba(143, 161, 196, .16);
  --nav-bg: rgba(10, 24, 54, .72);
  --card-shadow: 0 30px 80px -40px rgba(0, 0, 0, .8);
  --radius: 22px;
  --radius-sm: 14px;
  --font: "Urbanist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --pad: clamp(16px, 3vw, 44px);
  --max: 1360px;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f4f7fd;
  --bg-2: #e8eefa;
  --surface: rgba(255, 255, 255, .78);
  --surface-2: #ffffff;
  --surface-solid: #ffffff;
  --stroke: rgba(11, 42, 102, .1);
  --stroke-2: rgba(11, 42, 102, .2);
  --ink: #0b1f47;
  --ink-2: #2c3f66;
  --muted: #5d6f93;
  --brand: #1f5bff;
  --brand-2: #1f5bff;
  --brand-soft: rgba(31, 91, 255, .1);
  --glow: rgba(31, 91, 255, .22);
  --violet: #7b4dff;
  --cyan: #0095e0;
  --ok: #0a9a6e;
  --ok-soft: rgba(15, 179, 130, .12);
  --warn: #b86e00;
  --warn-soft: rgba(217, 119, 6, .12);
  --alert: #d32f2f;
  --alert-soft: rgba(220, 38, 38, .1);
  --slate-soft: rgba(93, 111, 147, .12);
  --nav-bg: rgba(255, 255, 255, .8);
  --card-shadow: 0 30px 70px -40px rgba(11, 42, 102, .45);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background-color .4s, color .4s;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; color: var(--ink); }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 3px; border-radius: 10px; }
.only-light { display: none !important; }
html[data-theme="light"] .only-light { display: block !important; }
html[data-theme="light"] .only-dark { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tnum { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Fondo: auras como en lanais.es ---------- */
.aura { position: fixed; z-index: 0; pointer-events: none; border-radius: 50%; filter: blur(80px); opacity: .5; }
.aura.a1 { width: 46vw; height: 46vw; left: -12vw; top: -14vw; background: radial-gradient(circle, rgba(61, 123, 255, .5), transparent 65%); animation: drift 22s ease-in-out infinite alternate; }
.aura.a2 { width: 38vw; height: 38vw; right: -10vw; top: 40vh; background: radial-gradient(circle, rgba(167, 123, 255, .3), transparent 65%); animation: drift 28s ease-in-out infinite alternate-reverse; }
html[data-theme="light"] .aura { opacity: .3; }
@keyframes drift { to { transform: translate(5vw, 4vh) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .aura { animation: none; } * { transition: none !important; } }

/* ---------- Cabecera flotante ---------- */
.site-nav {
  position: sticky; top: 14px; z-index: 200; margin: 14px auto 0; width: min(calc(100% - 28px), 1400px);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 8px 8px 22px;
  border-radius: 99px; background: var(--nav-bg); border: 1px solid var(--stroke);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 18px 40px -26px rgba(0, 0, 0, .6);
}
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; text-decoration: none !important; }
.brand img { height: 32px; width: auto; }
.brand .tag { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--stroke-2); }
.nav-links { display: flex; gap: 2px; }
.nav-links a { position: relative; text-decoration: none; font-size: 15px; font-weight: 600; color: var(--ink-2); padding: 9px 14px; border-radius: 99px; white-space: nowrap; transition: background .2s, color .2s; }
.nav-links a:hover, .nav-links a.on { background: var(--surface-2); color: var(--ink); }
.nav-links a.on::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); margin-right: 8px; vertical-align: middle; box-shadow: 0 0 10px var(--cyan); }
.nav-links .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; }
.nav-right { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--stroke); background: transparent; cursor: pointer; display: inline-grid; place-items: center; color: var(--ink); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .sun { display: none; }
html[data-theme="light"] .theme-btn .sun { display: block; }
html[data-theme="light"] .theme-btn .moon { display: none; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 99px; border: 1px solid var(--stroke); text-decoration: none !important; color: var(--ink); }
.me:hover { background: var(--surface-2); }
.me .who { line-height: 1.15; padding-right: 8px; }
.me .who b { display: block; font-size: 14px; }
.me .who span { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--brand), var(--violet)); flex-shrink: 0; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.burger { display: none; }
.burger span, .burger span::before, .burger span::after { display: block; width: 16px; height: 2px; border-radius: 2px; background: currentColor; position: relative; transition: transform .25s, background .25s; }
.burger span::before, .burger span::after { content: ""; position: absolute; left: 0; }
.burger span::before { top: -5px; } .burger span::after { top: 5px; }
.menu-open .burger span { background: transparent; }
.menu-open .burger span::before { transform: translateY(5px) rotate(45deg); }
.menu-open .burger span::after { transform: translateY(-5px) rotate(-45deg); }
@media (max-width: 1180px) {
  .burger { display: inline-grid; }
  .nav-links { position: fixed; inset: 72px 14px auto 14px; flex-direction: column; gap: 4px; padding: 12px; border-radius: var(--radius); background: var(--surface-solid); border: 1px solid var(--stroke); box-shadow: var(--card-shadow); display: none; }
  .menu-open .nav-links { display: flex; }
  .nav-links a { font-size: 17px; padding: 12px 16px; }
  .me .who, .brand .tag { display: none; }
}

/* ---------- Estructura ---------- */
main { position: relative; z-index: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: 36px var(--pad) 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand-2); display: inline-flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.eyebrow::before { content: ""; width: 22px; height: 2px; border-radius: 2px; background: var(--brand-2); }
.ttl { font-size: clamp(30px, 4vw, 52px); font-weight: 800; letter-spacing: -.035em; line-height: 1.02; }
.ttl em { font-style: normal; background: linear-gradient(90deg, var(--brand-2), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 17px; color: var(--muted); max-width: 680px; margin-top: 10px; }
.grid { display: grid; gap: 20px; }
.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-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.span-2 { grid-column: span 2; }
.stack { display: grid; gap: 20px; align-content: start; }
@media (max-width: 1080px) { .g-main, .g-3 { grid-template-columns: 1fr; } .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g-2, .g-4 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } main { padding-top: 24px; } }

/* ---------- Tarjetas ---------- */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--card-shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-head h2, .card h2 { font-size: 20px; }
.card-head .eyebrow { margin: 0; }
.card.hero { background: linear-gradient(135deg, rgba(61, 123, 255, .22), rgba(167, 123, 255, .12) 60%, var(--surface)); border-color: var(--stroke-2); overflow: hidden; }
html[data-theme="light"] .card.hero { background: linear-gradient(135deg, rgba(31, 91, 255, .1), rgba(123, 77, 255, .06) 60%, #fff); }
.card.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 1px solid var(--stroke-2); opacity: .6; pointer-events: none; }
.card.hero::before { content: ""; position: absolute; right: -10px; top: 40px; width: 140px; height: 140px; border-radius: 50%; border: 1px solid var(--stroke); pointer-events: none; }
.empty { padding: 18px; border: 1px dashed var(--stroke-2); border-radius: var(--radius-sm); color: var(--muted); text-align: center; font-size: 15px; }

/* ---------- Métricas ---------- */
.stat { display: grid; gap: 4px; }
.stat .k { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-size: clamp(28px, 3vw, 40px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 16px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.stat .s { font-size: 14px; color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--violet)); }
.bar.ok i { background: var(--ok); }
.bar.split { display: flex; }
.bar.split i { border-radius: 0; }
.bar.split i.p { background: repeating-linear-gradient(45deg, var(--brand-2) 0 6px, transparent 6px 10px); opacity: .7; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c, var(--brand)); }

/* ---------- Reloj de fichaje ---------- */
.clock { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; position: relative; z-index: 1; }
.clock .time { font-size: clamp(44px, 6vw, 72px); font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.clock .state { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 5px rgba(47, 211, 160, .2); animation: blink 2s ease-in-out infinite; }
.dot.pause { background: var(--warn); }
.dot.off { background: var(--violet); }
.dot.idle { background: var(--muted); opacity: .6; }
@keyframes blink { 50% { opacity: .4; } }
.clock-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.clock-actions select { min-width: 200px; }

/* ---------- Botones y chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 22px; border-radius: 99px;
  border: 1px solid transparent; background: var(--brand); color: #fff; font: 700 15px/1 var(--font); text-decoration: none !important; cursor: pointer;
  box-shadow: 0 14px 34px -14px var(--glow); transition: transform .2s, box-shadow .2s, background .2s, border-color .2s; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 20px 40px -14px var(--glow); }
.btn .arr { transition: transform .2s; }
.btn:hover .arr { transform: translateX(3px); }
.btn.lg { min-height: 56px; padding: 0 30px; font-size: 17px; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--stroke-2); box-shadow: none; }
.btn.ghost:hover { border-color: var(--ink); }
.btn.ok { background: var(--ok); color: #04241a; box-shadow: 0 14px 34px -14px rgba(47, 211, 160, .5); }
.btn.danger { background: var(--alert); box-shadow: none; }
.btn.warn { background: var(--warn); color: #2b1a00; box-shadow: none; }
.btn.light { background: #fff; color: #0b1f47; }
.btn.ms { background: #fff; color: #1b1b1b; border-color: #d0d7e2; box-shadow: 0 14px 34px -18px rgba(0, 0, 0, .5); width: 100%; min-height: 54px; font-size: 16px; }
.btn.ms svg { width: 20px; height: 20px; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand-2); font: inherit; cursor: pointer; font-weight: 600; }
.linkish:hover { text-decoration: underline; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.chip { display: inline-flex; align-items: center; gap: 8px; width: fit-content; padding: 6px 14px 6px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--stroke); font-size: 13px; font-weight: 700; color: var(--ink-2); }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; white-space: nowrap; background: var(--slate-soft); color: var(--ink-2); }
.badge.pendiente, .badge.amber, .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.aprobada, .badge.green, .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.rechazada, .badge.red { background: var(--alert-soft); color: var(--alert); }
.badge.cancelada, .badge.slate { background: var(--slate-soft); color: var(--muted); }
.badge.blue, .badge.nacional { background: var(--brand-soft); color: var(--brand-2); }
.badge.violet, .badge.autonomico { background: rgba(167, 123, 255, .16); color: var(--violet); }
.badge.local { background: rgba(25, 180, 255, .14); color: var(--cyan); }
.badge.empresa { background: var(--ok-soft); color: var(--ok); }

/* ---------- Listas ---------- */
.list { display: grid; }
.list > * { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-top: 1px solid var(--stroke); }
.list > *:first-child { border-top: 0; padding-top: 0; }
.list > *:last-child { padding-bottom: 0; }
.list .main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.list .main > div { min-width: 0; }
.list b { font-weight: 700; }
.list .sub { font-size: 14px; color: var(--muted); }
.date-tile { width: 50px; height: 54px; border-radius: 14px; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; align-content: center; flex-shrink: 0; line-height: 1; }
.date-tile b { font-size: 20px; font-weight: 800; }
.date-tile span { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-top: 3px; }

.alert-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14.5px; background: var(--slate-soft); }
.alert-row + .alert-row { margin-top: 8px; }
.alert-row.red { background: var(--alert-soft); }
.alert-row.amber { background: var(--warn-soft); }
.alert-row.blue { background: var(--brand-soft); }
.alert-row .when { font-weight: 800; white-space: nowrap; }
.alert-row.red .when { color: var(--alert); }
.alert-row.amber .when { color: var(--warn); }
.alert-row.blue .when { color: var(--brand-2); }

.notice { position: relative; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--stroke); }
.notice + .notice { margin-top: 10px; }
.notice.pinned { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.notice h3 { font-size: 16.5px; margin-bottom: 6px; }
.notice p { font-size: 15px; color: var(--ink-2); white-space: pre-line; }
.notice .meta { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--stroke-2); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.is-today td { background: var(--brand-soft); }
tr.is-today td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
tr.is-off td { color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.seg { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; margin: 2px 4px 2px 0; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--stroke); font-size: 13.5px; font-variant-numeric: tabular-nums; cursor: pointer; color: var(--ink); font-family: var(--font); }
.seg:hover { border-color: var(--brand); }
.seg.open { border-color: var(--ok); color: var(--ok); }
.seg.manual::after { content: "M"; font-size: 10px; font-weight: 800; color: var(--violet); }
.seg small { color: var(--muted); }
.pos { color: var(--ok); } .neg { color: var(--alert); }

/* ---------- Formularios ---------- */
form.inline { display: inline; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
label .hint { font-weight: 500; color: var(--muted); font-size: 13px; }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--stroke-2);
  background: var(--surface-2); color: var(--ink); font: 500 15.5px var(--font); transition: border-color .2s, box-shadow .2s;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
input[type="checkbox"] { width: 20px; min-height: 20px; height: 20px; accent-color: var(--brand); }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
select option { background: var(--surface-solid); color: var(--ink); }
.calc { margin-top: 4px; padding: 14px 16px; border-radius: 14px; background: var(--brand-soft); font-size: 15px; display: grid; gap: 6px; }
.calc b { font-size: 20px; }
.calc .e { color: var(--alert); } .calc .w { color: var(--warn); }
.ref { font-size: 13.5px; color: var(--muted); padding: 10px 14px; border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 0 12px 12px 0; }

/* ---------- Diálogos ---------- */
dialog { border: 1px solid var(--stroke-2); border-radius: var(--radius); background: var(--surface-solid); color: var(--ink); padding: 0; width: min(560px, calc(100% - 32px)); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .8); }
dialog::backdrop { background: rgba(3, 10, 26, .6); backdrop-filter: blur(4px); }
dialog .d-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--stroke); }
dialog .d-body { padding: 22px 24px; }
dialog .d-foot { display: flex; justify-content: space-between; gap: 10px; padding: 0 24px 22px; flex-wrap: wrap; }

/* ---------- Mensajes ---------- */
.flashes { display: grid; gap: 8px; margin-bottom: 22px; }
.flash { display: flex; gap: 12px; align-items: center; padding: 13px 18px; border-radius: 16px; font-weight: 600; font-size: 15px; border: 1px solid var(--stroke); background: var(--surface-2); }
.flash::before { content: ""; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--brand); }
.flash.ok::before { background: var(--ok); } .flash.error::before { background: var(--alert); } .flash.warn::before { background: var(--warn); }
.flash.error { border-color: var(--alert); } .flash.ok { border-color: rgba(47, 211, 160, .5); }

/* ---------- Tabs / segmentados ---------- */
.pill-group { display: inline-flex; padding: 4px; border-radius: 99px; border: 1px solid var(--stroke); background: var(--surface); font-size: 14px; font-weight: 700; }
.pill-group a { padding: 8px 14px; border-radius: 99px; color: var(--muted); text-decoration: none !important; }
.pill-group a[aria-current="true"] { background: var(--surface-2); color: var(--ink); box-shadow: 0 0 0 1px var(--stroke-2); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.pager { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.pager .lbl { min-width: 170px; text-align: center; text-transform: capitalize; }

/* ---------- Calendario de ausencias ---------- */
.cal-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--stroke); }
.cal { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 900px; }
.cal th, .cal td { padding: 0; border-bottom: 1px solid var(--stroke); border-right: 1px solid var(--stroke); text-align: center; height: 40px; min-width: 30px; }
.cal th { letter-spacing: 0; text-transform: none; font-size: 12px; color: var(--muted); padding: 6px 0; line-height: 1.2; background: var(--surface); position: sticky; top: 0; }
.cal th b { display: block; font-size: 14px; color: var(--ink); }
.cal .name { position: sticky; left: 0; z-index: 2; background: var(--surface-solid); text-align: left; padding: 0 14px; min-width: 190px; white-space: nowrap; font-size: 14px; font-weight: 600; }
.cal th.name { z-index: 3; }
.cal .we { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--surface-2) 5px 7px); }
.cal .hol { background: rgba(167, 123, 255, .16); }
.cal th.today { color: var(--brand-2); box-shadow: inset 0 -3px 0 var(--brand); }
.cal td.today { box-shadow: inset 2px 0 0 var(--brand), inset -2px 0 0 var(--brand); }
.cal .ev { display: block; height: 26px; margin: 0 -1px; background: var(--brand); }
.cal .ev.t-green { background: var(--ok); }
.cal .ev.t-amber { background: var(--warn); }
.cal .ev.t-violet { background: var(--violet); }
.cal .ev.t-slate { background: var(--muted); }
.cal .ev.pend { background: repeating-linear-gradient(45deg, var(--brand-2) 0 5px, transparent 5px 9px) !important; border: 1px solid var(--brand-2); }
.cal tr.me-row .name { color: var(--brand-2); }

/* ---------- Login ---------- */
.login-body { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-side { position: relative; overflow: hidden; padding: 48px clamp(28px, 5vw, 72px); display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(160deg, #0b2a66 0%, #06122b 70%); color: #f2f6ff; }
.login-side .ttl { color: #fff; }
.login-side .lead { color: #c9d5ee; }
.login-side .eyebrow { color: #79a6ff; } .login-side .eyebrow::before { background: #79a6ff; }
.login-side .lines { position: absolute; inset: 0; pointer-events: none; opacity: .55; }
.login-side .feat { display: grid; gap: 14px; margin-top: 36px; position: relative; }
.login-side .feat div { display: flex; gap: 14px; align-items: center; font-weight: 600; color: #e6edff; }
.login-side .feat i { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); font-style: normal; }
.login-side .feat svg { width: 18px; height: 18px; stroke: #79a6ff; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.login-side footer { font-size: 13px; color: #8fa1c4; position: relative; }
.login-main { display: grid; place-items: center; padding: 40px 24px; position: relative; }
.login-card { width: min(440px, 100%); display: grid; gap: 22px; position: relative; z-index: 1; }
.login-card .card { padding: 32px; }
.or { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--stroke-2); }
details.local summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14.5px; list-style: none; text-align: center; }
details.local summary::-webkit-details-marker { display: none; }
details.local[open] summary { margin-bottom: 16px; }
.login-top { position: absolute; top: 20px; right: 20px; z-index: 2; }
@media (max-width: 900px) { .login-body { grid-template-columns: 1fr; } .login-side { min-height: auto; padding-bottom: 36px; } .login-side .feat { display: none; } }

/* ---------- Pie ---------- */
.site-foot { position: relative; z-index: 1; max-width: var(--max); margin: 0 auto; padding: 22px var(--pad) 36px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); border-top: 1px solid var(--stroke); }
.site-foot a { color: var(--muted); }

.mt { margin-top: 20px; } .mt-s { margin-top: 10px; } .mb { margin-bottom: 20px; }
.right { text-align: right; }
.flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
[hidden] { display: none !important; }
.clock-actions select { width: auto; min-width: 220px; max-width: 320px; }

/* ---------- Aplicaciones integradas (CRM…) ---------- */
body.is-embed main { max-width: none; padding: 18px clamp(10px, 1.6vw, 24px) 12px; }
body.is-embed .site-foot { display: none; }
.embed-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; padding: 10px 12px 10px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--stroke); }
.embed-frame { height: calc(100vh - 190px); min-height: 520px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--stroke-2); background: #fff; box-shadow: var(--card-shadow); }
.embed-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.app-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; background: linear-gradient(135deg, var(--c, var(--brand)), var(--violet)); flex-shrink: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-tiles { display: grid; gap: 10px; }
.app-tile { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; border: 1px solid var(--stroke); background: var(--surface-2); color: var(--ink); text-decoration: none !important; transition: border-color .2s, transform .2s; }
.app-tile:hover { border-color: var(--brand); transform: translateY(-1px); }
.app-tile .go { margin-left: auto; color: var(--muted); }
.matrix select { min-height: 38px; padding: 6px 10px; font-size: 14px; min-width: 150px; }

/* ---------- Calendario de unidad · vista semanal ---------- */
.wk-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.wk { display: grid; gap: 6px; min-width: 860px; }
.wk-row { display: grid; grid-template-columns: 220px repeat(7, minmax(0, 1fr)); gap: 6px; align-items: stretch; }
.wk-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 600; font-size: 14.5px; padding: 0 6px; }
.wk-name .avatar { width: 30px; height: 30px; font-size: 11.5px; }
.wk-head .wk-name { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.wk-day { display: grid; justify-items: center; gap: 2px; padding: 10px 6px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--stroke); text-align: center; min-width: 0; }
.wk-day .dn { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.wk-day b { font-size: 24px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.wk-day .hname { font-size: 11.5px; font-weight: 700; color: var(--violet); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-day.today { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.wk-day.today b, .wk-day.today .hname { color: var(--brand-2); }
.wk-day.we { opacity: .6; }
.wk-day.hol { background: rgba(167, 123, 255, .14); border-color: rgba(167, 123, 255, .35); }
.wk-unit { margin-top: 10px; }
.wk-unit .wk-name { font-size: 15px; }
.wk-unit .wk-name::before { content: ""; width: 4px; height: 18px; border-radius: 4px; background: var(--brand); }
.wk-cov { display: grid; place-items: center; }
.cov { font-size: 12.5px; font-weight: 800; padding: 3px 10px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.cov.ok { background: var(--ok-soft); color: var(--ok); }
.cov.mid { background: var(--warn-soft); color: var(--warn); }
.cov.hi { background: var(--alert-soft); color: var(--alert); }
.wk-cell { position: relative; min-height: 50px; border-radius: 12px; background: var(--surface); border: 1px solid var(--stroke); display: flex; align-items: center; padding: 6px 0; }
.wk-cell.we { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface-2) 6px 8px); }
.wk-cell.hol { background: rgba(167, 123, 255, .1); }
.wk-cell.today { border-color: var(--brand); }
.blk { display: flex; align-items: center; height: 36px; flex: 1; min-width: 0; margin: 0 6px; padding: 0 10px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 700; position: relative; z-index: 1; overflow: hidden; white-space: nowrap; box-shadow: 0 8px 18px -10px var(--glow); }
.blk.cont { margin-left: -14px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.blk span { overflow: hidden; text-overflow: ellipsis; }
.blk.t-green { background: var(--ok); color: #04241a; }
.blk.t-amber { background: var(--warn); color: #2b1a00; }
.blk.t-violet { background: var(--violet); }
.blk.t-slate { background: var(--muted); color: #fff; }
.blk.pend { background: repeating-linear-gradient(45deg, var(--brand-soft) 0 6px, transparent 6px 11px) !important; color: var(--brand-2); border: 1.5px dashed var(--brand-2); box-shadow: none; }
.me-row .wk-name { color: var(--brand-2); }
/* mensual: fila de unidad */
.cal tr.unit-row td { background: var(--surface-2); height: 30px; }
.cal tr.unit-row td.name { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cal .mini { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 99px; font-size: 11px; font-weight: 800; }
.cal .mini.mid { background: var(--warn-soft); color: var(--warn); }
.cal .mini.hi { background: var(--alert-soft); color: var(--alert); }

/* ---------- Campana de avisos ---------- */
.bell { position: relative; }
.bell .dot-count { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--alert); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }

/* ---------- Administración: menú lateral ---------- */
.admin-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; align-items: start; }
.admin-nav { position: sticky; top: 100px; display: grid; gap: 16px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--stroke); }
.admin-nav .eyebrow { margin: 0; }
.admin-nav .grp { display: grid; gap: 2px; }
.admin-nav .grp b { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px 10px; }
.admin-nav a { padding: 8px 10px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 14.5px; text-decoration: none !important; }
.admin-nav a:hover { background: var(--surface-2); color: var(--ink); }
.admin-nav a.on { background: var(--brand-soft); color: var(--brand-2); }
@media (max-width: 1000px) { .admin-shell { grid-template-columns: 1fr; } .admin-nav { position: static; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); } }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.check-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--stroke); }
.check-item:first-child { border-top: 0; }
.check-item button.tick { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--stroke-2); background: transparent; color: #fff; cursor: pointer; display: grid; place-items: center; flex-shrink: 0; font-weight: 900; }
.check-item.done button.tick { background: var(--ok); border-color: var(--ok); }
.check-item.done .t { text-decoration: line-through; color: var(--muted); }
.prose { font-size: 16px; line-height: 1.7; color: var(--ink-2); }
.prose h1, .prose h2, .prose h3 { margin: 1.2em 0 .5em; color: var(--ink); }
.prose h1 { font-size: 28px; } .prose h2 { font-size: 22px; } .prose h3 { font-size: 18px; }
.prose p, .prose ul, .prose ol, .prose pre, .prose blockquote, .prose table { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.4em; list-style: revert; }
.prose code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .9em; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.prose pre { background: var(--surface-2); padding: 14px; border-radius: 12px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { border-left: 3px solid var(--brand); padding: 4px 14px; color: var(--muted); }
.prose a { color: var(--brand-2); text-decoration: underline; }
.prose table td, .prose table th { border: 1px solid var(--stroke); padding: 8px 10px; }
.pre-wrap { white-space: pre-line; }
img.avatar { object-fit: cover; background: var(--surface-2); padding: 0; }
.avatar.xl { width: 96px; height: 96px; font-size: 30px; }
/* ---------- Directorio y organigrama ---------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.person { display: grid; gap: 12px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--stroke); color: var(--ink); text-decoration: none !important; transition: border-color .2s, transform .2s; }
.person:hover { border-color: var(--brand); transform: translateY(-2px); }
.person .top { display: flex; gap: 12px; align-items: center; min-width: 0; }
.person .avatar { width: 52px; height: 52px; font-size: 17px; }
.person .meta { font-size: 13.5px; color: var(--muted); display: grid; gap: 2px; }
.org { display: grid; justify-content: center; overflow-x: auto; padding: 10px 0 20px; }
.org ul { display: flex; justify-content: center; padding-top: 22px; position: relative; gap: 0; }
.org li { list-style: none; position: relative; padding: 22px 8px 0; display: flex; flex-direction: column; align-items: center; }
.org li::before, .org li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 22px; border-top: 2px solid var(--stroke-2); }
.org li::after { right: auto; left: 50%; border-left: 2px solid var(--stroke-2); }
.org li:only-child::before, .org li:only-child::after { display: none; }
.org li:only-child { padding-top: 0; }
.org li:first-child::before, .org li:last-child::after { border: 0 none; }
.org li:last-child::before { border-right: 2px solid var(--stroke-2); border-radius: 0 10px 0 0; }
.org li:first-child::after { border-radius: 10px 0 0 0; }
.org ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 22px; border-left: 2px solid var(--stroke-2); }
.org > ul { padding-top: 0; }
.org-card { display: grid; justify-items: center; gap: 6px; width: 170px; padding: 14px 10px; border-radius: 18px; background: var(--surface); border: 1px solid var(--stroke); text-align: center; color: var(--ink); text-decoration: none !important; }
.org-card:hover { border-color: var(--brand); }
.org-card .avatar { width: 46px; height: 46px; }
.org-card b { font-size: 14px; line-height: 1.2; }
.org-card span { font-size: 12px; color: var(--muted); line-height: 1.2; }
.cel { display: flex; gap: 10px; align-items: center; }
.cel .ico { font-size: 20px; }

/* ---------- Fichaje móvil ---------- */
.m-clock { max-width: 440px; margin: 0 auto; display: grid; gap: 18px; text-align: center; }
.m-clock .eyebrow { justify-self: center; }
.m-clock .eyebrow::before { display: none; }
.m-clock .time { font-size: 72px; font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.m-clock .state { display: inline-flex; gap: 10px; align-items: center; justify-content: center; font-weight: 700; color: var(--ink-2); }
.m-btn { width: 100%; min-height: 120px; border-radius: 32px; border: 0; font: 800 26px var(--font); cursor: pointer; color: #fff; box-shadow: 0 24px 50px -24px var(--glow); }
.m-btn.in { background: linear-gradient(135deg, #0fb382, #2fd3a0); color: #04241a; }
.m-btn.out { background: linear-gradient(135deg, #d32f2f, #ff6b6b); }
.m-btn:active { transform: scale(.98); }
.m-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.m-stats div { padding: 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--stroke); display: grid; }
.m-stats span { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.m-stats b { font-size: 26px; font-variant-numeric: tabular-nums; }
.m-stats small { color: var(--muted); }
body.is-mobile .site-foot { display: none; }
@media (display-mode: standalone) { .install-hint { display: none; } }

/* ---------- Asistente ---------- */
.chat { display: grid; gap: 14px; }
.chat-log { display: grid; gap: 12px; min-height: 320px; max-height: calc(100vh - 380px); overflow-y: auto; padding: 4px; align-content: start; }
.msg { max-width: 78%; padding: 12px 16px; border-radius: 18px; white-space: pre-wrap; line-height: 1.55; font-size: 15.5px; }
.msg.user { justify-self: end; background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.msg.assistant { justify-self: start; background: var(--surface-2); border: 1px solid var(--stroke); border-bottom-left-radius: 6px; }
.msg.error { justify-self: start; background: var(--alert-soft); color: var(--alert); }
.msg.thinking { justify-self: start; color: var(--muted); font-style: italic; }
.chat-hints { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; }
.chat-hints .chip { cursor: pointer; font-family: var(--font); }
.chat-form { display: flex; gap: 10px; align-items: flex-end; }
.chat-form textarea { min-height: 50px; max-height: 180px; resize: none; }
.fab { position: fixed; right: 22px; bottom: 22px; z-index: 300; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--violet)); color: #fff; box-shadow: 0 18px 40px -14px var(--glow); text-decoration: none !important; }
.fab svg { width: 26px; height: 26px; stroke: #fff; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fab:hover { transform: translateY(-2px); }
body.is-embed .fab, body.is-mobile .fab { display: none; }

/* ---------- Ajustes de cabecera (muchos apartados) ---------- */
.nav-mobile-only { display: none !important; }
.nav-links a { padding: 9px 11px; font-size: 14.5px; }
@media (max-width: 1560px) { .brand .tag, .me .who { display: none; } .me { padding: 4px; } }
@media (max-width: 1360px) { .nav-links a { padding: 8px 9px; font-size: 14px; } .nav-links a.on::before { display: none; } }
@media (max-width: 1180px) {
  .nav-mobile-only { display: block !important; }
  .nav-links .linkish { padding: 12px 16px; text-align: left; font-size: 17px; color: var(--ink-2); }
  .nav-links { max-height: calc(100vh - 100px); overflow-y: auto; }
}
@media (max-width: 560px) { .hide-xs, .site-nav .logout { display: none; } .site-nav { padding-left: 16px; gap: 8px; } .brand img { height: 28px; } }
.org-card span.avatar { color: #fff; font-size: 14px; }

/* ---------- CRM ---------- */
.crm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.crm-tabs { flex-wrap: wrap; }
.status-select { min-height: 34px; padding: 4px 30px 4px 12px; border-radius: 99px; font-size: 13px; font-weight: 700; width: auto; }
.status-select.s-lead { color: var(--violet); }
.status-select.s-prospect { color: var(--warn); }
.status-select.s-active { color: var(--ok); }
.status-select.s-inactive { color: var(--muted); }
a.card.stat:hover { border-color: var(--brand); }

/* CRM → Agente */
.ag-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ag-fields { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 10px 0 0; font-size: 14px; }
.ag-fields dt { color: var(--muted); font-weight: 600; }
.ag-fields dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.ag-changes { display: grid; gap: 10px; margin-top: 8px; }
.ag-change { font-size: 13.5px; }
.ag-diff { margin-top: 4px; font-size: 13px; }
.ag-diff th { font-weight: 600; color: var(--muted); text-align: left; padding: 3px 10px 3px 0; white-space: nowrap; background: none; }
.ag-diff td { padding: 3px 8px; white-space: pre-wrap; word-break: break-word; }
.ag-diff td.old { color: var(--alert); text-decoration: line-through; }
.ag-diff td.new { color: var(--ok); }
