:root {
  color-scheme: light;
  --bg: #edf3f8;
  --panel: #ffffff;
  --text: #0d1726;
  --muted: #5d6b82;
  --line: #d7e0eb;
  --accent: #18748a;
  --accent-strong: #115d70;
  --danger: #e7281c;
  --danger-soft: #fff2f0;
  --dark: #101922;
  --ok: #16845b;
  --warning: #a96300;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.announcement-banner {
  width: 100%;
  min-height: 46px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff7da;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-align: center;
}

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

input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

input[type="color"] {
  padding: 4px;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
}

button:hover {
  background: var(--accent-strong);
}

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

button.secondary {
  background: #eef4f8;
  color: var(--accent-strong);
}

button.secondary:hover {
  background: #dceaf1;
}

button.danger {
  background: #d9382b;
}

button.danger:hover {
  background: #bf2b21;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  min-height: 132px;
  padding: 12px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 116, 138, 0.12);
}

.page {
  width: min(100% - 22px, 552px);
  margin: 6px auto;
  padding: 26px 24px 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(26, 44, 64, 0.06);
}

.admin-page {
  width: min(100% - 24px, 1440px);
  margin: 16px auto 48px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #e63a23;
  font-size: 16px;
  font-weight: 800;
}

h1 {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.14;
}

h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.notice {
  margin: 8px 0 18px;
  border: 2px solid var(--danger);
  border-radius: 9px;
  background: var(--danger-soft);
  color: #e22418;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.6;
  padding: 14px 16px;
}

.field {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.field label {
  color: var(--muted);
  font-size: 14px;
}

.primary-wide {
  width: 100%;
  margin-top: 2px;
}

.kv-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  min-height: 50px;
  border-bottom: 1px solid var(--line);
  color: #486075;
}

.kv-row strong {
  color: #07121f;
  font-size: 18px;
  text-align: right;
}

.countdown-hint {
  margin-top: 8px;
  color: var(--danger);
  font-weight: 800;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-align: right;
}

.terminal {
  display: grid;
  gap: 14px;
  min-height: 116px;
  margin-top: 14px;
  border-radius: 4px;
  background: var(--dark);
  color: #d9e6ee;
  padding: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.panel {
  grid-column: span 6;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.panel.wide {
  grid-column: 1 / -1;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #f8fbfd;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.announcement-controls {
  align-items: end;
}

.announcement-actions {
  align-items: end;
  margin: 0;
}

.checkbox-field {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 46px;
  color: var(--muted);
  font-size: 14px;
}

.status-line {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.status-line.ok {
  color: var(--ok);
}

.status-line.error {
  color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.pagination-actions {
  display: flex;
  gap: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
}

.phones-table {
  min-width: 1280px;
}

.phones-table th:nth-child(3),
.phones-table th:nth-child(4),
.phones-table th:nth-child(5),
.phones-table td:nth-child(3),
.phones-table td:nth-child(4),
.phones-table td:nth-child(5) {
  white-space: nowrap;
}

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

th {
  background: #f3f7fa;
  color: #41576b;
  font-weight: 800;
}

td code {
  display: inline-block;
  max-width: 340px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #eaf4f7;
  color: var(--accent-strong);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge.danger {
  background: #fde9e6;
  color: #bd2c21;
}

.badge.warn {
  background: #fff1d6;
  color: var(--warning);
}

.copy-box {
  max-height: 160px;
  overflow: auto;
  border-radius: 6px;
  background: #0e1720;
  color: #dbe7ee;
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .page {
    padding: 24px;
  }

  .topbar,
  .form-row {
    grid-template-columns: 1fr;
    display: grid;
    align-items: stretch;
  }

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

  .panel,
  .panel.wide {
    grid-column: 1;
  }

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

  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }
}
