:root {
  color-scheme: dark;
  --bg: #071013;
  --bg-2: #0a1519;
  --surface: #111b20;
  --surface-strong: #172329;
  --line: rgba(206, 232, 235, 0.15);
  --line-strong: rgba(102, 224, 211, 0.42);
  --text: #f4fbfb;
  --muted: #a8b7ba;
  --subtle: #78888c;
  --teal: #54d6c9;
  --teal-deep: #1f9189;
  --amber: #e5a63a;
  --amber-deep: #9a641b;
  --danger: #ff837d;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.36);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    linear-gradient(120deg, rgba(84, 214, 201, 0.05), transparent 28%),
    repeating-linear-gradient(90deg, rgba(84, 214, 201, 0.04) 0 1px, transparent 1px 74px),
    #03080a;
  color: var(--text);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.miniapp {
  width: min(100%, 430px);
  min-height: 100svh;
  margin: 0 auto;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(84, 214, 201, 0.08), transparent 180px),
    var(--bg);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow);
  position: relative;
}

.topbar {
  min-height: 74px;
  padding: max(14px, env(safe-area-inset-top)) 18px 14px;
  display: grid;
  grid-template-columns: 78px 1fr 38px;
  align-items: end;
  gap: 10px;
  background: rgba(5, 12, 15, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__title {
  text-align: center;
  line-height: 1.1;
}

.topbar__title strong {
  display: block;
  font-size: 14px;
  font-weight: 760;
}

.topbar__title span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.ghost-link,
.back-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1;
}

.ghost-link--center {
  color: var(--muted);
  line-height: 1.2;
  justify-self: center;
}

.menu-dot {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.menu-dot span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
}

.view {
  display: none;
  padding: 24px 18px calc(28px + env(safe-area-inset-bottom));
  animation: view-in 220ms ease-out both;
}

.view--active {
  display: block;
}

.hero {
  min-height: 220px;
  border-bottom: 1px solid rgba(84, 214, 201, 0.16);
  margin: -24px -18px 24px;
  padding: 34px 22px 18px;
  position: relative;
  overflow: hidden;
}

.hero::after,
.success-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 56%;
  background: linear-gradient(180deg, transparent, var(--bg));
  pointer-events: none;
}

.hero__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 54%;
  opacity: 0.82;
}

.brand-lockup {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--teal);
  text-transform: uppercase;
  margin-top: 30px;
}

.brand-lockup strong {
  display: block;
  font-size: 14px;
  letter-spacing: 0.08em;
}

.brand-lockup small {
  display: block;
  margin-top: 3px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.brand-mark,
.icon-box,
.notice__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  color: var(--teal);
  border: 1px solid rgba(84, 214, 201, 0.64);
  border-radius: var(--radius);
  background: rgba(84, 214, 201, 0.08);
}

.brand-mark svg {
  width: 30px;
  height: 30px;
}

.intro h1,
.screen-heading h2,
.success-copy h2 {
  margin: 0;
  color: var(--text);
  font-weight: 820;
  line-height: 1.08;
}

.intro h1 {
  max-width: 380px;
  font-size: 32px;
}

.intro p,
.screen-heading p,
.success-copy p {
  margin: 14px 0 0;
  color: #c5d0d2;
  font-size: 17px;
  line-height: 1.45;
}

.benefits {
  display: grid;
  gap: 14px;
  margin: 28px 0 24px;
}

.benefit {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 14px;
}

.icon-box {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  border: 1px solid rgba(84, 214, 201, 0.34);
  background: rgba(84, 214, 201, 0.1);
  color: var(--teal);
}

.icon-box svg {
  width: 28px;
  height: 28px;
}

.benefit strong,
.notice strong {
  display: block;
  font-size: 15px;
  line-height: 1.25;
}

.benefit small,
.notice small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.action-stack {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.button {
  width: 100%;
  min-height: 58px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text);
  font-size: 18px;
  font-weight: 780;
  line-height: 1.1;
  transition: transform 160ms ease, border-color 160ms ease, filter 160ms ease;
}

.button svg {
  width: 25px;
  height: 25px;
}

.button:active {
  transform: translateY(1px);
}

.button--primary {
  background: linear-gradient(180deg, rgba(84, 214, 201, 0.92), rgba(38, 153, 143, 0.92));
  border-color: rgba(119, 241, 230, 0.35);
  box-shadow: 0 14px 34px rgba(39, 192, 179, 0.18);
}

