/* Proxico Split Desk × Wire — tools-splitwire shell
   Teal #0d9488 · translucent glass buttons · no purple/indigo */

:root {
  --sw-bg: #f4f7f6;
  --sw-doc: #ffffff;
  --sw-border: #e2e8e6;
  --sw-text: #0f172a;
  --sw-muted: #64748b;
  --sw-teal: #0d9488;
  --sw-teal-deep: #0f766e;
  --sw-teal-ink: #115e59;     /* text on teal glass (AA) */
  --sw-muted-ink: #475569;    /* muted text on tinted surfaces (AA) */
  --sw-teal-soft: #f0fdfa;
  --sw-teal-glow: rgba(13,148,136,0.18);
  --sw-teal-border: rgba(13,148,136,0.35);
  --sw-green: #059669;
  --sw-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.05);
  --sw-shadow-lg: 0 12px 40px rgba(15,23,42,.10);
  --teal: #0d9488;
  --teal-soft: #f0fdfa;
}

/* Glass button system — Send vertical centering fixed */
.btn-glass,
.btn-primary,
.btn-ghost,
a.btn-primary,
a.btn-ghost,
button.btn,
a.btn,
.btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: background .18s, color .18s, box-shadow .18s, transform .12s, border-color .18s;
}

.btn-glass {
  background: rgba(13,148,136,0.18);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(13,148,136,0.35);
  color: var(--sw-teal-ink);
}
.btn-glass:hover {
  background: rgba(13,148,136,0.32); color: #0f766e;
  box-shadow: 0 4px 16px rgba(13,148,136,0.18);
}

/* Primary = stronger glass, still translucent (never solid fill) */
.btn-primary,
a.btn-primary,
.btn.btn-primary,
#btn-mail,
#btn-mail-self,
#a-mail,
#btnSend,
button.btn-primary {
  background: rgba(13,148,136,0.22) !important;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(13,148,136,0.45) !important;
  color: #0f766e !important;
  font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn-primary:hover,
a.btn-primary:hover,
.btn.btn-primary:hover,
#btn-mail:hover,
#btn-mail-self:hover,
#a-mail:hover,
#btnSend:hover {
  background: rgba(13,148,136,0.34) !important;
  color: #0f766e !important;
  border-color: rgba(13,148,136,0.60) !important;
  box-shadow: 0 4px 18px rgba(13,148,136,0.18), inset 0 1px 0 rgba(255,255,255,0.4);
}

.btn-ghost,
a.btn-ghost,
.btn.btn-ghost {
  background: rgba(255,255,255,0.45) !important;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(15,23,42,0.10) !important;
  color: var(--sw-muted) !important;
}
.btn-ghost:hover,
a.btn-ghost:hover {
  background: rgba(255,255,255,0.85) !important;
  color: var(--sw-text) !important;
  border-color: rgba(13,148,136,0.30) !important;
}

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

/* Kill indigo/purple accents if any leaked */
.text-indigo-600, .bg-indigo-600, .border-indigo-500,
.text-purple-600, .bg-purple-600 {
  color: var(--sw-teal-deep) !important;
  background-color: rgba(13,148,136,0.18) !important;
  border-color: rgba(13,148,136,0.35) !important;
}

/* Duty rail */
.duty-rail {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 22px;
  background: rgba(240,253,250,0.72);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--sw-teal-border);
  /* park under the fixed site header, not on top of it (--sw-header-h set by shell.js) */
  position: sticky; top: var(--sw-header-h, 0px); z-index: 40;
}
.duty-rail .rail-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--sw-teal-deep); white-space: nowrap;
}
.mini-path {
  display: flex; align-items: center; gap: 0; flex: 1; min-width: 0;
  overflow-x: auto; padding: 2px 0;
}
.mini-node {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  line-height: 1;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(13,148,136,0.22);
  font-size: 12px; font-weight: 600; color: var(--sw-muted);
  cursor: pointer; white-space: nowrap;
  transition: .18s; text-decoration: none;
}
.mini-node:hover { border-color: var(--sw-teal); color: var(--sw-teal-deep); }
.mini-node.on {
  background: rgba(13,148,136,0.18);
  border-color: rgba(13,148,136,0.45);
  color: var(--sw-teal-ink);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.10);
}
.mini-node .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--sw-teal); box-shadow: 0 0 0 2px rgba(13,148,136,0.25);
}
.mini-wire {
  width: 22px; height: 0;
  border-top: 2px dashed rgba(13,148,136,0.40);
  flex-shrink: 0;
}
.duty-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(13,148,136,0.30);
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px;
  color: var(--sw-muted); white-space: nowrap;
  transition: box-shadow .3s, border-color .3s;
}
.duty-chip strong { color: var(--sw-text); font-weight: 600; }
.duty-chip.pulse {
  border-color: var(--sw-teal);
  box-shadow: 0 0 0 4px rgba(13,148,136,0.18), 0 0 20px rgba(13,148,136,0.25);
  animation: chipPulse .7s ease;
}
@keyframes chipPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
.rail-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Views */
.sw-view { display: none; }
.sw-view.show { display: block; }
#view-workbench.show { display: flex; flex-direction: column; min-height: calc(100vh - 4rem); }

