/*
 * Design system on top of Bootstrap 5. Still restrained - a business tool,
 * not a marketing page - but with a deliberate color scheme instead of raw
 * Bootstrap defaults, so:
 *  - there is exactly one "brand" color, used consistently for every
 *    forward/primary action (buttons, the active step in the rail, links,
 *    focus rings) and for nothing else - color only ever means "this is
 *    the next thing to do" or "this is a link";
 *  - the Schritt-4 chart's bar color (see attributes.js) IS this brand
 *    color, so the one chart in the app doesn't clash with the UI around it;
 *  - "done" steps get their own green, "back"/secondary actions stay
 *    neutral gray - color is never the only signal (labels/icons carry the
 *    same information), it just reinforces it.
 *
 * Bootstrap's shipped CSS bakes literal hex values into each component
 * class (e.g. .btn-primary sets its own --bs-btn-bg locally), so a single
 * `:root { --bs-primary: ... }` override does not recolor buttons on its
 * own - each component's own CSS variables are overridden below instead.
 */

:root {
  --brand: #2a78d6;
  --brand-dark: #1c5cab;
  --brand-soft: #e9f1fb;
  --good: #0ca30c;
  --good-soft: #e6f7e6;

  --paper: #f6f7f9;
  --paper-raised: #ffffff;
  --ink: #16212e;
  --ink-muted: #5b6670;
  --line: #e1e4e8;
  --line-strong: #c7ccd1;
  --shadow: 0 1px 2px rgba(20, 30, 40, 0.06), 0 6px 16px rgba(20, 30, 40, 0.05);
}

body {
  font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

a,
.text-primary {
  color: var(--brand);
}
a:hover {
  color: var(--brand-dark);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- Buttons: one brand color for every forward action ---------- */
.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-disabled-bg: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
  --bs-btn-focus-shadow-rgb: 42, 120, 214;
}
/* "Zurück" and other secondary actions stay neutral - never compete with the brand color. */
.btn-outline-secondary {
  --bs-btn-color: var(--ink-muted);
  --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-bg: var(--ink-muted);
  --bs-btn-hover-border-color: var(--ink-muted);
}

/* Every other Bootstrap component that defaults to --bs-primary's baked-in
   hex needs the same brand override, or the page ends up with two
   different "blues" fighting each other (Bootstrap's #0d6efd showing up in
   DataTables' pagination, checked checkboxes, focused inputs, ...). */
.page-link {
  color: var(--brand);
}
.page-link:hover {
  color: var(--brand-dark);
}
.page-item.active .page-link {
  background-color: var(--brand);
  border-color: var(--brand);
}
.form-check-input:checked {
  background-color: var(--brand);
  border-color: var(--brand);
}
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.25rem rgba(42, 120, 214, 0.25);
}

.navbar-brand {
  color: var(--ink) !important;
}
/* Prototype logo (Currywurst neon sign, assets/img/logo.svg) */
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* ---------- Dataset indicator (navbar) ---------- */
.dataset-indicator {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.dataset-indicator .dataset-name {
  font-weight: 600;
  color: var(--ink);
}

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 24rem;
}

/* ---------- Guided workflow: progress list + panels ---------- */
.workflow-layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.workflow-nav {
  position: sticky;
  top: 1rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.75rem 0.5rem;
}
.nav-phase + .nav-phase {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.nav-phase-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  padding: 0 0.5rem 0.35rem;
}
.nav-phase.is-done .nav-phase-title::after {
  content: " ✓";
  color: var(--good);
}
.nav-phase-later .nav-phase-title { font-weight: 600; }
.nav-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-step {
  display: grid;
  grid-template-columns: 1.25rem 2.4rem 1fr;
  align-items: baseline;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  color: var(--ink);
  font-size: 0.875rem;
}
.nav-step:not(:disabled):hover { background: var(--paper); }
.nav-step:disabled { color: var(--ink-muted); opacity: 0.6; cursor: default; }
.nav-step.is-shown { background: var(--brand-soft); font-weight: 600; }
.nav-step-icon { font-size: 0.8rem; color: var(--ink-muted); }
.nav-step[data-state="done"] .nav-step-icon { color: var(--good); font-weight: 700; }
.nav-step[data-state="current"] .nav-step-icon { color: var(--brand); }
.nav-step-number { color: var(--ink-muted); font-variant-numeric: tabular-nums; }

.step-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.step-footer-next {
  margin-left: auto;
  text-align: right;
}
.step-footer-next [data-next-hint] { margin-bottom: 0.25rem; max-width: 36rem; }

