/* MoneyHub — styles */
:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #047857;
  --brand-strong: #065f46;
  --accent: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  background: linear-gradient(135deg, #022c22, #065f46 55%, #047857);
  color: #fff;
  padding: 18px 0;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark { font-size: 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 18px; letter-spacing: -0.01em; }
.brand-text small { opacity: 0.85; font-size: 12px; }
.header-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.currency-label { font-size: 12px; opacity: 0.9; }
.currency-select {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.currency-select option { color: #0f172a; }
.currency-note { font-size: 11px; opacity: 0.8; margin: 0; flex-basis: 100%; text-align: right; }

/* Hero */
.hero { text-align: center; padding: 34px 0 18px; }
.hero h1 { font-size: clamp(24px, 4vw, 34px); margin: 0 0 8px; letter-spacing: -0.02em; }
.hero p { color: var(--muted); margin: 0; font-size: 15px; }

/* Tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 14px; }
.tab {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab:hover { border-color: var(--brand); color: var(--brand); }
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Panels */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 26px;
}
.panel h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.01em; }
.lede { color: var(--muted); margin: 0 0 16px; font-size: 14px; }

/* Forms */
.calc-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input,
.field select {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 15px;
  background: #fbfdff;
  color: var(--ink);
  width: 100%;
}
.field input:focus,
.field select:focus {
  outline: 2px solid rgba(4, 120, 87, 0.35);
  border-color: var(--brand);
}

/* Slider + stepper controls (Round 5 UI/UX — replace typing with a control) */
.slider-field { grid-column: 1 / -1; } /* full-width rows give the slider room */
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.field-head label { margin: 0; }
.live-value { font-size: 12px; font-weight: 700; color: var(--brand-strong); white-space: nowrap; }
.slider-row { display: flex; align-items: center; gap: 8px; }
.ctl-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) var(--fill, 0%), var(--line) var(--fill, 0%));
  outline: none;
  cursor: pointer;
  margin: 4px 0;
}
.ctl-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--brand);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  cursor: grab;
}
.ctl-slider:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.08); }
.ctl-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--brand);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  cursor: grab;
}
.slider-row input[type="number"] { flex: 0 0 92px; text-align: right; }
.btn-stepper {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.btn-stepper:hover { border-color: var(--brand); color: var(--brand); }
.btn-stepper:active { background: var(--brand); border-color: var(--brand); color: #fff; transform: translateY(1px); }

/* Segmented radio group (compounding frequency) */
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: #f8fafc;
  align-self: flex-start;
}
.seg-btn {
  border: 0;
  padding: 9px 14px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn:hover { color: var(--brand); }
.seg-btn:active { background: #ecfdf5; color: var(--brand-strong); }
.seg-btn.selected { background: var(--brand); color: #fff; }
.seg-btn.selected + .seg-btn { border-left-color: transparent; }
.seg-btn.selected:active { background: var(--brand-strong); color: #fff; }

/* Results */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.stat {
  background: #f0fdf4;
  border: 1px solid #d1fae5;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-wide { grid-column: 1 / -1; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--brand-strong); }
.milestone {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: #78350f;
}

/* Charts */
.chart-wrap { grid-column: 1 / -1; margin-top: 8px; }
.chart-wrap canvas {
  width: 100%;
  height: 220px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

/* Actions */
.actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.btn {
  display: inline-block;
  border: none;
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn-share { background: var(--brand); color: #fff; }
.btn-share:hover { background: var(--brand-strong); }
.btn-share:active { background: #03563e; }
.btn-ko-fi { background: #c2410c; color: #fff; }  /* 4.5:1+ on #c2410c (contrast fix, 2026-11-09) */
.btn-ko-fi:active { background: #9a3412; }  /* contrast fix 2026-11-09 */
.btn-paypal { background: #1e3a8a; color: #fff; }
.btn-paypal:active { background: #172a6e; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* Pressed feedback shared by every button */
.btn:active { transform: translateY(1px); }
.btn-sm:active { transform: translateY(1px); }
.tab:active { background: var(--brand); border-color: var(--brand); color: #fff; }
.debt-remove:active { color: #9f1239; transform: scale(0.94); }

/* Transient click flash — added by app.js click delegation, removed ~300ms later */
@keyframes click-flash {
  0% { filter: brightness(1.4); transform: scale(0.97); }
  100% { filter: brightness(1); transform: scale(1); }
}
.clicked { animation: click-flash 300ms ease; }

/* Result recompute flash — added by each compute(), removed ~700ms later */
@keyframes result-flash {
  0% { background-color: #a7f3d0; box-shadow: 0 0 0 2px rgba(4, 120, 87, 0.25); }
  100% { background-color: #f0fdf4; box-shadow: 0 0 0 0 rgba(4, 120, 87, 0); }
}
.results.flash { animation: result-flash 700ms ease; }
.results.flash .stat { animation: result-flash 700ms ease; }

/* FAQ */
.faq { margin: 8px 0 28px; }
.faq h2 { font-size: 18px; }
.faq details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
}
.faq summary { font-weight: 600; cursor: pointer; }
.faq p { color: var(--muted); margin: 8px 0 0; font-size: 14px; }

/* Footer */
.site-footer { background: #0f172a; color: #cbd5e1; padding: 30px 0 26px; margin-top: 20px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.site-footer strong { color: #fff; }
.fineprint { font-size: 12px; color: #94a3b8; margin: 6px 0 0; }
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-links a { color: #cbd5e1; text-decoration: none; font-size: 14px; }
.footer-links a:hover { color: #fff; text-decoration: underline; }
.footer-donate { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ad-slot { margin-top: 24px; text-align: center; }
.ad-placeholder {
  border: 1px dashed #334155;
  border-radius: 8px;
  color: #64748b;
  font-size: 12px;
  padding: 10px;
  margin-bottom: 8px;
}

/* Toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 50;
}

/* Guides / static pages */
.site-header.guide { margin-bottom: 0; }
.guide-body { max-width: 760px; margin: 0 auto; padding: 30px 20px 40px; }
.guide-body h1 { font-size: 26px; letter-spacing: -0.02em; }
.guide-body h2 { font-size: 19px; margin-top: 28px; }
.guide-body p { color: #334155; }
.guide-body .fineprint { color: var(--muted); }
.guide-body ul { color: #334155; }

@media (max-width: 560px) {
  .results { grid-template-columns: 1fr 1fr; }
  .stat-wide { grid-column: 1 / -1; }
  .header-inner { justify-content: center; text-align: center; }
}

/* Debt payoff rows */
.fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.fieldset legend { font-size: 0.9rem; color: var(--muted); padding: 0 6px; }
.debt-row { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.debt-row input { flex: 1; min-width: 90px; }
.debt-remove { flex: 0 0 auto; align-self: center; border: 0; background: transparent; color: var(--err, #e11d48); font-size: 1rem; cursor: pointer; }


/* Hub rail — internal links across the tool network */
.hub { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hub a {
  color: inherit; opacity: 0.92; text-decoration: none; font-size: 0.9em;
  font-size: 0.8em; padding: 2px 8px; border: 1px solid currentColor; border-radius: 999px;
}
.hub a:hover { opacity: 1; }

/* >>> theme-by-name (2026-11-02) >>> */
/* Theme derived from the site's MEANING, not a random variant.
 * Money and trust = forest green on paper, with serif numerals. Reads like a ledger, not a casino.
 * Ad layout is deliberately NOT set here — container width and rail geometry are
 * measured and verified separately by check-ad-layout.mjs.
 */
:root {
  --bg: #f7faf8;
  --card: #ffffff;
  --ink: #0f1f18;
  --muted: #55665d;
  --line: #dde7e1;
  --brand: #065f46;
  --brand-strong: #065f46;
  --accent: #0d9488;
  --radius: 6px;
  --font-sans: 'Source Serif Pro', Georgia, 'Times New Roman', serif;
}
body { font-family: var(--font-sans); background: var(--bg); color: var(--ink); }
h1, h2, h3 { font-family: var(--font-sans); font-weight: 600; letter-spacing: -0.015em; }
.card, .panel, section[class*="card"] { border-radius: var(--radius); }
/* <<< theme-by-name <<< */

/* ── image-compressor tool styles (2026-11-07) ───────────────────────────── */
:root { --accent: #0f766e; --bad: #b91c1c; --good: #15803d; }
.dropzone{border:2px dashed #cbd5e1;border-radius:14px;padding:38px 20px;text-align:center;
  cursor:pointer;transition:border-color .15s,background .15s;background:#fafafa}
.dropzone:hover,.dropzone:focus-visible,.dropzone.is-over{border-color:var(--accent);background:#f0fdfa;outline:none}
.dropzone__title{margin:0 0 6px;font-size:17px;font-weight:600}
.dropzone__hint{margin:0;color:#64748b;font-size:13px}
.controls{display:flex;flex-wrap:wrap;gap:16px;align-items:center;margin:20px 0}
.controls label{font-size:14px;color:#334155}
.controls input[type=range]{width:200px;accent-color:var(--accent)}
.controls input[type=number]{width:78px;padding:4px 6px;border:1px solid #cbd5e1;border-radius:6px}
.checkbox{display:flex;align-items:center;gap:6px}
.summary{background:#ecfdf5;border-left:4px solid var(--good);padding:10px 14px;border-radius:8px;
  font-size:14px;margin:14px 0}
.results{list-style:none;padding:0;margin:16px 0}
.result{border:1px solid #e2e8f0;border-radius:10px;padding:12px 14px;margin-bottom:10px;background:#fff}
.result--bad{border-color:#fecaca;background:#fef2f2;color:var(--bad)}
.result__head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:4px}
.result__meta{color:#64748b;font-size:13px;margin-bottom:8px}
.result .good{color:var(--good);font-weight:600}
.result .muted{color:#94a3b8}
.btn-sm{display:inline-block;padding:6px 12px;font-size:13px}
@media (max-width:640px){ .controls{gap:10px} .controls input[type=range]{width:140px} }

/* ── markdown-tools styles (2026-11-07) ──────────────────────────────────── */
:root { --accent: #7c3aed; }
.tabs{display:flex;gap:8px;margin-bottom:18px;flex-wrap:wrap}
.tab{padding:9px 16px;border:1px solid #cbd5e1;background:#fff;border-radius:999px;cursor:pointer;font-size:14px;color:#334155}
.tab.is-active{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:600}
.split{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:16px 0}
.split__pane{min-width:0}
.pane-label{display:block;font-size:13px;font-weight:600;color:#475569;margin-bottom:6px}
#source,#before,#after{width:100%;min-height:320px;padding:12px;border:1px solid #cbd5e1;border-radius:10px;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;line-height:1.55;resize:vertical}
.markdown-body{min-height:320px;padding:12px 16px;border:1px solid #e2e8f0;border-radius:10px;background:#fff;overflow-x:auto}
.markdown-body h1{font-size:1.6em}.markdown-body h2{font-size:1.3em}.markdown-body h3{font-size:1.1em}
.markdown-body pre{background:#f6f8fa;padding:10px;border-radius:8px;overflow-x:auto}
.markdown-body code{background:#f6f8fa;padding:.12em .3em;border-radius:4px;font-size:.9em}
.markdown-body pre code{background:none;padding:0}
.markdown-body table{border-collapse:collapse;margin:10px 0}
.markdown-body th,.markdown-body td{border:1px solid #d0d7de;padding:.35rem .6rem}
.markdown-body blockquote{border-left:4px solid #d0d7de;margin:0;padding-left:1rem;color:#57606a}
.markdown-body img{max-width:100%}
.stats{color:#64748b;font-size:12px;margin-top:6px}
.diff{border:1px solid #e2e8f0;border-radius:10px;overflow:auto;max-height:60vh;font-family:ui-monospace,Menlo,monospace;font-size:12.5px;background:#fff}
.diff-row{display:flex;gap:8px;padding:1px 8px;white-space:pre-wrap;word-break:break-word}
.diff-num{flex:0 0 38px;text-align:right;color:#94a3b8;user-select:none}
.diff-sign{flex:0 0 12px;user-select:none}
.diff-text{flex:1}
.diff-add{background:#e6ffec}
.diff-del{background:#ffebe9}
.diff-gap{background:#f8fafc;color:#64748b;font-style:italic}
.summary{background:#f5f3ff;border-left:4px solid var(--accent);padding:10px 14px;border-radius:8px;margin:14px 0;font-size:14px}
.error{color:#b91c1c;background:#fef2f2;border-left:4px solid #b91c1c;padding:10px 14px;border-radius:8px}
.btn-ghost{background:#fff;color:#334155;border:1px solid #cbd5e1}
@media (max-width:820px){ .split{grid-template-columns:1fr} #source,#before,#after{min-height:200px} }

/* Side-by-side diff (2026-11-08, owner request: "compare side by side like a diff viewer") */
.diff-sbs{display:grid;grid-template-columns:1fr 1fr;gap:0;border:1px solid #e2e8f0;border-radius:10px;
  overflow:hidden;background:#fff;font-family:ui-monospace,Menlo,monospace;font-size:12.5px;height:60vh}
.diff-sbs__col{min-width:0;overflow-y:auto;overflow-x:auto;height:60vh;max-height:60vh}
/* Synchronised scrolling (2026-11-08, owner): the two columns are separate
   scroll boxes, so without this the left can sit at line 10 while the right is
   at line 200 and the comparison is meaningless. JS pins them together. */
.diff-sbs__head{position:sticky;top:0;background:#f1f5f9;padding:6px 10px;font-weight:700;font-size:12px;
  color:#334155;border-bottom:1px solid #e2e8f0;display:flex;justify-content:space-between}
.diff-sbs__col + .diff-sbs__col{border-left:1px solid #e2e8f0}
.sbs-row{display:flex;gap:8px;padding:1px 8px;white-space:pre-wrap;word-break:break-word;min-height:1.5em}
.sbs-row .diff-num{flex:0 0 34px;text-align:right;color:#94a3b8;user-select:none}
.sbs-row .diff-text{flex:1}
.sbs-add{background:#e6ffec}
.sbs-del{background:#ffebe9}
.sbs-empty{background:#f8fafc}
.sbs-gap{background:#f8fafc;color:#64748b;font-style:italic;grid-column:1/-1;padding:2px 10px}
@media (max-width:820px){ .diff-sbs{grid-template-columns:1fr} .diff-sbs__col + .diff-sbs__col{border-left:none;border-top:1px solid #e2e8f0} }

/* Privacy architecture section (2026-11-08) — the selling point of every site. */
.privacy-section{margin-top:34px;padding-top:24px;border-top:2px solid #e2e8f0}
.privacy-section h2{font-size:1.35em;margin-bottom:10px}
.privacy-section h3{font-size:1.05em;margin:20px 0 8px}
.privacy-steps{margin:10px 0 14px;padding-left:22px}
.privacy-steps li{margin-bottom:8px;line-height:1.6}
.privacy-section kbd{background:#f1f5f9;border:1px solid #cbd5e1;border-bottom-width:2px;
  border-radius:4px;padding:1px 5px;font-size:.85em;font-family:ui-monospace,Menlo,monospace}

/* ===== HERO TOOL CARD (2026-11-13) =====
   The tool IS the product. Before this, `class="tool-card"` existed in the
   markup of all six sites with no matching rule — so the primary feature sat in
   the same visual plane as the prose below it and nothing drew the eye (the
   owner's "the main feature is not emphasised" report). A real card with an
   accent edge, a soft shadow and extra breathing room makes it the focal point
   without changing any behaviour or markup. */
.tool-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 14px;
  padding: 22px 22px 20px;
  margin: 26px 0 30px;
  box-shadow: 0 10px 30px rgba(15, 31, 24, .07), 0 2px 6px rgba(15, 31, 24, .04);
}
.tool-card > h2:first-child,
.tool-card > h1:first-child { margin-top: 0; }
@media (max-width: 560px) {
  .tool-card { padding: 16px 14px 15px; border-radius: 12px; margin: 18px 0 22px; }
}
