/* AGHBT wizard components on Tailwind CSS */
[x-cloak] {
  display: none !important;
}

:root {
  --aghbt-accent: #0f5c4c;
  --aghbt-accent-hover: #0c4a3d;
  --wizard-field-font: 0.875rem;
  --wizard-field-line: 1.35;
  --wizard-control-h: 2rem;
  --wizard-gap-xs: 0.2rem;
  --wizard-gap-sm: 0.35rem;
  --wizard-gap-md: 0.5rem;
  --wizard-pad-sm: 0.75rem 0.85rem;
  --wizard-pad-xs: 0.5rem 0.65rem;
}

.wizard-main {
  max-width: 48rem;
}

#wizard .mb-3 { margin-bottom: var(--wizard-gap-md) !important; }
#wizard .mb-2 { margin-bottom: var(--wizard-gap-sm) !important; }
#wizard .mb-0 { margin-bottom: 0 !important; }
#wizard .mt-3 { margin-top: var(--wizard-gap-md) !important; }
#wizard .mt-2 { margin-top: var(--wizard-gap-sm) !important; }
#wizard .mt-0 { margin-top: 0 !important; }

.wizard-step-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 var(--wizard-gap-sm);
  color: #111827;
}

.wizard-subtitle {
  font-size: var(--wizard-field-font);
  font-weight: 600;
  margin: 0;
  color: #111827;
}

.wizard-hint {
  font-size: var(--wizard-field-font);
  line-height: var(--wizard-field-line);
  color: #6b7280;
}

.wizard-msgs {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--wizard-gap-sm);
}

.wizard-msg {
  font-size: var(--wizard-field-font);
}

.wizard-msg-ok { color: #059669; }
.wizard-msg-err { color: #dc2626; }

.wizard-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  padding: var(--wizard-pad-sm);
}

.step-progress-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.15rem;
  scrollbar-width: thin;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

.step-pill-active {
  background: var(--aghbt-accent);
  border-color: var(--aghbt-accent);
  color: #fff;
}

@media (max-width: 639px) {
  .step-title-long { display: none; }
}

.wizard-section {
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: var(--wizard-pad-xs);
  margin-bottom: var(--wizard-gap-sm);
  background: #fff;
}

.wizard-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--aghbt-accent);
  margin: 0 0 var(--wizard-gap-xs);
}

.wizard-form .form-label,
#wizard .form-label {
  font-weight: 500;
  font-size: var(--wizard-field-font);
  line-height: var(--wizard-field-line);
  color: #374151;
  margin-bottom: 0;
}

.wizard-field {
  display: grid;
  grid-template-columns: minmax(5.75rem, 8.5rem) minmax(0, 1fr);
  align-items: center;
  column-gap: var(--wizard-gap-sm);
  row-gap: var(--wizard-gap-xs);
  margin-bottom: var(--wizard-gap-sm);
}

.wizard-field:last-child { margin-bottom: 0; }

.wizard-field > input,
.wizard-field > select,
.wizard-field > textarea,
.wizard-field > .wizard-inline,
.wizard-field > .wizard-check {
  min-width: 0;
  margin: 0;
}

.wizard-field:has(textarea) { align-items: start; }
.wizard-field:has(textarea) > .form-label { padding-top: 0.2rem; }

#wizard .wizard-field input,
#wizard .wizard-field select,
#wizard input:not([type="checkbox"]):not([type="radio"]),
#wizard select,
#wizard textarea {
  width: 100%;
  max-width: 100%;
  font-size: var(--wizard-field-font) !important;
  line-height: var(--wizard-field-line);
  min-height: var(--wizard-control-h);
  padding: 0.3rem 0.55rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background: #fff;
  color: #111827;
}

#wizard input:focus,
#wizard select:focus,
#wizard textarea:focus {
  outline: 2px solid rgb(15 92 76 / 0.25);
  border-color: var(--aghbt-accent);
}

#wizard .field-sm {
  width: auto;
  max-width: 8rem;
}

