/* ==========================================================================
   Shared tool-page components (bento workbench, feature rows, result card,
   breakdown rows, presets, copy actions). Split out of initiative.css on 2026-11-28
   so every tool page can reuse them; contents unchanged.
   ========================================================================== */

.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.bento-left {
  grid-column: 1 / 7;
}

.bento-right {
  grid-column: 7 / 13;
  display: grid;
  gap: 12px;
}

/* Hairline Internal Section Divisions (No cards inside cards) */
.sec-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--div);
}

.sec-row:last-child {
  border-bottom: none;
}

.sec-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
}

/* Quick Presets Strip (actions: shared .btn .btn-sec) */
.preset {
  min-width: 0;
  padding: 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  justify-content: center;
}

.preset-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

/* Four across only when the left card is wide enough for the longest label */
.bento-left {
  container: bento-left / inline-size;
}

@container bento-left (min-width: 600px) {
  .preset-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Core Stats: Hairline 2-Column Split */
.core-split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  border-bottom: 1px solid var(--div);
}

.core-cell {
  padding: 12px 14px;
}

.core-cell + .core-cell {
  border-left: 1px solid var(--div);
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.field-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.field-sub {
  font-size: 11px;
  color: var(--ink-4);
}

/* Hairline Interactive Feature Rows (Zero nested boxes) */
.feat-list {
  display: grid;
}

.feat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--div);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s var(--ease);
}

.feat-row:last-child {
  border-bottom: none;
}

.feat-row:hover {
  background-color: var(--soft);
}

.feat-row.is-checked {
  background-color: var(--acc-tint);
}

.feat-l {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.feat-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.feat-box {
  width: 17px;
  height: 17px;
  border-radius: 4px;
  border: 1.5px solid var(--line-strong);
  background-color: var(--tile);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  flex-shrink: 0;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.feat-row.is-checked .feat-box {
  background-color: var(--acc);
  border-color: var(--acc);
  color: var(--ink-inv);
}

.feat-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}

.feat-row.is-checked .feat-name {
  font-weight: 600;
}

.feat-val {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}

.feat-row.is-checked .feat-val {
  color: var(--acc-ink);
}

/* ==========================================================================
   Dark Obsidian Instrument Card (Top Right Focal Anchor)
   ========================================================================== */
.xr-status {
  color: var(--x-ink-3);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.xr-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--x-ok);
}

.xr-situ {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.xr-misc {
  display: grid;
  gap: 4px;
}

.xr-misc-lbl {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--x-ink-2);
}

.xr-misc-hint {
  font-weight: 500;
  color: var(--x-ink-3);
}

.xr-misc .field {
  width: 92px;
  height: 30px;
}

.xr-body {
  padding: 16px 16px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 176px;
  gap: 16px;
  align-items: center;
}

.xr-kicker {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--x-ink-3);
  margin-bottom: 2px;
}

.xr-total {
  font-family: var(--num);
  font-size: 56px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--x-ink);
  margin-bottom: 14px;
  transition: color 0.18s var(--ease);
}

.xr-total.is-neg {
  color: var(--x-fail);
}

.xr-total.is-pulse {
  color: var(--x-data);
}

.xr-roll-btn {
  width: 100%;
  max-width: 230px;
  height: 38px;
  justify-content: space-between;
  padding: 0 12px 0 14px;
}

.xr-roll-btn.is-pressed kbd.keycap {
  transform: translateY(1px);
  border-bottom-width: 1px;
}

.xr-formula {
  margin-top: 10px;
  min-height: 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--x-ink-3);
}

.xr-formula strong {
  color: var(--x-ok);
  font-weight: 700;
}

/* Dark Bottom Utility Strip */
.xr-foot {
  container-type: inline-size;
  position: relative;
  padding: 9px 14px;
  border-top: 1px solid var(--x-div);
  background-color: var(--x-panel);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* One "Try" link to another tool in the empty right end of the copy strip (user 2026-11-30).
   Jump grammar: text + arrow. Hidden when the strip is too narrow, so it never adds a line. */
.xr-next {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  font-size: 13px;
  font-weight: 600;
  color: var(--x-ink-2);
  text-decoration: none;
  white-space: nowrap;
}

.xr-next:hover {
  color: var(--x-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.xr-next:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--r-sm);
}

/* While "Link copied" etc. shows, it takes the link's place at the right end (no layout shift). */
.copy-status:has(~ .xr-next) {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
}

.copy-status:not(:empty) ~ .xr-next {
  visibility: hidden;
}

/* Too narrow to keep buttons and link on one line: drop the link, feedback goes back in flow. */
@container (max-width: 489px) {
  .xr-next {
    display: none;
  }

  .copy-status:has(~ .xr-next) {
    position: static;
    transform: none;
  }
}

@media (pointer: coarse) {
  .xr-next {
    min-height: 44px;
  }
}

.xr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-status {
  min-height: 18px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--x-ok);
}

