:root {
  --ink: #12160e;
  --panel: #1b2115;
  --panel-2: #242b1c;
  --line: #3d472c;
  --paper: #e8ebd4;
  --mute: #9aa384;
  --acid: #d7ff3d;
  --heat: #ff7a45;
  --ok: #6ef0a8;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(215, 255, 61, 0.08), transparent 50%),
    linear-gradient(180deg, #161b10 0%, var(--ink) 40%);
  color: var(--paper);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

body {
  padding: 20px 16px 48px;
}

a { color: inherit; }

.wrap {
  width: min(760px, 100%);
  margin: 0 auto;
}

.admin-wrap { width: min(980px, 100%); }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.mark {
  width: 42px;
  height: 42px;
  border: 2px solid var(--acid);
  display: grid;
  place-items: center;
  font-family: "Syne", sans-serif;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--acid);
  background: #10140c;
}

.brand strong {
  display: block;
  font-family: "Syne", sans-serif;
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand span {
  display: block;
  color: var(--mute);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn, button, input[type="submit"] {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--paper);
  padding: 12px 14px;
  font: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  min-height: 46px;
}

.btn:hover, button:hover, input[type="submit"]:hover {
  border-color: var(--acid);
}

.btn.primary, input[type="submit"].primary {
  background: var(--acid);
  color: #161a0d;
  border-color: var(--acid);
  font-weight: 700;
}

.btn.ghost { background: transparent; }
.btn.wide, form.stack > .btn, form.stack > button, form.stack > input[type="submit"] { width: 100%; }
.btn.danger { border-color: var(--heat); color: var(--heat); }
.btn.compact {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
  white-space: nowrap;
}
.table-wrap { overflow-x: auto; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0 0;
}

.cred {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.cred-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0;
}

.hero, .card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 22px;
  box-shadow: var(--shadow);
}

.kicker {
  color: var(--acid);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

h1, h2 {
  font-family: "Syne", sans-serif;
  margin: 0 0 10px;
  line-height: 1.15;
}

p { color: #c9cdb6; line-height: 1.5; }

.actions { display: grid; gap: 10px; margin-top: 22px; }

.grid {
  display: grid;
  gap: 10px;
}

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

.state {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  text-decoration: none;
}

.state b { font-weight: 600; }
.state em {
  font-style: normal;
  color: var(--acid);
  font-family: "IBM Plex Mono", monospace;
}

.state.zero { opacity: 0.45; pointer-events: none; }

.phone {
  font-family: "IBM Plex Mono", monospace;
  font-size: 18px;
}

.phone-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.phone-row .phone {
  margin: 0;
  font-size: 34px;
}

.copy-btn {
  min-width: 84px;
}

.pager {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}

.note, .err, .ok {
  padding: 12px 14px;
  border: 1px solid var(--line);
  margin: 0 0 16px;
}

.err { border-color: var(--heat); color: #ffd2c4; }
.ok { border-color: var(--ok); color: #c8ffe0; }

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.status {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}

.status b { color: var(--paper); }

.messages {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.msg {
  background: #12170f;
  border-left: 3px solid var(--acid);
  padding: 12px 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.msg small {
  color: var(--mute);
  font-family: "IBM Plex Mono", monospace;
}

.msg-text { white-space: pre-wrap; }

.otp-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  vertical-align: middle;
  margin: 0 4px;
}

.otp {
  color: var(--acid);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
}

.crumb {
  color: var(--mute);
  font-size: 13px;
  margin-bottom: 14px;
}

.crumb a { color: var(--acid); text-decoration: none; }

form.stack, .stack { display: grid; gap: 12px; }

label { font-size: 13px; color: var(--mute); }

input, textarea, select {
  width: 100%;
  background: #10140c;
  border: 1px solid var(--line);
  color: var(--paper);
  padding: 12px;
  font: inherit;
}

textarea { min-height: 160px; resize: vertical; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th, .table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.table th { color: var(--mute); font-weight: 500; }

.admin-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.btn.danger {
  border-color: var(--heat);
  color: #ffd2c4;
}

.stat {
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 14px;
}

.stat b {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 28px;
  color: var(--acid);
}

.tiny { color: var(--mute); font-size: 12px; overflow-wrap: anywhere; }

.badge {
  display: inline-block;
  border: 1px solid var(--line);
  color: var(--acid);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  vertical-align: middle;
}

.row-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.row-form select,
.row-form button {
  width: auto;
  min-height: 40px;
}

@media (max-width: 700px) {
  .grid.two, .stats { grid-template-columns: 1fr; }
  .dialog-head { flex-direction: column; }
  .top { align-items: flex-start; flex-direction: column; }
}

body.gate {
  padding: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 88% 0%, rgba(215, 255, 61, 0.18), transparent 58%),
    radial-gradient(700px 480px at 0% 100%, rgba(215, 255, 61, 0.07), transparent 52%),
    linear-gradient(168deg, #0b0f08 0%, #12160e 48%, #080b06 100%);
}

.gate-wrap {
  width: min(520px, 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 20px 40px;
  position: relative;
}

.gate-wrap::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(215, 255, 61, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(215, 255, 61, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 42%, #000 18%, transparent 72%);
}

.gate-wrap .top {
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.gate-panel {
  position: relative;
  z-index: 1;
  padding: 40px 28px 32px;
  border: 1px solid rgba(215, 255, 61, 0.3);
  background:
    linear-gradient(180deg, rgba(27, 33, 21, 0.94), rgba(12, 16, 10, 0.9));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 28px 70px rgba(0, 0, 0, 0.5),
    0 0 90px rgba(215, 255, 61, 0.08);
}

.gate-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--acid), transparent);
}

.gate-mark {
  width: 72px;
  height: 72px;
  margin: 0 0 22px;
  border: 2px solid var(--acid);
  display: grid;
  place-items: center;
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--acid);
  background: #10140c;
  box-shadow: 0 0 28px rgba(215, 255, 61, 0.16);
}

.gate-title {
  margin: 0;
  font-size: clamp(40px, 11vw, 62px);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 0.95;
}

.gate-actions {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.gate-actions .btn,
.gate-actions button {
  width: 100%;
  min-height: 54px;
  font-size: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}

.gate-actions label {
  text-align: left;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gate-panel .err,
.gate-panel .ok {
  margin-top: 18px;
  margin-bottom: 0;
}
