/* =====================================================
   BWA-Spiegel — all styles specific to the production app
   ===================================================== */

body { background: #f5f6f8; }

.app-header__inner { flex-wrap: wrap; }

/* User menu (in header) */
.user-menu {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--c-border);
}
.user-menu__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text);
  padding: 2px 0;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .user-menu { padding-left: 0; border-left: 0; width: 100%; margin-top: 4px; }
}

/* ---------- Page layout ---------- */
.page {
  padding: 20px 28px 48px;
  max-width: 1920px;
  margin: 0 auto;
}
@media (max-width: 960px) {
  .page { padding: 16px 12px 48px; }
}

/* ---------- Anchor-trio summary ---------- */
.summary {
  margin-bottom: 16px;
}
.summary__inner {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 12px;
}
@media (max-width: 900px) {
  .summary__inner { grid-template-columns: 1fr; }
}
.summary__col {
  padding: 14px 18px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  min-width: 0;
}
.summary__col--cur {
  background: #f0fdf4;
  border-color: #bbf7d0;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.08);
}
.summary__col--prev {
  background: #fffbeb;
  border-color: #fde68a;
}
.summary__col--yoy {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.summary__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-muted);
}
.summary__period {
  font-size: 17px;
  font-weight: 700;
  margin-top: 2px;
  letter-spacing: -0.01em;
}
.summary__col--cur .summary__period { color: #166534; }
.summary__col--prev .summary__period { color: #92400e; }
.summary__col--yoy .summary__period { color: #1e40af; }

.summary__rows {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}
.summary__metric {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 12px;
}
.summary__metric-label {
  font-size: 12px;
  color: var(--c-text-muted);
}
.summary__metric-value {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.summary__col--cur .summary__metric-value { font-size: 17px; }
.summary__metric-delta {
  grid-column: 2 / 3;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: grid;
  grid-template-columns: 2.4fr 1.2fr;
  gap: 18px;
  padding: 14px 18px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  margin-bottom: 12px;
}
@media (max-width: 1100px) {
  .toolbar { grid-template-columns: 1fr; }
}
.toolbar__group { min-width: 0; }
.toolbar__label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-muted);
  margin-bottom: 6px;
}
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip-loc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--c-border-strong);
  background: var(--c-surface);
  color: var(--c-text-muted);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: all 120ms ease;
}
.chip-loc .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot-color, var(--c-text-muted));
  opacity: 0.4;
}
.chip-loc.is-on {
  background: var(--c-surface);
  color: var(--c-text);
  border-color: var(--dot-color, var(--c-text));
  box-shadow: 0 0 0 1px var(--dot-color, var(--c-text));
}
.chip-loc.is-on .dot { opacity: 1; }
.chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  color: var(--c-text);
  user-select: none;
}
.chk input { accent-color: var(--c-accent); }

/* ---------- Info band ---------- */
.info-band {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--c-info-bg);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 13px;
  color: #1e3a8a;
}
.info-band strong { font-weight: 600; }

/* ---------- Main table ---------- */
.table-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 100px);
}

