:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f4f7fb;
  --ink: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #d9e1ee;
  --accent: #4f66ff;
  --accent-soft: #eef2ff;
  --good: #21c977;
  --good-soft: #e8fbf1;
  --warn: #f59e0b;
  --warn-soft: #fff7e6;
  --bad: #ef4444;
  --bad-soft: #fff0f0;
  --shadow-border:
    0 0 0 1px rgba(15, 23, 42, 0.07),
    0 1px 2px -1px rgba(15, 23, 42, 0.08),
    0 2px 5px 0 rgba(15, 23, 42, 0.04);
  --shadow-hover:
    0 0 0 1px rgba(15, 23, 42, 0.1),
    0 2px 8px -2px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

body.auth-mode {
  background: #f7f9fc;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  background: var(--surface);
  box-shadow: inset -1px 0 0 rgba(15, 23, 42, 0.08);
  padding: 32px 18px;
}

.brand {
  color: var(--accent);
  font-size: 28px;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1;
  margin-bottom: 34px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  display: flex;
  align-items: center;
  padding: 0 14px;
  text-align: left;
  transition-property: background-color, color, scale;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.nav-item:hover,
.nav-item.active {
  background: var(--surface-muted);
  color: var(--accent);
}

.nav-item:active,
.button:active,
.icon-button:active,
.toggle:active {
  scale: 0.96;
}

.shell {
  min-height: 100vh;
  padding: 54px 48px 48px 308px;
}

body.auth-mode .sidebar {
  display: none;
}

body.auth-mode .shell {
  display: grid;
  place-items: center;
  padding: 0;
}

body.auth-mode .page {
  width: 100%;
}

.page {
  display: grid;
  gap: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.2;
  text-wrap: balance;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input,
.select {
  width: 220px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  outline: none;
  transition-property: border-color, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.input:focus,
.select:focus {
  border-color: rgba(79, 102, 255, 0.58);
  box-shadow: 0 0 0 3px rgba(79, 102, 255, 0.12);
}

.button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  font-weight: 650;
  box-shadow: 0 8px 18px -12px rgba(79, 102, 255, 0.8);
  transition-property: background-color, scale, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.button.secondary {
  background: var(--surface);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(79, 102, 255, 0.52);
}

.button:hover {
  background: #3f57f2;
}

.button.secondary:hover {
  background: var(--accent-soft);
}

.button[disabled] {
  cursor: default;
  opacity: 0.56;
}

.button.compact {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
  transition-property: background-color, color, scale;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.icon-button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.table-card,
.panel,
.metric-card,
.dns-card {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow-border);
}

.table-card {
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.table th,
.table td {
  height: 64px;
  padding: 0 20px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid rgba(217, 225, 238, 0.72);
}

.table th {
  height: 48px;
  color: #6074a6;
  font-size: 13px;
  font-weight: 520;
}

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

.table-row {
  transition-property: background-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.table-row:hover {
  background: #fbfcff;
}

.linkish {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 650;
  padding: 0;
  text-align: left;
}

.number {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.muted {
  color: var(--muted);
}

.cell-main {
  display: block;
  max-width: 100%;
}

.truncate {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nowrap {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  min-height: 28px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  font-weight: 650;
  color: #047857;
  background: var(--good-soft);
}

.status.warning {
  color: #9a5b00;
  background: var(--warn-soft);
}

.status.bad {
  color: #b91c1c;
  background: var(--bad-soft);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.toggle {
  width: 34px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  transition-property: background-color, scale;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.toggle::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: white;
  transition-property: transform;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.toggle.on {
  background: #65df96;
}

.toggle.on::before {
  transform: translateX(16px);
}

.tabs {
  display: flex;
  align-items: center;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  min-height: 48px;
}

.tab {
  min-height: 48px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #6074a6;
  padding: 0 16px;
  transition-property: color, border-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.tab.active {
  color: var(--accent);
  border-color: var(--accent);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 24px;
}

.metric-card {
  min-height: 94px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px;
}

.metric-icon {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.metric-icon.good {
  background: var(--good-soft);
  color: var(--good);
}

.metric-icon.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.metric-value {
  font-size: 24px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.metric-label {
  margin-top: 7px;
  color: var(--ink);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(348px, 100%);
  padding: 10px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.08),
    0 12px 34px -26px rgba(15, 23, 42, 0.55);
}

.auth-panel > div,
.auth-form label > span,
.auth-form .form-error {
  display: none;
}

.auth-panel.is-invalid {
  animation: auth-nudge 180ms ease-out;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-copy {
  max-width: 38ch;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
  text-wrap: pretty;
}

.auth-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}

.auth-form label {
  display: contents;
}

.auth-input {
  height: 44px;
  width: 100%;
  border-radius: 8px;
  padding: 0 14px;
}

.auth-panel.is-invalid .auth-input {
  border-color: rgba(239, 68, 68, 0.72);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.auth-submit,
.auth-form .button {
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  box-shadow: 0 8px 18px -12px rgba(79, 102, 255, 0.8);
  transition-property: background-color, scale, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
  padding: 0;
  font-size: 0;
}

.auth-submit::before,
.auth-form .button::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 10px;
  height: 10px;
  border-top: 2px solid white;
  border-right: 2px solid white;
  transform: translate(-60%, -50%) rotate(45deg);
}

.auth-submit:hover,
.auth-form .button:hover {
  background: #3f57f2;
}

.auth-submit:active,
.auth-form .button:active {
  scale: 0.96;
}

@keyframes auth-nudge {
  0%,
  100% {
    transform: translateX(0);
  }

  35% {
    transform: translateX(-4px);
  }

  70% {
    transform: translateX(4px);
  }
}

.panel {
  padding: 28px 26px;
}

.panel-title {
  margin: 0 0 20px;
  font-size: 16px;
  font-weight: 680;
}

.chart {
  min-height: 240px;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
}

.axis {
  display: grid;
  align-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding-bottom: 30px;
  text-align: right;
}

.bars {
  min-height: 220px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(28px, 1fr);
  align-items: end;
  gap: 14px;
  border-left: 1px solid rgba(15, 23, 42, 0.3);
  border-bottom: 1px solid rgba(15, 23, 42, 0.3);
  background:
    linear-gradient(to bottom, rgba(15, 23, 42, 0.12) 1px, transparent 1px) 0 0 / 100% 50%;
  padding: 0 22px 0 22px;
}

.bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 8px;
}

.bar {
  width: 26px;
  min-height: 2px;
  border-radius: 6px 6px 2px 2px;
  background: #74e68b;
}

.bar-label {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dns-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 22px;
}

.dns-card {
  min-height: 176px;
  padding: 28px 26px;
}

.dns-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  font-size: 18px;
  font-weight: 650;
}

.dns-records {
  color: #6074a6;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 18px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 0 16px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow-border);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 650;
}

.empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.22);
}

.modal {
  width: min(560px, 100%);
  border-radius: 8px;
  background: var(--surface);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.08),
    0 24px 80px -38px rgba(15, 23, 42, 0.55);
  padding: 22px;
}

.modal.wide {
  width: min(760px, 100%);
}

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

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  text-wrap: balance;
}

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

.form-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid .input {
  width: 100%;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
  resize: vertical;
  transition-property: border-color, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.textarea:focus {
  border-color: rgba(79, 102, 255, 0.58);
  box-shadow: 0 0 0 3px rgba(79, 102, 255, 0.12);
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.form-error {
  grid-column: 1 / -1;
  min-height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--bad-soft);
  color: #b91c1c;
  font-weight: 650;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

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

.suppression-item {
  min-height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 12px;
  background: var(--surface-muted);
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
    padding: 18px;
  }

  .brand {
    margin-bottom: 14px;
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
  }

  .shell {
    padding: 24px 18px 40px;
  }

  .topbar,
  .title-row,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .input,
  .select,
  .button {
    width: 100%;
  }

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

  .form-actions {
    flex-direction: column-reverse;
  }

  .suppression-item {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 10px 12px;
  }

  .metrics,
  .dns-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

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

  .table {
    min-width: 780px;
  }
}
