/* lu.ca/calc/threads — thread reference. Shared look from calc.css; only this tool's layout lives here. */
.th { gap: 16px; }

/* ---------- finder ---------- */
.th-find { padding: 16px 20px; }
.th-findrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.th-q { position: relative; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 12px; background: var(--surface); }
.th-q:focus-within { border-color: var(--text-2); }
.th-q svg { flex: none; color: var(--text-3); }
.th-q input { border: 0; outline: none; background: none; padding: 10px 0; width: 100%; font-size: 15px; min-width: 0; }
.th-filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-top: 12px; }
.th-filters .lab { font-size: 12px; color: var(--text-3); margin-right: 2px; }
.th-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.th-chips .chip[aria-pressed="true"] { background: var(--text); color: var(--on-accent); border-color: var(--text); }
.th-count { margin-left: auto; font-size: 12.5px; color: var(--text-3); }
.th-listwrap { margin-top: 12px; border-top: 1px solid var(--line); }
table.th-list { width: 100%; border-collapse: collapse; font-size: 13px; }
.th-list th { font-weight: 500; font-size: 12px; color: var(--text-3); text-align: right; padding: 8px 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.th-list th.l, .th-list td.l { text-align: left; }
.th-list td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--fill-1); white-space: nowrap; }
.th-list tbody tr { cursor: pointer; }
.th-list tbody tr:hover { background: var(--surface-2); }
.th-list tbody tr.sel { background: var(--sel-bg); }
.th-list td.l a { color: var(--text); text-decoration: none; font-weight: 500; }
.th-list tbody tr.sel td.l a { color: var(--sel); }
.th-list .ser { color: var(--text-3); font-size: 12px; }
.th-more { display: flex; justify-content: center; padding: 10px 0 2px; }
.th-hide-sm { }

