:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #162033;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #15803d;
  --success-bg: #ecfdf3;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --warn: #a16207;
  --warn-bg: #fffbeb;
  --shadow: 0 10px 30px rgba(15, 23, 42, .06);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: inherit; }
code, pre, .mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  width: min(1180px, calc(100% - 32px));
  height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -.02em;
}
.brand-mark, .auth-logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #0f172a);
  font-family: Georgia, serif;
  font-weight: 700;
}
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-link { color: var(--muted); text-decoration: none; font-weight: 650; padding: 8px 10px; }
.nav-link:hover { color: var(--text); }
.inline-form { display: inline; margin: 0; }

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}
.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: .85rem;
  border-top: 1px solid var(--line);
}

h1, h2, h3 { margin-top: 0; letter-spacing: -.025em; }
h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 8px; }
h2 { font-size: 1.2rem; margin-bottom: 6px; }
p { line-height: 1.6; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  text-transform: uppercase;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .12em;
}

.hero-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.hero-row.compact { align-items: center; }
.breadcrumb { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .85rem; margin-bottom: 10px; }
.breadcrumb a { text-decoration: none; color: var(--primary); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stats-grid-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat-label { display: block; color: var(--muted); font-size: .82rem; font-weight: 700; margin-bottom: 7px; }
.stat-value { font-size: 1.75rem; letter-spacing: -.03em; }
.status-text { font-size: 1.35rem; }
.text-ok { color: var(--success); }
.text-bad { color: var(--danger); }
.text-warn { color: var(--warn); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.panel + .panel { margin-top: 18px; }
.panel-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.panel-header h2 { margin-bottom: 0; }
.panel-warn { border-color: #fde68a; background: #fffdf5; }

.table-wrap { overflow-x: auto; margin: 0 -22px -22px; }
.site-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.site-table th, .site-table td { padding: 15px 22px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
.site-table th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; background: var(--surface-soft); }
.site-table tbody tr:hover { background: #fbfdff; }
.align-right { text-align: right !important; }
.domain-link { color: var(--primary); text-decoration: none; font-weight: 650; }
.domain-link:hover { text-decoration: underline; }
.domain-link.large { font-size: 1rem; }

.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: .83rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px currentColor; opacity: .75; }
.status-ok { color: var(--success); }
.status-bad { color: var(--danger); }
.status-warn { color: var(--warn); }

.tag { display: inline-flex; margin-left: 7px; padding: 3px 7px; border-radius: 999px; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.tag-warn { color: var(--warn); background: var(--warn-bg); }
.tag-ok { color: var(--success); background: var(--success-bg); }

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 15px;
  font: inherit;
  font-size: .9rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-dark); }
.button-success { color: #fff; background: var(--success); }
.button-danger { color: #fff; background: var(--danger); }
.button-ghost { color: var(--text); background: #fff; border-color: var(--line); }
.button-ghost:hover { background: var(--surface-soft); }
.button-small { padding: 7px 11px; font-size: .8rem; }
.button-block { width: 100%; }
.button-row { display: flex; align-items: center; gap: 10px; }
.button-row.wrap { flex-wrap: wrap; }

.two-column { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, .8fr); gap: 20px; align-items: start; }
.two-column.wide-main { grid-template-columns: minmax(0, 1.8fr) minmax(290px, .75fr); }
.stack > * + * { margin-top: 18px; }
.form-panel { padding: 26px; }
.info-panel { position: sticky; top: 90px; }

.form-stack { display: grid; gap: 15px; }
.form-stack label:not(.checkbox-row) { display: block; font-weight: 750; margin-bottom: 6px; font-size: .88rem; }
.form-stack input[type="text"],
.form-stack input[type="email"],
.form-stack input[type="password"],
.form-stack input:not([type]) {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
}
.form-stack input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.field-help { margin: 6px 0 0; color: var(--muted); font-size: .8rem; }
.field-error { color: var(--danger); font-size: .8rem; }
.checkbox-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.checkbox-row input { margin-top: 4px; width: 17px; height: 17px; }
.checkbox-row small { display: block; color: var(--muted); margin-top: 2px; }
.compact-form { gap: 11px; }

.alert { padding: 13px 16px; margin-bottom: 18px; border-radius: 10px; border: 1px solid; font-size: .9rem; white-space: pre-wrap; }
.alert-success { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.alert-error { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
.validation-summary { color: var(--danger); background: var(--danger-bg); border-radius: 9px; }
.validation-summary ul { margin: 0; padding: 10px 28px; }

.detail-list { margin: 0; }
.detail-list div { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.detail-list div:first-child { border-top: 0; }
.detail-list dt { color: var(--muted); font-size: .82rem; }
.detail-list dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }

.code-block {
  margin: 0;
  padding: 16px;
  border: 1px solid #1e293b;
  border-radius: 10px;
  background: #0f172a;
  color: #dbeafe;
  overflow: auto;
  white-space: pre-wrap;
  font-size: .82rem;
  line-height: 1.55;
}
.log-block { min-height: 420px; max-height: 70vh; white-space: pre; }

.check-list { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 10px; }
.check-list li::before { content: "✓"; color: var(--success); font-weight: 900; margin-right: 9px; }
.empty-state { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty-state.standalone { max-width: 640px; margin: 70px auto; }
.empty-state h1, .empty-state h3 { color: var(--text); }

.auth-wrap { min-height: calc(100vh - 190px); display: grid; place-items: center; padding: 40px 0; }
.auth-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: 0 20px 50px rgba(15, 23, 42, .08); }
.auth-logo { width: 48px; height: 48px; margin-bottom: 22px; font-size: 1.3rem; }
.auth-card h1 { font-size: 2rem; }

@media (max-width: 900px) {
  .stats-grid, .stats-grid-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column, .two-column.wide-main { grid-template-columns: 1fr; }
  .info-panel { position: static; }
}

@media (max-width: 640px) {
  .topbar-inner { width: min(100% - 22px, 1180px); height: auto; min-height: 64px; padding: 10px 0; }
  .brand span:last-child { display: none; }
  .nav-link { display: none; }
  .page-shell { width: min(100% - 22px, 1180px); padding-top: 24px; }
  .hero-row { align-items: flex-start; flex-direction: column; }
  .stats-grid, .stats-grid-four { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 15px; }
  .stat-value { font-size: 1.35rem; }
  .footer { width: min(100% - 22px, 1180px); flex-direction: column; }
}
