/* arsenal.css — round 39 (owned by the arsenal agent). Loaded after app.css/game.css/hud.css, so rules here override them.
 *
 * The Arsenal room: the armory floor (#/tools) and the frame every tool page
 * renders inside (#/tools/<slug>). Same materials as the Vault's wings and the
 * dock: deep navy glass, electric-blue edges, the hu-* icons in a socket.
 *
 *   .armory        the floor: header, .deck (next move + pipeline), .armory__bays, .supply
 *   .bay / .plate  one step of the work / one tool in it
 *   .tool-frame    a tool page: .tool-head, .tool-tabs, .tool-body[data-tool], .tool-foot
 */

.armory, .tool-frame {
  --glass: linear-gradient(180deg, rgba(20, 103, 239, 0.16), rgba(9, 22, 52, 0.82));
  --glass-hot: linear-gradient(180deg, rgba(20, 103, 239, 0.34), rgba(9, 22, 52, 0.9));
  --edge: rgba(144, 195, 255, 0.26);
  --edge-hot: rgba(56, 165, 255, 0.95);
  --blue: #38a5ff;
  display: grid; gap: var(--s-5); min-width: 0;
}

/* ---------- the icon socket (shared by plates, the next move, supply and the hand-off) ---------- */
.plate__icon, .nextmove__icon, .tool-head__icon {
  position: relative; display: grid; place-items: center; flex: none;
  width: 64px; height: 64px; border-radius: 16px;
  background: radial-gradient(circle at 50% 35%, rgba(56, 165, 255, 0.22), transparent 70%), rgba(4, 12, 32, 0.72);
  border: 1px solid rgba(144, 195, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -10px 18px -10px rgba(0, 0, 0, 0.6);
}
.plate__icon img, .nextmove__icon img, .tool-head__icon img { width: 78%; height: 78%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55)); transition: transform 200ms var(--ease-out), filter 200ms; }

/* ---------- the floor header ---------- */
.armory > .view-head h1 { max-width: 22ch; }
.armory > .view-head p { font-size: var(--t-md); }
.armory__keys { margin: calc(-1 * var(--s-3)) 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: var(--t-xs); color: var(--fg-faint); }
.armory__keys kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; font: 600 0.72rem/1 var(--font-mono); color: var(--fg-dim); background: rgba(4, 12, 32, 0.7); border: 1px solid rgba(144, 195, 255, 0.22); border-bottom-width: 2px; }
@media (hover: none), (pointer: coarse), (max-width: 640px) { .armory__keys { display: none; } }

/* ---------- the deck: next move + pipeline ---------- */
.deck { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--s-4); }
.nextmove, .ledger { position: relative; border-radius: 20px; border: 1px solid var(--edge); background: var(--glass); min-width: 0; }

.nextmove { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-5); align-items: center; padding: var(--s-4) var(--s-5); overflow: hidden;
  background: radial-gradient(90% 120% at 0% 0%, rgba(56, 165, 255, 0.32), transparent 55%), var(--glass-hot); border-color: rgba(56, 165, 255, 0.6); box-shadow: 0 0 40px -14px rgba(56, 165, 255, 0.7); }
