/* ── Free tools (calculators, builders) ─────────────────────────── */
.tool-section { padding: 56px 0 72px; }

.tool-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.tool-col-sticky { position: sticky; top: 96px; }

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.tool-card + .tool-card { margin-top: 20px; }
.tool-card h2 { font-size: 1.1rem; margin-bottom: 4px; }
.tool-card-sub { font-size: 0.85rem; margin-bottom: 20px; color: var(--text-dim); }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-grid .form-group { margin-bottom: 0; }
.field-grid + .field-grid { margin-top: 16px; }
.tool-card .form-group { margin-bottom: 16px; }
.field-hint { display: block; font-size: 0.75rem; color: var(--text-faint); margin-top: 6px; line-height: 1.4; }
.input-affix { position: relative; }
.input-affix > span {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 0.9rem; color: var(--text-faint); pointer-events: none;
}
.input-affix > input { padding-left: 26px; }
.input-affix.suffix > span { left: auto; right: 12px; }
.input-affix.suffix > input { padding-left: 14px; padding-right: 28px; }

/* Results */
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.metric {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.metric-label { font-size: 0.75rem; font-weight: 500; color: var(--text-dim); }
.metric-value { font-size: 1.35rem; font-weight: 700; color: var(--navy-900); margin-top: 2px; word-break: break-word; }
.metric-note { font-size: 0.72rem; color: var(--text-faint); margin-top: 2px; }
.metric--hero {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--navy-800) 0%, #1a3a8a 60%, #0e4f6e 100%);
  border: none;
}
.metric--hero .metric-label,
.metric--hero .metric-note { color: rgba(255,255,255,0.75); }
.metric--hero .metric-value { color: #fff; font-size: 2rem; }

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th {
  text-align: left; font-weight: 600; color: var(--text-mid);
  padding: 8px 10px; border-bottom: 1.5px solid var(--border-2); white-space: nowrap;
}
.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); color: var(--text-dim); white-space: nowrap; }
.data-table td.num, .data-table th.num { text-align: right; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tfoot td { font-weight: 700; color: var(--navy-900); border-top: 1.5px solid var(--border-2); border-bottom: none; }

.pill {
  display: inline-block; font-size: 0.72rem; font-weight: 600;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
.pill--good { background: rgba(16,185,129,0.12); color: #047857; }
.pill--warn { background: rgba(249,115,22,0.14); color: #c2410c; }
.pill--bad  { background: rgba(239,68,68,0.12);  color: #b91c1c; }

.callout {
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 0.85rem; line-height: 1.5;
  background: rgba(124,58,237,0.06); border: 1px solid rgba(124,58,237,0.18); color: var(--text-mid);
}
.callout + .callout { margin-top: 10px; }
.callout--warn { background: rgba(249,115,22,0.08); border-color: rgba(249,115,22,0.3); color: #9a3412; }
.callout-list { list-style: none; display: grid; gap: 10px; margin: 0; padding: 0; }

.tool-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

.tool-note { font-size: 0.78rem; color: var(--text-faint); margin-top: 16px; line-height: 1.5; }

/* Plan builder rows */
.row-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card-2);
  padding: 14px;
  margin-bottom: 12px;
}
.row-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.row-card-head input { max-width: 220px; font-weight: 600; }
.row-card .field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row-card .field-grid .form-group label { font-size: 0.75rem; }
.row-card--seg .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.btn-ghost {
  background: transparent; border: 1.5px dashed var(--border-2); color: var(--text-mid);
  border-radius: var(--radius-sm); padding: 9px 14px; font-size: 0.85rem; font-weight: 600;
}
.btn-ghost:hover { border-color: var(--brand-500); color: var(--brand-500); }
.btn-ghost[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-remove {
  background: none; border: none; color: var(--text-faint); font-size: 0.8rem; padding: 4px 8px; border-radius: 6px;
}
.btn-remove:hover { color: #b91c1c; background: rgba(239,68,68,0.08); }

/* Bar chart */
.bar-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 90px; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 0.82rem; }
.bar-label { color: var(--text-mid); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 18px; background: var(--bg-2); border-radius: 6px; overflow: hidden; display: flex; }
.bar-base { background: var(--brand-500); height: 100%; }
.bar-over { background: var(--teal-400); height: 100%; }
.bar-val { text-align: right; font-weight: 600; color: var(--navy-900); }
.legend { display: flex; gap: 16px; font-size: 0.75rem; color: var(--text-dim); margin-bottom: 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* Invoice preview */
.invoice { border: 1.5px solid var(--border-2); border-radius: var(--radius-sm); background: #fff; padding: 16px 18px; font-size: 0.85rem; }
.invoice-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; color: var(--navy-900); font-weight: 700; }
.invoice-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); color: var(--text-dim); }
.invoice-line span:last-child { white-space: nowrap; color: var(--navy-900); font-weight: 500; }
.invoice-total { display: flex; justify-content: space-between; padding-top: 10px; font-weight: 700; color: var(--navy-900); }

/* Content below the tool */
.tool-prose { max-width: 760px; margin: 0 auto; }
.tool-prose h2 { font-size: 1.5rem; margin: 40px 0 12px; }
.tool-prose h2:first-child { margin-top: 0; }
.tool-prose p, .tool-prose li { font-size: 0.95rem; line-height: 1.8; }
.tool-prose p { margin-bottom: 14px; }
.tool-prose ul { margin: 0 0 16px 20px; }
.tool-prose a { color: var(--brand-500); text-decoration: underline; }
.tool-prose code { background: var(--bg-2); padding: 1px 6px; border-radius: 4px; font-size: 0.85em; }

/* Hub */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; max-width: 1000px; margin: 0 auto; }
.tool-tile {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
}
.tool-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.tool-tile h3 { font-size: 1.2rem; }
.tool-tile p { font-size: 0.9rem; flex: 1; }
.tool-tile .tile-cta { color: var(--brand-500); font-weight: 600; font-size: 0.9rem; }

@media (max-width: 900px) {
  .tool-wrap { grid-template-columns: minmax(0, 1fr); }
  .tool-col-sticky { position: static; }
}
@media (max-width: 560px) {
  .field-grid, .row-card .field-grid, .row-card--seg .field-grid, .metric-grid { grid-template-columns: minmax(0, 1fr); }
  .tool-card { padding: 20px; }
  .bar-row { grid-template-columns: 96px minmax(0, 1fr) 72px; }
  .bar-label { white-space: normal; line-height: 1.2; }
}

/* FAQ accordion (same markup/behaviour as pricing page; toggled by main.js) */
.faq-list { max-width: 760px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:first-child { border-top: 1px solid var(--border); }
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 18px 0;
  background: none;
  border: none;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy-900);
  gap: 16px;
}
.faq-icon {
  flex-shrink: 0;
  width: 24px; height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-500);
  font-size: 1.3rem;
  font-weight: 400;
  transition: transform 0.25s ease;
}
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-answer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}
.faq-answer-inner { overflow: hidden; }
.faq-answer-inner p { font-size: 0.92rem; line-height: 1.7; color: var(--text-dim); padding-bottom: 22px; }
.faq-item.open .faq-answer { grid-template-rows: 1fr; }