/* Narrow screens: the progress list goes above the panel as a compact block. */
@media (max-width: 900px) {
  .workflow-layout { grid-template-columns: minmax(0, 1fr); }
  .workflow-nav { position: static; }
  .nav-steps { display: flex; flex-wrap: wrap; gap: 0.25rem; }
  .nav-step { grid-template-columns: auto auto; gap: 0.25rem; width: auto; }
  .nav-step-label { display: none; }
  .nav-step.is-shown .nav-step-label { display: inline; grid-column: span 2; }
}

/* ---------- Step panels ---------- */
.step-panel + .step-panel { margin-top: 1.5rem; }
.step-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand);
}
.step-panel {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1.75rem;
}

/* ---------- Step 1: dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: 8px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--ink-muted);
  cursor: pointer;
  background: var(--paper-raised);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.dropzone-title {
  font-weight: 600;
  color: var(--ink);
  margin-top: 0.5rem;
}
.dropzone-sub {
  font-size: 0.8125rem;
}
.dropzone svg {
  color: var(--ink-muted);
}
.dropzone:hover svg,
.dropzone.dragover svg {
  color: var(--brand);
}

/* ---------- Badges ---------- */
.badge-guessed {
  background: var(--good-soft);
  color: var(--good);
  font-weight: 600;
}

/* DataTables' default search/length controls float without Bootstrap's grid;
   give them breathing room to match the rest of the layout. */
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length {
  margin-bottom: 0.75rem;
}