.nextmove::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.06) 50%, transparent 60%); background-size: 250% 100%; animation: arsenal-sheen 6s var(--ease-out) 3; }   /* three passes, then still: a page left open stops moving (and screenshots settle) */
@keyframes arsenal-sheen { 0%, 70% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
.nextmove__icon { width: 104px; height: 104px; border-radius: 26px; border-color: rgba(56, 165, 255, 0.5); box-shadow: 0 0 30px -6px rgba(56, 165, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.nextmove__body { display: grid; gap: var(--s-2); justify-items: start; min-width: 0; }
.nextmove__label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font: 700 var(--t-2xs)/1.2 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: #bfe0ff; }
.nextmove__label i { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 10px var(--blue); animation: guide-breathe 2.4s ease-in-out 4; }
.nextmove__bay { color: var(--fg-faint); letter-spacing: 0.08em; }
.nextmove__title { margin: 0; font-size: clamp(1.3rem, 2.1vw, 1.75rem); line-height: 1.15; letter-spacing: -0.02em; max-width: 30ch; text-wrap: balance; }
.nextmove__why { margin: 0; color: var(--fg-dim); font-size: var(--t-sm); line-height: 1.5; max-width: 52ch; }
.nextmove__go { margin-top: var(--s-2); gap: var(--s-2); }

.ledger { display: grid; gap: var(--s-3); align-content: start; padding: var(--s-4) var(--s-5); container-type: inline-size; }
.ledger__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.ledger__head h2 { margin: 0; font: 700 var(--t-2xs)/1.2 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-dim); }
.ledger__head a { font-size: var(--t-sm); color: var(--neon-hot); text-decoration: none; white-space: nowrap; }
.ledger__head a:hover { color: #fff; }
.ledger__stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ledger__stage { display: grid; gap: 2px; padding: 7px 10px; border-radius: 10px; background: rgba(4, 12, 32, 0.55); border: 1px solid rgba(144, 195, 255, 0.12); min-width: 0; }
.ledger__stage b { font-size: 1.25rem; line-height: 1; color: var(--fg-faint); }
.ledger__stage span { font-size: var(--t-2xs); color: var(--fg-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger__stage.has-some { border-color: rgba(56, 165, 255, 0.4); background: rgba(20, 103, 239, 0.16); }
.ledger__stage.has-some b { color: #fff; }
.ledger__stage.has-some span { color: var(--fg-dim); }
.ledger__stage.is-won.has-some { border-color: rgba(var(--money-rgb), 0.55); background: rgba(var(--money-rgb), 0.1); }
.ledger__stage.is-won.has-some b { color: var(--money); }
.ledger__empty { margin: 0; color: var(--fg-dim); font-size: var(--t-sm); line-height: 1.5; }
.ledger__week { display: grid; gap: 8px; padding-top: var(--s-3); border-top: 1px solid rgba(144, 195, 255, 0.12); }
.ledger__weeklabel { font: 700 var(--t-2xs)/1 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-faint); }
.ledger__week ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ledger__meter { display: grid; grid-template-columns: 1fr auto; gap: 4px; align-items: baseline; font-size: var(--t-2xs); color: var(--fg-faint); min-width: 0; }
.ledger__meter b { font-size: var(--t-xs); color: var(--fg-dim); }
.ledger__meter i { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--blue) var(--fill), rgba(144, 195, 255, 0.12) var(--fill)); }
.ledger__meter.is-met b { color: var(--money); }
.ledger__meter.is-met i { background: linear-gradient(90deg, var(--money) var(--fill), rgba(144, 195, 255, 0.12) var(--fill)); }

/* ---------- the bays ---------- */
.armory__bays { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: auto; column-gap: 28px; align-items: start; }
/* Each bay spans two rows of the floor's grid (head, plates) on a subgrid, so every bay's first plate starts on the same line. */
.bay { position: relative; display: grid; grid-row: span 2; grid-template-rows: subgrid; row-gap: var(--s-3); align-content: start; min-width: 0; }
.bay__head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px var(--s-3); align-items: center; padding: 0 2px; }
.bay__n { grid-row: 1 / span 2; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; font-size: var(--t-md); color: #fff; background: linear-gradient(180deg, rgba(56, 165, 255, 0.45), rgba(20, 103, 239, 0.25)); border: 1px solid rgba(56, 165, 255, 0.7); box-shadow: 0 0 18px -6px rgba(56, 165, 255, 0.9); }
.bay__title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); min-width: 0; }
.bay__title h2 { margin: 0; font-size: var(--t-lg); letter-spacing: -0.01em; line-height: 1.1; }
.bay__count { font-size: var(--t-xs); color: var(--fg-faint); }
.bay__line { grid-column: 2; margin: 0; font-size: var(--t-xs); line-height: 1.4; color: var(--fg-faint); }
.bay__head { align-self: end; }
.bay__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; align-content: start; }
.bay__slot, .ledger__meter, .ledger__stage { margin: 0; }
.bay__slot { min-width: 0; }

/* The arrow from one bay to the next: a chevron in the gutter, level with the bay numbers. */
.bay__to { position: absolute; top: 13px; right: -24px; width: 20px; height: 14px; pointer-events: none;
  background: linear-gradient(90deg, rgba(56, 165, 255, 0) 0, rgba(56, 165, 255, 0.8) 100%) left center / 12px 2px no-repeat; }
