:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel2: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --line: #334155;
  /* Links: high contrast on dark bg (avoid browser default dark blue) */
  --link: #38bdf8;
  --link-hover: #7dd3fc;
  --link-visited: #a78bfa;
  --accent: #7dd3fc;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body:not(.setup-page):has(#appShell:not([hidden])) {
  overflow: hidden;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
}

#fileProtocolNotice[hidden],
#appShell[hidden] {
  display: none !important;
}

.file-protocol-notice {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px 40px;
}

.file-protocol-notice-inner {
  width: 100%;
  max-width: 560px;
  padding: 22px 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.file-protocol-notice-title {
  margin: 0 0 12px;
  font-size: 1.35rem;
}

.file-protocol-notice-lead {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.file-protocol-notice-steps {
  margin: 0 0 16px;
  padding-left: 1.25rem;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.55;
}

.file-protocol-notice-steps li {
  margin-bottom: 8px;
}

.file-protocol-notice-foot {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(56, 189, 248, 0.45);
}

a:hover {
  color: var(--link-hover);
  text-decoration-color: rgba(125, 211, 252, 0.65);
}

a:visited {
  color: var(--link-visited);
  text-decoration-color: rgba(167, 139, 250, 0.5);
}

a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 2px;
}

#appShell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  --topbar-pad-inline-start: 14px;
  --topbar-pad-inline-end: 14px;
  padding: 10px var(--topbar-pad-inline-end) 10px var(--topbar-pad-inline-start);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(6px);
  z-index: 10;
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 1.15rem;
}

.topbarRow {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.topbarCell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.topbarCell--moves {
  gap: 4px;
}

.topbarCell--spacer {
  display: none;
}

.topbarRow--primary .topbarCell--title {
  flex: 0 0 auto;
  gap: 10px;
}

.data-mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fde68a;
  background: rgba(180, 83, 9, 0.35);
  border: 1px solid rgba(251, 191, 36, 0.45);
}

.data-mode-badge.hidden {
  display: none;
}

.data-mode-badge.read-only-badge {
  color: #e0e7ff;
  background: rgba(67, 56, 202, 0.4);
  border-color: rgba(165, 180, 252, 0.5);
  text-transform: none;
  letter-spacing: 0;
}

body.account-read-only #fetchNowBtn,
body.account-read-only #deleteDatasetBtn,
body.account-read-only #newConfigBtn,
body.account-read-only a[href="./setup.html"] {
  display: none;
}
.topbarRow--primary .topbarCell--dataset {
  flex: 1 1 180px;
}
.topbarRow--primary .topbarCell--mode {
  flex: 0 0 auto;
}
.topbarRow--primary .topbarCell--speed {
  flex: 0 0 auto;
  margin-left: auto;
}

.topbarRow--secondary .topbarCell--config {
  flex: 0 1 auto;
  gap: 6px;
}

.config-topbar-details {
  min-width: 0;
}

.config-topbar-details > .config-topbar-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 2px 2px 2px 0;
}

.config-topbar-details > .config-topbar-summary::-webkit-details-marker {
  display: none;
}

.config-topbar-details > .config-topbar-summary::after {
  content: " «";
  font-size: 1.2rem;
  line-height: 1;
}

.config-topbar-details[open] > .config-topbar-summary::after {
  content: " »";
}

.config-topbar-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.config-empty-hint {
  display: none;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.config-topbar-details.is-empty {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.config-topbar-details.is-empty .config-topbar-inline-label,
.config-topbar-details.is-empty #configSelectTopbar {
  display: none;
}

.config-topbar-details.is-empty .config-empty-hint {
  display: inline;
}

.config-topbar-details:not(.is-empty) {
  display: flex;
  align-items: center;
}

.config-topbar-details:not(.is-empty) > .config-topbar-summary {
  display: none;
}
.topbarRow--secondary .topbarCell--settings {
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 12px;
}
.topbarRow--secondary .topbarCell--loaded {
  flex: 1 1 auto;
  min-width: 0;
}
.topbarRow--secondary .topbarCell--pvalues {
  flex: 0 1 auto;
}
.topbarRow--secondary .topbarCell--moves {
  flex: 0 0 auto;
  margin-left: auto;
}
.topbarRow--secondary .topbarCell--commitment {
  flex: 0 1 auto;
}

.topbarCell.topbarCell--inert {
  visibility: hidden;
  pointer-events: none;
}

/* Monte Carlo / Story analysis: scrubber is unused */
body[data-render-mode="monte-carlo"] .topbarRow--scrubber,
body[data-render-mode="story-analysis"] .topbarRow--scrubber,
body[data-render-mode="flow-charts"] .topbarRow--scrubber {
  display: none;
}

body[data-render-mode="flow-charts"] #legendBorderExplanation,
body[data-render-mode="flow-charts"] .hint--board-motion {
  display: none;
}

.topbarRow--scrubber .topbarCell--scrubber {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  row-gap: 4px;
  column-gap: 8px;
  align-items: center;
  width: 100%;
  min-width: 0;
  white-space: normal;
}

.topbarRow--scrubber .topbarCell--scrubber > #timelineScopeHint {
  grid-column: 1 / -1;
  grid-row: 2;
}

.timeline-scope-hint {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--muted);
  max-width: 100%;
}

.topbarCell--scrubber .smallLabel {
  flex-shrink: 0;
}

.topbarCell--loaded .statusText {
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.datasetLoadProgress {
  --progress: 0;
  display: inline-block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: conic-gradient(
    from -90deg,
    var(--accent) calc(var(--progress) * 1%),
    rgba(148, 163, 184, 0.2) 0
  );
  box-shadow: inset 0 0 0 1px var(--line);
}

.datasetLoadProgress.is-indeterminate {
  --progress: 28;
  animation: datasetLoadSpin 0.8s linear infinite;
}

@keyframes datasetLoadSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .datasetLoadProgress.is-indeterminate {
    animation: none;
  }
}

.datasetLoadDuration {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.85rem;
}

.scopeSummary {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scopeModalLead code {
  font-size: 0.9em;
}

.scope-modal-header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.scope-modal-header-actions .primary {
  min-width: 4.5rem;
}

.scope-custom-values-row {
  margin: 8px 0;
}

.scope-chip-group {
  margin-top: 6px;
}

.scope-chip-group--dataset-cf {
  max-height: 240px;
  overflow: auto;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.35);
}

.scope-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.scope-chip {
  max-width: 100%;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
  font-size: 0.85rem;
  line-height: 1.2;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-chip:hover {
  border-color: var(--muted);
}

.scope-chip--selected {
  border-color: #60a5fa;
  background: rgba(37, 99, 235, 0.25);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.35);
}

.scope-chip-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.scope-jira-search-hint {
  margin-top: 4px;
}

.scope-dataset-cf-subtitle {
  margin-top: 12px;
}

.scope-jira-field-truncated-hint {
  margin: 0 0 6px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.scope-jira-field-results {
  margin-top: 6px;
  max-height: 200px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(15, 23, 42, 0.45);
}

.scope-jira-field-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scope-jira-field-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.scope-jira-field-option:hover {
  background: rgba(96, 165, 250, 0.12);
}

.scope-jira-field-option-name {
  font-weight: 600;
  font-size: 0.88rem;
}

.scope-jira-field-option-id {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

.scope-jira-field-error {
  margin: 0;
  font-size: 0.85rem;
  color: #fca5a5;
}

.smallLabel {
  color: var(--muted);
  font-size: 0.85rem;
}

.checkboxLabel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

button,
select {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
}

#reloadDatasetBtn,
#refreshDatasetListBtn,
#deleteDatasetBtn,
#playPauseBtn,
#prevDayBtn,
#nextDayBtn,
#firstLastDayBtn {
  padding-left: 8px;
  padding-right: 8px;
}

#playPauseBtn {
  background: #1f3a2c;
  border-color: #2f5f45;
  min-width: 74px;
  text-align: center;
}

#playPauseBtn.is-playing {
  background: #2f6a4a;
  border-color: #4ea173;
  box-shadow: 0 0 0 1px rgba(78, 161, 115, 0.25);
}

#prevDayBtn,
#nextDayBtn,
#firstLastDayBtn {
  background: #1b3227;
  border-color: #2b5640;
}

#firstLastDayBtn {
  min-width: 58px;
  text-align: center;
}

#playPauseBtn:hover,
#speedSelect:hover {
  background: #264836;
  border-color: #3b7656;
}

#playPauseBtn.is-playing:hover {
  background: #377b56;
  border-color: #5fbd89;
}

