:root {
  color-scheme: dark;
  --bg: #090d12;
  --panel: #101721;
  --panel-2: #141d2a;
  --line: #243244;
  --text: #e8edf4;
  --muted: #8f9bae;
  --accent: #36d399;
  --accent-2: #6ea8fe;
  --danger: #ff6b6b;
  --warn: #f8c14a;
  --shadow: 0 24px 80px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 0%, rgba(54, 211, 153, .12), transparent 28%),
              linear-gradient(145deg, #090d12 0%, #0d1119 48%, #080b10 100%);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button, input, select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

input, select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c121a;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(110, 168, 254, .16);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: rgba(8, 12, 18, .92);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand, .topbar, .panel-head, .apply-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  justify-content: flex-start;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #06100d;
  background: linear-gradient(135deg, var(--accent), #9ef4c4);
  font-weight: 800;
}

.brand strong { display: block; font-size: 16px; }
.brand span, .panel p, .topbar p, .form-note { color: var(--muted); margin: 0; }

nav {
  display: grid;
  gap: 8px;
}

nav a, .ghost-button {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

nav a.active, nav a:hover, .ghost-button:hover {
  color: var(--text);
  background: #121a26;
}

.ghost-button { margin-top: auto; border: 1px solid var(--line); }

.workspace {
  padding: 28px;
  display: grid;
  gap: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent) !important;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(54, 211, 153, .32);
  border-radius: 999px;
  background: rgba(54, 211, 153, .08);
  color: #c9f6df;
}

.mode-pill span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.status-card, .panel {
  border: 1px solid var(--line);
  background: rgba(16, 23, 33, .86);
  box-shadow: var(--shadow);
}

.status-card {
  min-height: 112px;
  border-radius: 8px;
  padding: 16px;
  display: grid;
  align-content: space-between;
}

.status-card span {
  color: var(--muted);
  font-size: 12px;
}

.status-card strong {
  font-size: 20px;
  word-break: break-word;
}

.status-card.ok strong { color: var(--accent); }
.status-card.bad strong { color: var(--danger); }

.panel {
  border-radius: 8px;
  padding: 18px;
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.primary-button, .domain-form button, .diag-controls button, .password-form button, .login-form button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--accent);
  color: #06100d;
  font-weight: 800;
}

.secondary-button {
  background: #182333 !important;
  color: var(--text) !important;
  border: 1px solid var(--line);
}

.domain-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) 150px 160px minmax(160px, 1fr) 112px 110px;
  gap: 10px;
  margin: 16px 0;
}

.check-output {
  min-height: 0;
  margin: 0 0 14px;
}

.check-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #0c121a;
  display: grid;
  gap: 10px;
}

.check-card strong { display: block; }

.check-card small {
  color: var(--muted);
  display: block;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-pill {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: #101927;
  color: #c9d8ea;
  font-size: 12px;
}

.check-pill.good { color: #bdf8d9; border-color: rgba(54, 211, 153, .45); }
.check-pill.warn { color: #ffe3a3; border-color: rgba(248, 193, 74, .5); }
.check-pill.bad { color: #ffc7c7; border-color: rgba(255, 107, 107, .5); }

.table-tools {
  display: flex;
  gap: 10px;
}

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

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

th, td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

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

tr:last-child td { border-bottom: 0; }

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #1a2433;
  color: #bfd0e9;
  font-size: 12px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--text);
  background: #0d141d;
}

.icon-button.danger { color: var(--danger); }

.diagnostic-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr);
  gap: 22px;
}

.diag-controls {
  display: grid;
  grid-template-columns: 130px minmax(160px, 1fr) 120px 120px;
  gap: 10px;
  margin: 14px 0;
}

pre {
  min-height: 260px;
  max-height: 440px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #05080c;
  color: #d7e7f7;
  white-space: pre-wrap;
}

.event-list {
  display: grid;
  gap: 10px;
}

.event-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #0c121a;
}

.event-item small { color: var(--muted); display: block; margin-top: 4px; }

.security-panel {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(320px, 1.2fr);
  gap: 18px;
  align-items: center;
}

.password-form {
  display: grid;
  grid-template-columns: 1fr 1fr 110px;
  gap: 10px;
}

.login-page {
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(440px, calc(100vw - 32px));
}

.login-panel {
  padding: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(16, 23, 33, .94);
  box-shadow: var(--shadow);
}

.login-panel h1 { margin: 18px 0 6px; font-size: 30px; }
.login-panel p { color: var(--muted); margin: 0 0 22px; }

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

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.form-error { color: var(--danger); min-height: 20px; }
.form-note { margin-top: 10px; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow: auto; }
  .sidebar nav { display: flex; }
  .ghost-button { margin-left: auto; margin-top: 0; }
  .status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .domain-form, .diagnostic-grid, .security-panel, .password-form { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .workspace { padding: 16px; }
  .topbar, .panel-head, .apply-panel { align-items: flex-start; flex-direction: column; }
  .status-grid { grid-template-columns: 1fr; }
  .diag-controls { grid-template-columns: 1fr; }
}
