/* Free email tools: forms, result cards and tables. Builds on client-page.css. */

:root {
  --pass: #15803d;
  --warn: #b45309;
  --fail: #b91c1c;
  --info: #57534e;
  --card: #fbf9f5;
  --mark-money: #fde68a;
  --mark-urgency: #fecaca;
  --mark-free: #bbf7d0;
  --mark-overpromise: #ddd6fe;
  --mark-shady: #fca5a5;
}

.nav-links { display: flex; gap: 1.5rem; align-items: center; }

.hero.tool-hero { padding-bottom: 2.5rem; }
.tool-hero h1 { font-size: clamp(2.25rem, 6vw, 4.25rem); max-width: 18ch; }
.tool-hero .tagline { margin-bottom: 2.25rem; }

.tool-panel {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 1.5rem;
  text-align: left;
  position: relative;
}

.field-row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 0.4rem; flex: 1 1 220px; min-width: 0; }
.field.narrow { flex: 0 1 180px; }
.field label, .field-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.tool-input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.75rem 0.9rem;
  transition: border-color 0.2s;
}
.tool-input:focus, .tool-textarea:focus { outline: none; border-color: rgba(0,0,0,0.35); }
.tool-input.mono, .tool-textarea { font-family: 'JetBrains Mono', monospace; font-size: 0.8125rem; }
.tool-textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  color: var(--text);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.8rem 0.9rem;
  line-height: 1.55;
}
.tool-textarea.short { min-height: 0; height: 3.1rem; font-family: 'Inter', sans-serif; font-size: 1rem; }
.run-btn {
  flex: 0 0 auto;
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.85rem 1.6rem;
  cursor: pointer;
  transition: all 0.25s;
  min-height: 2.9rem;
}
.run-btn:hover { background: transparent; color: var(--accent); }
.run-btn:disabled { opacity: 0.55; cursor: progress; }
.run-btn.secondary { background: transparent; color: var(--accent); border-color: var(--line); }
.run-btn.secondary:hover { border-color: var(--accent); }
.tool-hint { font-size: 0.8125rem; color: var(--text-dim); line-height: 1.55; margin-top: 0.85rem; }
.tool-hint code, .card code, .prose code, .section-sub code { font-family: 'JetBrains Mono', monospace; font-size: 0.85em; background: var(--code-bg); border: 1px solid var(--line); border-radius: 3px; padding: 0.05rem 0.3rem; overflow-wrap: anywhere; }
.tool-hint a, .card a, .prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 0.15em; }
.tool-error { color: var(--fail); font-size: 0.875rem; margin-top: 0.75rem; min-height: 1.2em; }
.tool-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }

