* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: "Jost", sans-serif;
  background: linear-gradient(180deg, #f6f8fc 0%, #edf2f9 100%);
  color: #0f172a;
}
.gate-page { min-height: 100vh; padding: 24px; }
.gate-shell {
  width: min(520px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.gate-head, .gate-card {
  background: #fff;
  border: 1px solid #dce5f0;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}
.gate-head {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.gate-head h1 { margin: 0; font-size: 24px; line-height: 1.1; }
.gate-state {
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  display: none;
}
.is-hidden { display: none !important; }
.gate-state.is-idle, .gate-result.is-idle { background: #e2e8f0; color: #334155; }
.gate-state.is-ok, .gate-result.is-ok { background: #dcfce7; color: #166534; }
.gate-state.is-error, .gate-result.is-error { background: #fee2e2; color: #b91c1c; }
.gate-state.is-loading { background: #dbeafe; color: #1d4ed8; }
.gate-card { padding: 20px; }
.gate-card__title { font-size: 18px; font-weight: 800; margin-bottom: 14px; }
.gate-grid { display: grid; gap: 14px; }
.gate-grid--triple { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gate-grid--double { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gate-field { display: flex; flex-direction: column; gap: 6px; }
.gate-field span { font-size: 13px; font-weight: 700; color: #475569; }
.gate-pin-dots {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
}
.gate-pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  transition: all .18s ease;
}
.gate-pin-dot.is-filled {
  background: #0f172a;
  border-color: #0f172a;
  transform: scale(1.03);
}
.gate-keypad {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.gate-key {
  height: 64px;
  border: 1px solid #dce5f0;
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}
.gate-key--muted {
  font-size: 16px;
  color: #475569;
  background: #f8fafc;
}
.gate-key--confirm {
  font-size: 28px;
  color: #ffffff;
  background: #16a34a;
  border-color: #15803d;
}
.gate-key:active {
  transform: scale(.98);
}
.gate-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.gate-btn {
  height: 44px;
  padding: 0 18px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  background: #0f172a;
  color: #fff;
}
.gate-btn--soft { background: #eef2ff; color: #1e3a8a; }
.gate-btn--primary { background: #f97316; color: #fff; }
.gate-btn--danger { background: #ef4444; color: #fff; }
.gate-btn--success { background: #16a34a; color: #fff; }
.gate-btn--danger-soft { background: #fee2e2; color: #b91c1c; }
.gate-btn--xl { height: 56px; font-size: 18px; width: 100%; }
.gate-note { margin-top: 10px; font-size: 13px; color: #64748b; }
.gate-note--center { text-align: center; }
.gate-pill {
  padding: 8px 12px;
  border-radius: 12px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
  width: 100%;
}
.gate-result {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
}
.gate-actions--stack {
  flex-direction: column;
}

.gate-outcome {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate-outcome.is-success {
  background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
}
.gate-outcome.is-error,
.gate-outcome.is-cancel {
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
}
.gate-outcome__card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 28px;
  padding: 28px 24px;
  text-align: center;
  color: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(8px);
}
.gate-outcome__icon {
  width: 88px;
  height: 88px;
  margin: 0 auto 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.gate-outcome__icon svg {
  width: 42px;
  height: 42px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gate-outcome__title {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
}
.gate-outcome__message {
  margin: 0 0 22px;
  font-size: 17px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
}
.gate-outcome__meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 14px;
  font-weight: 700;
}
.gate-outcome__actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}
.gate-outcome__btn {
  height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.gate-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.gate-loader__card {
  min-width: 220px;
  padding: 22px 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.gate-loader__spinner {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 4px solid #e2e8f0;
  border-top-color: #f97316;
  animation: gateSpin 0.75s linear infinite;
}
.gate-loader__text {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
}
@keyframes gateSpin {
  to { transform: rotate(360deg); }
}
@media (max-width: 760px) {
  .gate-page { padding: 14px; }
  .gate-head { flex-direction: column; }
  .gate-grid--triple, .gate-grid--double { grid-template-columns: 1fr; }
  .gate-head h1 { font-size: 24px; }
  .gate-key {
    height: 58px;
    font-size: 20px;
  }
  .gate-outcome {
    padding: 16px;
  }
  .gate-outcome__card {
    padding: 24px 18px;
    border-radius: 24px;
  }
  .gate-outcome__title {
    font-size: 26px;
  }
  .gate-outcome__message {
    font-size: 16px;
  }
  .gate-outcome__btn {
    width: 100%;
  }
}
