/*! StiffStruct, (c) 2026 Mohammad Asad. All rights reserved. Proprietary: copying, mirroring or reusing this code is not permitted without written permission (see terms.html#intellectual-property). build 20261018-2133 */
/* StiffStruct — beam wizard (js/ui/beam-panel.js). Everything is scoped under .bp / .bp-*; colours come from
   the design tokens in app.css so light and dark themes both work. */

.bp {
  display: flex; flex-direction: column; min-height: 100%;
  font-size: 13px; color: var(--fg);
}
.bp [hidden] { display: none !important; }

/* ---- sticky tab bar ------------------------------------------------------------------------- */
.bp-top {
  position: sticky; top: 0; z-index: 4;
  padding: 6px 8px 0; background: var(--bg-elev); border-bottom: 1px solid var(--border);
  container-type: inline-size;
}
.bp-tabs { display: flex; gap: 2px; }
.bp-tab {
  position: relative; flex: 1 1 0; min-width: 0; height: 36px; padding: 0 2px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  border: 0; border-bottom: 2px solid transparent; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent; color: var(--fg-muted);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.bp-tab:hover { background: var(--bg-hover); color: var(--fg); }
.bp-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bp-tab[aria-selected="true"] { color: var(--accent-text); border-bottom-color: var(--accent); }
.bp-tabnum {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--bg-sunken); color: var(--fg-muted);
}
.bp-tab[aria-selected="true"] .bp-tabnum { background: var(--accent); color: var(--accent-fg); }
.bp-tablabel { overflow: hidden; text-overflow: ellipsis; }
.bp-tabcount {
  flex: none; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-text);
}
/* the panel is user-resizable: drop the step number, then the count, before a label gets clipped */
@container (max-width: 440px) { .bp-tabnum { display: none; } }
@container (max-width: 300px) { .bp-tabcount { display: none; } }