.button--submit {
  margin-top: 4px;
  background: linear-gradient(180deg, #d39331, var(--amber-deep));
  border-color: rgba(255, 199, 91, 0.4);
  box-shadow: 0 14px 34px rgba(207, 132, 35, 0.2);
}

.button--outline {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(84, 214, 201, 0.28);
  color: var(--teal);
}

.button[disabled] {
  cursor: wait;
  filter: grayscale(0.2) brightness(0.82);
}

.microcopy,
.privacy {
  margin: 0;
  color: var(--subtle);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

.privacy {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.privacy svg {
  width: 15px;
  height: 15px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 26px;
  color: #d7e1e2;
}

.back-link svg {
  width: 20px;
  height: 20px;
}

.screen-heading h2,
.success-copy h2 {
  font-size: 30px;
}

.screen-heading p,
.success-copy p {
  font-size: 16px;
}

.application-form {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}

.field {
  display: grid;
  gap: 9px;
}

.field span {
  color: #eef7f7;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
}

.field b {
  color: var(--teal);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(198, 221, 224, 0.18);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  color: var(--text);
  padding: 0 15px;
  outline: 0;
  font-size: 16px;
  line-height: 1.25;
}

.field textarea {
  min-height: 104px;
  padding-top: 14px;
  resize: vertical;
}

.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #d8e5e7 50%),
    linear-gradient(135deg, #d8e5e7 50%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  background-position:
    calc(100% - 22px) 50%,
    calc(100% - 16px) 50%,
    0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
  padding-right: 46px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(84, 214, 201, 0.72);
  box-shadow: 0 0 0 3px rgba(84, 214, 201, 0.1);
}

.field small {
  color: var(--subtle);
  font-size: 12px;
  line-height: 1.3;
}

.field--invalid input,
.field--invalid select,
.field--invalid textarea {
  border-color: rgba(255, 131, 125, 0.82);
  box-shadow: 0 0 0 3px rgba(255, 131, 125, 0.08);
}

.form-error {
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.success-hero {
  min-height: 250px;
  margin: -24px -18px 28px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 0 11%, rgba(84, 214, 201, 0.14) 11% 11.4%, transparent 11.4% 27%, rgba(84, 214, 201, 0.11) 27% 27.4%, transparent 27.4% 100%),
    linear-gradient(180deg, #0a1518, #081013);
}

.success-mark {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  border: 2px solid rgba(84, 214, 201, 0.88);
  background: rgba(84, 214, 201, 0.12);
  color: var(--teal);
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 14px rgba(84, 214, 201, 0.05);
}

.success-mark svg {
  width: 68px;
  height: 68px;
  stroke-width: 1.7;
}

.success-copy {
  text-align: center;
  max-width: 340px;
  margin: 0 auto;
}

.notice-list {
  display: grid;
  gap: 16px;
  margin: 30px 0 26px;
}

.notice {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.notice--amber {
  border-color: rgba(229, 166, 58, 0.38);
  background: rgba(229, 166, 58, 0.06);
}

.notice--teal {
  border-color: rgba(84, 214, 201, 0.35);
  background: rgba(84, 214, 201, 0.055);
}

.notice__icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

.notice--amber .notice__icon {
  color: var(--amber);
}

.notice--teal .notice__icon {
  color: var(--teal);
}

.notice__icon svg {
  width: 30px;
  height: 30px;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 360px) {
  .topbar {
    grid-template-columns: 66px 1fr 34px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .view {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero,
  .success-hero {
    margin-left: -14px;
    margin-right: -14px;
  }

  .intro h1,
  .screen-heading h2,
  .success-copy h2 {
    font-size: 27px;
  }

  .button {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* Keep native select dropdown options readable in Telegram/Chrome webviews. */
.field select option,
.field select optgroup {
  background-color: #f4fbfb;
  color: #071013;
}

.field select option:checked {
  background-color: #b9ece7;
  color: #071013;
}

.field input[readonly] {
  color: #d8f4f1;
  border-color: rgba(84, 214, 201, 0.38);
  background: linear-gradient(180deg, rgba(84, 214, 201, 0.12), rgba(255, 255, 255, 0.025));
}

.admin-view {
  padding-top: 24px;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 14px;
  margin: 22px 0 16px;
}

.admin-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(198, 221, 224, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.admin-tab {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.admin-tab span {
  display: inline-flex;
  min-width: 22px;
  justify-content: center;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 12px;
}

.admin-tab.is-active {
  border-color: rgba(84, 214, 201, 0.28);
  background: rgba(84, 214, 201, 0.12);
  color: var(--teal);
}

.admin-toolbar .button {
  min-height: 44px;
  font-size: 15px;
}

.admin-count,
.admin-state {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.admin-state {
  margin: 12px 0;
}

.admin-layout {
  display: grid;
  gap: 16px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(198, 221, 224, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.028);
}

.admin-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  color: var(--text);
}

.admin-table th,
.admin-table td {
  padding: 12px 13px;
  border-bottom: 1px solid rgba(198, 221, 224, 0.1);
  text-align: left;
  font-size: 13px;
  line-height: 1.3;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-weight: 720;
  background: rgba(255, 255, 255, 0.04);
}

.admin-table tr {
  cursor: pointer;
}

.admin-table tr:hover,
.admin-table tr.is-selected {
  background: rgba(84, 214, 201, 0.08);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(84, 214, 201, 0.24);
  color: var(--teal);
  background: rgba(84, 214, 201, 0.08);
  font-size: 12px;
  font-weight: 720;
}

.status-pill--accepted {
  color: #96f0aa;
  border-color: rgba(150, 240, 170, 0.34);
  background: rgba(150, 240, 170, 0.08);
}

.status-pill--rejected {
  color: #ffaaa4;
  border-color: rgba(255, 131, 125, 0.38);
  background: rgba(255, 131, 125, 0.08);
}

.admin-detail {
  padding: 18px;
  border: 1px solid rgba(198, 221, 224, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.admin-detail h3 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.2;
}

.admin-detail p,
.admin-detail li {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.admin-detail dl {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 9px 12px;
  margin: 16px 0;
}

.admin-detail dt {
  color: var(--subtle);
  font-size: 12px;
}

.admin-detail dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.admin-history-note {
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid rgba(198, 221, 224, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.admin-message {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.admin-message textarea {
  width: 100%;
  min-height: 92px;
  border: 1px solid rgba(198, 221, 224, 0.18);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  color: var(--text);
  padding: 12px;
  outline: 0;
  resize: vertical;
}

.admin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.admin-actions .button {
  min-height: 46px;
  font-size: 14px;
}

@media (min-width: 900px) {
  .miniapp {
    width: min(100%, 1100px);
  }

  .admin-layout {
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
    align-items: start;
  }

  .admin-toolbar {
    grid-template-columns: minmax(260px, 340px) minmax(120px, 160px) 1fr;
  }
}