.bay__to::after { content: ""; position: absolute; right: 2px; top: 50%; width: 8px; height: 8px; border-top: 2px solid var(--blue); border-right: 2px solid var(--blue); transform: translateY(-50%) rotate(45deg); filter: drop-shadow(0 0 4px rgba(56, 165, 255, 0.9)); }

/* ---------- a plate ---------- */
.plate { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-3); align-items: start; padding: 12px 14px 12px 12px; border-radius: 16px;
  background: radial-gradient(circle at 100% 0, rgba(56, 165, 255, 0.16), transparent 50%), var(--glass); border: 1px solid var(--edge); color: var(--fg); text-decoration: none;
  transition: transform 180ms var(--ease-out), border-color 180ms, box-shadow 180ms, background 180ms; }
.plate:hover, .plate:focus-visible { transform: translateY(-3px); border-color: var(--edge-hot); box-shadow: 0 0 30px -8px rgba(56, 165, 255, 0.75); text-decoration: none; color: var(--fg); outline: none; }
.plate:focus-visible { box-shadow: 0 0 0 2px rgba(56, 165, 255, 0.9), 0 0 30px -8px rgba(56, 165, 255, 0.75); }
.plate:hover .plate__icon img, .plate:focus-visible .plate__icon img { transform: scale(1.08) translateY(-1px); filter: drop-shadow(0 0 10px rgba(56, 165, 255, 0.8)); }
.plate:active { transform: scale(0.98); }
.plate__icon { width: 56px; height: 56px; border-radius: 14px; }
.plate__text { display: grid; gap: 4px; min-width: 0; }
.plate__name { font-size: 0.98rem; line-height: 1.2; letter-spacing: -0.01em; min-width: 0; padding-right: 40px; }
.plate__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; min-width: 0; }
.plate__lesson { position: absolute; top: 10px; right: 10px; font-size: var(--t-2xs); color: var(--fg-faint); padding: 1px 6px; border-radius: 6px; border: 1px solid rgba(144, 195, 255, 0.16); }
/* Blurbs are written to fit (views/tools.js `short`): they wrap, never cut mid-word. */
.plate__short { font-size: var(--t-xs); line-height: 1.4; color: var(--fg-dim); text-wrap: pretty; }
.plate__status { display: flex; align-items: center; gap: 6px; font: 600 var(--t-2xs)/1.3 var(--font-mono); letter-spacing: 0.02em; color: var(--fg-faint); min-width: 0; }
.plate__status i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: rgba(144, 195, 255, 0.25); }
.plate__status.is-live { color: #9df0c0; } .plate__status.is-live i { background: var(--money); box-shadow: 0 0 8px rgba(var(--money-rgb), 0.9); }
.plate__status.is-warn { color: #fde08a; } .plate__status.is-warn i { background: var(--warn); box-shadow: 0 0 8px rgba(251, 191, 36, 0.9); animation: guide-breathe 2.4s ease-in-out 4; }
.plate__status.is-out { color: #ff9aa1; } .plate__status.is-out i { background: var(--red); box-shadow: 0 0 8px rgba(255, 61, 74, 0.8); }
.plate.is-used .plate__icon { border-color: rgba(56, 165, 255, 0.4); }

/* The plate the next move points at: lit, and flagged. */
.plate.is-next { background: radial-gradient(circle at 100% 0, rgba(56, 165, 255, 0.3), transparent 55%), var(--glass-hot); border-color: rgba(56, 165, 255, 0.85); box-shadow: 0 0 26px -8px rgba(56, 165, 255, 0.8); }
.plate__flag { position: absolute; top: -9px; left: 80px; padding: 2px 8px; border-radius: 999px; font: 800 0.62rem/1.4 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: #04122e; background: #bfe0ff; box-shadow: 0 0 12px rgba(56, 165, 255, 0.9); }

/* ---------- supply (the shop) ---------- */
.supply { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-4); align-items: center; padding: 12px 18px 12px 12px; border-radius: 16px; border: 1px dashed rgba(144, 195, 255, 0.3); background: rgba(4, 12, 32, 0.45); color: var(--fg); text-decoration: none; transition: border-color 180ms, background 180ms; }
.supply:hover, .supply:focus-visible { border-color: var(--edge-hot); border-style: solid; background: rgba(20, 103, 239, 0.14); color: var(--fg); text-decoration: none; }
.supply .plate__icon { width: 56px; height: 56px; border-radius: 14px; }
.supply__text { display: grid; gap: 2px; min-width: 0; }
.supply__label { font: 700 var(--t-2xs)/1.2 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-faint); }
.supply__text b { font-size: 1rem; }
.supply__text > span:last-child { font-size: var(--t-xs); color: var(--fg-dim); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.supply__tag { font: 600 var(--t-2xs)/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--neon-hot); white-space: nowrap; }

/* The floor arrives in order: deck, then each bay's plates in turn. */
@media (prefers-reduced-motion: no-preference) {
  .deck, .bay { animation: arsenal-rise 420ms var(--ease-out) both; }
  .bay--find { animation-delay: 60ms; } .bay--judge { animation-delay: 120ms; } .bay--win { animation-delay: 180ms; } .bay--run { animation-delay: 240ms; }
}
@keyframes arsenal-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .nextmove::after, .nextmove__label i, .plate__status.is-warn i { animation: none; } .plate:hover, .plate:focus-visible { transform: none; } }

/* ---------- the tool frame ---------- */
.tool-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-5); align-items: start; padding-bottom: var(--s-5); border-bottom: 1px solid rgba(144, 195, 255, 0.14); }
.tool-head__icon { width: 104px; height: 104px; border-radius: 26px; border-color: rgba(56, 165, 255, 0.5); box-shadow: 0 0 30px -8px rgba(56, 165, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08); margin-top: 4px; }
.tool-head__main { gap: var(--s-2); min-width: 0; }
.tool-head__main h1 { margin: 0; font-size: clamp(1.9rem, 3.6vw, 2.75rem); max-width: 20ch; }
.tool-head__main p { margin: 0; font-size: var(--t-md); max-width: 62ch; }
.tool-head__side { display: grid; gap: var(--s-3); justify-items: end; min-width: 0; }
.tool-route { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.tool-route li { margin: 0; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: var(--t-xs); font-weight: 600; color: var(--fg-faint); background: rgba(4, 12, 32, 0.5); border: 1px solid rgba(144, 195, 255, 0.12); white-space: nowrap; }
.tool-route li .num { font-size: var(--t-2xs); opacity: 0.7; }
.tool-route li.is-on { color: #fff; border-color: rgba(56, 165, 255, 0.8); background: rgba(20, 103, 239, 0.32); box-shadow: 0 0 16px -6px rgba(56, 165, 255, 0.9); }
.tool-head__lesson { display: grid; gap: 2px; justify-items: end; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--edge); background: var(--glass); color: var(--fg); text-decoration: none; transition: border-color 160ms, box-shadow 160ms; }
.tool-head__lesson .label { color: var(--fg-faint); }
.tool-head__lesson b { font-size: var(--t-md); }
.tool-head__lesson:hover, .tool-head__lesson:focus-visible { border-color: var(--edge-hot); box-shadow: 0 0 22px -8px rgba(56, 165, 255, 0.8); color: var(--fg); text-decoration: none; outline: none; }

.tool-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: calc(-1 * var(--s-2)); padding: 2px; }
.tool-tab__short { display: none; }
.tool-tab { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 12px; font-size: var(--t-sm); font-weight: 600; color: var(--fg-dim); text-decoration: none; background: rgba(4, 12, 32, 0.45); border: 1px solid rgba(144, 195, 255, 0.14); transition: color 160ms, border-color 160ms, background 160ms; }
.tool-tab img { width: 28px; height: 28px; object-fit: contain; }
.tool-tab:hover, .tool-tab:focus-visible { color: #fff; border-color: rgba(56, 165, 255, 0.6); text-decoration: none; }
.tool-tab.is-on { color: #fff; border-color: rgba(56, 165, 255, 0.85); background: rgba(20, 103, 239, 0.3); box-shadow: inset 0 -2px 0 var(--blue); }

.tool-body { min-width: 0; }

.tool-foot { display: grid; grid-template-columns: auto minmax(0, 460px); justify-content: space-between; align-items: center; gap: var(--s-4); margin-top: var(--s-4); padding-top: var(--s-5); border-top: 1px solid rgba(144, 195, 255, 0.14); }
.tool-foot__links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.tool-foot__keys { flex-basis: 100%; margin: var(--s-1) 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: var(--t-xs); color: var(--fg-faint); }
.tool-foot__keys kbd, .leadbar kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; font: 600 0.72rem/1 var(--font-mono); color: var(--fg-dim); background: rgba(4, 12, 32, 0.7); border: 1px solid rgba(144, 195, 255, 0.22); border-bottom-width: 2px; }
@media (hover: none), (pointer: coarse), (max-width: 640px) { .tool-foot__keys { display: none; } }

/* The lesson link and the one-line summary stand in for the side card and the intro on a phone. */
.tool-head__lessonlink, .tool-head__short { display: none; }
.tool-foot__next { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-4); align-items: center; padding: 12px 18px 12px 12px; border-radius: 18px; border: 1px solid rgba(56, 165, 255, 0.55); background: radial-gradient(circle at 100% 0, rgba(56, 165, 255, 0.28), transparent 55%), var(--glass-hot); color: var(--fg); text-decoration: none; box-shadow: 0 0 26px -10px rgba(56, 165, 255, 0.7); transition: transform 180ms var(--ease-out), border-color 180ms, box-shadow 180ms; }
.tool-foot__next:hover, .tool-foot__next:focus-visible { transform: translateY(-3px); border-color: var(--edge-hot); box-shadow: 0 0 34px -8px rgba(56, 165, 255, 0.9); color: var(--fg); text-decoration: none; outline: none; }
.tool-foot__next .plate__icon { width: 56px; height: 56px; border-radius: 14px; }
.tool-foot__text { display: grid; gap: 2px; min-width: 0; }
.tool-foot__label { font: 700 var(--t-2xs)/1.2 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: #bfe0ff; }
.tool-foot__text b { font-size: var(--t-lg); line-height: 1.2; }
.tool-foot__text > span:last-child { font-size: var(--t-sm); color: var(--fg-dim); line-height: 1.4; }
.tool-foot__arrow { font-size: 1.5rem; color: var(--blue); transition: transform 180ms var(--ease-out); }
.tool-foot__next:hover .tool-foot__arrow { transform: translateX(4px); }

/* ---------- smaller screens ---------- */
@media (max-width: 1180px) {
  .armory__bays { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--s-5); }
  .bay--judge .bay__to { display: none; }   /* Judge → Win wraps to the next row; the numbers carry the order */
  .tool-head { grid-template-columns: auto minmax(0, 1fr); }
  .tool-head__side { grid-column: 1 / -1; grid-auto-flow: column; justify-content: space-between; align-items: center; justify-items: start; }
  .tool-head__lesson { justify-items: start; }
}
@media (max-width: 900px) {
  .deck { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .armory__bays { grid-template-columns: minmax(0, 1fr); row-gap: 36px; }
    .bay__to, .bay--judge .bay__to { display: block; top: auto; bottom: -28px; right: auto; left: 22px; width: 14px; height: 20px; background: linear-gradient(180deg, rgba(56, 165, 255, 0) 0, rgba(56, 165, 255, 0.8) 100%) center top / 2px 12px no-repeat; }
  .bay__to::after { right: auto; left: 50%; top: auto; bottom: 2px; transform: translateX(-50%) rotate(135deg); }
  .nextmove { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); padding: var(--s-4); }
  .nextmove__icon { display: none; }   /* the label names the tool; on a phone the space goes to the move itself */
  .nextmove__go { width: 100%; display: grid; }
  .nextmove__go .btn { justify-content: center; }
  .ledger { padding: var(--s-4); }
  .ledger__stage { padding: 6px 7px; }
  .ledger__stage span { font-size: 0.66rem; white-space: normal; overflow: visible; line-height: 1.2; }
  .ledger__week ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .supply { grid-template-columns: auto minmax(0, 1fr); }
  .supply__tag { display: none; }
  /* A phone gets the tool, not the brochure: icon beside the title, the one-line summary, the lesson as a link in the crumbs. */
  .tool-head { grid-template-columns: auto minmax(0, 1fr); gap: var(--s-2) var(--s-3); align-items: center; padding-bottom: var(--s-3); }
  .tool-head__icon { width: 52px; height: 52px; border-radius: 14px; margin-top: 0; align-self: start; }
  .tool-head__main { gap: 4px; }
  .tool-head__main h1 { font-size: 1.6rem; }
  .tool-head__intro, .tool-head__side { display: none; }
  .tool-head__short { display: block; grid-column: 1 / -1; font-size: var(--t-sm) !important; color: var(--fg-dim); line-height: 1.45; }
  .tool-head__main { display: contents; }
  .tool-head__main .crumbs, .tool-head__main h1 { grid-column: 2; }
  .tool-head__main .crumbs { align-self: end; flex-wrap: wrap; row-gap: 2px; }
  .tool-head__main h1 { align-self: start; }
  .tool-head__lessonlink { display: inline; margin-left: auto; padding-left: var(--s-2); color: var(--neon-hot); text-decoration: none; font-weight: 600; white-space: nowrap; }
  .tool-tabs { margin-top: 0; }
  .tool-tab { padding: 5px 10px 5px 5px; gap: 6px; font-size: var(--t-xs); }
  .tool-tab img { width: 22px; height: 22px; }
  .tool-tab__full { display: none; }
  .tool-tab__short { display: inline; }
  .tool-foot { grid-template-columns: minmax(0, 1fr); }
  .tool-foot__next { order: -1; }
}

