/* STEPWELL app.css: page styles for /app, /wells, /board, /docs, 404. Loads after base.css. */

main { display: block; }
.page-head { padding: 40px 0 28px; border-bottom: 1px solid var(--rule); }
.page-head .wrap { display: flex; flex-wrap: wrap; gap: 18px 32px; align-items: flex-end; justify-content: space-between; }
.page-head h1 { font-size: clamp(30px, 4.6vw, 56px); margin-top: 12px; }
.page-head .lead { margin: 12px 0 0; font-size: 16px; max-width: 58ch; }
.notice {
  display: flex; gap: 12px; align-items: flex-start;
  max-width: 440px; padding: 12px 14px;
  border: 1px dashed var(--ink-2); border-radius: var(--radius);
  font-size: 13px; line-height: 1.45; color: var(--ink-2);
}
.notice b { color: var(--ink); }
.notice.water { border-color: var(--water); color: var(--water-d); background: var(--water-t); }

/* section header inside panels: label left, meta right */
.sec { padding: 22px 0; border-top: 1px solid var(--rule); }
.sec:first-child { border-top: 0; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sec-h .meta { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ── builder layout ───────────────────────────────────── */
.b-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: calc(100vh - var(--nav-h)); }
.b-pools { border-right: 1px solid var(--rule); padding: 20px 20px 20px 0; position: relative; }
.b-pools-inner { position: sticky; top: calc(var(--nav-h) + 12px); display: grid; gap: 12px; }
.b-main { min-width: 0; padding: 20px 0 20px 28px; }
.b-toggle { display: none; }
@media (max-width: 1000px) {
  .b-grid { grid-template-columns: minmax(0, 1fr); }
  .b-pools { border-right: 0; border-bottom: 1px solid var(--rule); padding: 14px 0; }
  .b-pools-inner { position: static; }
  .b-main { padding: 20px 0; }
  .b-toggle { display: flex; }
  .b-pools:not(.open) .b-pools-body { display: none; }
}

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; padding: 10px 12px; border: 0; border-bottom: 2px solid transparent; background: none; font: 600 13px/1 var(--f-body); color: var(--ink-2); cursor: pointer; }
.tabs button[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--water); }
.tabs button .n { font-weight: 500; color: var(--ink-3); margin-left: 4px; font-variant-numeric: tabular-nums; }

