.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.form-field label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="search"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-ui);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-subtle);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239a9080' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  background-size: 12px 12px;
  padding-right: var(--sp-6);
}

[data-theme="light"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6258' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  background-size: 12px 12px;
}

textarea {
  resize: vertical;
  min-height: 60px;
}

.feedback {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  margin-top: var(--sp-3);
}
.feedback--success { background: var(--ok-subtle); color: var(--ok); border: 1px solid var(--ok); }
.feedback--error   { background: var(--err-subtle); color: var(--err); border: 1px solid var(--err); }
.feedback--info    { background: var(--info-subtle); color: var(--info); border: 1px solid var(--info); }
.feedback--warning { background: var(--warn-subtle); color: var(--warn); border: 1px solid var(--warn); }

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-switch .slider {
  width: 40px;
  height: 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  transition: background var(--t-fast), border-color var(--t-fast);
  position: relative;
}
.toggle-switch .slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  top: 2px;
  left: 2px;
  transition: transform var(--t-fast), background var(--t-fast);
}
.toggle-switch input:checked + .slider {
  background: var(--accent-subtle);
  border-color: var(--accent);
}
.toggle-switch input:checked + .slider::after {
  transform: translateX(18px);
  background: var(--accent);
}

/* Filters row for list pages */
.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: flex-end;
}
.filters-row label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-width: 120px;
}

/* DS form-control shorthand (reuses existing input/select styles) */
.form-control {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-ui);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-subtle);
  outline: none;
}
.form-control::placeholder {
  color: var(--text-muted);
}

/* select.form-control needs custom arrow because the `background` shorthand
   above would otherwise reset the default OS arrow that `appearance: auto`
   relied on. */
select.form-control,
select.form-control[data-theme="light"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239a9080' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  background-size: 12px 12px;
  padding-right: var(--sp-6);
}

[data-theme="light"] select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6258' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

/* Modal form layout */
.modal-form { display: flex; flex-direction: column; gap: var(--sp-3); }
.counterparty-row, .amount-row { display: flex; gap: var(--sp-3); }
.counterparty-row > label, .amount-row > label { flex: 1; }
.allocations-fieldset {
  border: 1px solid var(--border-subtle); border-radius: var(--r-md);
  padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2);
}
.alloc-row { display: flex; gap: var(--sp-2); align-items: center; }
.alloc-row input { min-width: 0; }
.t-ok { color: var(--ok); }
