/* ---- Design tokens (Augen "Beyond Humanware" redesign) ----
   Stark editorial / Swiss aesthetic: grotesque type, near-monochrome + one
   electric-blue accent (#0071e3), FLAT depth (hairline borders + grey fills, not
   drop shadows). Light is the default (see theme-init.js); dark is opt-in via the
   toggle. Every rule reads these via var(), so the whole UI re-themes from the two
   blocks below. Shared, non-color tokens (fonts, radius) live in :root and cascade
   into the light block. */
:root {
  /* ===== Dark palette (secondary theme) ===== */
  --bg:           #0f1012;
  --bg-card:      #161719;
  --bg-row-alt:   #1d1e20;
  --bg-input:     #161719;
  --bg-hover:     #1d1e20;

  --accent:       #f2f2f4;
  --accent-hover: #ffffff;
  --accent-dim:   rgba(255,255,255,0.06);

  --text:         #f2f2f4;
  --text-muted:   #9a9aa0;
  --text-faint:   #5f6066;

  --green:        #00b982;
  --green-dim:    #00b9821a;
  --red:          #e5372b;
  --red-dim:      #e5372b1a;
  --yellow:       #fca311;
  --yellow-dim:   #fca3111a;

  --border:       #25262a;
  --border-light: #2e2f34;

  /* Brand (electric blue: links, focus rings, active state, tags, count badges) */
  --brand:        #2b8bff;
  --brand-hover:  #4d9fff;
  --brand-fg:     #7ab6ff;
  --brand-subtle: rgba(43,139,255,0.14);

  /* ===== Shared tokens (cascade into the light block) ===== */
  --radius:       10px;
  --radius-sm:    8px;
  --radius-lg:    12px;

  --font:         'PP Neue Montreal', 'Neue Montreal', 'Helvetica Neue', 'Inter', Arial, system-ui, sans-serif;
  --font-serif:   'Georgia', serif; /* retained for compat; UNUSED by the Augen theme */
  --font-mono:    'Berkeley Mono', 'SF Mono', ui-monospace, 'Menlo', monospace;

  --shadow:       0 1px 2px rgba(0,0,0,0.4), 0 12px 32px -16px rgba(0,0,0,0.6);
  --shadow-sm:    0 1px 1px rgba(0,0,0,0.3);
}

/* ---- Light theme (default; Augen-matched) ----
   Pure white, near-black text (#0f1012), electric-blue accent, flat borders. Palette
   overrides only — shared tokens (fonts, radius) cascade from :root. */
:root[data-theme="light"] {
  --bg:           #ffffff;
  --bg-card:      #ffffff;
  --bg-row-alt:   #f8f8f8;
  --bg-input:     #f4f4f5;
  --bg-hover:     #f2f2f4;

  --accent:       #0f1012;
  --accent-hover: #000000;
  --accent-dim:   rgba(15,16,18,0.05);

  --text:         #0f1012;
  --text-muted:   #6b6b70;
  --text-faint:   #a3a3a9;

  --green:        #00b982;
  --green-dim:    #00b98218;
  --red:          #e5372b;
  --red-dim:      #e5372b18;
  --yellow:       #fca311;
  --yellow-dim:   #fca31118;

  --border:       #e7e7e8;
  --border-light: #ededee;

  --brand:        #0071e3;
  --brand-hover:  #0060c0;
  --brand-fg:     #0071e3;
  --brand-subtle: #e8f1fd;

  --shadow:    0 1px 2px rgba(15,16,18,0.05), 0 8px 24px -14px rgba(15,16,18,0.10);
  --shadow-sm: 0 1px 1px rgba(15,16,18,0.04);
}

/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Layout ----
   Fluid width: the content column tracks the browser window and re-flows live on
   resize, using ~92% of the viewport. It's bounded so it never distorts — capped
   at 1200px (the original max width) on wide screens, and it never compacts below
   ~50% of the window (min() keeps it wide enough to stay organised before the
   mobile breakpoint takes over). */
.container {
  width: min(92vw, 1200px);
  max-width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- Header ---- */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  margin-bottom: 32px;
}
.logo {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  text-align: center;
}

.header-row { position: relative; }

/* Brand + theme toggle share a top-left cluster (the icon is the brand mark;
   the toggle sits just to its right). */
.header-left {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 10px;
}

/* Reusable logo mark: an inline SVG drawn in currentColor, so it adapts to the
   active theme (light on dark, dark on light) everywhere it's dropped in —
   header, dashboard, etc. Inline (not a CSS mask) for bulletproof rendering. */
.tb-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  flex-shrink: 0;
}
.tb-logo svg { width: 100%; height: 100%; display: block; }
.brand-logo { color: var(--accent); }

/* Theme toggle — sits in .header-left, right of the brand mark */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
/* Show the moon in dark theme, the sun in light theme */
.theme-icon-sun { display: none; }
:root[data-theme="light"] .theme-icon-moon { display: none; }
:root[data-theme="light"] .theme-icon-sun { display: inline; }

/* ---- Tool navigation ---- */
.tool-nav {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tool-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 16px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tool-tab:hover { color: var(--text); }
.tool-tab.active { color: var(--accent); border-bottom-color: var(--accent-hover); }

/* ---- Search bar ---- */
.search-form { margin-bottom: 28px; }
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0 4px 0 14px;
  gap: 8px;
  transition: border-color 0.15s;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-icon { color: var(--text-faint); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 12px 0;
  min-width: 0;
}
.search-bar input::placeholder { color: var(--text-faint); font-family: var(--font); }
.search-bar.two-input { gap: 0; padding: 0; }
.search-bar.two-input input {
  padding: 12px 14px;
  border-right: 1px solid var(--border);
}
.search-bar.two-input input:first-child { border-left: none; }

/* Search bar with a leading record-type <select> (DNS Record Lookup). The select
   reads as part of the same field: no chrome of its own beyond a hairline divider,
   the bar's own border/focus ring still frames the whole control. */
.search-bar-select { padding-left: 0; }
.type-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  /* Chevron drawn as a background image: an inline SVG element would need its own
     markup, and inline style="" is blocked by the production CSP. */
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 16px top 50%, right 11px top 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 12px 30px 12px 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.type-select:hover { color: var(--brand); }
.type-select:focus-visible { color: var(--brand); }
.type-select option {
  /* Native dropdown list: the popup doesn't inherit the bar's transparency. */
  background: var(--bg-input);
  color: var(--text);
}

/* Label kept for screen readers only (the select is visually self-evident). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 700;
  padding: 8px 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
  margin: 4px;
}
.btn-primary:hover { background: var(--accent-hover); }

/* Press feedback — every button visibly reacts to a click (a quick shrink). */
.btn-primary:active,
.btn-secondary:active,
.tool-tab:active,
.subtool-tab:active,
.preset-btn:active,
.dashboard-tab:active,
.dash-actions button:active,
.record-copy:active,
.btn-ai:active,
.section-header:active {
  transform: scale(0.96);
}
.btn-primary:active { filter: brightness(0.88); }
/* The toggle now lives inside the flex .header-left cluster (no self-centering
   transform), so a plain scale() is safe and no longer drops it mid-click. */
.theme-toggle:active { transform: scale(0.92); }

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.btn-secondary:hover { color: var(--accent); border-color: var(--accent); }

/* ---- Loading & errors ---- */
.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 20px 0;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
  background: var(--red-dim);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--red);
  padding: 12px 16px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* ---- Result cards ---- */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ---- Summary ---- */
#section-summary {
  padding: 20px 24px 16px;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.summary-item {}
