/* =============================================================================
   COMPLIANCE TAB — SOP-OPS-01 v1.2 Part 7
   Five vertically stacked recording forms.
   ============================================================================= */

.comp-page {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comp-header h2 {
  margin: 0 0 4px;
  font-size: 20px;
  color: var(--text-primary, #2B2523);
}

.comp-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted, #6B6360);
}

/* ---------- Form card ---------- */

.comp-form {
  background: #fff;
  border: 1px solid var(--color-stone, #C4BCB0);
  border-radius: 8px;
  padding: 16px 18px;
}

.comp-form__header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary, #2B2523);
}

.comp-form__help {
  margin: 6px 0 12px;
  font-size: 13px;
  color: var(--text-muted, #6B6360);
}

/* ---------- Grid: 2-column on desktop, 1-column on narrow ---------- */

.comp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  align-items: end;
}

@media (max-width: 680px) {
  .comp-grid { grid-template-columns: 1fr; }
}

.comp-col-2 {
  grid-column: 1 / -1;
}

.comp-grid label {
  display: block;
  font-size: 12px;
  color: var(--text-muted, #6B6360);
}

.comp-grid label > input,
.comp-grid label > select,
.comp-grid label > textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  box-sizing: border-box;
}

.comp-grid input[type="text"],
.comp-grid input[type="number"],
.comp-grid input[type="date"],
.comp-grid select,
.comp-grid textarea {
  padding: 7px 9px;
  font-size: 14px;
  border: 1px solid var(--color-stone, #C4BCB0);
  border-radius: 4px;
  background: #fff;
  color: var(--text-primary, #2B2523);
  font-family: inherit;
}

.comp-grid input[type="file"] {
  font-size: 13px;
  color: var(--text-muted, #6B6360);
}

.comp-grid textarea { resize: vertical; min-height: 56px; }

.comp-req { color: #C62828; margin-left: 2px; }

/* ---------- Checkboxes ---------- */

.comp-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 16px;
  padding: 6px 0;
}

@media (max-width: 680px) {
  .comp-checks { grid-template-columns: 1fr; }
}

.comp-checks label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary, #2B2523);
}

.comp-checks input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

/* ---------- Live pass/fail preview ---------- */

.comp-preview {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  background: var(--color-warm-linen, #EBE8E3);
  color: var(--text-muted, #6B6360);
  grid-column: 1 / -1;
}

.comp-preview--pass {
  background: #E8F5E9;
  color: #2D5144;
}

.comp-preview--fail {
  background: #FFEBEE;
  color: #C62828;
}

/* ---------- Actions ---------- */

.comp-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.comp-actions button {
  appearance: none;
  border: 1px solid var(--color-forest-green, #2D5144);
  background: var(--color-forest-green, #2D5144);
  color: #fff;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}
.comp-actions button:hover:not(:disabled) { background: #244035; }
.comp-actions button:disabled { opacity: 0.55; cursor: wait; }

/* ---------- Inline error ---------- */

.comp-error {
  margin-top: 8px;
  padding: 10px 12px;
  background: #FFEBEE;
  color: #C62828;
  border-radius: 6px;
  font-size: 13px;
  white-space: pre-wrap;
}

/* ---------- Toasts (separate stack from system-health) ---------- */

.comp-toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  max-width: 420px;
}

.comp-toast {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: comp-toast-in 160ms ease-out;
}

.comp-toast--success { background: #2D5144; }
.comp-toast--error   { background: #C62828; }
.comp-toast--warn    { background: #B86E00; }
.comp-toast--info    { background: #2B2523; }

@keyframes comp-toast-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
