/* Mining tools (/tools, /tools/{slug}): only what app.css doesn't already have. Same tokens: green primary, gray borders,
   orange-600 h1 (app.css). Built on .card .form .row2 .kpi .t .cta .btn .badge. */
.tools .head { padding-top: 20px; }
.tools .head .lead { max-width: 820px; }
#tlUpd:empty { display: none; }
#tlUpd { margin: 8px 0 0; }

/* calculator switcher under the breadcrumb */
.tl-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.tl-nav a { padding: 6px 12px; border-radius: 9999px; border: 1px solid var(--gray-300); font-size: 13px; font-weight: 500; white-space: nowrap; }
.tl-nav a[aria-current="page"] { background: var(--green-100); border-color: var(--green-600); color: var(--green-700); }

/* live strip: coin picker + network figures */
.tl-net { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0 0 22px; }
.tl-net:empty { display: none; }
.kpi.tl-nt { padding: 10px 14px; min-width: 0; }
.kpi.tl-nt .v { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-pick label { display: block; }
.tl-pick .l { display: block; }
.tl-pick select { display: block; width: 100%; margin: 2px 0 0; padding: 2px 0; border: 0; border-bottom: 1px dashed var(--gray-300); background: transparent; color: hsl(var(--primary)); font-size: 12px; font-weight: 600; cursor: pointer; }
.tl-pick select option { color: #111; }

/* inputs left, results right */
.tl-grid { display: grid; grid-template-columns: minmax(0, 390px) minmax(0, 1fr); gap: 24px; align-items: start; }
.tl-in { position: sticky; top: 84px; padding: 18px; }
.tl-in .form { gap: 12px; }
.tl-in h3 { font-size: 15px; font-weight: 600; margin: 6px 0 0; }
.tl-in .form > h3 ~ h3 { border-top: 1px solid hsl(var(--border)); padding-top: 16px; margin-top: 8px; }
.tl-lab { display: inline; }
.tl-lab em { font-style: normal; font-weight: 400; font-size: 12px; color: hsl(var(--muted-foreground)); }
.tl-in .form input[type="number"] { font-variant-numeric: tabular-nums; }
.tl-in .form input[type="checkbox"] { width: 16px; height: 16px; padding: 0; flex: none; accent-color: hsl(var(--primary)); }
.tl-in .form .tl-check { display: flex; align-items: center; gap: 8px; font-weight: 400; color: hsl(var(--muted-foreground)); }
.tl-in .form .tl-check[hidden] { display: none; }
.tl-adv { display: block; }
.tl-adv summary { cursor: pointer; font-weight: 600; font-size: 14px; color: hsl(var(--muted-foreground)); }
.tl-adv[open] { display: grid; gap: 12px; }
.tl-note { font-size: 13px; color: hsl(var(--muted-foreground)); margin: 0; }
.tl-note:empty { display: none; }
.tl-note.is-warn { color: var(--red-500); }
.tl-note b { color: hsl(var(--foreground)); }

/* fleet: up to 10 miner rows */
.tl-fleet { display: grid; gap: 10px; }
.fl-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px 92px 32px; gap: 6px; align-items: end; border-left: 3px solid var(--green-300); padding-left: 10px; }
.fl-row.no-hw { grid-template-columns: minmax(0, 1fr) 84px 32px; }
.tl-in .form .fl-row label { gap: 4px; min-width: 0; font-size: 12px; font-weight: 500; color: hsl(var(--muted-foreground)); }
.tl-in .form .fl-row input, .tl-in .form .fl-row select { height: 36px; padding: 0 8px; min-width: 0; font-size: 13px; color: hsl(var(--foreground)); }
.fl-row .fl-m { grid-column: 1 / -1; position: relative; }
.fl-row .fl-c { grid-column: span 2; }
.fl-row .fl-c[hidden] { display: none; }
.fl-row.no-hw .fl-c { grid-column: auto; }
.fl-row.no-hw .fl-c + .fl-c { grid-column: span 2; }
.fl-hr { display: flex; gap: 4px; min-width: 0; }
.tl-in .form .fl-hr input { flex: 1 1 auto; }
.tl-in .form .fl-hr select { flex: 0 0 72px; width: 72px; padding: 0 4px; }
.fl-x { height: 36px; border: 1px solid hsl(var(--input)); border-radius: 8px; background: transparent; color: hsl(var(--muted-foreground)); cursor: pointer; font-size: 18px; line-height: 1; padding: 0; }
.fl-x:hover { border-color: var(--red-500); color: var(--red-500); }
.fl-x.is-off { visibility: hidden; }
.tl-add { justify-self: start; padding: 7px 12px; border: 1px dashed var(--green-600); border-radius: 8px; background: transparent; color: var(--green-700); font-size: 13px; font-weight: 600; cursor: pointer; }
.tl-add:hover { background: var(--green-100); }
.tl-add[hidden] { display: none; }
.tl-warn { margin: 0; padding: 9px 12px; border-radius: 8px; background: var(--amber-100); font-size: 12.5px; line-height: 1.45; }
.tl-warn[hidden] { display: none; }

/* miner search box over the hidden select */
.ms { position: relative; width: 100%; }
.ms-hidden { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; }
.tl-in .form .ms-in { padding-right: 32px; font-size: 14px; }
.ms-caret { position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; margin-top: -6px; border-right: 1.6px solid var(--gray-500); border-bottom: 1.6px solid var(--gray-500); transform: rotate(45deg); cursor: pointer; }
.ms.is-open .ms-caret { transform: rotate(225deg); margin-top: -2px; }
.ms-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 340px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: hsl(var(--background)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.ms-list[hidden] { display: none; }
.ms-g { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--green-700); }
.ms-o { padding: 7px 10px 7px 16px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.ms-o.is-act { background: hsl(var(--muted)); }
.ms-o.is-sel { font-weight: 600; }
.ms-none { padding: 10px; font-size: 13px; color: hsl(var(--muted-foreground)); }

/* "?" help after each label; the note opens across the input card */
.tl-in { position: sticky; }
.tl-q { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 6px; vertical-align: 1px; border-radius: 50%; border: 1px solid var(--gray-300); background: transparent; color: hsl(var(--muted-foreground)); font: 700 10px/1 var(--font); cursor: pointer; padding: 0; }
.tl-q:hover, .tl-q[aria-expanded="true"] { border-color: hsl(var(--primary)); background: hsl(var(--primary)); color: #fff; }
.tl-tip { position: absolute; left: 14px; right: 14px; z-index: 35; display: block; margin-top: 6px; padding: 10px 12px; background: hsl(var(--background)); border: 1px solid hsl(var(--border)); border-left: 3px solid hsl(var(--primary)); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.12); font-size: 13px; font-weight: 400; line-height: 1.45; color: hsl(var(--foreground)); white-space: normal; }
.fl-row .fl-m > .tl-q { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); margin: 0; background: hsl(var(--background)); }
.fl-row .fl-m > .tl-q:hover, .fl-row .fl-m > .tl-q[aria-expanded="true"] { background: hsl(var(--primary)); }
.fl-row .fl-m > .tl-tip { left: 0; right: 0; top: 100%; }

/* results */
.tl-out { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; min-width: 0; }
.tl-out h3 { font-size: 15px; margin: 0 0 10px; }
.tl-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.tl-tiles .kpi { min-width: 0; }
.tl-tiles .kpi .v { font-size: 21px; overflow-wrap: anywhere; }
.tl-tiles .kpi .small { margin-top: 2px; }
.tl-split-bar { display: flex; gap: 2px; height: 12px; border-radius: 9999px; overflow: hidden; }
.tl-split-bar i, .tl-split-k i { display: block; }
.sp-cost { background: var(--gray-300); }
.sp-profit { background: var(--green-500); }
.tl-split-k { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 8px; }
.tl-split-k span { display: inline-flex; align-items: center; gap: 6px; }
.tl-split-k i { width: 10px; height: 10px; border-radius: 3px; }
.tl-out .tablewrap { border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
.tl-out table.t td { font-variant-numeric: tabular-nums; }
.tl-out table.t tr:last-child td { border-bottom: 0; }
.t td.is-loss { color: var(--red-500); }
.t td.is-now { font-weight: 700; box-shadow: inset 0 -2px 0 var(--green-500); }
.t tr.is-mine td { font-weight: 700; background: var(--green-100); }
.tl-capex tr.is-total td { font-weight: 700; border-top: 2px solid var(--gray-300); }
.tl-capex td:nth-child(2) { color: hsl(var(--muted-foreground)); }
.tl-rank td.tl-rank-n { white-space: normal; min-width: 160px; }

/* net position chart (inline SVG) */
.tl-chart { position: relative; border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 10px 8px 4px; }
.tl-chart svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.tl-chart text { font-size: 11px; fill: hsl(var(--muted-foreground)); }
.ch-zero { stroke: var(--gray-300); stroke-width: 1; }
.ch-line { fill: none; stroke: var(--green-500); stroke-width: 2; stroke-linejoin: round; }
.ch-cross { stroke: var(--gray-300); stroke-dasharray: 3 3; }
.ch-dot { fill: var(--green-500); stroke: hsl(var(--background)); stroke-width: 2; }
.ch-hit { fill: transparent; cursor: crosshair; }
.ch-tip { position: absolute; top: 8px; width: 180px; background: hsl(var(--background)); border: 1px solid hsl(var(--border)); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.08); padding: 8px 10px; font-size: 12px; color: hsl(var(--muted-foreground)); pointer-events: none; }
.ch-tip[hidden] { display: none; }
.ch-tip b { color: hsl(var(--foreground)); }
.tl-assume { font-size: 12px; color: hsl(var(--muted-foreground)); margin: 8px 0 0; }

/* horizontal bars */
.tl-bars { display: grid; gap: 8px; }
.tl-bar { display: grid; grid-template-columns: 120px minmax(0, 1fr) 110px; gap: 10px; align-items: center; font-size: 13px; color: hsl(var(--muted-foreground)); }
.tl-bar-t { height: 14px; display: block; }
.tl-bar-t i { display: block; height: 100%; border-radius: 4px; background: var(--gray-300); }
.tl-bar.is-hl .tl-bar-t i { background: var(--green-500); }
.tl-bar.is-neg .tl-bar-t i { background: var(--red-500); opacity: .5; }
.tl-bar b { text-align: right; color: hsl(var(--foreground)); font-variant-numeric: tabular-nums; }
.tl-bar.is-neg b { color: var(--red-500); }

/* hosting vs own: two option cards */
.tl-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tl-opt { position: relative; padding: 16px 18px; }
.tl-opt.is-win { border-color: var(--green-600); box-shadow: inset 0 3px 0 var(--green-500); }
.tl-opt h3 { font-size: 18px; margin: 0 0 12px; }
.tl-win { position: absolute; top: 14px; right: 14px; }
.tl-opt dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin: 0; font-size: 14px; }
.tl-opt dt { color: hsl(var(--muted-foreground)); }
.tl-opt dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-opt dd.is-loss { color: var(--red-500); }

