:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #8b9bb4;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --deferred: #a78bfa;
  --radius: 10px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100%;
}

body {
  background-image:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(59, 130, 246, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(34, 197, 94, 0.06), transparent);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top navigation */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15, 20, 25, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topnav-inner {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 0.65rem clamp(1rem, 2vw, 2.5rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}
.topnav .brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.topnav .brand:hover { color: var(--accent); text-decoration: none; }
.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  flex: 1;
}
.nav-links a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 550;
  font-size: 0.92rem;
  text-decoration: none;
}
.nav-links a:hover {
  color: var(--text);
  background: var(--surface2);
  text-decoration: none;
}
.nav-links a.active {
  color: #fff;
  background: rgba(59, 130, 246, 0.2);
}

/* Settings dropdown (admin) */
.nav-dropdown {
  position: relative;
}
.nav-drop-btn {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 550;
  font-size: 0.92rem;
  cursor: pointer;
}
.nav-drop-btn:hover,
.nav-drop-btn.active {
  color: var(--text);
  background: var(--surface2);
}
.nav-drop-btn.active {
  color: #fff;
  background: rgba(59, 130, 246, 0.2);
}
.nav-caret {
  font-size: 0.7rem;
  opacity: 0.8;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  min-width: 12.5rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  z-index: 60;
}
.nav-dropdown.open .nav-dropdown-menu {
  display: block;
}
.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 550;
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
}
.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active {
  color: var(--text);
  background: var(--surface2);
  text-decoration: none;
}

/* Settings page subnav */
.settings-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: -0.35rem 0 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.settings-subnav a {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 550;
  font-size: 0.9rem;
  text-decoration: none;
}
.settings-subnav a:hover {
  color: var(--text);
  background: var(--surface2);
  text-decoration: none;
}
.settings-subnav a.active {
  color: #fff;
  background: rgba(59, 130, 246, 0.2);
}
.nav-user {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: auto;
}
.nav-user-name { color: var(--text); font-weight: 550; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-provider {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.nav-logout {
  color: var(--muted);
  font-weight: 550;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-decoration: none;
}
.nav-logout:hover { color: var(--text); background: var(--surface2); text-decoration: none; }

/* System status traffic lights (between nav links and user) */
.nav-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  margin-left: auto;
}
.nav-status + .nav-user {
  margin-left: 0;
}
.status-light {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.5rem 0.2rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 550;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}
.status-label {
  line-height: 1.2;
}
.status-dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.25);
  flex: 0 0 auto;
}
.status-light[data-state="ok"] .status-dot {
  background: var(--ok);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.28);
}
.status-light[data-state="warn"] .status-dot {
  background: var(--warn);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
}
.status-light[data-state="bad"] .status-dot {
  background: var(--bad);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
}
.status-light[data-state="unknown"] .status-dot {
  background: #64748b;
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.25);
  animation: status-pulse 1.4s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (max-width: 900px) {
  .nav-status {
    order: 3;
    flex-basis: 100%;
    margin-left: 0;
  }
  .nav-user {
    margin-left: auto;
  }
}

.wrap {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 2vw, 2.5rem) 2rem;
  min-height: calc(100vh - 7rem);
}

