:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d8dee6;
  --primary: #22577a;
  --primary-strong: #17415d;
  --accent: #2f6f73;
  --danger: #a13d3d;
  --warning: #9a6b1f;
  --success: #26734d;
  --shadow: 0 10px 30px rgba(32, 41, 51, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  max-height: 100vh;
  padding: 20px 16px;
  background: #17212b;
  color: #eef4f8;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: #fff;
}
.brand small { display: block; color: #adbdc9; margin-top: 2px; }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: #f4d35e;
  color: #17212b;
  font-weight: 800;
  font-size: 0.82rem;
}
.brand-mark.large { width: 52px; height: 52px; font-size: 1rem; }
.sidebar nav {
  display: grid;
  gap: 4px;
}
.sidebar nav a {
  color: #d9e5ee;
  padding: 10px 12px;
  border-radius: 6px;
}
.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}
.sidebar nav a.active {
  background: rgba(244, 211, 94, 0.18);
  color: #fff;
}
.tenant-box {
  margin-top: auto;
  display: grid;
  gap: 12px;
}
.tenant-box label {
  color: #adbdc9;
  font-size: 0.78rem;
}
.tenant-box select {
  width: 100%;
  margin-top: 6px;
}
.global-search {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}
.global-search label {
  color: #adbdc9;
  font-size: 0.78rem;
}
.global-search input {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
}
.global-search input::placeholder { color: #adbdc9; }

.main {
  margin-left: 248px;
  padding: 28px;
  min-height: 100vh;
}
.auth-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.platform-main {
  min-height: 100vh;
  padding: 28px;
}
.support-banner {
  background: #fff4da;
  border: 1px solid #f0d28a;
  color: #6f4f10;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-weight: 800;
}
.login-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 48px;
  align-items: center;
}
.login-panel h1 { font-size: 3rem; margin: 16px 0 8px; }
.login-panel p { color: var(--muted); font-size: 1.05rem; line-height: 1.6; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
h1, h2 { margin: 0; line-height: 1.12; }
h1 { font-size: 2rem; }
h2 { font-size: 1.1rem; margin-bottom: 14px; }
.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0;
  font-weight: 700;
}
.subtle { color: var(--muted); margin: 8px 0 0; }

.actions, .form-actions, .inline-form, .filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.test-actions, .quick-actions, .row-actions, .auth-links {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
.button, button {
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}
.button:hover, button:hover { background: var(--primary-strong); text-decoration: none; }
.button.secondary, button.secondary {
  background: #e8edf2;
  color: var(--ink);
}
.danger { background: var(--danger); }
.link-button {
  background: transparent;
  padding: 0;
  color: #d9e5ee;
  min-height: 0;
}

input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  width: 100%;
  font: inherit;
}
textarea { resize: vertical; }
label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: #3a4652;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
legend { font-weight: 800; color: #3a4652; }

.form-stack, .stack { display: grid; gap: 14px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 980px;
}
.span-2 { grid-column: span 2; }
.two-field {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.checkbox, .checkbox input {
  display: inline-flex;
  align-items: center;
  width: auto;
  gap: 8px;
  font-weight: 600;
}
.checkbox-grid {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.recipient-panel[hidden] { display: none; }
.preview-panel {
  display: grid;
  gap: 8px;
}
.preview-panel small {
  color: var(--muted);
}
.dns-list {
  display: grid;
  gap: 6px;
}
.dns-list code {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
}

.filter-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.filter-bar input[type="search"] { min-width: 260px; flex: 1; }
.filter-bar select { width: auto; min-width: 140px; }
.save-view { margin: 10px 0 16px; }
.save-view summary { cursor: pointer; font-weight: 800; color: var(--primary); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
  color: var(--ink);
}
.metric strong { display: block; font-size: 2rem; }
.metric span { color: var(--muted); }
.metric-grid.mini {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.two-column, .profile-grid, .search-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
  gap: 20px;
}
.search-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.two-column.wide-left { grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.55fr); }
.profile-grid { margin-bottom: 20px; }
.panel, .list-panel, .table-wrap, .empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.panel { padding: 18px; }
.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.spaced { margin-top: 24px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-size: 0.82rem; }
td small { display: block; color: var(--muted); margin-top: 4px; }
tr:last-child td { border-bottom: 0; }

.row-link, .row-form {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  align-items: center;
}
.row-link:last-child, .row-form:last-child { border-bottom: 0; }
.row-link:hover { background: #f5f8fa; text-decoration: none; }
.row-link.static:hover { background: transparent; }
.row-link small, .row-form small { color: var(--muted); }
.row-form input, .row-form select { width: auto; min-width: 120px; }
.compact .row-link { padding: 9px 12px; }

.details {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 16px;
  margin: 0;
}
.details dt { color: var(--muted); font-weight: 700; }
.details dd { margin: 0; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.chip, .tag, .status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.82rem;
  font-weight: 800;
}
.chip { background: #e8edf2; color: var(--ink); }
.tag { background: color-mix(in srgb, var(--tag-color) 18%, white); color: var(--tag-color); }
.status { background: #e7f2ed; color: var(--success); margin-left: 8px; }
.status.warning { background: #fff4da; color: var(--warning); }

.timeline {
  display: grid;
  gap: 12px;
}
.timeline article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.timeline small {
  display: block;
  color: var(--muted);
  margin: 4px 0 10px;
}
.timeline-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}
.timeline-meta small { margin: 0; }
.event-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  background: #e8edf2;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 800;
}
.warning-panel {
  border-color: #f4d28c;
  margin-bottom: 20px;
}

.flash {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #e8edf2;
  color: var(--ink);
}
.flash.success { background: #e7f2ed; color: var(--success); }
.flash.warning { background: #fff4da; color: var(--warning); }
.flash.error { background: #fde8e8; color: var(--danger); }
.bulk-panel {
  display: grid;
  grid-template-columns: max-content 96px max-content;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.product-footer {
  margin-top: 36px;
  color: var(--muted);
  font-size: 0.82rem;
}
.error-page {
  max-width: 720px;
  margin: 60px auto;
}
code {
  background: #eef2f5;
  border-radius: 4px;
  padding: 2px 5px;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: 0;
    max-height: none;
    overflow-y: visible;
  }
  .sidebar nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .main { margin-left: 0; padding: 18px; }
  .metric-grid, .two-column, .profile-grid, .search-grid, .login-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-header, .actions, .filter-bar {
    display: grid;
    grid-template-columns: 1fr;
  }
  .row-form, .row-actions, .test-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .bulk-panel {
    grid-template-columns: 1fr;
  }
  .form-grid, .two-field {
    grid-template-columns: 1fr;
  }
  .span-2 { grid-column: auto; }
  .sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