#prevDayBtn:hover,
#nextDayBtn:hover,
#firstLastDayBtn:hover {
  background: #234131;
  border-color: #376b4f;
}

#speedSelect {
  background: #1f3a2c;
  border-color: #2f5f45;
}

#reloadDatasetBtn,
#refreshDatasetListBtn {
  background: #1d324b;
  border-color: #2e527d;
}

#reloadDatasetBtn:hover,
#refreshDatasetListBtn:hover {
  background: #254062;
  border-color: #3d699c;
}

.iconBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding-left: 6px;
  padding-right: 6px;
  line-height: 0;
}

.iconBtn svg {
  display: block;
}

#refreshDatasetListBtn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

#refreshDatasetListBtn svg {
  display: block;
  flex-shrink: 0;
}

#viewMovesBtn {
  background: #4a2f1a;
  border-color: #7a4b27;
}

#viewMovesBtn:hover {
  background: #5a3a20;
  border-color: #9a6031;
}

#settingsBtn {
  background: #2f1e52;
  border-color: #5c3a8f;
}

#settingsBtn:hover {
  background: #3a2566;
  border-color: #7149aa;
}

#fetchNowBtn {
  background: #1d324b;
  border-color: #2e527d;
}

#fetchNowBtn:hover {
  background: #254062;
  border-color: #3d699c;
}

#dateLabel {
  grid-column: 3;
  justify-self: end;
  text-align: right;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

#datasetSelect {
  min-width: 160px;
  max-width: 350px;
  width: 100%;
  text-overflow: ellipsis;
}

#configSelectTopbar {
  min-width: 72px;
  max-width: 90px;
  width: 90px;
  text-overflow: ellipsis;
}

.setup-config-banner #configSelect {
  min-width: 96px;
  max-width: 160px;
  width: 160px;
  text-overflow: ellipsis;
}

#newConfigBtn {
  padding-left: 8px;
  padding-right: 8px;
}

.statusText {
  color: var(--muted);
  font-size: 0.85rem;
}

.statusText.error {
  color: #fca5a5;
}

#movesCountLabel {
  min-width: 2ch;
  text-align: left;
}

.flow-first-column-mismatch-banner {
  flex-shrink: 0;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(120, 53, 15, 0.35);
  color: #fde68a;
  font-size: 0.84rem;
  line-height: 1.45;
}

.flow-first-column-mismatch-banner.hidden {
  display: none;
}

.flow-first-column-mismatch-banner__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  max-width: 100%;
}

.flow-first-column-mismatch-banner__text {
  flex: 1 1 auto;
  min-width: 0;
}

.flow-first-column-mismatch-banner__dismiss {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  background: rgba(15, 23, 42, 0.55);
  color: #fde68a;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.flow-first-column-mismatch-banner__dismiss:hover {
  background: rgba(15, 23, 42, 0.75);
}

.layout {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 3px 10px;
  overflow: hidden;
}

.layout > .board {
  flex: 1;
  min-height: 0;
}

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 7px;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
}

.board:has(.cfd-board),
.board:has(.monte-carlo-board),
.board:has(.flow-rates-board),
.board:has(.flow-charts-board),
.board:has(.story-analysis-board) {
  grid-auto-columns: minmax(0, 1fr);
  overflow: hidden;
}

.cfd-board,
.monte-carlo-board,
.flow-rates-board,
.flow-charts-board,
.story-analysis-board {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  min-width: 0;
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px 10px;
  gap: 12px;
  overflow: auto;
}

.story-analysis-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.story-analysis-title {
  margin: 0;
  align-self: flex-start;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.story-analysis-subtitle {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted, #6b7280);
  line-height: 1.4;
}

.story-analysis-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.story-analysis-settings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.story-analysis-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
}

.story-analysis-meta-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.08);
  font: inherit;
  color: inherit;
  cursor: pointer;
  font-size: 0.76rem;
  line-height: 1.3;
  max-width: 100%;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.story-analysis-meta-chip:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

.story-analysis-meta-chip:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.55);
  outline-offset: 2px;
}

.story-analysis-meta-chip--active {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.45);
}

.story-analysis-meta-label {
  color: var(--muted, #6b7280);
  white-space: nowrap;
}

.story-analysis-meta-value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.story-analysis-meta-msg {
  font-size: 0.76rem;
  color: var(--muted, #6b7280);
}

.story-analysis-meta-msg--warn {
  color: #b45309;
}

.story-analysis-meta-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted, #6b7280);
}

.story-analysis-token-proxy-link {
  grid-column: 1 / -1;
  justify-self: start;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  color: var(--muted, #6b7280);
  text-decoration: underline;
  cursor: pointer;
}

.story-analysis-token-proxy-link:hover {
  color: var(--text);
}

.story-analysis-token-update {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr) auto;
  gap: 8px 8px;
  align-items: center;
  max-width: 560px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.04);
}

.story-analysis-token-context {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted, #6b7280);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.story-analysis-token-update .story-analysis-form-label {
  font-size: 0.82rem;
}

.story-analysis-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.05);
}

.story-analysis-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: flex-end;
}

.story-analysis-dist-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.story-analysis-dist-label {
  font-size: 0.76rem;
  color: var(--muted, #6b7280);
  min-width: 4.5rem;
}

.story-analysis-band-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.story-analysis-setup {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.06);
}

/* display:flex above wins over the [hidden] attribute otherwise — panel never hides */
.story-analysis-setup[hidden],
.story-analysis-token-update[hidden],
.story-analysis-main[hidden] {
  display: none !important;
}

.story-analysis-setup-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.story-analysis-setup-help {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted, #6b7280);
  line-height: 1.45;
}

.story-analysis-setup-form,
.story-analysis-token-update {
  --story-form-toggle-gap: 8px;
}

.story-analysis-setup-form {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr) auto;
  gap: 8px var(--story-form-toggle-gap);
  align-items: center;
  max-width: 560px;
}

.story-analysis-form-label {
  grid-column: 1;
  font-size: 0.82rem;
  color: var(--text);
}

.story-analysis-form-input {
  grid-column: 2;
  width: 100%;
  min-width: 0;
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  box-sizing: border-box;
}

.story-analysis-form-span {
  grid-column: 1 / -1;
}

.story-analysis-secret-toggle {
  grid-column: 3;
  align-self: center;
  justify-self: start;
  margin: 0;
  font: inherit;
  font-size: 0.76rem;
  line-height: 1.2;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  white-space: nowrap;
}

.story-analysis-secret-toggle:hover {
  background: rgba(148, 163, 184, 0.12);
}

.story-analysis-setup-msg {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.8rem;
  color: var(--text);
}

.story-analysis-setup-msg--error {
  color: #b91c1c;
}

.story-analysis-setup-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.story-analysis-setup-save,
.story-analysis-setup-cancel {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
}

.story-analysis-setup-save:disabled {
  opacity: 0.6;
  cursor: default;
}

.story-analysis-notice {
  margin: 0;
  padding: 6px 8px;
  font-size: 0.8rem;
  border-radius: 6px;
  background: rgba(234, 179, 8, 0.14);
  border: 1px solid rgba(234, 179, 8, 0.4);
  color: var(--text);
}

.story-analysis-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 5.5rem;
  font-size: 0.82rem;
  color: var(--text);
}

.story-analysis-stat-label {
  font-size: 0.72rem;
  color: var(--muted, #6b7280);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.story-analysis-stat-value {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.story-analysis-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.story-analysis-analyze-all,
.story-analyze-btn,
.story-summary-toggle {
  font: inherit;
  cursor: pointer;
}

.story-analysis-analyze-all,
.story-analyze-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.story-analysis-analyze-all:disabled,
.story-analyze-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.story-analysis-table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.story-analysis-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted, #6b7280);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--panel);
}

.story-cell {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.story-cell--score,
.story-cell--conf,
.story-cell--band {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Cap Summary width so the table groups Key/Type/Summary/metrics together on the left
   instead of stretching the metric columns to the far edge. Long summaries wrap. */
.story-cell--summary {
  max-width: 520px;
}

/* Right-align the Band / Score / Confidence headers to sit over their right-aligned values. */
.story-analysis-table th:nth-child(4),
.story-analysis-table th:nth-child(5),
.story-analysis-table th:nth-child(6) {
  text-align: right;
}

.story-summary-toggle {
  border: none;
  background: none;
  padding: 0;
  color: var(--text);
  text-align: left;
  display: inline-block;
  max-width: 520px;
  white-space: normal;
}

.story-summary-toggle:hover {
  text-decoration: underline;
}

.story-band {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.75rem;
  border: 1px solid transparent;
}

.story-band--s {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.5);
}

.story-band--m {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.5);
}

.story-band--l {
  background: rgba(234, 179, 8, 0.18);
  border-color: rgba(234, 179, 8, 0.5);
}

.story-band--xl {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.5);
}