.page-header {
  margin-bottom: 1.35rem;
}
.page-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.page-header .tagline,
.tagline {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

/* Homepage app cards */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
a.app-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
a.app-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}
.app-card .app-icon {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  line-height: 1;
}
.app-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}
.app-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 0.75rem clamp(1rem, 2vw, 2.5rem) 1.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}
.dev-badge {
  color: var(--warn);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

/* OIDC provider chooser (discover page) */
.provider-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}
.provider-actions a.btn {
  display: block;
  text-align: center;
  text-decoration: none;
}
.btn.microsoft { background: #2f2f2f; }
.btn.microsoft:hover { background: #1a1a1a; }
.btn.google { background: #fff; color: #1f2937; }
.btn.google:hover { background: #e5e7eb; }

header.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

header.app-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

header.app-header .tagline {
  color: var(--muted);
  font-size: 0.92rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.field .hint {
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.9;
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-family: var(--mono);
  font-size: 0.9rem;
}

input:focus,
select:focus {
  outline: 2px solid rgba(59, 130, 246, 0.45);
  border-color: var(--accent);
}

.field-check {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  padding-top: 1.4rem;
}

.field-span-2 {
  grid-column: 1 / -1;
  max-width: 42rem;
}

.subject-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}
.subject-search-row .subject-input {
  flex: 1 1 14rem;
  min-width: 0;
}
.subject-search-row .subject-mode {
  flex: 0 0 auto;
  width: auto;
  min-width: 9.5rem;
}

/* Restricted recipient: user@ + domain dropdown */
.addr-compose {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
}
.addr-compose .addr-local {
  flex: 1 1 40%;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.addr-compose .addr-at {
  display: flex;
  align-items: center;
  padding: 0 0.45rem;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 600;
  user-select: none;
}
.addr-compose .addr-domain {
  flex: 1 1 50%;
  min-width: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: none;
}
.addr-compose input.addr-domain[readonly] {
  opacity: 0.95;
  cursor: default;
}

.field-check input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.1rem;
  align-items: center;
}

button,
.btn {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: background 0.15s ease;
}

button:hover,
.btn:hover {
  background: var(--accent-hover);
}

button.secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

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

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  background: var(--surface2);
}

.alert.error {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
}

.alert.info {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.08);
}

.alert.ok {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.1);
  color: #bbf7d0;
}

/* Whitelist + row action buttons */
.col-actions {
  width: 2.75rem;
  text-align: center !important;
  white-space: nowrap;
}

.inline-form {
  display: inline;
  margin: 0;
  padding: 0;
}

.icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--border);
}
.icon-btn.danger:hover {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.15);
}

.wl-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 1.65rem;
  padding: 0 0.4rem;
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: 6px;
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  cursor: pointer;
  line-height: 1;
}
.wl-btn:hover {
  background: rgba(34, 197, 94, 0.32);
  color: #bbf7d0;
}
.wl-btn:disabled,
.wl-btn.wl-done {
  opacity: 0.85;
  cursor: default;
  background: rgba(34, 197, 94, 0.28);
}
.wl-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 1.65rem;
  color: #86efac;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  user-select: none;
}
.wl-btn-placeholder {
  color: var(--muted);
  opacity: 0.35;
  font-size: 0.85rem;
}

.col-release {
  width: 4.5rem;
}

.release-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.6rem;
  height: 1.65rem;
  padding: 0 0.45rem;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
}
.release-btn:hover {
  background: rgba(56, 189, 248, 0.3);
  color: #bae6fd;
}
.release-btn:disabled,
.release-btn.release-done {
  opacity: 0.9;
  cursor: default;
  background: rgba(56, 189, 248, 0.22);
}

.bl-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 1.65rem;
  padding: 0 0.4rem;
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.bl-btn:hover {
  background: rgba(239, 68, 68, 0.32);
  color: #fecaca;
}
.bl-btn:disabled,
.bl-btn.bl-done {
  opacity: 0.85;
  cursor: default;
  background: rgba(239, 68, 68, 0.28);
}
.bl-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 1.65rem;
  color: #fca5a5;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  user-select: none;
}

.danger-btn {
  appearance: none;
  border: 1px solid rgba(239, 68, 68, 0.55);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
  font: inherit;
  font-weight: 650;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}
.danger-btn:hover {
  background: rgba(239, 68, 68, 0.35);
}

.wl-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.wl-toolbar .field {
  min-width: 14rem;
  flex: 1 1 16rem;
  max-width: 28rem;
}
.wl-add-form {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 0.25rem;
}
.wl-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
}
.field-actions-inline {
  flex: 0 0 auto;
}
.h2-meta {
  margin-left: 0.5rem;
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-family: var(--mono);
}
.badge.domain-entry {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
}
.badge.addr-entry {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}
code.inline-code,
.page-header code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: #cbd5e1;
}
table.wl-table td.col-actions {
  vertical-align: middle;
}

.meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.meta-bar strong {
  color: var(--text);
  font-weight: 600;
}

.progress {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  max-height: 8rem;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--border);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.toolbar .left {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

#filter-input {
  min-width: 200px;
  max-width: 360px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: min(75vh, 1100px);
  width: 100%;
}

table.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  font-family: var(--mono);
  table-layout: auto;
}

table.results th,
table.results td {
  padding: 0.45rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: nowrap;
}

table.results th {
  position: sticky;
  top: 0;
  background: var(--surface2);
  color: var(--muted);
  font-weight: 600;
  font-family: var(--font);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  z-index: 1;
}

table.results tbody tr:hover {
  background: rgba(59, 130, 246, 0.07);
}

