/* RackingZone — interactive tool pages (/tools/load-calculator/, /tools/space-calculator/). Prefix .tl- */

/* ---------- Hero: compact, blueprint grid, tool switcher ---------- */
.tl-hero { padding: 32px 0 40px; background: var(--main); }
.tl-hero::before { opacity: .9; }
.tl-hero h1 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); margin: .55rem 0 .7rem; }
.tl-hero .lead { font-size: 1.05rem; }
.tl-hero .hero-facts { margin-top: 1.1rem; font-size: .86rem; }
.tl-switch { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.tl-switch a {
  flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: .45rem; padding: .6rem .7rem; border-radius: 10px;
  font-family: var(--font-head); font-weight: 700; font-size: .95rem; color: var(--muted); white-space: nowrap; transition: all .25s var(--ease);
}
.tl-switch a:hover { color: var(--ink); background: rgba(255, 255, 255, .7); }
.tl-switch a[aria-current] { background: var(--ink); color: #fff; box-shadow: var(--shadow-sm); }
.tl-switch a[aria-current] .bi { color: var(--red); }

/* ---------- App shell ---------- */
.tl-app { padding: 32px 0 56px; }
.tl-shell { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (min-width: 1200px) { .tl-shell { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 28px; } }
@media (max-width: 991.98px) { .tl-shell { grid-template-columns: minmax(0, 1fr); } }
.tl-results { display: grid; gap: 20px; min-width: 0; }

.tl-panel { background: var(--main); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 1.35rem 1.4rem; min-width: 0; }
.tl-panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.tl-panel-head h2 { display: flex; align-items: center; gap: .6rem; font-size: 1.25rem; font-weight: 800; margin: 0; }
.tl-h-sm { font-size: 1.08rem !important; font-weight: 800; margin: 0; }
.tl-step {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: var(--red); color: #fff; font-size: .9rem; font-weight: 800;
}
.tl-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--teal); background: var(--teal-soft); border-radius: 999px; padding: .25rem .6rem; }

/* Inputs panel: sticky on desktop, scrolls inside when taller than the screen */
@media (min-width: 992px) {
  .tl-inputs { position: sticky; top: 88px; max-height: calc(100vh - 104px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
.tl-field { border: 0; padding: 0; margin: 0 0 1.15rem; min-width: 0; }
.tl-field > label, .tl-legend { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: .86rem; font-weight: 600; color: var(--ink); margin-bottom: .4rem; width: 100%; float: none; }
.tl-sub-label { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin: .7rem 0 .25rem; }
.tl-opt { font-weight: 400; color: var(--muted); }
.tl-hint { display: block; font-size: .76rem; color: var(--muted); line-height: 1.45; margin-top: .35rem; }
.tl-out-val { font-family: var(--font-head); font-weight: 800; color: var(--teal); font-size: 1rem; }
.tl-inputs .form-control, .tl-inputs .custom-select { height: 46px; border-radius: 10px; border: 1px solid #d9d2ca; background-color: #fff; font-weight: 500; color: var(--ink); }
.tl-inputs .form-control:focus, .tl-inputs .custom-select:focus { border-color: var(--teal); box-shadow: 0 0 0 .2rem rgba(7, 128, 128, .15); }
.tl-inputs .form-control.is-invalid { border-color: var(--red); background-image: none; padding-right: .75rem; }
.tl-num { position: relative; }
.tl-num .form-control { padding-right: 3.6rem; font-family: var(--font-head); font-size: 1.15rem; font-weight: 700; -moz-appearance: textfield; }
.tl-num .form-control::-webkit-outer-spin-button, .tl-num .form-control::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tl-unit { position: absolute; right: .85rem; top: 50%; transform: translateY(-50%); font-size: .84rem; font-weight: 600; color: var(--muted); pointer-events: none; }
.tl-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* Segmented radio control */
.tl-seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); margin: 0; min-width: 0; }
.tl-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tl-seg label {
  margin: 0; padding: .35rem .85rem; border-radius: 8px; cursor: pointer; text-align: center;
  font-family: var(--font-head); font-weight: 700; font-size: .92rem; color: var(--muted); transition: all .2s var(--ease); user-select: none;
}
.tl-seg label:hover { color: var(--ink); }
.tl-seg input:checked + label { background: var(--ink); color: #fff; box-shadow: var(--shadow-sm); }
.tl-seg input:focus-visible + label { outline: 2px solid var(--teal); outline-offset: 2px; }
.tl-seg-wide { display: flex; width: 100%; }
.tl-seg-wide label { flex: 1 1 0; padding: .55rem .5rem; font-size: 1rem; }
.tl-seg-sm label { font-size: .86rem; }

/* Stepper */
.tl-stepper { display: flex; gap: 6px; }
.tl-stepper .form-control { text-align: center; font-family: var(--font-head); font-size: 1.15rem; font-weight: 700; -moz-appearance: textfield; }
.tl-stepper .form-control::-webkit-outer-spin-button, .tl-stepper .form-control::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tl-step-btn { flex: none; width: 46px; height: 46px; border-radius: 10px; border: 1px solid #d9d2ca; background: var(--bg); color: var(--ink); font-size: 1.05rem; transition: all .2s var(--ease); }
.tl-step-btn:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.tl-step-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Range */
.tl-range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 6px; background: var(--line); margin: .7rem 0 .1rem; accent-color: var(--teal); }
.tl-range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--teal); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); cursor: pointer; }
.tl-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--teal); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); cursor: pointer; }
.tl-range:focus { outline: none; }
.tl-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(7, 128, 128, .3); }