.story-cell--action {
  white-space: nowrap;
  text-align: left;
}

.story-status {
  display: inline-block;
  vertical-align: middle;
  max-width: 240px;
  margin-left: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  color: var(--muted, #6b7280);
}

.story-status--error {
  color: #dc2626;
}

.story-detail-cell {
  padding: 0 8px 8px 8px;
  border-bottom: 1px solid var(--line);
}

.story-detail {
  font-size: 0.8rem;
  color: var(--muted, #6b7280);
  background: rgba(127, 127, 127, 0.08);
  border-radius: 6px;
  padding: 6px 8px;
}

.cfd-board {
  --cfd-chart-max-height: min(62vh, 680px);
}

.flow-rates-board {
  --flow-rates-chart-max-height: min(62vh, 680px);
}

.cfd-chart-title,
.monte-carlo-title,
.flow-rates-title,
.flow-charts-title {
  margin: 0;
  align-self: flex-start;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.cfd-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
}

.cfd-control-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 0.8rem;
  white-space: nowrap;
}

.cfd-controls-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
  flex: 1 1 100%;
  max-width: 100%;
  white-space: normal;
}

.cfd-date-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  flex: 1 1 100%;
  align-items: end;
}

.cfd-date-control {
  min-width: 168px;
  max-width: 240px;
  flex: 1 1 168px;
}

.flow-charts-intro,
.flow-charts-range,
.flow-charts-stage-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.flow-charts-range {
  color: var(--text);
  font-size: 0.85rem;
}

.flow-charts-date-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: end;
}

.flow-charts-date-control {
  min-width: 180px;
  max-width: 260px;
  flex: 1 1 180px;
}

.flow-charts-reset:disabled {
  opacity: 0.45;
  cursor: default;
}

.flow-charts-board {
  overflow-x: hidden;
}

.flow-charts-stage {
  flex: 0 0 auto;
  min-height: 220px;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  overflow: visible;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.35);
}

.flow-charts-hist-note,
.flow-charts-hist-summary,
.flow-charts-hist-axis-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.flow-charts-hist-summary {
  color: var(--text);
}

.flow-charts-hist-frame {
  display: grid;
  grid-template-columns: 1.15rem auto minmax(0, 1fr);
  grid-template-rows: minmax(180px, min(42vh, 420px)) 22px auto;
  column-gap: 6px;
  row-gap: 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.flow-charts-hist-y-title {
  grid-column: 1;
  grid-row: 1;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.flow-charts-hist-y {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  width: 2.5rem;
  min-width: 0;
}

.flow-charts-hist-ytick {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.flow-charts-hist-ytick.is-max {
  top: 0;
}

.flow-charts-hist-ytick.is-zero {
  bottom: 0;
}

.flow-charts-hist-ytick.is-mid {
  transform: translateY(-50%);
}

.flow-charts-hist-ytick-mark {
  width: 6px;
  height: 1px;
  background: rgba(203, 213, 225, 0.78);
  flex: 0 0 auto;
}

.flow-charts-hist-plot-wrap {
  grid-column: 3;
  grid-row: 1;
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  border-left: 1.5px solid rgba(203, 213, 225, 0.78);
  border-bottom: 1.5px solid rgba(203, 213, 225, 0.78);
}

.flow-charts-hist-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.flow-charts-hist-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.flow-charts-hist-plot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.flow-charts-hist-col {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
}

.flow-charts-hist-col:hover .flow-charts-hist-bar {
  background: var(--link-hover);
}

.flow-charts-hist-bar {
  width: 100%;
  min-height: 1px;
  background: var(--link);
  border-radius: 2px 2px 0 0;
}

.flow-charts-hist-plot--dense .flow-charts-hist-bar {
  border-radius: 0;
}

.flow-charts-hist-x {
  grid-column: 3;
  grid-row: 2;
  position: relative;
  min-width: 0;
  height: 22px;
  overflow: hidden;
}

.flow-charts-hist-xtick-mark {
  position: absolute;
  top: 0;
  width: 1px;
  height: 6px;
  background: rgba(203, 213, 225, 0.78);
  transform: translateX(-50%);
}

.flow-charts-hist-xlabel {
  position: absolute;
  top: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.flow-charts-hist-axis-caption {
  grid-column: 3;
  grid-row: 3;
  text-align: center;
  margin-top: 2px;
}

.flow-charts-tail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.28);
}

.flow-charts-tail-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.flow-charts-tail-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.flow-charts-fraction {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 7.5rem;
  text-align: center;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.25;
}

.flow-charts-fraction-num,
.flow-charts-fraction-den {
  padding: 2px 10px;
}

.flow-charts-fraction-bar {
  align-self: stretch;
  border-top: 1.5px solid currentColor;
  margin: 3px 0;
}

.flow-charts-tail-eq {
  color: var(--text);
  font-size: 1.45rem;
  line-height: 1;
}

.flow-charts-tail-result {
  color: var(--text);
  font-size: 1.85rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding: 0 4px;
}

.flow-charts-tail-verdict {
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
}

.flow-charts-tail-verdict--thin {
  color: #86efac;
}

.flow-charts-tail-verdict--fat {
  color: #fca5a5;
}

.flow-charts-tail-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.flow-charts-stage-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.flow-charts-stage-empty {
  max-width: 42rem;
}

.monte-carlo-guidance {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.45);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.monte-carlo-guidance p {
  margin: 0 0 6px;
}

.monte-carlo-guidance ul {
  margin: 0;
  padding-left: 1.15rem;
}

.monte-carlo-guidance li {
  margin-bottom: 4px;
}

.monte-carlo-guidance li:last-child {
  margin-bottom: 0;
}

.flow-rates-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.flow-rates-chart-wrap {
  position: relative;
  flex: 1 1 0;
  min-height: 200px;
  min-width: 0;
  max-height: var(--flow-rates-chart-max-height, min(52vh, 680px));
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-rates-chart-stack {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--flow-rates-vb-w, 1000) / var(--flow-rates-vb-h, 460);
}

.flow-rates-chart-stack > .flow-rates-chart {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.flow-rates-scrub-readout-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.flow-rates-scrub-readout {
  position: absolute;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--text);
  font-size: 0.75rem;
  white-space: nowrap;
}

.flow-rates-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: auto;
}

.flow-rates-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--muted);
}

