:root {
  --bg-deep: #030508;
  --bg-mid: #07151d;
  --bg-teal: #0a2e2b;
  --text-main: #ecf7fb;
  --text-soft: #a7bcc4;
  --card-bg: rgba(8, 15, 24, 0.78);
  --card-border: rgba(68, 155, 171, 0.32);
  --line-soft: rgba(113, 149, 165, 0.35);
  --field-bg: rgba(3, 10, 15, 0.8);
  --field-border: rgba(123, 166, 183, 0.44);
  --field-focus: #3ed8d0;
  --field-error: #ff6b81;
  --accent-blue: #39a7ff;
  --accent-teal: #35dbc4;
  --accent-lime: #9cf067;
  --shadow-soft: 0 10px 35px rgba(0, 0, 0, 0.38);
}

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

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

body {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(
      1200px 700px at 12% -12%,
      rgba(57, 167, 255, 0.18),
      transparent 58%
    ),
    radial-gradient(
      900px 560px at 86% -10%,
      rgba(53, 219, 196, 0.2),
      transparent 62%
    ),
    linear-gradient(
      135deg,
      var(--bg-deep) 0%,
      var(--bg-mid) 52%,
      var(--bg-teal) 100%
    );
  position: relative;
  overflow-x: hidden;
}

a {
  color: inherit;
}

.bg-orbit,
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

.bg-orbit {
  background:
    radial-gradient(
      420px 420px at 16% 30%,
      rgba(57, 167, 255, 0.12),
      transparent 66%
    ),
    radial-gradient(
      460px 460px at 82% 70%,
      rgba(53, 219, 196, 0.12),
      transparent 66%
    );
  filter: blur(1px);
  z-index: -1;
}

.bg-grid {
  background-image:
    linear-gradient(rgba(123, 166, 183, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(123, 166, 183, 0.06) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 92%);
}

.site-header {
  width: min(940px, calc(100% - 2rem));
  margin: 1rem auto 0;
  padding: 1rem;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: linear-gradient(
    155deg,
    rgba(7, 18, 28, 0.84),
    rgba(6, 22, 26, 0.66)
  );
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-mark {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 8px;
  border: 1px solid rgba(156, 240, 103, 0.5);
  background:
    linear-gradient(135deg, rgba(57, 167, 255, 0.35), rgba(53, 219, 196, 0.3)),
    rgba(5, 14, 20, 0.9);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #f6fffd;
  letter-spacing: 0.04em;
}

.brand-text h1 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}

.brand-text p {
  margin: 0.2rem 0 0;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(156, 240, 103, 0.35);
  background: rgba(7, 22, 18, 0.72);
  color: #d8fce5;
  font-size: 0.8rem;
  font-weight: 600;
}

.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #67ec7e;
  box-shadow: 0 0 0 6px rgba(103, 236, 126, 0.17);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(103, 236, 126, 0.25);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(103, 236, 126, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(103, 236, 126, 0);
  }
}

.layout {
  width: min(940px, calc(100% - 2rem));
  margin: 1rem auto 2.2rem;
}

.layout-spaced {
  display: grid;
  gap: 1rem;
}

.card {
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--card-bg);
  backdrop-filter: blur(9px);
  box-shadow: var(--shadow-soft);
  padding: 1rem;
}

.card-head h2 {
  margin: 0 0 0.3rem;
  font-size: 1.2rem;
  color: #f2fbff;
}

.card-head p {
  margin: 0;
  color: var(--text-soft);
}

.emphasis {
  margin: 0.9rem 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(156, 240, 103, 0.3);
  border-left: 4px solid var(--accent-lime);
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    rgba(156, 240, 103, 0.07),
    rgba(57, 167, 255, 0.06)
  );
  color: #def3ec;
  font-size: 0.9rem;
  line-height: 1.45;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: #dbe8ef;
  font-size: 0.9rem;
  font-weight: 600;
}

.form input,
.form select {
  width: 100%;
  min-height: 46px;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--text-main);
  box-sizing: border-box;
}

.form input::placeholder {
  color: rgba(211, 229, 236, 0.55);
}