/* Workbench Split Desk */
.desk {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(400px, 1.2fr);
  flex: 1; min-height: 0;
}
/* One column: calculator first, enquiry under it, one page scroll (no nested pane) */
@media (max-width: 980px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  .desk-right { order: 1; overflow: visible; }
  .desk-left {
    order: 2;
    max-height: none; overflow: visible;
    border-right: none !important;
    border-bottom: none;
    border-top: 1px solid var(--sw-border);
  }
}
.desk > .desk-left, .desk > .desk-right { min-width: 0; }
.desk-left {
  background: var(--sw-doc); border-right: 1px solid var(--sw-border);
  padding: 24px 28px 36px; overflow-y: auto;
}
.desk-right {
  padding: 20px 24px 36px; overflow-y: auto;
  background: linear-gradient(180deg, rgba(240,253,250,0.35) 0%, var(--sw-bg) 120px);
}

.doc-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--sw-teal-deep); margin-bottom: 6px;
}
.doc-title {
  font-size: 20px; font-weight: 750; letter-spacing: -0.025em; margin: 0 0 4px;
  color: var(--sw-text);
}
.doc-meta { font-size: 13px; color: var(--sw-muted); margin-bottom: 18px; }
.doc-meta .live {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--sw-green); margin-right: 6px; animation: blink 2s infinite;
}
@keyframes blink { 50% { opacity: 0.35; } }

.send-bar {
  margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.send-note { width: 100%; font-size: 11.5px; color: var(--sw-muted); margin-top: 4px; }

/* Tool pills */
.tool-bar {
  display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; align-items: center;
}
.tool-pill {
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
  padding: 8px 14px; border-radius: 999px;
  background: rgba(255,255,255,0.45);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(15,23,42,0.10);
  color: var(--sw-muted); font-weight: 600; font-size: 12.5px;
  transition: .18s; text-decoration: none; cursor: pointer;
}
.tool-pill:hover { border-color: rgba(13,148,136,0.35); color: var(--sw-teal-deep); }
.tool-pill.on {
  background: rgba(13,148,136,0.18);
  border-color: rgba(13,148,136,0.40);
  color: var(--sw-teal-deep);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.08);
}

.calc-card {
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(13,148,136,0.15);
  border-radius: 16px; padding: 20px 22px;
  box-shadow: var(--sw-shadow);
}
.calc-card > .ws-grid { margin: 0; }
.calc-card .panel {
  background: transparent; border: none; box-shadow: none; padding: 0;
}
.interconnect {
  margin-top: 16px; padding: 14px 16px;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  border: 1px dashed rgba(13,148,136,0.30);
  border-radius: 12px; font-size: 12.5px; color: var(--sw-muted); line-height: 1.6;
}
.interconnect strong { color: var(--sw-teal-deep); }
.interconnect ul { margin: 8px 0 0 16px; }
.interconnect a { color: var(--sw-teal-deep); }

/* Compact hero */
.sw-hero {
  padding: 14px 22px 6px;
  max-width: none;
}
.sw-hero .crumbs { font-size: 12px; color: var(--sw-muted); margin-bottom: 6px; }
.sw-hero .crumbs a { color: var(--sw-teal-deep); text-decoration: none; }
.sw-hero h1 {
  font-size: 1.35rem; font-weight: 750; letter-spacing: -0.02em;
  margin: 0 0 4px; color: var(--sw-text);
}
.sw-hero p { margin: 0; font-size: 13.5px; color: var(--sw-muted-ink); max-width: 52rem; }

/* Map mode */
.map-wrap {
  position: relative; height: calc(100vh - 3rem);
  background-color: #f0f4f3;
  background-image: radial-gradient(circle, rgba(13,148,136,0.22) 1px, transparent 1px);
  background-size: 22px 22px;
  overflow: hidden;
}
.map-topbar {
  position: absolute; top: 16px; left: 20px; right: 20px; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}