#wizard .field-md {
  width: 100%;
  max-width: 11rem;
}

#wizard textarea.config-json {
  min-height: 9rem;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
}

.wizard-inline {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wizard-gap-sm);
  align-items: center;
}

.wizard-check {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--wizard-field-font);
  line-height: var(--wizard-field-line);
  color: #374151;
  cursor: pointer;
}

.wizard-check input[type="checkbox"],
.wizard-check input[type="radio"] {
  width: auto;
  min-height: unset;
  padding: 0;
  margin: 0;
}

.wizard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--wizard-gap-sm);
}

.wizard-info-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wizard-gap-xs) 1rem;
  padding: var(--wizard-pad-xs);
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  font-size: var(--wizard-field-font);
  margin-bottom: var(--wizard-gap-sm);
}

.wizard-info-item strong { color: var(--aghbt-accent); }

.date-preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wizard-gap-xs);
  margin-bottom: var(--wizard-gap-sm);
}

.date-preset-pills .wizard-btn.active {
  background: var(--aghbt-accent);
  border-color: var(--aghbt-accent);
  color: #fff;
}

.wizard-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--wizard-gap-sm);
}

@media (max-width: 639px) {
  .wizard-pair { grid-template-columns: 1fr; }
}

.wizard-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wizard-gap-xs);
}

.wizard-chip-grid .wizard-chip {
  padding: 0.2rem 0.5rem 0.2rem 0.35rem;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  background: #fff;
}

.wizard-chip-grid .wizard-chip:has(input:checked) {
  font-weight: 600;
  color: var(--aghbt-accent);
}

.wizard-item-card {
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: var(--wizard-pad-xs);
  margin-bottom: var(--wizard-gap-xs);
  background: #f9fafb;
}

.wizard-item-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: var(--wizard-gap-xs);
}

.wizard-cond-grid {
  display: flex;
  flex-direction: column;
  gap: var(--wizard-gap-xs);
}

.wizard-cond-grid .wizard-field {
  margin-bottom: 0;
  grid-template-columns: minmax(4.25rem, 5.5rem) minmax(0, 1fr);
}

.wizard-proximity-row { margin-top: var(--wizard-gap-xs); }
.wizard-proximity-row .wizard-field {
  grid-template-columns: minmax(3rem, 4rem) minmax(0, 1fr);
}

.wizard-nav {
  margin-top: var(--wizard-gap-md);
  display: flex;
  flex-wrap: wrap;
  gap: var(--wizard-gap-sm);
}

@media (min-width: 640px) {
  .wizard-nav .wizard-nav-back { order: 1; }
  .wizard-nav .wizard-nav-next { order: 2; }
}

@media (max-width: 639px) {
  .wizard-nav { flex-direction: column; }
  .wizard-nav .wizard-nav-next { order: 1; }
  .wizard-nav .wizard-nav-back { order: 2; }
}

@media (max-width: 639px) {
  .wizard-nav .wizard-btn { width: 100%; }
  .wizard-card { padding: var(--wizard-pad-xs); }
  #wizard textarea.config-json { min-height: 7rem; }
}

.wizard-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--wizard-control-h);
  padding: 0.35rem 0.7rem;
  font-size: var(--wizard-field-font);
  line-height: var(--wizard-field-line);
  font-weight: 500;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.wizard-btn-primary {
  background: var(--aghbt-accent);
  color: #fff;
}

.wizard-btn-primary:hover { background: var(--aghbt-accent-hover); }
.wizard-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.wizard-btn-secondary {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

.wizard-btn-secondary:hover { background: #e5e7eb; }

.wizard-btn-outline {
  background: #fff;
  border-color: #d1d5db;
  color: #374151;
}

.wizard-btn-outline:hover { background: #f9fafb; }

.wizard-btn-danger {
  background: #fff;
  border-color: #fca5a5;
  color: #b91c1c;
}

.wizard-btn-danger:hover { background: #fef2f2; }
