/* ── Builder view layout ── */
#view-builder { flex-direction: row; overflow: hidden; }

/* Tag panel */
.tag-panel { width: var(--tagbar-w); flex-shrink: 0; background: var(--ps-sidebar); display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid rgba(255,255,255,.05); }
.tag-panel-header { padding: 12px 12px 10px; border-bottom: 1px solid rgba(255,255,255,.07); flex-shrink: 0; }
.tag-search { display: flex; align-items: center; gap: 7px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: var(--ps-radius-pill); padding: 6px 11px; }
.tag-search svg { width: 12px; height: 12px; fill: none; stroke: rgba(255,255,255,.3); stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }
.tag-search input { border: none; outline: none; background: transparent; font-family: var(--display); font-size: 12px; color: rgba(255,255,255,.7); width: 100%; }
.tag-search input::placeholder { color: rgba(255,255,255,.25); }
.tag-scroll { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }
.tag-scroll::-webkit-scrollbar { width: 3px; }
.tag-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 2px; }
.tag-group { margin-bottom: 4px; }
.tag-group + .tag-group { border-top: 1px solid rgba(255,255,255,.06); padding-top: 4px; margin-top: 2px; }
.group-label { font-size: 9.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.22); padding: 6px 4px 5px; display: flex; align-items: center; gap: 6px; }
.gdot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.tag-btn { display: flex; align-items: center; background: transparent; border: 1px solid rgba(255,255,255,.06); color: rgba(255,255,255,.48); font-family: var(--mono); font-size: 12px; padding: 5px 9px; border-radius: var(--ps-radius-sm); cursor: pointer; text-align: left; width: 100%; transition: all .12s; margin-bottom: 2px; }
.tag-btn:hover { background: rgba(120,137,144,.18); border-color: rgba(120,137,144,.4); color: rgba(255,255,255,.9); }
.tag-btn:active { transform: scale(.97); }
.tag-btn.hidden { display: none; }
.tb-bracket { color: rgba(255,255,255,.22); }
.tb-name { color: rgba(255,255,255,.72); margin: 0 1px; flex: 1; }
.tb-plus { margin-left: auto; color: rgba(255,255,255,.18); font-size: 14px; padding-left: 8px; transition: color .12s; }
.tag-btn:hover .tb-plus { color: var(--ps-azul-light); }

/* Workspace */
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--ps-off-white); }
.workspace-body { flex: 1; overflow-y: auto; padding: 24px 28px; display: flex; flex-direction: column; align-items: center; }
.workspace-body::-webkit-scrollbar { width: 4px; }
.workspace-body::-webkit-scrollbar-thumb { background: var(--ps-border); border-radius: 2px; }

/* Context chips */
.context-chips { width: 100%; max-width: 720px; min-height: 32px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.context-chips:empty { min-height: 0; margin-bottom: 0; }
.ctx-chip { display: flex; align-items: center; gap: 7px; background: var(--ps-surface); border: 1.5px solid var(--ps-border); border-radius: var(--ps-radius-pill); padding: 4px 10px 4px 8px; font-size: 12px; font-weight: 500; color: var(--ps-text-secondary); }
.ctx-chip .chip-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.ctx-chip .chip-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--ps-text-muted); }
.ctx-chip .chip-name { color: var(--ps-text-primary); font-weight: 600; }
.ctx-chip .chip-x { background: none; border: none; color: var(--ps-text-muted); cursor: pointer; font-size: 15px; padding: 0 0 0 4px; line-height: 1; transition: color .12s; }
.ctx-chip .chip-x:hover { color: var(--ps-terracotta); }

/* Blocks area */
.blocks-area { width: 100%; max-width: 720px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

/* Empty state */
.workspace-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; width: 100%; padding: 60px 0; pointer-events: none; user-select: none; position: relative; }
.workspace-watermark { position: absolute; width: 200px; height: 200px; object-fit: contain; pointer-events: none; user-select: none; }
.empty-prompt { font-family: var(--mono); font-size: 22px; color: var(--ps-terracotta-light); margin-bottom: 8px; letter-spacing: -.5px; }
.empty-hint { font-size: 13.5px; color: var(--ps-text-muted); line-height: 1.6; }
.starter-kit { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--ps-text-muted); margin-top: 16px; pointer-events: all; flex-wrap: wrap; justify-content: center; }
.sk-tag { background: var(--ps-bege-rose); border: 1.5px solid var(--ps-border-strong); border-radius: var(--ps-radius-xs); padding: 4px 10px; font-family: var(--mono); font-size: 11px; color: var(--ps-text-secondary); cursor: pointer; transition: all .12s; font-weight: 500; }
.sk-tag:hover { background: var(--ps-terracotta-light); border-color: var(--ps-terracotta); color: var(--ps-terracotta-dark); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(168,75,42,.15); }
.sk-tag:active { transform: scale(.94); }