/* ---- body and cards ------------------------------------------------------------------------- */
.bp-body { flex: 1 1 auto; padding: 10px 10px 14px; }
.bp-step { display: flex; flex-direction: column; gap: 10px; }
.bp-card {
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
  padding: 10px 11px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.bp-h {
  margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--fg-muted);
}
.bp-help, .bp-tip { margin: 0; font-size: 12px; line-height: 1.45; color: var(--fg-muted); }
.bp-tip { padding: 6px 8px; border-radius: var(--radius-sm); background: var(--bg-sunken); }
.bp-muted { font-size: 12px; color: var(--fg-subtle); }
.bp-total { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bp-total:empty, .bp-muted:empty { display: none; }
.bp-ic { display: inline-flex; flex: none; }
.bp-form { display: flex; flex-direction: column; gap: 9px; }
.bp-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bp-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bp-mag { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bp-mag > .wg-num { flex: 1 1 110px; min-width: 100px; }
.bp-nav { display: flex; align-items: center; gap: 6px; padding-top: 2px; }

.bp-msg { min-height: 0; font-size: 12px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.bp-msg:empty { display: none; }
.bp-msg.err { color: var(--danger); }

/* ---- palettes ------------------------------------------------------------------------------- */
.bp-palette { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bp-tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 56px; padding: 6px 4px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elev); color: var(--fg); font: inherit; font-size: 12px; font-weight: 550; cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.bp-tool:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.bp-tool:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bp-tool[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.bp-palette--support .bp-tool .bp-ic { color: var(--support); }
.bp-palette--load .bp-tool .bp-ic { color: var(--load); }
.bp-tool[aria-checked="true"] .bp-ic { color: inherit; }
.bp-tool-label { line-height: 1.1; }

/* ---- position input with L · M · R quick buttons -------------------------------------------- */
.bp-pos { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bp-pos-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bp-posbox { position: relative; flex: 1 1 auto; min-width: 0; display: inline-flex; }
.bp-posbox .input { width: 100%; padding-right: 36px; }
.bp-unit {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--fg-subtle); pointer-events: none;
}
.bp-quicks { display: inline-flex; flex: none; gap: 2px; padding: 2px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius); }
.bp-quick {
  width: 28px; height: 26px; border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--fg-muted); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.bp-quick:hover { color: var(--fg); }
.bp-quick:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bp-quick[aria-pressed="true"] { background: var(--bg-elev); color: var(--accent-text); box-shadow: var(--shadow-1); }

/* ---- case bar ------------------------------------------------------------------------------- */
.bp-casebar { display: flex; align-items: center; gap: 4px; }
.bp-casebar .select { flex: 1 1 auto; min-width: 0; }

/* ---- lists ---------------------------------------------------------------------------------- */
.bp-list { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bp-row {
  display: flex; align-items: center; gap: 2px; min-width: 0;
  padding: 2px 2px 2px 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elev); scroll-margin: 48px 0 150px;
}
.bp-row:hover { background: var(--bg-hover); }
.bp-row.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.bp-row-main {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px;
  padding: 5px 6px 5px 8px; border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--fg); font: inherit; text-align: left; cursor: pointer;
}
.bp-row-main:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bp-row-ic { color: var(--support); }
.bp-row-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.bp-row-title { font-weight: 550; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.bp-row-sub { font-size: 12px; color: var(--fg-muted); overflow-wrap: anywhere; }
.bp-row-sub:empty { display: none; }
.bp-row.is-selected .bp-row-sub { color: var(--accent-text); }
.bp-row .btn-icon { flex: none; color: var(--fg-muted); }
.bp-row .btn-icon:hover { color: var(--fg); }
.bp-empty {
  display: flex; flex-direction: column; gap: 4px; padding: 12px; text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--fg-muted); font-size: 12.5px; line-height: 1.4;
}
.bp-empty strong { color: var(--fg); font-size: 13px; }

/* ---- sections step -------------------------------------------------------------------------- */
.bp-region { display: flex; flex-direction: column; gap: 6px; }
.bp-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.bp-chip {
  height: 26px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: 13px;
  background: var(--bg-elev); color: var(--fg); font: inherit; font-size: 12px; font-weight: 550; cursor: pointer;
}
.bp-chip:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.bp-chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bp-results { display: flex; flex-direction: column; gap: 2px; }
.bp-results:empty { display: none; }
.bp-result {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; padding: 5px 8px; text-align: left;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--bg-sunken); color: var(--fg);
  font: inherit; font-size: 12.5px; cursor: pointer;
}
.bp-result:hover, .bp-result:focus-visible { outline: none; border-color: var(--accent); background: var(--accent-soft); }
.bp-props {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 10px; margin: 0; padding: 7px 9px;
  border-radius: var(--radius-sm); background: var(--bg-sunken); font-variant-numeric: tabular-nums;
}
.bp-props > div { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.bp-props dt { color: var(--fg-muted); font-size: 12px; }
.bp-props dd { margin: 0; font-weight: 600; font-size: 12.5px; text-align: right; }

/* ---- sticky summary ------------------------------------------------------------------------- */
.bp-foot {
  position: sticky; bottom: 0; z-index: 4; margin-top: auto;
  display: flex; flex-direction: column; gap: 8px; padding: 9px 10px 10px;
  background: var(--bg-elev); border-top: 1px solid var(--border);
  box-shadow: 0 -8px 14px -12px rgba(16, 24, 40, 0.35);
}
.bp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.bp-stat {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 2px; min-width: 0;
  border-radius: var(--radius-sm); background: var(--bg-sunken); line-height: 1.15; text-align: center;
}
.bp-stat b { font-size: 14px; font-variant-numeric: tabular-nums; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-stat span { font-size: 10.5px; color: var(--fg-muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-status {
  display: flex; align-items: flex-start; gap: 6px; padding: 6px 8px; border-radius: var(--radius-sm);
  font-size: 12px; line-height: 1.35; background: var(--info-soft); color: var(--info);
}
.bp-status .bp-ic { margin-top: 1px; }
.bp-status.ok { background: var(--success-soft); color: var(--success); }
.bp-status.warn { background: var(--warning-soft); color: var(--warning); }
.bp-status.err { background: var(--danger-soft); color: var(--danger); }
.bp-analyze { font-weight: 650; }

/* ---- fallbacks for shared widgets (low specificity; css/inputs.css wins when present) --------- */
:where(.bp) .wg-num { position: relative; display: inline-flex; align-items: center; min-width: 0; }
:where(.bp) .wg-num-input { width: 100%; }
:where(.bp) .wg-num.has-unit .wg-num-input { padding-right: 52px; }
:where(.bp) .wg-num-unit { position: absolute; right: 9px; font-size: 12px; color: var(--fg-subtle); pointer-events: none; }
:where(.bp) .wg-num.is-invalid .wg-num-input { border-color: var(--danger); }
:where(.bp) .wg-control { min-width: 0; }
:where(.bp) .wg-hint { font-size: 12px; line-height: 1.35; color: var(--fg-subtle); }
:where(.bp) .wg-label { font-size: 12px; font-weight: 550; color: var(--fg-muted); }
:where(.bp) .wg-seg-btn .wg-ic { flex: none; }
:where(.bp) .wg-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; }
.bp .field, .bp .wg-field { gap: 4px; }
.bp .wg-control > .wg-num, .bp .wg-control > .select { width: 100%; }

@media (max-width: 380px) {
  .bp-tabnum { display: none; }
  .bp-tool { min-height: 52px; }
}

/* ---- forces-only choice (Sections step) ------------------------------------------------------ */
.bp-card[hidden], .bp-tip[hidden] { display: none; }
.seg.bp-modeseg { display: flex; flex-direction: column; align-items: stretch; gap: 3px; }
.seg.bp-modeseg button {
  height: auto; min-height: 34px; padding: 6px 10px; white-space: normal; text-align: left; justify-content: flex-start;
  line-height: 1.3; white-space: normal;
}
.seg.bp-modeseg button[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: -2px; color: var(--fg); }
.bp-why { background: var(--warning-soft); color: var(--fg); border-left: 3px solid var(--warning); }
.bp-fo-info { background: var(--info-soft); color: var(--fg); border-left: 3px solid var(--info); }
