/* Steps tab, builder helper and Publish wizard (loaded after studio.css). */
/* Steps tab */
.when-card .when-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.switch-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.step-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; min-height: 60px; border-radius: var(--radius); }
.step-list.drop-here { outline: 2px dashed var(--accent); outline-offset: 6px; }
.step-card { position: relative; margin: 0; padding: 14px 16px; }
.step-card.dragging { opacity: .45; }
.step-card.removing { opacity: .45; text-decoration: line-through; }
.step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grip { cursor: grab; color: var(--muted); letter-spacing: -2px; user-select: none; }
.step-no { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 650;
           background: var(--accent-soft); color: var(--accent); flex: none; }
.step-icon { font-size: 16px; width: 22px; text-align: center; }
input.step-title { width: auto; flex: 1 1 200px; min-width: 140px; font-weight: 600; border-color: transparent; background: transparent; padding: 4px 6px; }
input.step-title:hover, input.step-title:focus { border-color: var(--line-2); background: var(--surface); }
.tag.write { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.icon-btn { border: 0; background: none; padding: 2px 7px; color: var(--muted); font-size: 15px; cursor: pointer; border-radius: 6px; }
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.danger-x:hover { color: var(--bad); }
.small-btn { padding: 4px 10px; font-size: 13px; }
.step-body { margin-top: 8px; display: grid; gap: 8px; }
.step-body[open] { padding-top: 4px; }
.field { display: grid; gap: 4px; margin-top: 6px; }
select.insert { justify-self: start; font-size: 13.5px; color: var(--accent); }
.step-result { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; background: var(--surface-2); display: grid; gap: 6px; }
.step-result.ok { background: var(--ok-soft); } .step-result.bad { background: var(--bad-soft); color: var(--bad); }
.step-result.skip { color: var(--muted); }
.insert-here { position: absolute; left: 50%; bottom: -13px; transform: translateX(-50%); width: 24px; height: 24px; padding: 0;
               border-radius: 50%; justify-content: center; font-size: 15px; background: var(--surface); z-index: 2; opacity: .55; }
.step-card:hover .insert-here, .insert-here:focus-visible { opacity: 1; }
.add-step { width: 100%; justify-content: center; border-style: dashed; padding: 12px; margin-top: 4px; color: var(--accent); }
.empty-steps { display: grid; gap: 6px; text-align: center; padding: 28px; }
.palette { display: flex; flex-wrap: wrap; gap: 6px; }
.block-chip { font-size: 13px; padding: 5px 10px; border-radius: 8px; cursor: grab; background: var(--surface-2); }
.block-chip:hover { border-color: var(--accent); background: var(--surface); }
.p-sec.first { border-top: 0; }
.dlg-group { font-size: 13px; color: var(--muted); margin: 6px 0 0; font-weight: 600; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 400; }
.link-btn:hover { text-decoration: underline; background: none; }
.ac-copy { position: relative; z-index: 1; }
/* "?" help */
details.help { display: inline-block; position: relative; vertical-align: middle; font-weight: 400; }
details.help summary { list-style: none; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line-2); color: var(--muted);
                       font-size: 11px; display: grid; place-items: center; cursor: pointer; padding: 0; }
details.help summary::-webkit-details-marker { display: none; }
details.help[open] summary { color: var(--accent); border-color: var(--accent); }
.help-pop { position: absolute; z-index: 30; left: 0; top: 24px; width: 260px; padding: 10px 12px; border-radius: var(--radius-sm);
            background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 13px; color: var(--fg-2);
            text-transform: none; letter-spacing: 0; line-height: 1.45; }
/* Builder helper */
.helper-fab { position: fixed; right: 24px; bottom: 24px; z-index: 40; border-radius: 999px; padding: 11px 18px;
              background: var(--accent); color: var(--accent-fg); border-color: var(--accent); box-shadow: var(--shadow-lg); font-weight: 600; }
.helper-fab:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.helper { position: fixed; right: 24px; bottom: 80px; z-index: 41; width: min(420px, calc(100vw - 32px));
          height: min(600px, calc(100vh - 120px)); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 8px;
          margin: 0; box-shadow: var(--shadow-lg); }