/* ---------- detail head ---------- */
.th-dhead { padding: 14px 20px; display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; }
.th-dtitle { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; min-width: 0; }
.th-dtitle h2 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.th-dtitle .sub { color: var(--text-2); font-size: 13px; }
.th-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.th-tag { font-size: 11.5px; color: var(--text-2); background: var(--fill-1); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.th-tag.warn { color: var(--warn); background: var(--warn-bg); }
.th-dact { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- stage + panel ---------- */
.th-work { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 16px; align-items: start; }
.th-stage { overflow: hidden; }
.th-stage .stage-bar { flex-wrap: wrap; }
.th-cls { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.th-cls label { display: inline-flex; align-items: center; gap: 6px; }
.th-cls select { width: auto; min-width: 92px; padding: 4px 8px; }
#thView { display: block; width: 100%; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
#thView.dragging, #thView.dragging * { cursor: grabbing !important; }
#thView text { font-size: 12px; fill: var(--text-2); }
#thView .val-t { fill: var(--text); font-weight: 500; }
#thView .dim-t { fill: var(--text-2); }
.th-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 14px 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.th-legend span { display: inline-flex; align-items: center; gap: 6px; }
.th-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.th-stats { border-top: 1px solid var(--line); }
.th-stats .stat { min-width: 0; }
.th-stats .v { white-space: nowrap; }

.th-panel { display: flex; flex-direction: column; min-width: 0; }
.th-panel .tabs { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.th-panel .tabs button { white-space: nowrap; padding-left: 2px; padding-right: 2px; }
.th-pbody { padding: 6px 16px 16px; }
.th-pbody h3 { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 14px 0 8px; }
.th-pbody p { margin: 6px 0; color: var(--text-2); font-size: 13px; }
.th-pbody .note { margin: 8px 0 0; }
table.th-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.th-t th { font-weight: 500; font-size: 12px; color: var(--text-3); text-align: right; padding: 6px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.th-t th.l, .th-t td.l { text-align: left; }
.th-t td { text-align: right; padding: 6px 6px; border-bottom: 1px solid var(--fill-1); white-space: nowrap; }
.th-t td.l { white-space: normal; }
.th-t td.l small, .th-t th.l small { display: block; color: var(--text-3); font-size: 11.5px; font-weight: 400; }
.th-t tr.pick td { background: var(--sel-bg); }
.th-t tr.pick td.l { color: var(--sel); }
.th-t tr.out td { color: var(--text-3); }
.th-t .ok { color: var(--good); }
.th-t .no { color: var(--bad); }
.th-t td.sp { padding: 0; height: 8px; border: 0; }
.th-band { display: block; width: 100%; height: auto; margin: 4px 0 2px; }
.th-band text { font-size: 11px; fill: var(--text-2); }
.th-inl { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 8px 0; font-size: 13px; color: var(--text-2); }
.th-inl .num { width: 110px; }
.th-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.th-links a { font-size: 12.5px; }
.th-cmp { padding: 14px 20px; }
.th-cmp table td.l a { color: var(--text); }
.th-cmp .x { border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 14px; padding: 0 4px; }
.th-static { padding: 16px 20px; }
.th-static h2 { font-size: 18px; margin-bottom: 8px; }

@media (max-width: 1180px) {
  .th-work { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .th-findrow { grid-template-columns: minmax(0, 1fr); }
  .th-find, .th-dhead, .th-cmp { padding: 12px 14px; }
  .th-panel .tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .th-pbody { padding: 4px 12px 14px; }
  .th-hide-sm { display: none; }
  .th-list th, .th-list td { padding: 6px 5px; }
  .th-t th, .th-t td { padding: 6px 4px; font-size: 12.5px; }
  .th-count { margin-left: 0; width: 100%; }
}
.th-qbox { position: relative; min-width: 0; }
.th-res { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 12px 32px rgba(20, 22, 28, .14); }
.th-res li { display: flex; gap: 12px; align-items: baseline; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.th-res li[aria-selected="true"], .th-res li:hover { background: var(--sel-bg); }
.th-res li .n { font-weight: 500; min-width: 96px; }
.th-res li .s { color: var(--text-3); font-size: 12.5px; }
.th-res li.none { color: var(--text-3); cursor: default; }
.th-all { padding: 16px 20px 14px; }
.th-allgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 32px; }
.th-allgrid h3 { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 0 0 4px; }
.th-cbtn { border: 0; background: none; padding: 0; font: inherit; font-weight: 500; color: var(--text); cursor: pointer; }
.th-cbtn:hover { color: var(--sel); }
.th-cbtn[aria-pressed="true"] { color: var(--sel); }
.th .step .eq { padding: 6px 0; }
#index .block-head { margin-bottom: 4px; }
@media (max-width: 900px) { .th-allgrid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .th-all { padding: 12px 14px; } .th-res li { flex-direction: column; gap: 0; } }
.th-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.th-stats .stat:nth-child(3n + 1) { border-left: 0; }
.th-stats .stat:nth-child(n + 4) { border-top: 1px solid var(--line); }
@media (max-width: 560px) {
  .th-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .th-stats .stat:nth-child(3n + 1) { border-left: 1px solid var(--line); }
  .th-stats .stat:nth-child(2n + 1) { border-left: 0; }
  .th-stats .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
.th-t td.th-w { white-space: normal; }
.th-t td.th-w small { white-space: normal; }

/* ---------- copy: values copy on click or tap, rows and tables as tab-separated cells (app.js, Copy) ---------- */
.cp { cursor: copy; border-radius: 3px; -webkit-tap-highlight-color: transparent; transition: background-color .12s, box-shadow .12s; }
@media (hover: hover) { .cp:hover { background: var(--fill-2); box-shadow: 0 0 0 2px var(--fill-2); } }
.cp:focus { outline: none; }
.cp:focus-visible { outline: 2px solid var(--sel); outline-offset: 1px; }
.cp.cp-ok, .cpb.cp-ok { background: var(--good-bg); box-shadow: 0 0 0 2px var(--good-bg); color: var(--good-ink); }
.th-t .cpc { width: 22px; padding: 0 0 0 2px; text-align: center; }
.cpb { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px; background: none;
  color: var(--text-3); cursor: copy; vertical-align: middle; -webkit-tap-highlight-color: transparent; }
.cpb:hover { color: var(--text); background: var(--fill-2); }
.cpb:focus { outline: none; }
.cpb:focus-visible { outline: 2px solid var(--sel); outline-offset: 0; opacity: 1; }
@media (hover: hover) {
  .th-t tbody .cpb { opacity: 0; }
  .th-t tbody tr:hover .cpb, .th-t tbody .cpb:focus-visible, .th-t tbody .cpb.cp-ok { opacity: 1; }
  .th-t thead .cpb { opacity: .55; }
  .th-t:hover thead .cpb { opacity: 1; }
}
@media (hover: none) { .th-t tbody .cpb { opacity: .6; } }
.cp-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: flex; gap: 12px; align-items: center; width: max-content;
  max-width: calc(100vw - 32px); padding: 9px 14px; border-radius: 9px; background: var(--text); color: var(--on-accent); font-size: 13px; box-shadow: 0 4px 16px rgba(0, 0, 0, .18); }
.cp-toast[hidden] { display: none; }
.cp-toast b { font-weight: 600; }
.cp-toast button { flex: none; border: 0; border-radius: 6px; padding: 4px 9px; background: color-mix(in srgb, var(--surface) 16%, transparent); color: var(--on-accent); font: inherit; font-size: 12.5px; cursor: pointer; }
.cp-toast.in { animation: cp-in .16s ease-out; }
@keyframes cp-in { from { opacity: 0; transform: translate(-50%, 6px); } }
@media (prefers-reduced-motion: reduce) { .cp-toast.in { animation: none; } .cp { transition: none; } }
@media print { .cpc, .cp-toast { display: none; } }

/* theme-auto:start · generated by scripts/theme/hexmap.py: dark values (the rule of scripts/theme/colour.py) for
   colours that are not tokens, written as var(--x-rrggbb, #rrggbb): light is the fallback, unchanged */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --x-5b6b82: #7d8b9f; --x-6e7177: #85827f; --x-8a7a62: #867965; --x-a9b6c9: #47505e; --x-c9b9a0: #564b39;
    --x-cdbb9c: #635640; --x-e9edf3: #2d2b28; --x-f1ece4: #2e2b26;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-5b6b82: #7d8b9f; --x-6e7177: #85827f; --x-8a7a62: #867965; --x-a9b6c9: #47505e; --x-c9b9a0: #564b39;
    --x-cdbb9c: #635640; --x-e9edf3: #2d2b28; --x-f1ece4: #2e2b26;
  }
}
/* theme-auto:end */

/* dark, by hand: the nut (#f1ece4) and bolt (#e9edf3) fills come out as two near-identical warm greys through the rule,
   so in dark they take the concrete and blue-steel tokens (light keeps its exact colours through the fallbacks) */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --x-f1ece4: var(--concrete); --x-e9edf3: var(--steel-blue); }
}
@media screen {
  :root[data-theme="dark"] { --x-f1ece4: var(--concrete); --x-e9edf3: var(--steel-blue); }
}
