// ── Page shell ──────────────────────────────────────────────────────────────
.pie-page {
  padding: 16px;

  &__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
  }

  &__title { font-size: 1.125rem; font-weight: 600; margin: 0; }

  &__search { display: flex; gap: 8px; }

  &__input {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    min-width: 240px;

    &:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px #bfdbfe; }
  }

  &__loading, &__empty { padding: 32px; text-align: center; color: #6b7280; font-size: 0.875rem; }
  &__table-wrap { overflow-x: auto; }
}

// ── Module summary banner ───────────────────────────────────────────────────
.qc-summary {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;

  &__module {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex: 1;
    min-width: 200px;
  }

  &__id {
    font-size: 0.7rem;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 3px;
  }

  &__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;

    &--risk &__num { color: #dc2626; }
  }

  &__num { font-size: 1.5rem; font-weight: 700; line-height: 1.2; color: #1e3a5f; }
  &__label { font-size: 0.7rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; }
}

// ── Tabs ────────────────────────────────────────────────────────────────────
.qc-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 16px;
}

.qc-tab {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;

  &:hover { color: #374151; }

  &--active {
    color: #1e3a5f;
    border-bottom-color: #1e3a5f;
  }
}

// ── Variants table ──────────────────────────────────────────────────────────
.pie-table {
  width: 100%;
  border-collapse: collapse;

  th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
    vertical-align: top;
  }

  th {
    font-weight: 600;
    background: #f9fafb;
    white-space: nowrap;
    color: #374151;
  }

  &__num { text-align: right; }

  &__desc {
    max-width: 260px;
    white-space: normal;
    color: #6b7280;
    font-size: 0.8125rem;
  }

  &__row--risk { background: #fff7ed; }
}

.qc-code {
  font-size: 0.8rem;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
  color: #1e3a5f;
}

// ── Risk / status badges ────────────────────────────────────────────────────
.qc-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;

  &--risk { background: #fee2e2; color: #991b1b; }
  &--ok   { background: #dcfce7; color: #166534; }
}

// ── Test template cards ─────────────────────────────────────────────────────
.qc-templates { display: flex; flex-direction: column; gap: 12px; }

.qc-template-card {
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;

  &__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
  }

  &__title { font-weight: 600; font-size: 0.9rem; color: #111827; }

  &__precond, &__expected, &__variant {
    font-size: 0.8125rem;
    color: #4b5563;
    margin-top: 6px;
  }

  &__label { font-weight: 600; color: #374151; margin-right: 4px; }
}

.qc-complexity {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;

  &--simple  { background: #dcfce7; color: #166534; }
  &--medium  { background: #fef9c3; color: #854d0e; }
  &--complex { background: #fee2e2; color: #991b1b; }
}

.qc-auto-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: #ede9fe;
  color: #5b21b6;
  flex-shrink: 0;
}

.qc-steps {
  margin: 8px 0 8px 20px;
  padding: 0;

  li {
    font-size: 0.8125rem;
    color: #374151;
    padding: 2px 0;
    line-height: 1.5;
  }
}