.summary-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 3px;
}
.summary-value {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 500;
}
.summary-value.mono { font-family: var(--font-mono); font-size: 0.85rem; }

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}
.badge.green { background: var(--green-dim); color: var(--green); border: 1px solid #22c55e40; }
.badge.red   { background: var(--red-dim);   color: var(--red);   border: 1px solid #ef444440; }
.badge.yellow { background: var(--yellow-dim); color: var(--yellow); border: 1px solid #eab30840; }
.badge.gray  { background: var(--accent-dim); color: var(--text-muted); border: 1px solid var(--border-light); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Action button sharing a row with status badges (Domain Lookup summary) */
.badge-action { margin-left: auto; }

/* ---- Collapsible sections ---- */
.section-header {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  text-align: left;
  transition: background 0.1s;
}
.section-header:hover { background: var(--bg-hover); }
.section-title { display: flex; align-items: center; gap: 8px; }
.chevron { color: var(--text-muted); transition: transform 0.2s; flex-shrink: 0; }
.collapsed .chevron { transform: rotate(-90deg); }
.section-body {
  border-top: 1px solid var(--border);
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.collapsed .section-body { display: none; }

.count-badge {
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
}

/* ---- Tables ---- */
.records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.records-table th {
  text-align: left;
  padding: 10px 20px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.records-table td {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 0;
}
.records-table tr:last-child td { border-bottom: none; }
.records-table tr:nth-child(even) td { background: var(--bg-row-alt); }
.records-table .mono { font-family: var(--font-mono); font-size: 0.825rem; color: var(--text); }
.records-table .muted { color: var(--text-muted); }
.records-table td.mono.muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.priority-badge {
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
}
.type-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255,255,255,0.07);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

/* ---- Copy cell in flat DNS table ---- */
.copy-cell {
  width: 52px !important;
  max-width: none !important;   /* override the max-width:0 trick on td */
  padding: 8px 12px 8px 4px !important;
  vertical-align: middle !important;
  text-align: right;
  white-space: nowrap;
}
.copy-cell .copy-btn {
  position: static;             /* not absolute like in raw-record-box */
  display: inline-block;
}

/* ---- Record type sub-sections ---- */
.record-type-section { }
.record-type-header {
  padding: 8px 20px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 700;
  background: var(--bg-row-alt);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.record-type-section:first-child .record-type-header { border-top: none; }

/* ---- Raw record box with copy ---- */
.raw-record-box {
  position: relative;
  background: var(--bg-row-alt);
  border-radius: var(--radius-sm);
  padding: 12px 48px 12px 16px;
  margin: 0 20px 12px;
  font-family: var(--font-mono);
  font-size: 0.825rem;
  color: var(--text);
  word-break: break-all;
  line-height: 1.5;
}
.raw-record-box:first-child { margin-top: 16px; }
.copy-btn {
  position: absolute;
  right: 8px;
  top: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 9px;
  font-size: 0.7rem;
  font-family: var(--font);
  font-weight: 500;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.1s;
  user-select: none;
}
.copy-btn:hover { color: var(--text); border-color: var(--text-muted); }
.copy-btn:active { transform: scale(0.92); }
.copy-btn.copied {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  animation: copy-flash 0.3s ease;
}
@keyframes copy-flash {
  0%   { transform: scale(0.92); }
  60%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ---- Email section sub-labels ---- */
.email-subsection-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 10px 20px 6px;
  border-bottom: 1px solid var(--border);
}
.email-subsection-label:not(:first-child) { border-top: 1px solid var(--border); margin-top: 4px; }

/* ---- DKIM section ---- */
.dkim-found-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.dkim-record {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.dkim-record:last-child { border-bottom: none; }
.dkim-selector-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.dkim-selector-name {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
}
.dkim-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.dkim-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
}
.dkim-meta-item {}
.dkim-meta-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 600; margin-bottom: 2px; }
.dkim-meta-value { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text); }
.dkim-no-records {
  padding: 14px 20px;
  color: var(--text-faint);
  font-size: 0.875rem;
}
.dkim-custom-lookup {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-row-alt);
}
.dkim-custom-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.dkim-custom-lookup input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 6px 10px;
  outline: none;
  min-width: 0;
  transition: border-color 0.15s;
}
.dkim-custom-lookup input:focus { border-color: var(--accent); }
#dkim-custom-result {
  padding: 0 20px 4px;
  font-size: 0.875rem;
}
#dkim-custom-result:empty { display: none; }
#cname-custom-result {
  padding: 0 20px 4px;
  font-size: 0.875rem;
}
#cname-custom-result:empty { display: none; }
.dkim-custom-hit { color: var(--green); padding: 10px 0; }
.dkim-custom-miss { color: var(--text-muted); padding: 10px 0; }

/* ---- SPF action buttons ---- */
.spf-actions {
  display: flex;
  gap: 8px;
  padding: 10px 20px 14px;
}

/* ---- DMARC parsed grid ---- */
.dmarc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px 20px;
}
.dmarc-item {}
.dmarc-item--wide { grid-column: 1 / -1; }
.dmarc-key {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 2px;
}
.dmarc-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  word-break: break-all;
  overflow-wrap: break-word;
}
.dmarc-val.policy-reject  { color: var(--green); }
.dmarc-val.policy-quarantine { color: var(--yellow); }
.dmarc-val.policy-none    { color: var(--red); }

/* ---- WHOIS kv grid ---- */
.kv-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0;
}
.kv-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.kv-value {
  font-size: 0.875rem;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  word-break: break-word;
}
.kv-label:last-of-type, .kv-value:last-of-type { border-bottom: none; }
.kv-value .mono { font-family: var(--font-mono); font-size: 0.825rem; }
.kv-value .status-tag {
  display: inline-block;
  background: var(--bg-row-alt);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 0.75rem;
  padding: 1px 7px;
  margin: 2px 4px 2px 0;
  font-family: var(--font-mono);
}