.pool-list { display: grid; max-height: calc(100vh - var(--nav-h) - 190px); overflow-y: auto; overscroll-behavior: contain; margin-right: -6px; padding-right: 6px; }
@media (max-width: 1000px) { .pool-list { max-height: 56vh; } }
.pool-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px;
  padding: 11px 8px; border: 0; border-bottom: 1px solid var(--rule-2); background: none;
  text-align: left; cursor: pointer; color: var(--ink);
}
.pool-row:hover { background: var(--paper-2); }
.pool-row[aria-current='true'] { background: var(--ink); color: var(--paper); }
.pool-row[aria-current='true'] .pr-sub, .pool-row[aria-current='true'] .pr-meta { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.pool-row[aria-current='true'] .badge { color: var(--paper); border-color: color-mix(in srgb, var(--paper) 40%, transparent); }
.pool-group { margin: 14px 0 0; padding: 8px 8px 6px; border-top: 1px solid var(--ink); font: 600 10px/1 var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.pool-row.later { opacity: .55; }
.pool-row.later:hover, .pool-row.later[aria-current='true'] { opacity: 1; }
.pr-pair { font: 700 14px/1.2 var(--f-body); display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.pr-price { font: 600 14px/1.2 var(--f-body); font-variant-numeric: tabular-nums; text-align: right; }
.pr-sub, .pr-meta { font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pr-meta { text-align: right; }
.pr-sub .badge { padding: 1px 4px; font-size: 9px; }
.chg-up { color: var(--water-d); }
.pool-row[aria-current='true'] .chg-up { color: #7FD3CF; }

.pool-head { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: flex-end; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.pool-head h2 { font-size: clamp(24px, 3.2vw, 36px); }
.pool-head .ph-right { text-align: right; }
.pool-head .ph-price { font: 800 clamp(22px, 2.6vw, 30px)/1 var(--f-display); font-stretch: 112%; font-variant-numeric: tabular-nums; }
.pool-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 10px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pool-stats b { color: var(--ink); font-weight: 600; }

/* chart */
.chart-wrap { position: relative; margin-top: 18px; border: 1px solid var(--ink); background:
  linear-gradient(var(--paper-3), var(--paper-3)); user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.chart-wrap canvas { width: 100%; height: 340px; cursor: crosshair; }
@media (max-width: 640px) { .chart-wrap canvas { height: 260px; } }
.chart-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.chart-tools .icon-btn { width: 28px; height: 28px; background: var(--paper); font: 600 15px/1 var(--f-body); }
.handle {
  position: absolute; top: 0; bottom: 26px; width: 0; z-index: 2;
  border: 0; padding: 0; background: none; cursor: ew-resize; touch-action: none;
}
.handle::before { content: ''; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--ink); }
.handle::after { content: ''; position: absolute; top: 0; bottom: 0; left: -14px; width: 28px; }
.handle .tab {
  position: absolute; top: 36px; transform: translateX(-50%);
  padding: 5px 7px; background: var(--ink); color: var(--paper);
  font: 600 11px/1.15 var(--f-body); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: center;
  border-radius: var(--radius); pointer-events: none;
}
.handle .tab small { display: block; opacity: .7; font-size: 10px; }
.handle:focus-visible { outline: none; }
.handle:focus-visible .tab { outline: 2px solid var(--water); outline-offset: 2px; }
.handle.lo .tab { transform: translateX(-100%); left: -6px; }
.handle.hi .tab { transform: none; left: 6px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 0 0; font-size: 12px; color: var(--ink-2); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }

.range-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.range-box { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; }
.range-box .field > span { display: flex; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
@media (max-width: 640px) { .range-row { grid-template-columns: 1fr; } }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 32px; margin-top: 8px; }
.cols > div { min-width: 0; }
@media (max-width: 1240px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.sticky-col { position: sticky; top: calc(var(--nav-h) + 12px); align-self: start; }
@media (max-width: 1240px) { .sticky-col { position: static; } }

.templates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tpl {
  display: grid; gap: 4px; padding: 12px; text-align: left;
  border: 1px solid var(--rule); border-radius: var(--radius); background: transparent; cursor: pointer; color: var(--ink);
}
.tpl b { font: 800 14px/1.15 var(--f-display); font-stretch: 112%; }
.tpl span { font-size: 12px; color: var(--ink-2); line-height: 1.35; }
.tpl:hover { border-color: var(--ink); }
.tpl[aria-pressed='true'] { border-color: var(--water); background: var(--water-t); }
.tpl[disabled] { opacity: .45; cursor: not-allowed; }
@media (max-width: 420px) { .templates { grid-template-columns: 1fr; } }

.shapes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.shape-btn { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: transparent; cursor: pointer; text-align: left; color: var(--ink); }
.shape-btn svg { width: 100%; height: 34px; }
.shape-btn b { font: 800 13px/1 var(--f-display); font-stretch: 112%; }
.shape-btn[aria-pressed='true'] { border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--water); }
.shape-desc { font-size: 13px; color: var(--ink-2); margin: 10px 0 0; min-height: 3em; }
.histo { margin-top: 12px; border-bottom: 1px solid var(--ink); }
.histo svg { width: 100%; height: 70px; }
.rung-row { display: grid; grid-template-columns: minmax(0, 1fr) 56px; gap: 14px; align-items: center; margin-top: 16px; }
.rung-row .input { text-align: center; padding: 0 6px; }

.dep { display: grid; gap: 12px; }
.dep-box { display: grid; gap: 6px; }
.dep-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
.dep-in .input { border-top-right-radius: 0; border-bottom-right-radius: 0; font-size: 17px; }
.dep-in .sym { display: grid; place-items: center; min-width: 74px; padding: 0 10px; border: 1px solid var(--rule); border-left: 0; border-bottom: 1.5px solid var(--ink); font: 700 13px/1 var(--f-body); background: var(--paper-2); }
.dep-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dep-meta button { border: 0; background: none; padding: 0; color: var(--water-d); font: 600 12px/1 var(--f-body); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.dep-box.off .input { background: transparent; }
.opts { display: grid; gap: 14px; }
.opt-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { width: 18px; height: 18px; accent-color: var(--water); }

/* preview */
.pv { border: 1.5px solid var(--ink); background: var(--paper-3); }
.pv-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--rule); }
.pv-h h3 { font-size: 17px; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 14px; padding: 14px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.kv .total { border-top: 1px solid var(--rule); padding-top: 7px; }
.whatif { padding: 14px; border-top: 1px solid var(--rule); background: var(--paper); }
.whatif-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; font-size: 14px; }
.whatif .input { min-height: 36px; }
.whatif-out { margin: 10px 0 0; font-size: 14px; line-height: 1.5; }
.whatif-out b { font-variant-numeric: tabular-nums; }
.rung-table-wrap { max-height: 320px; overflow: auto; border-top: 1px solid var(--rule); }
table.t { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.t th { position: sticky; top: 0; background: var(--paper-2); text-align: right; font: 600 10px/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); padding: 9px 8px; white-space: nowrap; }
table.t td { padding: 7px 8px; border-top: 1px solid var(--rule-2); text-align: right; white-space: nowrap; }
table.t th:first-child, table.t td:first-child { text-align: left; }
.side { display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: 0; }
.side.buy { background: var(--water); }
.side.sell { background: var(--ink); }
.side.both { background: linear-gradient(90deg, var(--water) 50%, var(--ink) 50%); }
.act { padding: 14px; border-top: 1px solid var(--rule); display: grid; gap: 10px; }
.act .btn { width: 100%; }
.act-note { font-size: 12.5px; color: var(--ink-2); margin: 0; line-height: 1.45; }
.act-log { font-size: 12.5px; margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.act-log li::before { content: '— '; color: var(--ink-3); }
.act-log a { color: var(--water-d); }
.warn { color: #7A3E1C; }

.empty { padding: 48px 20px; text-align: center; color: var(--ink-2); border: 1px dashed var(--rule); }
.empty h2, .empty h3 { color: var(--ink); margin-bottom: 8px; font-size: clamp(18px, 2vw, 22px); line-height: 1.15; }

/* ── wells ────────────────────────────────────────────── */
.wells-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 22px 0; border-bottom: 1px solid var(--rule); }
.stat-row { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--ink); }
.stat { padding: 12px 18px; border-left: 1px solid var(--rule); min-width: 120px; }
.stat:first-child { border-left: 0; }
.stat small { display: block; font: 600 10px/1 var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px; }
.stat b { font: 800 20px/1 var(--f-display); font-stretch: 112%; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .stat { min-width: 50%; border-left: 0; border-top: 1px solid var(--rule); } .stat:nth-child(-n+2) { border-top: 0; } .stat:nth-child(even) { border-left: 1px solid var(--rule); } }
.ladder { margin-top: 28px; border: 1px solid var(--ink); background: var(--paper-3); }
.ladder-h { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.ladder-h h3 { font-size: 19px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ladder-h .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ladder-sum { display: flex; flex-wrap: wrap; gap: 6px 26px; padding: 12px 16px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--rule); }
.ladder-sum b { color: var(--ink); }
.ladder .t-wrap { overflow-x: auto; }
.conv { display: inline-flex; align-items: center; gap: 8px; }
.conv-bar { width: 64px; height: 6px; background: var(--paper-2); position: relative; }
.conv-bar i { position: absolute; inset: 0 auto 0 0; background: var(--water); }
.connect-cta { padding: 64px 20px; text-align: center; border: 1px solid var(--ink); margin-top: 28px; background: var(--paper-3); }
.connect-cta h2 { margin-bottom: 12px; }
.connect-cta p { margin: 0 auto 22px; max-width: 52ch; color: var(--ink-2); }

/* ── board ────────────────────────────────────────────── */
.board-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 0; min-height: 60vh; }
.board-list { border-right: 1px solid var(--rule); padding: 20px 20px 20px 0; }
.board-main { padding: 20px 0 20px 28px; min-width: 0; }
@media (max-width: 1000px) { .board-grid { grid-template-columns: minmax(0, 1fr); } .board-list { border-right: 0; border-bottom: 1px solid var(--rule); padding: 16px 0; } .board-main { padding: 20px 0; } }
.bl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; width: 100%; padding: 12px 8px; border: 0; border-bottom: 1px solid var(--rule-2); background: none; text-align: left; cursor: pointer; color: var(--ink); }
.bl-row:hover { background: var(--paper-2); }
.bl-row[aria-current='true'] { background: var(--ink); color: var(--paper); }
.bl-row[aria-current='true'] .pr-sub, .bl-row[aria-current='true'] .pr-meta { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.depthbar { display: flex; height: 4px; grid-column: 1 / -1; background: var(--paper-2); }
.depthbar i { display: block; height: 100%; }
.well-view { border: 1px solid var(--ink); background: var(--paper-3); margin-top: 18px; position: relative; }
.well-view svg { width: 100%; height: auto; display: block; }
.pub-list { margin-top: 22px; display: grid; gap: 0; border-top: 1px solid var(--ink); }
.pub { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pub .who { font-weight: 700; }
.pub .lbl { color: var(--ink-2); }
@media (max-width: 560px) { .pub { grid-template-columns: minmax(0, 1fr) auto; } .pub > :first-child { grid-column: 1 / -1; } }

/* ── docs ─────────────────────────────────────────────── */
.docs-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px; padding-top: 32px; }
.toc { position: sticky; top: calc(var(--nav-h) + 20px); align-self: start; max-height: calc(100vh - var(--nav-h) - 40px); overflow-y: auto; padding-bottom: 20px; }
.toc ol { list-style: none; margin: 12px 0 0; padding: 0; counter-reset: toc; border-left: 1px solid var(--rule); }
.toc li a { display: block; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 2px solid transparent; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.toc li a:hover { color: var(--ink); }
.toc li a.on { color: var(--ink); border-left-color: var(--water); font-weight: 600; }
.toc-m { display: none; }
@media (max-width: 960px) {
  .docs-grid { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 16px; }
  .toc { display: none; }
  .toc-m { display: block; margin: 0 0 8px; border: 1px solid var(--rule); padding: 10px 14px; }
  .toc-m summary { cursor: pointer; font-weight: 600; }
  .toc-m ol { margin: 10px 0 4px; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
}
.doc { max-width: 76ch; min-width: 0; }
.doc section { padding: 40px 0 8px; border-top: 1px solid var(--rule); }
.doc section:first-child, .doc .toc-m + section { border-top: 0; padding-top: 8px; }
.doc h2 { font-size: clamp(24px, 3vw, 34px); margin: 10px 0 18px; }
.doc h3 { margin: 28px 0 10px; font-size: 19px; }
.doc p, .doc li { font-size: 16.5px; line-height: 1.65; color: var(--ink); }
.doc ul, .doc ol { padding-left: 22px; margin: 0 0 1.1em; }
.doc li { margin-bottom: .35em; }
.doc figure { margin: 22px 0; padding: 16px; border: 1px solid var(--rule); background: var(--paper-3); }
.doc figure svg { width: 100%; height: auto; }
.doc figcaption { margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.shape-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 22px 0; }
.shape-figs figure { margin: 0; }
.shape-figs b { display: block; font: 800 15px/1.1 var(--f-display); font-stretch: 112%; margin-top: 8px; }
@media (max-width: 640px) { .shape-figs { grid-template-columns: 1fr; } }
.steps-list { counter-reset: st; list-style: none; padding: 0 !important; }
.steps-list > li { counter-increment: st; position: relative; padding: 0 0 14px 46px; }
.steps-list > li::before { content: counter(st); position: absolute; left: 0; top: 0; width: 30px; height: 30px; display: grid; place-items: center; border: 1.5px solid var(--ink); font: 800 13px/1 var(--f-display); font-stretch: 112%; }
.addr-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 12px 0 18px; }
.addr-table td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.addr-table td:first-child { color: var(--ink-2); white-space: nowrap; padding-right: 18px; }
.addr-table td a, .addr-table td code { word-break: break-all; }
.callout { margin: 20px 0; padding: 16px 18px; border-left: 3px solid var(--water); background: var(--water-t); font-size: 15.5px; }
.callout.ink { border-left-color: var(--ink); background: var(--paper-2); }
.faq details { border-bottom: 1px solid var(--rule); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 700; font-size: 16.5px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font: 800 18px/1 var(--f-display); color: var(--water-d); }
.faq details[open] summary::after { content: '−'; }
.faq details p { margin: 10px 0 0; }

/* ── 404 ──────────────────────────────────────────────── */
.lost { min-height: calc(100vh - var(--nav-h) - 120px); display: grid; place-items: center; text-align: center; padding: 60px 0; }
.lost svg { width: min(360px, 80vw); margin: 0 auto 28px; }
.lost h1 { font-size: clamp(40px, 8vw, 96px); }
.lost p { margin: 16px auto 28px; max-width: 46ch; color: var(--ink-2); }
.lost .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

@media (pointer: coarse) {
  .chart-tools .icon-btn { width: 40px; height: 40px; }
  .switch { min-height: 40px; }
}

/* phones: the price block reads left like the rest of the head; the zoom tools sit above the chart, off the labels */
@media (max-width: 640px) {
  .pool-head .ph-right { text-align: left; }
  .pool-head .ph-right .btn-ghost { padding-left: 0; }
  .chart-wrap { margin-top: 60px; }
  .chart-tools { top: -50px; right: -1px; }
}
