.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.widget-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.widget-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 0 0 14px;
}

/* Fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-label {
  font-size: 12.5px;
  color: var(--text-dim);
}

.field-hint {
  font-size: 11.5px;
  color: var(--text-faint);
  align-self: flex-end;
}

.field-error {
  font-size: 11.5px;
  color: #f0708a;
}

.field-spacer {
  height: 6px;
}

.input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 9px 10px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.input::placeholder {
  color: var(--text-faint);
}

.input:focus {
  border-color: var(--accent);
}

.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.input--error {
  border-color: #f0708a;
}

.textarea {
  resize: vertical;
  min-height: 72px;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5L5 6.5L8 3.5' stroke='%239297a3' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.select[multiple] {
  background-image: none;
  padding-right: 10px;
}

/* Checkbox / radio */
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 10px;
  user-select: none;
}

.check:last-of-type {
  margin-bottom: 0;
}

.check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.check-box {
  width: 17px;
  height: 17px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.check-box--radio {
  border-radius: 50%;
}

.check input:checked + .check-box {
  background: var(--accent);
  border-color: var(--accent);
}

.check input:checked + .check-box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #0e0f12;
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg);
}

.check input:checked + .check-box--radio::after {
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border: none;
  background: #0e0f12;
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(0);
}

.check input:disabled + .check-box {
  opacity: 0.4;
  cursor: not-allowed;
}

.check input:disabled ~ * {
  cursor: not-allowed;
}

/* Toggle switch */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  padding: 8px 0;
}

.switch {
  position: relative;
  width: 36px;
  height: 20px;
  display: inline-block;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.15s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d8dae0;
  transition: transform 0.15s ease;
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
  background: #0e0f12;
}

/* File upload */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 26px 14px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.dropzone-icon {
  font-size: 18px;
  color: var(--text-dim);
}

.dropzone-text {
  font-size: 13px;
  color: var(--text-dim);
}

.dropzone-text strong {
  color: var(--accent);
  font-weight: 600;
}

.dropzone-filename {
  font-size: 12px;
  color: var(--text-faint);
}

/* Buttons */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  color: #0e0f12;
}

.btn--primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn--secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn--danger {
  background: transparent;
  border-color: #f0708a;
  color: #f0708a;
}

.btn--danger:hover:not(:disabled) {
  background: rgba(240, 112, 138, 0.1);
}