/* ---- SPF Flatten ---- */
.spf-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  padding: 20px 24px;
}
.spf-tree {
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 0.825rem;
  word-break: break-word;
  overflow-wrap: break-word;
}
.spf-tree ul { list-style: none; padding-left: 20px; border-left: 1px solid var(--border); margin-left: 4px; }
.spf-tree > ul { padding-left: 0; border-left: none; margin-left: 0; }
.spf-tree li { margin: 6px 0; }
.tree-node-mech {
  color: var(--accent);
  font-weight: 600;
}
.tree-node-ips {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-left: 8px;
}
.ip-columns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
  padding: 16px 20px;
}
.ip-chip {
  background: var(--bg-row-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 5px 10px;
  color: var(--text);
}
.ip-chip.v6 { color: var(--text-muted); }
.spf-limit-warn {
  background: var(--yellow-dim);
  border: 1px solid var(--yellow);
  color: var(--yellow);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.85rem;
  margin: 12px 20px;
}

/* ---- SPF Reverse result ---- */
.reverse-result {
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 12px;
}
.reverse-result.pass { background: var(--green-dim); border: 1px solid #22c55e40; }
.reverse-result.fail, .reverse-result.softfail { background: var(--red-dim); border: 1px solid #ef444440; }
.reverse-result.neutral, .reverse-result.none { background: var(--yellow-dim); border: 1px solid #eab30840; }
.reverse-result.permerror { background: var(--red-dim); border: 1px solid #ef444440; }
.result-verdict {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.reverse-result.pass .result-verdict { color: var(--green); }
.reverse-result.fail .result-verdict,
.reverse-result.softfail .result-verdict,
.reverse-result.permerror .result-verdict { color: var(--red); }
.reverse-result.neutral .result-verdict,
.reverse-result.none .result-verdict { color: var(--yellow); }
.result-explanation { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; max-width: 540px; margin: 0 auto 16px; }
.result-detail { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); }

/* ---- Header Analyzer ---- */
.header-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.header-paste {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  padding: 14px 16px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
.header-paste:focus { border-color: var(--accent); }
.header-paste::placeholder { color: var(--text-faint); }
.header-form-footer {
  display: flex;
  flex-wrap: wrap;   /* three buttons — wrap on narrow screens instead of clipping */
  gap: 10px;
  align-items: center;
}
.header-form-footer .btn-secondary {
  font-size: 0.875rem;
  padding: 10px 20px;
}

/* Verdict banner */
.verdict-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.verdict-symbol {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}
.verdict-sub { font-size: 0.825rem; color: var(--text-muted); }
.verdict-trusted .verdict-symbol { color: var(--green); }
.verdict-suspicious .verdict-symbol { color: var(--yellow); }
.verdict-fail .verdict-symbol { color: var(--red); }

/* Auth result grid */
.auth-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px 20px;
}
.auth-item {}
.auth-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 2px;
}
.auth-val {
  font-family: var(--font-mono);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Large, legible pass/fail glyph — the owner flagged the old 0.85rem ✓ as hard
   to see; the ✗ is drawn at the same size for symmetry. */
.auth-symbol { font-size: 1.7rem; line-height: 1; font-weight: 700; }
.auth-status { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
.auth-pass { color: var(--green); }
.auth-fail { color: var(--red); }
.auth-none { color: var(--text-muted); }

/* Discrepancy severity dots */
.disc-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
  flex-shrink: 0;
}
.disc-high { background: var(--red); }
.disc-med  { background: var(--yellow); }
.disc-low  { background: var(--text-muted); }

/* Inline shortcut buttons (↗, Flatten SPF →) */
.shortcut-btn {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.72rem;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.shortcut-btn:hover { color: var(--accent); border-color: var(--accent); }

/* "Your public IP address" convenience field under the IP Lookup form */
.my-ip-bar {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.my-ip-value {
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--border-light);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0 1px;
  margin-left: 4px;
  transition: color 0.15s, border-color 0.15s;
}
.my-ip-value:hover { color: var(--accent); border-color: var(--accent); }

/* Received chain */
.chain-hop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
}
.chain-hop:last-child { border-bottom: none; }
.chain-idx {
  background: var(--bg-row-alt);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.chain-from { color: var(--text); }
.chain-arrow { color: var(--text-faint); }
.chain-by { color: var(--text-muted); }
.chain-ip { color: var(--text-faint); font-size: 0.75rem; }
.chain-internal {
  font-family: var(--font);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-row-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

/* DKIM sig rows */
.dkim-sig-row {
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.dkim-sig-row:last-child { border-bottom: none; }


/* ---- Section label (used across result cards) ---- */
.section-label {
  padding: 10px 20px 6px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 700;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.result-card > .verdict-banner + .section-label { border-top: none; margin-top: 0; }

/* ---- Utility ---- */
.hidden { display: none !important; }
.no-data { color: var(--text-faint); font-size: 0.875rem; padding: 16px 20px; }
.section-body.padded { padding: 16px 20px; }

/* ---- Responsive (mobile / phone only; tablets ≥768px keep the full desktop site) ---- */
@media (max-width: 767px) {
  html { font-size: 16px; }

  /* Phones use the full width (minus a small gutter); the desktop clamp above
     would otherwise leave too much dead space on a narrow screen. */
  .container { width: 100%; padding: 0 14px; }

  /* Header */
  .site-header { margin-bottom: 24px; padding: 12px 0; }
  .logo { font-size: 1rem; }

  /* Tool navigation: single horizontal scroll row */
  .tool-nav {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 20px;
    gap: 0;
  }
  .tool-nav::-webkit-scrollbar { display: none; }

  .tool-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  /* Search bar & inputs */
  .search-bar { padding: 0 4px 0 10px; }
  .search-bar input { font-size: 1rem; padding: 14px 0; }
  .btn-primary { padding: 10px 16px; }

  /* Two-input search bar stacks vertically */
  .search-bar.two-input { flex-direction: column; padding: 8px; gap: 6px; }
  .search-bar.two-input input { border-right: none; border-bottom: 1px solid var(--border); width: 100%; }
  .search-bar.two-input .btn-primary { width: 100%; margin: 0; border-radius: var(--radius-sm); }

  /* Summary & grids */
  #section-summary { padding: 16px 16px 14px; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

  .section-header { padding: 12px 16px; }

  /* Tables */
  .records-table td, .records-table th { padding: 8px 12px; }

  /* DMARC & SPF meta grids */
  .dmarc-grid { grid-template-columns: 1fr 1fr; }
  .spf-meta { grid-template-columns: 1fr 1fr; }

  /* WHOIS kv grid */
  .kv-grid { grid-template-columns: 1fr; }
  .kv-label { padding-bottom: 2px; border-bottom: none; }

  /* IP grids */
  .ip-columns { grid-template-columns: 1fr; }
  /* (.ip-security-row / .ip-coords / .map-btn mobile overrides live at the end
     of the file — they must follow their base definitions in source order.) */

  /* Header paste */
  .header-paste { font-size: 0.85rem; }

  /* Reverse result padding */
  .reverse-result { padding: 20px 16px; }
}

/* ---- IP Lookup ---- */
.muted { color: var(--text-muted); }

.ip-big {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
}

.ip-coords-item { grid-column: span 2; }
.ip-coords {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.map-btn {
  text-decoration: none;
  padding: 3px 10px;
  font-size: 0.75rem;
}

.ip-security-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.ip-sec-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 2px;
}
.ip-sec-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
}
.sec-detected { color: var(--red); }
.sec-clear { color: var(--green); }
.sec-na { color: var(--text-muted); }

/* The 8-column source comparison is data-dense; on narrow screens let it scroll
   horizontally (with a readable min-width) instead of collapsing to 1 char/line.
   Tighter cell padding gives the many columns more room before wrapping. */
.ip-sources-scroll { overflow-x: auto; }
.ip-sources-table { min-width: 680px; }
.ip-sources-table td, .ip-sources-table th { padding: 9px 12px; }

/* ---- Blacklist tool ---- */
.ip-actions-row {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.bl-status-cell { white-space: nowrap; }
.bl-reason { font-size: 0.78rem; margin-top: 2px; word-break: break-word; }
/* Like .ip-sources-scroll: on narrow screens the 4-column list scrolls
   horizontally at a readable min-width instead of wrapping names per letter. */
.bl-scroll { overflow-x: auto; }
.bl-table { min-width: 560px; }

/* ---- AI header inspector ---- */
/* "Analyze with AI" action — a subtly distinct accent so it reads as the
   premium/owner action next to the plain analyzer button, without breaking the
   black-and-white theme. */
.btn-ai {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 9px 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.btn-ai:hover { background: var(--accent); color: var(--bg); }
.btn-ai:disabled { opacity: 0.55; cursor: default; }
.btn-ai:disabled:hover { background: transparent; color: var(--accent); }

.ai-banner .verdict-symbol,
.ai-spark { color: var(--accent); }
.ai-body { padding: 16px 20px 18px; }
.ai-body p { color: var(--text); font-size: 0.9rem; margin-bottom: 10px; }
.ai-body p:last-child { margin-bottom: 0; }
.ai-note { color: var(--text-muted); font-size: 0.82rem; }
.ai-pending-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 3px 10px;
}
/* Findings list (populated once a provider is wired up) */
.ai-finding {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
}
.ai-finding-body { flex: 1; }
.ai-finding-title { font-weight: 600; color: var(--text); }
.ai-finding-detail { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }

/* ---- Structured AI report (verdict chip, sections, per-mechanism blocks) ---- */
.ai-status {
  margin-left: auto; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; padding: 3px 10px; border-radius: 20px;
  border: 1px solid var(--border-light); color: var(--text-muted); white-space: nowrap;
}
.ai-status-ok  { color: var(--green); border-color: #22c55e40; background: var(--green-dim); }
.ai-status-bad { color: var(--red);   border-color: #ef444440; background: var(--red-dim); }
.ai-status-warn{ color: var(--amber, #d97706); border-color: #f59e0b40; }

.ai-section-label {
  padding: 12px 20px 6px; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); font-weight: 700;
  border-top: 1px solid var(--border); margin-top: 4px;
}

.ai-mech-list { padding: 6px 20px 12px; display: flex; flex-direction: column; gap: 8px; }
.ai-mech-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 0.86rem; }
.ai-mech-name { font-weight: 700; min-width: 54px; color: var(--text); }
.ai-mech-status {
  font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border-light);
}
.ai-mech-ok  { color: var(--green); border-color: #22c55e40; background: var(--green-dim); }
.ai-mech-bad { color: var(--red);   border-color: #ef444440; background: var(--red-dim); }
.ai-mech-warn{ color: var(--text-muted); }
.ai-mech-detail { color: var(--text-muted); flex: 1 1 200px; }

.ai-bullets { margin: 4px 0 12px; padding: 0 20px 0 38px; }
.ai-bullets li { color: var(--text); font-size: 0.86rem; margin-bottom: 5px; line-height: 1.45; }
.ai-bullets li::marker { color: var(--text-faint); }

.ai-detail-list { padding: 6px 20px 12px; display: flex; flex-direction: column; gap: 12px; }
.ai-detail-head { font-weight: 700; color: var(--text); font-size: 0.88rem; margin-bottom: 3px; }
.ai-detail-status { font-weight: 600; color: var(--text-muted); }
.ai-detail-block .ai-bullets { padding-left: 20px; margin: 2px 0 0; }

/* ---- Owner-auth: sign-in modal & header actions ---- */
/* Sign-in lives in the header cluster (no corner FAB). Enforcement is server-side. */

/* Modal */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}
.auth-modal-card {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 380px;
  width: 100%;
  /* Account/enrollment cards can be tall (many sections) — cap and scroll so the
     sign-out / confirm controls stay reachable on short viewports. */
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px 28px;
  text-align: center;
}
/* The account portal packs more sections, so give it a slightly wider card. */
.auth-modal-card.account-card { max-width: 440px; }
.auth-modal-card svg { color: var(--text-muted); }
.auth-modal-card h2 { font-size: 1rem; font-weight: 600; margin: 12px 0 4px; }
.auth-modal-card p { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 18px; }
.auth-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
}
.auth-modal-close:hover { color: var(--text); }

/* Shared sign-in form (used by the modal) */
.locked-form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.locked-form input {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 10px 12px;
}
.locked-form input:focus { border-color: var(--accent); outline: none; }
.locked-form input::placeholder { color: var(--text-faint); font-family: var(--font); }
.locked-form .btn-primary { margin: 4px 0 0; padding: 10px 18px; }
.locked-error {
  color: var(--red);
  font-size: 0.8rem;
  margin-top: 12px;
}

/* Mobile overrides for the IP Lookup section. These share specificity with the
   base rules above, so source order decides — they must stay BELOW the base
   definitions (a copy inside the main mobile block higher up would be dead). */
@media (max-width: 767px) {
  .ip-security-row { grid-template-columns: 1fr 1fr; }
  .ip-coords { gap: 8px; }
  .map-btn { padding: 6px 12px; }
}

/* Accessibility: respect the user's reduced-motion preference (spinner,
   chevron/copy transitions, modal blur are decorative, not informational). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Account portal, toasts, passkeys (drafted by GLM, curated) ---- */
/* ---- Toasts ---- */
.toast-region {
  position: fixed;
  bottom: 72px;            /* above the auth FAB */
  left: 50%;
  transform: translateX(-50%);
  /* Must sit ABOVE the dashboard overlay (z-index 80) and modals — otherwise
     save/action confirmations render behind them and look like nothing happened. */
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.95rem;
  padding: 12px 20px;
  margin-top: 8px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok  { border-left: 3px solid var(--green, #3fb950); }
.toast.err { border-left: 3px solid var(--red, #f85149); }

/* ---- Account modal ---- */
.account-card {
  max-width: 420px;
  text-align: left;
}
.account-card > h2 {
  text-align: center;
  margin-bottom: 16px;
}

.account-section { margin-bottom: 20px; }
.account-section h3 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.account-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.account-row input,
.account-row select {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 9px 11px;
}
.account-row input:focus,
.account-row select:focus { border-color: var(--accent); outline: none; }
.account-note {
  color: var(--text-faint);
  font-size: 0.72rem;
  margin: 6px 0 0;
}

.account-field {
  display: block;
  margin-bottom: 10px;
}
.account-field .summary-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.account-field select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 9px 11px;
}
.account-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 10px;
  color: var(--text);
  cursor: pointer;
}

.account-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}
.account-signout { width: 100%; }

/* Passkey list */
.passkey-list { margin-bottom: 10px; }
.passkey-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  gap: 8px;
}
.passkey-name { color: var(--text); font-weight: 500; }
.passkey-meta {
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-top: 2px;
}
.passkey-remove {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 4px 10px;
  transition: color 0.15s, border-color 0.15s;
}
.passkey-remove:hover { color: var(--red); border-color: var(--red); }
.passkey-empty {
  color: var(--text-faint);
  font-size: 0.8rem;
  padding: 8px 0;
}

/* Passkey button inside the sign-in modal */
#auth-passkey-btn { width: 100%; padding: 9px 16px; font-size: 0.85rem; }

/* ============================================================================
   Round 4 — multi-user portal identity, TOTP setup, chooser, forced enrollment,
   and the admin dashboard (right-side section tabs). Black-&-white theme tokens.
   ============================================================================ */

/* Portal identity header */
.account-identity {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.account-fullname { font-weight: 600; color: var(--text); }
.account-username { color: var(--text-muted); font-size: 0.85rem; }
.account-cross-nav { width: 100%; margin-bottom: 18px; }
.account-stack { display: flex; flex-direction: column; gap: 8px; }

/* Role badges */
.role-badge {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border-light);
  color: var(--text-muted); white-space: nowrap;
}
.role-badge.admin { color: var(--accent-hover); border-color: var(--accent); background: var(--accent-dim); }
.role-badge.user  { color: var(--text-muted); }

/* TOTP setup */
.totp-setup { margin: 8px 0; }
/* Primary enrollment affordance: a scannable QR on a white quiet-zone so any
   authenticator camera reads it against the dark theme. */
.totp-qr {
  display: block; margin: 10px auto; width: 188px; height: 188px;
  background: #fff; border-radius: var(--radius-sm); padding: 8px; box-sizing: content-box;
}
/* Manual key: secondary fallback, collapsed by default. */
.totp-manual { margin-bottom: 8px; }
.totp-manual > summary {
  cursor: pointer; color: var(--text-muted); font-size: 0.82rem; list-style: revert;
}
.totp-manual > summary:hover { color: var(--text); }
.totp-manual .totp-secret { margin-top: 8px; }
.totp-secret {
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 10px; margin-bottom: 8px;
  word-break: break-all; user-select: all; font-size: 0.9rem; color: var(--accent);
}

/* ---- Admin dashboard --------------------------------------------------- */
.dashboard { position: fixed; inset: 0; z-index: 80; background: var(--bg); }
.dashboard-shell { display: flex; height: 100%; }
.dashboard-main { flex: 1 1 auto; overflow-y: auto; padding: 20px clamp(16px, 3vw, 32px); }
.dashboard-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-bottom: 14px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.dashboard-header h2 { margin: 0; }
.dashboard-header-actions { display: flex; gap: 8px; }
/* Close X: bigger + a shade whiter so it's easy to find (owner directive, round 6). */
#dashboard-close {
  font-size: 1.4rem; line-height: 1; color: var(--text);
  padding: 2px 12px; border-color: var(--border-light);
}
#dashboard-close:hover { color: var(--accent-hover); border-color: var(--accent); }

/* Left-side vertical section tabs */
.dashboard-tabs {
  flex: 0 0 190px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 0; background: var(--bg-card);
}
.dashboard-brand {
  padding: 0 20px 14px; font-weight: 600; font-size: 0.8rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted);
  display: flex; align-items: center; gap: 9px;
}
.dashboard-brand .tb-logo { width: 22px; height: 22px; color: var(--accent); }
.dashboard-tabs-spacer { flex: 1 1 auto; }
.dashboard-tab {
  background: none; border: none; border-left: 2px solid transparent;
  color: var(--text-muted); text-align: left; padding: 12px 20px;
  font-family: var(--font); font-size: 0.95rem; cursor: pointer;
}
.dashboard-tab:hover { color: var(--text); background: var(--bg-hover); }
.dashboard-tab.active { color: var(--accent); border-left-color: var(--accent-hover); background: var(--accent-dim); }
.dashboard-tab-portal { color: var(--text); border-top: 1px solid var(--border); margin-top: 8px; }
.dashboard-tab-portal:hover { color: var(--accent); }

.dashboard-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.dashboard-panel-head h3 { margin: 0; }

/* Tables */
.dashboard-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.dashboard-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.dashboard-table th, .dashboard-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap; vertical-align: middle;
}
.dashboard-table th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.dashboard-table tbody tr:last-child td { border-bottom: none; }
.dashboard-table tbody tr:nth-child(even) { background: var(--bg-row-alt); }
.dash-account-name { font-weight: 600; }
.dash-account-sub { color: var(--text-muted); font-size: 0.8rem; }

/* Method flags + status pills */
.method-flags { display: inline-flex; gap: 6px; }
.method-flag {
  font-size: 0.7rem; padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--border-light); color: var(--text-faint);
}
.method-flag.on { color: var(--green); border-color: #22c55e40; background: var(--green-dim); }
.pill { font-size: 0.75rem; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border-light); }
.pill.ok  { color: var(--green); border-color: #22c55e40; background: var(--green-dim); }
.pill.bad { color: var(--red);   border-color: #ef444440; background: var(--red-dim); }
.pill.muted { color: var(--text-muted); }

/* Row action buttons */
.dash-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.dash-actions button {
  background: none; border: 1px solid var(--border-light); color: var(--text-muted);
  border-radius: var(--radius-sm); padding: 4px 8px; font-size: 0.78rem;
  font-family: var(--font); cursor: pointer;
}
.dash-actions button:hover { color: var(--accent); border-color: var(--accent); }
.dash-actions button.danger:hover { color: var(--red); border-color: var(--red); }

/* Per-row labelled slider toggles (Premium / AI) in the user table. */
.dash-switch { display: inline-flex; align-items: center; gap: 5px; }
.dash-switch-label {
  font-size: 0.72rem; color: var(--text-muted); font-family: var(--font);
  text-transform: uppercase; letter-spacing: 0.04em;
}
/* Slider switch: an accessible checkbox visually rendered as a sliding track.
   Monochrome to match the theme — the knob and track invert on check. */
.switch { position: relative; display: inline-block; width: 34px; height: 18px; flex-shrink: 0; }
.switch input {
  position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer;
}
.switch-slider {
  position: absolute; inset: 0; border-radius: 999px; cursor: pointer;
  background: var(--bg-row-alt); border: 1px solid var(--border-light);
  transition: background 0.15s, border-color 0.15s;
}
.switch-slider::before {
  content: ""; position: absolute; left: 2px; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-muted); transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .switch-slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-slider::before { transform: translate(16px, -50%); background: var(--bg); }
.switch input:focus-visible + .switch-slider { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Create-user form */
.dash-create { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; background: var(--bg-card); }
.dash-create-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.dash-create-actions { display: flex; gap: 8px; margin-top: 12px; }
.dash-log-filters { display: flex; gap: 8px; flex-wrap: wrap; }

/* Insights cards */
.insights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.insight-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--bg-card); }
.insight-card .insight-num { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.insight-card .insight-num.warn { color: var(--red); }
.insight-card .insight-label { color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; }
.insight-section-title { margin: 18px 0 10px; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }

@media (max-width: 768px) {
  .dashboard-shell { flex-direction: column; }
  .dashboard-tabs { flex-direction: row; flex: 0 0 auto; border-right: none; border-bottom: 1px solid var(--border); overflow-x: auto; padding: 0; }
  .dashboard-brand { display: none; }
  .dashboard-tabs-spacer { display: none; }
  .dashboard-tab { border-left: none; border-bottom: 2px solid transparent; padding: 12px 16px; }
  .dashboard-tab.active { border-left: none; border-bottom-color: var(--accent-hover); }
  .dashboard-tab-portal { border-top: none; margin-top: 0; }
}

/* ============================================================================
   Round 5 — authenticated header cluster, two-step sign-in, email identity,
   password checklist, forced password change, SMTP settings. B&W theme tokens.
   ============================================================================ */

/* Authenticated header cluster (Account / Admin / Sign out) */
.auth-header-actions {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  display: flex; gap: 8px;
}
/* Header cluster buttons sit a shade whiter than the muted default so they read
   clearly against the dark header (owner directive, round 6). */
.auth-header-actions .btn-secondary { padding: 6px 12px; font-size: 0.82rem; color: var(--text); }
.auth-header-actions .btn-secondary:hover { color: var(--accent-hover); }
@media (max-width: 767px) {
  .header-row { display: flex; flex-direction: column; gap: 10px; }
  .auth-header-actions { position: static; transform: none; justify-content: center; flex-wrap: wrap; }
  .theme-toggle { position: absolute; left: 0; top: 4px; transform: none; }
}

/* Two-step sign-in: authenticator code row (revealed after password check) */
.auth-code-row { display: flex; flex-direction: column; gap: 6px; }
.auth-code-label { font-size: 0.78rem; color: var(--text-muted); }
/* Passkey sign-in matches the primary Sign in button */
.auth-passkey-btn { width: 100%; margin-top: 10px; padding: 10px 18px; font-size: 0.9rem; }
/* Forgot-password link */
.auth-linkbtn {
  display: inline-block; margin-top: 12px; background: none; border: none;
  color: var(--text-muted); font-size: 0.8rem; cursor: pointer; text-decoration: underline;
  font-family: var(--font);
}
.auth-linkbtn:hover { color: var(--text); }

/* Ghost button (distinct from the uniform primary action buttons) */
.btn-ghost {
  width: 100%; background: none; border: 1px solid var(--border-light);
  color: var(--text-muted); border-radius: var(--radius-sm); padding: 9px 16px;
  font-family: var(--font); font-size: 0.85rem; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

/* Enrollment / forced-change: uniform full-width action buttons */
.enroll-action { width: 100%; margin-top: 6px; }
.enroll-signout { margin-top: 4px; }

/* Grace-window countdown line shown on the (dismissible) grace splash. */
.enroll-countdown {
  margin: 4px 0 2px;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-row-alt);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}
/* Footer holds "Remind me later" + "Sign out" side by side in grace mode; the
   later button is hidden in forced mode so Sign out spans full width. */
.enroll-footer { display: flex; gap: 8px; }
.enroll-footer .btn-ghost { margin-top: 4px; }

/* ---- Inline-style -> class replacements ----
   The production CSP is `style-src 'self'` (no 'unsafe-inline'), which blocks
   style="" attributes in rendered HTML. These classes carry the styling that
   used to live inline in app.js, so layout applies in production without
   weakening the CSP. */
.tbl-fixed { table-layout: fixed; width: 100%; }
.tbl-fixed-bt { table-layout: fixed; width: 100%; border-top: 1px solid var(--border); }
.w-32 { width: 32px; }
.w-42 { width: 42px; }
.w-52 { width: 52px; }
.w-70 { width: 70px; }
.w-100 { width: 100px; }
.w-160 { width: 160px; }
.wp-7  { width: 7%; }
.wp-10 { width: 10%; }
.wp-11 { width: 11%; }
.wp-12 { width: 12%; }
.wp-13 { width: 13%; }
.wp-15 { width: 15%; }
.wp-20 { width: 20%; }
.wp-26 { width: 26%; }
.ta-center { text-align: center; }
.fs-75 { font-size: 0.75rem; }
.c-accent { color: var(--accent); }
.c-yellow { color: var(--yellow); }
.c-muted  { color: var(--text-muted); }
.c-green-b { color: var(--green); font-weight: 700; }
.gc-full { grid-column: 1 / -1; }
.pad-sec { padding: 12px 20px 16px; }
.no-data.nd-tight { padding: 12px 20px; }
.no-data.nd-flush { padding: 0; }
.grid-pad-20 { padding: 16px 20px; border-top: 1px solid var(--border); }
.grid-pad-24 { padding: 16px 24px; border-top: 1px solid var(--border); }
.ip-big-block { padding: 20px 24px 16px; }
.ip-err-block { padding: 0 20px 16px; }
.ip-err-list { color: var(--text-muted); font-size: 0.85rem; padding-left: 20px; }

/* Portal identity: greeting (first name) + compact dashboard chip */
.account-greeting { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }
.dash-chip {
  flex-shrink: 0; background: var(--accent-dim); border: 1px solid var(--accent);
  color: var(--accent-hover); border-radius: 999px; padding: 5px 12px;
  font-size: 0.78rem; font-family: var(--font); cursor: pointer; white-space: nowrap;
  transition: background 0.15s;
}
.dash-chip:hover { background: var(--bg-hover); }

/* Bigger close X on the account portal */
.account-close-lg { font-size: 1.5rem; top: 12px; right: 14px; padding: 6px 10px; }

/* Small "refresh this view" button (portal top-right, beside the close X). */
.view-refresh-btn {
  background: none; border: 1px solid var(--border-light); color: var(--text-muted);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 1rem; line-height: 1;
  transition: color 0.15s, border-color 0.15s;
}
.view-refresh-btn:hover { color: var(--accent); border-color: var(--accent); }
.view-refresh-btn:active { transform: scale(0.92); }
.account-refresh-btn { position: absolute; top: 14px; right: 52px; padding: 5px 9px; }

/* Authenticator section: setup + remove buttons sit on one wrapping row. */
.account-totp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-secondary.danger:hover { color: var(--red); border-color: var(--red); }

/* Uniform field + button sizing across the account modal. Password inputs in
   .account-stack previously fell back to browser defaults (the size mismatch the
   owner flagged); size them like every other field. */
.pw-field,
.account-stack input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 9px 11px;
}
.pw-field:focus, .account-stack input:focus { border-color: var(--accent); outline: none; }
/* Darker (more legible) placeholders — the faint token was hard to read. */
.pw-field::placeholder,
.account-stack input::placeholder,
.account-row input::placeholder,
.account-row select::placeholder,
.settings-field input::placeholder { color: var(--text-muted); font-family: var(--font); }
/* Standalone section buttons span the section for consistent width. */
.account-section > .btn-secondary,
.account-section > .btn-primary { width: 100%; }

/* Password requirements checklist */
.pw-rules {
  list-style: none; margin: 4px 0 2px; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px;
}
.pw-rules li { font-size: 0.76rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.pw-rules li.met { color: var(--green); }
.pw-rules .pw-check { font-weight: 700; width: 12px; display: inline-block; text-align: center; }

/* Dashboard: per-row 2FA policy select */
.dash-mfa-select {
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--font);
  font-size: 0.78rem; padding: 4px 6px;
}

/* Dashboard settings panel (premium / SMTP / self-service) */
.settings-block {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px; background: var(--bg-card); max-width: 720px;
}
.settings-block h4 { margin: 0 0 8px; font-size: 0.9rem; color: var(--text); }
.settings-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px; margin: 10px 0;
}
.settings-field { display: flex; flex-direction: column; gap: 4px; }
.settings-field span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.settings-field input, .settings-field select {
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--font);
  font-size: 0.86rem; padding: 8px 10px; width: 100%;
}
.settings-field input:focus, .settings-field select:focus { border-color: var(--accent); outline: none; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* SMTP "send test email" row — destination input + button, with an inline result */
.smtp-test-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.smtp-test-row .settings-field { flex: 1 1 240px; }
.smtp-test-result {
  margin-top: 10px;
  font-size: 0.84rem;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  word-break: break-word;
}
.smtp-test-result.ok { color: var(--green); border-color: var(--green); background: var(--green-dim); }
.smtp-test-result.err { color: var(--red); border-color: var(--red); background: var(--red-dim); }

/* ---- Sub-tabs (SPF / DMARC tool groups) ---- */
.subtool-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.subtool-tab {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  padding: 7px 16px;
  border-radius: 999px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.subtool-tab:hover { color: var(--text); border-color: var(--border-light); }
.subtool-tab.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}
.subtool-panel { animation: fadein 0.15s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.subtool-intro {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 22px;
  max-width: 720px;
}
.subtool-intro code, .wizard-form code, .subtool-intro strong { color: var(--text); }

/* ---- Wizard forms ---- */
.wizard-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}
.wizard-field { display: flex; flex-direction: column; gap: 7px; border: none; padding: 0; margin: 0; min-width: 0; }
.wizard-field > label, .wizard-field > legend {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  padding: 0;
}
.wizard-field legend { margin-bottom: 8px; }
.wizard-opt { font-weight: 400; color: var(--text-faint); }
.wizard-field code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--bg-row-alt);
  padding: 1px 5px;
  border-radius: 4px;
}
.wizard-field > input[type="text"],
.wizard-field > input[type="number"],
.wizard-field select,
.wizard-field-row input,
.wizard-field-row select {
  box-sizing: border-box;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  height: 42px;               /* identical height for inputs and selects */
  padding: 0 12px;
  width: 100%;
}
/* Strip native select chrome so dropdowns match the text fields exactly, then
   draw our own chevron (uses --text-muted-hex, kept in sync in both themes). */
.wizard-field select,
.wizard-field-row select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='1 1 6 6 11 1'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.wizard-field input:focus, .wizard-field select:focus { border-color: var(--accent); outline: none; }
.wizard-hint { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }
.wizard-check, .wizard-radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--text);
  cursor: pointer;
  padding: 6px 0;
  line-height: 1.45;
  font-weight: 400;
}
/* Custom-drawn checkbox/radio so the checked state is unmistakable in both themes */
.wizard-check input[type="checkbox"],
.wizard-radio input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 1px 0 0;
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  border: 2px solid var(--border-light);
  background: var(--bg-input);
  cursor: pointer;
  position: relative;
  transition: background 0.12s, border-color 0.12s;
}
.wizard-check input[type="checkbox"] { border-radius: 4px; }
.wizard-radio input[type="radio"] { border-radius: 50%; }
.wizard-check input[type="checkbox"]:hover,
.wizard-radio input[type="radio"]:hover { border-color: var(--accent); }
.wizard-check input[type="checkbox"]:checked,
.wizard-radio input[type="radio"]:checked { background: var(--accent); border-color: var(--accent); }
.wizard-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px; top: 1px;
  width: 5px; height: 10px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.wizard-radio input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 4px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--bg);
}
.wizard-check input:focus-visible,
.wizard-radio input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Highlight the whole selected row so the choice reads at a glance */
.wizard-check:has(input:checked),
.wizard-radio:has(input:checked) { color: var(--accent-hover); font-weight: 500; }
.wizard-check em, .wizard-radio em { color: var(--text-muted); font-style: normal; }
.wizard-field-row { flex-direction: row; gap: 20px; }
.wizard-field-row > div { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }

.wizard-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 2px; }
.preset-btn {
  background: transparent;
  border: 1px dashed var(--border-light);
  color: var(--text-muted);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.76rem;
  padding: 4px 11px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.preset-btn:hover { color: var(--accent); border-color: var(--accent); border-style: solid; }

.wizard-advanced { border-top: 1px solid var(--border); padding-top: 14px; }
.wizard-advanced summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
}
.wizard-advanced summary:hover { color: var(--text); }
.wizard-advanced[open] summary { margin-bottom: 14px; }
.wizard-advanced .wizard-field { margin-bottom: 16px; }

/* ---- Wizard output — deliberately prominent so it isn't missed ---- */
.wizard-output {
  margin-top: 32px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.wizard-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.wizard-output-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
/* DNS record fields — Type / Host / Value each in a boxed field like a DNS UI */
.record-fields { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 18px; }
.record-field {
  flex: 1 1 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
  position: relative;
  min-width: 0;
}
.record-field-narrow { flex: 0 1 200px; }
.record-field-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.record-value-box {
  background: var(--bg);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 15px 68px 15px 16px;      /* right padding leaves room for Copy */
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--accent-hover);
  word-break: break-all;
  line-height: 1.6;
  min-height: 22px;
}
.record-copy { position: absolute; right: 8px; bottom: 8px; padding: 4px 11px; font-size: 0.72rem; }
.wizard-publish { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 4px; line-height: 1.55; }
.wizard-publish code { font-family: var(--font-mono); background: var(--bg-row-alt); padding: 1px 5px; border-radius: 4px; }
.wizard-actions { margin-top: 16px; }