.map-topbar h2 {
  font-size: 15px; font-weight: 700; color: var(--sw-text);
  display: flex; align-items: center; gap: 10px; margin: 0;
}
.map-topbar h2 span {
  font-size: 11px; font-weight: 600; color: var(--sw-teal-deep);
  background: rgba(13,148,136,0.14); padding: 4px 10px; border-radius: 999px;
  border: 1px solid rgba(13,148,136,0.25);
}
svg.wires {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1;
}
.wire-path {
  fill: none; stroke: rgba(13,148,136,0.45); stroke-width: 2; stroke-dasharray: 7 5;
}
.wire-path.pulse {
  stroke: var(--sw-teal); stroke-dasharray: none;
  filter: drop-shadow(0 0 5px rgba(13,148,136,0.55));
  animation: wireDash 0.85s linear;
}
@keyframes wireDash {
  from { stroke-dashoffset: 42; stroke-dasharray: 8 4; }
  to { stroke-dashoffset: 0; stroke-dasharray: 8 4; }
}
.map-node {
  position: absolute; z-index: 2; width: 200px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(13,148,136,0.18);
  border-radius: 14px;
  box-shadow: var(--sw-shadow);
  cursor: pointer; transition: box-shadow .2s, border-color .2s, transform .15s;
  text-decoration: none; color: inherit;
}
.map-node:hover { border-color: rgba(13,148,136,0.40); transform: translateY(-2px); }
.map-node.active {
  border-color: var(--sw-teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,.16), var(--sw-shadow-lg);
}
.map-node .node-head {
  padding: 10px 12px; border-bottom: 1px solid rgba(13,148,136,0.10);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.map-node .node-head h3 { font-size: 13px; font-weight: 650; margin: 0; }
.map-node .port {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--sw-teal);
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--sw-teal);
  flex-shrink: 0;
}
.map-node .node-body { padding: 10px 12px; font-size: 12px; color: var(--sw-muted); }
.map-node .field-row {
  display: flex; justify-content: space-between; padding: 3px 0;
  font-family: "JetBrains Mono", monospace; font-size: 11px;
}
.map-node .field-row .v { color: var(--sw-text); font-weight: 550; }
.map-duty {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 5;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(13,148,136,0.30);
  border-radius: 999px; padding: 10px 18px;
  font-size: 12px; font-family: "JetBrains Mono", monospace;
  box-shadow: var(--sw-shadow); color: var(--sw-muted); white-space: nowrap;
}
.map-duty strong { color: var(--sw-text); }
.map-duty.pulse {
  border-color: var(--sw-teal);
  box-shadow: 0 0 0 4px rgba(13,148,136,0.18), 0 0 24px rgba(13,148,136,0.22);
}
.map-hint {
  position: absolute; bottom: 22px; right: 22px; z-index: 5;
  font-size: 12px; color: var(--sw-muted);
  background: rgba(255,255,255,0.7); backdrop-filter: blur(10px);
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid rgba(13,148,136,0.18);
}