/* ---------- shared tool pieces (tools/lead.js): the lead bar, the signer bar, empty states ---------- */

/* The lead bar: which location this tool is working, what it is, and where it goes next. */
.leadbar { display: grid; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-color: rgba(56, 165, 255, 0.35); background: radial-gradient(120% 140% at 0% 0%, rgba(56, 165, 255, 0.14), transparent 55%), var(--glass, rgba(9, 22, 52, 0.82)); }
.leadbar__top { display: grid; grid-template-columns: minmax(220px, 340px) minmax(0, 1fr); gap: var(--s-2) var(--s-4); align-items: end; }
.leadbar__top:not(:has(.leadbar__pick)) { grid-template-columns: minmax(0, 1fr); }
.leadbar__pick { margin: 0; min-width: 0; }
.leadbar__pick .select { width: 100%; }
.leadbar__id { display: grid; gap: 6px; min-width: 0; padding-bottom: 4px; }
.leadbar__name { font-size: var(--t-lg); line-height: 1.2; }
.leadbar__chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.leadbar__chips .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leadbar__empty { margin: 0; padding-bottom: 6px; font-size: var(--t-sm); color: var(--fg-dim); line-height: 1.45; max-width: 60ch; }
.leadbar__acts { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.leadbar__acts:empty { display: none; }
.leadbar__own { margin-left: auto; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.leadbar__log:empty { display: none; }
.leadbar__log { padding-top: var(--s-3); border-top: 1px solid rgba(144, 195, 255, 0.14); }
@media (max-width: 720px) {
  .leadbar { padding: var(--s-4); }
  .leadbar__top { grid-template-columns: minmax(0, 1fr); }
  .leadbar__acts .btn { flex: 1 1 auto; justify-content: center; }
  .leadbar__own { margin-left: 0; flex: 1 1 100%; }
  .leadbar__own .btn { flex: 1 1 auto; justify-content: center; }
}

/* Who every message signs as: four fields once, then one line. */
.youbar { display: grid; gap: var(--s-3); padding: var(--s-3) var(--s-5); }
.youbar__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.youbar__hint { flex: 1 1 260px; font-size: var(--t-sm); color: var(--warn, #fbbf24); }
.youbar__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); }
.youbar__grid .field { margin: 0; min-width: 0; }
.youbar__line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s-3); font-size: var(--t-sm); }
.youbar__line .btn { margin-left: auto; }
@media (max-width: 900px) { .youbar__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .youbar { padding: var(--s-3) var(--s-4); } }
@media (max-width: 720px) { .youbar__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); } }
@media (max-width: 340px) { .youbar__grid { grid-template-columns: minmax(0, 1fr); } }