table.bwa {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

/* Column header (month row) */
table.bwa thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f9fafb;
  border-bottom: 1px solid var(--c-border);
  padding: 8px 10px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  font-size: 12px;
  color: var(--c-text);
}
table.bwa thead th.bwa__label-head {
  text-align: left;
  left: 0;
  z-index: 4;
  background: #f9fafb;
  min-width: 260px;
  width: 260px;
  border-right: 1px solid var(--c-border);
}
table.bwa thead th .period-sub {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--c-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Anchor-column styling in header */
table.bwa thead th.col-cur  { background: #dcfce7; color: #14532d; }
table.bwa thead th.col-prev { background: #fef3c7; color: #713f12; }
table.bwa thead th.col-yoy  { background: #dbeafe; color: #1e3a8a; }

/* Sticky label column (first column body) */
table.bwa tbody th.bwa__label {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--c-surface);
  text-align: left;
  padding: 8px 14px;
  font-weight: 500;
  min-width: 260px;
  width: 260px;
  border-right: 1px solid var(--c-border);
  border-bottom: 1px solid #eef0f3;
}

/* Row variants */
tr.row-group .bwa__label {
  background: #1e293b;
  color: #f1f5f9;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 8px 14px;
}
tr.row-group td {
  background: #1e293b;
  border-bottom: 0;
}
tr.row-total .bwa__label,
tr.row-total td {
  background: #f3f4f6;
  font-weight: 600;
}
tr.row-total .bwa__label { color: var(--c-text); }

tr.row-big .bwa__label,
tr.row-big td {
  background: #e5e7eb;
  font-weight: 700;
}
tr.row-big.row-big--positive .bwa__label,
tr.row-big.row-big--positive td {
  background: #dcfce7;
  color: #14532d;
}
tr.row-big.row-big--primary .bwa__label,
tr.row-big.row-big--primary td {
  background: #0f172a;
  color: #f8fafc;
  font-size: 14px;
}
tr.row-big.row-big--primary .cell__chip-mom,
tr.row-big.row-big--primary .cell__chip-yoy { opacity: 0.95; }

tr.row-detail .bwa__label {
  padding-left: 28px;
  font-size: 12px;
  color: var(--c-text-muted);
  font-weight: 400;
}
tr.row-detail .bwa__label .loc-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: middle;
}

tr.row-pct .bwa__label {
  color: var(--c-text-muted);
  font-size: 12px;
  font-style: italic;
}
tr.row-pct td { background: #fafbfc; }

tr:hover td:not(.col-cur-bg):not(.col-prev-bg):not(.col-yoy-bg) { background: #f9fafb; }

/* Body cells */
table.bwa tbody td {
  padding: 6px 10px;
  text-align: right;
  border-bottom: 1px solid #eef0f3;
  font-size: 13px;
  white-space: nowrap;
  vertical-align: middle;
  min-width: 94px;
}
.cell__value { line-height: 1.2; }
.cell__chips {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 2px;
  line-height: 1;
}
.cell__chip {
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  letter-spacing: -0.01em;
}
.cell__chip svg { width: 8px; height: 8px; }
.cell__chip--pos { color: var(--c-pos); }
.cell__chip--neg { color: var(--c-neg); }
.cell__chip--neutral { color: var(--c-text-subtle); }
.cell__chip-label {
  font-size: 9px;
  font-weight: 500;
  color: var(--c-text-muted);
  margin-right: 1px;
  letter-spacing: 0.04em;
}

/* Anchor column cell backgrounds */
td.col-cur-bg  { background: #f0fdf4; }
td.col-prev-bg { background: #fffbeb; }
td.col-yoy-bg  { background: #eff6ff; }

/* aktuell cell: make it a bit wider and pin a stronger border-left */
table.bwa td.col-cur-bg,
table.bwa thead th.col-cur {
  border-left: 2px solid #10b981;
  border-right: 2px solid #10b981;
  min-width: 130px;
}
table.bwa td.col-prev-bg,
table.bwa thead th.col-prev {
  border-left: 1px solid #fbbf24;
}
table.bwa td.col-yoy-bg,
table.bwa thead th.col-yoy {
  border-left: 2px solid #3b82f6;
  border-right: 2px solid #3b82f6;
}

/* Empty/missing cell */
td.is-na {
  color: var(--c-text-subtle);
  font-style: italic;
}

/* Interpolated marker */
td.is-interpolated {
  box-shadow: inset 0 -2px 0 0 #f59e0b;
}
td.is-interpolated .cell__value::after {
  content: " ◦";
  color: #d97706;
  font-weight: 700;
}

/* Einmaleffekt marker */
td.has-einmal-effect {
  box-shadow: inset 3px 0 0 0 #dc2626;
}

/* Sum columns (right side of table) */
table.bwa thead th.col-sum {
  background: #0f172a;
  color: #f8fafc;
  border-left: 2px solid #0f172a;
  min-width: 118px;
  padding: 10px 12px;
}
table.bwa thead th.col-sum--py {
  background: #334155;
  border-left: 1px solid #475569;
}
table.bwa thead th.col-sum .period-sub {
  color: #94a3b8;
  font-weight: 500;
}

table.bwa tbody td.col-sum-bg {
  background: #f1f5f9;
  font-weight: 600;
  border-left: 2px solid #0f172a;
  min-width: 118px;
}
table.bwa tbody td.col-sum--py-bg {
  background: #f8fafc;
  border-left: 1px solid #cbd5e1;
}

/* bold value inside sum cells */
.cell__value--strong {
  font-weight: 700;
  font-size: 13.5px;
}

/* special row-total/big styling in sum columns must not be overridden */
tr.row-big td.col-sum-bg,
tr.row-big td.col-sum--py-bg {
  background: #dcfce7;
  color: #14532d;
}
tr.row-big--primary td.col-sum-bg,
tr.row-big--primary td.col-sum--py-bg {
  background: #0f172a;
  color: #f8fafc;
}
tr.row-total td.col-sum-bg,
tr.row-total td.col-sum--py-bg {
  background: #e2e8f0;
}
tr.row-pct td.col-sum-bg,
tr.row-pct td.col-sum--py-bg {
  background: #f1f5f9;
}

/* ---------- Legend ---------- */
.legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--c-text-muted);
}
.legend__row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.legend__anchor {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}
.legend__anchor--cur  { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.legend__anchor--prev { background: #fef3c7; color: #713f12; border: 1px solid #fde68a; }
.legend__anchor--yoy  { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }

/* ---------- Einmaleffekte ---------- */
.einmaleffekte {
  margin-top: 20px;
  padding: 18px 20px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
}
.einmaleffekte h2 {
  font-size: 16px;
  margin-bottom: 4px;
  font-weight: 700;
}

/* ---------- Footer ---------- */
.app-footer {
  margin-top: 24px;
  padding: 14px 0;
  font-size: 12px;
  color: var(--c-text-muted);
  text-align: center;
  border-top: 1px solid var(--c-border);
}

/* ---------- Expand/collapse chevrons ---------- */
.expand-btn {
  border: 0;
  background: transparent;
  padding: 0;
  margin-right: 6px;
  font-size: 10px;
  color: var(--c-text-muted);
  cursor: pointer;
  width: 12px;
  display: inline-block;
}
.expand-btn::before { content: "▼"; font-size: 9px; }
.expand-btn.is-collapsed::before { content: "▶"; }

.sub-expand-btn {
  border: 0;
  background: transparent;
  padding: 0;
  margin-right: 4px;
  font-size: 9px;
  color: var(--c-text-muted);
  cursor: pointer;
  width: 10px;
  display: inline-block;
}
.sub-expand-btn::before { content: "▾"; }
.sub-expand-btn.is-collapsed::before { content: "▸"; }
