/* ============================================================
   Form grid and switch
   ============================================================ */

/* Form grid (.fg) */
.fg {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--s-4) var(--s-5);
  align-items: start;
}

.fg label {
  font-size: var(--t-13);
  color: var(--ink-600);
  font-weight: var(--w-600);
  padding-top: 8px;
}

.fg .hint {
  font-size: var(--t-12);
  color: var(--ink-400);
  margin-top: 4px;
}

/* Full-width elements inside the form grid (span both columns). */
.fg__full { grid-column: 1 / -1; }

.fg__divider {
  grid-column: 1 / -1;
  border: none;
  border-top: 1px solid var(--ink-100);
  margin: var(--s-3) 0;
}

.fg__note {
  grid-column: 1 / -1;
  margin: 0 0 var(--s-2);
  color: var(--ink-400);
  font-size: var(--t-13);
}

.fg input[type="text"],
.fg input[type="email"],
.fg input[type="number"],
.fg input[type="tel"],
.fg input[type="time"],
.fg input[type="date"],
.fg input[type="datetime-local"],
.fg select,
.fg textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--ink-100);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--ink-800);
  font: inherit;
  font-size: var(--t-14);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.fg input:focus,
.fg select:focus,
.fg textarea:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: var(--shadow-ring);
}

.fg textarea {
  min-height: 120px;
  font-family: var(--font-mono);
  font-size: var(--t-13);
  line-height: 1.5;
  resize: vertical;
}

/* Toggle switch (.sw) */
.sw {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

/* Visually-hidden but a11y-tree-present, so screen readers announce
   the checkbox state and keyboard focus reaches the control. */
.sw input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.sw input:focus-visible + .sw__track {
  box-shadow: var(--shadow-ring);
}

.sw__track {
  width: 34px;
  height: 20px;
  border-radius: var(--r-pill);
  background: var(--ink-200);
  position: relative;
  transition: background var(--dur-fast);
  flex: none;
}

.sw__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: left var(--dur-fast);
  box-shadow: var(--shadow-xs);
}

.sw input:checked + .sw__track { background: var(--brand-500); }
.sw input:checked + .sw__track::after { left: 16px; }

.sw__label { font-size: var(--t-13); color: var(--ink-700); }

/* Inline error state (form validation, API errors) */
.error {
  color: var(--err-ink);
  margin-top: var(--s-3);
  font-size: var(--t-13);
}

/* Code/pre block — investigations, call detail */
.code-block {
  white-space: pre-wrap;
  overflow-x: auto;
  word-break: break-word;
  overflow-wrap: anywhere;
  background: var(--ink-025);
  border: 1px solid var(--ink-100);
  border-radius: var(--r-md);
  padding: 1rem;
  font-size: var(--t-12);
  font-family: var(--font-mono);
  line-height: 1.55;
}

/* Responsive */
@media (max-width: 860px) {
  .fg { grid-template-columns: 1fr; }
}
