/* ===== Design tokens ===== */
:root {
  --bg-deep: #0a0e1a;
  --bg-sidebar: #1c2a47;
  --bg-sidebar-2: #16223a;
  --bg-panel: #121a2e;
  --bg-panel-2: #0e1524;
  --bg-terminal: #060a12;
  --border: #2c3d60;
  --border-soft: #24314c;
  --text-primary: #e8edf7;
  --text-secondary: #93a3c4;
  --text-muted: #5c6c8c;
  --amber: #f2a93c;
  --amber-dark: #d98d1f;
  --amber-ink: #241605;
  --amber-soft: rgba(242, 169, 60, 0.14);
  --amber-glow: rgba(242, 169, 60, 0.55);
  --cyan: #2de2e6;
  --cyan-soft: rgba(45, 226, 230, 0.12);
  --cyan-glow: rgba(45, 226, 230, 0.5);
  --red: #f87171;
  --red-soft: rgba(239, 68, 68, 0.14);
  --green: #4ade80;
  --green-soft: rgba(34, 197, 94, 0.16);
  --mono: ui-monospace, "Cascadia Code", "Fira Code", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Content width caps — widened at larger breakpoints below so layout scales
     up on wide/ultrawide monitors instead of leaving the right side empty. */
  --content-max: 1180px;
  --panel-max: 960px;
}

/* ===== Reset & base ===== */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.5;
}

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

h1, h2, h3, h4 {
  margin-top: 0;
  font-family: var(--mono);
}

code, pre, textarea.mono, input.mono, .output-panel, .mono {
  font-family: var(--mono);
}

/* ===== App shell =====
   The shell itself is pinned to the viewport height with no scrolling of its
   own — the sidebar and main content each own their own independent scroll
   region below, so scrolling one never moves the other. */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  height: 100vh;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.015) 0px, rgba(255, 255, 255, 0.015) 1px, transparent 1px, transparent 3px),
    linear-gradient(160deg, var(--bg-sidebar), var(--bg-sidebar-2) 75%);
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  border-right: 1px solid var(--border);
  box-shadow: 6px 0 28px rgba(0, 0, 0, 0.4);
  z-index: 2;
  position: relative;
}

.sidebar-header {
  flex-shrink: 0;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: linear-gradient(160deg, #eef1f8, #e2e7f2 80%);
  border: 1px solid var(--border);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* The search trigger lives inside the header (see #header-search-slot in the
   markup) so it's reachable without opening the collapsed mobile menu, and
   stays visible above the tool list on desktop too. Its own margin-bottom
   (meant for sitting among other nav-list items) is zeroed here since the
   header's own flex `gap` already spaces it from the row above. */
#header-search-slot:empty {
  display: none;
}

#header-search-slot .nav-search-trigger {
  margin-bottom: 0;
}

.kofi-header {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.kofi-header img {
  display: block;
  border-radius: 6px;
}

/* Hidden on desktop — the sidebar is always fully visible there. */
.mobile-nav-toggle {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.mobile-nav-toggle-icon {
  width: 16px;
  height: 16px;
}

/* Everything below the logo scrolls on its own — the logo above never moves. */
.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.brand {
  font-size: 1.3rem;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.brand a {
  color: inherit;
  text-decoration: none;
  display: block;
}

.brand-logo-full {
  display: block;
  width: 100%;
  height: auto;
}

.brand-accent {
  color: var(--amber);
}

.tagline {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0;
}

.nav-back-link {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--cyan);
  text-decoration: none;
}

.nav-back-link:hover {
  text-decoration: underline;
}

/* ===== Nav ===== */
.tool-nav {
  margin-bottom: 16px;
}

.nav-category {
  margin-bottom: 18px;
}

.nav-category-title {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cyan);
  opacity: 0.7;
  margin: 0 0 6px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: var(--text-secondary);
  padding: 8px 10px 8px 11px;
  margin-bottom: 2px;
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-star {
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1;
  padding: 2px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, transform 0.1s;
}

.nav-item:hover .nav-star,
.nav-item.active .nav-star,
.nav-star.active {
  opacity: 1;
}

.nav-star:hover {
  transform: scale(1.15);
}

.nav-star.active {
  color: var(--amber);
}

.nav-search-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 400;
  padding: 7px 9px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.nav-search-trigger:hover {
  border-color: var(--cyan);
  color: var(--text-secondary);
}

.kbd-hint {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

.card-star {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1rem;
  opacity: 0.5;
}

.tool-card:hover .card-star {
  opacity: 1;
}

.card-star.active {
  opacity: 1;
}

.tool-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tool-heading-row .nav-star {
  opacity: 0.6;
  font-size: 1.15rem;
}

.tool-heading-row .nav-star:hover,
.tool-heading-row .nav-star.active {
  opacity: 1;
}

/* ===== Ctrl+K command palette ===== */
.palette-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 18, 0.72);
  z-index: 50;
  padding: 12vh 20px 20px;
}

.palette-backdrop.open {
  display: block;
}

.palette {
  max-width: 560px;
  margin: 0 auto;
  background: linear-gradient(160deg, var(--bg-panel), var(--bg-panel-2));
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--cyan-soft);
  overflow: hidden;
}

