:root {
  /* Palette sampled from the logo artwork (stoichiolab-icon.png /
     stoichiolab-full.png): a deep Prussian-blue as the primary brand
     color, with the logo's teal ("Lab") kept as a secondary highlight. */
  --bg: #eef1f5;
  --panel: #ffffff;
  --panel-2: #f6f9fb;
  --border: #dde4ec;
  --text: #172431;
  --muted: #5d6b7a;
  --accent: #11648f;
  --accent-dark: #0b3c5d;
  --accent-soft: #e2edf6;
  --warn: #b85c5c;
  --warn-bg: #fbeceb;
  --ok-bg: #e7f1f8;
  --shadow: 0 1px 2px rgba(10,20,30,0.05), 0 8px 24px -12px rgba(10,20,30,0.14);
  /* Fixed brand blue for gradients/banners and text on permanently-white
     chips, kept as its own token (rather than reusing --accent-dark)
     since some contexts need this exact color regardless of theme. */
  --brand-deep: #0b3c5d;
  /* Secondary highlight lifted from the logo's teal "Lab" text -- used
     sparingly for decorative accents, not as the main interactive color. */
  --brand-teal: #12a08f;
  --panel-translucent: rgba(255,255,255,0.92);
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Space Grotesk", var(--sans);
  --mono: "IBM Plex Mono", "Consolas", "SFMono-Regular", Menlo, monospace;
}
* { box-sizing: border-box; }
a { color: var(--accent-dark); }
html { overflow-x: hidden; min-height: 100%; }
body {
  margin: 0;
  max-width: 100vw;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(17,100,143,0.07), transparent 45%),
    radial-gradient(circle at 100% 20%, rgba(18,160,143,0.06), transparent 40%);
  color: var(--text);
  line-height: 1.45;
}
header {
  background: linear-gradient(135deg, var(--brand-deep), var(--accent));
  color: #fff;
  padding: 30px 32px 26px;
  display: flex;
  align-items: center;
  gap: 16px;
}
header .icon {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
}
header .icon svg { width: 24px; height: 24px; }
header h1 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 23px;
  letter-spacing: -0.01em;
}
header p { margin: 0; font-size: 13.5px; opacity: 0.88; max-width: 680px; }
main {
  width: 100%;
  max-width: 1180px;
  margin: 28px auto;
  padding: 0 20px 70px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
@media (max-width: 900px) { main { grid-template-columns: 1fr; } }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.panel.full { grid-column: 1 / -1; }
.panel-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
}
.panel-heading.spaced { margin-top: 22px; }
.badge {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-family: var(--display);
  font-weight: 600;
  font-size: 12.5px;
  display: flex; align-items: center; justify-content: center;
}
.badge svg { width: 14px; height: 14px; }
.panel h2 {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.01em;
}
.panel .hint {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.55;
}
.panel .hint code {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent-dark);
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 8px 6px; text-align: left; }
thead th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--panel-2); }
tbody tr + tr td { border-top: 1px solid #eef0f2; }
input[type=text], input[type=number], select, textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13.5px;
  font-family: var(--mono);
  background: var(--panel-2);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type=text]:focus, input[type=number]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--panel);
}
textarea { font-family: var(--mono); resize: vertical; }
.row-actions button, .add-row {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 9px;
  font-family: var(--sans);
  transition: background 0.15s, color 0.15s;
}
.row-actions button:hover, .add-row:hover { background: var(--accent-soft); color: var(--accent-dark); }
.add-row { margin-top: 10px; font-weight: 600; }
.mode-toggle { display: flex; gap: 6px; margin-bottom: 10px; }
.mode-toggle label {
  flex: 1;
  text-align: center;
  padding: 7px 4px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mode-toggle input { display: none; }
.mode-toggle label:has(input:checked), .mode-toggle label.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.mode-note {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  background: var(--ok-bg);
  color: var(--accent-dark);
  border: 1px solid var(--border);
}
.mode-note.auto-wt { background: #fdf3e8; color: #8a5a1e; border-color: #f0dcbb; }
.quantity-row { display: flex; gap: 8px; align-items: center; }
.quantity-row input { flex: 1; }
.quantity-row select { width: 90px; }
.quick-entry {
  display: flex;
  gap: 8px;
  margin: 6px 0 16px;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.quick-entry input { font-size: 15px; padding: 9px 10px; background: var(--panel); }
.quick-entry button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.quick-entry button:hover { background: var(--brand-deep); }
.field-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-dark);
  display: block;
  margin-bottom: 6px;
}
.solve-btn {
  background: linear-gradient(135deg, var(--accent), var(--brand-deep));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 20px;
  font-family: var(--display);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 14px -4px rgba(17,100,143,0.45);
  transition: transform 0.1s, box-shadow 0.15s;
}
.solve-btn:hover { box-shadow: 0 6px 18px -4px rgba(17,100,143,0.55); }
.solve-btn:active { transform: translateY(1px); }
.error-box {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid #e4b9b6;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
  margin-top: 12px;
}
.stat-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.stat-tile {
  flex: 1 1 160px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.stat-tile .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.stat-tile .value { font-family: var(--display); font-size: 18px; font-weight: 600; color: var(--accent-dark); }
.stat-tile .value small { font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--muted); }
.results-table { margin-top: 4px; }
.results-table th { background: var(--panel-2); border-radius: 6px 6px 0 0; }
.results-table td.num, .results-table th.num { text-align: right; font-family: var(--mono); }
.section-label { font-size: 13px; font-weight: 700; margin: 18px 0 6px; color: var(--text); }
.results-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; margin-bottom: 14px; }
.results-actions button {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  font-family: var(--sans);
}
.results-actions button:hover { background: var(--accent-soft); }
.residual-ok { color: var(--accent-dark); }
.residual-bad { color: var(--warn); font-weight: 700; }
.batch-accordion { display: flex; flex-direction: column; gap: 8px; }
.batch-item { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.batch-item-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px 14px;
  font-family: var(--sans);
  text-align: left;
}
.batch-item-header:hover { background: var(--accent-soft); }
.batch-item-formula { flex: 1; font-family: var(--mono); font-size: 13.5px; font-weight: 600; color: var(--text); }
.batch-item-total { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.batch-item-chevron { color: var(--accent-dark); transition: transform 0.15s; }
.batch-item-header.open .batch-item-chevron { transform: rotate(180deg); }
.batch-item-header.open { background: var(--accent-soft); }
.batch-item-body { padding: 4px 14px 16px; border-top: 1px solid var(--border); }
.example-links { font-size: 12.5px; margin-top: 10px; }
.example-links a {
  color: var(--accent-dark);
  cursor: pointer;
  text-decoration: none;
  margin-right: 10px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  font-weight: 600;
}
.example-links a:hover { background: #cde2f0; }
.small-input { width: 80px; }
.recipe-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.recipe-row input[type="text"] { flex: 1 1 220px; }
.recipe-row select { flex: 1 1 190px; }
.recipe-row button {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 14px;
  font-family: var(--sans);
  white-space: nowrap;
}
.recipe-row button:hover { background: var(--accent-soft); }
.recipe-row button#saveRecipeBtn { background: var(--accent); color: #fff; border: none; }
.recipe-row button#saveRecipeBtn:hover { background: var(--brand-deep); }

.lit-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  margin-bottom: 16px;
}
.lit-btn:hover { background: var(--brand-deep); }
.lit-signature {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 12px 0 16px;
  font-size: 12.5px;
  color: var(--accent-dark);
}
.lit-signature svg { flex: none; width: 16px; height: 16px; }
.lit-signature code {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 7px;
  font-family: var(--mono);
  font-size: 12px;
}
.lit-tier-label { font-size: 12px; color: var(--muted); margin: 16px 0 8px; }
.lit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lit-item-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.lit-item-link:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.lit-item-icon {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center;
}
.lit-item-icon svg { width: 16px; height: 16px; }
.lit-item-body { flex: 1; min-width: 0; }
.lit-item-title { display: block; font-weight: 600; font-size: 13.5px; color: var(--accent-dark); line-height: 1.4; }
.lit-meta { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lit-journal { background: var(--panel); border: 1px solid var(--border); color: var(--accent-dark); border-radius: 5px; padding: 1px 7px; font-weight: 600; font-size: 11px; }
.lit-item-arrow { flex: none; width: 14px; height: 14px; margin-top: 3px; color: var(--muted); transition: color 0.15s, transform 0.15s; }
.lit-item-link:hover .lit-item-arrow { color: var(--accent); transform: translate(2px, -2px); }

/* =======================================================================
   Site-wide navigation (all 4 pages)
   ======================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--panel-translucent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
}
.brand { display: flex; align-items: center; text-decoration: none; color: var(--text); }
.brand-logo-full { display: block; height: 34px; width: auto; }
.brand-logo-icon { display: none; height: 34px; width: auto; }
.header-right { display: flex; align-items: center; gap: 10px; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 7px;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: var(--accent-soft); color: var(--accent-dark); }
.nav-links a.active { background: var(--accent); color: #fff; }

/* Hamburger toggle -- hidden on desktop, shown + wired up by nav.js below 640px */
.nav-toggle {
  display: none;
  flex: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 640px) {
  .site-header { padding: 12px 18px; }
  .brand-logo-full { display: none; }
  .brand-logo-icon { display: block; }
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 0 8px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, padding 0.25s ease;
  }
  .nav-links.open { max-height: 280px; padding: 8px; }
  .nav-links a { padding: 12px 14px; border-radius: 8px; }
}

/* =======================================================================
   Homepage: hero + feature cards + steps
   ======================================================================= */
.hero {
  position: relative;
  background: linear-gradient(135deg, var(--brand-deep), var(--accent));
  color: #fff;
  padding: 64px 28px;
  overflow: hidden;
}
.hero::before, .hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
}
.hero::before {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(255,255,255,0.10), transparent 70%);
  top: -180px; right: -120px;
}
.hero::after {
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(18,160,143,0.22), transparent 70%);
  bottom: -160px; left: -100px;
}
.hero-inner {
  position: relative;
  max-width: 1080px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}
