:root {
  --ink: #151b2d;
  --muted: #6c7487;
  --line: rgba(105, 123, 160, 0.22);
  --brand: #6258e8;
  --brand-deep: #4e43cc;
  --danger: #e34f63;
  --shadow: 0 28px 90px rgba(83, 97, 146, 0.2);
  --soft-shadow: 0 14px 30px rgba(86, 76, 204, 0.24);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(190, 182, 255, 0.5), transparent 30%),
    radial-gradient(circle at 76% 17%, rgba(116, 226, 238, 0.5), transparent 32%),
    radial-gradient(circle at 48% 88%, rgba(244, 172, 245, 0.38), transparent 28%),
    linear-gradient(135deg, #f7f9ff 0%, #eef6ff 48%, #e9fbff 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 20px;
}

.shell {
  width: min(980px, 100%);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.4fr 180px;
  gap: 28px;
  align-items: center;
  min-height: 286px;
  padding: 42px 44px 42px 48px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 18px;
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.86), rgba(246, 251, 255, 0.66));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: #6e66f2;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #6d63ff;
  box-shadow: 0 0 0 5px rgba(109, 99, 255, 0.1);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 50px);
  line-height: 1.16;
}

h2 {
  font-size: 20px;
}

.lede {
  max-width: 280px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.form-area {
  display: grid;
  gap: 14px;
}

.field-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 12px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cdk-input,
.admin-card input,
.admin-card select,
.admin-card textarea,
.small-input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0 14px;
  color: #343b4b;
  border: 1px solid rgba(130, 145, 180, 0.22);
  border-radius: 10px;
  outline: none;
  background: rgba(255, 255, 255, 0.86);
}

.admin-card textarea {
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
}

.cdk-input:focus,
.admin-card input:focus,
.admin-card select:focus,
.admin-card textarea:focus,
.small-input:focus {
  border-color: rgba(98, 88, 232, 0.58);
  box-shadow: 0 0 0 4px rgba(98, 88, 232, 0.12);
}

.primary-btn,
.secondary-btn,
.danger-btn,
.link-btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease;
  white-space: nowrap;
}

.primary-btn:disabled,
.secondary-btn:disabled,
.danger-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(180deg, #7770ff, var(--brand-deep));
  box-shadow: var(--soft-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.secondary-btn,
.link-btn {
  color: #5147d0;
  border: 1px solid rgba(125, 131, 168, 0.22);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(246, 248, 252, 0.88));
}

.danger-btn {
  color: #fff;
  background: linear-gradient(180deg, #ff7182, var(--danger));
}

.primary-btn:hover,
.secondary-btn:hover,
.danger-btn:hover,
.link-btn:hover,
.copy-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.status-line {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid rgba(130, 145, 180, 0.18);
  border-radius: 10px;
  color: #778197;
  background: rgba(255, 255, 255, 0.64);
  font-size: 14px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #aab4c5;
}

.status-line.good .status-dot {
  background: #12b58a;
}

.status-line.warn .status-dot {
  background: #f0a21b;
}

.status-line.bad .status-dot {
  background: #eb4f63;
}

.side-panel {
  min-height: 140px;
  display: grid;
  align-content: center;
  gap: 10px;
  padding-left: 26px;
  border-left: 1px solid rgba(120, 136, 170, 0.18);
}

.side-title,
.box-head,
.meta {
  color: #506079;
  font-size: 14px;
}

.side-value {
  font-size: 18px;
  font-weight: 900;
}

.side-meta,
.mini {
  color: #8390a5;
  font-size: 13px;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 22px;
}

.info-box,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(14px);
}

.info-box {
  min-height: 126px;
  padding: 24px;
}

.info-box.code {
  border-color: rgba(30, 179, 183, 0.34);
  background: rgba(248, 255, 254, 0.62);
}

.box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  font-weight: 800;
}

.tag {
  display: inline-flex;
  min-width: 54px;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  color: #006e69;
  background: rgba(43, 220, 202, 0.13);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
}

.value-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}

.phone-value,
.code-value {
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 900;
}

.code-value {
  color: #007a77;
  letter-spacing: 7px;
  white-space: nowrap;
}

.copy-btn {
  min-width: 52px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(137, 151, 177, 0.26);
  border-radius: 8px;
  color: #69758b;
  background: #eef3f9;
  font-size: 13px;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 10;
  padding: 12px 18px;
  border-radius: 999px;
  color: #fff;
  background: rgba(18, 27, 48, 0.86);
  box-shadow: 0 12px 28px rgba(18, 27, 48, 0.22);
  transform: translate(-50%, 120%);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.admin-page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 54px;
}

.admin-body {
  background: #f4f6fa;
}

.ops-page {
  width: min(1320px, calc(100% - 28px));
}

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

.top-actions,
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.compact-grid {
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.stat-card {
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.stat-card span,
.stat-card em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.stat-card strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.admin-card {
  padding: 22px;
}

.admin-card form,
.admin-card label,
.admin-fields,
.stack-card {
  display: grid;
  gap: 10px;
}

.stack-card {
  gap: 22px;
}

.admin-card label {
  color: #4d5a70;
  font-size: 13px;
  font-weight: 800;
}

.admin-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0;
}

.admin-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.table-wrap {
  overflow-x: auto;
}

.pager-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}

.alert-list,
.mini-list {
  display: grid;
  gap: 8px;
}

.alert-item,
.mini-row {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid rgba(105, 123, 160, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  color: #4d5a70;
  font-size: 13px;
}

.alert-item.warn {
  border-color: rgba(230, 165, 51, 0.38);
  background: rgba(255, 247, 229, 0.82);
}

.alert-item.danger {
  border-color: rgba(227, 79, 99, 0.36);
  background: rgba(255, 238, 241, 0.82);
}

.mini-row {
  grid-template-columns: 110px 64px minmax(0, 1fr);
  align-items: center;
}

.mini-row small {
  color: var(--muted);
  font-size: 12px;
}

.mini-btn {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  color: #5147d0;
  border: 1px solid rgba(125, 131, 168, 0.24);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.stats-line {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(247, 250, 255, 0.8);
}

.stats-line b {
  font-size: 30px;
}

#statsPanel h3 {
  margin: 18px 0 8px;
  color: #4d5a70;
  font-size: 15px;
}

td code {
  display: block;
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(105, 123, 160, 0.16);
  text-align: left;
}

th {
  color: #4d5a70;
  font-weight: 900;
}

@media (max-width: 880px) {
  .hero,
  .admin-grid,
  .compact-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-panel {
    padding-left: 0;
    padding-top: 18px;
    border-left: 0;
    border-top: 1px solid rgba(120, 136, 170, 0.18);
  }
}

@media (max-width: 640px) {
  .page {
    align-items: start;
    padding: 26px 14px;
  }

  .hero {
    padding: 28px 22px;
  }

  .input-row,
  .button-row,
  .cards,
  .admin-fields,
  .stat-grid,
  .mini-row {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .action-row {
    align-items: stretch;
  }

  .top-actions > *,
  .action-row > * {
    flex: 1 1 100%;
  }

  .code-value {
    letter-spacing: 5px;
  }
}