.sw-toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(15,23,42,0.92); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 550; opacity: 0; pointer-events: none;
  transition: .3s; z-index: 200; backdrop-filter: blur(8px);
}
.sw-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Preview banner */
.sw-preview-banner {
  background: #0f172a; color: #94a3b8;
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
  padding: 8px 18px; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
}
.sw-preview-banner .tag { color: #5eead4; }
.sw-preview-banner a { color: #99f6e4; text-decoration: none; }

/* Spec sheet in left pane */
.desk-left .spec-sheet,
.desk-left #spec-block,
.desk-left .panel.spec-sheet {
  border: none; box-shadow: none; padding: 0; background: transparent;
}
.desk-left .spec-table { width: 100%; }
.desk-left .ws-grid { display: block; }

/* Engine in right: stack inputs then results */
.desk-right #calc-engine { display: block; }
.desk-right #calc-engine > .ws-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 1100px) {
  .desk-right #calc-engine > .ws-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }
}
.desk-right .panel {
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(13,148,136,0.12);
  border-radius: 14px;
  padding: 16px 18px;
}

/* Chem: matrix full width above desk optional */
.chem-matrix-band {
  padding: 12px 22px 0;
}
.chem-matrix-band .matrix-wrap {
  max-height: 280px; overflow: auto;
  border: 1px solid rgba(13,148,136,0.15);
  border-radius: 12px;
  background: #fff;
}

/* Soften live wrap padding when nested in shell */
body.sw-shell .wrap { max-width: none; padding: 0; margin: 0; }
body.sw-shell { background: var(--sw-bg); }

/* Gallery */
.sw-gallery { max-width: 56rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.sw-gallery h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
.sw-gallery .lede { color: var(--sw-muted); margin-bottom: 1.5rem; }
.sw-gallery .grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px;
}
.sw-gallery a.card {
  display: block; padding: 16px 18px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(13,148,136,0.18);
  border-radius: 12px; text-decoration: none; color: var(--sw-text);
  transition: .18s;
}
.sw-gallery a.card:hover {
  border-color: var(--sw-teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
}
.sw-gallery a.card strong { display: block; color: var(--sw-teal-deep); margin-bottom: 4px; }
.sw-gallery a.card span { font-size: 12.5px; color: var(--sw-muted); }
.sw-gallery .note {
  margin-top: 1.5rem; padding: 14px 16px;
  background: rgba(240,253,250,0.7);
  border: 1px dashed rgba(13,148,136,0.35);
  border-radius: 10px; font-size: 13px; color: var(--sw-muted); line-height: 1.55;
}


/* ——— Always translucent: kill solid fills from page-local CSS ——— */
body.sw-shell .btn-primary,
body.sw-shell a.btn-primary,
body.sw-shell .btn.btn-primary,
body.sw-shell #btn-mail,
body.sw-shell #btn-mail-self,
body.sw-shell #a-mail,
body.sw-shell #btnSend,
body.sw-shell button[class*="btn-primary"] {
  background: rgba(13,148,136,0.22) !important;
  color: var(--sw-teal-ink) !important;
  border: 1px solid rgba(13,148,136,0.45) !important;
}

/* Small laptop viewport (~1366×768 and similar): slightly zoomed out */
@media (max-width: 1440px) and (max-height: 900px) {
  html { font-size: 93%; }
  .duty-rail { padding: 6px 14px; gap: 8px; }
  .mini-node { padding: 5px 10px; font-size: 11px; }
  .duty-chip { padding: 5px 10px; font-size: 10px; }
  .sw-hero { padding: 8px 16px 4px; }
  .sw-hero h1 { font-size: 1.15rem; }
  .sw-hero p { font-size: 12.5px; }
  .desk-left { padding: 14px 16px 24px; }
  .desk-right { padding: 12px 14px 24px; }
  .doc-title { font-size: 17px; }
  .calc-card { padding: 14px 16px; border-radius: 12px; }
  .desk-right .panel { padding: 12px 14px; }
  .tool-pill { padding: 6px 11px; font-size: 11.5px; }
  .send-bar button, .send-bar a.btn, .btn-primary, .btn-ghost, .btn-glass {
    padding: 7px 12px !important; font-size: 12px !important;
  }
  .chem-matrix-band .matrix-wrap { max-height: 200px; }
  .map-node { width: 170px; }
}

/* Ultra-short laptop height */
@media (max-height: 780px) and (min-width: 981px) {
  html { font-size: 88%; }
  #view-workbench.show { min-height: calc(100vh - 3rem); }
  .desk-left { max-height: none; }
}

/* ============================================================
   MOBILE — Split Desk × Wire
   Less is more: one column, one scroll, no nested scroll traps,
   no horizontal overflow, map becomes a vertical duty chain.
   ============================================================ */

/* ---- Duty rail below the desk breakpoint: the wire chips are redundant with the
       tool pills, and the nowrap chip is what used to force the page sideways. ---- */
@media (max-width: 980px) {
  .duty-rail { padding: 8px 14px; gap: 8px; flex-wrap: nowrap; }
  .duty-rail .rail-label { display: none; }
  .mini-path { display: none; }
  .duty-chip {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    padding: 7px 12px;
    font-size: 11px;
    line-height: 1.4;
  }
  .rail-actions { flex-shrink: 0; }
  .rail-actions .btn-glass { padding: 7px 12px; font-size: 12px; }
}

/* Hard stop on sideways drift */
@media (max-width: 780px) {
  html, body.sw-shell { max-width: 100%; overflow-x: hidden; }

  /* a second sticky bar under a fixed header costs too much of a phone screen */
  .duty-rail { position: static; }

  /* ---- Hero ---- */
  .sw-hero { padding: 14px 16px 2px; }
  .sw-hero h1 { font-size: 1.2rem; line-height: 1.25; }
  .sw-hero p { font-size: 13px; line-height: 1.5; }

  /* ---- Desk: single column, calculator first, one page scroll ---- */
  #view-workbench.show { min-height: 0; }
  .desk { grid-template-columns: minmax(0, 1fr); }
  .desk-right {
    padding: 14px 16px 20px;
    background: linear-gradient(180deg, rgba(240,253,250,0.35) 0%, var(--sw-bg) 90px);
  }
  .desk-left { padding: 20px 16px 28px; }
  .doc-title { font-size: 18px; }
  .doc-meta { margin-bottom: 14px; }

  /* ---- Tool pills: single scrollable row, no ragged wrap ---- */
  .tool-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -16px 14px;
    padding: 0 16px 2px;
    /* fade the right edge so the row reads as scrollable */
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 34px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 34px), transparent 100%);
  }
  .tool-bar::-webkit-scrollbar { display: none; }
  .tool-pill { flex: 0 0 auto; padding: 7px 13px; font-size: 12.5px; }
  .tool-bar .btn-ghost { flex: 0 0 auto; }

  /* Enquiry sheet: label above value, full width, nothing clipped */
  .desk-left .spec-table { border: 1px solid var(--sw-border); }
  .desk-left .spec-table textarea { font-size: 0.9rem; resize: none; }

  /* ---- Cards ---- */
  .calc-card { padding: 14px 14px; border-radius: 14px; }
  .desk-right .panel { padding: 0; background: transparent; border: none; }
  .desk-right #calc-engine > .ws-grid { gap: 20px; }
  .desk-right #calc-engine > .ws-grid > .panel + .panel {
    border-top: 1px solid rgba(13,148,136,0.16);
    padding-top: 18px;
  }
  .interconnect { font-size: 12px; padding: 12px 14px; }

  /* ---- Anything mono/wide scrolls inside itself, never the page ---- */
  .calc-card pre,
  .desk-left pre,
  .formula, .ws-formula, .calc-formula {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 11px;
  }
  .calc-card table, .desk-left table { max-width: 100%; }

  /* ---- Chem matrix: keep the fluid column, tighten everything else ---- */
  .chem-matrix-band { padding: 10px 12px 0; }
  .chem-matrix-band .matrix-wrap { max-height: 62vh; }
  .matrix-wrap { -webkit-overflow-scrolling: touch; }
  table.matrix { min-width: 34rem; font-size: .7rem; }
  .matrix th, .matrix td { padding: .35rem .25rem; }
  .matrix td.fluid, .matrix th.fluid { width: 7.5rem; font-size: .72rem; }
  .matrix thead th {
    font-size: .5rem; letter-spacing: 0;
    word-break: normal; overflow-wrap: anywhere;
  }

  /* ---- Toast clears the thumb zone ---- */
  .sw-toast { bottom: 18px; left: 12px; right: 12px; transform: none; text-align: center; }
  .sw-toast.show { transform: none; }

  /* ---- Preview banner: drop the decoration ---- */
  .sw-preview-banner { font-size: 10px; padding: 6px 12px; }
}

