/* ===== Form Wizard ===== */

.wizard-progress {
  width: 100%;
  padding: 0 0 4px;
}

.wizard-steps {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.wizard-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

.wizard-step:hover {
  background: var(--panel-soft);
  color: var(--ink-2);
}

.wizard-step.active {
  background: var(--primary-bg);
  color: var(--primary);
}

.wizard-step.completed {
  color: var(--success);
}

.wizard-step .step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: var(--line);
  color: var(--muted);
  flex-shrink: 0;
  transition: all 0.15s;
}

.wizard-step.active .step-num {
  background: var(--primary);
  color: white;
}

.wizard-step.completed .step-num {
  background: var(--success);
  color: white;
}

.wizard-bar {
  width: 100%;
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.wizard-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.wizard-template-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  margin-top: 8px;
}

.wizard-template-bar select {
  flex: 1;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  font-size: 12px;
  color: var(--ink);
  outline: none;
}

.wizard-template-bar select:focus {
  border-color: var(--primary);
}

/* Template Preview Panel */
.template-preview {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  overflow: hidden;
}

.tpl-prev-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line-soft);
}

.tpl-prev-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tpl-prev-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tpl-prev-meta {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.tpl-prev-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.tpl-prev-body {
  padding: 12px 14px 4px;
  max-height: 220px;
  overflow-y: auto;
}

.tpl-prev-section {
  margin-bottom: 10px;
}

.tpl-prev-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.tpl-prev-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tpl-prev-item {
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  min-width: 0;
}

.tpl-prev-item.full {
  grid-column: 1 / -1;
}

.tpl-prev-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 2px;
}

.tpl-prev-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  word-break: break-word;
}

.tpl-prev-empty {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.tpl-prev-desc {
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.tpl-prev-foot {
  padding: 8px 14px 10px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px dashed var(--line-soft);
}

/* Template Manager Modal */
.tpl-mgr-tabs {
  display: flex;
  gap: 6px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 14px;
}

.tpl-mgr-tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.tpl-mgr-tab:hover {
  color: var(--ink);
}

.tpl-mgr-tab.active {
  background: var(--panel);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.tpl-mgr-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.tpl-mgr-tab.active .tpl-mgr-count {
  background: var(--primary-bg);
  color: var(--primary);
}

.tpl-mgr-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 2px;
}

.tpl-mgr-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.tpl-mgr-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tpl-mgr-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.tpl-mgr-info {
  min-width: 0;
  flex: 1;
}

.tpl-mgr-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.tpl-mgr-name > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tpl-mgr-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.tpl-mgr-mine {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

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

.tpl-mgr-desc {
  margin: 2px 0 4px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.tpl-mgr-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.tpl-mgr-actions .btn {
  padding: 6px 8px;
  min-height: 30px;
}

.tpl-mgr-actions .tpl-mgr-danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.tpl-mgr-foot {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 560px) {
  .tpl-prev-grid {
    grid-template-columns: 1fr;
  }
  .tpl-mgr-item {
    flex-direction: column;
    align-items: stretch;
  }
  .tpl-mgr-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}

/* Form Steps */
.form-step {
  display: none;
  animation: wizardFadeIn 0.2s ease;
}

.form-step.active {
  display: block;
}

@keyframes wizardFadeIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Wizard Navigation */
.wizard-nav {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.wizard-nav-left {
  display: flex;
  gap: 8px;
}

.wizard-nav-right {
  display: flex;
  gap: 8px;
}

/* Review Step */
.review-section {
  margin-bottom: 16px;
}

.review-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--line);
}

.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.review-item {
  padding: 8px 12px;
  background: var(--panel-soft);
  border-radius: 8px;
  border: 1px solid var(--line-soft);
}

.review-item.full {
  grid-column: 1 / -1;
}

.review-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.review-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-top: 2px;
  word-break: break-word;
}

/* Smart Suggestions */
.suggest-hint {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 1;
  pointer-events: auto;
}

.suggest-hint:hover {
  background: var(--primary);
  color: white;
}

.suggest-hint.visible {
  display: flex;
}

/* Time Conflict Warning */
.conflict-warning {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
  margin-top: 8px;
  display: none;
  align-items: center;
  gap: 6px;
}

.conflict-warning.visible {
  display: flex;
}

/* Responsive */
@media (max-width: 560px) {
  .wizard-steps {
    overflow-x: auto;
    gap: 2px;
  }
  .wizard-step {
    padding: 5px 8px;
    font-size: 11px;
  }
  .wizard-step .step-label {
    display: none;
  }
  .review-grid {
    grid-template-columns: 1fr;
  }
}
