/* ============================================================
   GoFile Tool UI — shared design system for /tools/ calculators
   Dark single-screen dashboard: glowing input panel, stat strip,
   breakdown card (donut + receipt), light detail sections below.
   Card surface: #10283e. Validated chart palette (CVD-checked):
   keep/net #0da184 · blue #4a90d9 · orange #cf7a1f ·
   purple #9d7bf5 · pink #d8697f · red #bc4a63
   ============================================================ */

.tool-app {
  background:
    radial-gradient(1100px 500px at 78% -10%, rgba(19,214,176,0.10), transparent 60%),
    radial-gradient(900px 460px at 8% 110%, rgba(74,144,217,0.10), transparent 55%),
    linear-gradient(160deg, #0b1d2e 0%, #12314a 58%, #0e2739 100%);
  color: #fff;
  padding: 18px 0 26px;
}
.tool-container { max-width: 1240px; }

/* --- Head row --- */
.tool-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}
.tool-head .guide-breadcrumb { margin-bottom: 4px; }
.tool-head h1 {
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  line-height: 1.2;
  margin: 0;
}
.tool-head .tool-sub {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.62);
  margin: 4px 0 0;
}
.tool-year-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 7px 8px 7px 16px;
  flex-shrink: 0;
}
.tool-year-pill label { font-size: 0.82rem; color: rgba(255,255,255,0.65); white-space: nowrap; }
.tool-year-pill select {
  padding: 5px 10px;
  border-radius: 999px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.tool-year-pill select option { background: #12314a; color: #fff; }

/* --- Main grid --- */
.tool-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: stretch;
}
.tool-card {
  background: #10283e;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(3,12,20,0.35);
}

/* --- Inputs panel (the action area) --- */
.tool-inputs {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: linear-gradient(165deg, rgba(19,214,176,0.13), rgba(19,214,176,0.02) 50%), #10283e;
  border-color: rgba(19,214,176,0.45);
  box-shadow: 0 10px 30px rgba(3,12,20,0.35), 0 0 30px rgba(19,214,176,0.12);
}
.tool-field-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #13d6b0;
}
.tool-field-label-sm {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 6px;
}
.tool-input-hint { font-size: 0.82rem; color: rgba(255,255,255,0.5); line-height: 1.5; margin-top: -8px; }

/* £ amount inputs */
.tool-amount { position: relative; }
.tool-amount::before {
  content: '\00a3';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #13d6b0;
  font-size: 1.35rem;
  font-weight: 700;
  pointer-events: none;
}
.tool-amount input {
  width: 100%;
  padding: 13px 16px 13px 38px;
  border: 1.5px solid rgba(255,255,255,0.16);
  border-radius: 12px;
  background: rgba(255,255,255,0.07);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  box-sizing: border-box;
  -moz-appearance: textfield;
}
.tool-amount input::-webkit-outer-spin-button,
.tool-amount input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tool-amount input:focus {
  outline: none;
  border-color: #13d6b0;
  box-shadow: 0 0 0 3px rgba(19,214,176,0.18);
}
.tool-amount-sm::before { font-size: 1rem; left: 12px; }
.tool-amount-sm input { font-size: 1rem; font-weight: 600; padding: 9px 12px 9px 30px; border-radius: 10px; }

/* Slider */
.tool-inputs input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  cursor: pointer;
  --tool-fill: 20%;
}
.tool-inputs input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(to right, #13d6b0 0%, #13d6b0 var(--tool-fill), rgba(255,255,255,0.16) var(--tool-fill));
}
.tool-inputs input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -8px;
  border-radius: 50%;
  background: #13d6b0;
  border: 3px solid #fff;
  box-shadow: 0 0 0 5px rgba(19,214,176,0.25), 0 2px 10px rgba(0,0,0,0.45);
  cursor: grab;
  transition: box-shadow 0.15s;
}
.tool-inputs input[type="range"]:active::-webkit-slider-thumb {
  cursor: grabbing;
  box-shadow: 0 0 0 8px rgba(19,214,176,0.3), 0 2px 10px rgba(0,0,0,0.45);
}
.tool-inputs input[type="range"]::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
}
.tool-inputs input[type="range"]::-moz-range-progress {
  height: 10px;
  border-radius: 999px;
  background: #13d6b0;
}
.tool-inputs input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #13d6b0;
  border: 3px solid #fff;
  box-shadow: 0 0 0 5px rgba(19,214,176,0.25), 0 2px 10px rgba(0,0,0,0.45);
  cursor: grab;
}
.tool-inputs input[type="range"]:focus-visible {
  outline: 2px solid rgba(19,214,176,0.7);
  outline-offset: 4px;
  border-radius: 999px;
}

