/* HoraLegal · estilos de la aplicación (panel, checar y tablet) */
:root {
  --ink: #13201B;
  --bg: #F5F6F3;
  --white: #FFFFFF;
  --accent: #0F7A44;
  --accent-dark: #0B5C33;
  --lime: #5BE38E;
  --text: #3F4E47;
  --muted: #55645D;
  --line: #DDE3DE;
  --soft: #E9EFEA;
  --tint: #E3EFE7;
  --warn-bg: #FFF4DB;
  --warn: #7A5300;
  --bad-bg: #FDE8E6;
  --bad: #A2271B;
  --display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; margin: 0; line-height: 1.1; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 999px; border: 0; font: inherit; font-weight: 600; font-size: 16px; text-decoration: none; cursor: pointer; background: var(--accent); color: #FFF; }
.btn:hover { background: var(--accent-dark); color: #FFF; }
.btn.secondary { background: var(--white); color: var(--ink); border: 1.5px solid var(--line); }
.btn.secondary:hover { border-color: var(--ink); background: var(--white); color: var(--ink); }
.btn.dark { background: var(--ink); }
.btn.danger { background: var(--white); color: var(--bad); border: 1.5px solid #F0C5C0; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: wait; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* Formularios */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text); }
.field input, .field select, .field textarea { font: inherit; font-weight: 400; font-size: 16px; color: var(--ink); background: var(--white); border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 13px; min-height: 46px; width: 100%; }
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* Mensajes */
.msg { border-radius: 12px; padding: 12px 14px; font-size: 15px; background: var(--tint); color: var(--accent-dark); }
.msg.warn { background: var(--warn-bg); color: var(--warn); }
.msg.bad { background: var(--bad-bg); color: var(--bad); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--soft); color: var(--text); white-space: nowrap; }
.badge.ok { background: var(--tint); color: var(--accent-dark); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

/* Tarjetas */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.card.flat { box-shadow: none; }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }

/* Marca */
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand svg { width: 30px; height: 30px; }
.brand-word { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -0.035em; line-height: 1; }

/* Panel del patrón */
.topbar { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .inner { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1 1 auto; scrollbar-width: none; }
.tabs a { padding: 8px 14px; border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap; }
.tabs a:hover { background: var(--soft); color: var(--ink); }
.tabs a.on { background: var(--ink); color: #FFF; }
.page { max-width: 1120px; margin: 0 auto; padding: 24px 20px 64px; display: flex; flex-direction: column; gap: 18px; }
.auth { max-width: 420px; margin: 0 auto; padding: 48px 20px; display: flex; flex-direction: column; gap: 22px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.stat b { display: block; font-family: var(--display); font-size: 30px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 14px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--soft); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: #FAFBF9; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .sub { display: block; font-size: 13px; color: var(--muted); }

.list { display: flex; flex-direction: column; }
.item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 0; border-bottom: 1px solid var(--soft); }
.item:last-child { border-bottom: 0; }
.item select { font: inherit; font-size: 14px; color: var(--ink); background: var(--white); border: 1.5px solid var(--line); border-radius: 10px; padding: 7px 10px; min-height: 36px; }
#emp-accesos h3 { margin-top: 14px; }
#f-invitar { margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--soft); }

dialog { border: 0; border-radius: 20px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(19, 32, 27, 0.45); }
dialog .dlg { padding: 22px; display: flex; flex-direction: column; gap: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #FFF; padding: 12px 18px; border-radius: 12px; font-size: 15px; z-index: 50; max-width: calc(100vw - 32px); }

/* Pantallas del trabajador y la tablet */
.phone { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; padding: 18px 18px 28px; gap: 18px; }
.phone header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.clock { font-family: var(--display); font-weight: 800; font-size: 64px; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.date { color: var(--muted); font-size: 16px; }
.big-btn { width: 100%; min-height: 84px; border-radius: 22px; font-size: 22px; font-family: var(--display); font-weight: 700; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices .btn { min-height: 54px; border-radius: 16px; }
.choices .btn.on { border-color: var(--ink); background: var(--ink); color: #FFF; }

.pin-dots { display: flex; justify-content: center; gap: 14px; min-height: 22px; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); display: block; }
.pin-dots i.on { background: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { min-height: 64px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--white); font: inherit; font-family: var(--display); font-size: 28px; font-weight: 700; color: var(--ink); cursor: pointer; }
.keypad button:active { background: var(--soft); }
.keypad button.fn { font-family: var(--body); font-size: 16px; font-weight: 600; }

.done { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 0; }
.done .ring { width: 92px; height: 92px; border-radius: 50%; background: var(--tint); display: grid; place-items: center; }
.done .ring svg { width: 52px; height: 52px; }
.done .when { font-family: var(--display); font-size: 48px; font-weight: 800; line-height: 1; }

/* Tablet */
.kiosk { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr; gap: 28px; padding: 28px; max-width: 1100px; margin: 0 auto; align-content: center; }
@media (min-width: 860px) { .kiosk { grid-template-columns: 1fr 420px; align-items: center; } }
.kiosk .clock { font-size: clamp(72px, 10vw, 120px); }
.codigo-tablet { display: flex; gap: 18px; align-items: center; padding: 16px 18px; }
.codigo-qr { width: 190px; flex: none; background: #FFF; border-radius: 12px; }
.codigo-qr svg { display: block; width: 100%; height: auto; }
.codigo-barra { height: 6px; background: var(--soft, #E9EFEA); border-radius: 4px; overflow: hidden; }
.codigo-barra i { display: block; height: 100%; width: 100%; background: var(--accent, #0F7A44); border-radius: 4px; }
@media (max-width: 520px) { .codigo-tablet { flex-direction: column; text-align: center; } .codigo-qr { width: 220px; } }

/* Avisos legales */
.legal { max-width: 760px; margin: 0 auto; padding: 22px 20px 64px; display: flex; flex-direction: column; gap: 26px; }
.legal section { display: flex; flex-direction: column; gap: 8px; }
.legal h1 { font-size: clamp(28px, 5vw, 38px); }
.legal h2 { font-size: 20px; }
.legal p, .legal li { line-height: 1.6; }
.legal ul, .legal ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-dark); }
.aviso-simple { font-size: 13.5px; line-height: 1.5; color: var(--text); background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }

/* Convenio y formato alterno (solo se imprimen) */
.convenio { font-family: Georgia, "Times New Roman", serif; font-size: 9.9pt; line-height: 1.3; color: #000; }
.convenio + .convenio { break-before: page; page-break-before: always; }
.convenio h1 { font-family: Inter, Arial, sans-serif; font-size: 13.5pt; text-align: center; text-transform: uppercase; letter-spacing: 0.02em; margin: 0 0 8pt; }
.convenio h2 { font-family: Inter, Arial, sans-serif; font-size: 11pt; text-align: center; text-transform: uppercase; margin: 10pt 0 5pt; }
.convenio p { margin: 0 0 5pt; text-align: justify; }
.convenio ol { margin: 0 0 6pt; padding-left: 20pt; display: block; }
.convenio li { margin-bottom: 2pt; text-align: justify; }
.convenio .blanco { display: inline-block; border-bottom: 1px solid #000; height: 0.9em; vertical-align: baseline; }
.convenio .firmas { break-inside: avoid; page-break-inside: avoid; margin-top: 8pt; }
.convenio table { width: 100%; border-collapse: collapse; margin-top: 4pt; }
.convenio th { font-family: Inter, Arial, sans-serif; font-size: 10pt; text-align: center; padding: 2pt; border: 0; }
.convenio td { width: 50%; text-align: center; vertical-align: top; padding: 2pt 8pt; border: 0; }
.convenio td.linea { padding-top: 24pt; }
.convenio td.linea span { display: inline-block; min-width: 65mm; border-top: 1px solid #000; padding-top: 3pt; font-family: Inter, Arial, sans-serif; font-size: 9pt; }
.convenio .pie { font-family: Inter, Arial, sans-serif; font-size: 8pt; color: #555; text-align: center; margin-top: 8pt; }
.convenio .ejemplar { font-family: Inter, Arial, sans-serif; font-size: 8pt; color: #555; text-align: right; margin: 0 0 4pt; }
.convenio .sub { font-family: Inter, Arial, sans-serif; text-align: center; }
.formato table { margin-top: 8pt; }
.formato th, .formato td { width: auto; border: 1px solid #000; font-size: 8.5pt; padding: 3pt; }
.formato td { height: 9mm; }

/* Prenómina */
.prenomina td, .prenomina th { white-space: nowrap; }
.prenomina td:first-child, .prenomina td.small { white-space: normal; min-width: 160px; }
.prenomina tr.total td { border-top: 2px solid var(--line); }
.dias-descanso { gap: 6px 14px; }
.prenomina-impresa { font-family: Inter, Arial, sans-serif; color: #000; }
.prenomina-impresa h2 { margin: 0 0 4px; }
.prenomina-impresa p { margin: 0 0 4px; }
.prenomina-impresa .nota { font-size: 10px; margin-bottom: 10px; }
.prenomina-impresa table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.prenomina-impresa th, .prenomina-impresa td { border: 1px solid #999; padding: 3px 5px; text-align: left; }

/* Impresión (reportes y carteles QR) */
.print-only { display: none; }
@media print {
  body { background: #FFF; font-size: 12px; }
  .no-print, .topbar, .toast { display: none !important; }
  .print-only { display: block; }
  .page { padding: 0; max-width: none; }
  .card, .table-wrap { border: 0; padding: 0; }
  th, td { padding: 5px 6px; border-bottom: 1px solid #CCC; }
  @page { margin: 14mm; }
}

/* Registros: atajos de periodo y tarjeta del trabajador */
.atajos { display: inline-flex; align-self: flex-start; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.atajos button { border: 0; background: none; font: inherit; font-size: 14px; color: var(--muted); padding: 7px 12px; border-radius: 9px; cursor: pointer; }
.atajos button:hover { color: var(--ink); }
.atajos button.on { background: var(--tint); color: var(--accent-dark); font-weight: 600; }
.reg-uno { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.reg-perfil { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.reg-perfil h2 { font-size: 19px; }
.reg-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--ink); color: var(--lime); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 22px; margin-bottom: 6px; }
.reg-semana { width: 100%; margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--bg); display: grid; gap: 6px; text-align: left; font-size: 14px; }
.reg-semana strong { font-size: 17px; }
.reg-semana i { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.reg-semana em { display: block; height: 100%; background: var(--accent); }
.reg-semana em.warn { background: #D99A00; }
.reg-semana em.bad { background: var(--bad); }
.reg-semana .badge { justify-self: start; }
.reg-sub { width: 100%; margin: 14px 0 2px; text-align: left; font-weight: 600; font-size: 14px; }
.reg-perfil ul { width: 100%; list-style: none; margin: 0; padding: 0; text-align: left; }
.reg-perfil li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.reg-perfil li:last-child { border-bottom: 0; }
.reg-conf { width: 100%; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); text-align: left; font-size: 14px; }
.reg-detalle { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.reg-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.reg-pills span { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; font-size: 14px; color: var(--text); }
.reg-pills b { color: var(--ink); }
@media (max-width: 860px) { .reg-uno { grid-template-columns: 1fr; } }
@media print { .reg-perfil, .reg-pills { display: none; } .reg-uno { display: block; } }

/* Turnos */
.tur-nav { align-items: center; gap: 10px; flex-wrap: wrap; }
.tur-nav b { font-family: var(--display); font-size: 18px; }
.tur-tabla th .sub { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.tur-tabla th.hoy { color: var(--accent-dark); }
.tur-tabla td.tur-celda { padding: 4px; min-width: 96px; vertical-align: top; }
.tur-tabla td.tur-sem { min-width: 150px; vertical-align: top; }
.tur-sem .tur-s { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; }
.tur-sem .tur-s b { color: var(--ink); font-weight: 600; }
.tur-sem .badge { margin: 3px 0 2px; }
.tur-celda button, .tur-celda > div { width: 100%; min-height: 60px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px; border: 1px dashed var(--line); border-radius: 10px; background: var(--white); font: inherit; color: var(--ink); text-align: left; }
.tur-celda button { cursor: pointer; }
.tur-celda button:hover { border-color: var(--accent); }
.tur-celda.plan button, .tur-celda.plan > div { background: var(--tint); border: 1px solid #B9E0C6; }
.tur-celda.desc button, .tur-celda.desc > div { background: var(--soft); }
.tur-celda.siempre .tur-h, .tur-celda.desc .tur-h { color: var(--muted); font-weight: 500; }
.tur-celda.hoy button, .tur-celda.hoy > div { box-shadow: inset 0 0 0 2px var(--accent); }
.tur-h { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tur-celda .sub { display: block; font-size: 12px; color: var(--muted); }
.tur-celda .badge { white-space: normal; font-size: 11px; }
.tur-dias { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.tur-dias label, .tur-op { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