/* Block cards */
.block-card { background: var(--ps-surface); border: 1.5px solid var(--ps-border); border-radius: var(--ps-radius); overflow: hidden; flex-shrink: 0; transition: box-shadow .15s; animation: slideIn .18s ease; }
.block-card:focus-within { box-shadow: var(--ps-shadow); }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.block-header { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1.5px solid var(--ps-border); background: var(--ps-surface); }
.block-drag { color: var(--ps-text-muted); font-size: 14px; cursor: grab; flex-shrink: 0; line-height: 1; padding: 2px 0; }
.block-drag:active { cursor: grabbing; }
.block-tag { font-family: var(--mono); font-size: 12px; color: var(--ps-azul-dark); font-weight: 500; flex-shrink: 0; cursor: pointer; border-radius: 3px; padding: 1px 3px; transition: background .12s, color .12s; }
.block-tag:hover { background: var(--ps-azul-faint); color: var(--ps-azul); }
.block-preview { flex: 1; font-size: 12.5px; color: var(--ps-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.block-del { background: none; border: none; color: var(--ps-text-muted); cursor: pointer; font-size: 16px; padding: 0; line-height: 1; transition: color .12s; flex-shrink: 0; }
.block-del:hover { color: var(--ps-terracotta); }
.block-body { padding: 12px 14px; }
.block-textarea { width: 100%; border: none; outline: none; resize: vertical; background: transparent; font-family: var(--display); font-size: 13.5px; color: var(--ps-text-primary); line-height: 1.6; min-height: 72px; display: block; }
.block-textarea::placeholder { color: var(--ps-text-muted); opacity: .6; }
.block-card.dragging { opacity: .2; }
.block-card.drag-over { border-color: var(--ps-azul); box-shadow: 0 0 0 3px var(--ps-azul-faint); }

/* AI Prompt Builder bar */
#ai-prompt-bar {
  display: none;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 20px;
  background: var(--ps-surface);
  border-top: 1.5px solid var(--ps-border);
  flex-shrink: 0;
  position: relative;
}

.aipb-resize-handle {
  position: absolute;
  top: -6px; left: 0; right: 0;
  height: 12px;
  cursor: ns-resize;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aipb-resize-handle::after {
  content: '';
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: var(--ps-border);
  transition: background .15s, width .15s;
}
.aipb-resize-handle:hover::after,
.aipb-resize-handle.dragging::after {
  background: var(--ps-azul-light);
  width: 48px;
}
.ps-logged-in #ai-prompt-bar { display: flex; }

.aipb-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  padding-bottom: 2px;
}
.aipb-icon { font-size: 13px; color: var(--ps-terracotta); line-height: 1; }
.aipb-text { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ps-text-muted); white-space: nowrap; }

.aipb-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  min-width: 0;
}
.aipb-input-wrap #ai-prompt-input { flex: 1; width: 100%; }

.aipb-clear-btn {
  position: absolute;
  top: 5px; right: 6px;
  width: 17px; height: 17px;
  border-radius: 50%;
  border: none;
  background: var(--ps-border-strong, #ccc);
  color: var(--ps-text-muted);
  font-size: 13px;
  line-height: 17px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s, color .15s;
  z-index: 2;
}
.aipb-clear-btn:hover { background: var(--ps-terracotta); color: white; }
.aipb-input-wrap.has-content .aipb-clear-btn { display: flex; }

#ai-prompt-input {
  flex: 1;
  border: 1.5px solid var(--ps-border);
  border-radius: var(--ps-radius-sm);
  padding: 8px 12px;
  font-family: var(--display);
  font-size: 13.5px;
  color: var(--ps-text-primary);
  background: var(--ps-off-white);
  resize: none;
  outline: none;
  line-height: 1.5;
  min-height: 36px;
  overflow-y: auto;
  transition: border-color .15s;
}
#ai-prompt-input:focus { border-color: var(--ps-terracotta); box-shadow: 0 0 0 3px rgba(168,75,42,.08); }
#ai-prompt-input::placeholder { color: var(--ps-text-muted); opacity: .7; }