.palette-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  background: transparent;
  padding: 16px 18px;
  font-size: 1rem;
}

.palette-input:focus {
  outline: none;
  box-shadow: none;
  border-bottom-color: var(--cyan);
}

.palette-results {
  max-height: 50vh;
  overflow-y: auto;
  padding: 6px;
}

.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.palette-item.selected {
  background: var(--amber-soft);
}

.palette-item-label {
  color: var(--text-primary);
  font-size: 0.9rem;
}

.palette-item-cat {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
  flex-shrink: 0;
}

.palette-empty {
  padding: 18px;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}

/* ===== DMARC report pass/fail bar chart ===== */
.dmarc-bar-chart {
  display: flex;
  height: 26px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}

.dmarc-bar-pass {
  background: var(--green);
}

.dmarc-bar-fail {
  background: var(--red);
}

.nav-item:hover {
  background: linear-gradient(90deg, var(--cyan-soft), transparent);
  color: var(--text-primary);
  border-left-color: var(--cyan);
}

.nav-item.active {
  background: linear-gradient(90deg, var(--amber-soft), transparent);
  color: var(--amber);
  border-left-color: var(--amber);
  box-shadow: inset 0 0 16px rgba(242, 169, 60, 0.12);
  font-weight: 600;
}

/* ===== Ad slots ===== */
.ad-slot {
  border: 1px dashed var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--mono);
  background: var(--cyan-soft);
}

.ad-slot-label {
  opacity: 0.85;
  letter-spacing: 0.04em;
}

.ad-slot-sidebar {
  width: 200px;
  height: 200px;
  max-width: 100%;
  margin: 0 auto 16px auto;
}

.ad-slot-top {
  width: 100%;
  max-width: 728px;
  height: 90px;
  margin: 0 0 20px 0;
  border-color: var(--border);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.sidebar-footer {
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
}

.sidebar-footer p {
  margin: 0 0 6px 0;
}

.sidebar-footer a {
  color: var(--cyan);
}

/* ===== Main content ===== */
.main-content {
  flex: 1 1 auto;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px 40px 28px;
  min-width: 0;
  background:
    linear-gradient(rgba(45, 226, 230, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 226, 230, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
}

.welcome {
  background: linear-gradient(160deg, var(--bg-panel), var(--bg-panel-2));
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 32px;
  max-width: 720px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.35);
}

/* ===== Homepage: welcome panel + tool card grid ===== */
.welcome-panel {
  background: linear-gradient(160deg, var(--bg-panel), var(--bg-panel-2));
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--cyan);
  border-radius: 8px;
  padding: 22px 28px;
  margin-bottom: 34px;
  max-width: var(--content-max, 1180px);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.35);
}

.welcome-panel h2 {
  font-size: 1.5rem;
  margin: 0 0 10px;
  color: var(--text-primary);
}

.welcome-panel h2 span {
  color: var(--amber);
}

.welcome-panel p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 0.94rem;
  max-width: 68ch;
  font-family: var(--sans);
}

.welcome-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.welcome-meta b {
  color: var(--cyan);
  font-weight: 600;
}

.category-block {
  max-width: var(--content-max);
  margin-bottom: 34px;
}

.category-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.category-heading h3 {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0;
}

.category-heading .rule {
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

.category-heading .count {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 158px;
  text-decoration: none;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  padding: 16px;
  position: relative;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

.tool-card:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan-soft), 0 4px 18px rgba(0, 0, 0, 0.35);
  transform: translateY(-2px);
}

.tool-card:hover .tool-icon {
  color: var(--amber);
}

.tool-card:hover .tool-icon-wrap {
  border-color: var(--amber-dark);
  background: var(--amber-soft);
}

