.form-grid { display: grid; gap: 18px; }
.form-grid.compact,
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid > .wide { grid-column: 1 / -1; }
.responsive-form-grid { align-items: start; }
.form-field { display: grid; gap: 7px; }
.form-label { font-weight: 700; font-size: 13px; color: var(--text-label); }
.form-help { font-size: 12px; color: var(--muted); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { border: var(--border-line); border-radius: 5px; background: var(--surface); font: inherit; padding: 10px 12px; color: var(--text); width: 100%; box-shadow: var(--shadow-control-inset); }
input[type="checkbox"]:not(.toggle-switch-input),
input[type="radio"] {
  accent-color: var(--primary);
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin: 0;
}
input[type="checkbox"]:not(.toggle-switch-input):focus-visible,
input[type="radio"]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
textarea { resize: vertical; }

@media (max-width: 1100px) {
  .form-grid.compact.responsive-form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .form-grid.two,
  .form-grid.three,
  .form-grid.four { grid-template-columns: 1fr; }
}
.form-field:has(input:disabled, select:disabled, textarea:disabled, input[readonly], textarea[readonly]) .form-label { color: var(--control-disabled-label); }
input:disabled:not([type="checkbox"]):not([type="radio"]),
select:disabled,
textarea:disabled,
input[readonly]:not([type="checkbox"]):not([type="radio"]),
textarea[readonly] {
  border-color: var(--control-disabled-border);
  background: var(--control-disabled-bg);
  color: var(--control-disabled-text);
  box-shadow: var(--shadow-inset-highlight-muted);
  opacity: 1;
}
input:disabled:not([type="checkbox"]):not([type="radio"]),
select:disabled,
textarea:disabled {
  cursor: not-allowed;
}
input[readonly]:not(:disabled),
textarea[readonly]:not(:disabled) {
  cursor: default;
}
input:disabled::placeholder,
textarea:disabled::placeholder,
input[readonly]::placeholder,
textarea[readonly]::placeholder {
  color: var(--control-disabled-placeholder);
  opacity: 1;
}
.btn { align-items: center; border: var(--border-line-dark); border-radius: 4px; cursor: pointer; display: inline-flex; font: inherit; font-weight: 700; gap: 7px; justify-content: center; padding: 9px 14px; background: var(--control-bg); color: var(--text); box-shadow: 0 1px 2px var(--hover-tint-strong); }
.btn-primary { background: var(--green); border-color: var(--success-border); color: var(--on-accent); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-danger { background: var(--red); color: var(--on-accent); border-color: var(--danger-border-strong); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
