/* SIM Autopilot Web UI — dashboard view. Dark default, light toggle. */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root[data-theme="dark"] {
  --bg: #1a1a1a; --bg-2: #212121; --bg-3: #2a2a2a; --bg-side: #171717;
  --text: #ececec; --text-2: #b4b4b4; --text-3: #7d7d7d;
  --border: #303030; --accent: #7c93f5; --accent-2: #a78bfa;
  --user-bubble: #2f2f2f; --code-bg: #0d0d0d;
  --amber: #e0a94a; --green: #4ec38a; --blue: #5aa0e6; --red: #e56a6a; --gray: #6e6e6e;
}
:root[data-theme="light"] {
  --bg: #ffffff; --bg-2: #f7f7f8; --bg-3: #ececec; --bg-side: #f5f5f5;
  --text: #1a1a1a; --text-2: #4a4a4a; --text-3: #8a8a8a;
  --border: #e2e2e2; --accent: #4f6ef2; --accent-2: #7c5cf0;
  --user-bubble: #eef0f7; --code-bg: #f5f5f5;
  --amber: #b7791f; --green: #22855c; --blue: #2f74c0; --red: #cc4b4b; --gray: #9a9a9a;
}

body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; }
.hidden { display: none !important; }
.app { display: flex; height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- sidebar ---- */
.sidebar { width: 300px; min-width: 300px; background: var(--bg-side); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.sidebar-header { display: flex; align-items: center; gap: 4px; padding: 14px 14px 8px; }
.sidebar-title { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.sidebar-header-spacer { flex: 1; }
.sidebar-action-btn { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 5px; border-radius: 7px; display: flex; }
.sidebar-action-btn:hover { background: var(--bg-3); color: var(--text); }
.queue-meta { padding: 0 16px 2px; font-size: 12px; color: var(--text-3); }
.cron-meta { padding: 0 16px 10px; font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.cron-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cron-dot.live { background: var(--green); animation: cron-pulse 1.4s ease-in-out infinite; }
.cron-dot.idle { background: var(--text-3); }
@keyframes cron-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---- sidebar search ---- */
.sidebar-search { position: relative; display: flex; align-items: center; margin: 0 12px 8px; }
.sidebar-search .search-icon { position: absolute; left: 9px; color: var(--text-3); pointer-events: none; }
#sim-search {
  width: 100%; padding: 6px 26px 6px 28px; font: inherit; font-size: 12.5px;
  background: var(--bg-3); color: var(--text);
  border: 1px solid transparent; border-radius: 8px; outline: none;
}
#sim-search::placeholder { color: var(--text-3); }
#sim-search:focus { border-color: var(--accent); background: var(--bg-2); }
.search-clear {
  position: absolute; right: 6px; display: flex; padding: 3px;
  background: none; border: none; border-radius: 5px; color: var(--text-3); cursor: pointer;
}
.search-clear:hover { background: var(--bg-side); color: var(--text); }
/* match count line — only rendered while a query is active */
.search-count { padding: 0 16px 8px; font-size: 11px; color: var(--text-3); }
.search-count .hit { color: var(--accent); font-weight: 600; }
/* highlight the matched substring inside a row's title */
/* fallback first: color-mix is Chrome 111+/Safari 16.2+, and a dropped declaration would leave the
   default yellow-on-black mark, which is unreadable in the dark theme. */
.sim-item mark { background: rgba(124, 147, 245, 0.30); color: inherit; border-radius: 2px; padding: 0 1px; }
.sim-item mark { background: color-mix(in srgb, var(--accent) 32%, transparent); }

/* ---- per-SIM alias: replaces the ticket title in the row ---- */
/* Marked only by a faint accent bar, not a coloured pill — the row should read as a NAME, and a
   badge-looking chip next to a long title was visual noise. */
.sim-item-title.is-alias {
  border-left: 2px solid var(--accent); padding-left: 6px; font-weight: 600;
}
.alias-btn, .alias-revert-btn {
  padding: 0 3px; font-size: 11px; line-height: 1;
  background: none; border: none; color: var(--text-3); cursor: pointer; border-radius: 4px;
  opacity: 0;                     /* revealed on row hover — keeps the resting list clean */
}
.alias-btn { margin-left: auto; }
.alias-revert-btn { font-size: 12px; }
.sim-item:hover .alias-btn, .sim-item:hover .alias-revert-btn { opacity: 1; }
.alias-btn:hover, .alias-revert-btn:hover { background: var(--bg-side); color: var(--text); }
/* no-alias rows get class="hidden" on the revert button; the global .hidden rule already wins */
.alias-input {
  width: 100%; padding: 2px 6px; font: inherit; font-size: 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--accent); border-radius: 6px; outline: none;
}

.sidebar-sims { flex: 1; overflow-y: auto; padding: 0 8px 20px; }

.sim-item { padding: 8px 10px; border-radius: 9px; cursor: pointer; margin-bottom: 2px; border-left: 2px solid transparent; }
.sim-item:hover { background: var(--bg-3); }
.sim-item.active { background: var(--bg-3); border-left-color: var(--accent); }
.sim-item.kbd-focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.sim-item.open .sim-id::after { content: " ●"; color: var(--accent); font-size: 9px; vertical-align: middle; }
.sim-item.bucket-decide { border-left-color: var(--amber); }
.sim-item.bucket-merge { border-left-color: var(--green); }
.sim-item-top { display: flex; align-items: baseline; gap: 5px; }
.sim-item-title { font-size: 13px; line-height: 1.35; color: var(--text); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sim-item-sub { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--text-3); margin-top: 4px; }
.sim-id { font-family: ui-monospace, Menlo, monospace; color: var(--text-2); }
.sim-age { margin-left: auto; color: var(--text-3); }
.unseen-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.sim-item.unseen .sim-item-title { font-weight: 650; color: var(--text); }
.prio-hi { color: var(--red); font-size: 10px; }
.prio-lo { color: var(--text-3); font-size: 10px; }
/* status chip */
.chip { font-size: 9.5px; font-weight: 700; letter-spacing: 0.03em; padding: 1px 6px; border-radius: 10px; background: var(--bg-3); color: var(--text-3); flex-shrink: 0; }
.chip-decide { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); }
.chip-merge { background: color-mix(in srgb, var(--green) 22%, transparent); color: var(--green); }
.chip-pending { background: color-mix(in srgb, var(--blue) 22%, transparent); color: var(--blue); }
.chip-working { background: color-mix(in srgb, var(--accent-2) 22%, transparent); color: var(--accent-2); }
.chip-verify { background: color-mix(in srgb, var(--blue) 18%, transparent); color: var(--blue); }
.chip-done { background: color-mix(in srgb, var(--gray) 22%, transparent); color: var(--text-3); }
.sim-item.bucket-verify, .sim-item.bucket-done { opacity: 0.72; }
.zone-hdr { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); padding: 14px 10px 6px; }
.zone-hdr.z-needsyou { color: var(--amber); }
.zone-hdr.z-working { color: var(--accent-2); }
.offplate-hdr { font-size: 11px; font-weight: 600; color: var(--text-3); padding: 14px 10px 6px; cursor: pointer; user-select: none; }
.offplate-hdr:hover { color: var(--text-2); }
.sim-empty { color: var(--text-3); font-size: 12px; padding: 8px 12px; font-style: italic; }