/* Preset chips */
.tool-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-chip {
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.8);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tool-chip:hover { border-color: rgba(19,214,176,0.7); color: #fff; }
.tool-chip.active { background: #13d6b0; border-color: #13d6b0; color: #0b1d2e; }

/* Segmented control (mutually exclusive options, e.g. buyer type) */
.tool-seg {
  display: flex;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}
.tool-seg button {
  flex: 1;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  border-radius: 8px;
  padding: 8px 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tool-seg button:hover { color: #fff; }
.tool-seg button.active { background: #13d6b0; color: #0b1d2e; }

/* Toggle switch */
.tool-switch {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.84rem;
  color: rgba(255,255,255,0.78);
  line-height: 1.45;
  user-select: none;
}
.tool-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.tool-switch .tool-track {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
  margin-top: 1px;
}
.tool-switch .tool-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.tool-switch input:checked + .tool-track { background: #13d6b0; }
.tool-switch input:checked + .tool-track::after { transform: translateX(16px); }
.tool-switch input:focus-visible + .tool-track { box-shadow: 0 0 0 3px rgba(19,214,176,0.35); }
.tool-switch small { display: block; color: rgba(255,255,255,0.45); font-size: 0.76rem; margin-top: 2px; }

/* Callout + note + CTA */
.tool-save {
  background: linear-gradient(135deg, rgba(19,214,176,0.16), rgba(19,214,176,0.05));
  border: 1px solid rgba(19,214,176,0.35);
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.85);
}
.tool-save strong { color: #fff; font-size: 1.05rem; }
.tool-save.hidden { display: none; }
.tool-note {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.62);
  line-height: 1.5;
  border-left: 3px solid #cf7a1f;
  padding: 2px 0 2px 10px;
}
.tool-note.hidden { display: none; }
.tool-cta {
  margin-top: auto;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.55;
  border-top: 1px solid rgba(255,255,255,0.09);
  padding-top: 13px;
}
.tool-cta a { color: #13d6b0; font-weight: 600; }
.tool-cta a:hover { text-decoration: underline; }

/* --- Results column --- */
.tool-results { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* Stat strip: default 4 tiles; .tool-stats-5 for five */
.tool-stats {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
  gap: 12px;
}
.tool-stats-5 { grid-template-columns: 1.5fr 1fr 1fr 1.1fr 1.35fr; }
.tool-stats-3 { grid-template-columns: 1.6fr 1fr 1fr; }
.tool-stat {
  background: #10283e;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  padding: 14px 16px;
  min-width: 0;
}
.tool-stat-label {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-bottom: 5px;
  white-space: nowrap;
}
.tool-stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}
.tool-stat-sub { font-size: 0.75rem; color: rgba(255,255,255,0.48); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-stat-hero {
  background: linear-gradient(135deg, rgba(19,214,176,0.2), rgba(19,214,176,0.04)), #10283e;
  border-color: rgba(19,214,176,0.4);
}
.tool-stat-hero .tool-stat-label { color: rgba(19,214,176,0.95); }
.tool-stat-hero .tool-stat-value { font-size: 2.1rem; }
.tool-meter {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  margin-top: 9px;
  overflow: hidden;
}
.tool-meter span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #13d6b0;
  width: 0;
  transition: width 0.3s ease;
}

/* --- Breakdown card: donut + receipt --- */
.tool-breakdown { flex: 1; position: relative; }
.tool-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.tool-card-head h2 { font-size: 0.95rem; font-weight: 700; color: #fff; margin: 0; }
.tool-card-head .tool-card-hint { font-size: 0.74rem; color: rgba(255,255,255,0.42); white-space: nowrap; }
.tool-breakdown-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 56px;
}
.tool-donut-wrap { flex-shrink: 0; }
.tool-donut-wrap svg { width: 250px; height: 250px; display: block; }
.tool-donut-seg { fill: none; stroke-width: 34; transition: filter 0.15s; cursor: pointer; }
.tool-donut-seg.lift { filter: brightness(1.25); }
.tool-donut-center-value { font-size: 30px; font-weight: 700; fill: #fff; }
.tool-donut-center-label { font-size: 11.5px; fill: rgba(255,255,255,0.55); }

/* Receipt */
.tool-receipt { font-size: 0.85rem; flex: 1; min-width: 0; max-width: 440px; }
.tool-r-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4.5px 6px;
  border-radius: 7px;
  transition: background 0.12s, opacity 0.2s;
}
.tool-r-row:hover { background: rgba(255,255,255,0.05); }
.tool-r-row.is-zero { opacity: 0.35; }
.tool-r-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.tool-r-label { color: rgba(255,255,255,0.78); }
.tool-r-pct { margin-left: auto; font-size: 0.74rem; color: rgba(255,255,255,0.42); font-variant-numeric: tabular-nums; }
.tool-r-val { color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 76px; text-align: right; }
.tool-r-group {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
  padding: 8px 6px 3px;
}
.tool-r-summary {
  border-top: 1px solid rgba(255,255,255,0.12);
  margin-top: 9px;
  padding-top: 9px;
}
.tool-r-summary .tool-r-row:hover { background: none; }
.tool-r-summary .tool-r-label { font-weight: 700; color: #fff; }

/* Tooltip */
.tool-tip {
  position: absolute;
  pointer-events: none;
  background: #081826;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 158px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 5;
}
.tool-tip.visible { opacity: 1; }
.tool-tip-title { font-size: 0.74rem; color: rgba(255,255,255,0.55); margin-bottom: 6px; }
.tool-tip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.65);
  padding: 1.5px 0;
}
.tool-tip-row strong { margin-left: auto; color: #fff; font-variant-numeric: tabular-nums; }

/* ---------- Below the fold: detail table, embed, FAQ ---------- */
.tool-detail { padding: 52px 0; background: #f8fafc; }
.tool-detail .container { max-width: 1080px; }
.tool-detail h2 { font-size: 1.35rem; color: #192851; margin-bottom: 6px; }
.tool-detail .tool-detail-sub { font-size: 0.9rem; color: #8494a7; margin-bottom: 22px; }
.tool-table-card {
  background: #fff;
  border-radius: 14px;
  padding: 10px 22px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  overflow-x: auto;
}
.tool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 620px;
}
.tool-table thead th {
  text-align: right;
  padding: 13px 10px;
  font-weight: 600;
  color: #384860;
  border-bottom: 2px solid #eef2f6;
  font-size: 0.78rem;
  white-space: nowrap;
}
.tool-table thead th:first-child { text-align: left; }
.tool-table tbody td {
  padding: 11px 10px;
  border-bottom: 1px solid #f0f3f6;
  color: #192851;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tool-table tbody tr:last-child td { border-bottom: none; }
.tool-table tbody td:first-child { text-align: left; font-weight: 600; }
.tool-table tbody tr.tool-row-hl { background: #edfcf8; }
.tool-table tbody tr.tool-row-hl td { font-weight: 700; }
.tool-row-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0a8c6e;
  background: #d8f7ee;
  border-radius: 999px;
  padding: 2px 9px;
  margin-left: 8px;
}
.tool-table td.tool-td-good { color: #0a8c6e; font-weight: 700; }

/* Embed */
.tool-embed-section { padding: 44px 0 10px; text-align: center; }
.tool-embed-section h3 { font-size: 1.1rem; color: #192851; margin-bottom: 8px; }
.tool-embed-section p { font-size: 0.88rem; color: #8494a7; margin-bottom: 16px; }
.tool-embed-toggle {
  background: none;
  border: 1.5px solid #dde3ea;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 0.9rem;
  color: #384860;
  cursor: pointer;
  transition: border-color 0.2s;
}
.tool-embed-toggle:hover { border-color: #13d6b0; color: #192851; }
.tool-embed-code { display: none; max-width: 640px; margin: 16px auto 0; text-align: left; }
.tool-embed-code.visible { display: block; }
.tool-embed-code textarea {
  width: 100%;
  height: 120px;
  padding: 12px;
  border: 1.5px solid #dde3ea;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.82rem;
  color: #384860;
  resize: vertical;
  box-sizing: border-box;
  background: #f8fafc;
}

/* FAQ */
.tool-faq { padding: 44px 0 56px; }
.tool-faq h2 { text-align: center; font-size: 1.6rem; color: #192851; margin-bottom: 32px; }
.tool-faq details { border-bottom: 1px solid #eef2f6; }
.tool-faq summary {
  padding: 18px 0;
  font-weight: 600;
  color: #192851;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}
.tool-faq summary::-webkit-details-marker { display: none; }
.tool-faq summary::after { content: '+'; font-size: 1.4rem; color: #8494a7; transition: transform 0.2s; }
.tool-faq details[open] summary::after { content: '\2212'; }
.tool-faq .faq-answer { padding: 0 0 18px; font-size: 0.9rem; color: #576b80; line-height: 1.7; }

/* Embed mode */
.embed-mode .tool-app { padding: 14px 0 20px; }

/* --- Responsive --- */
@media (max-width: 1120px) {
  .tool-grid { grid-template-columns: 1fr; }
  .tool-inputs .tool-cta { margin-top: 4px; }
  .tool-stats, .tool-stats-5, .tool-stats-3 { grid-template-columns: repeat(3, 1fr); }
  .tool-stat-hero { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
  .tool-card-head .tool-card-hint { display: none; }
  .tool-breakdown-body { flex-direction: column; gap: 16px; }
  .tool-donut-wrap svg { width: 210px; height: 210px; }
  .tool-receipt { width: 100%; }
}
@media (max-width: 640px) {
  .tool-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .tool-stats, .tool-stats-5, .tool-stats-3 { grid-template-columns: 1fr 1fr; }
  .tool-stat { min-width: 0; }
  .tool-stat-label, .tool-stat-sub { white-space: normal; }
  .tool-stat-value { font-size: 1.2rem; }
  .tool-stat-hero .tool-stat-value { font-size: 1.7rem; }
  .tool-card { padding: 16px; }
  .tool-r-val { min-width: 60px; }
}