.hero-copy, .hero-visual { min-width: 0; }
@media (max-width: 860px) { .hero-inner { grid-template-columns: 1fr; } }
.eyebrow-pill {
  display: inline-block;
  font-family: var(--display);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero h1 {
  font-family: var(--display);
  font-size: 42px;
  font-weight: 700;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.hero-copy p {
  max-width: 480px;
  margin: 0 0 26px;
  font-size: 15.5px;
  opacity: 0.92;
  line-height: 1.6;
}
.hero .cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.trust-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 22px;
  font-size: 12px;
  opacity: 0.72;
}
.trust-row span:nth-child(even) { opacity: 0.5; }

/* Hero visual: a small "reaction" mockup card echoing the calculator's own UI */
.hero-visual { display: flex; justify-content: center; }
.reaction-card {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 16px;
  padding: 26px 26px;
  backdrop-filter: blur(8px);
  width: 100%;
  max-width: 360px;
}
.reaction-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.reaction-row-wrap { flex-wrap: wrap; row-gap: 8px; }
.chip {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.28);
  padding: 6px 11px;
  border-radius: 8px;
  color: #fff;
  white-space: nowrap;
}
.chip-result { background: #fff; color: var(--brand-deep); border-color: #fff; font-size: 13.5px; }
.chip-plus { opacity: 0.7; font-size: 14px; }
.reaction-arrow { display: flex; justify-content: center; color: rgba(255,255,255,0.65); margin: 14px 0; }
.reaction-arrow svg { width: 12px; height: 26px; }
.reaction-mass {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed rgba(255,255,255,0.25);
  text-align: center;
}
.rm-label {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
  margin-bottom: 10px;
}
.rm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  text-align: left;
}
.rm-grid span { opacity: 0.85; }
.rm-grid b { display: block; font-size: 13px; margin-top: 1px; }
.rm-value { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.rm-value small { opacity: 0.55; font-weight: 400; }
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 9px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14.5px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}
.btn-primary { background: #fff; color: var(--brand-deep); }
.btn-primary:hover { box-shadow: 0 6px 18px -6px rgba(0,0,0,0.35); }
.btn-secondary { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.35); }
.btn-secondary:hover { background: rgba(255,255,255,0.2); }

