/* ---------- Existing UI styles (unchanged) ---------- */
body {
  font-family: system-ui, sans-serif !important;
  background: #f5f7fa;
  margin: 0;
}
header {
  background: #0066ff;
  color: #fff;
  padding: 1rem;
  text-align: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
header h1 {
  margin: 0;
  flex: 1;
}
.header-right {
  position: absolute;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
#langSelect {
  padding: 0.3rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
}
#langSelect option {
  color: #333;
  background: #fff;
}
.admin-link {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.8rem;
  text-decoration: none;
}
.admin-link:hover {
  color: #fff;
}
.admin-status {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.8rem;
}
.admin-not-authorized {
  color: rgba(255, 180, 180, 0.9);
}

/* ---------- Node card base ---------- */
.node {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  position: relative; /* for the ::before line */
}

/* ---------- Indentation – ONE RULE ONLY ---------- */
.node .node {
  /* any node inside another node */
  margin-left: 2rem; /* step size – change as you like */
}

/* ---------- Optional left‑border line ---------- */
/*.node .node::before {*/
/*  content: "";*/
/*  position: absolute;*/
/*  top: 0;*/
/*  bottom: 0;*/
/*  left: -0.5rem;*/
/*  width: 4px;*/
/*  !*background: #0066ff;*!*/
/*  opacity: 0.15;*/
/*}*/

/* ---------- Form layout inside each node ---------- */
.nodeForm {
  display: grid;
  gap: 0.8rem;
}

/* ---------- Collapsible sections ---------- */
.form-section {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin-bottom: 0.6rem;
  overflow: hidden;
}

.form-section-header {
  background: #f5f7fa;
  padding: 0.8rem 1rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
  list-style: none;
}

.form-section-header::-webkit-details-marker {
  display: none;
}

.form-section-header::before {
  content: "▶";
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.2s;
  font-size: 0.8em;
}

.form-section[open] > .form-section-header::before {
  transform: rotate(90deg);
}

.form-section-header:hover {
  background: #e9ecef;
}

.form-section-content {
  padding: 1rem;
  display: grid;
  gap: 0.6rem;
  background: white;
}
.nodeForm textarea {
  resize: vertical;
  min-height: 60px;
}

/* ---------- Collapsed state ---------- */
.node.collapsed {
  opacity: 0.95;
}

.collapsed-indicator {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  padding: 0.6rem 0.8rem;
  margin: 0.8rem 0;
  color: #856404;
  font-size: 0.9em;
  font-style: italic;
}

/* ---------- Help icons ---------- */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #2196f3;
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.help-icon:hover {
  background: #1976d2;
  transform: scale(1.15);
}