.helper[hidden] { display: none; }
.helper-msgs { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px; }
.helper .msg { max-width: 92%; font-size: 15px; }
/* Publish wizard */
.wizard { display: grid; gap: 14px; }
.wizard .card { margin: 0; display: grid; gap: 10px; }
.wizard .h .step-no { width: 26px; height: 26px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checks li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.checks .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.checks li.ok .mark { background: var(--ok-soft); color: var(--ok); }
.checks li.warn .mark { background: var(--warn-soft); color: var(--warn); }
.checks li.bad .mark { background: var(--bad-soft); color: var(--bad); }
.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.channel-tile { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--fg); background: var(--surface); }
.channel-tile:hover { border-color: var(--accent); text-decoration: none; }
.channel-tile .pill { justify-self: start; margin-top: 4px; }
.howto { margin: 0; padding-left: 22px; display: grid; gap: 14px; }
.howto li { padding-left: 4px; }
.copy-row { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.copy-row pre, .copy-row input { flex: 1; margin: 0; }
.p-row.wrap { flex-wrap: wrap; margin-top: 6px; }
input.compact-input { width: 320px; max-width: 100%; }
.test-out { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius-sm); white-space: pre-wrap; font-size: 13.5px; }
.test-out.ok { background: var(--ok-soft); } .test-out.bad { background: var(--bad-soft); color: var(--bad); }
.step-result[hidden], .test-out[hidden] { display: none; }
.when-row input, .when-row select { width: auto; }
.palette .block-chip { text-align: left; max-width: 100%; }
/* Connections list */
.conn-list { display: grid; gap: 8px; }
.conn-row { display: grid; grid-template-columns: 36px minmax(180px, 1.1fr) minmax(160px, 1.3fr) minmax(140px, 1fr) auto;
            gap: 14px; align-items: center; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line);
            border-radius: var(--radius); box-shadow: var(--shadow); }
.conn-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft);
             color: var(--accent); font-size: 16px; }
