/**
 * Mahnwesen workbench styles.
 *
 * Built on the authored design tokens in legacy-design.css. Every text colour
 * used here was measured against its own background: the lowest pair is
 * --legacy-ink-soft on --legacy-paper at 5.18:1, comfortably over the 4.5:1
 * WCAG AA floor the recovered DunningPage missed at 4.07:1.
 */

.mw-root {
  --mw-danger: #9b1c1c; /* 8.15:1 on white */
  --mw-gap: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--mw-gap);
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 56px;
  color: var(--legacy-ink, #232323);
  font-family: inherit;
}

/* The shell lives in authored-shell.css and is shared with the Leitstand, so
   both authored screens carry identical navigation. */

/* ---------- header ---------- */

.mw-eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--legacy-blue, #1300ff);
}

.mw-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mw-lede {
  margin: 0;
  max-width: 68ch;
  font-size: 15px;
  line-height: 1.6;
  color: var(--legacy-ink-soft, #6b6560);
}

/* ---------- metrics ---------- */

.mw-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 0;
}

.mw-metric {
  background: var(--legacy-surface, #fff);
  border: 1px solid var(--legacy-line, #e7e4e0);
  border-radius: var(--legacy-radius-md, 16px);
  padding: 16px 18px;
}

.mw-metric__label {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--legacy-ink-soft, #6b6560);
}

.mw-metric__value {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.mw-metric__hint {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--legacy-ink-soft, #6b6560);
}

/* ---------- filters ---------- */

.mw-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 16px;
  align-items: end;
  background: var(--legacy-surface, #fff);
  border: 1px solid var(--legacy-line, #e7e4e0);
  border-radius: var(--legacy-radius-md, 16px);
  padding: 16px 18px;
}

.mw-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.mw-field--check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.mw-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--legacy-ink, #232323);
}

.mw-label--inline {
  font-weight: 500;
}

.mw-input {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--legacy-ink, #232323);
  background: var(--legacy-surface, #fff);
  border: 1px solid var(--legacy-line-strong, #d8d4cf);
  border-radius: var(--legacy-radius-sm, 10px);
}

.mw-check {
  width: 20px;
  height: 20px;
  accent-color: var(--legacy-blue, #1300ff);
}

/* One visible focus treatment for every interactive element. */
.mw-input:focus-visible,
.mw-check:focus-visible,
.mw-button:focus-visible,
.mw-link:focus-visible,
.mw-tablewrap:focus-visible {
  outline: 3px solid var(--legacy-blue, #1300ff);
  outline-offset: 2px;
}

/* ---------- states ---------- */

.mw-announce {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--legacy-ink-soft, #6b6560);
}

/* Keep loading perceivable to assistive technology without reintroducing the
   large visible placeholder panel removed from the Cockpit experience. */
.mw-announce--loading {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mw-state {
  margin: 0;
  background: var(--legacy-surface, #fff);
  border: 1px solid var(--legacy-line, #e7e4e0);
  border-radius: var(--legacy-radius-md, 16px);
  padding: 22px;
  font-size: 14.5px;
}

/* The error state colours the whole box, not one edge of it. */
.mw-state--error {
  border-color: var(--mw-danger);
  background: #fdf5f5;
}

.mw-state__title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.mw-state__reason,
.mw-state__hint {
  margin: 0 0 8px;
  color: var(--legacy-ink-soft, #6b6560);
  line-height: 1.55;
}

.mw-button {
  margin-top: 6px;
  min-height: 42px;
  padding: 10px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--legacy-blue, #1300ff);
  border: 1px solid transparent;
  border-radius: var(--legacy-radius-sm, 10px);
  cursor: pointer;
}

.mw-button:hover {
  background: var(--legacy-blue-hover, #0f00cc);
}

/* ---------- table ---------- */

/*
 * The wrapper is focusable so a keyboard-only user can scroll it — the exact
 * axe "scrollable-region-focusable" defect the recovered GovernanceMeetingPage
 * still has on mobile.
 */
.mw-tablewrap {
  overflow-x: auto;
  background: var(--legacy-surface, #fff);
  border: 1px solid var(--legacy-line, #e7e4e0);
  border-radius: var(--legacy-radius-md, 16px);
}

.mw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.mw-table__caption {
  padding: 16px 18px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--legacy-ink-soft, #6b6560);
}

.mw-table thead th {
  position: sticky;
  top: 0;
  background: var(--legacy-paper, #f6f4f1);
  padding: 10px 14px;
  text-align: left;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--legacy-ink, #232323);
  border-bottom: 1px solid var(--legacy-line-strong, #d8d4cf);
  white-space: nowrap;
}

.mw-table tbody td,
.mw-table tbody th {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--legacy-line, #e7e4e0);
  font-weight: 400;
}

.mw-table tbody tr:last-child td,
.mw-table tbody tr:last-child th {
  border-bottom: 0;
}

.mw-row--focused {
  background: #f6f5ff;
  outline: 3px solid var(--legacy-blue, #1300ff);
  outline-offset: -3px;
  scroll-margin-block: 24px;
}

.mw-row--focused:focus-visible {
  outline-offset: -3px;
}

.mw-row__name {
  display: block;
  font-weight: 600;
  font-size: 14.5px;
}

/* 12.5px at 5.18:1 — small, but well over the AA floor. */
.mw-row__meta {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--legacy-ink-soft, #6b6560);
}

/* Keep "3,62 %" together; a wrapped percent sign reads as a stray glyph. */
.mw-row__interest .mw-row__meta {
  white-space: nowrap;
}

.mw-amount {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mw-stage {
  font-weight: 600;
}

/*
 * Age band. The label text carries the meaning; the tint is redundant, and the
 * text colour is dark enough to pass AA on the tint on its own.
 */
.mw-band {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--legacy-ink, #232323);
  background: var(--legacy-line, #e7e4e0);
}

.mw-band--overdue {
  color: var(--legacy-warning, #855000);
  background: #fdf1dc;
}

.mw-band--critical {
  color: var(--mw-danger);
  background: #fbe4e4;
}

.mw-next {
  font-size: 13px;
  font-weight: 600;
  color: var(--legacy-blue, #1300ff);
}

.mw-next--none {
  font-weight: 400;
  color: var(--legacy-ink-soft, #6b6560);
}

.mw-link {
  color: var(--legacy-blue, #1300ff);
  font-size: 13px;
  font-weight: 650;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

.mw-link--quiet {
  font-weight: 600;
}

.mw-workflow {
  display: grid;
  grid-template-columns: max-content minmax(120px, 1fr);
  gap: 3px 8px;
  min-width: 190px;
  align-items: center;
}

.mw-workflow__status {
  display: inline-flex;
  width: max-content;
  padding: 3px 8px;
  border-radius: 999px;
  color: #30364a;
  background: #eceef4;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
}

.mw-workflow--active .mw-workflow__status {
  color: var(--legacy-blue, #1300ff);
  background: var(--legacy-blue-soft, #eceaff);
}

.mw-workflow--blocked .mw-workflow__status {
  color: #855000;
  background: #fdf1dc;
}

.mw-workflow--completed .mw-workflow__status {
  color: #197054;
  background: #e2f5ed;
}

.mw-workflow--failed .mw-workflow__status {
  color: var(--mw-danger);
  background: #fbe4e4;
}

.mw-workflow--cancelled .mw-workflow__status {
  color: #545a68;
  background: #e6e7eb;
}

.mw-workflow__label {
  min-width: 0;
  overflow: hidden;
  color: var(--legacy-ink, #232323);
  font-size: 12.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mw-workflow__detail {
  grid-column: 1 / -1;
  color: var(--legacy-ink-soft, #6b6560);
  font-size: 11.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.mw-workflow .mw-link {
  display: inline-flex;
  grid-column: 1 / -1;
  min-height: 44px;
  align-items: center;
  width: max-content;
}

/* A left rule repeats the severity for scanning; never the only cue. */
.mw-row--critical th[scope="row"] {
  box-shadow: inset 3px 0 0 var(--mw-danger);
}

.mw-row--overdue th[scope="row"] {
  box-shadow: inset 3px 0 0 var(--legacy-warning, #855000);
}

/* ---------- footnote ---------- */

.mw-footnote p {
  margin: 0;
  max-width: 76ch;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--legacy-ink-soft, #6b6560);
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .mw-root {
    padding: 20px 14px 44px;
  }

  .mw-filters {
    grid-template-columns: 1fr;
  }

  .mw-table thead th {
    position: static;
  }

  /*
   * Seven columns cannot fit a phone, so the table scrolls sideways. Pinning the
   * debtor column keeps every scrolled value attributable to a row — table
   * semantics stay intact, unlike a block-layout rewrite.
   */
  .mw-table thead th:first-child,
  .mw-table tbody th[scope="row"] {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 148px;
    background: var(--legacy-surface, #fff);
    border-right: 1px solid var(--legacy-line, #e7e4e0);
  }

  .mw-table thead th:first-child {
    background: var(--legacy-paper, #f6f4f1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mw-root * {
    transition: none !important;
    animation: none !important;
  }
}