/* ---- Analyzer results (SPF / DMARC) ---- */
.analyzer-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.analyzer-chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-width: 120px;
}
.analyzer-chip-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.analyzer-chip-value { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.analyzer-chip.chip-ok { border-color: var(--green); }
.analyzer-chip.chip-ok .analyzer-chip-value { color: var(--green); }
.analyzer-chip.chip-bad { border-color: var(--red); }
.analyzer-chip.chip-bad .analyzer-chip-value { color: var(--red); }
.analyzer-chip.chip-warn { border-color: var(--yellow); }
.analyzer-chip.chip-warn .analyzer-chip-value { color: var(--yellow); }

.analyzer-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin: 22px 0 10px;
}
.breakdown-table td { vertical-align: top; }
.breakdown-table td.muted { color: var(--text-muted); line-height: 1.5; font-size: 0.85rem; }
.breakdown-table td.muted strong { color: var(--text); }
.lookup-tag {
  display: inline-block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--yellow);
  border: 1px solid var(--yellow);
  border-radius: 4px;
  padding: 0 5px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ---- Issue / findings list (shared: analyzers + wizards) ---- */
.issue-list { display: flex; flex-direction: column; gap: 8px; }
.issue {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.86rem;
  line-height: 1.5;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
}
.issue-icon { flex-shrink: 0; font-weight: 700; line-height: 1.5; }
.issue-critical { border-color: var(--red); background: var(--red-dim); }
.issue-critical .issue-icon { color: var(--red); }
.issue-warning { border-color: var(--yellow); background: var(--yellow-dim); }
.issue-warning .issue-icon { color: var(--yellow); }
.issue-info .issue-icon { color: var(--text-muted); }
.issue-ok { border-color: var(--green); background: var(--green-dim); }
.issue-ok, .issue-ok .issue-icon { color: var(--green); }
#spfw-warn:not(:empty), #dmw-warn:not(:empty) { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

