*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", Arial, sans-serif;
    background: #F0F4F8;
    min-height: 100vh;
    color: #2D3748;
  }

  /* ── Header ── */
  .app-header {
    background: #1E2D5A;
    color: #fff;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
    position: sticky; top: 0; z-index: 100;
  }
  .app-header h1 { font-size: 16px; font-weight: 700; letter-spacing: .04em; }
  .app-header .tagline { font-size: 13px; color: #fff; margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
  .header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
  .btn-help {
  background: rgba(255,255,255,.18);
  color: #FFFFFF;
  border: 1px solid rgba(255,255,255,.32);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.btn-help:hover {
  background: rgba(255,255,255,.28);
  color: #fff;
}
.btn-help .help-badge {
  font-size: 13px;
  line-height: 1;
}

  .btn {
    padding: 6px 14px; border-radius: 6px; border: none; cursor: pointer;
    font-size: 12px; font-weight: 600; transition: all .15s;
  }
  .btn-primary { background: #F5A623; color: #1E2D5A; }
  .btn-primary:hover { background: #E09415; }
  .btn-secondary { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.3); }
  .btn-secondary:hover { background: rgba(255,255,255,.25); }
  .btn-danger { background: #E53E3E; color: #fff; }
  .btn-danger:hover { background: #C53030; }
  .btn-outline { background: transparent; border: 1.5px solid #CBD5E0; color: #4A5568; }
  .btn-outline:hover { background: #EDF2F7; }
  .btn-sm { padding: 4px 10px; font-size: 11px; }
  .btn-xs { padding: 2px 8px; font-size: 10px; border-radius: 4px; }

  /* ── Layout ── */
  .main-layout {
    display: flex;
    height: calc(100vh - 56px);
  }

  /* ── Sidebar ── */
  .sidebar {
    width: 320px;
    min-width: 320px;
    background: #fff;
    border-right: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .sidebar-section {
    padding: 16px 18px;
    border-bottom: 1px solid #E2E8F0;
  }
  .sidebar-section h3 {
    font-size: 13px;
    font-weight: 700;
    color: #1E2D5A;
    letter-spacing: .02em;
    margin-bottom: 12px;
  }
  .field-group { margin-bottom: 12px; }
  .field-group label { display: block; font-size: 12px; color: #718096; margin-bottom: 4px; font-weight: 600; }
  .field-group input, .field-group textarea, .field-group select {
    width: 100%; padding: 8px 10px; border: 1.5px solid #CBD5E0; border-radius: 6px;
    font-size: 13px; font-family: inherit; color: #2D3748;
    transition: border-color .15s;
    background: #FAFAFA;
  }
  .field-group input:focus, .field-group textarea:focus {
    outline: none; border-color: #1E2D5A; background: #fff;
  }
  .field-group textarea { resize: vertical; min-height: 60px; }

  .robot-list { flex: 1; overflow-y: auto; padding: 8px; }
  .robot-item {
    padding: 10px 12px; border-radius: 8px; cursor: pointer;
    margin-bottom: 4px; border: 1.5px solid transparent;
    transition: all .15s; position: relative;
  }
  .robot-item:hover { background: #EDF2F7; }
  .robot-item.active { background: #EEF4FF; border-color: #1E2D5A; }
  .robot-item-name { font-size: 13px; font-weight: 700; color: #2D3748; }
  .robot-item-meta { font-size: 11px; color: #A0AEC0; margin-top: 2px; }
  .robot-item-del {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    opacity: 0; transition: opacity .15s;
    background: #FED7D7; border: none; border-radius: 4px;
    padding: 2px 6px; cursor: pointer; font-size: 10px; color: #C53030;
  }
  .robot-item:hover .robot-item-del { opacity: 1; }

  /* ── Canvas ── */
  .canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .robot-meta-editor {
    display: none;
    background: #fff;
    border-bottom: 1px solid #E2E8F0;
    padding: 18px 20px 16px;
  }
  .robot-meta-editor-inner {
    max-width: 760px;
    margin: 0 auto;
    position: relative;
    padding-right: 170px;
  }
  .robot-meta-row + .robot-meta-row {
    margin-top: 12px;
  }
  .robot-name-input {
    width: 100%;
    font-size: 15px;
    font-weight: 700;
    color: #1E2D5A;
    border: 1.5px solid #E2E8F0;
    border-radius: 8px;
    padding: 10px 12px;
    background: #F7FAFC;
    font-family: inherit;
    transition: border-color .15s, background .15s, box-shadow .15s;
  }
  .robot-name-input:focus {
    outline: none;
    border-color: #CBD5E0;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(30,45,90,.06);
  }
  .robot-name-input.compact {
    font-size: 15px;
    padding: 10px 12px;
  }
  .robot-memo-input {
    width: 100%;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1.5px solid #E2E8F0;
    border-radius: 8px;
    background: #F7FAFC;
    font-size: 12px;
    color: #4A5568;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    min-height: 72px;
    transition: border-color .15s, background .15s;
  }
  .robot-memo-input:focus {
    outline: none;
    border-color: #CBD5E0;
    background: #fff;
  }
  .meta-actions {
  position: absolute;
  top: 4px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.meta-actions .btn {
  min-width: 150px;
  justify-content: center;
  display: inline-flex;
  align-items: center;
}
.robot-memo-input.compact {
    margin-top: 0;
    min-height: 64px;
    padding: 10px 12px;
    line-height: 1.5;
  }

  .steps-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
  }

  .steps-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 760px;
    margin: 0 auto;
  }

  /* ── Step Card ── */
  .step-card {
    background: #fff;
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    padding: 18px 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: grab;
    transition: all .15s;
    position: relative;
  }
  .step-card:hover { border-color: #CBD5E0; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
  .step-card.dragging { opacity: .5; cursor: grabbing; }
  .step-card.drag-over { border-color: #F5A623; box-shadow: 0 0 0 2px rgba(245,166,35,.25); }

  .step-number {
    min-width: 34px; height: 34px;
    border-radius: 50%;
    background: #1E2D5A;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
  }

  .step-drag-handle {
    cursor: grab;
    color: #A0AEC0;
    font-size: 20px;
    padding: 6px 4px;
    flex-shrink: 0;
    line-height: 1;
  }
  .step-drag-handle:hover { color: #718096; }

  .step-body { flex: 1; min-width: 0; }

  .step-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

  .step-action-input {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #1E2D5A;
    border: none;
    border-bottom: 1.5px solid transparent;
    padding: 2px 4px;
    background: transparent;
    font-family: inherit;
    transition: border-color .15s;
    min-width: 0;
  }
  .step-action-input:focus { outline: none; border-bottom-color: #1E2D5A; background: #FAFAFA; border-radius: 4px 4px 0 0; }
  .step-action-input::placeholder { color: #A0AEC0; font-weight: 400; }

  .step-detail-input {
    width: 100%;
    font-size: 13px;
    color: #4A5568;
    border: 1.5px solid transparent;
    border-radius: 6px;
    padding: 4px 6px;
    background: #F7FAFC;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    line-height: 1.5;
    transition: all .15s;
  }
  .step-detail-input:focus { outline: none; border-color: #CBD5E0; background: #fff; }
  .step-detail-input::placeholder { color: #CBD5E0; }

  .step-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
    min-width: 56px;
    justify-content: flex-start;
  }
  .step-move-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
  }
  .step-icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1.5px solid #CBD5E0;
    background: #fff;
    color: #4A5568;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
  .step-icon-btn:hover {
    background: #EDF2F7;
    color: #1E2D5A;
    border-color: #A0AEC0;
  }
  .step-delete-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: #E53E3E;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
  .step-delete-btn:hover {
    background: #C53030;
  }
  .step-drag-bottom {
  font-size: 14px;
  color: #A0AEC0;
  cursor: grab;
  margin-top: 4px;
  width: 30px;
  display: flex;
  justify-content: center;
}
  .step-drag-bottom:hover {
    color: #4A5568;
  }

  /* ── Add Step ── */
  .add-step-btn {
    max-width: 760px;
    margin: 8px auto 0;
    width: 100%;
    padding: 12px;
    border: 2px dashed #CBD5E0;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: #718096;
    transition: all .15s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }
  .add-step-btn:hover { border-color: #F5A623; color: #F5A623; background: rgba(245,166,35,.04); }

  /* ── Empty State ── */
  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #A0AEC0;
    text-align: center;
  }
  .empty-state .icon { font-size: 48px; margin-bottom: 16px; }
  .empty-state h3 { font-size: 16px; color: #718096; margin-bottom: 8px; }
  .empty-state p { font-size: 13px; }

  /* ── Export Modal ── */
  .modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
  }
  .modal-overlay.open { display: flex; }
  .modal {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(0,0,0,.2);
  }
  .modal h2 { font-size: 16px; color: #1E2D5A; margin-bottom: 16px; }
  .export-preview-wrap {
    position: relative;
  }
  .export-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #4A5568;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background .15s, color .15s, opacity .15s;
    opacity: .78;
  }
  .export-copy-btn:hover {
    background: rgba(255,255,255,.9);
    color: #1E2D5A;
    opacity: 1;
  }
  .export-copy-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
  }
  .export-format-title {
    margin-top: 14px;
    font-size: 12px;
    font-weight: 700;
    color: #4A5568;
  }
  .export-note {
    margin-top: 12px;
    font-size: 12px;
    color: #718096;
  }
  .modal pre {
    background: #F7FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 20px 56px 20px 16px;
    font-size: 11px;
    line-height: 1.9;
    height: 340px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: #2D3748;
    font-family: "Courier New", monospace;
  }
  .modal-footer {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    justify-content: center;
  }
  .modal-footer .btn {
    flex: 1;
    max-width: 200px;
    min-width: 0;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
    text-align: center;
    white-space: nowrap;
  }
  .export-run-btn {
    font-weight: 700;
    border-radius: 8px;
  }

  /* ── Toast ── */
  .toast {
    position: fixed;
    bottom: 24px; right: 24px;
    background: #1E2D5A;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    opacity: 0;
    transform: translateY(10px);
    transition: all .3s;
    z-index: 9999;
  }
  .toast.show { opacity: 1; transform: translateY(0); }

  /* ── Scrollbar ── */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 3px; }
  ::-webkit-scrollbar-thumb:hover { background: #718096; }

  .guide-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.guide-img {
  width: 48px;
  height: auto;
}