:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1a1d21;
  --muted: #5f6771;
  --border: #e3e6ea;
  --brand: #2454ff;
  --brand-dark: #173bcc;
  --critical: #c0261d;
  --warning: #a3690a;
  --info: #5f6771;
  --good: #1c7a44;
  --radius: 10px;
  --max-width: 960px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #12151c;
  --surface: #1a1e28;
  --text: #eef0f6;
  --muted: #98a2b3;
  --border: #2b303c;
  --brand: #4d7fff;
  --brand-dark: #3a63cc;
  --critical: #ff6b6b;
  --warning: #f0a83e;
  --info: #98a2b3;
  --good: #3ecf78;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: var(--brand); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

header.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

header.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--text);
}

.brand span { color: var(--brand); }

nav.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

nav.site-nav a {
  margin-left: 20px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
}

nav.site-nav a:hover { color: var(--brand); }
nav.site-nav a:first-child { margin-left: 0; }

.support-link { color: #d6336c !important; font-weight: 700; }
.support-link:hover { color: #a3204f !important; }
html[data-theme="dark"] .support-link { color: #ff7aa8 !important; }
html[data-theme="dark"] .support-link:hover { color: #ffa4c6 !important; }

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn svg { width: 18px; height: 18px; flex-shrink: 0; display: block; }

.fav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.fav-btn:hover { background: var(--bg); }
.fav-btn svg { width: 16px; height: 16px; flex-shrink: 0; transition: fill 0.15s ease, stroke 0.15s ease; }
.fav-btn.is-fav svg { fill: #f5b400; stroke: #f5b400; }
.fav-btn.is-fav { color: #b5860a; border-color: #f5d98a; }

.toast {
  position: absolute;
  top: 46px;
  right: 0;
  background: var(--text);
  color: var(--bg);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  max-width: 260px;
  white-space: normal;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 1100;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast kbd {
  background: rgba(128,128,128,0.25);
  border: 1px solid rgba(128,128,128,0.4);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.75rem;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

main { padding: 40px 0 60px; }

.page-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.page-content h1 { margin-top: 0; }
.page-content h2 { margin-top: 2em; }

.scan-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.scan-form input[type="text"] {
  flex: 1;
  min-width: 220px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}

button, .btn {
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover, .btn:hover { background: var(--brand-dark); }
button.secondary, .btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
button.secondary:hover { background: var(--bg); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.hint { color: var(--muted); font-size: 0.88rem; margin: 4px 0 20px; }

.whoami-box {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 20px;
}
.whoami-box strong { color: var(--text); }

.tip-box {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.5;
  background: #eef3ff;
  color: #1a3a8f;
  border: 1px solid #d3ddfa;
}
.tip-box.tip-fix {
  background: #fff6e5;
  color: #7a4e00;
  border-color: #f2debb;
}
.tip-box strong { display: inline-block; margin-right: 4px; }

html[data-theme="dark"] .tip-box {
  background: rgba(77,127,255,0.14);
  color: #b9cdff;
  border-color: rgba(77,127,255,0.35);
}
html[data-theme="dark"] .tip-box.tip-fix {
  background: rgba(240,168,62,0.14);
  color: #ffcf8a;
  border-color: rgba(240,168,62,0.35);
}

.score-panel {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.score-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.score-circle .num { font-size: 1.8rem; line-height: 1; }
.score-circle .grade { font-size: 0.85rem; opacity: 0.9; }

.grade-A, .grade-B { background: var(--good); }
.grade-C { background: var(--warning); }
.grade-D, .grade-F { background: var(--critical); }

.category-bars { flex: 1; min-width: 220px; }
.category-bar { margin-bottom: 10px; }
.category-bar .label { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 4px; }
.category-bar .track { background: var(--bg); border-radius: 6px; height: 8px; overflow: hidden; }
.category-bar .fill { height: 100%; background: var(--brand); }

.critical-box {
  background: #fdecea;
  border: 1px solid #f3c6c1;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.critical-box h3 { margin: 0 0 8px; color: var(--critical); font-size: 1rem; }
.critical-box ul { margin: 0; padding-left: 20px; }

html[data-theme="dark"] .critical-box {
  background: rgba(255,107,107,0.12);
  border-color: rgba(255,107,107,0.35);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.result-card h3 { margin: 0 0 10px; font-size: 1rem; }
.result-card .status-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 8px;
  vertical-align: middle;
}
.status-ok { background: #e4f5ea; color: var(--good); }
.status-warn { background: #fdf2df; color: var(--warning); }
.status-fail { background: #fdecea; color: var(--critical); }
.status-info { background: #eef0f3; color: var(--info); }

html[data-theme="dark"] .status-ok { background: rgba(62,207,120,0.18); }
html[data-theme="dark"] .status-warn { background: rgba(240,168,62,0.18); }
html[data-theme="dark"] .status-fail { background: rgba(255,107,107,0.18); }
html[data-theme="dark"] .status-info { background: rgba(152,162,179,0.18); }

/* HTTP Security Headers Analyzer: one card per header check */
.header-check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 12px; margin-top: 14px; }
.header-check-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.header-check-card h4 { margin: 0 0 6px; font-size: 0.92rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.header-check-card p { margin: 0; font-size: 0.85rem; color: var(--muted); }
.header-check-card .val { display: block; margin-top: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.76rem; color: var(--text); background: var(--bg); border-radius: 6px; padding: 6px 8px; word-break: break-all; }

.issue-list { list-style: none; padding: 0; margin: 10px 0 0; font-size: 0.88rem; }
.issue-list li { padding: 4px 0 4px 18px; position: relative; }
.issue-list li::before { content: "•"; position: absolute; left: 4px; }
.issue-critical { color: var(--critical); }
.issue-warning { color: var(--warning); }
.issue-info { color: var(--info); }

.actions-row { display: flex; gap: 10px; margin: 20px 0; flex-wrap: wrap; }

textarea {
  width: 100%;
  min-height: 180px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

.received-chain { font-size: 0.85rem; }
.received-chain .hop { border-left: 2px solid var(--border); padding: 6px 0 6px 14px; margin-bottom: 4px; }

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.ad-slot {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 24px 0;
}

/* Cookie consent banner */
#cookie-consent {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--text);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  z-index: 1000;
}
#cookie-consent p { margin: 0; font-size: 0.88rem; max-width: 640px; }
#cookie-consent p a { color: #9db8ff; }
#cookie-consent .cc-actions { display: flex; gap: 10px; flex-shrink: 0; }
#cookie-consent button { padding: 9px 16px; font-size: 0.88rem; }
#cookie-consent button.cc-accept { background: var(--brand); color: #fff; }
#cookie-consent button.cc-reject { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.4); }

html[data-theme="dark"] #cookie-consent { background: #05070c; }
html[data-theme="dark"] #cookie-consent p a { color: #9db8ff; }

.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Recent-domain / bulk-scan chips */
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 20px; }
.chip {
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}
.chip:hover { background: #eef1f6; }
html[data-theme="dark"] .chip:hover { background: #232836; }

/* Copy-to-clipboard button inside tip snippets */
.copy-btn {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  background: var(--surface);
  color: var(--brand);
  border: 1px solid var(--border);
  cursor: pointer;
  vertical-align: middle;
}
.copy-btn:hover { background: var(--bg); }

/* Re-check button in a card heading */
.result-card h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.recheck-btn {
  margin-left: auto;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}
.recheck-btn:hover { background: var(--bg); color: var(--brand); border-color: var(--brand); }
.recheck-btn:disabled { opacity: 0.6; cursor: wait; }

/* Report branding (PDF export) */
.branding-details {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 4px 0 0;
}
.branding-details summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}
.branding-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.branding-form input[type="text"] {
  flex: 1;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.branding-form input[type="file"] { font-size: 0.85rem; }

/* Bulk-scan / DMARC report tables */
.bulk-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.bulk-table th, .bulk-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.bulk-table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.bulk-table tbody tr:hover { background: var(--bg); }
.bulk-table td:nth-child(3), .bulk-table th:nth-child(3) { text-align: center; }

.grade-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  color: #fff !important;
}
.grade-chip.grade-A, .grade-chip.grade-B { background: var(--good); }
.grade-chip.grade-C { background: var(--warning); }
.grade-chip.grade-D, .grade-chip.grade-F { background: var(--critical); }

/* Glossary tooltips */
abbr.glossary-term {
  text-decoration: underline dotted;
  text-decoration-color: var(--muted);
  cursor: help;
}

@media (max-width: 640px) {
  main { padding: 24px 0 40px; }
  .page-content { padding: 20px; }
  nav.site-nav a { margin-left: 12px; font-size: 0.85rem; }
  .bulk-table { display: block; overflow-x: auto; }
  .fav-btn span { display: none; }
  .fav-btn { padding: 0 10px; }
  .toast { right: auto; left: 0; max-width: 220px; }
}

/* =========================================================
   App shell — persistent left sidebar nav (replaces the old
   top header/nav bar). The sidebar is intentionally a fixed dark
   surface regardless of the light/dark site theme, same as the
   approved mockup — only the main content area follows the toggle.
   ========================================================= */
.app-shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

.app-sidebar {
  width: 232px;
  flex-shrink: 0;
  background: #14171f;
  color: #c9d0e0;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  /* Above the cookie-consent banner (z-index: 1000) and the mobile
     backdrop below — the full-height sidebar and the fixed-bottom banner
     occupy the same screen corner, and the sidebar's own controls (theme
     toggle, favorites) need to stay clickable rather than have the banner
     silently steal pointer events there. */
  z-index: 1100;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 1.02rem;
  text-decoration: none;
}
.sidebar-brand .mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: #4d7fff;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.sidebar-brand .name i { font-style: normal; color: #7fa4ff; }
.sidebar-close {
  display: none;
  width: 30px; height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #aab2c5;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.sidebar-close:hover { background: #1e222e; color: #fff; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.snav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #aab2c5;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.snav-link:hover { background: #1e222e; color: #fff; }
.snav-link.active { background: #22273a; color: #fff; }
.snav-link .ic { width: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.snav-link .ic svg { width: 16px; height: 16px; display: block; }
.sidebar-divider { height: 1px; background: #262b3a; margin: 10px 6px; }
.snav-link.support { color: #ff8fb3; }
.snav-link.support:hover { color: #ffb0c9; background: #2a1f28; }

/* Collapsible tool categories inside the sidebar */
.cat { margin: 2px 0; }
.cat-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 8px; border: none; background: none; cursor: pointer;
  color: #c9d0e0; font-size: 0.86rem; font-weight: 600; text-align: left;
}
.cat-head:hover { background: #1e222e; color: #fff; }
.cat-head .ic { width: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #7fa4ff; }
.cat-head .ic svg { width: 15px; height: 15px; display: block; }
.cat-head .label { flex: 1; }
.cat-head .count {
  font-size: 0.66rem; font-weight: 700; color: #8a91a3; background: #1b1f2a;
  border: 1px solid #262b3a; border-radius: 20px; padding: 1px 7px; flex-shrink: 0;
}
.cat-head .chev { width: 14px; flex-shrink: 0; display: flex; color: #6b7285; transition: transform 0.2s ease; }
.cat-head .chev svg { width: 13px; height: 13px; display: block; }
.cat-head[aria-expanded="true"] .chev { transform: rotate(90deg); }

.cat-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.22s ease; }
.cat-body.open { grid-template-rows: 1fr; }
.cat-body .inner { overflow: hidden; }
.cat-items { padding: 2px 0 4px 8px; margin: 2px 0 4px 19px; border-left: 1px solid #262b3a; display: flex; flex-direction: column; gap: 1px; }

.tool-link {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 7px;
  color: #8a91a3; font-size: 0.83rem; text-decoration: none; cursor: pointer; border: none; background: none; width: 100%; text-align: left;
}
.tool-link:hover { background: #1e222e; color: #fff; }
.tool-link.active { background: #22273a; color: #fff; font-weight: 600; }
.tool-link .ic { width: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.tool-link .ic svg { width: 14px; height: 14px; display: block; }
.tool-link.soon { opacity: 0.5; cursor: default; }
.tool-link.soon:hover { background: none; color: #8a91a3; }
.soon-tag {
  margin-left: auto; font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  background: #1b1f2a; border: 1px solid #262b3a; border-radius: 20px; padding: 1px 6px; color: #6b7285; flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #232838;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-footer .whoami-box {
  display: block;
  background: #1b1f2a;
  border: 1px solid #262b3a;
  color: #93a0b4;
  font-size: 0.75rem;
  padding: 7px 10px;
  border-radius: 8px;
  margin: 0;
  white-space: normal;
  line-height: 1.4;
}
.sidebar-footer .whoami-box strong { color: #e7ebf5; }
.sidebar-controls { display: flex; gap: 8px; position: relative; }
.sidebar-controls .icon-btn { background: #1e222e; border-color: #2a2f40; color: #cbd2e1; }
.sidebar-controls .icon-btn:hover { background: #262b3a; }
.sidebar-controls .fav-btn { background: #1e222e; border-color: #2a2f40; color: #cbd2e1; flex: 1; justify-content: center; }
.sidebar-controls .fav-btn:hover { background: #262b3a; }
.sidebar-controls .fav-btn span { display: none; }
.sidebar-controls .fav-btn.is-fav { color: #f5b400; border-color: #4a3d1a; }
.sidebar-controls .fav-btn.is-fav svg { fill: #f5b400; stroke: #f5b400; }
.sidebar-controls .toast { top: auto; bottom: 46px; left: 0; right: auto; }

.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(8,10,16,0.5); z-index: 1050; }
.sidebar-backdrop.open { display: block; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.hamburger {
  width: 38px; height: 38px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.app-topbar-brand { font-weight: 700; color: var(--text); }
.app-topbar-brand span { color: var(--brand); }

.app-content { flex: 1; padding: 32px 20px 24px; }

.app-panel[hidden] { display: none; }

@media (max-width: 900px) {
  .app-topbar { display: flex; }
  .app-sidebar {
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 2px 0 24px rgba(0,0,0,0.35);
  }
  .app-sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .app-content { padding: 24px 16px 24px; }
}

/* ==========================================================================
   Tools hub + shared building blocks for standalone utility pages
   ========================================================================== */
.tool-category { margin: 0 0 32px; }
.tool-category:first-of-type { margin-top: 0; }
.tool-category h2 { margin: 0 0 4px; font-size: 1.05rem; }
.tool-category .cat-hint { margin: 0 0 14px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.tool-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; text-decoration: none; color: var(--text); transition: border-color 0.15s ease, transform 0.15s ease; }
.tool-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.tool-card h3 { margin: 0 0 6px; font-size: 0.98rem; display: flex; align-items: center; gap: 8px; }
.tool-card h3 .ic { color: var(--brand); flex-shrink: 0; }
.tool-card p { margin: 0; font-size: 0.85rem; color: var(--muted); }
.tool-card.disabled { cursor: default; opacity: 0.65; }
.tool-card.disabled:hover { border-color: var(--border); transform: none; }
.soon-badge { display: inline-block; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 2px 7px; border-radius: 20px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); margin-left: auto; }

/* Mechanism/row builder (SPF builder) */
.mech-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.mech-row select, .mech-row input[type="text"] { padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.88rem; background: var(--surface); color: var(--text); }
.mech-row select { min-width: 110px; }
.mech-row input[type="text"] { flex: 1; min-width: 160px; }
.mech-remove { background: transparent; color: var(--critical); border: 1px solid var(--border); padding: 7px 10px; font-size: 0.8rem; }
.mech-remove:hover { background: var(--bg); }

/* Generated-record output box, used by SPF/DKIM/MTA-STS generators */
.record-out { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; word-break: break-all; margin: 12px 0; white-space: pre-wrap; }
.record-out-label { font-size: 0.8rem; color: var(--muted); margin: 14px 0 4px; font-weight: 600; }

/* SPF lookup-count meter */
.lookup-meter { margin: 14px 0; }
.lookup-meter .track { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; height: 14px; overflow: hidden; }
.lookup-meter .fill { height: 100%; background: var(--good); transition: width 0.2s ease, background 0.2s ease; }
.lookup-meter.at-risk .fill { background: var(--warning); }
.lookup-meter.over-limit .fill { background: var(--critical); }
.lookup-meter .label { display: flex; justify-content: space-between; font-size: 0.82rem; margin-bottom: 5px; color: var(--muted); }

/* Labeled input grid used by generator wizards */
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 12px; margin-bottom: 14px; }
.field-grid label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; }
.field-grid input[type="text"], .field-grid input[type="number"], .field-grid select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; background: var(--surface); color: var(--text); }

/* Simple key/value results table (subnet calculator, etc.) */
.kv-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 10px 0; }
.kv-table th, .kv-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.kv-table th { color: var(--muted); font-weight: 600; width: 40%; }

/* Per-resolver result cards (propagation checker) */
.resolver-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 10px; margin-top: 14px; }
.resolver-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.resolver-card .rname { font-weight: 600; font-size: 0.85rem; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.resolver-card .rans { font-size: 0.78rem; color: var(--muted); margin-top: 4px; word-break: break-all; }
.resolver-card.err .rans { color: var(--critical); }

.warning-banner { background: #fdf2df; color: #7a4e00; border: 1px solid #f2debb; border-radius: var(--radius); padding: 12px 16px; font-size: 0.85rem; margin: 14px 0; }
html[data-theme="dark"] .warning-banner { background: rgba(240,168,62,0.14); color: #ffcf8a; border-color: rgba(240,168,62,0.35); }

.danger-banner { background: #fdecea; color: var(--critical); border: 1px solid #f3c6c1; border-radius: var(--radius); padding: 12px 16px; font-size: 0.85rem; margin: 14px 0; }
html[data-theme="dark"] .danger-banner { background: rgba(255,107,107,0.12); border-color: rgba(255,107,107,0.35); }

/* Guides — long-form explainer articles (schema-backed FAQ/HowTo content) */
.guide-content { max-width: 760px; }
.guide-dek { font-size: 0.98rem; color: var(--text); margin-bottom: 24px; }
.guide-content h2 { font-size: 1.15rem; }
.guide-content p { line-height: 1.65; margin: 0 0 14px; }
.guide-content ul, .guide-content ol { line-height: 1.65; margin: 0 0 14px; padding-left: 22px; }
.guide-content table.bulk-table { margin: 10px 0 20px; }
.guide-content table.bulk-table td, .guide-content table.bulk-table th { white-space: normal; }
.guide-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 28px 0;
}
.guide-cta > div { flex: 1; min-width: 220px; }
.guide-cta strong { display: block; margin-bottom: 4px; }
.guide-cta p { margin: 0; font-size: 0.88rem; color: var(--muted); }
.guide-cta-btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 20px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
}
.guide-cta-btn:hover { opacity: 0.9; }
.guide-faq { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.guide-faq .branding-details summary { font-weight: 600; color: var(--text); }
.guide-faq .branding-details p { margin: 10px 0 0; font-size: 0.9rem; color: var(--muted); }
.guide-see-also { margin: 20px 0; font-size: 0.88rem; }