@media (max-width: 768px) {
  .wizard-field-row { flex-direction: column; gap: 20px; }
  .analyzer-chip { flex: 1; min-width: 0; }
}


/* ===== Augen refinement layer (redesign) =====
   v2 — closer resemblance to the reference: one floating pill nav (logo · tabs ·
   toggle · auth), minimal bottom-left hero, "search type box" fields, and
   "pop-up window" modal/portal chrome. Drafted via GLM (amlab glm_call),
   adjudicated + corrected. Appended last so it overrides the base rules; the two
   token blocks at the top drive the whole palette. */

body {
  background: var(--bg);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

/* --- 1. Floating pill nav (the reference's "top format") --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 18px 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: none;
}
.nav-bar {
  width: max-content;
  max-width: calc(100% - 40px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
/* The brand mark is a <button>: clicking it reloads the app (see initBrandReload). */
.nav-logo {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  flex-shrink: 0;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.nav-logo:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg-input);
}
.nav-logo:active { transform: scale(0.94); }
.nav-logo svg { width: 18px; height: 18px; }

.tool-nav {
  display: flex;
  gap: 2px;
  background: transparent;
  border: none;
  box-shadow: none;
  margin: 0;
  padding: 0;
  width: auto;
  flex-wrap: wrap;
  justify-content: center;
}
.tool-tab {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 5px 16px;
  font-family: var(--font);
  font-size: 0.98rem;
  font-weight: 450;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.tool-tab:hover {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.tool-tab.active {
  background: var(--bg-card);
  color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}
.theme-toggle {
  width: 31px;
  height: 31px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.theme-toggle:hover {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.auth-header-actions {
  position: static;
  transform: none;
  display: flex;
  gap: 4px;
}
.auth-header-actions .btn-secondary {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
}

@media (max-width: 720px) {
  .nav-bar { flex-wrap: wrap; border-radius: 20px; }
}

/* --- 2. Wordmark — compact, directly below the tab bar (no empty band) --- */
.hero {
  background: var(--bg);
  border: none;
  margin: 0;
  padding: 16px 0 10px;
}
.hero-inner {
  width: min(92vw, 1200px);
  max-width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}
.hero-wordmark {
  font-size: 1.2rem; /* 20% larger than the prior 1rem */
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
}

/* --- 3a. Text inputs: consistent rounded grey style (declared BEFORE .search-bar
   input so the pill's transparent inner input wins the cascade) --- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
.dkim-custom-lookup input,
.dmarc-analyze-row input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
textarea:focus,
.dkim-custom-lookup input:focus,
.dmarc-analyze-row input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-subtle);
  outline: none;
}

/* --- 3b. Search — the reference "search type box" (circular icon + pill field) --- */
.search-bar {
  display: flex;
  align-items: center;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  box-shadow: none;
  padding: 5px 5px 5px 8px;
  gap: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-bar:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-subtle);
}
.search-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
  padding: 8px;
}
.search-bar input {
  padding: 9px 4px;
  font-size: 0.95rem;
  border: none;
  background: transparent;
  box-shadow: none;
  outline: none;
}
.search-bar input:focus { box-shadow: none; }

/* --- 4. Pop-up / portal windows (reference "pop up window sample") --- */
.auth-modal:not(.hidden) {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--text) 45%, transparent);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.auth-modal-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
  width: min(440px, 92vw);
}
.auth-modal-card h2 { font-size: 1.15rem; font-weight: 500; }
.auth-modal-card p { color: var(--text-muted); font-size: 0.9rem; }
.auth-modal-card > svg {
  position: absolute;
  top: 22px;
  left: 24px;
  margin: 0;
  width: 40px;
  height: 40px;
  padding: 9px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text);
}
/* Grotesque inputs (kill the base monospace) so the modal matches the theme */
.locked-form input,
.auth-modal-card form input,
.account-row input,
.account-row select { font-family: var(--font); }
/* Sign-in header divider (matches the "pop up window" sample) */
#auth-modal .auth-modal-card { padding-top: 24px; }
#auth-modal .auth-modal-card > p {
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 20px;
}
.auth-modal-close,
.account-close-lg {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.auth-modal-close:hover,
.account-close-lg:hover {
  color: var(--text);
  background: var(--bg-input);
}
.auth-modal-card form input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-modal-card form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-subtle);
  outline: none;
}

