/* ChecaHub · sistema visual
   Motivo: la tarjeta del reloj checador. La hora es el protagonista; todo lo demás, sobrio. */
@font-face {
  font-family: 'Archivo'; font-style: normal; font-display: swap;
  font-weight: 100 900; font-stretch: 62% 125%;
  src: url('/fonts/archivo.woff2') format('woff2');
}

:root {
  --ink: #142126;          /* grafito: texto */
  --ink-2: #4A5D63;        /* texto secundario */
  --paper: #EEF3F1;        /* fondo frío */
  --sheet: #FFFFFF;        /* superficies */
  --card: #E2EFEA;         /* la tarjeta de checador */
  --rule: #CFDDD8;         /* líneas */
  --in: #0F5B49;           /* tinta verde: entrada y marca */
  --in-soft: #D3EBE3;
  --out: #1D3557;          /* tinta azul: salida */
  --out-soft: #DCE4F0;
  --warn: #E59A2E;         /* ámbar: avisos */
  --warn-soft: #FBEBD2;
  --bad: #A8323E;
  --bad-soft: #F6DEE0;
  --focus: #E59A2E;
  --r-s: 8px; --r-m: 14px; --r-l: 22px;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --tap: 48px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E5EFEC; --ink-2: #9FB3B8; --paper: #0D1A1D; --sheet: #13252A; --card: #183238;
    --rule: #25434A; --in: #4CC3A0; --in-soft: #143A31; --out: #8FB0E0; --out-soft: #1B2B44;
    --warn: #F0B35A; --warn-soft: #3A2A12; --bad: #F08A94; --bad-soft: #3D1A1E;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.5; font-variant-numeric: tabular-nums;
}
a { color: var(--in); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden], .hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 750; font-stretch: 110%; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; }
.quiet { color: var(--ink-2); font-size: .94rem; }
.small { font-size: .85rem; }

/* ---------- Controles ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: .9rem; font-weight: 600; color: var(--ink-2); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--sheet); width: 100%;
  min-height: var(--tap); padding: 10px 14px; border: 1.5px solid var(--rule); border-radius: var(--r-s);
}
input:focus, select:focus { border-color: var(--in); outline: none; box-shadow: 0 0 0 3px var(--in-soft); }
.btn {
  font: inherit; font-weight: 650; min-height: var(--tap); padding: 10px 18px; border-radius: var(--r-s);
  border: 1.5px solid transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--in); color: #fff; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.line { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.line:hover { border-color: var(--ink-2); filter: none; }
.btn.danger { background: var(--bad); }
.btn.block { width: 100%; }
.msg { min-height: 1.4em; font-size: .92rem; margin-top: 6px; }
.msg.bad { color: var(--bad); } .msg.good { color: var(--in); }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 650; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.tag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag.in { background: var(--in-soft); color: var(--in); }
.tag.out { background: var(--out-soft); color: var(--out); }
.tag.warn { background: var(--warn-soft); color: #8A5300; }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.none { background: transparent; color: var(--ink-2); border: 1px dashed var(--rule); }
@media (prefers-color-scheme: dark) { .tag.warn { color: var(--warn); } }

/* Interruptor (reglas) */
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; min-height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--rule); transition: background .2s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--in); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; }

/* ---------- Tarjeta de checador (motivo) ---------- */
.timecard {
  position: relative; background: var(--card); border-radius: var(--r-m);
  padding: 18px 18px 18px 30px; overflow: hidden;
}
/* perforaciones del borde izquierdo, como las tarjetas de cartón */
.timecard::before {
  content: ''; position: absolute; left: 10px; top: 14px; bottom: 14px; width: 8px;
  background: radial-gradient(circle, var(--paper) 3.2px, transparent 3.6px) 0 0 / 8px 16px repeat-y;
}
.timecard .row-line { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: baseline; padding: 9px 0; border-bottom: 1px dashed var(--rule); }
.timecard .row-line:last-child { border-bottom: 0; }
.stamp {
  font-stretch: 125%; font-weight: 800; font-size: 1.35rem; letter-spacing: .01em;
}
.stamp.in { color: var(--in); } .stamp.out { color: var(--out); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