/* ---------- 1.4/1.5/1.8: Materialtexte, Produktarten, Analyseumfang ---------- */
.scroll-box {
  max-height: 22rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.scroll-box thead th {
  position: sticky;
  top: 0;
  background: var(--paper-raised);
  z-index: 1;
}
.scope-summary {
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}
.type-badge { font-weight: 600; }
.type-badge.type-a { background: var(--good-soft); color: #0a6e0a; }
.type-badge.type-p { background: #eef0ff; color: #3b45a8; }
.type-badge.type-g { background: #f3ecfb; color: #6b3fa0; }
.type-badge.type-x { background: #eceff2; color: var(--ink-muted); }
.type-badge.type-check { background: #fff4e0; color: #9a5b00; }
select.learned {
  border-color: var(--brand);
  background-color: var(--brand-soft);
}

/* ---------- Kennzahlen (stat tiles), Pivot, A/B ---------- */
.stat-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.stat-tile {
  flex: 1 1 10rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow);
}
.stat-label {
  font-size: 0.75rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat-sub {
  font-size: 0.8rem;
  color: var(--ink-muted);
}
.pivot-table td,
.pivot-table th {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pivot-table td.heat {
  background-color: rgba(42, 120, 214, calc(0.06 + var(--heat) * 0.34));
}
.pivot-table tfoot td,
.pivot-table tfoot th {
  border-top: 2px solid var(--line-strong);
}
td.abc-A,
td.abc-B {
  font-weight: 700;
  text-align: center;
}
td.abc-A { color: #0a6e0a; }
td.abc-B { color: var(--ink-muted); }

/* ---------- Quad-Matrix (dormant Schritt 5, quads.js) ---------- */
.quad-matrix {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 0.75rem;
}
.quad-axis {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.quad-axis-col { text-align: center; align-self: end; }
.quad-axis-row { writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; align-self: center; }
.quad-cell {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  background: var(--paper-raised);
  font-size: 0.875rem;
}
.quad-cell.quad-aa { border-left: 4px solid var(--good); }
.quad-cell.quad-ab,
.quad-cell.quad-ba { border-left: 4px solid var(--brand); }
.quad-cell.quad-bb { border-left: 4px solid #d08a00; }
.quad-title { font-weight: 600; }
.quad-share {
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  margin: 0.25rem 0;
}
.quad-stat { color: var(--ink); }
.quad-strategy {
  margin-top: 0.5rem;
  color: var(--ink-muted);
  font-style: italic;
}
.quad-cell details { margin-top: 0.5rem; }
.quad-cell summary { cursor: pointer; color: var(--brand); }
@media (max-width: 640px) {
  .quad-matrix { grid-template-columns: 1fr; }
  .quad-axis { display: none; }
}

/* 1.7 Konzerne (corporation grouping review, groups.js) */
.group-list { padding: 0.25rem 0.75rem; }
.group-item { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.group-item:last-child { border-bottom: 0; }
.group-name-input { max-width: 18rem; }
.group-member { font-size: 0.875rem; margin: 0.1rem 0 0.1rem 0.25rem; }
.group-label { text-decoration: underline dotted; cursor: help; }

/* ---------- Übersetzung fremder Schrift (auf Klick, im Browser) ---------- */
.translate-btn { font-size: 0.8em; }
.translation-hint {
  font-size: 0.85em;
  color: var(--ink-muted);
  font-style: italic;
}

/* ---------- Speicherstand (1.4) ---------- */
.save-state { font-size: 0.8rem; font-weight: 600; }
.save-state.is-saved { color: var(--good); }
.save-state.is-unsaved { color: #9a5b00; }

/* ---------- 1.2 Dateiprüfung ---------- */
.check-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.check-list li {
  display: grid;
  grid-template-columns: 1.5rem 12rem 1fr;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.check-list li:last-child { border-bottom: 0; }
.check-list .check-summary { display: block; font-weight: 600; background: var(--paper); }
.check-icon { font-weight: 700; text-align: center; }
.check-label { font-weight: 600; }
.check-ok .check-icon { color: var(--good); }
.check-info .check-icon { color: var(--brand); }
.check-warning .check-icon { color: #9a5b00; }
.check-error .check-icon { color: #d03b3b; }
.check-summary.check-warning { background: #fff4e0; }
@media (max-width: 640px) {
  .check-list li { grid-template-columns: 1.5rem 1fr; }
  .check-detail { grid-column: 2; }
}

/* ---------- Phase 2: Kundenanalyse ---------- */
.abc-tag {
  display: inline-block;
  min-width: 1.5rem;
  font-weight: 700;
  border-radius: 4px;
}
.abc-tag.abc-A { background: var(--good-soft); color: #0a6e0a; }
.abc-tag.abc-B { background: #eceff2; color: var(--ink-muted); }
.option-suggested td { background: var(--brand-soft); }
.rule-box {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  background: var(--paper-raised);
}
.chart-box {
  position: relative;
  height: 22rem; /* includes the axis labels - no nested scroll */
}
.chart-box-small {
  height: 12rem;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-bottom: 0.5rem;
  color: var(--ink-muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-swatch { display: inline-block; }
.legend-swatch.legend-line { width: 1.25rem; height: 2px; }
.legend-swatch.legend-thin { width: 1.25rem; height: 1px; }
.legend-swatch.legend-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; }
.legend-swatch.legend-bar { width: 0.75rem; height: 0.6rem; border-radius: 2px; }

/* Amounts and percentages never break inside a table cell ("226.427.781 €"). */
.table td.text-end,
.table th.text-end {
  white-space: nowrap;
}
/* Values of the scope filter (1.8): flex only while shown - Bootstrap's d-flex would override [hidden]. */
.filter-values {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.filter-values[hidden] {
  display: none;
}

/* 2.4: protected B customer ("B geschützt") - its own tone, never a status color */
.abc-tag.abc-P { background: #eef0ff; color: #3b45a8; padding: 0 0.35rem; }
.abc-tag { padding: 0 0.25rem; white-space: nowrap; }

/* Phases whose content is still to be defined */
.nav-later {
  font-size: 0.8rem;
  color: var(--ink-muted);
  padding: 0 0.5rem;
  font-style: italic;
}

/* 2.6/2.7: product line A/B × group A/B/none */
.class-matrix {
  display: grid;
  grid-template-columns: auto repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  font-size: 0.875rem;
}
.class-matrix-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  align-self: end;
}
.class-matrix-row { align-self: center; }
.class-matrix-col { text-align: center; }
.class-matrix-cell {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  background-color: rgba(42, 120, 214, calc(0.04 + var(--heat, 0) * 0.4));
  font-variant-numeric: tabular-nums;
}
.class-matrix-cell.is-proposal { border: 2px solid #6250d6; }
.class-matrix-count { font-weight: 700; }
@media (max-width: 640px) {
  .class-matrix { grid-template-columns: auto repeat(3, minmax(4.5rem, 1fr)); overflow-x: auto; }
}

/* 2.7: revenue shares of the final classes as one 100 % bar */
.share-bar {
  display: flex;
  gap: 2px;
  height: 1.5rem;
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-raised);
}
.share-bar-segment { min-width: 2px; }

/* 2.9: revenue heatmap month × year (one hue, light to dark) */
.heatmap td,
.heatmap th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.heatmap td.heat { background-color: rgba(42, 120, 214, calc(0.05 + var(--heat, 0) * 0.45)); }

/* 2.10: hints - icon plus title, never color alone */
.hint {
  display: flex;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.5rem;
  background: var(--paper-raised);
}
.hint-warning { border-left-color: #fab219; }
.hint-info { border-left-color: var(--brand); }
.hint-icon { font-weight: 700; }
.hint-warning .hint-icon { color: #9a5b00; }
.hint-info .hint-icon { color: var(--brand); }

/* ---------- Frank, der virtuelle Assistent (assets/js/frank.js) ---------- */
.frank-launcher {
  position: fixed;
  right: 1.25rem;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  width: 4rem;
  height: 4rem;
  padding: 0;
  border: 3px solid var(--paper-raised);
  border-radius: 50%;
  background: #1f2a37;
  box-shadow: 0 4px 14px rgba(20, 30, 40, 0.25);
  z-index: 1050;
  cursor: pointer;
}
.frank-launcher:hover { transform: translateY(-2px); }
.frank-launcher:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.frank-launcher .frank-avatar { width: 100%; height: 100%; border-radius: 50%; display: block; }
.frank-badge {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #d6332a;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4rem;
  text-align: center;
}
.frank-panel {
  position: fixed;
  right: 1.25rem;
  bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
  width: min(24rem, calc(100vw - 2.5rem));
  max-height: min(36rem, calc(100vh - 8rem));
  display: flex;
  flex-direction: column;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(20, 30, 40, 0.2);
  z-index: 1050;
  font-size: 0.9rem;
}
.frank-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.frank-head .frank-avatar { width: 2.25rem; height: 2.25rem; border-radius: 50%; flex: none; }
.frank-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.frank-step { font-size: 0.78rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frank-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--paper);
}
.frank-msg {
  max-width: 92%;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  align-self: flex-start;
}
.frank-msg p { margin: 0; }
.frank-msg p + p { margin-top: 0.35rem; }
.frank-kind {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}
.frank-question { border-left: 3px solid #d08a00; }
.frank-question .frank-kind { color: #9a5b00; }
.frank-tip { border-left: 3px solid var(--good); }
.frank-tip .frank-kind { color: #0a6e0a; }
.frank-thanks { color: var(--ink-muted); }
.frank-error { border-color: #f1b5b0; color: #b42318; }
.frank-user {
  align-self: flex-end;
  background: var(--brand-soft);
  border-color: transparent;
}
.frank-detail { font-size: 0.8rem; color: var(--ink-muted); }
.frank-answered { font-size: 0.82rem; color: #0a6e0a; font-weight: 600; }
.frank-replies { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; align-items: center; }
.frank-replies .form-control { flex: 1 1 8rem; min-width: 0; }
.frank-form {
  border-top: 1px solid var(--line);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.frank-form textarea { resize: none; font-size: 0.9rem; }
.frank-form-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.frank-privacy { font-size: 0.72rem; color: var(--ink-muted); }
.frank-answering { font-size: 0.78rem; font-weight: 600; color: #9a5b00; }
@media (prefers-reduced-motion: no-preference) {
  .frank-launcher { transition: transform 0.15s ease; }
}
@media (max-width: 480px) {
  .frank-panel { right: 0.5rem; left: 0.5rem; width: auto; bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }
  .frank-launcher { right: 0.75rem; bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)); width: 3.5rem; height: 3.5rem; }
}

/* ---------- Ladeanzeige (steps.js "fleischmeister:loading", Feedback 25.10.2026) ---------- */
.global-loading {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  background-size: 50% 100%;
  background-repeat: no-repeat;
  z-index: 1100;
}
.frank-busy {
  position: fixed;
  right: 5.75rem;
  bottom: calc(2.25rem + env(safe-area-inset-bottom, 0px));
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: #1f2a37;
  color: #fff;
  font-size: 0.8rem;
  z-index: 1050;
}
@media (prefers-reduced-motion: no-preference) {
  .global-loading { animation: global-loading 1.1s linear infinite; }
  .frank-launcher.is-busy { animation: frank-think 1s ease-in-out infinite; }
}
@keyframes global-loading { from { background-position: -50% 0; } to { background-position: 150% 0; } }
@keyframes frank-think { 50% { transform: translateY(-3px) rotate(-4deg); } }
@media (max-width: 480px) {
  .frank-busy { right: 4.75rem; bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- 1.2 Spaltennamen direkt in der Vorschau ändern ---------- */
.col-head { display: inline-flex; align-items: center; gap: 0.25rem; }
.col-head.is-generated .col-name { background: #fff8eb; outline: 1px solid #d08a00; border-radius: 0.2rem; padding: 0 0.2rem; }
.col-rename { border: 0; background: none; padding: 0 0.15rem; color: var(--bs-secondary-color); line-height: 1; }
.col-rename:hover, .col-rename:focus-visible { color: var(--bs-body-color); }
.col-rename-input { width: 11rem; font-weight: normal; }

/* ---------- 1.4 häufigste Werte einer Spalte ---------- */
.values-peek summary { cursor: pointer; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22rem; }
.values-peek ol { margin: 0.35rem 0 0; padding-left: 1.2rem; font-size: 0.85em; }

/* 3.9: product rows open their customers */
.row-expandable tbody tr[role="row"], .row-expandable tbody tr.odd, .row-expandable tbody tr.even { cursor: pointer; }

/* Collapsible "Erweitert" groups (UAT: less on screen for testers, open for admins) */
details.advanced > summary { cursor: pointer; color: var(--bs-secondary-color, #52514e); }

/* ---------- Autopilot (steps.js, autopilot.js) ---------- */
.workflow-main { position: relative; }
.autopilot-overlay {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: 6rem; border-radius: 0.5rem;
}
.autopilot-box {
  display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--bs-border-color); border-radius: 0.5rem;
  padding: 1rem 1.25rem; box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.08); max-width: 100%;
}

/* ---------- 1.6 Stückliste je Baureihe (links.js) ---------- */
.bom-tree { border: 1px solid var(--bs-border-color); border-radius: 0.375rem; padding: 0.25rem 0.5rem; font-size: 0.875rem; }
.bom-node > .bom-node, .bom-node > .bom-leaf { margin-left: 1.25rem; }
.bom-row {
  display: grid; grid-template-columns: minmax(10rem, 1.4fr) minmax(8rem, auto) minmax(0, 2fr);
  gap: 0.75rem; align-items: baseline; padding: 0.2rem 0; border-bottom: 1px solid var(--bs-border-color-translucent);
}
summary.bom-row { cursor: pointer; list-style: none; }
summary.bom-row::-webkit-details-marker { display: none; }
summary.bom-row .bom-name::before { content: "▸"; display: inline-block; width: 1rem; color: var(--bs-secondary-color); }
details[open] > summary.bom-row .bom-name::before { content: "▾"; }
.bom-leaf .bom-name { padding-left: 1rem; }
.bom-series > summary .bom-name { font-weight: 600; }
.bom-value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bom-meta { color: var(--bs-secondary-color); }
.bom-meta.is-match { color: #1e7a3c; }
.bom-meta.is-nomatch { color: #9a6200; }
@media (max-width: 576px) {
  .bom-row { grid-template-columns: 1fr auto; }
  .bom-meta { grid-column: 1 / -1; padding-left: 1rem; }
}

/* ---------- 2.0 / 3.0: folded result list (result.js) ---------- */
.result-table-details > summary { cursor: pointer; margin-bottom: 0; }

/* ---------- 2.1 / 3.1: the options table is the choice (pareto.js) ---------- */
.option-table .option-row { cursor: pointer; }
.option-table .option-row:hover > td { background-color: var(--bs-tertiary-bg); }
.option-table .option-row.is-chosen > td { background-color: #e7f0fb; }
.option-table .option-row.is-chosen > td:first-child { box-shadow: inset 3px 0 0 #2a78d6; }
.option-table td:first-child { width: 2rem; }

/* ---------- 4.1 Top 5 High Runner (quadmatrix.js) ---------- */
.high-runners .runner-share { position: relative; min-width: 7rem; }
.high-runners .runner-bar {
  position: absolute; left: 0.25rem; bottom: 0.2rem; height: 3px; max-width: calc(100% - 0.5rem);
  background: #2a78d6; border-radius: 2px; opacity: 0.7;
}

/* ---------- 4.3 Werkstoffnutzung: doughnuts with legend (links.js) ---------- */
.pie-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.5rem; }
.pie-card { border: 1px solid var(--bs-border-color); border-radius: 0.5rem; padding: 1rem; background: #fff; }
.pie-box { position: relative; height: 13rem; margin-bottom: 0.75rem; }
.pie-legend li { display: grid; grid-template-columns: 0.8rem 1fr auto; gap: 0.5rem; align-items: center; padding: 0.1rem 0; }
.pie-swatch { width: 0.8rem; height: 0.8rem; border-radius: 2px; }
.pie-name { color: var(--ink); overflow-wrap: anywhere; }
.pie-value { color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