#ai-build-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--ps-terracotta);
  color: white;
  border: none;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--ps-radius-pill);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .15s;
  height: 36px;
}
#ai-build-btn:hover { background: var(--ps-terracotta-dark); box-shadow: 0 4px 16px rgba(168,75,42,.3); transform: translateY(-1px); }
#ai-build-btn:active { transform: scale(.97); box-shadow: none; }
#ai-build-btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.ai-build-icon { font-size: 11px; }

@media (max-width: 700px) {
  #ai-prompt-bar { padding: 8px 12px; }
  .aipb-label { display: none; }
  .ai-build-label { display: none; }
  #ai-build-btn { padding: 9px 13px; }
}

/* Workspace bar */
.workspace-bar { flex-shrink: 0; height: 52px; padding: 0 20px; background: var(--ps-surface); border-top: 1.5px solid var(--ps-border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bar-left { display: flex; align-items: center; gap: 8px; }
.block-count { font-family: var(--mono); font-size: 11.5px; color: var(--ps-text-muted); }
.bar-btn { padding: 6px 14px; border-radius: var(--ps-radius-pill); font-family: var(--display); font-size: 12.5px; font-weight: 500; cursor: pointer; border: 1.5px solid var(--ps-border); background: transparent; color: var(--ps-text-secondary); transition: all .15s; }
.bar-btn:hover { border-color: var(--ps-border-strong); color: var(--ps-text-primary); }
.bar-btn.danger:hover { background: var(--ps-terracotta-faint); border-color: var(--ps-terracotta-light); color: var(--ps-terracotta-dark); }
.bar-btn.active { background: var(--ps-azul-faint); border-color: var(--ps-azul-light); color: var(--ps-azul-dark); }
.bar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-copy { background: var(--ps-azul); color: white; border: none; font-family: var(--display); font-size: 13px; font-weight: 600; padding: 8px 20px; border-radius: var(--ps-radius-pill); cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all .15s; }
.btn-copy:hover { background: var(--ps-azul-dark); box-shadow: 0 4px 16px rgba(120,137,144,.4); transform: translateY(-1px); }
.btn-copy:active { transform: scale(.97); }
.btn-copy.copied { background: var(--ps-verde) !important; box-shadow: none !important; transform: none !important; }
.btn-copy.icon-only { padding: 8px 13px; }
.btn-copy.icon-only .copy-label { display: none; }

.btn-chat { background: var(--ps-verde); color: white; border: none; font-family: var(--display); font-size: 13px; font-weight: 600; padding: 8px 18px; border-radius: var(--ps-radius-pill); cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all .15s; }
.btn-chat:hover { background: var(--ps-verde-dark); box-shadow: 0 4px 16px rgba(141,149,126,.4); transform: translateY(-1px); }
.btn-chat:active { transform: scale(.97); }
.chat-btn-icon { font-size: 12px; }

/* Preview pane (builder XML preview) */
#preview-pane-builder { display: none; border-top: 1.5px solid var(--ps-border); padding: 14px 20px; max-height: 200px; overflow-y: auto; flex-shrink: 0; background: var(--ps-surface); }
#preview-pane-builder.open { display: block; }
#preview-pane-builder pre { font-family: var(--mono); font-size: 12px; color: var(--ps-text-secondary); white-space: pre-wrap; word-break: break-word; line-height: 1.75; }
#preview-pane-builder pre .xml-tag { color: var(--ps-terracotta); }

/* Rail + Drawer */
.right-panel { display: flex; flex-shrink: 0; border-left: 1px solid var(--ps-border); }
.drawer { width: 0; overflow: hidden; background: var(--ps-surface); border-left: 0px solid var(--ps-border); transition: width .25s cubic-bezier(.4,0,.2,1), border-left-width .25s; display: flex; flex-direction: column; }
.drawer.open { width: var(--drawer-w); border-left-width: 1.5px; }
.drawer-view { display: none; flex-direction: column; height: 100%; }
.drawer-view.active { display: flex; }
.drawer-header { padding: 14px 14px 12px; flex-shrink: 0; border-bottom: 1.5px solid var(--ps-border); display: flex; align-items: center; justify-content: space-between; }
.drawer-title { font-size: 13px; font-weight: 700; color: var(--ps-text-primary); }
.drawer-title em { color: var(--ps-azul); font-style: normal; }
.drawer-close { width: 24px; height: 24px; border-radius: 50%; background: var(--ps-bege-rose); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--ps-text-muted); transition: all .12s; }
.drawer-close:hover { background: var(--ps-azul-light); color: var(--ps-azul-dark); }
.drawer-search { padding: 10px 12px; flex-shrink: 0; border-bottom: 1.5px solid var(--ps-border); }
.dsearch { display: flex; align-items: center; gap: 7px; background: var(--ps-off-white); border: 1.5px solid var(--ps-border); border-radius: var(--ps-radius-pill); padding: 6px 12px; transition: border-color .15s; }
.dsearch:focus-within { border-color: var(--ps-azul); }
.dsearch svg { width: 12px; height: 12px; fill: none; stroke: var(--ps-text-muted); stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }
.dsearch input { border: none; outline: none; background: transparent; font-family: var(--display); font-size: 12.5px; color: var(--ps-text-primary); width: 100%; }
.dsearch input::placeholder { color: var(--ps-text-muted); }
.drawer-scroll { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.drawer-scroll::-webkit-scrollbar { width: 3px; }
.drawer-scroll::-webkit-scrollbar-thumb { background: var(--ps-border); border-radius: 2px; }
.dsection-label { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ps-text-muted); padding: 8px 6px 6px; display: flex; align-items: center; gap: 8px; }
.dsection-label::after { content: ''; flex: 1; height: 1px; background: var(--ps-border); }
.drawer-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 32px 16px; text-align: center; }
.drawer-empty svg { width: 28px; height: 28px; fill: none; stroke: var(--ps-border); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.drawer-empty p { font-size: 12.5px; color: var(--ps-text-muted); line-height: 1.5; }
.drawer-empty a { color: var(--ps-azul); text-decoration: none; font-weight: 500; }

/* Persona drawer items */
.persona-item { display: flex; align-items: center; gap: 9px; padding: 10px; border-radius: var(--ps-radius-sm); cursor: pointer; transition: all .15s; margin-bottom: 5px; border: 1.5px solid var(--ps-border); background: var(--ps-surface); }
.persona-item:hover { border-color: var(--ps-azul-light); background: var(--ps-off-white); box-shadow: var(--ps-shadow); }
.persona-item.selected { background: var(--ps-azul-faint); border-color: var(--ps-azul); box-shadow: 0 0 0 1px var(--ps-azul); }
.pi-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pi-icon svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pi-info { flex: 1; min-width: 0; }
.pi-name { font-size: 12.5px; font-weight: 600; color: var(--ps-text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-role { font-size: 10.5px; color: var(--ps-text-muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-use { opacity: 0; background: var(--ps-azul); color: white; border: none; border-radius: var(--ps-radius-xs); padding: 3px 8px; font-family: var(--display); font-size: 11px; font-weight: 500; cursor: pointer; transition: all .12s; flex-shrink: 0; }
.persona-item:hover .pi-use, .persona-item.selected .pi-use { opacity: 1; }
.persona-item.selected .pi-use { background: var(--ps-azul-dark); }
.pi-chat { opacity: 0; background: var(--ps-verde); color: white; border: none; border-radius: var(--ps-radius-xs); padding: 3px 8px; font-family: var(--display); font-size: 11px; font-weight: 500; cursor: pointer; transition: all .12s; flex-shrink: 0; }
.persona-item:hover .pi-chat { opacity: 1; }
.pi-chat:hover { background: var(--ps-verde-dark); }

/* Template/snippet drawer items */
.drawer-item { padding: 10px; border-radius: var(--ps-radius-sm); cursor: pointer; border: 1.5px solid var(--ps-border); background: var(--ps-surface); transition: all .15s; margin-bottom: 5px; }
.drawer-item:hover { border-color: var(--ps-azul-light); background: var(--ps-off-white); box-shadow: var(--ps-shadow); }
.drawer-item.open  { border-color: var(--ps-azul); background: var(--ps-azul-faint); }
.drawer-item.selected { border-color: var(--ps-azul); box-shadow: 0 0 0 1px var(--ps-azul); background: var(--ps-azul-faint); }

/* Template expand area */
.di-expand { display: none; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--ps-azul-light); }
.drawer-item.open .di-expand { display: block; }
.di-block-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.di-block-chip { font-family: var(--mono); font-size: 9.5px; color: var(--ps-azul-dark); background: white; border: 1px solid var(--ps-azul-light); border-radius: var(--ps-radius-xs); padding: 2px 7px; }
.di-load-btn { width: 100%; padding: 7px; background: var(--ps-azul); color: white; border: none; border-radius: var(--ps-radius-sm); font-family: var(--display); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .15s; margin-top: 10px; }
.di-load-btn:hover { background: var(--ps-azul-dark); }
.di-chevron { margin-left: auto; font-size: 11px; color: var(--ps-text-muted); transition: transform .2s; flex-shrink: 0; }
.drawer-item.open .di-chevron { transform: rotate(90deg); }

/* Persona picker inside template expand */
.di-picker-label { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--ps-text-muted); margin-bottom: 6px; }
.di-persona-opts { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.di-persona-opt { padding: 7px 10px; border-radius: var(--ps-radius-xs); border: 1.5px solid var(--ps-border); background: white; cursor: pointer; transition: all .12s; }
.di-persona-opt:hover { border-color: var(--ps-azul-light); background: var(--ps-off-white); }
.di-persona-opt.active { background: var(--ps-azul-faint); border-color: var(--ps-azul); }
.di-opt-name { font-size: 12px; font-weight: 600; color: var(--ps-text-primary); }
.di-opt-role { font-size: 10.5px; color: var(--ps-text-muted); margin-top: 1px; line-height: 1.4; }
.di-persona-opt.active .di-opt-name { color: var(--ps-azul-dark); }
.di-persona-opt.active .di-opt-role { color: var(--ps-azul); }
.di-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.di-name { font-size: 12.5px; font-weight: 600; color: var(--ps-text-primary); }
.di-meta { font-family: var(--mono); font-size: 10.5px; color: var(--ps-text-muted); }
.di-action { opacity: 0; background: var(--ps-azul); color: white; border: none; border-radius: var(--ps-radius-xs); padding: 3px 8px; font-family: var(--display); font-size: 11px; font-weight: 500; cursor: pointer; transition: all .12s; flex-shrink: 0; }
.drawer-item:hover .di-action { opacity: 1; }

/* History drawer items */
.history-item { padding: 10px; border-radius: var(--ps-radius-sm); cursor: pointer; border: 1.5px solid var(--ps-border); background: var(--ps-surface); transition: all .15s; margin-bottom: 5px; }
.history-item:hover { border-color: var(--ps-azul-light); background: var(--ps-off-white); box-shadow: var(--ps-shadow); }
.hi-time { font-family: var(--mono); font-size: 10px; color: var(--ps-text-muted); margin-bottom: 3px; }
.hi-preview { font-size: 12px; color: var(--ps-text-secondary); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hi-blocks { font-family: var(--mono); font-size: 10px; color: var(--ps-text-muted); margin-top: 4px; }

/* Pack drawer items */
.pack-item { display: flex; align-items: center; gap: 9px; padding: 10px; border-radius: var(--ps-radius-sm); border: 1.5px solid var(--ps-border); background: var(--ps-surface); transition: all .15s; margin-bottom: 5px; }
.pack-item:hover { border-color: var(--ps-azul-light); background: var(--ps-off-white); box-shadow: var(--ps-shadow); }
.pack-item-icon { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pack-item-icon svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pack-item-name { font-size: 12.5px; font-weight: 600; color: var(--ps-text-primary); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pack-item-count { font-family: var(--mono); font-size: 10px; color: var(--ps-text-muted); }

/* ── Mobile: tag panel slide-out ── */
#tag-panel-overlay {
  display: none; position: fixed; inset: 0; top: var(--header-h);
  background: rgba(0,0,0,.45); z-index: 199;
}
#tag-panel-overlay.visible { display: block; }
.mobile-tags-btn { display: none; }

@media (max-width: 700px) {
  .tag-panel {
    position: fixed; left: 0; top: var(--header-h); bottom: 56px;
    width: 260px; z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
  }
  .tag-panel.mobile-open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,.4);
  }
  #tag-panel-overlay { bottom: 56px; }
  .right-panel { display: none; }
  .mobile-tags-btn { display: inline-flex; }
  #preview-btn, #save-tpl-btn { display: none; }
  .workspace-body { padding: 14px 14px; }
  .workspace-bar { padding: 0 12px; gap: 6px; }
  .bar-btn { padding: 5px 10px; font-size: 11.5px; }
  .block-count { font-size: 11px; }
  .copy-label { display: none; }
  .btn-copy { padding: 8px 13px; }
  .chat-btn-label { display: none; }
  .btn-chat { padding: 8px 13px; }
}

/* Icon rail */
.icon-rail { width: var(--rail-w); flex-shrink: 0; background: var(--ps-surface); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; border-left: 1.5px solid var(--ps-border); }
.rail-btn { width: 36px; height: 36px; border-radius: var(--ps-radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; border: none; background: transparent; color: var(--ps-text-muted); transition: all .15s; position: relative; }
.rail-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rail-btn:hover { background: var(--ps-bege-rose); color: var(--ps-text-primary); }
.rail-btn.active { background: var(--ps-azul-faint); color: var(--ps-azul-dark); }
.rail-btn.active::before { content: ''; position: absolute; left: -1px; top: 6px; bottom: 6px; width: 2px; background: var(--ps-azul); border-radius: 0 2px 2px 0; }
.rail-sep { width: 24px; height: 1.5px; background: var(--ps-border); margin: 4px 0; }
.rail-btn[data-tip]:hover::after { content: attr(data-tip); position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%); background: var(--ps-sidebar); color: white; font-family: var(--display); font-size: 11.5px; font-weight: 500; padding: 4px 10px; border-radius: var(--ps-radius-xs); white-space: nowrap; pointer-events: none; z-index: 50; }

/* AI reason ? button */
.block-ai-why {
  width: 17px; height: 17px; border-radius: 50%;
  border: 1.5px solid var(--ps-azul-light);
  background: var(--ps-azul-faint);
  color: var(--ps-azul-dark);
  font-family: var(--display); font-size: 9px; font-weight: 700;
  cursor: default; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  position: relative; user-select: none; line-height: 1;
}

/* Tooltip is body-level (avoids overflow:hidden clipping on .block-card) */
.ai-why-tooltip {
  position: fixed; z-index: 600;
  background: var(--ps-sidebar); color: rgba(255,255,255,.9);
  font-family: var(--display); font-size: 11.5px; font-weight: 400;
  padding: 7px 11px; border-radius: var(--ps-radius-xs);
  max-width: 260px; white-space: normal; text-align: left; line-height: 1.45;
  box-shadow: 0 4px 18px rgba(0,0,0,.3);
  pointer-events: none; display: none;
}

/* Tag picker popup */
.tag-picker-popup {
  position: fixed; z-index: 400;
  background: var(--ps-surface);
  border: 1.5px solid var(--ps-border-strong);
  border-radius: var(--ps-radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
  width: 200px; max-height: 280px;
  display: none; flex-direction: column; overflow: hidden;
}
.tag-picker-popup.visible { display: flex; }
.tp-search {
  border: none; border-bottom: 1.5px solid var(--ps-border); outline: none;
  padding: 8px 12px; font-family: var(--display); font-size: 12.5px;
  color: var(--ps-text-primary); background: var(--ps-off-white); flex-shrink: 0;
}
.tp-search::placeholder { color: var(--ps-text-muted); }
.tp-list { overflow-y: auto; padding: 4px; }
.tp-list::-webkit-scrollbar { width: 3px; }
.tp-list::-webkit-scrollbar-thumb { background: var(--ps-border); border-radius: 2px; }
.tp-tag-opt {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent;
  font-family: var(--mono); font-size: 11.5px; color: var(--ps-text-secondary);
  padding: 5px 8px; border-radius: var(--ps-radius-xs);
  cursor: pointer; transition: all .1s;
}
.tp-tag-opt:hover { background: var(--ps-azul-faint); color: var(--ps-azul-dark); }
.tp-tag-opt.current { color: var(--ps-azul-dark); font-weight: 600; }