.tool-icon-wrap {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cyan-soft);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.tool-icon {
  width: 19px;
  height: 19px;
  color: var(--cyan);
  transition: color 0.15s ease;
}

.tool-card h4 {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px;
  line-height: 1.3;
}

.tool-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  font-family: var(--sans);
}

/* Forces exactly 2 columns on small/medium tablets. Deliberately excludes
   phones (below ~481px) — two 230px-minimum cards plus the grid gap and page
   padding don't actually fit that narrow, so phones fall through to the base
   .card-grid rule above and get auto-fit's natural single column instead. */
@media (min-width: 481px) and (max-width: 640px) {
  .card-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.tool-panel {
  background: linear-gradient(160deg, var(--bg-panel), var(--bg-panel-2));
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 24px 28px;
  max-width: var(--panel-max);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.35);
}

.tool-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--cyan-soft);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.tool-back-link:hover {
  background: rgba(45, 226, 230, 0.2);
  box-shadow: 0 0 10px rgba(45, 226, 230, 0.25);
}

.tool-back-link svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.tool-panel h2 {
  margin-bottom: 6px;
  color: var(--text-primary);
}

.tool-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0;
  margin-bottom: 20px;
  font-family: var(--sans);
}

/* ===== Form elements ===== */
.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
  align-items: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--cyan);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.btn-copy {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 2px 9px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-panel-2);
  color: var(--text-secondary);
  cursor: pointer;
  text-transform: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn-copy:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-soft);
}

.btn-copy.copied {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
}

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.checkbox-field label {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 0.9rem;
  font-family: var(--mono);
  background: var(--bg-deep);
  color: var(--text-primary);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
}

textarea.large {
  min-height: 220px;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 14px var(--cyan-glow);
}

button {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 9px 16px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s, background 0.15s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--amber), var(--amber-dark));
  color: var(--amber-ink);
}

.btn-primary:hover {
  box-shadow: 0 0 18px var(--amber-glow);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: var(--cyan-soft);
  color: var(--cyan);
  border-color: rgba(45, 226, 230, 0.3);
}

.btn-secondary:hover {
  background: rgba(45, 226, 230, 0.2);
  box-shadow: 0 0 14px rgba(45, 226, 230, 0.3);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none !important;
}

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(45, 226, 230, 0.3);
  background: var(--bg-panel);
  color: var(--cyan);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s, visibility 0.2s;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  box-shadow: 0 0 16px rgba(45, 226, 230, 0.35);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

/* ===== Tool guide (collapsible how-to) ===== */
.tool-guide {
  background: var(--bg-panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 6px 14px;
  margin-bottom: 18px;
  font-size: 0.85rem;
  font-family: var(--sans);
}

.tool-guide summary {
  cursor: pointer;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--cyan);
  padding: 8px 0;
}

.tool-guide ul {
  margin: 4px 0 10px 0;
  padding-left: 20px;
  color: var(--text-secondary);
}

.tool-guide li {
  margin-bottom: 6px;
}

/* ===== Output panels (terminal style) ===== */
.output-panel {
  background: var(--bg-terminal);
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
  border-left: 2px solid var(--cyan);
  border-radius: 4px;
  padding: 14px 16px;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow-y: auto;
}

.output-panel .line-added {
  background: var(--green-soft);
  color: #86efac;
  display: block;
}

.output-panel .line-removed {
  background: var(--red-soft);
  color: #fca5a5;
  display: block;
}

.output-panel .line-unchanged {
  display: block;
  color: var(--text-secondary);
}

.output-panel mark {
  background: var(--amber);
  color: var(--amber-ink);
  border-radius: 2px;
  padding: 0 1px;
}

/* ===== Tables ===== */
/* Multi-column data tables (3+ columns) don't have room to wrap sensibly on a
   phone-width screen — letter-by-letter wrapping is worse than just letting the
   table scroll horizontally within its own box at natural column widths. A plain
   `table { display: block; overflow-x: auto }` does NOT achieve this (the table's
   internal layout still gets constrained to the block box's width, so columns
   squeeze instead of overflowing) — an actual wrapper element is required so the
   table can lay out at its natural width and the wrapper scrolls. See the
   `wrapResultTablesForScroll` MutationObserver in app.js, which wraps every
   .result-table in a .table-scroll div as it's added to the DOM. */
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 14px;
}

table.result-table {
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 100%;
  margin-bottom: 0;
}

