/* ============================================================================
   Manticore Finance — free online calculators (tools).
   Loaded ON TOP of pages.css, which supplies tokens, nav, footer and backdrop.
   Everything here is the calculator UI: inputs, live results and the small charts.
   ============================================================================ */

.tools-intro { max-width: 720px; }

/* ---- hub grid ---- */
.tool-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 34px 0 8px; }
.tool-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px; text-decoration: none; transition: transform .2s, border-color .2s, background .2s;
}
.tool-card:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--panel-2); }
.tool-card .ic { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(91,140,255,0.22), rgba(47,87,214,0.12)); border: 1px solid rgba(91,140,255,0.28); margin-bottom: 6px; }
.tool-card .ic svg { width: 20px; height: 20px; stroke: var(--accent-2); fill: none; stroke-width: 2; }
.tool-card h3 { font-size: 1.12rem; color: var(--text); margin: 0; }
.tool-card p { font-size: 14px; color: var(--text-dim); margin: 0; line-height: 1.55; }
.tool-card .go { margin-top: auto; padding-top: 8px; color: var(--accent-2); font-size: 14px; font-weight: 600; }
@media (max-width: 900px) { .tool-cards { grid-template-columns: 1fr; } }

/* ---- calculator shell ---- */
/* No overflow:hidden here — it would clip the hover tooltips. The rounded
   corners are carried by the panels themselves instead. */
.calc { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; margin: 8px 0 6px; }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; }
.calc-inputs { padding: 28px; border-right: 1px solid var(--border); min-width: 0; border-radius: 18px 0 0 18px; }
.calc-output { padding: 28px; background: var(--bg-2); min-width: 0; border-radius: 0 18px 18px 0; }
@media (max-width: 760px) {
  .calc-grid { grid-template-columns: 1fr; }
  .calc-inputs { border-right: none; border-bottom: 1px solid var(--border); border-radius: 18px 18px 0 0; }
  .calc-output { border-radius: 0 0 18px 18px; }
}

/* wide variant: input-heavy calculators (e.g. the debt table) stack so the
   inputs get the full column width and every field stays readable */
.calc.wide .calc-grid { grid-template-columns: 1fr; }
.calc.wide .calc-inputs { border-right: none; border-bottom: 1px solid var(--border); border-radius: 18px 18px 0 0; }
.calc.wide .calc-output { border-radius: 0 0 18px 18px; }

.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
.field label { position: relative; display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; color: var(--text-dim); margin-bottom: 8px; }
.field label .hint { color: var(--text-faint); font-size: 12px; }
.field label .lb { display: inline-flex; align-items: center; gap: 6px; }

/* ---- hover-info tooltip (the circled "i") ---- */
.info {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; width: 16px; height: 16px; padding: 0; margin: 0;
  border: none; background: none; color: var(--text-faint);
  cursor: help; -webkit-appearance: none; appearance: none; line-height: 0;
  transition: color .18s;
}
.info svg { width: 16px; height: 16px; display: block; }
.info:hover, .info:focus-visible { color: var(--accent-2); outline: none; }
.info:focus-visible { color: var(--accent-2); }
/* the bubble is anchored to the whole field and left-aligned, so it can never
   run off the panel edge on narrow screens; it opens above the field */
