/* BUILDER.CSS — extracted from agent_vocabulary.html (Phase 1)
   See docs/data-model.md for component ownership. */

    /* ---------- BUILDER PANEL ---------- */
    .builder-panel {
      display: flex;
      flex-direction: column;
      height: 100%;
    }
    .builder-header {
      padding-bottom: 18px;
      border-bottom: 1px solid var(--border);
      margin-bottom: 18px;
    }
    .builder-header h2 {
      font-family: "Charter", Georgia, serif;
      font-size: 18px;
      font-weight: 600;
      margin: 0 0 4px 0;
    }
    .builder-header .file-selector {
      display: flex;
      gap: 6px;
      margin-top: 10px;
      flex-wrap: wrap;
    }
    .file-option {
      padding: 4px 10px;
      border: 1px solid var(--border-strong);
      border-radius: 6px;
      background: var(--bg);
      cursor: pointer;
      font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
      font-size: 11.5px;
      color: var(--muted);
      transition: all 0.12s;
    }
    .file-option:hover { border-color: var(--muted); color: var(--ink); }
    .file-option.active {
      background: var(--ink);
      color: var(--surface);
      border-color: var(--ink);
    }
    .builder-sections {
      flex: 1;
      overflow-y: auto;
      padding-right: 4px;
    }
    .builder-sections::-webkit-scrollbar { width: 5px; }
    .builder-sections::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

    .bsection {
      border: 1px solid var(--border);
      border-radius: 8px;
      margin-bottom: 12px;
      overflow: hidden;
      transition: border-color 0.15s;
    }
    .bsection:hover { border-color: var(--border-strong); }
    .bsection-header {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      cursor: pointer;
      user-select: none;
      transition: background 0.12s;
      background: var(--bg);
    }
    .bsection-header:hover { background: var(--surface); }
    .bsection-icon {
      font-size: 14px;
      width: 20px;
      flex-shrink: 0;
      text-align: center;
    }
    .bsection-title {
      flex: 1;
      font-family: "Charter", Georgia, serif;
      font-size: 15px;
      font-weight: 600;
    }
    .bsection-desc {
      font-size: 11px;
      color: var(--muted);
      line-height: 1.3;
      margin-top: 1px;
    }
    .bsection-toggle {
      font-size: 12px;
      color: var(--muted);
      transition: transform 0.15s;
    }
    .bsection.collapsed .bsection-toggle { transform: rotate(-90deg); }
    .bsection-body {
      padding: 8px 14px 14px;
      border-top: 1px solid var(--border);
    }
    .bsection.collapsed .bsection-body { display: none; }

    .bsection-body textarea {
      width: 100%;
      min-height: 56px;
      padding: 8px 10px;
      border: 1px solid var(--border-strong);
      border-radius: 6px;
      background: var(--bg);
      font-family: "Charter", Georgia, serif;
      font-size: 13.5px;
      line-height: 1.5;
      resize: vertical;
      outline: none;
      transition: border-color 0.12s, box-shadow 0.12s;
    }
    .bsection-body textarea:focus {
      border-color: var(--ink);
      box-shadow: 0 0 0 3px rgba(26,26,26,0.06);
    }
    .bsection-body textarea::placeholder { color: var(--muted); opacity: 0.6; }

    .checklist-item {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      padding: 5px 0;
      cursor: pointer;
      font-size: 13px;
      line-height: 1.4;
      transition: opacity 0.12s;
    }
    .checklist-item:hover { opacity: 0.8; }
    .checklist-item input[type="checkbox"] {
      margin-top: 2px;
      width: 15px;
      height: 15px;
      accent-color: var(--ink);
      cursor: pointer;
      flex-shrink: 0;
    }
    .checklist-item label {
      cursor: pointer;
      flex: 1;
    }
    .checklist-item.checked label {
      text-decoration: line-through;
      opacity: 0.55;
    }

    .custom-input-row {
      display: flex;
      gap: 6px;
      margin-top: 8px;
    }
    .custom-input-row input {
      flex: 1;
      padding: 5px 8px;
      border: 1px solid var(--border-strong);
      border-radius: 5px;
      background: var(--surface);
      font-size: 12.5px;
      font-family: inherit;
      outline: none;
    }
    .custom-input-row input:focus { border-color: var(--ink); }
    .custom-add-btn {
      padding: 5px 10px;
      border: 1px solid var(--border-strong);
      border-radius: 5px;
      background: var(--bg);
      cursor: pointer;
      font-size: 12px;
      color: var(--muted);
      transition: all 0.12s;
      white-space: nowrap;
    }
    .custom-add-btn:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }

    .links-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .link-row {
      display: flex;
      gap: 6px;
      align-items: center;
    }
    .link-row input {
      flex: 1;
      padding: 5px 8px;
      border: 1px solid var(--border-strong);
      border-radius: 5px;
      background: var(--surface);
      font-size: 12px;
      font-family: inherit;
      outline: none;
    }
    .link-row input:focus { border-color: var(--ink); }
    .link-row .link-del {
      padding: 3px 7px;
      border: none;
      background: transparent;
      cursor: pointer;
      font-size: 14px;
      color: var(--muted);
      border-radius: 4px;
      transition: all 0.12s;
    }
    .link-row .link-del:hover { background: var(--chip-red); color: white; }
    .link-add-btn {
      padding: 4px 10px;
      border: 1px dashed var(--border-strong);
      border-radius: 5px;
      background: transparent;
      cursor: pointer;
      font-size: 11.5px;
      color: var(--muted);
      transition: all 0.12s;
      margin-top: 4px;
    }
    .link-add-btn:hover { border-color: var(--muted); color: var(--ink); }

    /* Vocabulary suggestions in build mode */
    .vocab-suggest {
      margin-top: 14px;
      padding: 10px 12px;
      background: rgba(123,141,240,0.08);
      border: 1px dashed var(--pre-action);
      border-radius: 6px;
      font-size: 12px;
      line-height: 1.5;
      color: var(--muted);
      display: none;
    }
    .vocab-suggest.visible { display: block; }
    .vocab-suggest strong { color: var(--ink); }
    .vocab-suggest .sugg-item {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      padding: 4px 0;
    }
    .vocab-suggest .sugg-item::before {
      content: '\2192';
      color: var(--pre-action);
      font-weight: 700;
      flex-shrink: 0;
    }
    .vocab-add-sugg {
      margin-top: 6px;
      padding: 4px 10px;
      background: var(--chip-navy);
      color: white;
      border: none;
      border-radius: 5px;
      cursor: pointer;
      font-size: 11.5px;
      font-weight: 600;
      font-family: inherit;
      transition: opacity 0.12s;
    }
    .vocab-add-sugg:hover { opacity: 0.85; }

    /* Builder footer / export */
    .builder-footer {
      padding-top: 16px;
      border-top: 1px solid var(--border);
      margin-top: 16px;
    }
    .preview-toggle {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 12px;
    }
    .preview-toggle button {
      padding: 5px 12px;
      border: 1px solid var(--border-strong);
      border-radius: 6px;
      background: var(--bg);
      cursor: pointer;
      font-size: 11.5px;
      font-weight: 600;
      font-family: inherit;
      color: var(--muted);
      transition: all 0.12s;
    }
    .preview-toggle button:hover { border-color: var(--muted); color: var(--ink); }
    .preview-toggle button.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }

    .preview-box {
      background: #1a1a1a;
      color: #d4d4d4;
      border-radius: 8px;
      padding: 14px 16px;
      font-family: ui-monospace, "SF Mono", "Cascadia Code", "Fira Code", monospace;
      font-size: 12px;
      line-height: 1.6;
      white-space: pre-wrap;
      overflow-x: auto;
      max-height: 300px;
      overflow-y: auto;
      display: none;
    }
    .preview-box.visible { display: block; }

    .export-actions {
      display: flex;
      gap: 8px;
      margin-top: 12px;
      flex-wrap: wrap;
    }
    .export-btn {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 8px 16px;
      border: 1px solid var(--border-strong);
      border-radius: 8px;
      background: var(--bg);
      cursor: pointer;
      font-family: inherit;
      font-size: 12.5px;
      font-weight: 600;
      color: var(--ink);
      transition: all 0.12s;
    }
    .export-btn:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }
    .export-btn.primary {
      background: var(--ink);
      color: var(--surface);
      border-color: var(--ink);
    }
    .export-btn.primary:hover { opacity: 0.85; background: var(--ink); }
    .export-btn .icon { font-size: 14px; }

    /* Theme toggle */
    .theme-btn {
      background: var(--bg);
      border: 1px solid var(--border-strong);
      border-radius: 6px;
      padding: 6px 10px;
      cursor: pointer;
      font-size: 15px;
      transition: all 0.12s;
      flex-shrink: 0;
      line-height: 1;
    }
    .theme-btn:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }

    /* Section status badge */
    .section-badge {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      padding: 2px 7px;
      border-radius: 999px;
      font-family: ui-sans-serif, system-ui, sans-serif;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.04em;
      flex-shrink: 0;
      transition: all 0.15s;
    }
    .section-badge.empty { background: var(--soft); color: var(--ink); }
    .section-badge.filled { background: var(--chip-navy); color: white; }


    /* ---- Section guidance panel ---- */
    .bsection-help-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 22px; height: 22px;
      border: 1px solid var(--border-strong);
      border-radius: 999px;
      background: var(--surface);
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
      flex-shrink: 0;
      transition: all 0.15s;
      font-family: inherit;
      padding: 0;
      line-height: 1;
    }
    .bsection-help-btn:hover {
      background: var(--chip-navy);
      color: white;
      border-color: var(--chip-navy);
    }
    .bsection-help {
      display: none;
      margin-top: 12px;
      padding: 12px 14px;
      background: rgba(123,141,240,0.06);
      border: 1px dashed var(--pre-action);
      border-radius: 6px;
      font-size: 12px;
      line-height: 1.55;
      color: var(--ink);
    }
    .bsection-help.visible { display: block; }
    .bsection-help > div { margin-bottom: 8px; }
    .bsection-help > div:last-child { margin-bottom: 0; }
    .bsection-help strong {
      display: inline-block;
      font-family: ui-sans-serif, system-ui, sans-serif;
      font-size: 10.5px;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--pre-action);
      font-weight: 700;
      margin-right: 6px;
    }
    .bsection-help-why { color: var(--muted); }
    .bsection-help-tip { color: var(--ink); }
    .bsection-help-example {
      font-family: "Charter", Georgia, serif;
      font-style: italic;
      font-size: 12.5px;
      color: var(--muted);
      padding: 6px 10px;
      background: var(--surface);
      border-radius: 5px;
      border: 1px solid var(--border);
    }
    .bsection-help-example code {
      font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
      font-size: 11px;
      font-style: normal;
      background: var(--bg);
      padding: 1px 4px;
      border-radius: 3px;
    }
    .bsection-help {
      background: rgba(123,141,240,0.06);
      border-color: var(--pre-action);
    }
    .bsection-help-example { background: var(--soft); }

    .export-toast {
      margin-top: 8px;
      padding: 8px 12px;
      border-radius: 6px;
      font-size: 12px;
      animation: toast-fade 0.2s ease-out;
      display: none;
    }
    /* Phase-9 dark-only: toast colors now use dark palette (was light green/red). */
    .export-toast.success { background: #1a3a24; color: #8ad4a0; border: 1px solid #2a5a34; display: block; }
    .export-toast.error   { background: #3a1a20; color: #d48a90; border: 1px solid #5a2a30; display: block; }

    @keyframes toast-fade {
      from { opacity: 0; transform: translateY(-4px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    /* Import area */
    .import-toggle {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 4px 10px;
      border: 1px dashed var(--border-strong);
      border-radius: 6px;
      background: transparent;
      cursor: pointer;
      font-family: inherit;
      font-size: 11.5px;
      color: var(--muted);
      transition: all 0.12s;
    }
    .import-toggle:hover { border-color: var(--muted); color: var(--ink); }
    .import-area {
      margin-top: 10px;
      padding: 12px;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      display: none;
    }
    .import-area.visible { display: block; }
    .import-area textarea {
      width: 100%;
      min-height: 80px;
      padding: 10px 12px;
      border: 1px solid var(--border-strong);
      border-radius: 6px;
      background: var(--surface);
      font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
      font-size: 11.5px;
      line-height: 1.5;
      resize: vertical;
      outline: none;
      color: var(--ink);
    }
    .import-area textarea:focus {
      border-color: var(--ink);
      box-shadow: 0 0 0 3px rgba(26,26,26,0.06);
    }
    .import-area textarea:focus {
      box-shadow: 0 0 0 3px rgba(224,224,224,0.10);
    }
    .import-area textarea::placeholder { color: var(--muted); opacity: 0.5; }
    .import-actions {
      display: flex;
      gap: 8px;
      margin-top: 8px;
      align-items: center;
      flex-wrap: wrap;
    }
    .import-parse-btn {
      padding: 5px 12px;
      border: 1px solid var(--chip-mint);
      border-radius: 5px;
      background: var(--chip-mint);
      color: white;
      cursor: pointer;
      font-size: 11.5px;
      font-weight: 600;
      font-family: inherit;
      transition: opacity 0.12s;
    }
    .import-parse-btn:hover { opacity: 0.85; }
    .import-msg {
      font-size: 11.5px;
      margin-top: 6px;
      padding: 6px 10px;
      border-radius: 5px;
      display: none;
    }
    /* Phase-9 dark-only: import message colors (was light green/red; dark overrides merged). */
    .import-msg.success { display: block; background: #1a3a24; color: #8ad4a0; }
    .import-msg.error   { display: block; background: #3a1a20; color: #d48a90; }

    /* Template picker */
    .template-picker select {
      appearance: none;
      -webkit-appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239a9a9a'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 8px center;
      padding-right: 26px;
      cursor: pointer;
    }
    .template-picker select:focus {
      border-color: var(--ink);
      box-shadow: 0 0 0 3px rgba(26,26,26,0.06);
    }
    .template-picker select:focus {
      box-shadow: 0 0 0 3px rgba(224,224,224,0.10);
    }
    .template-picker .tmpl-apply-btn {
      padding: 4px 10px;
      border: 1px solid var(--chip-navy);
      border-radius: 5px;
      background: var(--chip-navy);
      color: white;
      cursor: pointer;
      font-size: 11.5px;
      font-weight: 600;
      font-family: inherit;
      transition: opacity 0.12s;
    }
    .template-picker .tmpl-apply-btn:hover { opacity: 0.85; }
    .template-picker .tmpl-clear-btn {
      padding: 4px 10px;
      border: 1px solid var(--border-strong);
      border-radius: 5px;
      background: transparent;
      cursor: pointer;
      font-size: 11px;
      color: var(--muted);
      font-family: inherit;
      transition: all 0.12s;
    }
    .template-picker .tmpl-clear-btn:hover { border-color: var(--recovery); color: var(--recovery); }
    .template-picker .tmpl-desc {
      font-family: "Charter", Georgia, serif;
      font-style: italic;
      font-size: 11.5px;
      color: var(--muted);
      flex-basis: 100%;
      margin-top: 2px;
    }

    /* ---- Phase 2: body-class-driven mount-point visibility ----
       #builder-panel is hidden by default via the `hidden` HTML attribute.
       The Phase-2 builder slice (js/ui/builder.js) ALSO sets panel.hidden based
       on userGraph.getState().mode -- both safeguards work together: the
       `hidden` attribute + selector below provides layout-level empty-screen
       behavior, the slice sets `hidden = false` when in build mode. */
    #builder-panel[hidden] { display: none !important; }
    body.mode-build #builder-panel { display: flex !important; }
    body.mode-build #detail { display: none !important; }

    /* Legacy class (.build-mode) retained for backwards CSS scope. */
    .build-mode .graph-pane {
      position: relative;
    }
    .build-mode .zoom-controls {
      opacity: 1;
      pointer-events: auto;
    }
    .build-mode .graph-pane .legend { display: none; }
    .build-mode .graph-pane::after {
      content: 'Click a node to see rule suggestions';
      position: absolute;
      top: 12px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(36,36,46,0.92);
      backdrop-filter: blur(4px);
      padding: 5px 14px;
      border-radius: 999px;
      border: 1px solid var(--border);
      font-family: "Charter", Georgia, serif;
      font-style: italic;
      font-size: 12px;
      color: var(--muted);
      pointer-events: none;
      white-space: nowrap;
    }
    .build-mode .node {
      cursor: pointer;
    }
    .build-mode .node-bg {
      transition: r 0.15s, stroke-width 0.15s, filter 0.15s;
    }
    .build-mode .node.has-suggestions .node-bg {
      filter: drop-shadow(0 0 6px rgba(123,141,240,0.5));
      stroke-width: 2.4;
    }

    /* Node suggestion pulse */
    @keyframes sugg-pulse {
      0%, 100% { filter: drop-shadow(0 0 4px rgba(123,141,240,0.3)); }
      50%      { filter: drop-shadow(0 0 10px rgba(123,141,240,0.7)); }
    }
    .build-mode .node.has-suggestions.build-active {
      animation: sugg-pulse 1.5s ease-in-out infinite;
    }
    .build-mode .node.build-active .node-bg {
      stroke-width: 3.5;
      r: 34;
    }