.flow-rates-legend-swatch {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.flow-rates-legend-swatch--arrival-bar {
  background: rgba(56, 189, 248, 0.75);
}

.flow-rates-legend-swatch--departure-bar {
  background: rgba(74, 222, 128, 0.75);
}

.flow-rates-legend-swatch--ma-5 {
  background: transparent;
  border: 2px solid #22d3ee;
  height: 0;
  width: 18px;
}

.flow-rates-legend-swatch--ma-8 {
  background: transparent;
  border: 2px solid #fbbf24;
  height: 0;
  width: 18px;
}

.flow-rates-legend-swatch--ma-15 {
  background: transparent;
  border: 2px solid #c084fc;
  height: 0;
  width: 18px;
}

.flow-rates-playhead {
  stroke: var(--text);
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
  opacity: 0.55;
  pointer-events: none;
}

.flow-rates-sprint-boundary {
  stroke: #ddd6fe;
  stroke-width: 1.75px;
  stroke-dasharray: 6px 4px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  filter: drop-shadow(0 0 1.5px rgba(15, 23, 42, 0.85));
}

.flow-rates-bar--arrival {
  fill: rgba(56, 189, 248, 0.72);
}

.flow-rates-bar--departure {
  fill: rgba(74, 222, 128, 0.72);
}

.flow-rates-bar--net-pos {
  fill: rgba(251, 191, 36, 0.82);
}

.flow-rates-bar--net-neg {
  fill: rgba(248, 113, 113, 0.78);
}

.flow-rates-zero-line {
  stroke: rgba(226, 232, 240, 0.75);
  stroke-width: 1.5px;
  stroke-dasharray: 4px 3px;
  vector-effect: non-scaling-stroke;
}

.flow-rates-panel-title--net {
  fill: #fde68a;
}

.flow-rates-legend-swatch--net-pos {
  background: rgba(251, 191, 36, 0.82);
}

.flow-rates-legend-swatch--net-neg {
  background: rgba(248, 113, 113, 0.78);
}

.flow-rates-ma-line--ma-5 {
  stroke: #22d3ee;
  stroke-width: 2.5px;
  vector-effect: non-scaling-stroke;
}

.flow-rates-ma-line--ma-8 {
  stroke: #fbbf24;
  stroke-width: 2.5px;
  vector-effect: non-scaling-stroke;
}

.flow-rates-ma-line--ma-15 {
  stroke: #c084fc;
  stroke-width: 2.5px;
  vector-effect: non-scaling-stroke;
}

.flow-rates-grid {
  stroke: rgba(148, 163, 184, 0.18);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}

.flow-rates-baseline {
  stroke: rgba(203, 213, 225, 0.55);
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
}

.flow-rates-panel-title,
.flow-rates-y-label,
.flow-rates-week-label {
  fill: var(--muted);
  font-size: 11px;
  font-family: system-ui, sans-serif;
}

.flow-rates-panel-title {
  fill: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.flow-rates-empty {
  fill: var(--muted);
  font-size: 14px;
  font-family: system-ui, sans-serif;
}

.monte-carlo-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

.monte-carlo-controls--panel {
  margin-bottom: 10px;
}

.monte-carlo-control {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.monte-carlo-control input,
.monte-carlo-control select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111827;
  color: var(--text);
  padding: 7px 8px;
}

.monte-carlo-control--check {
  display: flex;
  flex-direction: row;
  align-items: center;
  align-self: end;
  gap: 8px;
  min-height: 38px;
}

.monte-carlo-control--check input {
  width: auto;
  min-width: 0;
  margin: 0;
}

.monte-carlo-control--date .monte-carlo-date-field {
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.monte-carlo-control--date label {
  color: var(--muted);
  font-size: 0.78rem;
}

.monte-carlo-date-field input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  cursor: pointer;
}

.monte-carlo-date-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  flex: 0 0 36px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: #1e293b;
  color: var(--text);
  cursor: pointer;
  padding: 0;
}

.monte-carlo-date-toggle:hover {
  background: #334155;
}

.monte-carlo-date-toggle svg {
  width: 14px;
  height: 14px;
  display: block;
}

.monte-carlo-mini-cal {
  position: fixed;
  z-index: 80;
  width: 248px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  background: #0f172a;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  color: var(--text);
}

.monte-carlo-mini-cal-head {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.monte-carlo-mini-cal-head strong {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
}

.monte-carlo-mini-cal-nav {
  width: 32px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #1e293b;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.monte-carlo-mini-cal-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.monte-carlo-mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}

.monte-carlo-mini-cal-weekday {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  padding: 2px 0 4px;
  text-transform: uppercase;
}

.monte-carlo-mini-cal-day {
  min-height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
}

.monte-carlo-mini-cal-day:not(.is-blank):not(.is-disabled):hover {
  background: rgba(148, 163, 184, 0.22);
}

.monte-carlo-mini-cal-day.is-blank {
  cursor: default;
}

.monte-carlo-mini-cal-day.is-disabled {
  color: rgba(148, 163, 184, 0.35);
  cursor: default;
}

.monte-carlo-mini-cal-day.is-selected {
  background: #2563eb;
  color: #eff6ff;
}

.monte-carlo-mini-cal-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.35;
}

.monte-carlo-histogram {
  margin-top: 12px;
}

.monte-carlo-histogram-title {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.monte-carlo-histogram-plot {
  position: relative;
  height: 96px;
}

.monte-carlo-histogram-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 100%;
}

.monte-carlo-histogram-bar {
  flex: 1 1 0;
  min-width: 2px;
  background: rgba(148, 163, 184, 0.5);
  border-radius: 2px 2px 0 0;
}

.monte-carlo-histogram-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.monte-carlo-histogram-mark {
  position: absolute;
  top: 0;
  height: 100%;
  transform: translateX(-50%);
  border-left: 1px solid currentColor;
  padding-left: 4px;
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.monte-carlo-histogram-mark--p50 {
  color: #f59e0b;
}

.monte-carlo-histogram-mark--p70 {
  top: 16px;
  color: #fde047;
}

.monte-carlo-histogram-mark--p85 {
  top: 32px;
  color: #86efac;
}

.monte-carlo-histogram-mark--p95 {
  top: 48px;
  color: #4ade80;
}

.monte-carlo-histogram-axis {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.68rem;
}

.monte-carlo-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.monte-carlo-card {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  padding: 10px;
}

.monte-carlo-context,
.monte-carlo-calendar-card {
  grid-column: 1 / -1;
}

.monte-carlo-calendar-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin: 0 0 6px;
}

.monte-carlo-calendar-card .monte-carlo-calendar-head h4 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
}

.monte-carlo-calendar-card .monte-carlo-calendar-head .monte-carlo-note {
  margin: 0 !important;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
  flex: 1 1 12rem;
  min-width: 0;
}

.monte-carlo-card h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--text);
}

.monte-carlo-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.monte-carlo-warning-summary {
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 8px;
  background: rgba(120, 53, 15, 0.22);
  padding: 8px 10px;
}

.monte-carlo-warning-summary.hidden {
  display: none;
}

.monte-carlo-warning-summary .monte-carlo-warning:last-child {
  margin-bottom: 0 !important;
}

.monte-carlo-warning {
  margin-top: 6px !important;
  color: #fbbf24 !important;
}

.monte-carlo-warning--red {
  color: #fca5a5 !important;
}

.monte-carlo-warning--amber {
  color: #fbbf24 !important;
}

.monte-carlo-percentile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.monte-carlo-percentile {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 7px;
  background: rgba(30, 41, 59, 0.76);
  padding: 8px;
  min-width: 0;
}

.monte-carlo-percentile-key {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.monte-carlo-percentile strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.2;
}

.monte-carlo-calendar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.monte-carlo-month {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.5);
  padding: 8px;
}

.monte-carlo-month h5 {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 0.82rem;
}