/* ---- chat area + tabs ---- */
.chat-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tabbar { display: flex; gap: 2px; padding: 8px 10px 0; background: var(--bg); border-bottom: 1px solid var(--border); overflow-x: auto; min-height: 42px; }
.tab { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 9px 9px 0 0; background: var(--bg-2); color: var(--text-2); cursor: pointer; font-size: 13px; white-space: nowrap; border: 1px solid transparent; border-bottom: none; max-width: 220px; }
.tab.active { background: var(--bg-3); color: var(--text); }
.tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gray); flex-shrink: 0; }
.tab.bucket-decide .tab-dot { background: var(--amber); }
.tab.bucket-merge .tab-dot { background: var(--green); }
.tab.bucket-pending .tab-dot { background: var(--blue); }
.tab.bucket-working .tab-dot { background: var(--accent-2); }
.tab-label { overflow: hidden; text-overflow: ellipsis; }
.tab-close { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; border-radius: 4px; }
.tab-close:hover { background: var(--border); color: var(--text); }

.panes { flex: 1; position: relative; overflow: hidden; }
.empty-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.empty-content { text-align: center; max-width: 420px; padding: 20px; }
.empty-title { font-size: 30px; font-weight: 650; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.empty-subtitle { color: var(--text-3); margin-top: 12px; font-size: 14px; line-height: 1.5; }

/* ---- pane ---- */
.pane { position: absolute; inset: 0; display: flex; flex-direction: column; }
.pane-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--bg-2); }
.pane-header-main { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.pane-simid { font-family: ui-monospace, Menlo, monospace; font-weight: 600; font-size: 13px; }
.pane-title { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-header-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.pane-status { font-size: 10px; font-weight: 700; letter-spacing: 0.03em; padding: 3px 8px; border-radius: 20px; background: var(--bg-3); color: var(--text-2); }
.status-needs_human_input { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); }
.status-pending { background: color-mix(in srgb, var(--blue) 22%, transparent); color: var(--blue); }
.status-working { background: color-mix(in srgb, var(--accent-2) 22%, transparent); color: var(--accent-2); }
.status-done { background: color-mix(in srgb, var(--green) 22%, transparent); color: var(--green); }
.pane-cr { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.pane-md-btn { background: var(--bg-3); border: 1px solid var(--border); color: var(--text-2); font-family: ui-monospace, monospace; font-size: 11px; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.pane-md-btn:hover { color: var(--text); }

.pane-messages { flex: 1; overflow-y: auto; padding: 24px 0 12px; scroll-behavior: smooth; }
.message { max-width: 780px; margin: 0 auto 18px; padding: 0 24px; }
.message.user { display: flex; justify-content: flex-end; }
.message.user .message-bubble { background: var(--user-bubble); padding: 11px 16px; border-radius: 18px 18px 5px 18px; max-width: 85%; }
.message.assistant .message-bubble { font-size: var(--chat-font-size, 14.5px); line-height: 1.65; }
/* Live card refresh: a change landed while you were reading — flash so it can't be missed. */
.message.card-updated .message-bubble { animation: card-flash 1.6s ease-out; border-radius: 8px; }
@keyframes card-flash {
  0%   { background: color-mix(in srgb, var(--accent) 22%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 12%, transparent); }
  100% { background: transparent; box-shadow: 0 0 0 6px transparent; }
}
.message.system .message-bubble { color: var(--red); font-size: 13px; }
.message-bubble p { margin-bottom: 10px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { padding-left: 22px; margin: 8px 0; }
.message-bubble li { margin: 3px 0; }
.message-bubble h1, .message-bubble h2, .message-bubble h3 { margin: 16px 0 8px; font-weight: 650; }
.message-bubble h1 { font-size: 17px; } .message-bubble h2 { font-size: 15.5px; } .message-bubble h3 { font-size: 14.5px; }
.message-bubble table { border-collapse: collapse; margin: 10px 0; width: 100%; font-size: 13px; }
.message-bubble th, .message-bubble td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.message-bubble th { background: var(--bg-3); }
.message-bubble blockquote { border-left: 3px solid var(--border); padding-left: 12px; color: var(--text-2); margin: 10px 0; }
.message-bubble :not(pre) > code { background: var(--code-bg); padding: 2px 6px; border-radius: 4px; font-family: ui-monospace, Menlo, monospace; font-size: 0.9em; }

.code-block-wrapper { margin: 12px 0; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.code-block-header { display: flex; justify-content: space-between; align-items: center; padding: 5px 12px; background: var(--bg-3); font-size: 11px; color: var(--text-3); }
.code-copy { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 11px; }
.code-copy:hover { color: var(--text); }
.code-block-wrapper pre { background: var(--code-bg); padding: 13px; overflow-x: auto; }
.code-block-wrapper pre code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }

/* full-md modal */
.md-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; z-index: 200; }
.md-modal { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; width: min(860px, 92vw); max-height: 88vh; display: flex; flex-direction: column; }
.md-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); font-family: ui-monospace, monospace; font-size: 13px; }
.md-close { background: none; border: none; color: var(--text-3); font-size: 22px; cursor: pointer; line-height: 1; }
.md-body { overflow-y: auto; padding: 20px 24px; font-size: 13.5px; line-height: 1.6; }

/* work-in-terminal button + block */
.pane-work-btn { background: color-mix(in srgb, var(--accent) 16%, transparent); border: 1px solid var(--accent); color: var(--accent); font-size: 11px; padding: 3px 9px; border-radius: 6px; cursor: pointer; white-space: nowrap; font-weight: 600; }
.pane-work-btn:hover { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.work-block { max-width: 780px; margin: 8px auto 14px; padding: 12px 16px; border: 1px solid var(--accent); border-radius: 10px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.work-head { font-size: 12.5px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.work-label { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.work-cmd { font-family: ui-monospace, Menlo, monospace; font-size: 14px; color: var(--text); background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; user-select: all; }
.work-foot { font-size: 11px; color: var(--text-3); margin-top: 8px; }
.takeover-block { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 8%, transparent); }
.takeover-block .work-head { color: var(--amber); }
.takeover-actions { display: flex; gap: 8px; margin-top: 10px; }
.takeover-btn { background: var(--amber); color: #1a1a1a; border: none; font-weight: 700; font-size: 12.5px; padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.takeover-btn:hover { filter: brightness(1.1); }
.takeover-cancel { background: var(--bg-3); color: var(--text-2); border: 1px solid var(--border); font-size: 12.5px; padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.takeover-cancel:hover { color: var(--text); }

/* answer row — input box at the bottom of each pane */
.answer-row { display: flex; align-items: flex-end; gap: 8px; padding: 10px 20px 14px; border-top: 1px solid var(--border); background: var(--bg); }
.answer-input { flex: 1; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px 14px; color: var(--text); font-family: inherit; font-size: 14px; resize: none; outline: none; max-height: 120px; line-height: 1.5; }
.answer-input:focus { border-color: var(--accent); }
.answer-input::placeholder { color: var(--text-3); }
.answer-btn { background: var(--accent); border: none; color: #fff; padding: 8px 16px; border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.answer-btn:hover { filter: brightness(1.1); }
.answer-btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

/* draft-for-ticket modal */
.pane-draft-btn { background: color-mix(in srgb, var(--accent-2) 14%, transparent); border: 1px solid var(--accent-2); color: var(--accent-2); font-size: 11px; padding: 3px 9px; border-radius: 6px; cursor: pointer; white-space: nowrap; font-weight: 600; }
.pane-draft-btn:hover { background: color-mix(in srgb, var(--accent-2) 26%, transparent); }
.draft-modal { max-width: 680px; }
.draft-note { font-size: 12px; color: var(--text-3); padding: 8px 20px; border-bottom: 1px solid var(--border); }
.draft-text { flex: 1; background: var(--bg-2); border: none; outline: none; color: var(--text); font-family: ui-monospace, Menlo, monospace; font-size: 13px; line-height: 1.5; padding: 14px 20px; resize: none; min-height: 240px; }
.draft-actions { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); justify-content: flex-end; }
.draft-cancel { background: var(--bg-2); border: 1px solid var(--border); color: var(--text-2); padding: 7px 16px; border-radius: 20px; cursor: pointer; font-size: 13px; }
.draft-approve { background: var(--accent); border: none; color: #fff; padding: 7px 16px; border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: 600; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- Teams onboarding modal ---- */
.teams-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.teams-overlay.hidden { display: none !important; }
.teams-panel { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; width: min(920px, 100%); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,0.4); }
.teams-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 22px 14px; border-bottom: 1px solid var(--border); gap: 16px; }
.teams-title { font-size: 17px; font-weight: 650; margin-bottom: 4px; }
.teams-subtitle { font-size: 12.5px; color: var(--text-3); line-height: 1.5; max-width: 640px; }
.teams-close { background: none; border: none; color: var(--text-3); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.teams-close:hover { color: var(--text); }
.teams-body { flex: 1; overflow: auto; padding: 16px 22px 22px; }
.teams-list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.teams-list { display: flex; flex-direction: column; gap: 8px; }
.team-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--bg-2); }
.team-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.team-name { font-weight: 650; font-size: 14px; }
.team-tier-badge { font-size: 10.5px; padding: 2px 7px; border-radius: 999px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.team-tier-byo-skill { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.team-tier-byo-skill-kb { background: color-mix(in srgb, var(--accent-2) 18%, transparent); color: var(--accent-2); }
.team-tier-byo-agent { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.team-meta { font-size: 12px; color: var(--text-2); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 12px; }
.team-meta-item { display: inline-flex; align-items: center; gap: 4px; }
.team-services { font-size: 11.5px; color: var(--text-3); margin-top: 6px; font-family: ui-monospace, Menlo, monospace; }
.team-actions { display: flex; gap: 6px; margin-top: 8px; }
.team-action-btn { background: var(--bg-3); border: 1px solid var(--border); color: var(--text-2); font-size: 11.5px; padding: 3px 10px; border-radius: 14px; cursor: pointer; }
.team-action-btn:hover { color: var(--text); border-color: var(--accent); }
.team-action-btn.danger:hover { color: var(--red); border-color: var(--red); }
.teams-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: 13px; border: 1px dashed var(--border); border-radius: 10px; }
.teams-wizard { margin-top: 20px; padding: 16px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; }
.teams-wizard-title { font-weight: 650; font-size: 14px; margin-bottom: 12px; }
.wizard-tier-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-bottom: 14px; }
.wizard-tier { border: 1px solid var(--border); background: var(--bg); padding: 10px 12px; border-radius: 9px; cursor: pointer; text-align: left; }
.wizard-tier.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.wizard-tier-name { font-weight: 600; font-size: 12.5px; margin-bottom: 2px; }
.wizard-tier-desc { font-size: 11px; color: var(--text-3); line-height: 1.4; }
.wizard-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.wizard-field label { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.wizard-field input, .wizard-field textarea { background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; color: var(--text); font-family: inherit; font-size: 13px; outline: none; }
.wizard-field input:focus, .wizard-field textarea:focus { border-color: var(--accent); }
.wizard-field .hint { font-size: 11px; color: var(--text-3); }
.wizard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wizard-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.wizard-cancel { background: var(--bg); border: 1px solid var(--border); color: var(--text-2); padding: 6px 14px; border-radius: 18px; cursor: pointer; font-size: 12.5px; }
.wizard-submit { background: var(--accent); border: none; color: #fff; padding: 6px 14px; border-radius: 18px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.wizard-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.wizard-error { color: var(--red); font-size: 12px; margin-top: 8px; padding: 8px 10px; background: color-mix(in srgb, var(--red) 10%, transparent); border: 1px solid var(--red); border-radius: 7px; }
.wizard-preview { margin-top: 14px; padding: 10px 12px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; color: var(--text-2); max-height: 220px; overflow: auto; white-space: pre-wrap; }
.btn.primary { background: var(--accent); border: none; color: #fff; padding: 6px 14px; border-radius: 18px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }

/* ---- Mermaid diagram + collapsible details ---- */
.mermaid-diagram { display: flex; justify-content: center; margin: 12px 0; padding: 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; }
.mermaid-diagram svg { max-width: 100%; height: auto; }

details { margin: 8px 0; padding: 10px 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; }
details > summary { cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--text-2); user-select: none; }
details > summary:hover { color: var(--text); }
details[open] > summary { margin-bottom: 8px; color: var(--text); }
