/* Data update status dashboard. Shared colors and spacing come from site.css. */

.ds-body {
  color: var(--lsf-text);
}

.ds-page {
  width: min(var(--lsf-content), calc(100% - 40px));
  margin: 0 auto;
  padding: 52px 0 72px;
}

.ds-page > * {
  min-width: 0;
}

.ds-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 32px;
  align-items: end;
  padding: 38px 0 30px;
  border-bottom: 1px solid var(--lsf-line-strong);
}

.ds-kicker,
.ds-section-kicker {
  margin: 0 0 10px;
  color: var(--lsf-brand);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ds-hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2.35rem, 6.6vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.ds-deck {
  max-width: 780px;
  margin: 24px 0 0;
  color: var(--lsf-muted);
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  line-height: 1.75;
}

.ds-overall {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--lsf-line);
  border-top: 3px solid var(--lsf-brand-bright);
  border-radius: var(--lsf-radius-lg);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--lsf-shadow-sm);
}

.ds-overall-label {
  display: block;
  margin-bottom: 12px;
  color: var(--lsf-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ds-overall p {
  margin: 14px 0 0;
  color: var(--lsf-muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.ds-overall time {
  display: block;
  margin-top: 3px;
  color: var(--lsf-ink);
  font-variant-numeric: tabular-nums;
}

.ds-status-badge,
.ds-inline-status {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  border: 1px solid var(--lsf-line-strong);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--lsf-muted);
  background: var(--lsf-surface-muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.ds-status-badge {
  min-height: 38px;
  padding: 8px 13px;
  font-size: 0.9rem;
}

.ds-status-badge::before,
.ds-inline-status::before {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.ds-status-badge.is-healthy,
.ds-inline-status.is-healthy {
  border-color: rgba(0, 168, 112, 0.32);
  color: #087854;
  background: #e8f8f2;
}

.ds-status-badge.is-warning,
.ds-inline-status.is-warning {
  border-color: rgba(237, 123, 47, 0.4);
  color: #a14a15;
  background: #fff5e9;
}

.ds-status-badge.is-danger,
.ds-inline-status.is-danger {
  border-color: rgba(227, 77, 89, 0.36);
  color: #b52f3d;
  background: #fff0f1;
}

.ds-status-badge.is-running,
.ds-inline-status.is-running {
  border-color: rgba(0, 110, 255, 0.3);
  color: var(--lsf-brand);
  background: var(--lsf-brand-wash);
}

.ds-status-badge.is-loading::before,
.ds-inline-status.is-loading::before {
  animation: ds-pulse 1.4s ease-in-out infinite;
}

@keyframes ds-pulse {
  50% { opacity: 0.28; }
}

@media (prefers-reduced-motion: reduce) {
  .ds-status-badge.is-loading::before,
  .ds-inline-status.is-loading::before {
    animation: none;
  }
}

.ds-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 0;
}

.ds-summary-card {
  display: flex;
  min-height: 142px;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--lsf-line);
  border-radius: var(--lsf-radius);
  background: var(--lsf-surface);
  box-shadow: var(--lsf-shadow-sm);
}

.ds-summary-card > span {
  color: var(--lsf-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.ds-summary-card strong {
  margin: auto 0 6px;
  color: var(--lsf-ink);
  font-size: clamp(1.8rem, 4vw, 2.65rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ds-summary-card small {
  color: var(--lsf-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.ds-alert {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid rgba(227, 77, 89, 0.32);
  border-left: 4px solid var(--lsf-negative);
  border-radius: var(--lsf-radius);
  color: #8f2530;
  background: #fff0f1;
  line-height: 1.6;
}

.ds-section {
  margin-top: 54px;
}

.ds-section-head {
  display: flex;
  gap: 28px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 20px;
}

.ds-section-head > div {
  min-width: 0;
}

.ds-section h2 {
  margin: 0;
  font-size: clamp(1.65rem, 3.2vw, 2.45rem);
  letter-spacing: -0.025em;
}

.ds-section-note {
  max-width: 780px;
  margin: 10px 0 0;
  color: var(--lsf-muted);
  line-height: 1.7;
}

.ds-result-count {
  flex: 0 0 auto;
  margin: 0;
  color: var(--lsf-muted);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.ds-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(190px, 0.42fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--lsf-line);
  border-bottom: 0;
  border-radius: var(--lsf-radius) var(--lsf-radius) 0 0;
  background: var(--lsf-surface-soft);
}

.ds-field {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--lsf-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.ds-field input,
.ds-field select,
.ds-secondary-button {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--lsf-line-strong);
  border-radius: var(--lsf-radius-sm);
  padding: 9px 12px;
  color: var(--lsf-text);
  background: var(--lsf-surface);
  font: inherit;
  font-size: 0.92rem;
}

.ds-field input::placeholder {
  color: #7b899b;
}

.ds-secondary-button {
  width: auto;
  min-width: 128px;
  cursor: pointer;
  color: var(--lsf-brand);
  font-weight: 700;
}

.ds-secondary-button:hover {
  border-color: var(--lsf-brand-bright);
  background: var(--lsf-brand-wash);
}

.ds-table-region {
  max-width: 100%;
  border: 1px solid var(--lsf-line);
  border-radius: 0 0 var(--lsf-radius) var(--lsf-radius);
  background: var(--lsf-surface);
  box-shadow: var(--lsf-shadow-sm);
}

.ds-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.86rem;
}

.ds-table th,
.ds-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--lsf-line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.ds-table th {
  color: var(--lsf-muted);
  background: var(--lsf-surface-muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.ds-table th:first-child,
.ds-table td:first-child {
  width: 28%;
}

.ds-table th:nth-child(5),
.ds-table td:nth-child(5) {
  width: 18%;
}

.ds-table tbody tr:last-child td {
  border-bottom: 0;
}

.ds-table tbody tr[data-severity="danger"] {
  background: linear-gradient(90deg, rgba(227, 77, 89, 0.055), transparent 45%);
}

.ds-table tbody tr[data-severity="warning"] {
  background: linear-gradient(90deg, rgba(237, 123, 47, 0.055), transparent 45%);
}

.ds-job-name {
  display: block;
  margin-bottom: 5px;
  color: var(--lsf-ink);
  font-size: 0.92rem;
}

.ds-job-id,
.ds-cell-note,
.ds-job-message {
  display: block;
  color: var(--lsf-muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.ds-job-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.ds-job-message {
  margin-top: 7px;
}

.ds-time {
  color: var(--lsf-text);
  font-size: 0.8rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.ds-loading-row td {
  height: 88px;
  color: var(--lsf-muted);
  text-align: center;
  vertical-align: middle;
}

.ds-empty {
  margin: 14px 0 0;
  padding: 18px;
  border: 1px dashed var(--lsf-line-strong);
  border-radius: var(--lsf-radius);
  color: var(--lsf-muted);
  background: var(--lsf-surface);
  text-align: center;
}

.ds-run-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ds-run-card {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(120px, 0.38fr) minmax(210px, 1fr);
  gap: 16px;
  align-items: center;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--lsf-line);
  border-left: 3px solid var(--lsf-line-strong);
  border-radius: var(--lsf-radius);
  background: var(--lsf-surface);
  box-shadow: var(--lsf-shadow-sm);
}

.ds-run-card.is-danger { border-left-color: var(--lsf-negative); }
.ds-run-card.is-warning { border-left-color: var(--lsf-warning); }
.ds-run-card.is-healthy { border-left-color: var(--lsf-positive); }
.ds-run-card.is-running { border-left-color: var(--lsf-brand-bright); }

.ds-run-title {
  min-width: 0;
}

.ds-run-title strong {
  display: block;
  color: var(--lsf-ink);
  overflow-wrap: anywhere;
}

.ds-run-title small,
.ds-run-meta,
.ds-run-message {
  color: var(--lsf-muted);
  font-size: 0.77rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.ds-run-meta time {
  display: block;
  color: var(--lsf-text);
  font-variant-numeric: tabular-nums;
}

.ds-dataset-head {
  align-items: end;
}

.ds-dataset-search {
  width: min(100%, 310px);
  flex: 0 0 310px;
}

.ds-dataset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ds-dataset-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--lsf-line);
  border-radius: var(--lsf-radius-lg);
  background: var(--lsf-surface);
  box-shadow: var(--lsf-shadow-sm);
}

.ds-dataset-card-head {
  display: flex;
  gap: 14px;
  align-items: start;
  justify-content: space-between;
}

.ds-dataset-card h3 {
  margin: 0;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.ds-dataset-id {
  display: block;
  margin-top: 5px;
  color: var(--lsf-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.ds-dataset-description {
  margin: 16px 0;
  color: var(--lsf-text);
  line-height: 1.65;
}

.ds-dataset-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

.ds-dataset-meta div {
  min-width: 0;
  padding: 10px;
  background: var(--lsf-surface-muted);
}

.ds-dataset-meta dt,
.ds-definition h4 {
  margin: 0 0 5px;
  color: var(--lsf-muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ds-dataset-meta dd {
  margin: 0;
  color: var(--lsf-ink);
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ds-definition {
  margin-top: 12px;
  padding: 13px 14px;
  border-left: 3px solid var(--lsf-brand-bright);
  background: var(--lsf-surface-soft);
}

.ds-definition.is-caveat {
  border-left-color: var(--lsf-warning);
  background: #fff8ef;
}

.ds-definition p {
  margin: 0;
  color: var(--lsf-text);
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.ds-footer {
  display: flex;
  gap: 24px;
  align-items: start;
  justify-content: space-between;
  margin-top: 58px;
  padding-top: 22px;
  border-top: 1px solid var(--lsf-line-strong);
  color: var(--lsf-muted);
  font-size: 0.8rem;
  line-height: 1.65;
}

.ds-footer p {
  margin: 0;
}

.ds-footer time {
  color: var(--lsf-text);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 920px) {
  .ds-page {
    width: min(100% - 32px, var(--lsf-content));
    padding-top: 28px;
  }

  .ds-hero {
    grid-template-columns: 1fr;
  }

  .ds-overall {
    width: min(100%, 520px);
  }

  .ds-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .ds-secondary-button {
    width: 100%;
  }

  .ds-run-card {
    grid-template-columns: minmax(0, 1fr) minmax(170px, 0.5fr);
  }

  .ds-run-message {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .ds-page {
    width: min(100% - 24px, var(--lsf-content));
    padding-bottom: 48px;
  }

  .ds-hero {
    gap: 24px;
    padding-top: 26px;
  }

  .ds-hero h1 {
    font-size: clamp(2.25rem, 13vw, 3.7rem);
  }

  .ds-summary-card {
    min-height: 126px;
    padding: 16px;
  }

  .ds-section {
    margin-top: 44px;
  }

  .ds-section-head,
  .ds-dataset-head,
  .ds-footer {
    display: grid;
    gap: 14px;
  }

  .ds-result-count {
    justify-self: start;
  }

  .ds-filters {
    grid-template-columns: 1fr;
    border-bottom: 1px solid var(--lsf-line);
    border-radius: var(--lsf-radius);
  }

  .ds-table-region {
    margin-top: 12px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .ds-table,
  .ds-table tbody,
  .ds-table tr,
  .ds-table td {
    display: block;
    width: 100% !important;
  }

  .ds-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .ds-table tr {
    margin-bottom: 12px;
    padding: 6px 14px;
    border: 1px solid var(--lsf-line);
    border-left: 3px solid var(--lsf-line-strong);
    border-radius: var(--lsf-radius);
    background: var(--lsf-surface);
    box-shadow: var(--lsf-shadow-sm);
  }

  .ds-table tr[data-severity="danger"] { border-left-color: var(--lsf-negative); }
  .ds-table tr[data-severity="warning"] { border-left-color: var(--lsf-warning); }
  .ds-table tr[data-severity="healthy"] { border-left-color: var(--lsf-positive); }
  .ds-table tr[data-severity="running"] { border-left-color: var(--lsf-brand-bright); }

  .ds-table td {
    display: grid;
    grid-template-columns: minmax(88px, 0.34fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 10px 0;
  }

  .ds-table td::before {
    color: var(--lsf-muted);
    content: attr(data-label);
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .ds-loading-row td {
    display: block;
    height: auto;
    padding: 18px 0;
  }

  .ds-loading-row td::before {
    content: none;
  }

  .ds-run-card {
    grid-template-columns: 1fr;
  }

  .ds-run-message {
    grid-column: auto;
  }

  .ds-dataset-search {
    width: 100%;
    flex-basis: auto;
  }

  .ds-dataset-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .ds-summary {
    grid-template-columns: 1fr;
  }

  .ds-summary-card {
    min-height: 110px;
  }

  .ds-dataset-card {
    padding: 18px;
  }

  .ds-dataset-card-head {
    display: grid;
  }

  .ds-dataset-meta {
    grid-template-columns: 1fr;
  }
}
