/* ============================================================
   BARAEM GRADEFLOW — DATA QUALITY CENTRE

   The screen has one job: state whether the data can be trusted, and if not,
   say exactly what is wrong. The visual language therefore leans on state
   colour only where there is an actual problem — a clean bill of health is
   rendered almost entirely in neutral, so a real issue stands out.
   ============================================================ */

.dq-wrap { }

/* ------------------------------------------------------------
   HEADLINE
   ------------------------------------------------------------ */
.dq-sum {
  display: grid; gap: 1px; margin-block-end: var(--s-5);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  background: var(--border-soft);
  border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden;
}
.dq-stat-error { background: var(--bad-100); }
.dq-stat-warn  { background: var(--warn-100); }
.dq-stat-ok    { background: var(--surface); }
.dq-stat-error .kpi-v { color: var(--bad-700); }
.dq-stat-warn  .kpi-v { color: var(--warn-700); }

/* the clean case: one calm block, not three green cards */
.dq-clear {
  display: flex; align-items: flex-start; gap: var(--s-4);
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--ok-600);
  border-radius: var(--r-lg);
  margin-block-end: var(--s-5);
}
.dq-clear-ic {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ok-100); color: var(--ok-700);
}
.dq-clear-ic svg { width: 20px; height: 20px; }
.dq-clear h3 { margin: 0 0 var(--s-1); font-size: var(--t-15); color: var(--text); font-weight: 700; }
.dq-clear p  { margin: 0; font-size: var(--t-13); color: var(--text-soft); line-height: var(--lh-body); max-width: 82ch; }

/* ------------------------------------------------------------
   LAYOUT
   ------------------------------------------------------------ */
.dq-grid {
  display: grid; gap: var(--s-5);
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  align-items: start;
}
.dq-side { display: grid; gap: var(--s-5); }

/* ------------------------------------------------------------
   CHECK LIST
   Each row is a button: title, state, count, and the detail underneath.
   A row with zero issues is deliberately quiet — it should not compete with a
   real one for attention.
   ------------------------------------------------------------ */
.dq-list { display: grid; gap: var(--s-1); }

.dq-check {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--t-fast) var(--ease);
}
.dq-check.is-open { border-color: var(--border-strong); }

.dq-check-h {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center; gap: var(--s-3);
  width: 100%;
  padding: var(--s-3) var(--s-4);
  border: 0; background: none; cursor: pointer;
  text-align: start; font: inherit; color: inherit;
}
.dq-check-h:disabled { cursor: default; }
.dq-check-h:hover:not(:disabled) { background: var(--surface-2); }

.dq-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-mute); flex: 0 0 8px;
}
.dq-check-t {
  font-size: var(--t-13); font-weight: 600; color: var(--text);
  line-height: var(--lh-snug);
}
.dq-badge {
  font-size: var(--t-10, 10px); font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  padding: 2px var(--s-2); border-radius: var(--r-pill);
  background: var(--surface-sunk); color: var(--text-faint);
  white-space: nowrap;
}
.dq-count {
  font-size: var(--t-14); font-weight: 700; color: var(--text);
  min-width: 3ch; text-align: end;
}
.dq-caret {
  display: grid; place-items: center; color: var(--text-mute);
  transition: transform var(--t-base) var(--ease);
}
.dq-check.is-open .dq-caret { transform: rotate(180deg); }

.dq-check-d {
  margin: 0;
  padding: 0 var(--s-4) var(--s-3) calc(var(--s-4) + 8px + var(--s-3));
  font-size: var(--t-12); color: var(--text-faint); line-height: var(--lh-body);
}

/* state colouring — only where there is something to say */
.dq-error { border-inline-start: 3px solid var(--bad-600); }
.dq-error .dq-dot      { background: var(--bad-600); }
.dq-error .dq-badge    { background: var(--bad-100); color: var(--bad-700); }
.dq-error .dq-count    { color: var(--bad-700); }

.dq-warn { border-inline-start: 3px solid var(--warn-600); }
.dq-warn .dq-dot   { background: var(--warn-600); }
.dq-warn .dq-badge { background: var(--warn-100); color: var(--warn-700); }
.dq-warn .dq-count { color: var(--warn-700); }

.dq-info { border-inline-start: 3px solid var(--info-600); }
.dq-info .dq-dot   { background: var(--info-600); }
.dq-info .dq-badge { background: var(--info-100); color: var(--info-700); }
.dq-info .dq-count { color: var(--info-700); }

.dq-ok { border-inline-start: 3px solid var(--border); }
.dq-ok .dq-dot { background: var(--ok-600); opacity: .55; }
.dq-ok .dq-count { color: var(--text-mute); }
.dq-ok .dq-check-t { color: var(--text-soft); font-weight: 500; }

.dq-unknown { border-inline-start: 3px solid var(--border-strong); }
.dq-unknown .dq-dot { background: var(--text-mute); }

/* ------------------------------------------------------------
   EXPANDED SAMPLE
   ------------------------------------------------------------ */
.dq-sample { padding: 0 var(--s-4) var(--s-4); }
.dq-sample-n {
  font-size: var(--t-11); color: var(--text-mute);
  margin-block-end: var(--s-2);
}
.dq-sample-none {
  padding: var(--s-4);
  font-size: var(--t-12); color: var(--text-mute);
  text-align: center;
}

/* ------------------------------------------------------------
   COVERAGE
   ------------------------------------------------------------ */
.dq-cov { margin-block-end: var(--s-4); }
.dq-cov-fig { display: flex; flex-direction: column; gap: 2px; margin-block-end: var(--s-3); }
.dq-cov-v {
  font: 700 var(--t-30)/1 var(--font); letter-spacing: -.02em; color: var(--text);
  font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate;
}
.dq-cov-k { font-size: var(--t-12); color: var(--text-faint); }
.dq-cov-meter {
  height: 8px; border-radius: var(--r-pill);
  background: var(--surface-sunk); overflow: hidden;
}
.dq-cov-meter > i {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width var(--t-slow) var(--ease-out);
}

/* ------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------ */
@media (max-width: 1100px) {
  .dq-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .dq-check-h {
    grid-template-columns: auto 1fr auto;
    row-gap: var(--s-1);
  }
  .dq-badge { grid-column: 2; justify-self: start; }
  .dq-count { grid-row: 1; grid-column: 3; }
  .dq-caret { grid-row: 1; grid-column: 3; }
  .dq-check-d { padding-inline-start: var(--s-4); }
}

@media print {
  .dq-check-h { pointer-events: none; }
  .dq-caret { display: none; }
  .dq-sample { display: block !important; }
}