.copy-status.is-err {
  color: var(--x-fail);
}

/* ==========================================================================
   Precision SVG Initiative Scale Ruler + Hairline Breakdown Card
   ========================================================================== */
.scale-box {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--div);
}

.scale-head {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 10px;
}

.scale-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.scale-stat:nth-child(2) {
  align-items: center;
}

.scale-stat:nth-child(3) {
  align-items: flex-end;
}

.scale-stat-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-4);
}

.scale-stat-val {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.scale-stat.is-avg .scale-stat-val {
  color: var(--data);
}

/* Breakdown List: fixed rows, values change in place */
.bd-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bd-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 58px;
  gap: 10px;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  border-bottom: 1px solid var(--div);
  font-size: 13px;
}

.bd-row:last-child {
  border-bottom: none;
}

.bd-row.is-superseded {
  color: var(--ink-4);
}

.bd-name {
  font-weight: 500;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bd-row.is-superseded .bd-name {
  color: var(--ink-4);
}

.bd-meter {
  display: block;
  position: relative;
  height: 4px;
  border-radius: 2px;
  background-color: var(--trk);
}

.bd-fill {
  display: block;
  position: relative;
  height: 100%;
  border-radius: 2px;
  background-color: var(--data);
  transition: width 0.2s var(--ease);
}

.bd-fill.is-neg {
  background-color: var(--red);
}

.bd-val {
  text-align: right;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.bd-val.is-pos {
  color: var(--green);
}

.bd-val.is-neg {
  color: var(--red);
}

.bd-row.is-off .bd-name {
  font-weight: 400;
  color: var(--ink-4);
}

.bd-val.is-off {
  color: var(--ink-4);
  font-weight: 500;
}

.bd-val.is-muted {
  grid-column: 2 / 4;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--ink-4);
  white-space: normal;
}

.privacy-bar {
  padding: 8px 16px;
  border-top: 1px solid var(--div);
  background-color: var(--head);
  color: var(--ink-4);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 7px;
}

@media (max-width: 959px) {
  .bento-left,
  .bento-right {
    grid-column: 1 / -1;
  }
}

@media (max-width: 639px) {
  .core-split {
    grid-template-columns: 1fr;
  }

  .core-cell + .core-cell {
    border-left: none;
    border-top: 1px solid var(--div);
  }

  .xr-body {
    grid-template-columns: 1fr;
  }

  .xr-roll-btn {
    max-width: none;
  }

  .bd-row {
    grid-template-columns: minmax(0, 1fr) 64px 52px;
    padding: 0 14px;
  }
}

@media (pointer: coarse) {
  .xr-misc .field {
    height: 44px;
  }

  .feat-row {
    min-height: 48px;
  }
}

/* Shared dropdown (moved from hp.css on 2026-12-03): native arrow replaced by the same chevron as the top-bar Tools caret
   (14px, stroke 2, symmetric, vertically centred). Colour = --ink-3 of each theme. */
.sel {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  height: 40px;
  padding: 0 34px 0 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b6256' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 14px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background-color: var(--ctl);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.sel:hover {
  border-color: var(--ink-4);
}

[data-theme="dark"] .sel {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a09480' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
}

.sel:focus-visible {
  outline: none;
  border-color: var(--acc);
  box-shadow: var(--focus);
}

@media (pointer: coarse) {
  .sel {
    height: 44px;
  }
}

/* Reference card sub-headings (moved from initiative.css, shared by tool pages) */
.ref-split {
  border-bottom: 1px solid var(--div);
}

.ref-subhead {
  padding: 9px 14px;
  background-color: var(--soft);
  border-bottom: 1px solid var(--div);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