/* ---------- Help modal ---------- */
.help-modal {
  display: flex;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.help-modal-content {
  background-color: white;
  padding: 2rem;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.help-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.help-modal-close:hover {
  color: #000;
}

.help-modal-content h3 {
  margin-top: 0;
  color: #2196f3;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.help-modal-content p {
  line-height: 1.6;
  color: #333;
  margin: 0;
}

.error-modal {
  display: flex;
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.error-modal-content {
  background-color: white;
  padding: 2rem;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  position: relative;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-top: 4px solid #dc2626;
  animation: modalSlideIn 0.3s ease;
}

.error-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.error-modal-close:hover {
  color: #000;
}

.error-modal-content h3 {
  margin-top: 0;
  color: #dc2626;
  border-bottom: 2px solid #fee2e2;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.error-modal-content p {
  line-height: 1.6;
  color: #333;
  margin: 0;
}

/* ---------- Validation messages ---------- */
.validation-container {
  margin-top: 0.8rem;
}

.validation-messages {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.validation-message {
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
  font-size: 0.9em;
  line-height: 1.4;
}

.validation-error {
  background: #fee;
  border-left: 4px solid #d32f2f;
  color: #c62828;
}

.validation-warning {
  background: #fff3cd;
  border-left: 4px solid #ff9800;
  color: #8b6914;
}

.validation-info {
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  color: #1565c0;
}

.validation-success {
  background: #e8f5e9;
  border-left: 4px solid #4caf50;
  color: #2e7d32;
}

/* ---------- Hover states ---------- */
.nodeForm button[type="submit"]:hover,
.node > button:hover {
  opacity: 0.9;
}

/* ---------- Responsive tweak ---------- */
@media (max-width: 600px) {
  .nodeForm label {
    min-width: 100px;
  }
}

/* ========== WIZARD STYLES ========== */

.wizard-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Progress bar */
.wizard-progress {
  margin-bottom: 2rem;
}

.wizard-progress-bar {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.wizard-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0066ff, #00c853);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.wizard-step-indicator {
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}

/* Step content */
.wizard-step-content {
  background: #fff;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
}

.wizard-step h2 {
  margin-top: 0;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  position: relative;
}

.wizard-step h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: #0066ff;
  border-radius: 10px;
}

.wizard-help {
  color: #555;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.wizard-info {
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  padding: 0.8rem 1rem;
  border-radius: 0 4px 4px 0;
  margin-bottom: 1.5rem;
  color: #1565c0;
  font-size: 0.95rem;
}

.wizard-info ul,
.wizard-info li {
  margin: 0.3rem 0;
  padding-left: 0.5rem;
}

.wizard-prompt {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 0.8rem 1rem;
  border-radius: 0 4px 4px 0;
  color: #856404;
  font-style: italic;
}

/* Form fields */
.wizard-field {
  margin-bottom: 1.2rem;
}

.wizard-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #333;
}

.wizard-field input,
.wizard-field select,
.wizard-field textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  box-sizing: border-box;
}

.wizard-field textarea {
  resize: vertical;
  min-height: 80px;
}

.wizard-field input:focus,
.wizard-field select:focus,
.wizard-field textarea:focus {
  outline: none;
  border-color: #0066ff;
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* Navigation buttons */
.wizard-navigation {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.wizard-btn {
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.wizard-btn-back {
  background: #6c757d;
  color: #fff;
}

.wizard-btn-back:hover {
  background: #5a6268;
}

.wizard-btn-skip {
  background: #fff;
  color: #666;
  border: 1px solid #ccc;
}

.wizard-btn-skip:hover {
  background: #f5f5f5;
}

.wizard-btn-example {
  background: #17a2b8;
  color: #fff;
}

.wizard-btn-example:hover {
  background: #138496;
}

.wizard-btn-upload {
  background: #6c5ce7;
  color: #fff;
}

.wizard-btn-upload:hover {
  background: #5b4cdb;
}

.wizard-btn-next {
  background: #0066ff;
  color: #fff;
}

.wizard-btn-next:hover {
  background: #0052cc;
}

.wizard-btn-finish {
  background: #28a745;
  color: #fff;
}

.wizard-btn-finish:hover {
  background: #218838;
}

.wizard-btn-add,
.wizard-btn-add-small {
  background: #17a2b8;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.wizard-btn-add {
  padding: 0.6rem 1.2rem;
  margin-top: 1rem;
}

.wizard-btn-add-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.wizard-btn-add:hover,
.wizard-btn-add-small:hover {
  background: #138496;
}

/* Remove button for wizard items */
.input-with-remove {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}
.input-with-remove input,
.input-with-remove > div {
  flex: 1;
}
.wizard-btn-remove {
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}
.wizard-btn-remove:hover {
  background: #c82333;
}
.wizard-btn-move {
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}
.wizard-btn-move:hover {
  background: #4f46e5;
}
.node-btn-move {
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-left: 4px;
}
.node-btn-move:hover {
  background: #4f46e5;
}

.node-btn-locate {
  background: none;
  color: #6366f1;
  border: 1px solid #6366f1;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-left: 4px;
  opacity: 0.7;
}
.node-btn-locate:hover {
  opacity: 1;
  background: #eef2ff;
}

/* skils view */
.skills-view {
  padding: 0.5rem 0;
}
.skills-help {
  color: #555;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.skills-subtask {
  margin-bottom: 1.5rem;
}
.skills-subtask-title {
  font-size: 0.95rem;
  color: #374151;
  margin: 0 0 0.5rem;
  font-weight: 600;
}
.skills-action {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  margin-bottom: 0.35rem;
}
.skills-action-label {
  flex: 1 1 200px;
  font-size: 0.85rem;
  color: #111;
}
.skills-select-label {
  font-size: 0.8rem;
  color: #555;
  white-space: nowrap;
}
.skills-skill-select,
.skills-dir-select {
  font-size: 0.82rem;
  padding: 2px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: white;
  cursor: pointer;
}
.skills-dir-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.skills-empty {
  color: #888;
  font-style: italic;
}
.skills-row {
  flex-basis: 100%;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.skills-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.8rem;
  align-items: center;
}
.skills-cb-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}
.skills-cb-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.skills-other-input {
  font-size: 0.82rem;
  padding: 2px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  margin-top: 0.2rem;
}

/* Parent goals form */
.parent-goal-item {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 0.8rem;
}

.parent-goal-item label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.4rem;
}

.parent-goal-item input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  box-sizing: border-box;
}

/* Subtasks form */
.subtasks-group {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.subtasks-group h3 {
  margin: 0 0 1rem 0;
  color: #333;
  font-size: 1rem;
}

.subtask-item {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.subtask-item input {
  flex: 2;
  padding: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
}

.subtask-item select {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
}

/* Plans form */
.plan-item {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.plan-item h3 {
  margin: 0 0 0.8rem 0;
  color: #333;
  font-size: 1rem;
}

.plan-item label {
  display: block;
  font-weight: 500;
  margin: 0.8rem 0 0.3rem 0;
  font-size: 0.95rem;
}

.plan-item textarea,
.plan-item select,
.plan-item input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  box-sizing: border-box;
}

/* Roles form */
.roles-group {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.roles-group h3 {
  margin: 0 0 0.8rem 0;
  color: #333;
  font-size: 1rem;
}

.role-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.role-item label {
  flex: 2;
  font-size: 0.95rem;
}

.role-item select {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
}

/* Criteria form */
.criteria-item {
  margin-bottom: 1rem;
}

.criteria-item label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.criteria-item textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  box-sizing: border-box;
}

/* Change items */
.change-item,
.skill-change-item,
.collaboration-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.change-item label,
.skill-change-item label,
.collaboration-item label {
  flex: 2;
  font-size: 0.95rem;
}

.change-item select,
.skill-change-item select,
.collaboration-item select {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  min-width: 120px;
}

.skill-change-item textarea {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
}

/* Stopping rules cards */
.stopping-rules {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.rule-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1rem;
  border-left: 4px solid #0066ff;
}

.rule-card h3 {
  margin: 0 0 0.5rem 0;
  color: #333;
  font-size: 1rem;
}

.rule-card p {
  margin: 0;
  color: #555;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Review summary */
.review-summary {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 6px;
  padding: 1.5rem;
}

.review-summary h3 {
  margin: 0 0 1rem 0;
  color: #2e7d32;
}

.review-summary p {
  margin: 0.5rem 0;
  color: #333;
}

/* Responsive */
@media (max-width: 600px) {
  .wizard-step-content {
    padding: 1rem;
  }

  .wizard-navigation {
    flex-direction: column;
  }

  .wizard-btn {
    width: 100%;
    text-align: center;
  }

  .subtask-item {
    flex-direction: column;
  }

  .change-item,
  .skill-change-item,
  .collaboration-item {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ========== CHART SECTION & DOWNLOAD ========== */

.chart-section {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: #28a745;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 1rem;
}

.download-btn:hover {
  background: #218838;
}

.download-btn:active {
  background: #1e7e34;
}

#chartContainer {
  padding: 0;
}

/* ========== PHASE INDICATOR ========== */
.wizard-phase {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.8rem;
  background: #f8f9fa;
  border-radius: 6px;
}

.phase-label {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: 500;
  color: #666;
  background: #fff;
  border: 1px solid #e0e0e0;
}

.phase-label.active {
  background: #0066ff;
  color: #fff;
  border-color: #0066ff;
}

.phase-arrow {
  color: #999;
  font-size: 1.2rem;
}

/* ========== VIEW TOGGLE ========== */
.view-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.view-btn {
  padding: 0.5rem 1rem;
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.view-btn:hover {
  background: #f5f5f5;
}

.view-btn.active {
  background: #0066ff;
  color: #fff;
  border-color: #0066ff;
}

/* ========== DIAGRAM HEADERS ========== */
.diagram-header {
  margin: 0 0 1rem 0;
  padding: 0.8rem 1rem;
  background: #f8f9fa;
  border-left: 4px solid #0066ff;
  color: #333;
  font-size: 1rem;
}

.diagram-container {
  overflow-x: auto;
  padding: 1rem 0;
}

.edit-form {
  display: none;
}

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

/* ========== TABLE VIEW ========== */
.table-view {
  padding: 1rem 0;
}

.table-header {
  margin: 0 0 1rem 0;
  padding: 0.8rem 1rem;
  background: #f8f9fa;
  border-left: 4px solid #0066ff;
  color: #333;
  font-size: 1rem;
}

.hta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.hta-table th,
.hta-table td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border: 1px solid #e0e0e0;
}

.hta-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.hta-table tr:hover {
  background: #f5f7fa;
}

.hta-table tr.level-0 {
  background: #1f2937;
  color: #fff;
}

.hta-table tr.level-0:hover {
  background: #374151;
}

.hta-table tr.level-1 {
  background: #e3f2fd;
}

.hta-table tr.level-2 {
  background: #fff;
}

/* ========== ACTIONS GROUP (new wizard) ========== */
.actions-group {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.actions-group h3 {
  margin: 0 0 1rem 0;
  color: #333;
  font-size: 1rem;
}

.action-item {
  margin-bottom: 0.5rem;
}

.action-item input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  box-sizing: border-box;
}

/* ========== ACTORS GROUP ========== */
.actors-group {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.actors-group h3 {
  margin: 0 0 0.8rem 0;
  color: #333;
  font-size: 1rem;
}

.actor-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.actor-item label {
  flex: 2;
  font-size: 0.95rem;
}

.actor-item select {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  min-width: 120px;
}

/* ========== TAICO CODES GROUP ========== */
.taico-group {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.taico-group h3 {
  margin: 0 0 0.8rem 0;
  color: #333;
  font-size: 1rem;
}

.taico-item {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
}

.taico-item h4 {
  margin: 0 0 0.6rem 0;
  font-size: 0.95rem;
  color: #555;
}

.taico-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
}

.taico-fields label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.3rem;
}

.taico-fields select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
}

/* ========== SUBGOAL ITEM (new wizard) ========== */
.subgoal-item {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 0.8rem;
}

.subgoal-item label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.4rem;
}

.subgoal-item input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  box-sizing: border-box;
}

/* ========== APP-LEVEL CONTROLS (Restart | Undo | Redo) ========== */
.app-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #fff;
  border-bottom: 2px solid #e9ecef;
  margin-bottom: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-btn {
  padding: 0.5rem 1.1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #555;
  font-size: 0.9rem;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.app-btn:hover:not(:disabled) {
  background: #f5f5f5;
  border-color: #999;
  color: #333;
}

.app-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Restart sits alone on the left; undo/redo are a paired group */
.app-btn-restart {
  margin-right: 0.75rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* ========== EXPORT BUTTONS ========== */
.export-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.export-buttons .download-btn {
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  background: #e2e8f0;
  color: #334155;
  transition:
    background 0.2s,
    transform 0.1s;
}

.export-buttons .download-btn:hover {
  background: #cbd5e1;
  transform: translateY(-1px);
}
