:root {
  --bg: #F6F5FC;
  --surface: #FFFFFF;
  --surface-2: #F0EEFB;
  --border: #E5E3F5;
  --ink: #211F36;
  --muted: #6B7280;

  --primary: #0078D4;
  --primary-dark: #005A9E;
  --primary-soft: #E5F1FB;

  --success: #16C79A;
  --success-soft: #E3FBF3;

  --out: #FF8A5B;
  --out-soft: #FFEEE3;

  --danger: #FF5C7A;
  --danger-soft: #FFE9EE;

  --font-display: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

button {
  font-family: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 14px;
  color: var(--ink);
}

.topbar__mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, #2AA4EF, var(--primary));
  flex-shrink: 0;
}

.topbar__name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--ink);
}

.topbar__sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.topbar__version {
  font-size: 10.5px;
  color: #C9C6DC;
  align-self: flex-start;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.stage {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px 16px 40px;
}

/* ---------- Layout de escritorio: panel de contexto + columna app ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hero {
  display: none;
}

@media (min-width: 900px) {
  .hero {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 46%;
    max-width: 540px;
    padding: 48px;
    background: linear-gradient(160deg, #3FB6FF, var(--primary) 55%, var(--primary-dark));
  }

  .app-column {
    flex: 1 1 54%;
  }

  .stage {
    justify-content: flex-start;
    padding-left: 56px;
  }
}

.hero__inner {
  max-width: 380px;
}

.hero__clock {
  width: 84px;
  height: 84px;
  margin-bottom: 26px;
}

.hero__title {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  line-height: 1.08;
  margin: 0 0 16px;
}

.hero__tagline {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
  margin: 0 0 30px;
}

.hero__points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.hero__points li {
  display: flex;
  align-items: baseline;
  gap: 11px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.45;
}

.hero__points li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  transform: translateY(-1px);
}

/* ---------- Tarjetas genéricas (login / política) ---------- */

.card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: none;
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(0, 120, 212, 0.10), 0 2px 8px rgba(33, 31, 54, 0.04);
  padding: 30px 26px;
  margin-top: 8px;
}

.card__title {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  color: var(--ink);
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field__label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.field input,
.field select {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 16px;
  font-family: var(--font-body);
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.btn {
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.005em;
  border-radius: 12px;
}

.btn--primary {
  background: var(--primary);
  color: #FFFFFF;
  font-size: 16px;
  padding: 15px;
  margin-top: 4px;
  box-shadow: 0 8px 20px rgba(0, 120, 212, 0.28);
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn--primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn--primary:active:not(:disabled) { transform: scale(0.99); }

.btn--primary:disabled {
  background: #DCD8F3;
  color: #A79EDA;
  box-shadow: none;
  cursor: not-allowed;
}

.form__error {
  color: var(--danger);
  font-size: 14px;
  margin: -6px 0 14px;
  font-weight: 500;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ---------- Política ---------- */

.policy__intro {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 14px;
}

.policy__box {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  max-height: 260px;
  overflow-y: auto;
}

.policy__version {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.policy__content {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0;
  white-space: pre-wrap;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 18px;
  line-height: 1.4;
}

.checkbox input {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

/* ---------- Captura de foto + ubicación ---------- */

.card--capture { padding-bottom: 24px; }

.camera {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
}

.camera video,
.camera img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera video[hidden],
.camera img[hidden] {
  display: none;
}

.btn--secondary-outline {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--ink);
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  margin-bottom: 16px;
}

.btn--secondary-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn--secondary-outline:active { background: var(--primary-soft); }

.location-status {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  margin-bottom: 14px;
}

.location-status[hidden] {
  display: none;
}

.location-status[hidden] {
  display: none;
}

.location-status__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.capture__actions {
  display: flex;
  gap: 10px;
}

.classification-field {
  margin-bottom: 14px;
}

.classification-field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.classification-field select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 16px;
  font-family: var(--font-body);
  color: var(--ink);
}

.classification-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.btn--ghost {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--muted);
  border-radius: 12px;
  padding: 15px;
  font-size: 16px;
  flex: 0 0 40%;
}

.btn--ghost:hover { border-color: var(--ink); color: var(--ink); }

.capture__actions .btn--primary { flex: 1; }

/* ---------- Ticket de checado ---------- */

.ticket {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: none;
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(0, 120, 212, 0.10), 0 2px 8px rgba(33, 31, 54, 0.04);
  padding: 24px 24px 28px;
  margin-top: 8px;
  position: relative;
}

.ticket__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.ticket__top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
}

.icon-btn[hidden] {
  display: none;
}

.icon-btn:hover { color: var(--primary); }

.ticket__greeting {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ticket__code {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 0;
}

.link-btn:hover { color: var(--primary); }

.ticket__clock {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.ticket__date {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.ticket__status {
  margin-top: 18px;
  font-size: 16px;
  font-weight: 700;
}

.ticket__status[data-state="in"] { color: var(--success); }
.ticket__status[data-state="out"] { color: var(--muted); }

.ticket__lastevent {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.perforation {
  height: 1px;
  margin: 22px 0;
  border-top: 2px dashed var(--border);
}

.btn--punch {
  padding: 20px;
  font-size: 18px;
  border-radius: 14px;
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 10px 24px rgba(0, 120, 212, 0.28);
}

.btn--punch:active { background: var(--primary-dark); }

.btn--punch[data-type="salida"] {
  background: var(--out);
  box-shadow: 0 10px 24px rgba(255, 138, 91, 0.32);
}

.btn--punch[data-type="salida"]:active { background: #F17545; }

.btn--punch:disabled {
  background: #E5E3F5;
  color: #A79EDA;
  box-shadow: none;
}

.confirmation {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--success-soft);
  border-radius: 12px;
  border-left: 4px solid var(--success);
}

.confirmation__title {
  font-weight: 700;
  color: var(--success);
}

.confirmation__time {
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}

.confirmation__late {
  font-size: 13px;
  color: var(--out);
  font-weight: 600;
  margin-top: 6px;
}

.history {
  margin-top: 24px;
}

.history__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.history__title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.history__datefilter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.history__datefilter input[type="date"] {
  padding: 7px 9px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  max-width: 150px;
}

.history__datefilter input[type="date"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

@media (max-width: 380px) {
  .history__header {
    flex-direction: column;
    align-items: stretch;
  }
  .history__datefilter input[type="date"] {
    max-width: none;
    flex: 1;
  }
}

.history__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.history__list li {
  display: flex;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.history__list li:last-child { border-bottom: none; }

.history__left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
}

.history__type { font-weight: 600; }

.history__time {
  flex: 0 0 auto;
  color: var(--ink);
}

.history__duration {
  flex: 0 0 72px;
  text-align: right;
  color: var(--muted);
  font-size: 12.5px;
}

.history__badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history__badge--in { background: var(--success); }
.history__badge--out { background: var(--out); }

@media (min-width: 480px) {
  .stage { padding-top: 24px; }
}