.monte-carlo-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.monte-carlo-weekday {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.monte-carlo-day {
  min-height: 38px;
  border-radius: 6px;
  padding: 4px;
  color: #0f172a;
  font-weight: 700;
  font-size: 0.72rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.monte-carlo-day span {
  font-size: 0.62rem;
  font-weight: 800;
}

.monte-carlo-day--blank {
  background: transparent;
  border: 1px dashed rgba(148, 163, 184, 0.12);
}

.monte-carlo-day--early {
  background: #9a3412;
  color: #ffedd5;
}

.monte-carlo-day--p50 {
  background: #f59e0b;
}

.monte-carlo-day--p70 {
  background: #fde047;
}

.monte-carlo-day--p85 {
  background: #86efac;
}

.monte-carlo-day--tail {
  background: #15803d;
  color: #dcfce7;
}

.monte-carlo-day--weekend {
  background: rgba(148, 163, 184, 0.16);
  color: var(--muted);
  font-weight: 600;
}

.cfd-chart-wrap {
  position: relative;
  flex: 1 1 0;
  min-height: 200px;
  min-width: 0;
  max-height: var(--cfd-chart-max-height, min(52vh, 680px));
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Aspect from `CFD_VB`: `--cfd-vb-w` / `--cfd-vb-h` set on `.cfd-chart-wrap` in buildCfdBoard(). */
.cfd-chart-stack {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--cfd-vb-w, 200) / var(--cfd-vb-h, 60);
}

@supports (container-type: size) {
  .cfd-chart-wrap {
    container-type: size;
  }

  .cfd-chart-stack {
    width: min(100cqw, calc(100cqh * var(--cfd-vb-w, 200) / var(--cfd-vb-h, 60)));
    max-height: none;
  }
}

.cfd-chart-stack > .cfd-chart {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.cfd-board .cfd-legend {
  margin-top: auto;
}

.cfd-playhead {
  stroke: var(--text);
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
  opacity: 0.55;
  pointer-events: none;
}

.cfd-throughput-line {
  fill: none;
  stroke: #fbbf24;
  stroke-width: 3px;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  opacity: 1;
  paint-order: stroke;
}

.cfd-axis-layer {
  pointer-events: none;
}

.cfd-axis-spine {
  stroke: rgba(203, 213, 225, 0.78);
  stroke-width: 2.5px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.cfd-axis-tick {
  stroke: rgba(203, 213, 225, 0.65);
  stroke-width: 2px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.cfd-axis-label {
  font-size: 3.1px;
  font-weight: 600;
  font-family: ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.02em;
}

.cfd-axis-label--wip {
  fill: rgba(203, 213, 225, 0.92);
}

.cfd-axis-label--throughput {
  fill: #fcd34d;
}

.cfd-throughput-scrub-marker {
  fill: #fbbf24;
  stroke: rgba(15, 23, 42, 0.88);
  stroke-width: 0.22px;
  vector-effect: non-scaling-stroke;
}

.cfd-scrub-throughput-readout {
  position: absolute;
  transform-origin: 0 0;
  color: #fbbf24;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.85);
  white-space: nowrap;
  z-index: 4;
  pointer-events: none;
}

.cfd-scrub-total-wip-readout {
  position: absolute;
  transform-origin: 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  color: rgba(226, 232, 240, 0.98);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.1;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.85);
  white-space: nowrap;
  z-index: 5;
  pointer-events: none;
}

.cfd-scrub-total-wip-readout__line--ct {
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.92;
}

.cfd-sprint-boundary {
  stroke: #ddd6fe;
  stroke-width: 1.75px;
  stroke-dasharray: 6px 4px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  filter: drop-shadow(0 0 1.5px rgba(15, 23, 42, 0.85));
}

.cfd-scrub-bracket {
  stroke: rgba(226, 232, 240, 0.92);
  stroke-width: 0.35px;
  vector-effect: non-scaling-stroke;
}

.cfd-scrub-label-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cfd-scrub-bracket-label {
  position: absolute;
  transform: translate(-100%, -50%);
  color: rgba(226, 232, 240, 0.95);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(15, 23, 42, 0.65);
  white-space: nowrap;
  z-index: 2;
  pointer-events: none;
}

.cfd-scrub-connector {
  position: absolute;
  height: 1px;
  background: rgba(226, 232, 240, 0.55);
  transform-origin: 0 50%;
  z-index: 1;
  pointer-events: none;
}

.cfd-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.78rem;
  color: var(--muted);
  align-items: center;
}

.cfd-legend-throughput-swatch {
  width: 22px;
  height: 0;
  flex: 0 0 auto;
  border-top: 3px solid #fbbf24;
  opacity: 1;
  margin-right: 7px;
}

.cfd-legend-item--throughput .cfd-legend-throughput-swatch {
  align-self: center;
}

.cfd-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cfd-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
  border: 1px solid rgba(15, 23, 42, 0.45);
}

.column {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-width: var(--col-middle-width, 140px);
}

.columnBody {
  --column-heat-alpha: 0;
}

.columnBody.columnBody--heat {
  background:
    linear-gradient(
      180deg,
      rgba(239, 68, 68, calc(var(--column-heat-alpha) * 1.2)) 0%,
      rgba(239, 68, 68, calc(var(--column-heat-alpha) * 1.0)) 100%
    ),
    transparent;
}

.column--edge {
  min-width: var(--col-edge-width, 240px);
}

body[data-render-mode="threshold"] .column--last {
  min-width: calc(var(--col-edge-width, 240px) - 20px);
}

.column--middle {
  min-width: var(--col-middle-width, 140px);
}

.columnHeader {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.columnHeader-title {
  margin-top: -2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.columnHeader-titleBlock {
  min-width: 0;
}

.columnHeader-meta {
  margin-top: 1px;
  font-size: 0.68rem;
  line-height: 1.05;
  color: #94a3b8;
}

.columnHeader-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.columnHeader-thresholds {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex: 0 0 auto;
}

.threshold-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid transparent;
  color: #e2e8f0;
  white-space: nowrap;
}

.threshold-chip--p50 {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.78);
}

.threshold-chip--p75 {
  background: rgba(168, 85, 247, 0.22);
  border-color: rgba(168, 85, 247, 0.78);
}

.threshold-chip--p85 {
  background: rgba(239, 68, 68, 0.24);
  border-color: rgba(239, 68, 68, 0.82);
}

.columnBody {
  position: relative;
  flex: 1;
  min-height: 300px;
}

.columnSparkline {
  flex: 0 0 auto;
  padding: 4px 6px 6px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.columnSparklineSvg {
  display: block;
  width: 100%;
  height: 26px;
}

.columnSparklineSvg .columnSparkline-path {
  stroke: currentColor;
  stroke-width: 1.25;
  fill: none;
  vector-effect: non-scaling-stroke;
  opacity: 0.85;
}

.columnSparklineSvg .columnSparkline-playhead {
  stroke: var(--text);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: 0.35;
}

.columnSparklineSvg .columnSparkline-sprint-boundary {
  stroke: #c4b5fd;
  stroke-width: 1px;
  stroke-dasharray: 3px 2px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  opacity: 0.85;
  filter: drop-shadow(0 0 1px rgba(15, 23, 42, 0.75));
}

.ticket {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.95;
  transition: top 220ms linear, width 220ms linear, height 220ms linear;
}

.ticket:focus {
  outline: none;
}

.ticket.ticket--keyboard-focus {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 4px;
  z-index: 25;
}

.ticket.missing-created::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  border: 1px solid rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25);
  pointer-events: none;
}

.ticket.ticket--tooltip-hover {
  z-index: 20;
}

.ticket.pre-created {
  opacity: 0.45;
  filter: grayscale(0.45);
}

.ticket.ticket--parking {
  filter: saturate(0.95) drop-shadow(0 0 5px rgba(250, 204, 21, 0.65));
}

.ticket.ticket--excluded-terminal {
  opacity: 0.48;
  filter: grayscale(0.7);
}

.ticket-flag-mark {
  position: absolute;
  top: -5px;
  left: -5px;
  display: grid;
  place-items: center;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(15, 23, 42, 0.95);
  background: rgba(2, 6, 23, 0.96);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.25);
  pointer-events: none;
  z-index: 2;
}

.ticket-flag-mark svg {
  display: block;
  width: 10px;
  height: 10px;
}

.ticket-flag-mark.hidden {
  display: none;
}

.ticket-status-badge {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: grid;
  place-items: center;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.95);
  background: rgba(2, 6, 23, 0.96);
  color: #f8fafc;
  font-size: 0.52rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.ticket-status-badge.hidden {
  display: none;
}

.ticket-status-badge.ticket-status-badge--sprint-add {
  background: rgba(180, 83, 9, 0.95);
  color: #fffbeb;
  font-size: 0.62rem;
}

.sprint-commitment-summary {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.counter-link-sep {
  color: #64748b;
  user-select: none;
}

.counter-link {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  color: #38bdf8;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.counter-link:hover:not(:disabled) {
  color: #7dd3fc;
}

.counter-link:disabled {
  color: inherit;
  cursor: default;
  text-decoration: none;
  opacity: 0.85;
}

.columnHeader-meta--clickable .columnHeader-counter {
  font-size: inherit;
  line-height: inherit;
}

body[data-render-mode="threshold"] .ticket {
  transition: top 220ms linear, left 220ms linear;
}

body[data-render-mode="threshold"] .ticket--threshold-p50 {
  box-shadow:
    0 0 0 2px rgba(15, 23, 42, 0.95),
    0 0 0 4px rgba(245, 158, 11, 0.96),
    0 0 10px rgba(245, 158, 11, 0.42);
  border-radius: 999px;
}

body[data-render-mode="threshold"] .ticket--threshold-p75 {
  box-shadow:
    0 0 0 2px rgba(15, 23, 42, 0.95),
    0 0 0 4px rgba(168, 85, 247, 0.95),
    0 0 12px rgba(168, 85, 247, 0.5);
  border-radius: 999px;
}

body[data-render-mode="threshold"] .ticket--threshold-p85 {
  box-shadow:
    0 0 0 2px rgba(15, 23, 42, 0.95),
    0 0 0 5px rgba(239, 68, 68, 0.98),
    0 0 14px rgba(239, 68, 68, 0.58);
  border-radius: 999px;
}

body[data-render-mode="threshold"] .ticket-threshold-approach-arc {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% + 14px);
  height: calc(100% + 14px);
  pointer-events: none;
  z-index: 24;
  overflow: visible;
}

body[data-render-mode="threshold"] .ticket-threshold-approach-arc--hidden {
  opacity: 0;
}

.ticket > svg:not(.ticket-threshold-approach-arc) {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.ticket-emoji-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 3;
  line-height: 1;
  font-size: clamp(10px, calc(var(--ticket-px, 24px) * 0.48), 26px);
  text-shadow:
    0 0 2px rgba(15, 23, 42, 0.95),
    0 0 5px rgba(15, 23, 42, 0.55);
}

.legend-glyph-tile {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: middle;
}

.legend-glyph-tile .shape {
  position: absolute;
  inset: 0;
  width: 14px;
  height: 14px;
  margin-right: 0;
}