.dropzone {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 2.25rem 1.25rem;
  text-align: center;
  color: var(--text-dim);
  background: var(--code-bg);
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}
.dropzone strong { color: var(--text); display: block; font-size: 1.0625rem; margin-bottom: 0.4rem; font-weight: 600; }
.dropzone.over { border-color: var(--accent); background: #fff; }
.dropzone small { display: block; margin-top: 0.5rem; font-size: 0.8125rem; }

/* Results */
.results { width: 100%; max-width: 840px; margin: 0 auto; padding: 0 2rem 3rem; scroll-margin-top: 5.5rem; }
.results:empty { display: none; }
.results-status { text-align: center; color: var(--text-dim); font-size: 0.9375rem; padding: 2rem 0; }
.spinner { display: inline-block; width: 0.9rem; height: 0.9rem; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -0.12rem; margin-right: 0.5rem; }
@keyframes spin { to { transform: rotate(360deg); } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-top: 1.25rem;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.card-title { font-weight: 600; font-size: 1rem; color: var(--accent); }
.card-headline { color: var(--text-dim); font-size: 0.9375rem; flex: 1 1 200px; }
.card-body { padding: 1.1rem 1.25rem 1.25rem; }
.card-body > * + * { margin-top: 1rem; }
.card-sub { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--text-dim); overflow-wrap: anywhere; }
.card-link { margin-left: auto; font-size: 0.8125rem; }
section.card { padding: 0; max-width: none; margin: 1.25rem 0 0; }
details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .chev { margin-left: auto; color: var(--text-dim); transition: transform 0.2s; }
details.card[open] > summary .chev { transform: rotate(90deg); }
details.card:not([open]) > summary { border-bottom: 0; }

.pill {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.22rem 0.6rem;
  border-radius: 3px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.pill.pass { color: var(--pass); background: rgba(21,128,61,0.07); }
.pill.warn { color: var(--warn); background: rgba(180,83,9,0.07); }
.pill.fail, .pill.listed { color: var(--fail); background: rgba(185,28,28,0.07); }
.pill.info, .pill.unavailable, .pill.clean-dim { color: var(--info); background: rgba(87,83,78,0.06); }
.pill.error { color: var(--fail); background: transparent; border-style: dashed; }
.pill.clean { color: var(--pass); background: rgba(21,128,61,0.07); }

.record {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  padding: 0.8rem 4.5rem 0.8rem 0.9rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: var(--text);
}
.copy-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  font: inherit;
  font-family: 'Inter', sans-serif;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  border-radius: 3px;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

.findings { list-style: none; display: flex; flex-direction: column; gap: 0.55rem; }
.findings li {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: 0.6rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
  overflow-wrap: anywhere;
}
.findings li::before {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-align: center;
  line-height: 1.55;
}
.findings li.pass::before { content: '✓'; color: var(--pass); }
.findings li.warn::before { content: '!'; color: var(--warn); }
.findings li.fail::before { content: '✕'; color: var(--fail); }
.findings li.info::before { content: 'i'; color: var(--info); font-style: italic; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 5px; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.data th, table.data td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.5; }
table.data tr:last-child td { border-bottom: 0; }
table.data th { font-family: 'JetBrains Mono', monospace; font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); font-weight: 500; background: var(--code-bg); white-space: nowrap; }
table.data td.mono, table.data .mono { font-family: 'JetBrains Mono', monospace; font-size: 0.8125rem; overflow-wrap: anywhere; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.dim { color: var(--text-dim); }
table.data tr.lvl-fail td:first-child { box-shadow: inset 3px 0 0 var(--fail); }
table.data tr.lvl-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
table.tags td:first-child { white-space: nowrap; font-family: 'JetBrains Mono', monospace; font-size: 0.8125rem; color: var(--accent); }
table.tags td:nth-child(2) { font-family: 'JetBrains Mono', monospace; font-size: 0.8125rem; overflow-wrap: anywhere; max-width: 16rem; }
table.tags td:nth-child(3) { color: var(--text-dim); }
table.tags.terms td:nth-child(2) { font-family: inherit; font-size: inherit; color: var(--text-dim); max-width: none; overflow-wrap: normal; }
table.data td.nowrap { white-space: nowrap; overflow-wrap: normal; }
table.data tr.advice td { padding-top: 0; color: var(--text-dim); font-size: 0.8125rem; }
table.data tr.has-advice td { border-bottom: 0; }

.tree { list-style: none; font-family: 'JetBrains Mono', monospace; font-size: 0.8125rem; line-height: 1.7; }
.tree ul { list-style: none; margin-left: 1.1rem; border-left: 1px solid var(--line); padding-left: 0.8rem; }
.tree .cost { color: var(--text-dim); }
.tree .err { color: var(--fail); }

.section-label { font-family: 'JetBrains Mono', monospace; font-size: 0.6875rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 0.6rem; }

/* Domain check summary */
.score-card { display: grid; grid-template-columns: auto 1fr; gap: 1.75rem; align-items: center; padding: 1.5rem 1.25rem; }
.score-ring { position: relative; width: 132px; height: 132px; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; font-size: 2.4rem; color: var(--accent); line-height: 1; }
.score-ring .num small { font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); margin-top: 0.35rem; font-family: 'JetBrains Mono', monospace; }
.score-meta h3 { font-size: 1.25rem; color: var(--accent); margin-bottom: 0.35rem; overflow-wrap: anywhere; }
.score-meta p { color: var(--text-dim); font-size: 0.9375rem; line-height: 1.5; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1px; padding-top: 1px; }
.check-tile { background: var(--card); padding: 0.9rem 1rem; text-decoration: none; display: block; color: inherit; outline: 1px solid var(--line); }
.card a.check-tile { text-decoration: none; color: inherit; }
.check-tile:hover { background: #fff; }
.check-tile .t { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.9375rem; color: var(--accent); margin-bottom: 0.35rem; }
.check-tile .h { font-size: 0.8125rem; color: var(--text-dim); line-height: 1.45; }
.fix-list { list-style: none; counter-reset: fix; display: flex; flex-direction: column; gap: 0.75rem; }
.fix-list li { counter-increment: fix; display: grid; grid-template-columns: 1.6rem 1fr; gap: 0.6rem; font-size: 0.9rem; line-height: 1.55; overflow-wrap: anywhere; }
.fix-list li::before { content: counter(fix); font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; background: var(--accent); color: var(--bg); width: 1.4rem; height: 1.4rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; margin-top: 0.1rem; }
.fix-list strong { color: var(--accent); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.stat { background: var(--card); padding: 0.9rem 1rem; }
.stat .v { font-size: 1.5rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .k { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.2rem; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--pass); }

.kv { display: grid; grid-template-columns: minmax(7rem, max-content) 1fr; gap: 0.35rem 1rem; font-size: 0.875rem; }
.kv dt { color: var(--text-dim); }
.kv dd { overflow-wrap: anywhere; color: var(--text); }

.badges { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.badge { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; padding: 0.3rem 0.6rem; border-radius: 3px; border: 1px solid var(--line); background: var(--bg); }
.badge.pass { color: var(--pass); border-color: rgba(21,128,61,0.4); }
.badge.fail { color: var(--fail); border-color: rgba(185,28,28,0.4); }
.badge.warn { color: var(--warn); border-color: rgba(180,83,9,0.4); }

/* Message viewer */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { font: inherit; font-size: 0.8125rem; background: none; border: 0; border-bottom: 2px solid transparent; padding: 0.7rem 1rem; color: var(--text-dim); cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.eml-frame { width: 100%; min-height: 520px; border: 1px solid var(--line); border-radius: 5px; background: #fff; display: block; }
.raw-view { max-height: 560px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; line-height: 1.55; background: var(--code-bg); border: 1px solid var(--line); border-radius: 5px; padding: 0.9rem; }
.notice { font-size: 0.8125rem; color: var(--text-dim); background: var(--code-bg); border: 1px solid var(--line); border-radius: 5px; padding: 0.6rem 0.8rem; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.notice .linkish { font-size: 0.8125rem; }
.cta-strip { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--accent); color: var(--bg); border-radius: 6px; padding: 1rem 1.25rem; margin-top: 1.25rem; }
.cta-strip p { font-size: 0.9375rem; line-height: 1.5; flex: 1 1 260px; }
.cta-strip .run-btn { background: var(--bg); color: var(--accent); border-color: var(--bg); }
.cta-strip .run-btn:hover { background: transparent; color: var(--bg); }
.logo-preview { display: flex; gap: 1rem; align-items: center; }
.logo-preview img { width: 72px; height: 72px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.logo-preview img.round { border-radius: 50%; }

/* Copy checker */
.risk { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.risk-meter { flex: 1 1 200px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--pass), #ca8a04 50%, var(--fail)); position: relative; }
.risk-meter i { position: absolute; top: -4px; width: 4px; height: 18px; background: var(--accent); border-radius: 2px; transform: translateX(-2px); }
.risk-label { font-weight: 700; font-size: 1.125rem; text-transform: capitalize; }
.risk-label.low { color: var(--pass); }
.risk-label.medium { color: var(--warn); }
.risk-label.high { color: var(--fail); }
.highlight { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9rem; line-height: 1.65; background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 0.9rem 1rem; max-height: 420px; overflow-y: auto; }
.highlight mark { border-radius: 2px; padding: 0 1px; color: inherit; }
mark.m-money { background: var(--mark-money); }
mark.m-urgency { background: var(--mark-urgency); }
mark.m-free { background: var(--mark-free); }
mark.m-overpromise { background: var(--mark-overpromise); }
mark.m-shady { background: var(--mark-shady); }
mark.m-caps { background: transparent; text-decoration: underline wavy var(--warn); text-underline-offset: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-size: 0.75rem; color: var(--text-dim); }
.legend span::before { content: ''; display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 2px; margin-right: 0.35rem; vertical-align: -0.05rem; }
.legend .l-money::before { background: var(--mark-money); }
.legend .l-urgency::before { background: var(--mark-urgency); }
.legend .l-free::before { background: var(--mark-free); }
.legend .l-overpromise::before { background: var(--mark-overpromise); }
.legend .l-shady::before { background: var(--mark-shady); }
.cat-list { display: grid; gap: 0.9rem; }
.cat h4 { font-size: 0.9375rem; color: var(--accent); margin-bottom: 0.25rem; }
.cat p { font-size: 0.875rem; color: var(--text-dim); line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
.chip { font-size: 0.75rem; font-family: 'JetBrains Mono', monospace; padding: 0.15rem 0.5rem; border-radius: 3px; border: 1px solid var(--line); background: var(--bg); }

/* Explainer content */
.prose { max-width: 680px; margin: 0 auto; font-size: 1rem; line-height: 1.7; color: var(--text); font-weight: 300; }
.prose p + p { margin-top: 1rem; }
.prose strong { font-weight: 600; }
.explain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 2.5rem; }
.explain { background: var(--bg); padding: 1.5rem 1.4rem; }
.explain h3 { font-size: 0.9375rem; font-weight: 600; color: var(--accent); margin-bottom: 0.5rem; }
.explain h3 code { font-family: 'JetBrains Mono', monospace; font-size: 0.875rem; }
.explain p { font-size: 0.875rem; line-height: 1.6; color: var(--text-dim); font-weight: 300; }
.explain p code { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; color: var(--text); }
.faq { max-width: 720px; margin: 0 auto; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 1.1rem 0; font-weight: 600; color: var(--accent); list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--text-dim); font-weight: 400; }
.faq details[open] summary::after { content: '–'; }
.faq details p { padding: 0 0 1.2rem; color: var(--text-dim); font-size: 0.9375rem; line-height: 1.65; font-weight: 300; }
.faq details p code { font-family: 'JetBrains Mono', monospace; font-size: 0.85em; color: var(--text); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1px; padding: 1px; }
.tool-card { background: var(--bg); padding: 1.4rem 1.3rem; text-decoration: none; color: inherit; display: block; transition: background 0.2s; outline: 1px solid var(--line); }
.tool-card:hover { background: #fff; }
.tool-card h3 { font-size: 0.9375rem; font-weight: 600; color: var(--accent); margin-bottom: 0.4rem; }
.tool-card p { font-size: 0.8125rem; color: var(--text-dim); line-height: 1.5; font-weight: 300; }
.tool-card.featured { grid-column: 1 / -1; }
.tool-group-title { font-family: 'JetBrains Mono', monospace; font-size: 0.6875rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-dim); margin: 2.5rem 0 0.9rem; }
.tool-group-title:first-child { margin-top: 0; }

@media (max-width: 768px) {
  .results { padding: 0 1.5rem 2.5rem; }
  .tool-panel { padding: 1.1rem; }
  .run-btn { width: 100%; }
  .score-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .nav-links { gap: 1rem; }
  .nav-links .hide-sm { display: none; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 0.4rem; }
  .eml-frame { min-height: 420px; }
}

.auth-line { display: flex; gap: 0.5rem; align-items: flex-start; }
.auth-line + .auth-line { margin-top: 0.35rem; }
.auth-k { font-family: 'JetBrains Mono', monospace; font-size: 0.6875rem; color: var(--text-dim); width: 2.4rem; flex: 0 0 auto; padding-top: 0.3rem; }
table.data td .pill { white-space: normal; max-width: 9.5rem; line-height: 1.35; text-align: center; }
table.data tr.advice .pill { white-space: nowrap; max-width: none; margin-right: 0.4rem; }