.page-body {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 20px 70px;
}
.section-title {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.section-sub {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  max-width: 560px;
  margin: 0 auto 36px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 56px;
}
@media (max-width: 900px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .card-grid { grid-template-columns: 1fr; } }
.feature-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 22px;
  box-shadow: var(--shadow);
}
.feature-card .icon-badge {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.feature-card .icon-badge svg { width: 20px; height: 20px; stroke: var(--accent-dark); }
.feature-card h3 {
  font-family: var(--display);
  font-size: 16px;
  margin: 0 0 8px;
}
.feature-card p { font-size: 13.5px; color: var(--muted); margin: 0; line-height: 1.55; }

.steps-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 800px) { .steps-row { grid-template-columns: 1fr; } }
.step {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.step .step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.step h4 { font-size: 14.5px; margin: 0 0 6px; font-family: var(--display); }
.step p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }

/* =======================================================================
   Compact page banner (calculator / history / contact)
   ======================================================================= */
.page-banner {
  background: linear-gradient(135deg, var(--brand-deep), var(--accent));
  color: #fff;
  padding: 30px 28px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.page-banner h1 { margin: 0 0 6px; font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; }
.page-banner p { margin: 0 auto; font-size: 13.5px; opacity: 0.88; max-width: 680px; }

/* =======================================================================
   History page
   ======================================================================= */
.history-toolbar {
  width: 100%;
  max-width: 1180px;
  margin: 24px auto 0;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.history-toolbar p { font-size: 13px; color: var(--muted); margin: 0; }
.history-toolbar button {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--warn);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
}
.history-toolbar button:hover { background: var(--warn-bg); }
.history-list {
  width: 100%;
  max-width: 1180px;
  margin: 16px auto 70px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.history-empty a { color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.history-empty a:hover { text-decoration: underline; }
.history-empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 60px 20px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: var(--panel);
}
.history-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.history-card summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.history-card summary::-webkit-details-marker { display: none; }
.history-card .hc-title { font-family: var(--display); font-weight: 600; font-size: 14.5px; }
.history-card .hc-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.history-card .hc-chevron { color: var(--muted); font-size: 13px; transition: transform 0.15s; flex: none; }
.history-card[open] .hc-chevron { transform: rotate(90deg); }
.hc-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.hc-delete {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 6px;
  display: flex;
}
.hc-delete:hover { background: var(--warn-bg); color: var(--warn); }
.hc-delete svg { width: 15px; height: 15px; }
.history-card .hc-body { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }

/* =======================================================================
   Contact page
   ======================================================================= */
.contact-body {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px 70px;
}
.contact-body h2 { font-family: var(--display); font-size: 19px; margin: 28px 0 10px; }
.contact-body p { font-size: 14px; color: var(--muted); line-height: 1.6; }
.contact-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-top: 10px;
}
.contact-card dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; margin-top: 12px; }
.contact-card dt:first-child { margin-top: 0; }
.contact-card dd { margin: 3px 0 0; font-size: 14px; color: var(--text); font-family: var(--mono); }