.conn-main { display: grid; min-width: 0; }
.conn-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-where { color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.conn-used { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.conn-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
@media (max-width: 900px) { .conn-row { grid-template-columns: 36px 1fr; } .conn-where, .conn-used, .conn-actions { grid-column: 2; } }
/* Lists: search, filters, pages */
[data-item][hidden], [data-section][hidden], .pager[hidden] { display: none !important; }
.list-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.list-tools .compact { width: auto; }
.pager { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; flex-wrap: wrap; }
.pager .pager-size { margin-left: 4px; }
.conn-kids { display: grid; gap: 2px; white-space: normal; }
.conn-kids a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-picks { display: grid; gap: 6px; }
.autosave { position: fixed; right: 20px; bottom: 20px; z-index: 50; padding: 8px 14px; border-radius: 999px;
            background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; color: var(--fg-2); }
.autosave.bad { color: var(--danger, #b42318); border-color: currentColor; }
.autosave[hidden] { display: none; }
.step-result.busy { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.next-steps { display: grid; gap: 8px; border-style: dashed; }
.img-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.img-bar[hidden] { display: none; }
.img-thumb { position: relative; display: inline-block; }
.img-thumb img { height: 56px; max-width: 120px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.img-thumb .x { position: absolute; top: -6px; right: -6px; background: var(--surface); border-radius: 999px; }
@media (max-width: 640px) {
  .helper { right: 8px; left: 8px; bottom: 72px; width: auto; height: calc(100vh - 96px); }
  .helper-fab { right: 12px; bottom: 12px; }
}
.doc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border: 1px solid var(--line);
            border-radius: 999px; background: var(--surface-2); font-size: 14px; max-width: 100%; overflow-wrap: anywhere; }
.chat-actions .attach-btn { margin-right: auto; }
.sent-img { max-height: 120px; max-width: 220px; border-radius: 8px; border: 1px solid var(--line); margin-top: 6px; }

/* Agent map (agent_map.html + agentmap.js): one compact row per team, opens to its members */
.stats.am-stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 8px; }
.am-stats .stat { padding: 8px 14px; }
.am-stats .stat-value { font-size: 22px; }
.am-sec { margin-top: 20px; }
.am-sec[hidden], [data-am-item][hidden] { display: none; }
.am-cat { font-size: 16px; font-weight: 650; margin: 0 0 8px; }
.am-teams { display: grid; gap: 8px; align-items: start; grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr)); }
.am-team { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.am-team[open] { grid-column: 1 / -1; }
.am-team > summary { display: flex; align-items: center; gap: 12px; padding: 8px 12px; cursor: pointer; list-style: none; }
.am-team > summary::-webkit-details-marker { display: none; }
.am-team > summary::after { content: "▸"; color: var(--muted); margin-left: 4px; transition: transform .15s; }
.am-team[open] > summary::after { transform: rotate(90deg); }
.am-team > summary:hover { background: var(--accent-soft); border-radius: 12px; }
.am-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.am-name strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-faces { display: flex; align-items: center; }
.am-faces .app-icon + .app-icon { margin-left: -6px; }
.am-more { font-size: 12px; color: var(--muted); margin-left: 6px; }
.am-body { padding: 0 14px 12px 58px; }
.am-members { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.am-members .am-members { padding-left: 22px; border-left: 2px solid var(--line); margin-top: 6px; }
.am-member { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.am-now { font-size: 13px; margin: 2px 0 0 36px; }
.am-solo { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.am-tile { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--surface); }
.am-busy { border-color: var(--accent); box-shadow: var(--shadow); }
.app-icon.sm { width: 32px; height: 32px; border-radius: 8px; font-size: 16px; }
.app-icon.xs { width: 22px; height: 22px; border-radius: 6px; font-size: 12px; border: 2px solid var(--surface); box-shadow: none; }
.am-dot { font-size: 12px; white-space: nowrap; color: var(--muted); }
.am-dot::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: #94a3b8; }
.am-dot.busy { color: var(--accent); font-weight: 600; }
.am-dot.busy::before { background: #22c55e; box-shadow: 0 0 0 3px rgb(34 197 94 / 25%); }
.am-dot.draft::before { background: #f59e0b; }
@media (max-width: 640px) { .am-faces { display: none; } .am-body { padding-left: 14px; } }

/* Setup check (agent_check.html): one line per thing the agent needs, green / amber / red */
.sc-head { display: flex; align-items: center; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.sc-head > div { flex: 1; }
.sc-head .h { margin: 0; }
.sc-big { font-size: 30px; }
.sc-list { list-style: none; margin: 8px 0 0; padding: 0; }
.sc-list li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.sc-list li:last-child { border-bottom: 0; }
.sc-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700;
  color: #fff; background: #16a34a; }
.sc-warn .sc-icon { background: #d97706; }
.sc-fail .sc-icon { background: #dc2626; }
.sc-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.chat-answered { background: #e7f6ec; color: #1d6b37; } .chat-failed { background: #fde8e8; color: #a32020; }
.chat-received, .chat-answering, .chat-waiting { background: #fff4e0; color: #8a5a00; }
.am-off { opacity: .55; } .am-off-chip { background: #f1f1f4; color: #6b6b76; }
/* When it runs → Sites picker (_build_sites.html, sitespick.js) */
.sp-dlg { width: min(640px, calc(100vw - 32px)); }
.sp-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 12px; }
.sp-mode .tile { display: grid; gap: 2px; cursor: pointer; }
.sp-mode .tile input { position: absolute; opacity: 0; pointer-events: none; }
.sp-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.sp-tools input[type=search] { flex: 1 1 220px; }
.sp-list { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.sp-list li { border-bottom: 1px solid var(--line); }
.sp-list li:last-child { border-bottom: 0; }
.sp-list label { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; cursor: pointer; flex-wrap: wrap; }
.sp-list label:hover { background: var(--surface-2); }
.sp-list.sp-off { opacity: .5; }
@media (max-width: 640px) { .sp-mode { grid-template-columns: 1fr; } }
.ev-block { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.ev-every { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .ev-every label { margin: 0; }
.ev-every input { width: 90px; }
.ev-block.p-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; } .ev-block.p-row input[type=time] { width: 120px; }
.wide-sec > .ws-ask { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
