:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #687385;
  --line: #dce3ef;
  --primary: #1463ff;
  --primary-dark: #0f4fca;
  --success: #138a48;
  --danger: #c13b3b;
  --warning: #9a6a00;
  --shadow: 0 18px 50px rgba(27, 41, 70, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(20, 99, 255, 0.08), transparent 38%),
    linear-gradient(240deg, rgba(19, 138, 72, 0.08), transparent 42%),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.front-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.front-shell {
  width: min(520px, 100%);
}

.front-panel,
.login-box,
.editor-section,
.table-section {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(220, 227, 239, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.front-panel {
  padding: 44px;
  text-align: center;
}

.pulse-ring {
  width: 54px;
  height: 54px;
  margin: 0 auto 22px;
  border-radius: 999px;
  border: 4px solid rgba(20, 99, 255, 0.18);
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

.front-panel h1,
.login-box h1,
.admin-header h1 {
  margin-bottom: 12px;
}

.front-panel p,
.login-box p {
  color: var(--muted);
}

.front-actions,
.form-actions,
.header-actions,
.row-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.front-actions {
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.fallbacks {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.fallbacks a {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbff;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.row-actions button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 700;
}

.primary-btn {
  color: #fff;
  background: var(--primary);
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.ghost-btn,
.icon-btn,
.row-actions button {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.ghost-link {
  line-height: 38px;
  font-weight: 700;
}

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

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-box {
  width: min(420px, 100%);
  padding: 32px;
}

label {
  display: grid;
  gap: 7px;
  color: #344053;
  font-weight: 700;
  font-size: 14px;
}

input {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

input:focus {
  outline: 2px solid rgba(20, 99, 255, 0.18);
  border-color: var(--primary);
}

.login-box .primary-btn {
  width: 100%;
  margin-top: 16px;
}

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

.admin-header h1 {
  font-size: 28px;
}

.editor-section,
.table-section {
  padding: 20px;
  margin-bottom: 18px;
}

.domain-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(240px, 1.8fr) repeat(4, minmax(110px, 0.7fr)) auto;
  gap: 14px;
  align-items: end;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.switch-label input {
  width: 18px;
  min-height: 18px;
}

.form-actions {
  grid-column: 1 / -1;
}

.form-error {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
}

.section-title span {
  color: var(--muted);
  font-weight: 700;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 4px;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
}

.status-pill.healthy {
  color: var(--success);
  background: rgba(19, 138, 72, 0.12);
}

.status-pill.down {
  color: var(--danger);
  background: rgba(193, 59, 59, 0.12);
}

.status-pill.unknown {
  color: var(--warning);
  background: rgba(154, 106, 0, 0.12);
}

.row-actions {
  flex-wrap: wrap;
}

.row-actions button {
  min-height: 32px;
  padding: 0 10px;
}

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

.empty-state {
  margin: 16px 0 0;
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .domain-form {
    grid-template-columns: 1fr 1fr;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .front-panel,
  .login-box,
  .editor-section,
  .table-section {
    padding: 20px;
  }

  .domain-form {
    grid-template-columns: 1fr;
  }

  .header-actions,
  .form-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .header-actions button,
  .form-actions button {
    flex: 1;
  }
}