.tl-switch-row { padding-left: 2.6rem; min-height: 1.6rem; }
.tl-switch-row .custom-control-label { font-size: .9rem; font-weight: 600; color: var(--ink); cursor: pointer; }
.tl-switch-row .custom-control-label::before { left: -2.6rem; width: 2.1rem; height: 1.2rem; border-radius: 1rem; top: .15rem; }
.tl-switch-row .custom-control-label::after { left: calc(-2.6rem + 3px); top: calc(.15rem + 3px); width: calc(1.2rem - 6px); height: calc(1.2rem - 6px); }
.tl-switch-row .custom-control-input:checked ~ .custom-control-label::before { background: var(--teal); border-color: var(--teal); }
.tl-switch-row .custom-control-input:checked ~ .custom-control-label::after { transform: translateX(.9rem); }

.tl-reset { border: 0; background: none; padding: .2rem 0; font-size: .84rem; font-weight: 600; color: var(--muted); }
.tl-reset:hover { color: var(--teal); }

/* ---------- Results ---------- */
.tl-readout {
  position: relative; overflow: hidden; border-radius: 16px; padding: 1.2rem 1.35rem 1.15rem; color: rgba(255, 255, 255, .78);
  background: var(--ink);
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 22px 22px;
}
.tl-readout::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--red); }
.tl-readout-label { display: block; font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #7fd1d1; }
.tl-readout-value { display: block; font-family: var(--font-head); font-weight: 800; color: #fff; font-size: clamp(2.4rem, 5vw, 3.4rem); line-height: 1.05; margin: .25rem 0 .2rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tl-readout-value small { font-size: .45em; font-weight: 700; color: rgba(255, 255, 255, .7); }
.tl-readout-sub { display: block; font-size: .88rem; }
.tl-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
@media (max-width: 1199.98px) { .tl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tl-kpi { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; min-width: 0; }
.tl-kpi-label { display: block; font-size: .74rem; font-weight: 600; color: var(--muted); line-height: 1.35; min-height: 2em; }
.tl-kpi strong { display: block; font-family: var(--font-head); font-size: 1.55rem; font-weight: 800; color: var(--ink); line-height: 1.15; margin-top: .2rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tl-kpi strong small { font-size: .62em; font-weight: 700; color: var(--muted); }
.tl-kpi-sub { display: block; font-size: .74rem; color: var(--muted); margin-top: .15rem; line-height: 1.35; }
.tl-allow { margin: 12px 0 0; padding: .7rem .9rem; border-radius: 10px; background: #fff6e0; border: 1px solid #f1d48a; font-size: .84rem; }
.tl-hp { margin-top: 12px; }
.tl-out > p.tl-allow:empty { display: none; }

/* Diagram */
.tl-figure { margin: 0; background: #fbfaf8; border: 1px solid var(--line); border-radius: 14px; padding: 12px 12px 8px; }
.tl-svg { display: block; width: 100%; height: auto; max-height: 620px; }
.tl-legend-row { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; align-items: center; font-size: .78rem; color: var(--muted); padding: .55rem .2rem 0; border-top: 1px dashed var(--line); margin-top: .5rem; }
.tl-legend-row span { display: inline-flex; align-items: center; gap: .4rem; }
.tl-legend-row .tl-note { margin-left: auto; font-style: italic; }
.tl-key { display: inline-block; width: 18px; height: 10px; border-radius: 2px; }
.tl-key-beam { background: var(--red); }
.tl-key-load { background: var(--teal-soft); border: 1.5px solid var(--teal); }
.tl-key-frame { background: var(--ink); width: 8px; height: 14px; }
.tl-key-row { background: var(--teal); }
.tl-key-aisle { background: #efe9e2; border: 1px solid #ddd4ca; }
.tl-key-dock { background: repeating-linear-gradient(45deg, #fff 0 3px, #c9bfb3 3px 4px); border: 1px solid #c9bfb3; }
.tl-share { display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.tl-share-svg { width: 100%; max-width: 640px; height: auto; display: block; margin: 0 auto; }

/* SVG parts */
.tl-svg text, .tl-share-svg text { font-family: var(--font-body); fill: var(--text); }
.tl-s-title { font-family: var(--font-head) !important; font-weight: 800; font-size: 15px; fill: var(--ink) !important; }
.tl-s-lbl { font-size: 13px; font-weight: 700; fill: var(--ink) !important; }
.tl-s-small { font-size: 11.5px; fill: var(--muted) !important; }
.tl-s-strong { font-weight: 700; fill: var(--teal) !important; }
.tl-s-teal { fill: var(--teal) !important; }
.tl-s-ltxt { font-size: 11px; font-weight: 600; fill: var(--teal) !important; }
.tl-svg-narrow .tl-s-title { font-size: 16px; }
.tl-svg-narrow .tl-s-lbl { font-size: 14px; }
.tl-svg-narrow .tl-s-small { font-size: 12.5px; }
.tl-svg-narrow .tl-s-ltxt { font-size: 11.5px; }
.tl-s-col { fill: var(--ink); }
.tl-s-end { fill: #5d6262; }
.tl-s-slot { fill: rgba(255, 255, 255, .35); }
.tl-s-beam { fill: var(--red); }
.tl-s-load { fill: var(--teal-soft); stroke: var(--teal); stroke-width: 1.5; transition: all .3s var(--ease); }
.tl-s-pallet { fill: #8b6b4e; }
.tl-s-floor { stroke: var(--ink); stroke-width: 2; }
.tl-s-hatch { stroke: #c9bfb3; stroke-width: 1.5; }
.tl-s-dim { stroke: var(--teal); stroke-width: 1.3; }
.tl-s-dash { stroke-dasharray: 3 3; opacity: .7; }
.tl-s-dimtxt { paint-order: stroke; stroke: #fbfaf8; stroke-width: 6px; stroke-linejoin: round; }
.tl-s-bldg { fill: #fff; stroke: var(--ink); stroke-width: 2; }
.tl-s-dock { stroke: none; }
.tl-s-door { fill: var(--ink); }
.tl-s-rows rect { fill: var(--teal); }
.tl-s-aisles rect { fill: #efe9e2; }
.tl-s-onhatch { paint-order: stroke; stroke: #fff; stroke-width: 6px; stroke-linejoin: round; }

/* Comparison */
.tl-table { margin: 0; }
.tl-table th, .tl-table td { white-space: nowrap; }
.tl-table td:last-child { font-family: var(--font-head); font-weight: 800; color: var(--ink); text-align: right; }
.tl-table thead th:last-child { text-align: right; }
.tl-table tr.is-current th, .tl-table tr.is-current td { background: var(--teal-soft); }
.tl-table tr.is-current th { box-shadow: inset 4px 0 0 var(--teal); }
.tl-density { margin-top: 1.1rem; padding: 1rem 1.1rem; border-radius: 12px; background: var(--ink); color: rgba(255, 255, 255, .8); font-size: .9rem; }
.tl-density h3 { color: #fff; font-size: 1.05rem; font-weight: 800; display: flex; gap: .5rem; align-items: center; margin: 0 0 .5rem; }
.tl-density h3 .bi { color: var(--red); }
.tl-density strong { color: #fff; }
.tl-density p { margin-bottom: .6rem; }
.tl-density .link-arrow { color: #7fd1d1; }
.tl-density .link-arrow:hover { color: #fff; }
.tl-links { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }

/* Supplier summary */
.tl-summary-text {
  display: block; width: 100%; resize: vertical; overflow: hidden; min-height: 180px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  padding: .9rem 1rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; line-height: 1.6; color: var(--ink);
}
.tl-summary-text:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 .2rem rgba(7, 128, 128, .12); }
.tl-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.tl-actions .btn { padding: .6rem 1.1rem; }

/* ---------- Assumptions, method, related ---------- */
.tl-info { background: var(--main); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tl-assume, .tl-method { height: 100%; border-radius: var(--radius-lg); padding: 1.4rem 1.5rem; }
.tl-assume { background: #fff9ea; border: 1px solid #f1d48a; }
.tl-method { background: var(--bg); border: 1px solid var(--line); }
.tl-assume h2, .tl-method h2 { display: flex; align-items: center; gap: .55rem; margin-bottom: .9rem !important; }
.tl-assume h2 .bi { color: #b7791f; }
.tl-method h2 .bi { color: var(--teal); }
.tl-assume ul { margin: 0; padding-left: 1.1rem; font-size: .88rem; }
.tl-assume li { margin-bottom: .5rem; }
.tl-assume li::marker { color: #b7791f; }
.tl-method dl { margin: 0 0 1rem; font-size: .88rem; }
.tl-method dt { font-weight: 700; color: var(--ink); margin-top: .55rem; }
.tl-method dd { margin: .15rem 0 0; color: var(--muted); }
.tl-method code { display: inline; font-size: .82rem; color: var(--ink); background: var(--main); border: 1px solid var(--line); border-radius: 6px; padding: .08rem .4rem; white-space: normal; word-break: break-word; }
.tl-related { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: .5rem; }
@media (max-width: 1199.98px) { .tl-related { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .tl-related { grid-template-columns: minmax(0, 1fr); } }
.tl-rel {
  display: flex; align-items: center; gap: .85rem; padding: .95rem 1rem; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line);
  color: var(--ink); transition: all .3s var(--ease); min-width: 0;
}
.tl-rel:hover { color: var(--ink); background: var(--main); border-color: transparent; box-shadow: var(--shadow); transform: translateY(-3px); }
.tl-rel > span:nth-child(2) { flex: 1 1 auto; min-width: 0; }
.tl-rel strong { display: block; font-family: var(--font-head); font-size: 1rem; line-height: 1.25; }
.tl-rel small { display: block; font-size: .78rem; color: var(--muted); line-height: 1.4; margin-top: .15rem; }
.tl-rel > .bi { color: var(--teal); transition: transform .25s var(--ease); }
.tl-rel:hover > .bi { transform: translateX(4px); }
.tl-quote { padding-top: 72px; }

@media (max-width: 575.98px) {
  .tl-hero { padding: 24px 0 32px; }
  .tl-switch a { font-size: .88rem; padding: .55rem .4rem; }
  .tl-panel { padding: 1.1rem 1rem; border-radius: 18px; }
  .tl-figure { padding: 8px 6px 6px; }
  .tl-kpi strong { font-size: 1.3rem; }
  .tl-legend-row .tl-note { margin-left: 0; }
  .tl-actions .btn { flex: 1 1 auto; }
  .tl-table th, .tl-table td { white-space: normal; }
}

/* ---------- Print: results only ---------- */
.tl-print-only { display: none; }
@media print {
  @page { margin: 12mm; }
  html, body { background: #fff !important; }
  body { font-size: 10pt; color: #000; }
  .topbar, .site-header, .site-footer, .mobile-cta, .to-top, .rz-breadcrumb, .tl-switch, .hero-facts,
  .tl-inputs, .tl-summary-text, .tl-actions, .tl-reset, .tl-related, .tl-quote, .tl-badge, .tl-range, .tl-step-btn, .tl-hint, .tl-density .tl-links, .tl-share p, .tl-actions + p { display: none !important; }
  .tl-key, .tl-step, .tl-svg, .tl-share-svg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tl-hero { padding: 0 0 8pt; border: 0; }
  .tl-hero::before { display: none; }
  .tl-hero h1 { font-size: 20pt; margin: 0 0 4pt; }
  .tl-hero .lead { font-size: 10pt; }
  .tl-app { padding: 0; }
  .tl-shell { display: block; }
  .tl-inputs { position: static; max-height: none; overflow: visible; margin-bottom: 8pt; }
  .tl-inputs .form-control, .tl-inputs .custom-select { height: auto; border: 0; padding: 0; font-size: 10pt; }
  .tl-panel { box-shadow: none; border: 1px solid #ccc; padding: 8pt 10pt; break-inside: avoid; margin-bottom: 8pt; }
  .tl-results { display: block; }
  .tl-readout { background: #fff !important; color: #000; border: 2px solid #000; }
  .tl-readout-label, .tl-readout-value, .tl-readout-value small { color: #000 !important; }
  .tl-kpis { grid-template-columns: repeat(4, 1fr); }
  .tl-figure, .tl-summary-text { break-inside: avoid; }
  .tl-svg { max-height: 120mm; }
  .tl-print-only { display: block; white-space: pre-wrap; font-size: 8.5pt; margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; }
  .tl-info { border: 0; padding: 0; }
  .tl-info .col-lg-6 { flex: 0 0 100%; max-width: 100%; }
  .tl-density { background: #fff; color: #000; border: 1px solid #ccc; }
  .tl-density h3, .tl-density strong { color: #000; }
  .reveal { opacity: 1 !important; transform: none !important; }
  a[href]::after { content: none !important; }
}
