/* Funnel Builder Cost - a price-tag ledger. Forest green for the best fit, coral for what costs the most,
 * cream paper, tabular numerals everywhere a figure sits in a column. */
:root {
  --bg: #f7f4ec; --paper: #fffdf7; --ink: #1d231f; --muted: #5d665f; --line: #e2dccb; --soft: #efe9da;
  --brand: #1d5c46; --brand-ink: #ffffff; --brand-soft: #dcebe3; --accent: #c4552f; --accent-soft: #f8e3d9;
  --warn: #8a5a00; --warn-soft: #fbefd2; --ok: #1d6b3f; --bad: #a3321b;
  --s1: #1d5c46; --s2: #c4552f; --s3: #3d6fb6; --s4: #8a5ab0; --s5: #b38600; --s6: #2c8c8c; --s7: #7a6a55; --s8: #c2407f;
  --r: 12px; --shadow: 0 1px 2px rgba(40, 35, 20, .06), 0 4px 14px rgba(40, 35, 20, .05);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #121714; --paper: #19201c; --ink: #e8ede9; --muted: #9ba79f; --line: #2c3631; --soft: #202a25;
  --brand: #5fbf94; --brand-ink: #0d1a14; --brand-soft: #1f3a2f; --accent: #f08a62; --accent-soft: #3b231a;
  --warn: #f0c060; --warn-soft: #3a2f14; --ok: #6fd39a; --bad: #ff8f75;
  --s1: #5fbf94; --s2: #f08a62; --s3: #7aa7ec; --s4: #c39ae6; --s5: #e6c04f; --s6: #5ccfcf; --s7: #c2b39b; --s8: #f07fb4;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; overflow-x: hidden; }
a { color: var(--brand); }
code, .mono { font-family: var(--mono); font-size: .92em; }
.hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.bad { color: var(--bad); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
.h3 { font-size: 1.08rem; }

/* header */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--paper); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--brand); min-width: 0; }
.brand strong { color: var(--ink); font-size: 1.02rem; }
.brand .sep { color: var(--muted); }
.topactions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.backlink, .topup { color: var(--muted); text-decoration: none; font-size: .92rem; padding: 8px 6px; min-height: 40px; display: inline-flex; align-items: center; }
.backlink:hover, .topup:hover { color: var(--ink); }
.credits { font-family: var(--mono); font-size: .85rem; color: var(--muted); }

/* buttons */
button { font: inherit; cursor: pointer; }
.primary { background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 10px; padding: 11px 20px; min-height: 46px; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.primary:hover { filter: brightness(1.08); }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: 8px 14px; min-height: 40px; }
.ghost:hover:not(:disabled) { border-color: var(--brand); }
.ghost.sq { width: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.ghost.strong { border-color: var(--brand); color: var(--brand); font-weight: 600; }
.quiet { background: none; border: 0; color: var(--brand); padding: 8px 2px; min-height: 40px; text-decoration: underline; text-underline-offset: 3px; }
.mini { background: var(--soft); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 8px 12px; min-height: 40px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, .matrixwrap:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* layout */
main { max-width: 1160px; margin: 0 auto; padding: 0 16px 40px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.hero { padding: 26px 0 8px; max-width: 760px; }
.hero h1 { font-size: clamp(1.6rem, 4.4vw, 2.35rem); letter-spacing: -.01em; }
.lede { font-size: 1.08rem; color: var(--muted); margin: 0 0 12px; }
.perks { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 14px; }
.perks li { background: var(--brand-soft); color: var(--ink); border-radius: 999px; padding: 4px 12px; font-size: .86rem; }
.start { display: grid; gap: 12px; }
.startgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.start .primary { justify-self: start; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: .9rem; color: var(--muted); margin: 0 0 10px; }
.startgrid .field { margin: 0; }
input[type=text], select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; min-height: 44px; width: 100%; }
.startgrid input { font-size: 1.12rem; font-variant-numeric: tabular-nums; background: var(--paper); border-width: 1.5px; }
textarea { resize: vertical; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 4px; }
.chipbtn { background: var(--paper); border: 1px dashed var(--brand); color: var(--brand); border-radius: 999px; padding: 8px 14px; min-height: 40px; font-size: .9rem; }
.chipbtn[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-style: solid; }
.msg { margin: 10px 0 0; padding: 10px 12px; border-radius: 9px; background: var(--soft); }
.msg.bad { background: var(--accent-soft); color: var(--bad); }

.work { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.work > * { min-width: 0; }
.verdict { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; border-left: 6px solid var(--brand); }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--muted); }
.vbest { font-size: 1.35rem; font-weight: 700; margin: 2px 0 4px; }
.vline { margin: 0 0 4px; }
.exports { display: grid; gap: 8px; justify-items: stretch; min-width: 260px; }
.primary.big { min-height: 50px; font-size: 1.02rem; }
.exp-grid { display: grid; grid-template-columns: repeat(3, auto); gap: 6px; }
.exp-grid .ghost { padding: 8px 10px; font-size: .88rem; }
.cardhead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.cardhead p { margin: 0 0 8px; }

/* option chips */
.optchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.optchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 8px; min-height: 40px; font-size: .86rem; background: var(--bg); cursor: pointer; }
.optchip input { width: 18px; height: 18px; accent-color: var(--brand); }
.optchip .sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.optchip.add { border-style: dashed; color: var(--brand); padding-left: 12px; }

