:root {
  color-scheme: light;
  --ink: #18312f;
  --muted: #657673;
  --paper: #f3f1ea;
  --card: #fffefa;
  --line: #d8ddd8;
  --green: #147568;
  --green-dark: #0d544c;
  --blue: #285f94;
  --red: #a94845;
  --amber: #a66b10;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(20, 117, 104, 0.12), transparent 34rem),
    var(--paper);
  color: var(--ink);
}

button, input { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 24px max(30px, env(safe-area-inset-bottom));
}

.topbar, .status-cluster, .dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow, .step-label, .metric-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 { margin: 4px 0 0; font-size: clamp(1.5rem, 4vw, 2.2rem); }

.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: #e7ece9;
  font-size: 0.82rem;
  font-weight: 700;
}
.status-pill.online { background: #d9eee8; color: var(--green-dark); }
.status-pill.offline { background: #f5e5cf; color: #76480b; }

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.clock-panel { margin: 28px 0 20px; display: flex; align-items: baseline; gap: 16px; }
#current-time { font-size: clamp(3.4rem, 11vw, 6.8rem); font-weight: 800; letter-spacing: -0.07em; line-height: 0.9; }
#current-date { color: var(--muted); font-weight: 650; text-transform: capitalize; }

.card {
  background: var(--card);
  border: 1px solid rgba(40, 70, 66, 0.13);
  border-radius: 22px;
  box-shadow: 0 14px 40px rgba(28, 53, 50, 0.07);
}
.action-card, .identify-card { padding: 22px; margin-bottom: 18px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.action-button {
  min-height: 108px;
  border: 2px solid transparent;
  border-radius: 18px;
  color: white;
  font-size: 1.55rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.action-button.entry { background: var(--green); }
.action-button.exit { background: var(--blue); }
.action-button.selected { outline: 5px solid rgba(238, 175, 62, 0.62); transform: translateY(-2px); }
.action-symbol { font-size: 2.5rem; line-height: 1; }
.action-help { margin: 14px 0 0; color: var(--muted); text-align: center; }
.action-help.ready { color: var(--green-dark); font-weight: 700; }
.history-button {
  display: block;
  margin: 10px auto 0;
  border: 0;
  padding: 8px 12px;
  background: transparent;
  color: var(--blue);
  font-weight: 750;
}

.tabs { display: flex; gap: 6px; padding: 5px; margin: 16px 0; background: #edf0ed; border-radius: 13px; }
.tab { flex: 1; border: 0; border-radius: 9px; padding: 12px; background: transparent; color: var(--muted); font-weight: 750; }
.tab.active { background: white; color: var(--ink); box-shadow: 0 2px 8px rgba(30, 50, 48, 0.1); }

.credential-form { display: grid; gap: 10px; }
.credential-form label { font-weight: 700; }
.credential-form input, dialog input {
  width: 100%;
  min-height: 54px;
  border: 1px solid #bdc8c4;
  border-radius: 12px;
  padding: 10px 14px;
  background: white;
  color: var(--ink);
}
.credential-form input:focus, dialog input:focus { outline: 3px solid rgba(20, 117, 104, 0.22); border-color: var(--green); }
.credential-form small { color: var(--muted); }

.primary-button, .secondary-button, .text-button {
  border-radius: 12px;
  padding: 13px 18px;
  font-weight: 750;
}
.primary-button { border: 0; background: var(--green-dark); color: white; }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.text-button { border: 0; padding: 8px 0; background: transparent; color: var(--green-dark); text-align: left; }

.bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.compact-card { padding: 18px 20px; }
.metric { display: block; margin-top: 5px; font-size: 2rem; }
.message { min-height: 24px; margin: 16px 4px; color: var(--red); font-weight: 650; }

.confirmation {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 35, 32, 0.72);
}
.confirmation-box {
  width: min(520px, 100%);
  padding: 42px 30px;
  border-radius: 26px;
  background: white;
  text-align: center;
  display: grid;
  gap: 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}
.confirmation-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto 8px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d9eee8;
  color: var(--green-dark);
  font-size: 2.6rem;
  font-weight: 900;
}
#confirmation-title { font-size: 1.8rem; }
#confirmation-worker { font-size: 1.3rem; font-weight: 700; }
#confirmation-detail { color: var(--muted); }
.confirmation.warning .confirmation-icon {
  background: #f5e5cf;
  color: #76480b;
}
.confirmation.warning #confirmation-title,
.confirmation.warning #confirmation-detail {
  color: #76480b;
}

dialog { width: min(560px, calc(100% - 32px)); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 24px 80px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(10, 35, 32, 0.65); }
dialog form { padding: 26px; display: grid; gap: 12px; }
dialog h2, dialog p { margin: 0 0 6px; }
.dialog-actions { margin-top: 10px; justify-content: flex-end; }
.history-content { padding: 24px; }
.history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.history-list { display: grid; gap: 8px; margin-top: 20px; max-height: 60vh; overflow: auto; }
.history-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f2f4f1;
}
.history-type { font-weight: 800; }
.history-type.entry { color: var(--green-dark); }
.history-type.exit { color: var(--blue); }
.history-date { color: var(--muted); }
.history-time { font-size: 1.15rem; font-weight: 800; }

.hidden { display: none !important; }

@media (max-width: 620px) {
  .shell { padding-left: 14px; padding-right: 14px; }
  .topbar { align-items: flex-start; }
  .status-cluster { flex-direction: column-reverse; align-items: flex-end; gap: 7px; }
  .clock-panel { align-items: flex-end; justify-content: space-between; }
  #current-date { max-width: 45%; text-align: right; }
  .action-button { min-height: 92px; font-size: 1.25rem; }
  .bottom-grid { gap: 10px; }
}


/* Terminal compartida de 10 pulgadas en vertical. */
.shell { width: min(760px, 100%); padding: 16px 24px; }
.topbar h1 { font-size: 1.6rem; }
.clock-panel { margin: 14px 0; }
#current-time { font-size: 3.6rem; }
.action-card, .identify-card { padding: 16px 20px; margin-bottom: 12px; }
.action-grid { margin-top: 10px; gap: 14px; }
.action-button { min-height: 82px; }
.action-help { margin-top: 10px; }
.history-button { margin-top: 2px; padding: 4px 12px; font-size: .85rem; }
.reader-help { margin: 10px 0 14px; text-align: center; font-weight: 700; color: var(--green-dark); }
.reader-form { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.credential-fields { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.credential-fields label { display: block; margin-bottom: 6px; }
.credential-fields input { min-height: 54px; font-size: 1.5rem; letter-spacing: .12em; }
.numeric-keyboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numeric-keyboard button { min-height: 62px; border: 1px solid #bdc8c4; border-radius: 12px; background: #f1f4f1; color: var(--ink); font-size: 1.7rem; font-weight: 750; touch-action: manipulation; }
.numeric-keyboard button[data-key="clear"] { font-size: .9rem; }
button:disabled, input:disabled { cursor: default; opacity: .45; }
.numeric-keyboard button:active:not(:disabled) { background: #d9eee8; }
#confirm-pin { min-height: 54px; font-size: 1.1rem; }
.bottom-grid { gap: 12px; }
.compact-card { padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.metric { margin: 0; font-size: 1.2rem; }
.metric-label { font-size: .65rem; letter-spacing: .02em; }
.text-button { font-size: .75rem; }
.message { margin: 8px 4px; min-height: 20px; }
@media (max-height: 950px) and (min-width: 600px) {
  .shell { padding-top: 10px; padding-bottom: 10px; }
  .clock-panel { margin: 10px 0; }
  .action-button { min-height: 70px; }
  .numeric-keyboard button { min-height: 54px; }
  .action-card, .identify-card { padding: 12px 18px; }
}
@media (max-width: 599px) {
  .shell { padding: 10px 14px; }
  .numeric-keyboard button { min-height: 48px; }
  .compact-card { flex-wrap: wrap; }
}

.credential-label { display: block; font-weight: 700; margin-bottom: 6px; }
.credential-display { width: 100%; min-height: 54px; border: 1px solid #bdc8c4; border-radius: 12px; padding: 10px 14px; background: white; color: var(--ink); font-size: 1.5rem; letter-spacing: .12em; text-align: left; }
.credential-display.placeholder { color: #7d8885; letter-spacing: .03em; }
.credential-display[aria-pressed="true"] { outline: 3px solid rgba(20,117,104,.22); border-color: var(--green); }
.terminal-error { width: min(540px, calc(100% - 32px)); border: 2px solid #c5574f; }
.terminal-error-content { padding: 32px 26px; display: grid; gap: 18px; text-align: center; }
.terminal-error h2 { font-size: 1.7rem; color: var(--red); margin: 0; }
.terminal-error p { font-size: 1.15rem; line-height: 1.5; margin: 0; }
.error-icon { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; margin: 0 auto; background: #fbe5e1; color: var(--red); font-size: 2.5rem; font-weight: 900; }
.terminal-error button { min-height: 54px; font-size: 1.1rem; }
