/* Field atom — component-specific styles */
.field-stage {
  align-items: flex-start;
}

.field-showcase {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 800px;
}

.field-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-xs);
}

.field-panel--wide {
  grid-column: 1 / -1;
}

.field-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.field-panel__header h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: -0.012em;
}

.field-panel__header p {
  margin-top: 2px;
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1.45;
}

.field-panel__tag {
  flex: none;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.field-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.field-item--horizontal {
  flex-direction: row;
  align-items: flex-start;
}

.field-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  line-height: 1.375;
}

.field-content--split {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.field-label,
.field-title {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  color: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.375;
  user-select: none;
}

.field-required {
  margin-left: -5px;
  color: var(--destructive);
}

.field-description {
  color: var(--muted-foreground);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--destructive);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
}

.field-error svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field-control {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--input);
  border-radius: 8px;
  outline: none;
  background: transparent;
  color: var(--foreground);
  box-shadow: 0 0 0 0 transparent;
  font-size: 14px;
  line-height: 1.4;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.field-control::placeholder {
  color: var(--muted-foreground);
  opacity: 1;
}

.field-control:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--input), var(--foreground) 15%);
}

.field-control:focus-visible {
  border-color: var(--ring);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent);
}

.field-control[aria-invalid="true"] {
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--destructive) 20%, transparent);
}

.field-control:disabled {
  cursor: not-allowed;
  background: color-mix(in srgb, var(--input) 50%, transparent);
  opacity: .5;
}

.field-item--disabled > :not(.field-control) {
  opacity: .5;
}

.field-textarea {
  min-height: 72px;
  height: auto;
  padding-block: 8px;
  resize: vertical;
}

.field-select-wrap {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.field-select-wrap::after {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  color: var(--muted-foreground);
  content: "";
  pointer-events: none;
  transform: translateY(-65%) rotate(45deg);
}

.field-select {
  appearance: none;
  padding-right: 30px;
  cursor: pointer;
}

.field-set {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-set--compact {
  gap: 12px;
}

.field-legend {
  margin: 0 0 6px;
  padding: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
}

.field-legend--label {
  margin-bottom: 0;
  font-size: 14px;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.field-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-check-row,
.field-radio-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  cursor: pointer;
  font-size: 14px;
  line-height: 20px;
  user-select: none;
}

.field-check,
.field-radio,
.field-switch-input,
.field-choice__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.field-check__box,
.field-radio__dot {
  display: grid;
  width: 16px;
  height: 16px;
  flex: none;
  place-items: center;
  border: 1px solid var(--input);
  background: transparent;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.field-check__box {
  border-radius: 4px;
}

.field-check__box svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.field-check:checked + .field-check__box {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
}

.field-check:checked + .field-check__box svg {
  opacity: 1;
}

.field-check:focus-visible + .field-check__box,
.field-radio:focus-visible + .field-radio__dot,
.field-switch-input:focus-visible + .field-switch,
.field-choice__input:focus-visible ~ .field-choice__marker {
  border-color: var(--ring);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent);
}

.field-check-row--disabled {
  cursor: not-allowed;
  opacity: .5;
}

.field-radio__dot {
  border-radius: 50%;
}

.field-radio__dot::after {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  content: "";
  opacity: 0;
}

.field-radio:checked + .field-radio__dot {
  border-color: var(--primary);
}

.field-radio:checked + .field-radio__dot::after {
  opacity: 1;
}

.field-switch {
  position: relative;
  display: block;
  width: 32px;
  height: 18px;
  flex: none;
  margin-top: 1px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--input);
  cursor: pointer;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}

.field-switch span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--background);
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease;
}

.field-switch-input:checked + .field-switch {
  background: var(--primary);
}

.field-switch-input:checked + .field-switch span {
  transform: translateX(14px);
}

.field-value {
  color: var(--muted-foreground);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.field-slider {
  width: 100%;
  height: 16px;
  margin: 0;
  appearance: none;
  outline: none;
  background: transparent;
  cursor: pointer;
}

.field-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--primary) 0 75%, var(--secondary) 75% 100%);
}

.field-slider::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -6px;
  appearance: none;
  border: 1px solid var(--primary);
  border-radius: 50%;
  background: var(--background);
  box-shadow: var(--shadow-xs);
}

.field-slider::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--secondary);
}

.field-slider::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--primary);
}

.field-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 1px solid var(--primary);
  border-radius: 50%;
  background: var(--background);
  box-shadow: var(--shadow-xs);
}

.field-slider:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent);
}

.field-separator {
  position: relative;
  display: grid;
  height: 20px;
  margin-block: -8px;
  place-items: center;
  color: var(--muted-foreground);
  font-size: 12px;
}

.field-separator::before {
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  background: var(--border);
  content: "";
}

.field-separator span {
  position: relative;
  padding-inline: 8px;
  background: var(--card);
}

.field-responsive-group {
  container-type: inline-size;
}

.field-item--responsive {
  align-items: stretch;
}

.field-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.field-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding-inline: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  appearance: none;
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: box-shadow 150ms ease, transform 80ms ease;
}

.field-button:hover {
  background: var(--muted);
}

.field-button:focus-visible {
  border-color: var(--ring);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent);
}

.field-button:active {
  transform: translateY(1px);
}

.field-button--primary {
  border-color: transparent;
  background: var(--primary);
  color: var(--primary-foreground);
}

.field-button--primary:hover {
  background: color-mix(in srgb, var(--primary) 82%, var(--background));
}

.field-set--choice {
  gap: 12px;
}

.field-choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.field-choice:hover {
  background: color-mix(in srgb, var(--muted) 55%, transparent);
}

.field-choice:has(.field-choice__input:checked) {
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}

.field-choice__marker {
  display: grid;
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
  place-items: center;
  border: 1px solid var(--input);
  border-radius: 50%;
}

.field-choice__marker::after {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  content: "";
  opacity: 0;
}

.field-choice__input:checked ~ .field-choice__marker {
  border-color: var(--primary);
}

.field-choice__input:checked ~ .field-choice__marker::after {
  opacity: 1;
}

@container (min-width: 36rem) {
  .field-item--responsive {
    flex-direction: row;
    align-items: center;
    gap: 24px;
  }

  .field-item--responsive > .field-content {
    flex: 1 1 50%;
  }

  .field-item--responsive > .field-control,
  .field-item--responsive > .field-select-wrap {
    flex: 0 1 50%;
    width: 50%;
  }
}

@media (prefers-color-scheme: dark) {
  .field-control {
    background: color-mix(in srgb, var(--input) 30%, transparent);
  }

  .field-control:disabled {
    background: color-mix(in srgb, var(--input) 80%, transparent);
  }

  .field-check__box,
  .field-radio__dot,
  .field-switch {
    background-color: color-mix(in srgb, var(--input) 30%, transparent);
  }

  .field-choice:has(.field-choice__input:checked) {
    border-color: color-mix(in srgb, var(--primary) 20%, transparent);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
  }
}

@media (max-width: 760px) {
  .field-showcase {
    grid-template-columns: minmax(0, 1fr);
    max-width: 430px;
  }

  .field-panel--wide {
    grid-column: auto;
  }
}

@media (max-width: 420px) {
  .field-panel {
    padding: 16px;
  }

  .field-panel__header {
    gap: 10px;
  }

  .field-panel__tag {
    display: none;
  }

  .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-actions {
    justify-content: stretch;
  }

  .field-actions .field-button {
    flex: 1;
  }
}