/* ---- Map on mobile: a vertical duty chain, not a canvas ---- */
@media (max-width: 780px) {
  .map-wrap {
    position: static;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 14px 16px 28px;
    background-size: 18px 18px;
  }
  .map-topbar {
    position: static;
    display: block;
    margin-bottom: 14px;
  }
  .map-topbar h2 { font-size: 15px; flex-wrap: wrap; margin-bottom: 10px; }
  .map-topbar > div { display: flex; gap: 8px; }
  .map-topbar > div button { flex: 1 1 auto; }

  svg.wires { display: none; }
  .map-hint { display: none; }

  .map-duty {
    position: static;
    transform: none;
    display: block;
    width: 100%;
    border-radius: 12px;
    white-space: normal;
    text-align: center;
    margin-bottom: 14px;
    padding: 10px 14px;
    line-height: 1.5;
  }

  #view-map .map-wrap { display: flex; flex-direction: column; }
  .map-node {
    position: relative !important;
    left: auto !important; top: auto !important;
    width: auto;
    margin: 0 0 10px;
  }
  /* the dashed link between stacked nodes */
  .map-node + .map-node::before {
    content: "";
    position: absolute;
    left: 50%; top: -11px;
    width: 0; height: 10px;
    border-left: 2px dashed rgba(13,148,136,0.40);
  }
  /* ports are wiring cues for the canvas — meaningless in a stack */
  .map-node .port { display: none; }
  .map-node .node-head { padding: 10px 14px; justify-content: flex-start; }
  .map-node .node-head h3 { font-size: 13.5px; }
  .map-node .node-body { padding: 8px 14px 10px; }
  .map-node .field-row { font-size: 11.5px; }
}

/* Small phones — shave the last of the padding */
@media (max-width: 400px) {
  .sw-hero { padding: 12px 14px 2px; }
  .desk-right { padding: 12px 14px 18px; }
  .desk-left { padding: 18px 14px 24px; }
  .tool-bar { margin: 0 -14px 14px; padding: 0 14px 2px; }
  .calc-card { padding: 12px 12px; }
  .duty-chip { font-size: 10.5px; }
}