.form input[type="date"] {
  padding-right: 2.4rem;
  color-scheme: dark;
}

.form input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 1;
  cursor: pointer;
  filter: invert(84%) sepia(13%) saturate(469%) hue-rotate(161deg) brightness(103%) contrast(95%);
}

.form select option {
  background: #081118;
  color: var(--text-main);
}

.form input:focus,
.form select:focus {
  outline: none;
  border-color: var(--field-focus);
  box-shadow: 0 0 0 3px rgba(62, 216, 208, 0.2);
}

.form input[aria-invalid="true"] {
  border-color: var(--field-error);
  box-shadow: 0 0 0 3px rgba(255, 107, 129, 0.22);
}

#document-expiry-error {
  margin-top: -0.2rem;
}

.card-actions {
  margin-top: 0.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 10px;
  padding: 0.72rem 1rem;
  border: 1px solid rgba(99, 159, 176, 0.38);
  background: rgba(5, 15, 21, 0.78);
  color: #e8f4f8;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(156, 240, 103, 0.55);
  background: rgba(10, 25, 32, 0.92);
}

.btn.primary {
  border-color: rgba(53, 219, 196, 0.55);
  background: linear-gradient(
    135deg,
    rgba(57, 167, 255, 0.28),
    rgba(53, 219, 196, 0.3)
  );
}

.btn.primary:hover {
  border-color: rgba(156, 240, 103, 0.6);
  background: linear-gradient(
    135deg,
    rgba(57, 167, 255, 0.35),
    rgba(53, 219, 196, 0.38)
  );
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.notice {
  margin-top: 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(115, 174, 191, 0.36);
  background: rgba(6, 16, 24, 0.75);
  color: #d8ebf4;
  padding: 0.68rem 0.82rem;
  font-size: 0.88rem;
}

.notice.error {
  border-color: rgba(255, 107, 129, 0.56);
  background: rgba(42, 11, 19, 0.75);
  color: #ffd7de;
}

.notice.warning {
  border-color: rgba(255, 203, 104, 0.55);
  background: rgba(39, 27, 5, 0.75);
  color: #ffe4b0;
}

.notice.success {
  border-color: rgba(88, 236, 156, 0.5);
  background: rgba(6, 30, 20, 0.75);
  color: #d5f9e2;
}

.step-copy {
  margin-bottom: 0.8rem;
}

.step-copy p {
  margin: 0.35rem 0;
  color: var(--text-soft);
}

.qr-box {
  border: 1px solid rgba(124, 168, 186, 0.34);
  border-radius: 12px;
  background: rgba(4, 14, 20, 0.62);
  padding: 0.85rem;
}

.qr-stack {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

#qr-img {
  width: min(220px, 100%);
  border-radius: 10px;
  border: 1px solid rgba(126, 170, 187, 0.38);
  background: #fff;
}

.qr-link {
  margin-bottom: 0.55rem;
}

.overlay,
.freeze-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(2, 5, 8, 0.72);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 50;
}

.overlay.active,
.freeze-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.overlay-card,
.freeze-card {
  width: min(92vw, 360px);
  border-radius: 14px;
  border: 1px solid rgba(113, 167, 186, 0.38);
  background: rgba(8, 16, 24, 0.93);
  box-shadow: var(--shadow-soft);
  padding: 1rem;
  text-align: center;
  color: #def0f8;
}

.overlay-text,
.freeze-text {
  margin-top: 0.6rem;
  color: #dceef7;
  line-height: 1.35;
}

.spinner {
  width: 30px;
  height: 30px;
  margin: 0 auto;
  border-radius: 999px;
  border: 3px solid rgba(85, 140, 160, 0.28);
  border-top-color: var(--accent-teal);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 820px) {
  .site-header {
    margin-top: 1.3rem;
    padding: 1rem 1.2rem;
  }

  .layout-spaced {
    gap: 1.2rem;
  }

  .card {
    padding: 1.15rem 1.2rem;
  }

  .qr-stack {
    flex-direction: row;
    align-items: center;
  }
}
