/* Buttons, form controls, tables, chips, dialogs, toasts (the TBX kit's shapes: pills, grey cards, soft chips). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--pill);
  color: var(--text);
  font: inherit;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.btn:hover:not(:disabled) { background: var(--pill-hover); }
.btn:active:not(:disabled) { background: var(--pill-active); }
/* Disabled is a plain grey pill in secondary ink, not a faded one. */
.btn:disabled { background: var(--card); color: var(--muted); cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn-primary:hover:not(:disabled), .btn-primary:active:not(:disabled) { background: var(--accent); opacity: 0.85; }
.btn-danger { color: var(--bad-text); font-weight: 600; }
.btn-danger-quiet { background: transparent; color: var(--bad-text); }
.btn-danger-quiet:hover:not(:disabled) { background: var(--pill); }
.btn-quiet { padding: 0 8px; background: transparent; }
.btn-quiet:hover:not(:disabled) { background: var(--pill); }
.btn-wide { width: 100%; margin-top: 0.5rem; min-height: 46px; }

input[type="text"], input[type="search"], input[type="password"], input[type="number"], select, textarea {
  font: inherit;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--field);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  max-width: 100%;
}

textarea { width: 100%; padding: 8px 12px; resize: vertical; }

.field { margin-bottom: 1.15rem; border: 0; padding: 0; }
.field > label, .field > legend { display: block; font-weight: 600; margin-bottom: 0.4rem; padding: 0; }
.field input[type="text"], .field input[type="password"], .field input[type="number"], .field select { width: 100%; }
.field-check, .inline { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }
.hint { color: var(--muted); font-weight: 400; }
.field > .hint { display: block; margin-top: 0.25rem; }
.form-error { color: var(--bad-text); margin: 0.5rem 0; min-height: 1.2em; }
.form-error ul { margin: 0.25rem 0 0; padding-left: 1.2rem; }

.checklist { max-height: 320px; overflow: auto; border: 1px solid var(--field); border-radius: 10px;
  padding: 0.35rem 0.75rem; }
.check-row { display: flex; align-items: center; gap: 0.5rem; min-height: 36px; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--accent); }

/* A list or table sits on a soft grey card; hairlines between its rows. */
.table-wrap { overflow-x: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; color: var(--muted); background: var(--card); }
.table th, .table td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--card); }
.table th.num { text-align: right; }
.table .check { width: 2rem; }
.table .actions { text-align: right; white-space: nowrap; }
.table select, .table input[type="text"], .table input[type="number"] { min-height: 36px; padding: 0 10px;
  border-radius: 8px; }
.table select { max-width: 200px; }
.table input[type="checkbox"] { width: 18px; height: 18px; }

/* A chip says a status in words (never a colour alone) and is never clickable. */
.badge { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; font-size: 13px;
  border-radius: var(--radius-chip); font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge-bad { background: var(--bad-bg); color: var(--bad-text); }
.badge-info { background: var(--info-bg); color: var(--info-text); }
.badge-muted { background: var(--muted-bg); color: var(--text); }

.dialog {
  width: min(520px, calc(100vw - 2rem));
  padding: 1.75rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

/* A toast is a tinted notice with its own mark and words, as the kit's notices are. */
.toast { padding: 0.9rem 1.2rem; border-radius: 12px; background: var(--tint-ok); color: var(--text);
  box-shadow: var(--shadow); max-width: 380px; }
.toast::before { content: "\2713\00a0"; font-weight: 700; color: var(--ok-text); }
.toast-error { background: var(--tint-bad); }
.toast-error::before { content: "\2715\00a0"; color: var(--bad-text); }

.btn-group { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; }
.badges { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.actions-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.section-head { margin-top: 1.5rem; }
.section-head + p { margin-top: 0.25rem; }

/* Key figures on a grey card: a label over a value. */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.25rem 2rem; }
.card.kv { padding: 1.25rem 1.5rem; }

.cred-row { display: flex; align-items: center; gap: 0.75rem; margin: 0.6rem 0; }
.cred-row > span { width: 6rem; }
.cred-value { flex: 1; padding: 0.5rem 0.75rem; background: var(--card); border-radius: 10px; user-select: all; }

.dialog-wide { width: min(860px, calc(100vw - 2rem)); }
.dialog h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }
.report-list { max-height: 160px; overflow: auto; margin-bottom: 0.75rem; }
.kv + .btn-group { margin-top: 1rem; }

.bar-wrap { display: inline-flex; align-items: center; gap: 0.5rem; }
.bar { display: inline-block; width: 90px; height: 8px; border-radius: 4px; background: var(--muted-bg);
  overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; }
/* A meter's fill carries severity: the accent while calm, then warning, then critical. */
.bar-ok { background: var(--chart); }
.bar-info { background: var(--st-warning); }
.bar-warn { background: var(--st-critical); }
.bar-text { font-variant-numeric: tabular-nums; }
.alert-count { display: inline-flex; align-items: center; min-width: 1.5rem; height: 24px; padding: 0 8px;
  border-radius: var(--radius-chip); background: var(--warn-bg); color: var(--warn-text); font-weight: 600; }
.alerts { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--warn-text); }
.steps { padding-left: 1.2rem; }
.snippet { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background: var(--card);
  border-radius: 12px; margin: 0.75rem 0; }
.snippet code { flex: 1; user-select: all; word-break: break-all; }