/* Dashboard / portal window (light touch; token-driven, non-structural) */
.dashboard-shell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dashboard-tab {
  border-radius: 999px;
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.dashboard-tab:hover { color: var(--text); }
.dashboard-tab.active {
  background: var(--bg-hover);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* --- Action buttons: neutral, matching the search magnifier (no blue, no black fill).
   Same color theme as .search-submit — surface bg, hairline border, plain text. --- */
.btn-primary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: none;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary:hover { background: var(--bg-hover); border-color: var(--text-muted); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  box-shadow: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--text-muted); color: var(--text); }

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
}
.section-header { border-bottom: none; }
.records-table th { font-weight: 500; letter-spacing: 0.08em; }

.badge {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid transparent;
  line-height: 1.5;
}
.badge.green  { background: var(--green-dim);  color: var(--green);  border-color: var(--green-dim); }
.badge.red    { background: var(--red-dim);    color: var(--red);    border-color: var(--red-dim); }
.badge.yellow { background: var(--yellow-dim); color: var(--yellow); border-color: var(--yellow-dim); }

a { color: var(--brand); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--brand-hover); text-decoration: underline; }
.count-badge {
  background: var(--brand-subtle);
  color: var(--brand-fg);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
}

.spinner { border-top-color: var(--brand); }

/* ===== v3 tweaks: search magnifier submit, de-black buttons, modal polish ===== */

/* Main search box: 5% shorter + circular magnifier submit (replaces the "Look up"
   text button; the magnifier that was on the left is now the action on the right). */
