.form-shell {
  max-width: 760px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

/* ── Form Hero ── */

.form-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 28px 28px;
  border-radius: var(--radius-lg);
  color: #fff;
  background: linear-gradient(135deg, var(--navy) 0%, #2f2d72 58%, #3d1e6e 100%);
  box-shadow: var(--shadow-md);
  text-align: left;
}

.form-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.12), transparent 22%),
    radial-gradient(circle at 0% 100%, rgba(0, 201, 167, 0.14), transparent 30%);
  pointer-events: none;
}

.form-hero-icon {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  color: #fff;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.form-hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 6px;
}

.form-hero-title {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.form-hero-lead {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  line-height: 1.55;
}

/* Form hero variants */
.form-hero--tasks {
  background: linear-gradient(135deg, var(--navy) 0%, #2f2d72 58%, #3d1e6e 100%);
}

.form-hero--habits {
  background: linear-gradient(135deg, #065a4e 0%, #039c82 50%, var(--mint) 100%);
}

.form-hero--habits::before {
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.14), transparent 24%),
    radial-gradient(circle at 5% 90%, rgba(0, 100, 80, 0.2), transparent 30%);
}

.form-hero--themes {
  background: linear-gradient(135deg, #3d1e6e 0%, #7b4bb5 50%, #c06040 100%);
}

.form-hero--themes::before {
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 179, 71, 0.16), transparent 26%),
    radial-gradient(circle at 5% 90%, rgba(108, 99, 255, 0.14), transparent 30%);
}

/* ── Color Picker ── */

.color-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.color-picker-option {
  position: relative;
}

.color-picker-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.color-picker-swatch {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--swatch-color);
  border: 3px solid transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.color-picker-swatch:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.color-picker-check {
  color: #fff;
  font-size: 16px;
  opacity: 0;
  transition: opacity 140ms ease;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.color-picker-option input:checked + .color-picker-swatch {
  border-color: var(--text);
  transform: scale(1.12);
  box-shadow:
    0 0 0 3px var(--surface),
    0 0 0 5px var(--swatch-color),
    0 6px 20px color-mix(in srgb, var(--swatch-color) 40%, transparent);
}

.color-picker-option input:checked + .color-picker-swatch .color-picker-check {
  opacity: 1;
}

.color-picker-swatch--random {
  background: conic-gradient(
    from 0deg,
    #E74C3C, #F39C12, #2ECC71, #3498DB, #9B59B6, #E74C3C
  );
  color: #fff;
  font-size: 18px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.color-picker-option input:checked + .color-picker-swatch--random {
  border-color: var(--text);
  box-shadow:
    0 0 0 3px var(--surface),
    0 0 0 5px var(--accent),
    0 6px 20px rgba(108, 99, 255, 0.3);
}

.item-form {
  display: grid;
  gap: 14px;
}

.form-section {
  display: grid;
  gap: 16px;
  padding: 20px 22px;
  background: linear-gradient(180deg, var(--surface), var(--bg-tinted));
}

.form-feedback {
  display: grid;
  gap: 10px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.section-header i {
  color: var(--accent);
}

.section-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-group {
  display: grid;
  gap: 8px;
}

.form-group label,
.form-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.form-hint,
.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.field-error,
.form-error {
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
}

.field-error {
  margin-top: 2px;
}

.form-error {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 107, 107, 0.24);
  background: rgba(255, 107, 107, 0.08);
}

.input-control.error,
.textarea-control.error,
.select-control.error {
  border-color: rgba(255, 107, 107, 0.4);
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.1);
}

.schedule-config-block.error,
.selection-grid.error {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 107, 107, 0.24);
  background: rgba(255, 107, 107, 0.06);
}

.selection-grid {
  display: grid;
  gap: 10px;
}

.selection-grid.themes {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.selection-grid.form-theme-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.selection-grid.priority {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.selection-option {
  position: relative;
}

.selection-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.selection-card {
  min-height: 104px;
  display: grid;
  gap: 8px;
  justify-items: center;
  align-content: center;
  padding: 16px 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  text-align: center;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

.selection-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.selection-option input:checked + .selection-card {
  border-color: rgba(108, 99, 255, 0.32);
  box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.1);
  background: var(--ambient-accent);
}

.selection-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.selection-title {
  font-size: 12px;
  font-weight: 700;
}

.selection-grid.form-theme-grid .selection-card {
  min-height: 112px;
  padding-inline: 18px;
}

.selection-grid.form-theme-grid .selection-title {
  max-width: 100%;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.selection-meta {
  color: var(--muted);
  font-size: 11px;
}

.priority-low .selection-icon {
  color: var(--muted);
}

.priority-medium .selection-icon {
  color: var(--warn);
}

.priority-high .selection-icon {
  color: var(--danger);
}

.form-inline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.schedule-config-block {
  display: none;
}

.schedule-config-block.is-visible {
  display: block;
}

.schedule-helper {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-loading {
  opacity: 0.72;
  pointer-events: none;
}

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 16px;
}

.alert i {
  flex: 0 0 auto;
  line-height: 1;
}

.alert[hidden] {
  display: none !important;
}

.alert-error {
  color: #c93d3d;
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.22);
}

@media (max-width: 760px) {
  .form-hero {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 12px;
    padding: 22px 20px;
    text-align: center;
  }

  .form-hero-title {
    font-size: 26px;
  }

  .form-section {
    padding: 18px;
  }

  .selection-grid.themes,
  .selection-grid.priority,
  .form-inline-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .action-buttons {
    width: 100%;
  }

  .action-buttons .btn,
  .form-actions > .btn {
    width: 100%;
  }
}
