:root {
  --asphalt: #16202a;
  --cabin: #1c2c3a;
  --brass: #d4a017;
  --fog: #d7e0e8;
  --paper: #f4f7fa;
  --stamp: #e23c28;
  --ink: #0e151c;
  --muted: #5c6b78;
  --line: #c3ced8;
  --ok: #1f7a5c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body.login-page {
  min-height: 100vh;
  color: var(--ink);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, #2a4558 0%, transparent 55%),
    radial-gradient(900px 420px at 110% 110%, #3a2810 0%, transparent 50%),
    var(--asphalt);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

body.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(
      115deg,
      transparent 0 28px,
      rgba(215, 224, 232, 0.04) 28px 29px
    );
}

.login-shell {
  width: min(920px, 100%);
  position: relative;
  z-index: 1;
}

.brand-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  color: var(--fog);
  margin-bottom: 0.85rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ticket {
  display: grid;
  grid-template-columns: 210px 1fr;
  background: var(--paper);
  border-radius: 6px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(212, 160, 23, 0.25);
  overflow: hidden;
  animation: ticket-in 0.55s ease-out both;
}

.ticket-stub {
  position: relative;
  background: linear-gradient(180deg, #1a3344 0%, #132530 100%);
  color: var(--paper);
  padding: 1.4rem 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ticket-stub::after {
  content: "";
  position: absolute;
  top: 14px;
  right: -9px;
  bottom: 14px;
  width: 18px;
  background: radial-gradient(circle at 9px 9px, var(--asphalt) 7px, transparent 8px);
  background-size: 18px 22px;
  background-repeat: repeat-y;
}

.stub-kicker {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: var(--brass);
  text-transform: uppercase;
}

.stub-dest {
  font-family: "Teko", sans-serif;
  font-weight: 600;
  font-size: 3.15rem;
  line-height: 0.85;
  letter-spacing: 0.02em;
}

.stub-dest span {
  display: block;
  font-size: 1.2rem;
  letter-spacing: 0.14em;
  color: var(--fog);
  margin-top: 0.15rem;
  white-space: nowrap;
}

.stub-meta {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  line-height: 1.55;
  color: #b7c5d0;
}

.stub-meta strong {
  color: var(--paper);
  font-weight: 500;
}

.barcode {
  margin-top: auto;
  height: 46px;
  background: repeating-linear-gradient(
    90deg,
    #f4f7fa 0 2px,
    transparent 2px 5px,
    #f4f7fa 5px 7px,
    transparent 7px 9px,
    #f4f7fa 9px 10px,
    transparent 10px 14px
  );
  opacity: 0.85;
}

.ticket-coupon {
  padding: 1.7rem 1.8rem 1.5rem;
}

.coupon-head h1 {
  font-family: "Teko", sans-serif;
  font-size: 2.35rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0 0 0.2rem;
  text-transform: uppercase;
}

.coupon-head p {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.alert {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.8rem 0.9rem;
  margin-bottom: 1.1rem;
  border-left: 4px solid var(--stamp);
  background: #fdecea;
  color: #6d1b14;
  border-radius: 2px;
}

.alert strong {
  display: block;
  font-size: 0.92rem;
}

.alert span {
  display: block;
  font-size: 0.88rem;
  margin-top: 0.15rem;
}

.field {
  margin-bottom: 0.95rem;
}

.field label {
  display: block;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--line);
  background: transparent;
  padding: 0.55rem 0.1rem;
  font: 1.05rem/1.3 "Source Sans 3", sans-serif;
  color: var(--ink);
  border-radius: 0;
}

.field input:focus {
  outline: none;
  border-bottom-color: var(--brass);
}

.field input:focus-visible {
  box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.28);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.35rem;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: "Source Sans 3", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.85rem 0.9rem;
  border-radius: 2px;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 2px;
}

.btn-admin {
  background: var(--stamp);
  color: #fff;
}

.btn-consulta {
  background: var(--cabin);
  color: var(--paper);
}

.btn[disabled] {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.fine-print {
  margin: 1.1rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.login-swal {
  font-family: "Source Sans 3", sans-serif !important;
  border-radius: 4px !important;
  background: var(--paper) !important;
  border-top: 4px solid var(--stamp) !important;
}

.login-swal .swal2-title {
  font-family: "Teko", sans-serif;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

@media (max-width: 740px) {
  .ticket {
    grid-template-columns: 1fr;
  }

  .ticket-stub {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem 1.2rem;
    padding-right: 1.15rem;
  }

  .ticket-stub::after {
    top: auto;
    right: 16px;
    left: 16px;
    bottom: -9px;
    width: auto;
    height: 18px;
    background: radial-gradient(circle at 9px 9px, var(--asphalt) 7px, transparent 8px);
    background-size: 22px 18px;
    background-repeat: repeat-x;
  }

  .stub-dest {
    font-size: 2.4rem;
  }

  .barcode {
    width: 120px;
    height: 36px;
    margin-left: auto;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .ticket-coupon {
    padding: 1.4rem 1.2rem 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticket,
  .btn {
    animation: none;
    transition: none;
  }
}

@keyframes ticket-in {
  from {
    opacity: 0;
    transform: translateY(16px) rotate(-0.4deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
