/**
 * Dokumente 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 DocumentIntakePage step numbers missed at 3.03:1.
 */

.dw-root {
  --dw-gap: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--dw-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 other authored
   screens, so all of them carry identical navigation. */

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

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

.dw-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;
}

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

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

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

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

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

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

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

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

.dw-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;
}

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

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

.dw-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);
}

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

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

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

.dw-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. */
.dw-state--error {
  border-color: #9b1c1c; /* 8.15:1 on white */
  background: #fdf5f5;
}

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

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

.dw-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;
}

.dw-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 screens still carry
 * on mobile.
 */
.dw-tablewrap {
  overflow-x: auto;
  background: var(--legacy-surface, #fff);
  border: 1px solid var(--legacy-line, #e7e4e0);
  border-radius: var(--legacy-radius-md, 16px);
}

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

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

.dw-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;
}

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

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

.dw-row__title {
  display: block;
  font-weight: 600;
  font-size: 14.5px;
}

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

/* The kind label carries the document's category as text, never colour alone. */
.dw-tag {
  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);
}

.dw-size {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dw-row__date span {
  white-space: nowrap;
}

/* The download control reads as an action: white on the brand blue, > 4.5:1. */
.dw-download {
  display: inline-block;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  color: #fff;
  background: var(--legacy-blue, #1300ff);
  border-radius: var(--legacy-radius-sm, 10px);
}

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

.dw-download--none {
  color: var(--legacy-ink-soft, #6b6560);
  background: transparent;
  font-weight: 400;
}

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

.dw-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) {
  .dw-root {
    padding: 20px 14px 44px;
  }

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

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

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

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

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