/* Key/value rows (schema generator) */
.pair-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.pair-row input {
  width: 100%; background: var(--bg); border: 1.5px solid var(--border-2); border-radius: var(--radius-sm);
  color: var(--navy-900); font-size: 0.85rem; font-family: inherit; padding: 9px 12px; outline: none;
}
.pair-row input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(124,58,237,0.1); }

/* Code output */
.lang-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.lang-tab {
  background: var(--bg-card-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 14px; font-size: 0.8rem; font-weight: 600; color: var(--text-dim);
}
.lang-tab.active { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }
.code-block {
  background: var(--navy-900); color: #e2e8f0; border-radius: var(--radius-sm); padding: 16px;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.78rem; line-height: 1.6;
  overflow-x: auto; white-space: pre; margin: 0;
}
.code-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 18px 0 8px; font-size: 0.85rem; font-weight: 600; color: var(--text-mid); }
.code-head:first-child { margin-top: 0; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-mid); margin-top: 6px; }
.check-row input { width: auto; accent-color: var(--brand-500); }

/* Checklist */
.quiz-intro { font-size: 0.85rem; color: var(--text-dim); margin: 0 0 4px; }
.quiz-q {
  border: 1.5px solid var(--border-2); border-radius: 12px; padding: 16px 16px 14px; margin-top: 14px;
  background: #fff; transition: border-color .15s, background .15s;
}
.quiz-q[data-state="yes"]    { border-color: rgba(16,185,129,.55); background: rgba(16,185,129,.045); }
.quiz-q[data-state="partly"] { border-color: rgba(245,158,11,.6);  background: rgba(245,158,11,.05); }
.quiz-q[data-state="no"]     { border-color: rgba(239,68,68,.5);   background: rgba(239,68,68,.04); }
.quiz-q-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; margin-bottom: 14px; }
.quiz-num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--bg-2); color: var(--text-mid);
  font-size: 0.78rem; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.quiz-q[data-state="yes"] .quiz-num    { background: #10b981; color: #fff; }
.quiz-q[data-state="partly"] .quiz-num { background: #f59e0b; color: #fff; }
.quiz-q[data-state="no"] .quiz-num     { background: #ef4444; color: #fff; }
.quiz-text { font-size: 0.95rem; color: var(--navy-900); font-weight: 600; line-height: 1.45; margin: 0; }
.quiz-status {
  font-size: 0.7rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap;
  padding: 3px 9px; border-radius: 999px; background: var(--bg-2); color: var(--text-faint); margin-top: 2px;
}
.quiz-q[data-state="yes"] .quiz-status    { background: rgba(16,185,129,.15); color: #047857; }
.quiz-q[data-state="partly"] .quiz-status { background: rgba(245,158,11,.18); color: #b45309; }
.quiz-q[data-state="no"] .quiz-status     { background: rgba(239,68,68,.13);  color: #b91c1c; }

.choice-group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.choice { position: relative; display: block; cursor: pointer; margin: 0; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice-body {
  display: flex; align-items: center; gap: 10px; height: 100%;
  border: 1.5px solid var(--border-2); border-radius: 10px; padding: 10px 12px; background: var(--bg);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.choice:hover .choice-body { border-color: var(--text-faint); background: #fff; }
.choice input:focus-visible + .choice-body { outline: 3px solid rgba(124,58,237,.35); outline-offset: 2px; }
.choice-mark {
  flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-2); background: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 800; color: transparent; line-height: 1;
}
.choice-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.choice-label { font-size: 0.88rem; font-weight: 700; color: var(--navy-900); }
.choice-desc { font-size: 0.72rem; color: var(--text-dim); margin-top: 2px; }

.choice--yes    { --c: #10b981; --c-bg: rgba(16,185,129,.12); }
.choice--partly { --c: #f59e0b; --c-bg: rgba(245,158,11,.15); }
.choice--no     { --c: #ef4444; --c-bg: rgba(239,68,68,.1); }
.choice.on .choice-body { background: var(--c-bg); border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.choice.on .choice-mark { color: #fff; border-color: var(--c); background: var(--c); }
.choice.on .choice-label { color: var(--navy-900); }

.score-big { font-size: 3rem; font-weight: 800; color: var(--navy-900); line-height: 1; }
.score-big.is-empty { color: var(--border-2); }
.score-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.score-row .pill:empty { display: none; }
.progress { margin-bottom: 18px; }
.progress-text { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }
.progress-track { height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-500), var(--teal-400)); border-radius: 999px; transition: width .25s ease; }

@media (max-width: 520px) {
  .choice-body { padding: 10px 8px; gap: 7px; justify-content: center; }
  .choice-desc { display: none; }
  .choice-mark { width: 18px; height: 18px; }
  .quiz-q-head { grid-template-columns: auto minmax(0, 1fr); }
  .quiz-status { grid-column: 2; justify-self: start; }
}

@media (max-width: 560px) {
  .pair-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
}

/* ── UX polish ──────────────────────────────────────────────────── */
/* The global form styles strip the native select arrow, so selects looked like text boxes. */
.tool-card select,
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23475569' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}
.tool-card h2 + .field-grid,
.tool-card h2 + .form-group,
.tool-card h2 + #tiers,
.tool-card h2 + #segments { margin-top: 14px; }

/* Name boxes inside tier / segment cards */
.row-card-head input {
  flex: 1; max-width: 240px; min-width: 0; background: #fff; border: 1.5px solid var(--border-2); border-radius: var(--radius-sm);
  color: var(--navy-900); font-size: 0.9rem; font-family: inherit; padding: 8px 12px; outline: none;
}
.row-card-head input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(124,58,237,0.1); }
.row-card .input-affix > input, .row-card .form-group input { background: #fff; }

/* Remove buttons: readable at rest, clearly destructive on hover */
.btn-remove { color: var(--text-dim); font-weight: 600; border: 1px solid transparent; }
.btn-remove:hover:not([disabled]) { color: #b91c1c; background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.25); }
.btn-remove[disabled] { opacity: .35; cursor: not-allowed; }
.pair-row .btn-remove { padding: 6px 9px; font-size: 0.85rem; }

/* Two-line table cells: revenue over margin pill, so wide tables fit the results card */
.cell-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; line-height: 1.2; }
.cell-stack .pill { font-size: 0.68rem; padding: 1px 8px; }
.data-table td, .data-table th { padding-left: 8px; padding-right: 8px; }

/* Toggle switch (replaces a bare checkbox) */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; margin-top: 18px; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--border-2); position: relative; transition: background .2s;
}
.switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(15,23,41,.3); transition: transform .2s;
}
.switch input:checked + .switch-track { background: var(--brand-500); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 3px solid rgba(124,58,237,.35); outline-offset: 2px; }
.switch-text { font-size: 0.85rem; color: var(--text-mid); font-weight: 500; }
.switch-state { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); margin-left: auto; }
.switch input:checked ~ .switch-state { color: var(--brand-500); }

/* Highlight the model the user picked in comparison bars */
.bar-row--selected .bar-label { color: var(--navy-900); font-weight: 700; }
.bar-row--selected .bar-base { background: var(--teal-400); }
.bar-tag { display: inline-block; font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #0e7490; background: rgba(6,182,212,.15); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; }

/* Make keyboard focus visible everywhere in the tools */
.lang-tab:focus-visible, .btn-ghost:focus-visible, .btn-remove:focus-visible, .btn:focus-visible { outline: 3px solid rgba(124,58,237,.35); outline-offset: 2px; }

/* Scrollable tables: edge shadows show where more content is, hint appears only when the table overflows */
.table-scroll {
  background:
    linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) 0 0 / 36px 100% no-repeat local,
    linear-gradient(to left,  #fff 30%, rgba(255,255,255,0)) 100% 0 / 36px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%,   rgba(15,23,41,.22), rgba(15,23,41,0)) 0 0 / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(15,23,41,.22), rgba(15,23,41,0)) 100% 0 / 14px 100% no-repeat scroll;
  -webkit-overflow-scrolling: touch;
}
.table-hint { display: none; font-size: 0.72rem; color: var(--text-dim); margin: 6px 0 0; font-weight: 500; }
.table-scroll.is-scrollable + .table-hint { display: block; }

@media (max-width: 560px) {
  .bar-row[style] { grid-template-columns: 110px minmax(0, 1fr) 84px !important; }
}

/* Breadcrumbs */
.crumbs { background: var(--bg); border-bottom: 1px solid var(--border); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 12px 0; font-size: 0.8rem; color: var(--text-dim); }
.crumbs li + li::before { content: '›'; margin-right: 4px; color: var(--text-faint); }
.crumbs a { color: var(--text-dim); text-decoration: underline; text-underline-offset: 2px; }
.crumbs a:hover { color: var(--brand-500); }
.crumbs [aria-current="page"] { color: var(--navy-900); font-weight: 600; }