table.result-table th, table.result-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  /* Deliberately NOT overflow-wrap:anywhere — that gives the browser license to
     break every cell mid-word to force-fit the available width, which is how
     multi-column headers ended up wrapping one letter per line on narrow
     screens. Normal word-boundary wrapping plus the .table-scroll horizontal
     scroll above is what actually keeps columns readable. */
  white-space: normal;
}

table.result-table th {
  color: var(--text-secondary);
  width: 40%;
  font-weight: 600;
  font-family: var(--mono);
  font-size: 0.82rem;
}

/* ===== Utility ===== */
/* These boxes routinely hold dynamically-generated long unbroken strings (hex
   digests, URLs, base64) — without overflow-wrap they force their own width
   past the viewport, and since they're plain block elements (not inside a
   scroll container like .table-scroll), that overflow propagates all the way
   up to the page body, causing the whole page to scroll horizontally on mobile. */
.error-box {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: 14px;
  overflow-wrap: anywhere;
}

.info-box {
  background: var(--cyan-soft);
  color: var(--cyan);
  border: 1px solid rgba(45, 226, 230, 0.3);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 14px;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.muted-box {
  background: var(--bg-panel-2);
  color: var(--text-secondary);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: 14px;
  overflow-wrap: anywhere;
}

.static-page h3 {
  margin-top: 22px;
  color: var(--text-primary);
}

.static-page .last-updated {
  margin-top: 24px;
}

/* ===== Fluid scaling for large / ultrawide monitors =====
   The sidebar stays a fixed width (it's navigation, not content), but the
   content column's max-width steps up at wider viewports so panels, tool
   forms, and the card grid actually use the extra horizontal space instead
   of leaving it empty next to a left-pinned layout. */
@media (min-width: 1440px) {
  :root {
    --content-max: 1440px;
    --panel-max: 1100px;
  }
}

@media (min-width: 1920px) {
  :root {
    --content-max: 1760px;
    --panel-max: 1280px;
  }

  .main-content {
    padding: 28px 40px 48px;
  }
}

@media (min-width: 2560px) {
  :root {
    --content-max: 2200px;
    --panel-max: 1480px;
  }

  .sidebar {
    width: 300px;
  }

  .main-content {
    padding: 32px 56px 56px;
  }
}

@media (min-width: 3200px) {
  :root {
    --content-max: 2760px;
    --panel-max: 1680px;
  }
}

/* ===== Responsive =====
   Below this width the sidebar stacks above the main content instead of
   sitting beside it, so the independent-scroll-region layout (which assumes
   two side-by-side columns each pinned to the viewport height) is dropped in
   favor of one normal, single scrolling page. */
@media (max-width: 860px) {
  :root {
    /* Matches the rendered height of .sidebar-header (logo row + search box)
       now that it's fixed-positioned — see the padding-top/top rules below. */
    --mobile-header-height: 150px;
  }

  .app-shell {
    flex-direction: column;
    height: auto;
    overflow: visible;
    /* Reserves space for the fixed header below so it doesn't render on top
       of (and hide) the first bit of the sidebar/page content. Kept in a
       custom property so both rules that need the number stay in sync. */
    padding-top: var(--mobile-header-height);
  }

  .sidebar {
    width: 100%;
    height: auto;
    box-shadow: none;
  }

  .mobile-nav-toggle {
    display: inline-flex;
  }

  /* The page itself scrolls on mobile (see .main-content below). A plain
     `position: sticky` here only holds the header in place for as long as
     its immediate parent (.sidebar) is on screen — and .sidebar is short on
     mobile (it's just this header once .sidebar-scroll is collapsed), so the
     header would scroll away as soon as .sidebar's own box scrolled past.
     `position: fixed` pins it to the viewport itself instead, independent of
     any ancestor's height — the .app-shell padding-top above is what makes
     room for it. */
  .sidebar-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
  }

  /* Collapsed by default so a visitor sees the page content first, not a
     100+-item tool list — tap the Menu button to expand it in place. */
  .sidebar-scroll {
    display: none;
    overflow-y: visible;
    margin-top: 14px;
  }

  .sidebar.nav-open .sidebar-scroll {
    display: block;
  }

  .ad-slot-sidebar {
    width: 100%;
    max-width: 300px;
    height: 160px;
  }

  .main-content {
    height: auto;
    overflow-y: visible;
    padding: 18px;
  }

  .ad-slot-top {
    height: 70px;
  }

  .field-row {
    flex-direction: column;
    align-items: stretch;
  }
}
