:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: rgba(15, 30, 50, 0.82);
  --panel-strong: #101f34;
  --line: rgba(163, 190, 219, 0.16);
  --muted: #8ea5bf;
  --text: #f5f9ff;
  --accent: #ff9f43;
  --accent-2: #ffbe78;
  --success: #55d6a3;
  --danger: #ff6d78;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 78% 9%, rgba(35, 101, 141, 0.25), transparent 34rem),
    radial-gradient(circle at 8% 80%, rgba(255, 159, 67, 0.09), transparent 30rem),
    var(--bg);
  font: 15px/1.55 Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.nav {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 760; letter-spacing: .02em; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #07111f;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 22px rgba(255, 159, 67, .22);
}
.nav-link { color: var(--muted); font-size: 14px; transition: color .2s; }
.nav-link:hover { color: var(--text); }
.hero { padding: 64px 0 38px; text-align: center; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .12em;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; }
h1 { margin: 15px 0 10px; font-size: clamp(34px, 5vw, 56px); line-height: 1.08; letter-spacing: -.04em; }
.hero p { margin: 0 auto; max-width: 570px; color: var(--muted); font-size: 16px; }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(290px, .88fr);
  gap: 18px;
  padding-bottom: 70px;
}
.card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.card-main { padding: 26px; }
.card-side { padding: 26px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head h2 { margin: 0; font-size: 19px; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.step {
  flex: 0 0 auto;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #b7c7d9; font-size: 13px; font-weight: 600; }
.control {
  width: 100%;
  height: 48px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: rgba(5, 15, 27, .72);
  padding: 0 14px;
  transition: border .2s, box-shadow .2s;
}
.control:focus { border-color: rgba(255, 159, 67, .8); box-shadow: 0 0 0 4px rgba(255, 159, 67, .1); }
.control::placeholder { color: #60758e; }
.primary, .secondary, .danger {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  font-weight: 740;
  transition: transform .15s, opacity .15s, background .15s;
}
.primary {
  color: #13110d;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 10px 25px rgba(255, 159, 67, .16);
}
.primary:hover, .secondary:hover, .danger:hover { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: .55; transform: none !important; }
.secondary { color: var(--text); border: 1px solid var(--line); background: rgba(255,255,255,.045); }
.danger { color: #ffd9dc; border: 1px solid rgba(255,109,120,.26); background: rgba(255,109,120,.1); }
.submit { margin-top: 18px; width: 100%; }
.notice { min-height: 23px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.notice.error { color: #ff9ca4; }
.notice.success { color: var(--success); }
.empty-state { min-height: 260px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.signal {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.035);
  color: var(--accent-2);
  font-size: 24px;
}
.result[hidden], .empty-state[hidden], .modal[hidden] { display: none; }
.status-line { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(255,159,67,.09); }
.dot.received { background: var(--success); box-shadow: 0 0 0 5px rgba(85,214,163,.09); }
.phone { margin: 18px 0 4px; font-size: clamp(26px, 4vw, 38px); font-weight: 780; letter-spacing: .015em; }
.meta { color: var(--muted); font-size: 13px; }
.code-box {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(5, 15, 27, .62);
  padding: 18px;
}
.code-box small { color: var(--muted); }
.code { margin-top: 6px; min-height: 42px; color: var(--accent-2); font-size: 29px; font-weight: 800; letter-spacing: .08em; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.actions button { min-height: 42px; }
.replace-button { width: 100%; min-height: 42px; margin-top: 10px; }
.footnote { padding: 0 0 30px; color: #647b95; text-align: center; font-size: 12px; }

.admin-layout { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 18px; padding: 38px 0 70px; }
.admin-card { padding: 24px; }
.admin-card h1, .admin-card h2 { margin: 0 0 5px; font-size: 21px; letter-spacing: -.02em; }
.admin-card > p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.stack { display: grid; gap: 14px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.toolbar h2 { margin: 0; font-size: 18px; }
.toolbar span { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.badge { display: inline-flex; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 700; }
.badge.on { color: #8be7bf; background: rgba(85,214,163,.11); }
.badge.off { color: #ff9ca4; background: rgba(255,109,120,.11); }
.text-button { color: var(--accent-2); border: 0; background: none; padding: 0; }
.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(2, 8, 15, .76); }
.modal-panel { width: min(580px, 100%); max-height: 80vh; overflow: auto; padding: 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.modal-head h2 { margin: 0; font-size: 19px; }
.icon-button { color: var(--muted); border: 0; background: none; font-size: 22px; }
.codes { margin: 18px 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #07111f; color: #dbe8f6; white-space: pre-wrap; word-break: break-all; font: 13px/1.8 ui-monospace, SFMono-Regular, Consolas, monospace; }

@media (max-width: 820px) {
  .hero { padding-top: 38px; }
  .workspace, .admin-layout { grid-template-columns: 1fr; }
  .admin-layout { padding-top: 24px; }
}
@media (max-width: 520px) {
  .shell { width: min(100% - 22px, 1120px); }
  .nav { height: 64px; }
  .hero { padding: 32px 0 28px; text-align: left; }
  .hero p { font-size: 14px; }
  .card-main, .card-side, .admin-card { padding: 19px; border-radius: 17px; }
  .form-grid, .actions { grid-template-columns: 1fr; }
}