/* =======================================================================
   Shared confirm-dialog modal (see modal.js) -- replaces native confirm()
   ======================================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 20, 30, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 20px 60px -12px rgba(10, 20, 30, 0.45);
  padding: 24px 26px;
  width: 100%;
  max-width: 400px;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.15s ease;
}
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }
.modal-title { margin: 0 0 8px; font-family: var(--display); font-size: 17px; font-weight: 700; color: var(--text); }
.modal-message { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal-btn {
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
}
.modal-btn-cancel { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.modal-btn-cancel:hover { background: var(--accent-soft); }
.modal-btn-confirm { background: var(--accent); color: #fff; }
.modal-btn-confirm:hover { background: var(--brand-deep); }
.modal-btn-confirm.modal-btn-danger { background: var(--warn); }
.modal-btn-confirm.modal-btn-danger:hover { background: #9c4a4a; }

/* =======================================================================
   Shared footer
   ======================================================================= */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 22px 28px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}
.site-footer a { color: var(--accent-dark); }

/* =======================================================================
   Print (calculator page "Print" button, and Ctrl+P in general) --
   keep the target/precursor/results record, drop everything chrome-y.
   ======================================================================= */
@media print {
  .site-header, .site-footer, .page-banner,
  .quick-entry, .example-links, .add-row, .row-actions,
  .solve-btn, .results-actions, #errorBox,
  .hint, .mode-toggle, .mode-note, .recipe-row, #recipeMsg,
  .lit-btn, #litResults { display: none !important; }
  body { background: #fff; }
  main { display: block; }
  .panel { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; margin-bottom: 16px; }
  input, select, textarea { border: none; background: none; color: #000; }
}