/* the matrix */
.matrixwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; -webkit-overflow-scrolling: touch; }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 640px; font-variant-numeric: tabular-nums; font-size: .9rem; }
.matrix th, .matrix td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.matrix th:first-child, .matrix td:first-child { text-align: left; position: sticky; left: 0; background: var(--paper); z-index: 1; white-space: normal; min-width: 150px; max-width: 190px; color: var(--muted); font-weight: 500; }
.matrix thead th { vertical-align: bottom; background: var(--soft); color: var(--ink); white-space: normal; min-width: 118px; text-align: right; }
.matrix thead th:first-child { background: var(--soft); }
.matrix .colhead { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.matrix .colname { font-weight: 650; line-height: 1.2; }
.matrix .tag { display: inline-block; font-size: .72rem; border-radius: 999px; padding: 1px 8px; background: var(--paper); border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.matrix .tag.best { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.matrix .tag.cheap { background: var(--brand-soft); color: var(--ink); border-color: var(--brand); }
.matrix .tag.out { background: var(--accent-soft); color: var(--bad); border-color: transparent; }
.matrix .editbtn { background: none; border: 1px solid var(--line); border-radius: 7px; color: var(--brand); padding: 4px 10px; min-height: 32px; font-size: .8rem; }
.matrix td.isbest, .matrix th.isbest { background: color-mix(in srgb, var(--brand-soft) 55%, transparent); }
.matrix thead th.isbest { background: var(--brand-soft); box-shadow: inset 0 4px 0 var(--brand); }
.matrix td.isout, .matrix th.isout { opacity: .55; }
.matrix tr.sub td { font-size: .82rem; padding-top: 4px; padding-bottom: 4px; }
.matrix tr.sub td:first-child { padding-left: 20px; }
.matrix tr.key td { font-weight: 700; font-size: .98rem; color: var(--ink); }
.matrix tr.key td:first-child { color: var(--ink); }
.matrix tr.sect td { background: var(--soft); font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding-top: 5px; padding-bottom: 5px; text-align: left; }
.matrix td.hi { color: var(--accent); }
.matrix td.lo { color: var(--ok); font-weight: 650; }
.matrix select.score { min-height: 34px; width: auto; padding: 3px 6px; font-size: .86rem; background: var(--paper); }
.scorebar { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.scorebar .bar { width: 52px; height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.scorebar .bar i { display: block; height: 100%; background: var(--brand); }
.matrix .why { font-size: .76rem; color: var(--bad); white-space: normal; max-width: 150px; text-align: right; }

/* editor */
.editor { margin-top: 12px; border: 1px solid var(--brand); border-radius: 10px; padding: 14px; background: var(--bg); }
.editor .edhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.editor .edgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 12px; }
.editor .field { margin: 0; }
.editor .edfoot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* columns */
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.colmain, .colside { display: grid; gap: 16px; min-width: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.curve .grid { stroke: var(--line); stroke-width: 1; }
.curve .tick { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
.curve .axis { fill: var(--muted); font-size: 11px; }
.curve .now { stroke: var(--ink); stroke-dasharray: 4 4; stroke-width: 1.2; }
.curve .nowlbl { fill: var(--ink); font-size: 11.5px; font-weight: 600; }
.curve .opt { stroke-width: 2.2; opacity: .8; }
.curve .opt.best { stroke-width: 4; opacity: 1; }
.curve .cross { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.legend { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .84rem; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.legend li.out { opacity: .5; text-decoration: line-through; }
.bands, .flips, .flags { margin: 10px 0 0; padding-left: 18px; }
.bands li, .flips li, .flags li { margin: 4px 0; }
.flips li.weight::marker { color: var(--s4); }
.flips li.gmv::marker { color: var(--brand); }
.flips li.contacts::marker { color: var(--s3); }
.flags li.warn { color: var(--warn); }
.wrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; margin: 8px 0; }
.wrow label { font-weight: 600; font-size: .92rem; }
.wrow output { font-family: var(--mono); font-weight: 700; min-width: 2ch; text-align: right; }
.wrow input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--brand); min-height: 32px; }
.wrow .wh { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); margin-top: -4px; }
details.more summary, details.ai summary { cursor: pointer; font-weight: 650; min-height: 40px; display: flex; align-items: center; gap: 8px; }
details.more[open] summary { margin-bottom: 8px; }
.badge { font-size: .72rem; font-weight: 600; border-radius: 999px; padding: 2px 8px; background: var(--soft); color: var(--muted); }
.ai .hint { font-size: .9rem; color: var(--muted); }
.ai .hint.bad { color: var(--bad); }
.warn-soft { background: var(--warn-soft); color: var(--ink) !important; padding: 8px 10px; border-radius: 8px; }
.ai-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.progress { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.progresshead { display: flex; justify-content: space-between; }
.steps { margin: 8px 0 0; padding-left: 20px; font-size: .9rem; color: var(--muted); }
.steps li.on { color: var(--ink); font-weight: 650; }
.steps li.done { color: var(--ok); }
.report { border-left: 6px solid var(--s4); }
.report .rhead { font-size: 1.15rem; font-weight: 700; margin: 0 0 6px; }
.report .rgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 20px; }
.report h3 { font-size: .95rem; margin: 12px 0 4px; }
.report ul { margin: 0; padding-left: 18px; }
.report li { margin: 3px 0; }
.report .checks li.ok { color: var(--ok); }
.report .checks li.warn { color: var(--warn); }
.report .checks li.bad { color: var(--bad); }
.report .rnote { background: var(--soft); border-radius: 8px; padding: 8px 10px; }
.report .rnote.bad { background: var(--accent-soft); color: var(--bad); }
.history { margin-top: 16px; }
.historylist { list-style: none; padding: 0; margin: 0; }
.historylist li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.linkbtn { background: none; border: 0; color: var(--brand); padding: 6px 0; min-height: 40px; text-align: left; font-weight: 600; }

/* below the tool */
.about { margin-top: 36px; max-width: 760px; }
.about h2 { font-size: 1.25rem; margin-top: 22px; }
.howlist li { margin: 6px 0; }
.faq dt { font-weight: 650; margin-top: 12px; }
.faq dd { margin: 4px 0 0; color: var(--muted); }
.foot { border-top: 1px solid var(--line); padding: 16px; text-align: center; color: var(--muted); font-size: .86rem; }
.foot p { margin: 4px auto; max-width: 760px; }

/* docs pages */
.doc { max-width: 860px; padding-top: 20px; }
.doc table { border-collapse: collapse; width: 100%; margin: 8px 0 16px; font-size: .9rem; display: block; overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.doc pre { background: var(--soft); border: 1px solid var(--line); border-radius: 9px; padding: 12px; overflow-x: auto; font-size: .84rem; }
.codegroup { margin: 8px 0 18px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tab { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; min-height: 36px; font-size: .84rem; color: var(--ink); }
.tab.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.statebox { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--paper); }
.tokenrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.tokenbox { font-family: var(--mono); background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px; word-break: break-all; width: 100%; }

@media (max-width: 860px) {
  .cols { grid-template-columns: 1fr; }
  .verdict { grid-template-columns: 1fr; }
  .exports { min-width: 0; }
}
@media (max-width: 560px) {
  .startgrid { grid-template-columns: 1fr; gap: 8px; }
  .start .primary { justify-self: stretch; }
  .hero { padding-top: 16px; }
  .lede { font-size: 1rem; }
  .exp-grid { grid-template-columns: 1fr 1fr 1fr; }
  .topbar { padding: 8px 12px; }
}
@media print {
  .topbar, .hero, .colside, #history, .about, .foot, .exports, .optchips, .editor { display: none !important; }
  .cols { grid-template-columns: 1fr; }
}