.legend-glyph-emoji {
  position: relative;
  z-index: 1;
  font-size: 9px;
  line-height: 1;
  text-shadow:
    0 0 1px rgba(15, 23, 42, 0.95),
    0 0 3px rgba(15, 23, 42, 0.55);
}

#timelineRange {
  grid-column: 2;
  min-width: 0;
  width: 100%;
  max-width: min(1290px, 85vw);
  justify-self: start;
  height: 24px;
  accent-color: var(--link);
}

#timelineRange.timeline-range--in-sprint {
  accent-color: #22c55e;
}

.legend {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 20px;
  padding: 5px 10px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.legend-entries {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  flex: 0 1 auto;
  max-width: 50%;
  min-width: 0;
}

.legend-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: 1 1 0;
  min-width: 0;
}

#legendBorderExplanation {
  display: block;
  margin: 0;
  max-width: 100%;
  width: 100%;
  text-align: right;
  line-height: 1.45;
}

.legend-stack-inline {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: baseline;
  gap: 0.85em;
  margin: 0;
  max-width: 100%;
  width: 100%;
}

.legend-stack-inline .hint {
  display: block;
  margin: 0;
  flex: 0 0 auto;
}

.legend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #1e293b;
  color: var(--text);
  border: 1px solid #475569;
  border-radius: 999px;
  padding: 4px 8px;
  cursor: pointer;
}

.legend-toggle.off {
  opacity: 0.45;
  border-style: dashed;
}

.shape {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: #22c55e;
  margin-right: 6px;
  vertical-align: middle;
}

.shape.circle {
  border-radius: 50%;
}

.shape.diamond {
  transform: rotate(45deg);
}

.shape.triangle {
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.shape.pentagon {
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

.shape.hexagon {
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.shape.octagon {
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
}

.shape.star {
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
}

.hint {
  margin: 0;
  font-size: 0.78rem;
}

.hintLink {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(56, 189, 248, 0.45);
}

.hintLink:hover {
  color: var(--link-hover);
  text-decoration-color: rgba(125, 211, 252, 0.65);
}

@media (max-width: 980px) {
  .topbar {
    --topbar-pad-inline-end: 10px;
  }

  .legend {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .legend-entries {
    flex: 0 1 auto;
    max-width: 100%;
  }

  .legend-stack {
    flex: 0 1 auto;
    max-width: 100%;
    min-width: 0;
  }
}

.moveTrail {
  position: fixed;
  color: var(--trail-color, #93c5fd);
  background: currentColor;
  height: 3px;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0.34;
  transform-origin: 0 50%;
  z-index: 240;
  filter: blur(0.4px);
}

.moveTrailHead {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translate(-1px, -50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 11px solid currentColor;
}

.ticket-hierarchy-links {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 260;
  overflow: visible;
}

.ticket-hierarchy-links .ticket-hierarchy-link-line {
  stroke: #93c5fd;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.88;
  filter: drop-shadow(0 0 1px rgba(15, 23, 42, 0.75));
}

.ticket-hover-tooltip {
  position: fixed;
  z-index: 320;
  max-width: min(420px, 68vw);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #475569;
  background: rgba(2, 6, 23, 0.96);
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.45);
  pointer-events: none;
}

.ticket-hover-tooltip.hidden {
  display: none;
}

.ticket-hover-tooltip-line {
  margin: 0;
  white-space: pre-wrap;
}

.ticket-hover-tooltip-line + .ticket-hover-tooltip-line {
  margin-top: 2px;
}

.ticket-hover-tooltip-line--heading {
  margin-top: 5px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #cbd5e1;
}

.ticket-hover-tooltip-line--title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f1f5f9;
}

.ticket-hover-tooltip-line--summary {
  font-size: 0.9rem;
  color: #e2e8f0;
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.62);
  display: grid;
  place-items: center;
  z-index: 300;
}

.modal-card {
  width: min(720px, 92vw);
  max-height: 78vh;
  overflow: auto;
  background: #0b1220;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
}

.modal-card--sticky-header {
  padding-top: 0;
}

.modal-card--detail-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-detail-list-head {
  flex-shrink: 0;
}

.modal-card--detail-list .moves-list--root {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.modal-card--detail-list .moves-list--root.moves-list--empty {
  flex: 0 0 auto;
  overflow: visible;
}

.modal-header--sticky {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -12px 10px;
  padding: 12px;
  background: #0b1220;
  border-bottom: 1px solid var(--line);
}

.modal-card--settings {
  padding-top: 0;
}

.modal-card--confirm {
  width: min(440px, 92vw);
  max-height: none;
}

.delete-dataset-path {
  margin: 0 0 4px;
  padding: 8px 10px;
  font-size: 0.86rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.new-config-name-label {
  display: block;
  margin: 10px 0 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

#newConfigNameInput {
  width: 100%;
  box-sizing: border-box;
}

.new-config-copy-fieldset {
  margin: 12px 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
}

.new-config-copy-fieldset legend {
  padding: 0 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

.new-config-copy-fieldset label {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: normal;
}

#fetchModal .modal-card {
  display: flex;
  flex-direction: column;
  height: min(640px, 85vh);
  max-height: 85vh;
  overflow: hidden;
}

#fetchModal .modal-header--settings {
  flex-shrink: 0;
}

#fetchModal .fetch-tabs {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
  margin: 0 0 10px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
}

#fetchModal .fetch-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted, #94a3b8);
  border-radius: 6px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

#fetchModal .fetch-tab:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.1);
}

#fetchModal .fetch-tab.is-active {
  color: var(--text);
  border-color: var(--line);
  background: rgba(148, 163, 184, 0.14);
}

#fetchModal .fetch-tab-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#fetchModal .fetch-tab-panel.hidden {
  display: none;
}

#fetchModal .settings-section {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#fetchModal .settings-section-title,
#fetchModal .settings-section-subtitle,
#fetchModal .fetch-form-row,
#fetchModal .fetch-destination,
#fetchModal #fetchModalStatus,
#fetchModal #issueCacheActionStatus,
#fetchModal #clearIssueCacheBtn {
  flex-shrink: 0;
}

#fetchModal #clearIssueCacheBtn {
  align-self: flex-start;
  margin-top: 4px;
}

#fetchModal #issueCacheActionStatus {
  margin-top: 10px;
}

.fetch-reexport-row.hidden,
.fetch-force-refetch-done-row.hidden,
.fetch-enrich-refetch-row.hidden,
.fetch-enrich-include-open-row.hidden,
.fetch-print-jql-row.hidden {
  display: none;
}

.modal-header--settings {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -12px 10px;
  padding: 12px;
  background: #0b1220;
  border-bottom: 1px solid var(--line);
}

.settings-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.modal-close {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  line-height: 1;
  cursor: pointer;
}

.modal-subtitle {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.moves-modal-type-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
  padding: 8px 10px;
  font-size: 0.82rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.moves-modal-type-summary[hidden],
.moves-modal-type-summary:not(:has(.moves-modal-type-summary-item)) {
  display: none;
}

.moves-modal-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
}

.moves-modal-type-summary-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #94a3b8);
}

.moves-modal-type-summary-items {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.moves-modal-type-summary-item {
  color: var(--text);
  font-weight: 500;
}

.moves-modal-type-summary-sep {
  color: #64748b;
  user-select: none;
}

.moves-modal-sort {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  margin: 0 0 12px;
}

.moves-modal-sort[hidden] {
  display: none;
}

.moves-modal-type-summary:not([hidden]) + .moves-modal-sort:not([hidden]) {
  margin-top: -4px;
}

.moves-modal-sort-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #94a3b8);
}

.moves-modal-sort-buttons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.moves-modal-sort-btn {
  padding: 3px 8px;
  font-size: 0.78rem;
  background: #1e293b;
  color: var(--text);
  border: 1px solid #475569;
  border-radius: 999px;
  cursor: pointer;
}

.moves-modal-sort-btn.is-active,
.moves-modal-sort-btn[aria-pressed="true"] {
  background: rgba(147, 197, 253, 0.16);
  border-color: #93c5fd;
  color: #e2e8f0;
}

.column-mapping-footnote {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.moves-list {
  margin: 0;
  padding-left: 20px;
}

.moves-list--root {
  list-style: none;
  padding-left: 0;
}

.moves-list--nested {
  margin-top: 4px;
  padding-left: 18px;
}

.moves-list li {
  margin: 6px 0;
  color: var(--text);
}

.moves-list a {
  color: #93c5fd;
}

.moves-list-section {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.moves-list-section:first-child {
  margin-top: 0;
}

.moves-list-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #94a3b8);
  margin-bottom: 4px;
}

.moves-list-item--new {
  border-left: 3px solid #fbbf24;
  padding-left: 8px;
  margin-left: -11px;
  background: rgba(251, 191, 36, 0.08);
  border-radius: 0 4px 4px 0;
}

.moves-list-item--removed {
  border-left: 3px solid #f87171;
  padding-left: 8px;
  margin-left: -11px;
  background: rgba(248, 113, 113, 0.08);
  border-radius: 0 4px 4px 0;
}

.moves-scope-chip {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
}

.moves-scope-chip--new,
.moves-scope-chip--sprint-add {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.45);
}