/* One empty / error card for every tool. */
.tool-empty { display: grid; gap: var(--s-2); justify-items: start; padding: var(--s-5); border-style: dashed; border-color: rgba(144, 195, 255, 0.3); background: rgba(4, 12, 32, 0.5); }
.tool-empty__title { margin: 0; font-size: var(--t-xl, 1.35rem); line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
.tool-empty__body { margin: 0; color: var(--fg-dim); font-size: var(--t-sm); line-height: 1.55; max-width: 62ch; }
.tool-empty__acts { margin-top: var(--s-2); }
.tool-empty--error { border-style: solid; border-color: rgba(255, 61, 74, 0.45); background: rgba(40, 8, 16, 0.45); }
.tool-empty--error .label { color: #ff9aa1; }

/* The bars' fields use the console slot every tool's intake uses (label inside, top-left), whichever tool they sit in. */
.leadbar .field, .youbar .field { position: relative; display: grid; gap: 2px; min-height: 58px; padding: 9px 12px 8px; border-radius: var(--r-sm); background: var(--bg-0); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.06); transition: box-shadow 160ms var(--ease-out); }
.leadbar .field > label, .youbar .field > label { font: 400 0.62rem/1.3 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-faint); }
.leadbar .field .input, .leadbar .field .select, .youbar .field .input { border: 0; padding: 0; background-color: transparent; box-shadow: none; font-size: var(--t-md); min-height: 0; width: 100%; }
/* The caret keeps its own lane: a long name ends in an ellipsis before it (defect 44). An empty, disabled picker has no caret. */
.leadbar .field .select { padding-right: 28px; background-position: calc(100% - 12px) 55%, calc(100% - 7px) 55%; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.leadbar .field .select:disabled { background-image: none; padding-right: 0; opacity: 0.8; }
.leadbar .field:focus-within, .youbar .field:focus-within { box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(var(--scan-rgb), 0.7), 0 0 0 3px rgba(var(--scan-rgb), 0.14); }
.leadbar .field:focus-within > label, .youbar .field:focus-within > label { color: var(--scan); }
.leadbar .field .input:focus, .leadbar .field .select:focus, .youbar .field .input:focus { box-shadow: none; border: 0; outline: none; }

/* ---- Keyboard focus on the bay tabs and the Supply plate (defect 25) ---- */
.tool-tab:focus-visible, .supply:focus-visible { outline: 2px solid var(--focus, #8fd0ff); outline-offset: 3px; }

/* ---- The bay tabs on a phone: one row that scrolls (defect 43) ----
 * Snap to each tab, fade only the edge where more tabs wait (views/tools.js sets
 * is-more-left / is-more-right), and the lit tab is scrolled into view on open.
 */
@media (max-width: 640px) {
  .tool-tabs { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline: 16px; scrollbar-width: none; margin-inline: -4px; padding: 4px; }
  .tool-tabs::-webkit-scrollbar { display: none; }
  .tool-tab { scroll-snap-align: start; }
  .tool-tabs.is-more-right { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
  .tool-tabs.is-more-left { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px); mask-image: linear-gradient(90deg, transparent, #000 36px); }
  .tool-tabs.is-more-left.is-more-right { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
}

/* ---- One chip, every tool ----
 * The filter and toggle chips of the Pipeline (.crm-chip), the Script Library
 * (.sc-chip) and the Lead Finder (.lf__chip) share one look, the bay tab's:
 * navy glass, a thin blue edge, electric blue when on. Status pills inside the
 * tools take the same edge and shape at a smaller, static size.
 */
.crm-chip, .sc-chip, .lf .lf__chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 5px 12px;
  font: inherit; font-size: var(--t-xs); font-weight: 600; line-height: 1.2; color: var(--fg-dim);
  background: rgba(4, 12, 32, 0.45); border: 1px solid rgba(144, 195, 255, 0.22); border-radius: 999px; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none; transform: none;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: color 160ms, border-color 160ms, background 160ms;
}
.crm-chip:hover, .sc-chip:hover, .lf .lf__chip:hover { color: #fff; border-color: rgba(56, 165, 255, 0.6); transform: none; }
.crm-chip[aria-pressed="true"], .sc-chip[aria-pressed="true"], .lf .lf__chip.is-on { color: #fff; background: rgba(20, 103, 239, 0.32); border-color: rgba(56, 165, 255, 0.9); }
.crm-chip:focus-visible, .sc-chip:focus-visible, .lf .lf__chip:focus-visible { outline: 2px solid var(--focus, #8fd0ff); outline-offset: 2px; }
.crm-chip:active, .sc-chip:active, .lf .lf__chip:active { transform: scale(0.97); }
@media (max-width: 640px) { .crm-chip, .sc-chip, .lf .lf__chip { min-height: 36px; padding: 4px 11px; } }
:is(.tool-frame, .crm) .pill { border-radius: 999px; border: 1px solid rgba(144, 195, 255, 0.22); border-top-color: rgba(144, 195, 255, 0.22); font-size: var(--t-2xs); line-height: 1.2; }
:is(.tool-frame, .crm) .pill--warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
:is(.tool-frame, .crm) .pill--ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
:is(.tool-frame, .crm) .pill--accent { border-color: rgba(56, 165, 255, 0.5); }
:is(.tool-frame, .crm) .pill--idle { border-color: rgba(var(--red-rgb), 0.4); }

/* app.css resets the background of every select inside a tool field, which took the
 * caret with it: a dropdown looked like a text box. The caret comes back here. */
:is(.tool-form, .pipeline, .finder, .scripts, .drawer, .leadbar, .crm) .field:not(.field--inline) .select:not(:disabled) {
  padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-dim) 50%), linear-gradient(135deg, var(--fg-dim) 50%, transparent 50%);
  background-size: 5px 5px; background-repeat: no-repeat; background-position: calc(100% - 12px) 55%, calc(100% - 7px) 55%;
}

/* Round 40 (preview tier): sealed plates keep their art, quieter. */
.plate.is-sealed .plate__icon img { filter: saturate(.6) brightness(.85); }
.plate__seal { position: absolute; top: -9px; left: 80px; }
.scripts__seal { justify-self: start; }
.sealed__list { margin: 0; display: grid; gap: var(--s-1); }

/* ---- Round 40 fixer ----
 * The week's four meters go two by two when the ledger is narrow, so "0/15" never runs into "Visits" (M17).
 * The lesson link sits in the crumbs only on a phone; on wider screens the "From the lesson" card is the one link (L1).
 * Back buttons on a missing tool keep their own width (L3).
 */
@container (max-width: 480px) { .ledger__week ul { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; } }
.ledger__meter span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 641px) { .tool-head .crumbs a.tool-head__lessonlink { display: none; } }
.armory--missing .cluster .btn { flex: none; width: auto; }
/* The phone tab row (M5): snap points sit at the row's padding, matching where wireTabRow() scrolls the lit tab,
 * and the left fade is short, because the left edge is always a tab boundary, never half a tab. */
@media (max-width: 640px) {
  .tool-tabs { scroll-padding-inline: 4px; }
  .tool-tabs.is-more-left { -webkit-mask-image: linear-gradient(90deg, transparent, #000 10px); mask-image: linear-gradient(90deg, transparent, #000 10px); }
  .tool-tabs.is-more-left.is-more-right { -webkit-mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 36px), transparent); }
}

/* Preview tier: a sealed tool's tab reads quieter, so the open ones stand out; the preview strip breathes. */
.tool-tab.is-sealed { color: var(--fg-faint); }
.tool-tab.is-sealed img { filter: saturate(0.5) brightness(0.8); }
.tool-tab.is-sealed::after { content: ""; width: 9px; height: 11px; margin-left: 2px; flex: none; opacity: 0.7;
  background: currentColor; -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 11'><path d='M2 5V3.5a2.5 2.5 0 0 1 5 0V5h1v6H1V5zm1 0h3V3.5a1.5 1.5 0 0 0-3 0z'/></svg>") center / contain no-repeat; mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 11'><path d='M2 5V3.5a2.5 2.5 0 0 1 5 0V5h1v6H1V5zm1 0h3V3.5a1.5 1.5 0 0 0-3 0z'/></svg>") center / contain no-repeat; }
.armory__preview { display: grid; gap: var(--s-2); justify-items: start; }
.armory__preview p { margin: 0; max-width: 72ch; }
.armory__preview .cluster { margin-top: var(--s-1); }