.info .tip {
  position: absolute; left: 0; bottom: calc(100% + 9px); z-index: 40;
  width: max-content; max-width: min(300px, 100%);
  background: var(--panel-2); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 13px; font-size: 12.5px; font-weight: 400; line-height: 1.55;
  text-align: left; letter-spacing: normal; text-transform: none;
  box-shadow: 0 14px 34px rgba(0,0,0,0.5);
  opacity: 0; visibility: hidden; transform: translateY(5px);
  transition: opacity .16s ease, transform .16s ease; pointer-events: none;
}
.info:hover .tip, .info:focus .tip, .info:focus-visible .tip {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.field .in { display: flex; align-items: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; transition: border-color .2s; }
.field .in:focus-within { border-color: var(--accent); }
.field .in .pre, .field .in .suf { color: var(--text-faint); font-size: 15px; }
.field .in input { flex: 1; background: none; border: none; color: var(--text); font-family: var(--sans); font-size: 16px; padding: 12px 0; width: 100%; }
.field .in input:focus { outline: none; }
.field input[type=range] { width: 100%; margin-top: 12px; accent-color: var(--accent); }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: none; background: none; color: var(--text-dim); font-family: var(--sans); font-size: 13.5px; font-weight: 600; padding: 8px 14px; border-radius: 8px; cursor: pointer; transition: background .2s, color .2s; }
.seg button.on { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #fff; }

/* ---- output ---- */
.out-primary .lbl { font-size: 13.5px; color: var(--text-dim); }
.out-primary .val { font-family: var(--serif); font-size: 2.6rem; color: var(--text); letter-spacing: -.02em; line-height: 1.1; margin-top: 2px; }
.out-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border-soft); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-top: 22px; }
.out-grid .c { background: var(--panel); padding: 15px 16px; }
.out-grid .c .v { font-size: 1.2rem; color: var(--text); font-variant-numeric: tabular-nums; }
.out-grid .c .l { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.out-grid .c.accent .v { color: var(--accent-2); }
.out-grid .c.good .v { color: var(--green); }
.out-grid .c.warn .v { color: var(--yellow); }

/* stacked bar */
.viz { margin-top: 22px; }
.viz .bar { display: flex; height: 30px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.viz .bar span { display: block; height: 100%; transition: width .35s ease; }
.viz .s-a { background: linear-gradient(180deg, var(--accent), var(--accent-deep)); }
.viz .s-b { background: repeating-linear-gradient(135deg, #2a3a5f, #2a3a5f 6px, #24324f 6px, #24324f 12px); }
.viz .s-c { background: var(--panel-2); }
.viz .key { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-top: 12px; font-size: 12.5px; color: var(--text-dim); }
.viz .key i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.viz .key .k-a { background: var(--accent); } .viz .key .k-b { background: #2a3a5f; } .viz .key .k-c { background: var(--panel-2); }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
.compare .p { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.compare .p.win { border-color: var(--green); box-shadow: inset 0 0 0 1px rgba(47,191,113,0.25); }
.compare .p h4 { font-size: 14px; color: var(--text); margin: 0 0 8px; display: flex; align-items: center; gap: 7px; }
.compare .p h4 .tag { font-size: 11px; font-weight: 700; color: var(--green); background: rgba(47,191,113,0.14); padding: 2px 7px; border-radius: 5px; }
.compare .p .row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--text-dim); padding: 4px 0; }
.compare .p .row b { color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .compare { grid-template-columns: 1fr; } .out-grid { grid-template-columns: 1fr; } }

/* debt rows */
.debt-rows { display: flex; flex-direction: column; gap: 10px; }
.debt-head, .debt-row { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1.1fr) minmax(0,0.9fr) minmax(0,1.1fr) 36px; gap: 10px; align-items: center; }
.debt-row input { min-width: 0; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; color: var(--text); font-family: var(--sans); font-size: 14px; padding: 10px; width: 100%; }
.debt-row input:focus { outline: none; border-color: var(--accent); }
.debt-row .rm { background: none; border: 1px solid var(--border); color: var(--text-faint); border-radius: 8px; width: 36px; height: 40px; cursor: pointer; font-size: 16px; }
.debt-row .rm:hover { color: var(--red); border-color: var(--red); }
.debt-head { font-size: 12px; color: var(--text-faint); margin-bottom: 4px; }
@media (max-width: 560px) {
  .debt-head, .debt-row { grid-template-columns: minmax(0,1.5fr) minmax(0,1fr) minmax(0,0.8fr) minmax(0,1fr) 34px; gap: 6px; }
  .debt-row input { padding: 9px 8px; }
  .debt-row .rm { width: 34px; }
}
.add-debt { margin-top: 12px; background: rgba(255,255,255,0.04); border: 1px dashed var(--border); color: var(--text-dim); border-radius: 10px; padding: 10px; width: 100%; cursor: pointer; font-family: var(--sans); font-size: 14px; }
.add-debt:hover { color: var(--text); border-color: var(--accent); }

/* assumptions + app cta */
.tool-note { font-size: 13px; color: var(--text-faint); line-height: 1.6; margin-top: 18px; }
.tool-cta { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(91,140,255,0.10), rgba(47,87,214,0.05)); border: 1px solid rgba(91,140,255,0.24);
  border-radius: 16px; padding: 22px 26px; margin: 40px 0 10px; }
.tool-cta div { max-width: 62ch; }
.tool-cta h3 { font-size: 1.15rem; color: var(--text); margin: 0 0 4px; }
.tool-cta p { font-size: 14px; color: var(--text-dim); margin: 0; }
.tool-cta .btn { white-space: nowrap; }

/* ============================================================================
   Email-capture — shared by the pop-up (.sub-modal) and the inline block.
   ============================================================================ */
.sub-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.sub-form { margin-top: 4px; }
.sub-field { display: flex; gap: 8px; }
.sub-field .sub-email {
  flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-family: var(--sans); font-size: 15px; padding: 12px 14px;
}
.sub-field .sub-email:focus { outline: none; border-color: var(--accent); }
.sub-field .sub-submit { white-space: nowrap; }
.sub-field .sub-submit:disabled { opacity: .6; cursor: default; }
.sub-consent { display: flex; gap: 9px; align-items: flex-start; margin-top: 12px; font-size: 12.5px; color: var(--text-dim); line-height: 1.5; cursor: pointer; }
.sub-consent input { margin-top: 2px; accent-color: var(--accent); flex: none; }
.sub-consent a { color: var(--accent-2); }
.sub-status { font-size: 13px; margin: 10px 0 0; min-height: 0; }
.sub-status.err { color: var(--yellow); }
.sub-thanks { text-align: center; padding: 8px 4px; }
.sub-thanks-ic { font-size: 30px; line-height: 1; margin-bottom: 10px; }
.sub-thanks h3 { font-size: 1.15rem; color: var(--text); margin: 0 0 8px; }
.sub-thanks p { font-size: 14px; color: var(--text-dim); line-height: 1.55; margin: 0; }
@media (max-width: 460px) { .sub-field { flex-direction: column; } .sub-field .sub-submit { width: 100%; } }

/* inline block (calm, always-present version on the tools hub) */
.sub-inline { background: linear-gradient(135deg, rgba(91,140,255,0.10), rgba(47,87,214,0.05));
  border: 1px solid rgba(91,140,255,0.24); border-radius: 16px; padding: 26px 28px; margin: 40px 0 10px; }
.sub-inline .sub-eyebrow { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-2); font-weight: 700; margin-bottom: 8px; }
.sub-inline h3 { font-size: 1.25rem; color: var(--text); margin: 0 0 6px; }
.sub-inline .sub-lead { font-size: 14px; color: var(--text-dim); line-height: 1.6; margin: 0 0 16px; max-width: 60ch; }
.sub-inline .sub-form { max-width: 460px; }

/* pop-up */
.sub-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease; }
.sub-modal.open { opacity: 1; visibility: visible; }
.sub-backdrop { position: absolute; inset: 0; background: rgba(3,5,10,0.66); backdrop-filter: blur(4px); }
.sub-card { position: relative; z-index: 1; width: 100%; max-width: 440px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 18px; padding: 30px 30px 28px; box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  transform: translateY(12px) scale(.98); transition: transform .25s ease; }
.sub-modal.open .sub-card { transform: none; }
.sub-x { position: absolute; top: 12px; right: 14px; background: none; border: none; color: var(--text-faint);
  font-size: 24px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.sub-x:hover { color: var(--text); }
.sub-card .sub-eyebrow { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-2); font-weight: 700; margin-bottom: 8px; }
.sub-card .sub-title { font-size: 1.4rem; color: var(--text); margin: 0 0 8px; }
.sub-card .sub-lead { font-size: 14px; color: var(--text-dim); line-height: 1.6; margin: 0 0 18px; }