.moves-scope-chip--removed {
  color: #fecaca;
  background: rgba(248, 113, 113, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.modal-card--issue-detail {
  width: min(700px, 96vw);
  display: flex;
  flex-direction: column;
  max-height: 78vh;
  overflow: hidden;
}

.issue-membership-meta {
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.issue-membership-meta.hidden {
  display: none;
}

.issue-membership-meta-line {
  margin: 0;
  max-width: 100%;
  word-break: break-word;
}

.issue-membership-meta-line + .issue-membership-meta-line {
  margin-top: 4px;
}

.issue-membership-meta-line.hidden {
  display: none;
}

.issue-membership-meta-label {
  color: #cbd5e1;
  font-weight: 600;
}

.issue-flow-milestones-wrap {
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.issue-flow-milestones-wrap.hidden {
  display: none;
}

.issue-flow-milestone-line {
  margin: 0;
  max-width: 100%;
}

.issue-flow-milestone-line--spans {
  margin-top: 6px;
  font-size: 0.76rem;
  line-height: 1.4;
}

.issue-detail-external {
  font-size: 0.82rem;
  color: #93c5fd;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.issue-detail-external:hover {
  color: #bfdbfe;
}

.issue-detail-external.hidden {
  display: none;
}

.issue-flag-context {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(127, 29, 29, 0.22);
}

.issue-flag-context.hidden {
  display: none;
}

.issue-flag-context-text {
  margin: 0;
  color: #fecaca;
  font-size: 0.82rem;
  line-height: 1.35;
}

.issue-history-list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  overflow-x: hidden;
  min-height: 0;
  padding-right: 6px;
}

.issue-history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}

.issue-history-filters.hidden {
  display: none;
}

.issue-history-filter-btn {
  padding: 3px 8px;
  font-size: 0.78rem;
}

.issue-description {
  margin: 0 0 8px;
}

.issue-description.hidden {
  display: none;
}

.issue-description-toggle {
  display: inline-block;
  margin: 0;
  padding: 3px 8px;
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: 999px;
  font-size: 0.76rem;
  cursor: pointer;
}

.issue-description-toggle:hover {
  background: rgba(34, 197, 94, 0.24);
  border-color: rgba(74, 222, 128, 0.55);
  color: #bbf7d0;
}

.issue-description-body {
  margin: 8px 0 0;
  padding: 8px 10px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid var(--line);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow: auto;
}

.issue-description-body.hidden {
  display: none;
}

.issue-description-source {
  margin: 0 0 8px;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--muted);
}

.issue-description-text {
  margin: 0;
}

.issue-pre-sprint-influences {
  margin: 0 0 8px;
}

.issue-pre-sprint-influences.hidden {
  display: none;
}

.issue-pre-sprint-toggle {
  display: inline-block;
  margin: 0;
  padding: 3px 8px;
  background: #1e293b;
  color: var(--text);
  border: 1px solid #475569;
  border-radius: 999px;
  font-size: 0.76rem;
  cursor: pointer;
}

.issue-pre-sprint-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.issue-pre-sprint-list.hidden {
  display: none;
}

.issue-pre-sprint-item {
  margin: 4px 0;
  font-size: 0.8rem;
}

.issue-pre-sprint-change {
  color: var(--text);
}

.issue-history-row {
  border-bottom: 1px solid var(--line);
  padding: 5px 0 6px;
  font-size: 0.86rem;
  line-height: 1.35;
}

.issue-history-row:last-child {
  border-bottom: none;
}

.issue-history-row--current {
  background: rgba(30, 41, 59, 0.55);
  margin: 0 -8px;
  padding: 5px 8px 6px;
  border-radius: 6px;
  border-bottom: none;
}

.issue-history-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  font-size: 0.86rem;
  line-height: 1.35;
  max-width: 100%;
}

.issue-change-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: none;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  vertical-align: baseline;
  white-space: nowrap;
}

.issue-change-tag--undone {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.45);
  border-color: rgba(248, 113, 113, 0.55);
}

.issue-change-tag--po-reversal {
  color: #bae6fd;
  background: rgba(12, 74, 110, 0.55);
  border-color: rgba(56, 189, 248, 0.45);
}

.issue-change-tag--backward {
  color: #e2e8f0;
  background: rgba(51, 65, 85, 0.75);
  border-color: #64748b;
}

.issue-change-tag--flag {
  color: #fee2e2;
  background: rgba(153, 27, 27, 0.55);
  border-color: rgba(248, 113, 113, 0.65);
}

.issue-history-datetime {
  color: var(--muted);
  font-size: 0.8rem;
}

.issue-change-type-inline {
  font-weight: 600;
  color: #cbd5e1;
}

.issue-change-inline-arrow {
  color: var(--text);
  white-space: normal;
  word-break: break-word;
}

.issue-change-type-btn {
  display: inline;
  margin: 0;
  padding: 0;
  font: inherit;
  color: #93c5fd;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.issue-change-type-btn:hover {
  color: #bfdbfe;
}

.issue-change-type-btn[aria-expanded="true"] {
  color: #e2e8f0;
}

.issue-change-detail {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--panel2);
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.issue-change-detail-line {
  margin: 0 0 4px;
}

.issue-change-detail-line:last-child {
  margin-bottom: 0;
}

.issue-change-detail-label {
  font-weight: 700;
  color: #e2e8f0;
}

.issue-change-detail.is-collapsed {
  display: none;
}

.issue-history-current-label {
  color: var(--text);
  font-weight: 600;
}

.settings-section {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.35);
}

.settings-section-title {
  margin: 0;
  font-size: 0.95rem;
}

.settings-section-subtitle {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.settings-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.settings-checkbox-row input {
  width: auto;
  cursor: pointer;
}

.settings-checkbox-row.is-disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.68;
}

.settings-checkbox-row input[type="date"] {
  color-scheme: dark;
}

.settings-section.hidden {
  display: none;
}

.settings-config-row {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto minmax(0, 1.2fr);
  gap: 8px 10px;
  align-items: center;
}

.settings-config-row .statusText {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.config-status--error {
  color: #fca5a5;
}

.board.board--sparklines-off .columnSparkline {
  display: none;
}

.settings-grid {
  display: grid;
  grid-template-columns: auto minmax(90px, 140px);
  gap: 8px 10px;
  align-items: center;
}

.settings-grid input[type="number"] {
  width: 100%;
}

#thresholdScopeSelect {
  min-width: 250px;
  justify-self: end;
}

.settings-grid label[for="thresholdScopeSelect"] {
  grid-column: 1;
}

.settings-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}

.settings-error {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: #fca5a5;
}

.settings-error.hidden {
  display: none;
}

.fetch-output {
  margin: 10px 0 0;
  min-height: 120px;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  box-sizing: border-box;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.85);
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.4;
}

#fetchModal .fetch-output {
  flex: 1 1 0;
  min-height: 120px;
  max-height: none;
  margin-bottom: 2px;
  overflow: auto;
  overscroll-behavior: contain;
}

.fetch-form-row {
  margin-top: 6px;
}

.fetch-closed-sprint-limit-row {
  cursor: default;
  align-items: flex-start;
}

.fetch-issue-date-row {
  cursor: default;
}

.fetch-issue-date-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.fetch-issue-date-inline select {
  width: auto;
  min-width: 9.5rem;
  cursor: pointer;
}

.settings-checkbox-row.fetch-issue-date-row.is-disabled select,
.settings-checkbox-row.fetch-issue-date-row.is-disabled input {
  cursor: default;
}

.fetch-closed-sprint-limit-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  flex: 1;
  min-width: 0;
  line-height: 1.45;
}

.fetch-closed-sprint-limit-prompt,
.fetch-closed-sprint-limit-suffix {
  color: var(--text);
}

.settings-checkbox-row.fetch-closed-sprint-limit-row input.fetch-closed-sprint-limit-input {
  box-sizing: border-box;
  width: 3.75rem;
  min-width: 0;
  max-width: 3.75rem;
  flex: 0 0 3.75rem;
  padding-inline: 4px;
  cursor: text;
}

