/* Fichaje v0.9.0 — estilos (identidad corporativa Safeland) */
:root {
  /* Paleta Safeland */
  --brand: #0083db;        /* azul corporativo */
  --brand-d: #0065c0;      /* azul oscuro (hover) */
  --brand-l: #9acdff;      /* azul claro */
  --navy: #041537;         /* azul marino profundo (barra, marca) */
  --navy-2: #0a2e63;

  --bg: #eef4fb; --card: #fff; --text: #16233f; --muted: #5c6b86; --line: #dde6f1;
  --primary: #0083db; --primary-d: #0065c0; --ok: #15803d; --warn: #b45309; --err: #b91c1c; --pausa: #6d28d9;
  --radius: 14px; --btn-radius: 8px;
  --shadow: 0 1px 2px rgba(9,40,90,.06), 0 6px 22px rgba(9,40,90,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 15px/1.55 "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* Fondo de marca (login, terminal, instalador) — degradado radial azul marino */
body.centered, body.brand-bg { background: radial-gradient(120% 95% at 50% 12%, #0b3d72 0%, #06204b 42%, #00082c 100%) fixed; color: #e7ecf5; }
body.centered { display: flex; align-items: center; justify-content: center; padding: 20px; }

a { color: var(--primary); }
h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 12px; letter-spacing: -.2px; } h1 small { color: var(--muted); font-weight: 400; font-size: .85rem; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 10px; letter-spacing: -.2px; } h3 { font-size: 1rem; font-weight: 600; margin: 16px 0 6px; }
code { background: #e7f0fb; color: #0b4a86; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* ---- Marca ---- */
.brandmark { display: flex; align-items: center; gap: 12px; }
.brandmark img { width: 44px; height: 44px; flex: none; }
.brandmark .wm { line-height: 1.05; }
.brandmark .wm b { display: block; font-weight: 300; letter-spacing: 5px; font-size: 1.25rem; }
.brandmark .wm span { display: block; font-weight: 600; font-size: .8rem; letter-spacing: 1.5px; color: var(--brand-l); text-transform: uppercase; }
.brand-hero { text-align: center; margin: 0 auto 22px; }
.brand-hero img { width: 74px; height: 74px; filter: drop-shadow(0 6px 16px rgba(0,131,219,.4)); }
.brand-hero .wm { margin-top: 12px; }
.brand-hero .wm b { font-weight: 300; letter-spacing: 8px; font-size: 1.7rem; color: #fff; }
.brand-hero .wm span { display: block; margin-top: 2px; font-weight: 600; font-size: .82rem; letter-spacing: 2px; color: var(--brand-l); text-transform: uppercase; }

.card { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 16px; }
.card.narrow { max-width: 460px; width: 100%; }
/* Tarjeta de acceso con cabecera de marca */
.login-card { max-width: 430px; width: 100%; margin: 6vh auto; padding: 0; overflow: hidden; }
.login-card .lc-head { background: linear-gradient(135deg, #062a5c 0%, #0083db 130%); padding: 26px 24px; color: #fff; display: flex; align-items: center; gap: 14px; }
.login-card .lc-head img { width: 46px; height: 46px; }
.login-card .lc-head .wm b { display: block; font-weight: 300; letter-spacing: 5px; font-size: 1.2rem; }
.login-card .lc-head .wm span { display: block; font-weight: 600; font-size: .72rem; letter-spacing: 1.5px; color: #bfe0ff; text-transform: uppercase; margin-top: 2px; }
.login-card .lc-body { padding: 24px; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.wrap.slim { max-width: 640px; }

label { display: block; margin: 10px 0 4px; font-weight: 600; font-size: .9rem; }
label input, label select, label textarea { font-weight: 400; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #c6d4e6; border-radius: var(--btn-radius); font: inherit; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(0,131,219,.25); border-color: var(--primary); }
input[type=checkbox] { width: auto; margin-right: 6px; transform: scale(1.15); }
.check { display: flex; align-items: center; gap: 6px; font-weight: 500; margin: 8px 0; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.help { font-size: .82rem; color: var(--muted); margin: 2px 0 6px; }

.btn { display: inline-block; padding: 10px 18px; border: 0; border-radius: var(--btn-radius); background: var(--primary); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s, box-shadow .15s; box-shadow: 0 1px 2px rgba(0,101,192,.25); }
.btn:hover { background: var(--primary-d); box-shadow: 0 3px 10px rgba(0,101,192,.3); } .btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.secondary { background: #e6eef8; color: #1c3a63; box-shadow: none; } .btn.secondary:hover { background: #d3e2f4; }
.btn.ok { background: var(--ok); } .btn.ok:hover { background: #166534; }
.btn.warn { background: var(--warn); } .btn.warn:hover { background: #92400e; }
.btn.err { background: var(--err); } .btn.err:hover { background: #991b1b; }
.btn.pausa { background: var(--pausa); } .btn.pausa:hover { background: #5b21b6; }
.btn.big { font-size: 1.25rem; padding: 20px 26px; width: 100%; border-radius: 14px; }
.btn.small { padding: 5px 10px; font-size: .82rem; border-radius: 6px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.btns.stack { flex-direction: column; }

.msg { padding: 10px 14px; border-radius: var(--btn-radius); margin: 10px 0; font-size: .92rem; }
.msg.error, p.error { background: #fee2e2; color: #7f1d1d; }
.msg.ok, p.ok { background: #dcfce7; color: #14532d; }
.msg.info { background: #dbeafe; color: #1e3a8a; }
.msg.warn { background: #fef3c7; color: #78350f; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; background: linear-gradient(100deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; border-bottom: 3px solid var(--brand); position: sticky; top: 0; z-index: 5; box-shadow: 0 2px 10px rgba(4,21,55,.25); }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; }
.topbar .brand img { width: 30px; height: 30px; }
.topbar .brand .bt { line-height: 1.1; }
.topbar .brand .bt b { font-weight: 300; letter-spacing: 3px; font-size: 1.02rem; text-transform: uppercase; }
.topbar .brand small { display: block; color: var(--brand-l); font-weight: 600; font-size: .64rem; letter-spacing: 1px; text-transform: uppercase; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a { padding: 7px 12px; border-radius: 7px; text-decoration: none; color: #cfe0f5; font-weight: 500; font-size: .92rem; transition: background .15s, color .15s; }
.topbar nav a.active, .topbar nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar .user { color: #b9cbe6; font-size: .9rem; } .topbar .user a { color: var(--brand-l); }

.clock { font-size: 2.6rem; font-weight: 700; letter-spacing: 1px; text-align: center; font-variant-numeric: tabular-nums; color: var(--navy); }
.date { text-align: center; color: var(--muted); margin-bottom: 14px; }
.estado { text-align: center; font-size: 1.05rem; margin: 6px 0 16px; }
.pill { display: inline-block; padding: 3px 12px; border-radius: 999px; font-weight: 600; font-size: .85rem; }
.pill.fuera { background: #e2e8f0; color: #334155; } .pill.dentro { background: #dcfce7; color: #14532d; }
.pill.pausa { background: #ede9fe; color: #4c1d95; } .pill.olvidada { background: #fef3c7; color: #78350f; }
.pill.valido { background: #dcfce7; color: #14532d; } .pill.anulado { background: #fee2e2; color: #7f1d1d; text-decoration: line-through; }
.pill.admin { background: #fde68a; color: #78350f; } .pill.web { background: #dbeafe; color: #1e3a8a; } .pill.terminal { background: #e0f2fe; color: #0c4a6e; }
.pill.prueba { background: #fbcfe8; color: #831843; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f2f7fc; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: #45608a; }
tr.finde td { color: var(--muted); } tr.inc td { background: #fffbeb; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { background: #f2f7fc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.stat .v { font-size: 1.4rem; font-weight: 700; color: var(--navy); } .stat .l { font-size: .8rem; color: var(--muted); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.timeline .hora { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 60px; }
.timeline .tipo { flex: 1; } .timeline .extra { color: var(--muted); font-size: .82rem; }

.modal-bg { position: fixed; inset: 0; background: rgba(4,21,55,.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.modal { background: #fff; color: var(--text); border-radius: var(--radius); padding: 22px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; box-shadow: 0 12px 40px rgba(4,21,55,.3); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 8px 12px; font: inherit; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.muted { color: var(--muted); } .right { text-align: right; } .center { text-align: center; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; word-break: break-all; }

/* Terminal (kiosco) — sobre fondo de marca oscuro */
.terminal { max-width: 520px; margin: 0 auto; padding: 16px; }
.terminal .brand-hero { padding-top: 8px; }
.usuarios-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.usuarios-grid button { padding: 18px 10px; font-size: 1rem; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 14px auto; }
.pinpad button { font-size: 1.5rem; padding: 18px 0; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-family: inherit; }
.pinpad button:active { background: #e2e8f0; }
.pin-display { text-align: center; font-size: 2rem; letter-spacing: 12px; min-height: 48px; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .card { padding: 18px; } .topbar { flex-wrap: wrap; } h1 { font-size: 1.25rem; } .brand-hero .wm b { letter-spacing: 5px; font-size: 1.4rem; } }
@media print { .topbar, .btn, .noprint { display: none !important; } .card { box-shadow: none; border: 0; } }

/* v0.2.0 */
.pill.diferido { background: #e0f2fe; color: #0c4a6e; }
td .ev { white-space: nowrap; padding: 2px 0; }
td .ev .hora { font-weight: 600; font-variant-numeric: tabular-nums; }
a.op { font-size: .8rem; color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--muted); }
a.op:hover { color: var(--primary); }

/* v0.5.0 — enlace de desactivar terminal, discreto y en la esquina para no pulsarlo por error */
#t-desactivar { position: fixed; bottom: 6px; right: 8px; font-size: .68rem; color: #8fa6c6; opacity: .55; text-decoration: none; padding: 4px 6px; z-index: 5; }
#t-desactivar:hover, #t-desactivar:focus { opacity: 1; text-decoration: underline; color: #cfe0f5; }

/* v0.8.4 — campo de contraseña con botón "Ver/Ocultar" */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 76px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: #e6eef8; color: #1c3a63; font: inherit; font-size: .8rem; font-weight: 600; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.pw-toggle:hover { background: #d3e2f4; }

/* v0.6.0 — al rol lector se le oculta por completo la columna de incidencias/alertas (cabecera y celdas) */
.rol-lector .col-anot { display: none; }
/* v0.6.0 — el atributo hidden debe ganar SIEMPRE, incluso a .btn/.pill con display propio. */
[hidden] { display: none !important; }

/* v0.9.0 — festivos, vacaciones y permisos con etiquetas propias (no son «ausencias») */
.pill.fest { background: #ccfbf1; color: #134e4a; }
.pill.vac { background: #dbeafe; color: #1e3a8a; }
.pill.perm { background: #ede9fe; color: #4c1d95; }
.pill.injust { background: #fee2e2; color: #7f1d1d; }
tr.fest td { background: #f0fdfa; }
tr.fest.inc td { background: #fffbeb; }
/* Calendarios: vista previa de la importación */
.cal-bloque { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 14px 0; background: #fbfdff; }
.cal-bloque.guardado { border-color: #86efac; background: #f0fdf4; }
.cal-bloque h3 { margin-top: 0; }
.cal-bloque table input, .cal-bloque table select { padding: 5px 8px; font-size: .88rem; }
.cal-bloque tr.excluido td { opacity: .45; }
.cal-bloque tr.finde td { color: var(--muted); }
.cal-resumen { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0; font-size: .9rem; }
.cal-resumen b { font-variant-numeric: tabular-nums; }
.pill.revisar { background: #fef3c7; color: #78350f; }
.estado-conv.ok { color: var(--ok); font-weight: 600; } .estado-conv.mal { color: var(--err); font-weight: 600; }