#lookup-form .search-bar { padding: 5px 5px 5px 16px; }
#lookup-form .search-bar input { padding: 8px 4px; }
.search-submit {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.search-submit:hover { color: var(--text); border-color: var(--text-muted); }
.search-submit:active { transform: scale(0.92); }

/* Action buttons neutral (match the magnifier) — no blue, no black fill. */
.btn-ai:hover { background: var(--bg-hover); color: var(--text); }
.dash-chip { background: var(--bg-card); border-color: var(--border); color: var(--text); }
.dash-chip:hover { background: var(--bg-hover); border-color: var(--text-muted); }
.auth-passkey-btn { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.auth-passkey-btn:hover { background: var(--bg-hover); border-color: var(--text-muted); color: var(--text); }
/* Dashboard on/off switch: neutral dark track (it's a switch, not a button — needs a
   filled "on" state; uses the theme's accent, not blue). */
.switch input:checked + .switch-slider { background: var(--accent); border-color: var(--accent); }

/* Account portal: align the refresh + close as matching circular buttons (no overlap).
   Close sits top-right (right:20, 32px → occupies 20–52); refresh sits just left of it. */
.account-close-lg { font-size: 1.1rem; padding: 0; }
.account-refresh-btn {
  top: 20px;
  right: 60px;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.account-refresh-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--bg-input); }


/* ============================================================================
   TOUCH TABLETS (iPad et al. — ≥768px, so desktop Augen layout, but finger-driven)
   ----------------------------------------------------------------------------
   A tablet is ≥768px and gets the desktop layout, but it's driven by a finger, which
   needs a bigger target than a mouse pointer. `pointer: coarse` matches ONLY touch, so
   mouse-driven desktops (`pointer: fine`) stay pixel-identical — this honors the
   "≥768px unchanged" guardrail's INTENT (don't degrade the desktop) while meeting the
   44px HIG/WCAG 2.5.5 target floor and the 16px rule that stops iOS Safari zooming the
   page on input focus. Phones (≤767px) are the separate app shell and never match this.

   Placed at the END (after every base rule it overrides) on purpose: an @media rule has
   the same specificity as the bare selector, so the cascade falls to SOURCE ORDER — a
   block earlier than `.search-submit`'s base rule silently loses to it. Only persistent
   chrome is bumped (nav · search · header cluster); hit areas grow, glyphs/type do not.
   Verified by /device-lab on the iPad cells. ============================================ */
@media (pointer: coarse) and (min-width: 768px) {
  .nav-logo { width: 44px; height: 44px; }
  .tool-tab { min-height: 44px; display: inline-flex; align-items: center; }
  .search-submit { width: 44px; height: 44px; }
  .search-bar input { font-size: 16px; }
  .theme-toggle { width: 44px; height: 44px; }
  .auth-header-actions .btn-secondary { min-height: 44px; }
}


/* ============================================================================
   MOBILE APP SHELL (phones ≤767px)
   ----------------------------------------------------------------------------
   Purely additive: ≥768px renders exactly as before. The desktop pill nav and the
   phone chrome are two control surfaces onto the SAME `data-tab` panels — nothing
   is forked. Tokens only (--brand is the electric blue; --accent is the mono ink),
   so both themes come for free.

   Non-obvious constraints baked in here:
   - env(safe-area-inset-*) only resolves because index.html sets viewport-fit=cover.
   - Inputs must stay ≥16px or iOS Safari zooms the page on focus and the fixed
     chrome drifts out of alignment.
   - Record tables become cards via td::before + data-label; app.js fills data-label
     from each table's <th> (labelTableCells), so no render function changes.
   ============================================================================ */

/* Off on desktop. Declared outside the media query so the chrome can never leak
   into the desktop layout if a rule below is edited. */
.m-appbar,
.m-tabbar,
.m-sheet { display: none; }

@media (max-width: 767px) {
  /* ---- Chrome: top app bar ---- */
  .m-appbar {
    display: flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 60;
    height: calc(52px + env(safe-area-inset-top));
    padding: 0 12px;
    padding-top: env(safe-area-inset-top);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  .m-appbar-logo {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 44px is the HIG/WCAG 2.5.5 floor, not a style choice — the icon stays 22px, only the
       hit area grows. The -10px pull keeps the glyph optically on the 12px gutter. */
    width: 44px; height: 44px;
    margin-left: -10px;
    padding: 0;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
  }
  .m-appbar-logo svg { width: 22px; height: 22px; }
  .m-appbar-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1.0625rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .m-appbar-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
  /* The pre-redesign phone block absolutely-positions .theme-toggle to the left of
     its container; inside the fixed app bar that lands it on top of the logo. */
  .m-appbar .theme-toggle { position: static; transform: none; width: 44px; height: 44px; }

  /* ---- Chrome: bottom tab bar ---- */
  .m-tabbar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 60;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .m-tab {
    flex: 1 1 0;
    min-width: 0;
    /* 56px ≫ the 44px minimum target (Apple HIG / WCAG 2.2). */
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .m-tab svg { width: 23px; height: 23px; }
  .m-tab-label {
    font-size: 0.6875rem;
    line-height: 1.1;
    letter-spacing: 0.01em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .m-tab.active { color: var(--brand); }
  .m-tab:active { background: var(--bg-hover); }

  /* ---- Chrome: "More" bottom sheet ---- */
  .m-sheet { display: block; position: fixed; inset: 0; z-index: 90; }
  .m-sheet[hidden] { display: none; }
  .m-scrim {
    position: absolute; inset: 0;
    background: rgba(15, 16, 18, 0.45);
    opacity: 0;
    transition: opacity 0.22s ease;
  }
  .m-sheet.open .m-scrim { opacity: 1; }
  .m-sheet-panel {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    max-height: 85dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg);
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    padding: 0 16px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  }
  .m-sheet.open .m-sheet-panel { transform: translateY(0); }
  .m-grabber {
    width: 36px; height: 4px;
    margin: 8px auto 4px;
    border-radius: 2px;
    background: var(--border-light);
  }
  .m-sheet-body { display: flex; flex-direction: column; }
  .m-sheet-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 56px;
    padding: 12px 4px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font);
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .m-sheet-item:active { background: var(--bg-hover); }
  .m-sheet-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
  }
  .m-sheet-icon svg { width: 20px; height: 20px; }
  .m-sheet-item.active .m-sheet-icon { border-color: var(--brand); color: var(--brand); }
  .m-sheet-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .m-sheet-name { font-size: 0.95rem; font-weight: 500; }
  .m-sheet-desc { font-size: 0.78rem; color: var(--text-muted); }
  .m-sheet-item.active .m-sheet-name { color: var(--brand); }

  /* The live auth cluster is MOVED here by app.js (not cloned) — same nodes, same
     handlers, so sign-in/account/admin keep working on a phone. */
  .m-sheet-auth:empty { display: none; }
  .m-sheet-auth { padding: 14px 0 4px; }
  .m-sheet-auth .auth-header-actions {
    position: static;
    transform: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .m-sheet-auth .auth-header-actions .btn-secondary {
    width: 100%;
    min-height: 46px;
    justify-content: center;
    font-size: 0.95rem;
  }

  /* ---- Page frame: clear the fixed chrome ---- */
  body {
    min-height: 100dvh;
    padding-top: calc(52px + env(safe-area-inset-top));
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
  /* The desktop pill nav and the wordmark are replaced by the app bar. */
  .site-header,
  .hero { display: none; }
  .container { width: 100%; max-width: 100%; padding: 0 16px; }
  main.container { padding-top: 16px; }

  /* ---- Search: the primary action, kept in reach ---- */
  .search-form { margin-bottom: 20px; }
  .search-bar { padding: 4px 4px 4px 14px; border-radius: 999px; }
  /* 16px is a hard floor — below it iOS Safari zooms on focus. */
  .search-bar input,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  select,
  textarea { font-size: 16px; }
  .search-bar input { padding: 12px 0; }
  .search-submit { width: 44px; height: 44px; flex: 0 0 44px; }
  .search-bar.two-input { flex-direction: column; align-items: stretch; padding: 0; }
  .search-bar.two-input input { width: 100%; border-left: none; border-bottom: 1px solid var(--border); }
  .search-bar.two-input input:last-of-type { border-bottom: none; }

  /* ---- Tap targets (44px floor) ---- */
  .btn-primary,
  .btn-secondary,
  .btn-ghost {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .section-header { min-height: 48px; }
  .copy-btn { min-width: 40px; min-height: 40px; }
  button, [role="tab"] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

  /* ---- Sub-tool nav → scrolling segmented control ---- */
  .subtool-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    margin: 0 -16px 18px;
    padding: 0 16px 2px;
  }
  .subtool-nav::-webkit-scrollbar { display: none; }
  .subtool-tab {
    flex: 0 0 auto;
    scroll-snap-align: start;
    white-space: nowrap;
    min-height: 44px;
  }

  /* ---- Records: tables become cards ----
     One card per row; the column name (from data-label) sits above the value so a
     long TXT/SPF record gets the full width to wrap into. Values that cannot break
     on whitespace (DKIM keys, SPF strings) break anywhere rather than overflow. */
  /* Desktop keeps these two wide tables scrolling sideways at a readable min-width.
     As cards they must give that up, or every card stays 560/680px wide and the
     page scrolls horizontally. */
  .bl-scroll,
  .ip-sources-scroll { overflow-x: visible; }
  .bl-table,
  .ip-sources-table { min-width: 0; }
  .bl-reason { overflow-wrap: anywhere; }
  .records-table { display: block; width: 100%; border-collapse: separate; }
  .records-table thead { display: none; }
  .records-table tbody { display: flex; flex-direction: column; gap: 10px; }
  .records-table tr,
  .records-table tr:nth-child(even) td { background: transparent; }
  .records-table tr {
    display: block;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .records-table td {
    display: block;
    width: auto;
    max-width: 100%;
    padding: 6px 0;
    border: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }
  .records-table td + td { border-top: 1px solid var(--border); }
  .records-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
  }
  /* A cell whose column has no header (actions, spanned "no data") needs no label. */
  .records-table td[data-label=""]::before { content: none; }
  .records-table td.mono.muted { white-space: normal; overflow: visible; text-overflow: clip; }
  .records-table .mono { font-size: 0.8125rem; }
  .records-table .no-data { padding: 14px 0; }

  /* ---- Results: single column, room to breathe ---- */
  .result-card { border-radius: var(--radius); }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-value { overflow-wrap: anywhere; }
  .verdict-banner { flex-direction: column; align-items: flex-start; gap: 6px; }

  /* ---- Modals → full-screen sheets ---- */
  .auth-modal-card {
    width: 100%;
    max-width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-top: calc(24px + env(safe-area-inset-top));
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  /* ---- Admin dashboard sits under the same fixed chrome ---- */
  .dashboard-main { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}