.fetch-destination {
  margin: 8px 0 0;
  padding: 7px 9px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.62);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.fetch-destination--empty {
  color: #fbbf24;
}

.fetch-status--error {
  color: #fca5a5;
}

.fetch-status--ok {
  color: #86efac;
}

/* --- Project setup wizard (setup.html) --- */
.setup-page #appShell {
  height: auto;
  min-height: 0;
  overflow: visible;
  display: block;
}

.setup-page {
  min-height: 100vh;
  padding: 16px 20px 40px;
  max-width: 1140px;
  margin: 0 auto;
  color: var(--text);
}

.setup-page header {
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.setup-page h1 {
  margin: 0 0 6px;
  font-size: 1.35rem;
}

.setup-page .setup-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.setup-config-banner {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.45);
}

.setup-page .setup-actions-top {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.setup-page .setup-actions-top a {
  color: var(--accent, #7dd3fc);
}

.setup-page .setup-dev-tip {
  flex-basis: 100%;
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.setup-section {
  margin-bottom: 22px;
}

.setup-section h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.setup-section p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.setup-section textarea {
  width: 100%;
  min-height: 160px;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.8rem;
  line-height: 1.35;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
}

.setup-section textarea.setup-ta--tall {
  min-height: 220px;
}

.setup-page .setup-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.setup-page .setup-msg {
  font-size: 0.85rem;
  margin: 0;
}

.setup-page .setup-msg--error {
  color: #fca5a5;
}

.setup-page .setup-msg--ok {
  color: #86efac;
}

.setup-page button {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
}

.setup-page button.setup-btn-primary {
  background: #0ea5e9;
  border-color: #0284c7;
  color: #0f172a;
  font-weight: 600;
}

.setup-page button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.setup-wizard .setup-step {
  margin-bottom: 28px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.setup-step--hidden {
  display: none !important;
}

.setup-step h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.setup-page .setup-step textarea {
  width: 100%;
  min-height: 120px;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.8rem;
  line-height: 1.35;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
}

.setup-page .setup-step textarea.setup-ta--tall {
  min-height: 220px;
}

#taTomlPreview {
  margin-bottom: 12px;
}

.setup-step-help {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.setup-step-help code {
  font-size: 0.85em;
}

.setup-global-msg {
  margin: 12px 0 16px;
  min-height: 1.2em;
}

.setup-stepper {
  margin: 16px 0 20px;
}

.setup-stepper-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.setup-dev-skip-badge {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: #fde68a;
}

.setup-dev-skip-badge--hidden {
  display: none;
}

.setup-stepper-btn {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.setup-page .setup-stepper-btn--active,
.setup-page .setup-stepper-btn--active-pending,
.setup-page .setup-stepper-btn--active.setup-stepper-btn--done {
  border-color: #38bdf8;
  color: #f8fafc;
  background: rgba(14, 165, 233, 0.3);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.setup-page .setup-stepper-btn--done {
  border-color: var(--line);
  color: var(--muted);
  background: var(--panel);
}

.setup-stepper-btn--done::after {
  content: " \2713";
  color: #86efac;
  font-weight: 700;
}

.setup-page .setup-stepper-btn--active.setup-stepper-btn--done::after {
  color: #e0f2fe;
}

/* Keep active step fill consistent (blue), even when also marked done. */
.setup-page .setup-stepper-btn--active {
  border-color: #38bdf8;
  color: #f8fafc;
  background: rgba(14, 165, 233, 0.3);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.setup-field-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 14px;
  align-items: center;
  max-width: 640px;
}

.setup-field-grid + .setup-field-row {
  margin-top: 18px;
}

.setup-field-grid--compact {
  max-width: 720px;
}

.setup-field-grid input,
.setup-field-grid select {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.setup-field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.setup-field-row label {
  font-size: 0.85rem;
  color: var(--muted);
}

.setup-inline-msg {
  font-size: 0.82rem;
  color: var(--muted);
  min-height: 1.2em;
}

.setup-inline-msg--ok {
  color: #86efac;
}

.setup-inline-msg--error {
  color: #fca5a5;
}

.setup-input-narrow {
  width: 120px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.setup-input-tiny {
  width: 110px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.setup-input-medium {
  width: 180px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.setup-emoji-combo {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.setup-emoji-preset-select {
  flex: 0 0 auto;
  min-width: 4.5rem;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.2;
}

.setup-input-emoji {
  flex: 1 1 auto;
  width: 100%;
  max-width: 7.5rem;
  min-width: 3.5rem;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.2;
}

.setup-credentials-line {
  font-size: 0.85rem;
  color: #86efac;
}

.setup-fetch-summary {
  font-size: 0.88rem;
  color: #86efac;
  margin: 8px 0 0;
}

.setup-shape-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.setup-shape-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.setup-shape-table th,
.setup-shape-table td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
}

.setup-shape-table select {
  min-width: 120px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.setup-shape-table select.setup-shape-select--emoji-locked:disabled {
  opacity: 0.92;
  cursor: not-allowed;
  color: var(--muted);
  appearance: auto;
  -webkit-appearance: menulist;
}

.setup-column-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.setup-column-fieldset {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.setup-column-def-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.setup-column-def-order {
  color: var(--muted);
  min-width: 2ch;
  text-align: right;
  font-weight: 600;
}

.setup-column-def-label {
  flex: 1;
  min-width: 180px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.setup-column-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.setup-column-head input[type="text"] {
  flex: 1;
  min-width: 160px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.setup-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.setup-status-map-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.setup-status-map-table th,
.setup-status-map-table td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
}

.setup-status-map-table select {
  min-width: 240px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.setup-boards-reference-wrap {
  margin: 8px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
}

.setup-boards-reference-intro {
  margin-top: 0;
  margin-bottom: 8px;
}

.setup-boards-reference-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
  font-size: 0.88rem;
}

.setup-boards-apply-select {
  min-width: 160px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.setup-boards-reference-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.setup-boards-reference-table th,
.setup-boards-reference-table td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
  vertical-align: middle;
}

.setup-boards-reference-table th:last-child,
.setup-boards-reference-table td:last-child {
  width: 1%;
  white-space: nowrap;
}

.setup-boards-id-code {
  font-size: 0.92em;
}

.setup-page button.setup-boards-use-id-btn {
  font-size: 0.82rem;
  padding: 4px 10px;
}

.setup-profiles-editor {
  --setup-profile-grid-columns:
    minmax(110px, 1fr)
    minmax(110px, 1fr)
    minmax(130px, 1fr)
    minmax(110px, 150px)
    minmax(180px, 2fr)
    minmax(220px, 2fr)
    auto;
  margin: 8px 0 10px;
}

.setup-profile-header,
.setup-profile-row {
  display: grid;
  grid-template-columns: var(--setup-profile-grid-columns);
  gap: 8px;
  align-items: center;
}

.setup-profile-header {
  padding-bottom: 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}

.setup-profile-header span {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
}

.setup-profiles-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-profile-row input {
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.setup-board-input-wrap {
  position: relative;
  min-width: 0;
  width: 100%;
}

.setup-board-input-wrap > input {
  width: 100%;
}

.setup-board-suggest-panel {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 80;
  max-height: 260px;
  overflow-y: auto;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.setup-board-suggest-panel--open {
  display: block;
}

.setup-board-suggest-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  line-height: 1.35;
}

.setup-board-suggest-item:last-child {
  border-bottom: none;
}

.setup-board-suggest-item:hover,
.setup-board-suggest-item:focus-visible,
.setup-page button.setup-board-suggest-item:hover,
.setup-page button.setup-board-suggest-item:focus-visible {
  background: var(--panel2);
  outline: none;
}

.setup-board-suggest-item-id {
  font-weight: 600;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.82rem;
}

.setup-board-suggest-item-meta {
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--muted);
}

.setup-page button.setup-board-suggest-item {
  padding: 8px 10px;
  border-radius: 0;
  border: none;
  background: transparent;
  font-size: 0.84rem;
  line-height: 1.35;
  text-align: left;
  width: 100%;
}

.setup-status-chip {
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
}

.setup-done-row {
  margin-top: 18px;
}

.setup-done-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
}

.setup-done-chip {
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
}

.setup-label-block {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.setup-advanced {
  margin: 16px 0;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.setup-advanced textarea {
  width: 100%;
  min-height: 100px;
  margin-bottom: 12px;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  box-sizing: border-box;
}

.setup-review-list {
  margin: 0 0 16px;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.setup-wizard-nav {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
}

.setup-wizard-nav #btnNext {
  margin-left: auto;
}