/* From / To / Subject / Reason — use available width; soft wrap */
table.results td.wrap-cell {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  max-width: none;
  min-width: 10rem;
}

table.results td.subject-cell {
  min-width: 14rem;
  max-width: 28rem;
}

table.results td.sa-cell {
  min-width: 12rem;
  max-width: 24rem;
  font-size: 0.78rem;
  color: #cbd5e1;
}

/* Reason is usually last and needs room */
table.results th:last-child,
table.results td.wrap-cell:last-child {
  min-width: 16rem;
  width: 26%;
}

/* From / To */
table.results td.wrap-cell:not(:last-child):not(.subject-cell) {
  min-width: 11rem;
  max-width: 20rem;
}

@media (min-width: 1600px) {
  table.results td.subject-cell {
    max-width: 36rem;
  }
  table.results td.wrap-cell:not(:last-child):not(.subject-cell) {
    max-width: 24rem;
  }
  table.results th:last-child,
  table.results td.wrap-cell:last-child {
    min-width: 20rem;
    width: 28%;
  }
}

.badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: lowercase;
}

.badge.sent,
.badge.ok { background: rgba(34, 197, 94, 0.18); color: #86efac; }
.badge.bounced,
.badge.rejected { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.badge.quarantined,
.badge.held { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.badge.deferred { background: rgba(167, 139, 250, 0.2); color: #c4b5fd; }
.badge.unknown { background: rgba(139, 155, 180, 0.2); color: var(--muted); }

.empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}

.help-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.help-list li { margin-bottom: 0.35rem; }
.help-list code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: #cbd5e1;
}

footer {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.login-box {
  max-width: 380px;
  margin: 4rem auto;
}

@media (max-width: 640px) {
  .field-check { padding-top: 0.25rem; }
  table.results { font-size: 0.78rem; }
}

/* DMARC analysis */
.dmarc-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.dmarc-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.dmarc-stat-label {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.dmarc-stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.dmarc-stat-sub {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.dmarc-lvl-ok { color: #86efac; }
.dmarc-lvl-warn { color: #fcd34d; }
.dmarc-lvl-bad { color: #fca5a5; }
.dmarc-lvl-unknown { color: var(--muted); }

.dmarc-overview-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2rem 2.5rem;
}
.dmarc-pie {
  position: relative;
  width: 11.5rem;
  height: 11.5rem;
  flex: 0 0 auto;
}
.dmarc-pie-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.dmarc-pie-hole {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.dmarc-pie-hole strong {
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}
.dmarc-pie-hole span {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 650;
}
.dmarc-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 14rem;
}
.dmarc-legend li {
  display: grid;
  grid-template-columns: 0.85rem auto;
  column-gap: 0.6rem;
  align-items: baseline;
}
.dmarc-legend li strong {
  grid-column: 2;
  font-size: 1.05rem;
}
.dmarc-legend li .hint {
  grid-column: 2;
  font-size: 0.8rem;
  color: var(--muted);
}
.dmarc-legend li.dmarc-legend-range {
  display: block;
  margin-top: 0.35rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}
.dmarc-legend li.dmarc-legend-range .dmarc-range-label {
  margin-right: 0.65rem;
}
.dmarc-legend li.dmarc-legend-range strong {
  grid-column: auto;
  font-size: inherit;
  font-weight: 650;
  white-space: nowrap;
}
.dmarc-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  display: inline-block;
  margin-top: 0.25rem;
}
.dmarc-swatch.ok { background: var(--ok); }
.dmarc-swatch.bad { background: var(--bad); }

.dmarc-rate {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 8.5rem;
}
.dmarc-rate-track {
  flex: 1 1 auto;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.dmarc-rate-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--muted);
}
.dmarc-lvl-ok .dmarc-rate-bar { background: var(--ok); }
.dmarc-lvl-warn .dmarc-rate-bar { background: var(--warn); }
.dmarc-lvl-bad .dmarc-rate-bar { background: var(--bad); }
.dmarc-rate-n {
  flex: 0 0 3.6rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
table.dmarc-table td.num,
table.dmarc-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.dmarc-ingest-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin: -0.25rem 0 1.5rem;
}

@media (max-width: 640px) {
  .dmarc-stat-value { font-size: 1.35rem; }
  .dmarc-pie { width: 9.5rem; height: 9.5rem; }
}