.tl-share { display: flex; flex-wrap: wrap; gap: 8px; }
.tl-share:empty { display: none; }
.tl-cta { margin-top: 28px; }
.tl-cta[hidden] { display: none; }
.tl-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* hub + related tools */
.tl-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tl-card { display: grid; grid-template-rows: auto auto 1fr auto; gap: 8px; align-content: start; color: inherit; transition: border-color .15s, box-shadow .15s; }
.tl-card:hover { color: inherit; border-color: var(--green-600); box-shadow: 0 6px 20px rgba(0,0,0,.06); }
.tl-card b { font-size: 17px; font-weight: 600; }
.tl-ico { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--green-100); font-size: 22px; line-height: 1; }
.tl-open { color: hsl(var(--primary)); font-weight: 600; font-size: 14px; }
.tl-card.small { padding: 14px 16px; }
.tl-card.small .tl-ico { width: 36px; height: 36px; font-size: 18px; }
.tl-card.small b { font-size: 15px; }
.tl-faq { max-width: 820px; }
.tl-faq details.faq p { color: hsl(var(--muted-foreground)); margin: 8px 0 0; }
.tl-more { margin: 18px 0 0; font-size: 14px; }

@media (max-width: 1100px) {
  .tl-grid { grid-template-columns: minmax(0, 1fr); }
  .tl-in { position: relative; top: auto; }
  .tl-net { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tl-net { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tl-opts { grid-template-columns: minmax(0, 1fr); }
  .tl-bar { grid-template-columns: 84px minmax(0, 1fr) 86px; }
  .tl-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tl-tiles .kpi { padding: 12px; }
  .tl-tiles .kpi .v { font-size: 18px; }
  .tl-rank th:nth-child(2), .tl-rank td:nth-child(2) { display: none; }
}

/* Save PDF: shown only when printing */
.pdf-only { display: none; }
@media print {
  .topbar, .hdr, .ftr, .tray, .tl-nav, .crumbs, .tl-share, .tl-cta, .tl-faq, .tl-related, .tl-add, .fl-x, .tl-q, .tl-tip, .ms-caret, .ms-list { display: none !important; }
  html, body { background: #fff !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tl-grid { grid-template-columns: minmax(0, 1fr); }
  .tl-in { position: static; }
  .tl-adv { display: grid; }
  .pdf-only { display: block; }
  .pdf-head { display: flex !important; align-items: center; gap: 14px; padding: 0 0 12px; margin: 0 0 18px; border-bottom: 3px solid #00c469; }
  .pdf-brand { flex: 1; }
  .pdf-brand b { display: block; font-size: 22px; color: #111827; }
  .pdf-brand span { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #ea580c; }
  .pdf-when { text-align: right; font-size: 11px; color: #374151; }
  .pdf-when span { display: block; letter-spacing: .08em; text-transform: uppercase; color: #6b7280; }
  .pdf-end { margin-top: 22px; padding: 14px 16px; border: 1px solid #e5e7eb; border-left: 4px solid #00c469; font-size: 11px; color: #374151; break-inside: avoid; }
  .pdf-end p { margin: 0 0 6px; }
  .pdf-url { word-break: break-all; color: #15803d; }
  .pdf-fine { color: #6b7280; font-size: 10px; margin: 6px 0 0 !important; }
}

/* ===== AsicProfit look (overrides above) ===== */
/* live data: one slim ticker line under the title */
.tl-net { display: flex; flex-wrap: wrap; gap: 0; margin: 4px 0 22px; padding: 8px 0; border-top: 1px solid hsl(var(--border)); border-bottom: 1px solid hsl(var(--border)); }
.kpi.tl-nt { border: 0; border-right: 1px solid hsl(var(--border)); border-radius: 0; padding: 4px 18px; background: none; min-width: 0; }
.kpi.tl-nt:first-child { padding-left: 0; }
.kpi.tl-nt:last-child { border-right: 0; }
.kpi.tl-nt .l { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.kpi.tl-nt .v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* calculator switcher: icon tabs */
.tl-tabs { display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden; margin: 16px 0 0; box-shadow: inset 0 -1px 0 hsl(var(--border)); scrollbar-width: thin; }
.tl-tabs a { flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; font-size: 14px; font-weight: 500; color: hsl(var(--muted-foreground)); border-bottom: 2px solid transparent; white-space: nowrap; }
.tl-tabs a svg { width: 18px; height: 18px; }
.tl-tabs a:hover { color: hsl(var(--foreground)); }
.tl-tabs a[aria-current="page"] { color: hsl(var(--foreground)); border-bottom-color: hsl(var(--primary)); }
.tl-tabs a[aria-current="page"] svg { color: hsl(var(--primary)); }
/* inputs: a spec sheet with a green spine */
.tl-in { border-left: 3px solid hsl(var(--primary)); background: hsl(var(--background)); }
/* results: a dark readout like a miner's status screen */
.tl-readout { background: #0c1310; color: #e6f4ea; border-radius: var(--radius); padding: 16px 18px 18px; box-shadow: 0 18px 40px -24px rgb(0 0 0 / .45); }
.tl-ro-k { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #6ee7a0; margin-bottom: 12px; }
.tl-readout .tl-tiles { gap: 0; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tl-readout .kpi { background: none; border: 0; border-radius: 0; border-left: 1px solid rgb(255 255 255 / .1); padding: 4px 16px 10px; }
.tl-readout .kpi .l { color: rgb(230 244 234 / .62); font-size: 12px; }
.tl-readout .kpi .v { color: #fff; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tl-readout .kpi.good .v { color: #4ade80; }
.tl-readout .kpi.bad .v { color: #f87171; }
.tl-readout .kpi .small, .tl-readout .muted { color: rgb(230 244 234 / .55) !important; }
/* hosting vs own site: the two option cards sit inside the dark readout, so they're dark too (white cards made the light text vanish) */
.tl-readout .tl-opt { background: rgb(255 255 255 / .04); border-color: rgb(255 255 255 / .12); color: #e6f4ea; box-shadow: none; }
.tl-readout .tl-opt.is-win { border-color: #4ade80; box-shadow: inset 0 3px 0 #4ade80; }
.tl-readout .tl-opt h3 { color: #fff; }
.tl-readout .tl-opt dt { color: rgb(230 244 234 / .62); }
.tl-readout .tl-opt dd { color: #fff; }
.tl-readout .tl-opt dd.is-loss { color: #f87171; }
.tl-readout .tl-opt .tl-win { background: rgb(74 222 128 / .16); color: #4ade80; }
/* where to buy */
.tl-buy { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 14px 16px; background: var(--gray-50); }
.tl-buy[hidden] { display: none; }
.tl-buy ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tl-buy li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.tl-buy-n { font-weight: 600; color: inherit; }
.tl-buy li .btn { margin-left: auto; }
/* overview + related: a list of tools, not a card grid */
.tl-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; border-top: 1px solid hsl(var(--border)); }
.tl-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 4px; border-bottom: 1px solid hsl(var(--border)); color: inherit; }
.tl-row:hover { color: inherit; background: var(--gray-50); }
.tl-row:hover .tl-go { color: hsl(var(--primary)); transform: translateX(3px); }
.tl-svg { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--green-100); color: var(--green-700); }
.tl-svg svg { width: 20px; height: 20px; }
.tl-row-t { display: grid; gap: 2px; min-width: 0; }
.tl-row-t b { font-size: 16px; }
.tl-row-t span { font-size: 14px; color: hsl(var(--muted-foreground)); }
.tl-go { font-size: 18px; color: hsl(var(--muted-foreground)); transition: transform .15s, color .15s; }
.tl-row.small .tl-row-t span { display: none; }
@media (max-width: 760px) { .tl-list { grid-template-columns: minmax(0, 1fr); } .kpi.tl-nt { padding: 4px 12px; } }
@media print { .tl-readout { background: none; color: #000; box-shadow: none; border: 1px solid #ccc; } .tl-readout .kpi .v { color: #000; } .tl-buy, .tl-tabs { display: none !important; } }
/* the buying panel comes before the share buttons */
.tl-out > .tl-share { order: 2; }
.tl-out > .tl-buy { order: 1; }
/* Hosting vs own site: each option in its own panel (A green = hosting, B amber = running it yourself) */
.tl-side { display: grid; gap: 12px; padding: 14px 14px 16px; border: 1px solid hsl(var(--border)); border-left-width: 4px; border-radius: 12px; }
.tl-side h3 { display: flex; align-items: center; gap: 8px; margin: 0; border: 0 !important; padding: 0 !important; }
.tl-side-k { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: 12px; font-weight: 700; color: #fff; }
.tl-side-a { border-left-color: var(--green-500); background: color-mix(in srgb, var(--green-500) 8%, transparent); }
.tl-side-a .tl-side-k { background: var(--green-600); }
.tl-side-b { border-left-color: var(--amber-500); background: color-mix(in srgb, var(--amber-500) 9%, transparent); }
.tl-side-b .tl-side-k { background: var(--amber-500); }
.tl-side + .tl-side { margin-top: 4px; }
