/* ── Reset & Variables ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0f0f12;
  --surface:    #18181f;
  --card:       #1e1e26;
  --border:     #2a2a36;
  --border-mid: #333340;
  --text:       #f2f2f8;
  --text-dim:   #c0c0d8;
  --text-muted: #9090b0;
  --accent:     #f97316;
  --accent-bg:  rgba(249,115,22,0.12);
  --red:        #ef4444;
  --red-bg:     rgba(239,68,68,0.12);
  --amber:      #f59e0b;
  --amber-bg:   rgba(245,158,11,0.12);
  --blue:       #3b82f6;
  --blue-bg:    rgba(59,130,246,0.12);
  --r:  7px;
  --rs: 4px;
}

/* ── Light mode ─────────────────────────────────────────────────────────── */
html.theme-light {
  --bg:         #f0f0f8;
  --surface:    #ffffff;
  --card:       #e8e8f4;
  --border:     #d0d0e0;
  --border-mid: #b8b8cc;
  --text:       #1a1a2e;
  --text-dim:   #3a3a5a;
  --text-muted: #6060a0;
}

/* ── Accent colours ──────────────────────────────────────────────────────── */
html.accent-orange { --accent: #f97316; --accent-bg: rgba(249,115,22,0.12); }
html.accent-green  { --accent: #22c55e; --accent-bg: rgba(34,197,94,0.12); }
html.accent-blue   { --accent: #3b82f6; --accent-bg: rgba(59,130,246,0.12); }
html.accent-purple { --accent: #a855f7; --accent-bg: rgba(168,85,247,0.12); }
html.accent-cyan   { --accent: #06b6d4; --accent-bg: rgba(6,182,212,0.12); }
html.accent-amber  { --accent: #f59e0b; --accent-bg: rgba(245,158,11,0.12); }
html.accent-red    { --accent: #ef4444; --accent-bg: rgba(239,68,68,0.12); }
html.accent-pink   { --accent: #ec4899; --accent-bg: rgba(236,72,153,0.12); }

html, body { height: 100%; overflow: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Scrollbars ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.header-left  { display: flex; align-items: center; gap: 9px; }
.header-right { display: flex; align-items: center; gap: 8px; }

.tai-logo { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0; }

.header-title-group { display: flex; flex-direction: column; gap: 1px; }
.logo-text { font-size: 13px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.2; }
.logo-powered { font-size: 11px; color: var(--text-muted); line-height: 1; }

/* ── Header ad ──────────────────────────────────────────────────────────── */
.header-ad {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.header-ad:hover { border-color: var(--accent); background: var(--accent-bg); }
.header-ad-icon  { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; }
.header-ad-text  { display: flex; flex-direction: column; gap: 1px; }
.header-ad-label { font-size: 11px; font-weight: 700; color: var(--text); line-height: 1.1; }
.header-ad-cta   { font-size: 10px; color: var(--accent); line-height: 1.1; }
.header-divider  { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; margin: 0 2px; }

.logo-powered-link {
  display: flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}
.logo-powered-link:hover .tai-powered-name { text-decoration: underline; }

.tai-powered-logo {
  width: 14px;
  height: 14px;
  object-fit: contain;
  border-radius: 3px;
  flex-shrink: 0;
}
.tai-powered-name { font-size: 11px; font-weight: 600; color: var(--accent); }

.plan-badge {
  font-size: 14px; font-weight: 700; padding: 2px 8px;
  border-radius: 20px; border: 1px solid var(--border);
  background: var(--card); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.plan-badge.unlocked { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

/* ── Page info ──────────────────────────────────────────────────────────── */
.page-info {
  padding: 5px 10px 5px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
}
.page-info-main { flex: 1; overflow: hidden; }
.page-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-url   { font-size: 14px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* ── Auto-track toggle ──────────────────────────────────────────────────── */
.btn-track-toggle {
  flex-shrink: 0; font-size: 11px; padding: 3px 8px;
  border-radius: var(--rs); cursor: pointer; font-weight: 700;
  white-space: nowrap; transition: all 0.15s;
}
.btn-track-toggle.off {
  background: var(--card); border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-track-toggle.off:hover {
  border-color: var(--accent); color: var(--accent);
}
.btn-track-toggle.on {
  background: var(--acc-bg); border: 1px solid var(--accent);
  color: var(--accent);
  box-shadow: 0 0 6px var(--acc-glow, rgba(34,197,94,0.2));
}
.btn-track-toggle.on:hover {
  background: rgba(239,68,68,0.1); border-color: var(--red); color: var(--red);
}

.btn-reset-session {
  flex-shrink: 0; font-size: 11px; padding: 3px 8px;
  border-radius: var(--rs); border: 1px solid var(--border);
  background: var(--card); color: var(--text-muted);
  cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: border-color 0.12s, color 0.12s;
}
.btn-reset-session:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.btn-reset-session:disabled { opacity: 0.5; cursor: default; }

/* ── Tab bar ────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
}
.tab {
  flex: 1;
  padding: 10px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tab:hover  { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Content scroll area ────────────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.tab-pane        { display: flex; flex-direction: column; }
.tab-pane.hidden { display: none; }

/* ── Workflow steps ─────────────────────────────────────────────────────── */
.workflow-step {
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.divider { height: 1px; background: var(--border); margin: 0; flex-shrink: 0; }

.step-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.step-hint { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

.step-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.step-label-actions { display: flex; gap: 8px; }

/* ── Test Case row ──────────────────────────────────────────────────────── */
.test-case-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.active-test-display {
  flex: 1;
  font-size: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 6px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Result buttons ─────────────────────────────────────────────────────── */
.result-btns { display: flex; gap: 5px; }
.result-btn {
  flex: 1;
  padding: 6px 4px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.result-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.result-btn.pass:not(:disabled):hover    { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.result-btn.fail:not(:disabled):hover    { background: var(--red-bg);    border-color: var(--red);    color: var(--red); }
.result-btn.skip:not(:disabled):hover    { background: var(--card);      border-color: var(--border-mid); color: var(--text); }
.result-btn.blocked:not(:disabled):hover { background: var(--amber-bg);  border-color: var(--amber);  color: var(--amber); }

/* ── Inspect controls ───────────────────────────────────────────────────── */
.inspect-controls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.btn-mode-large {
  padding: 7px 14px;
  background: var(--card);
  border: 1px solid var(--border-mid);
  border-radius: var(--r);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-mode-large:hover { border-color: var(--accent); color: var(--accent); }
.btn-mode-large.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

.btn-mode-small {
  padding: 6px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-mode-small:hover { border-color: var(--border-mid); color: var(--text); }
.btn-mode-small.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.btn-mode-small.muted-btn { color: var(--text-muted); }

/* ── Draw options ───────────────────────────────────────────────────────── */
.draw-options { padding: 8px 10px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r); }
.draw-options.hidden { display: none; }
.draw-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.draw-label { font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }

.color-swatches { display: flex; gap: 4px; }
.swatch { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; padding: 0; flex-shrink: 0; }
.swatch.active { border-color: white; }

.draw-slider {
  -webkit-appearance: none; width: 70px; height: 3px;
  background: var(--border); border-radius: 2px; outline: none; cursor: pointer;
}
.draw-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
}

/* ── Element card ───────────────────────────────────────────────────────── */
.element-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.element-header { display: flex; align-items: center; gap: 6px; }
.tag-badge {
  font-size: 13px; font-weight: 700; padding: 2px 7px;
  border-radius: var(--rs); background: var(--blue-bg);
  border: 1px solid var(--blue); color: var(--blue);
  font-family: monospace; flex-shrink: 0;
}
.el-label { font-size: 14px; color: var(--text-dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.attr-grid {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 2px 6px;
  align-items: start;
}
.attr-k { font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; padding-top: 2px; }
.attr-v { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.attr-v.mono { font-family: monospace; }
.attr-v.wrap { white-space: normal; word-break: break-all; }

.selector-row {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--rs); padding: 4px 7px;
}
.sel-label { font-size: 14px; font-weight: 700; color: var(--text-muted); width: 38px; flex-shrink: 0; text-transform: uppercase; }
.sel-code  { font-size: 14px; font-family: monospace; color: var(--accent); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.el-attrs-extra { font-size: 14px; color: var(--text-muted); font-family: monospace; word-break: break-all; }

/* ── Collapsible element section ─────────────────────────────────────────── */
.el-collapse-header {
  width: 100%; display: flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer; padding: 4px 0;
  color: inherit; text-align: left;
}
.el-collapse-header:hover { opacity: 0.85; }

.el-collapse-summary {
  display: flex; align-items: center; gap: 5px;
  flex: 1; overflow: hidden; min-width: 0;
}

.el-label-inline {
  font-size: 13px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}

.el-collapse-actions {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}

.el-chevron {
  color: var(--text-muted); font-size: 11px; transition: transform 0.15s;
  user-select: none; display: inline-block;
}
.el-collapse-header[aria-expanded="true"] .el-chevron { transform: rotate(90deg); }

.el-collapse-body { margin-top: 6px; }
.el-collapse-body.hidden { display: none; }

/* ── Multi-selector list ─────────────────────────────────────────────────── */
.el-selectors-section { margin-top: 6px; }
.el-selectors-title {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px;
}
.el-selectors-list { display: flex; flex-direction: column; gap: 3px; }
.el-sel-row {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--rs); padding: 3px 7px;
  cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.el-sel-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--text-muted); flex-shrink: 0; min-width: 52px;
}
.el-sel-badge.robust  { color: var(--accent); }
.el-sel-badge.fragile { color: var(--text-muted); opacity: 0.65; }
.el-sel-val {
  font-size: 12px; font-family: monospace; color: var(--text);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.el-sel-row:hover { border-color: var(--accent); background: var(--accent-bg); }
.el-sel-row:hover .el-sel-val { color: var(--accent); }
.el-sel-row.copied { border-color: var(--accent); background: var(--accent-bg); }
.el-sel-row.copied .el-sel-val::after { content: " ✓ copied"; color: var(--accent); font-size: 11px; opacity: 0.8; }

/* ── AI action buttons (below element) ──────────────────────────────────── */
.ai-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── AI results ─────────────────────────────────────────────────────────── */
.ai-results-content {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 380px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 12px;
}
.ai-results-content h3       { font-size: 14px; font-weight: 700; color: var(--accent); margin: 8px 0 3px; }
.ai-results-content ul       { padding-left: 16px; margin: 4px 0; }
.ai-results-content li       { margin: 2px 0; }
.ai-results-content strong   { color: var(--text); }
.ai-results-content code     { font-size: 14px; background: var(--bg); padding: 1px 4px; border-radius: 3px; font-family: monospace; color: var(--blue); }

.ai-follow-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-follow-actions.hidden { display: none; }

/* ── Spinner ────────────────────────────────────────────────────────────── */
.spinner-wrap { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.spinner-wrap.hidden { display: none; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
#ai-spinner-label { font-size: 14px; color: var(--text-dim); }

/* ── Element Queue ──────────────────────────────────────────────────────── */
.queue-count {
  font-size: 14px; font-weight: 700; padding: 1px 6px;
  border-radius: 20px; background: var(--accent-bg);
  border: 1px solid var(--accent); color: var(--accent);
}

.element-queue { display: flex; flex-direction: column; gap: 6px; }

.queue-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color 0.15s;
}
.queue-item.analyzing { border-color: var(--amber); }
.queue-item.done      { border-color: var(--border); }
.queue-item.error     { border-color: var(--red); }

.qi-header {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.qi-thumb-wrap {
  position: relative;
  width: 72px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.qi-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.qi-thumb-tag {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.7);
  color: var(--blue);
  font-size: 13px;
  font-family: monospace;
  font-weight: 700;
  padding: 2px 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qi-body {
  flex: 1;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.qi-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qi-selector {
  font-size: 14px;
  font-family: monospace;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ── Analysis chips ─────────────────────────────────────────────────────── */
.qi-chips { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }

.qi-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.qi-chip:hover   { border-color: var(--border-mid); color: var(--text); }
.qi-chip.done    { border-color: var(--border-mid); color: var(--text); }
.qi-chip.open    { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.qi-chip.error   { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.qi-chip.loading { color: var(--text-muted); cursor: default; }

.qi-chip-spinner {
  display: inline-block;
  width: 9px; height: 9px;
  border: 1.5px solid var(--border-mid);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.qi-chip-count { font-size: 10px; opacity: 0.75; }
.qi-chip-warn  { color: var(--amber); font-weight: 800; }

/* keep thumb-placeholder for when screenshot isn't ready */
.qi-thumb-placeholder {
  height: 56px; display: flex; align-items: center;
  justify-content: center; color: var(--text-muted); font-size: 12px;
}

.qi-status-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.qi-status {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.qi-status.analyzing { color: var(--amber); }
.qi-status.done      { color: var(--accent); }
.qi-status.error     { color: var(--red); }
.qi-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.qi-dot.pulse { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.qi-counts { font-size: 14px; color: var(--text-muted); }
.qi-counts .has-issues { color: var(--amber); font-weight: 600; }

.qi-actions-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  padding: 6px 8px;
  gap: 4px;
  flex-shrink: 0;
}

.qi-details {
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.qi-details.hidden { display: none; }

.qi-tabs { display: flex; border-bottom: 1px solid var(--border); }
.qi-tab {
  padding: 5px 10px;
  background: none; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.qi-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.qi-panel {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 280px;
  overflow-y: auto;
}
.qi-panel.hidden { display: none; }

/* ── Analysis item cards ─────────────────────────────────────────────────── */
.ac {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ac-header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ac-num {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 50%; min-width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ac-num.best { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.ac-title { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; min-width: 0; }
.ac-title.mono { font-family: monospace; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  padding: 1px 6px; border-radius: 20px; flex-shrink: 0; letter-spacing: 0.03em;
}
.ac-badge.happy        { background: rgba(34,197,94,0.12);  color: var(--accent); border: 1px solid rgba(34,197,94,0.3); }
.ac-badge.edge         { background: rgba(245,158,11,0.12); color: var(--amber);  border: 1px solid rgba(245,158,11,0.3); }
.ac-badge.negative     { background: rgba(239,68,68,0.12);  color: var(--red);    border: 1px solid rgba(239,68,68,0.3); }
.ac-badge.boundary     { background: rgba(59,130,246,0.12); color: var(--blue);   border: 1px solid rgba(59,130,246,0.3); }
.ac-badge.high         { background: rgba(239,68,68,0.12);  color: var(--red);    border: 1px solid rgba(239,68,68,0.3); }
.ac-badge.medium       { background: rgba(245,158,11,0.12); color: var(--amber);  border: 1px solid rgba(245,158,11,0.3); }
.ac-badge.low          { background: rgba(34,197,94,0.12);  color: var(--accent); border: 1px solid rgba(34,197,94,0.3); }
.ac-badge.accessibility { background: rgba(168,85,247,0.12); color: #a855f7;      border: 1px solid rgba(168,85,247,0.3); }
.ac-badge.ux           { background: rgba(6,182,212,0.12);  color: #06b6d4;       border: 1px solid rgba(6,182,212,0.3); }
.ac-badge.bug          { background: rgba(239,68,68,0.12);  color: var(--red);    border: 1px solid rgba(239,68,68,0.3); }
.ac-badge.performance  { background: rgba(245,158,11,0.12); color: var(--amber);  border: 1px solid rgba(245,158,11,0.3); }
.ac-badge.robust       { background: rgba(34,197,94,0.12);  color: var(--accent); border: 1px solid rgba(34,197,94,0.3); }
.ac-badge.fragile      { background: rgba(239,68,68,0.12);  color: var(--red);    border: 1px solid rgba(239,68,68,0.3); }
.ac-body   { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.ac-steps  { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.ac-expect { font-size: 12px; color: var(--accent); line-height: 1.4; }
.ac-expect::before { content: "✓ "; font-weight: 700; }
.ac-footer { display: flex; justify-content: flex-end; margin-top: 2px; }

/* ── Test play button ────────────────────────────────────────────────────── */
.btn-play-test, .btn-play-page-test {
  margin-left: auto; flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-bg); border: 1px solid var(--accent);
  color: var(--accent); font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; line-height: 1; padding: 0;
}
.btn-play-test:hover:not(:disabled),
.btn-play-page-test:hover:not(:disabled) { background: var(--accent); color: var(--bg); }
.btn-play-test:disabled,
.btn-play-page-test:disabled { opacity: 0.5; cursor: default; }

/* ── Save test locally button ───────────────────────────────────────────── */
/* ── Create bug from Likely Bugs card ───────────────────────────────────── */
.btn-create-bug-from-likely {
  margin-left: auto; flex-shrink: 0;
  padding: 2px 7px; border-radius: var(--rs);
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 11px; cursor: pointer;
  transition: all 0.13s; line-height: 1.4;
}
.btn-create-bug-from-likely:hover {
  background: var(--red-bg); border-color: var(--red); color: var(--red);
}

/* ── Save test locally button ───────────────────────────────────────────── */
.btn-save-test-local {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: var(--rs);
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; line-height: 1; padding: 0;
}
.btn-save-test-local:hover { border-color: var(--accent); color: var(--accent); }
.btn-save-test-local.saved { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

/* ── Saved tests divider ────────────────────────────────────────────────── */
.saved-tests-header {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 6px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.saved-tests-header .saved-count-badge {
  background: var(--accent-bg); color: var(--accent);
  border: 1px solid rgba(var(--accent), 0.3);
  padding: 1px 5px; border-radius: 20px; font-size: 10px;
}
.saved-tests-divider {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 0; color: var(--text-muted); font-size: 11px;
}
.saved-tests-divider::before,
.saved-tests-divider::after { content:''; flex:1; height:1px; background: var(--border); }
.ac.saved-test-card { border-color: var(--accent); border-style: dashed; opacity: 0.85; }

/* ── Test run result row ─────────────────────────────────────────────────── */
.test-run-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 4px 6px; border-radius: var(--rs);
  margin-top: 3px;
}
.test-run-row.running { color: var(--text-muted); background: var(--card); }
.test-run-row.pass    { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.25); }
.test-run-row.fail    { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); }
.test-run-row.error   { background: var(--amber-bg); border: 1px solid rgba(245,158,11,0.25); }
.tr-icon    { font-weight: 700; flex-shrink: 0; }
.tr-verdict { font-weight: 700; flex-shrink: 0; }
.test-run-row.pass .tr-icon, .test-run-row.pass .tr-verdict { color: var(--accent); }
.test-run-row.fail .tr-icon, .test-run-row.fail .tr-verdict { color: var(--red); }
.test-run-row.error .tr-icon { color: var(--amber); }
.tr-msg { color: var(--text-dim); flex: 1; }

/* ── Pass/fail card border accent ────────────────────────────────────────── */
.ac.ac-pass { border-color: rgba(34,197,94,0.4); }
.ac.ac-fail { border-color: rgba(239,68,68,0.35); }

/* ── Tests panel export toolbar ──────────────────────────────────────────── */
.qi-panel-toolbar {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 8px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-wrap: wrap;
}
.qi-panel-label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.btn-export-tests {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--rs); color: var(--text-dim);
  cursor: pointer; transition: all 0.12s;
}
.btn-export-tests:hover { border-color: var(--accent); color: var(--accent); }

.btn-save-tests-sheet, .btn-save-page-tests-sheet {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  background: var(--card); border: 1px solid var(--accent);
  border-radius: var(--rs); color: var(--accent);
  cursor: pointer; transition: all 0.12s; flex-shrink: 0;
}
.btn-save-tests-sheet:hover:not(:disabled),
.btn-save-page-tests-sheet:hover:not(:disabled) { background: var(--accent-bg); }
.btn-save-tests-sheet:disabled,
.btn-save-page-tests-sheet:disabled { opacity: 0.6; cursor: default; }

.btn-more-tests, .btn-more-page-tests, .btn-more-form-data {
  font-size: 12px; font-weight: 600; padding: 4px 12px;
  background: var(--card); border: 1px dashed var(--border);
  border-radius: var(--rs); color: var(--text-muted);
  cursor: pointer; width: 100%; text-align: center;
  transition: border-color 0.12s, color 0.12s;
}
.btn-more-tests:hover:not(:disabled),
.btn-more-page-tests:hover:not(:disabled),
.btn-more-form-data:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-more-tests:disabled,
.btn-more-page-tests:disabled,
.btn-more-form-data:disabled { opacity: 0.5; cursor: default; }

.btn-create-issue {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  background: none; border: 1px solid var(--border);
  border-radius: var(--rs); color: var(--text-muted);
  cursor: pointer; transition: all 0.12s;
}
.btn-create-issue:hover {
  border-color: var(--red); color: var(--red); background: var(--red-bg);
}

/* ── Form assistant ─────────────────────────────────────────────────────── */
.form-assist-controls { display: flex; gap: 6px; flex-wrap: wrap; }
.page-ai-controls     { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Page analysis sub-tabs ─────────────────────────────────────────────── */
.page-analysis-step   { padding-bottom: 0 !important; }
.page-analysis-tabs   {
  display: flex; gap: 0; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; flex-shrink: 0;
}
.pat-tab {
  flex: 1; padding: 7px 8px; font-size: 12px; font-weight: 600;
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; transition: all 0.13s; border-right: 1px solid var(--border);
}
.pat-tab:last-child { border-right: none; }
.pat-tab:hover:not(.active) { background: var(--card); color: var(--text); }
.pat-tab.active { background: var(--accent-bg); color: var(--accent); }
.pat-tab.loading::after { content: ' …'; opacity: 0.6; }
.page-analysis-panel  {
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--r) var(--r); overflow: hidden;
}
.page-analysis-content {
  padding: 4px 0; max-height: 480px; overflow-y: auto;
}
.page-analysis-content .ac { border-radius: 0; border-left: none; border-right: none; border-top: none; }
.page-analysis-content .ac:last-of-type { border-bottom: none; }

/* ── Auto-analysis toggle row ───────────────────────────────────────────── */
.toggle-row {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 0;
}
.toggle-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.toggle-label-text { font-size: 13px; color: var(--text); }
.page-analysis-summary {
  font-size: 13px; color: var(--text-dim); line-height: 1.5;
  padding: 8px 10px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); margin-bottom: 6px;
}
.page-analysis-rec {
  font-size: 12px; color: var(--accent); line-height: 1.5;
  padding: 6px 10px; background: var(--accent-bg); border: 1px solid var(--accent);
  border-radius: var(--r); margin-top: 4px;
}

.form-fields-list { display: flex; flex-direction: column; gap: 3px; max-height: 160px; overflow-y: auto; }
.form-fields-list.hidden { display: none; }
.field-item {
  display: flex; align-items: center; gap: 6px; padding: 5px 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--rs); font-size: 13px;
}
.field-type-badge {
  font-size: 13px; font-weight: 700; padding: 1px 5px; border-radius: 3px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-muted);
  text-transform: uppercase; font-family: monospace; flex-shrink: 0;
}
.field-name  { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-value { font-family: monospace; font-size: 14px; color: var(--accent); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.form-fill-data { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; max-height: 340px; overflow-y: auto; }
.form-fill-data.hidden { display: none; }
.form-fill-loading { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; color: var(--text-muted); }
.spinner-inline { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }

/* ── Form fill cards ─────────────────────────────────────────────────────── */
.ff-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 7px 9px;
  display: flex; flex-direction: column; gap: 3px;
  transition: border-color 0.15s;
}
.ff-card-filled { border-color: var(--accent); }
.ff-card-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ff-card-meta   { display: flex; align-items: center; gap: 6px; overflow: hidden; flex: 1; }
.ff-label  { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-type-badge {
  font-size: 10px; padding: 1px 5px; border-radius: 3px; flex-shrink: 0;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-muted);
  font-family: monospace; text-transform: uppercase; letter-spacing: 0.04em;
}
.ff-value  { font-size: 13px; color: var(--accent); font-weight: 500; }
.ff-reason { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.ff-selector { font-size: 11px; color: var(--text-muted); font-family: monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-fill-one {
  font-size: 11px; padding: 3px 8px; border-radius: var(--rs); flex-shrink: 0;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer; font-weight: 600;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.btn-fill-one:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.btn-fill-one.filled { border-color: var(--accent); color: var(--accent); opacity: 0.7; pointer-events: none; }

.ff-filled-badge {
  font-size: 11px; color: var(--accent); font-weight: 600; flex-shrink: 0;
}

/* ── Session notes ──────────────────────────────────────────────────────── */
#test-session-notes { resize: vertical; }

/* ── Test case mode badge ────────────────────────────────────────────────── */
.testcase-mode-badge {
  font-size: 11px; font-weight: 600; color: var(--accent);
  background: var(--accent-bg); border: 1px solid var(--accent);
  border-radius: 20px; padding: 1px 8px; text-transform: uppercase; letter-spacing: 0.04em;
}

/* ── Local test case panel ───────────────────────────────────────────────── */
.local-tc-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.local-tc-panel.hidden { display: none; }

.local-tc-toolbar { display: flex; gap: 5px; }
.local-tc-input {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--rs); color: var(--text); font-size: 13px; padding: 5px 8px;
}
.local-tc-input:focus { outline: none; border-color: var(--accent); }

.local-tc-list { display: flex; flex-direction: column; gap: 3px; max-height: 180px; overflow-y: auto; }
.local-tc-empty { font-size: 13px; color: var(--text-muted); padding: 6px 0; text-align: center; }

.local-tc-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: var(--rs);
  border: 1px solid var(--border); background: var(--card);
  cursor: pointer; transition: border-color 0.12s;
}
.local-tc-item:hover { border-color: var(--border-mid); }
.local-tc-item.active { border-color: var(--accent); background: var(--accent-bg); }
.local-tc-item.local-tc-pass { border-color: var(--accent); }
.local-tc-item.local-tc-fail { border-color: var(--red); }
.local-tc-item.local-tc-skip { border-color: var(--border-mid); }
.local-tc-title { flex: 1; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.local-tc-result { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; flex-shrink: 0; }
.local-tc-del { font-size: 11px !important; }

/* ── TestRail picker panel ──────────────────────────────────────────────── */
.tr-picker-panel {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tr-picker-panel.hidden { display: none; }
.tr-picker-header { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 700; }

.tr-filter-row { display: flex; gap: 6px; }
.tr-filter-row select { flex: 0 0 120px; }
.tr-filter-row input  { flex: 1; }

.tr-cases-list { display: flex; flex-direction: column; gap: 3px; max-height: 200px; overflow-y: auto; }
.tr-case-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--rs);
  cursor: pointer; font-size: 13px; transition: border-color 0.15s;
}
.tr-case-item:hover  { border-color: var(--accent); }
.tr-case-item.active { border-color: var(--accent); background: var(--accent-bg); }
.tr-case-id    { font-family: monospace; font-size: 14px; color: var(--text-muted); width: 36px; flex-shrink: 0; }
.tr-case-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Bug Report tab ─────────────────────────────────────────────────────── */
.chip-row { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  padding: 4px 11px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--card);
  color: var(--text-dim); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.chip:hover  { border-color: var(--border-mid); color: var(--text); }
.chip.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

.attach-row { display: flex; gap: 12px; flex-wrap: wrap; }

.screenshot-preview-wrap { display: flex; flex-direction: column; gap: 5px; }
.screenshot-preview-wrap.hidden { display: none; }
.screenshot-preview { width: 100%; max-height: 120px; object-fit: cover; border-radius: var(--rs); border: 1px solid var(--border); }

.recent-bugs { display: flex; flex-direction: column; gap: 4px; }
.bug-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--card); border: 1px solid var(--border); border-radius: var(--rs); font-size: 13px; }
.bug-item a { color: var(--blue); text-decoration: none; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bug-item a:hover { text-decoration: underline; }
.sev-badge { font-size: 13px; font-weight: 700; padding: 1px 5px; border-radius: 3px; text-transform: uppercase; flex-shrink: 0; }
.sev-critical { background: var(--red-bg);   border: 1px solid var(--red);   color: var(--red); }
.sev-high     { background: var(--amber-bg); border: 1px solid var(--amber); color: var(--amber); }
.sev-medium   { background: var(--blue-bg);  border: 1px solid var(--blue);  color: var(--blue); }
.sev-low      { background: var(--card);     border: 1px solid var(--border); color: var(--text-muted); }

/* ── Testing Context (compact, Test tab) ────────────────────────────────── */
.ctx-summary { display: flex; flex-direction: column; gap: 3px; }
.ctx-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--rs); font-size: 13px;
}
.ctx-pill-scope {
  font-size: 13px; font-weight: 700; padding: 1px 5px; border-radius: 3px;
  text-transform: uppercase; flex-shrink: 0;
}
.scope-global { background: var(--accent-bg); border: 1px solid var(--accent); color: var(--accent); }
.scope-domain { background: var(--blue-bg);   border: 1px solid var(--blue);   color: var(--blue); }
.scope-url    { background: var(--amber-bg);  border: 1px solid var(--amber);  color: var(--amber); }
.ctx-pill-name { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-pill-len  { font-size: 14px; color: var(--text-muted); font-family: monospace; flex-shrink: 0; }

/* ── Testing Context (Settings tab) ─────────────────────────────────────── */
.ctx-scope-bar { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.ctx-scope-btn {
  flex: 1; padding: 6px 8px; background: var(--card); border: none;
  color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer;
  border-right: 1px solid var(--border); transition: all 0.15s;
}
.ctx-scope-btn:last-child { border-right: none; }
.ctx-scope-btn:hover  { color: var(--text); background: var(--surface); }
.ctx-scope-btn.active { background: var(--accent-bg); color: var(--accent); }

.ctx-scope-note { padding: 2px 0; min-height: 16px; }

.ctx-list { display: flex; flex-direction: column; gap: 4px; }

.ctx-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.ctx-item-header {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; cursor: pointer;
}
.ctx-item-header:hover { background: var(--surface); }
.ctx-item-toggle { accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.ctx-item-name   { flex: 1; font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-item-meta   { font-size: 14px; color: var(--text-muted); font-family: monospace; flex-shrink: 0; }
.ctx-item-preview { font-size: 14px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 10px 6px; }

.ctx-item-body { border-top: 1px solid var(--border); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.ctx-item-body.hidden { display: none; }
.ctx-item-content { font-size: 13px; color: var(--text-dim); font-family: monospace; white-space: pre-wrap; word-break: break-word; background: var(--card); border: 1px solid var(--border); border-radius: var(--rs); padding: 6px 8px; max-height: 120px; overflow-y: auto; }
.ctx-item-actions { display: flex; gap: 8px; }

.ctx-add-form { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; border-top: 1px solid var(--border); }
.form-optional { font-weight: 400; color: var(--text-muted); text-transform: none; font-size: 14px; }

/* ── Settings ───────────────────────────────────────────────────────────── */
.settings-block {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-block-title { font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.settings-hint { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.settings-block-hint { font-size: 13px; color: var(--text-muted); line-height: 1.4; margin-top: -2px; }
.settings-optional-badge {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 1px 7px; text-transform: lowercase; letter-spacing: 0;
}

.provider-options { display: flex; flex-direction: column; gap: 10px; }

.provider-btn-group {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.provider-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 6px 9px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
  user-select: none;
}
.provider-btn:hover {
  border-color: var(--border-mid);
  background: var(--surface);
}
.provider-btn.active {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.provider-btn-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}
.provider-btn-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.provider-btn-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1;
}
.provider-btn.active .provider-btn-label { color: var(--accent); }
.provider-btn.active .provider-btn-sub   { color: var(--accent); opacity: 0.7; }

.provider-panel { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.provider-panel.hidden { display: none; }
.provider-panel.active { display: flex; }

.provider-help {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 7px 10px;
}
.provider-help em { font-style: normal; color: var(--text-dim); font-weight: 600; }
.provider-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.provider-link:hover { text-decoration: underline; }

.settings-btn-row { display: flex; gap: 6px; }

.code-gen        { display: flex; flex-direction: column; gap: 8px; }
.code-gen.hidden { display: none; }
.gen-output      { display: flex; align-items: center; gap: 6px; }
.gen-output.hidden { display: none; }
.gen-output input { flex: 1; font-family: monospace; font-size: 14px; }

.unlock-status { font-size: 13px; padding: 5px 8px; border-radius: var(--rs); }
.unlock-status.hidden  { display: none; }
.unlock-status.valid   { background: var(--accent-bg); border: 1px solid var(--accent); color: var(--accent); }
.unlock-status.invalid { background: var(--red-bg);    border: 1px solid var(--red);    color: var(--red); }

.parallel-stat { font-size: 13px; color: var(--text-dim); }
.parallel-stat strong { color: var(--accent); font-family: monospace; }
.parallel-note { font-size: 11px; color: var(--text-muted); }

.usage-table { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.usage-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.usage-row:last-child { border-bottom: none; }
.usage-row span   { color: var(--text-dim); }
.usage-row strong { color: var(--accent); font-family: monospace; }
.usage-select {
  font-size: 12px; padding: 2px 6px; border-radius: var(--rs);
  background: var(--card); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer;
}
.usage-select:focus { outline: none; border-color: var(--accent); color: var(--accent); }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 3px; }
.form-group label { font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; display: flex; align-items: center; gap: 6px; }
.label-action { font-size: 14px; font-weight: 600; color: var(--accent); background: none; border: none; cursor: pointer; padding: 0; text-transform: none; letter-spacing: 0; margin-left: auto; }
.label-action:hover { text-decoration: underline; }
.form-row-2 { display: flex; gap: 8px; }
.form-row-2 .form-group { flex: 1; min-width: 0; }
.flex-1 { flex: 1; }

input[type=text], input[type=email], input[type=password],
input[type=url], input[type=number], textarea, select {
  width: 100%;
  padding: 6px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input[readonly] { color: var(--text-dim); cursor: default; }
select option { background: var(--card); }
textarea { resize: vertical; min-height: 60px; }

.checkbox-label { display: flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; color: var(--text-dim); }
.checkbox-label input { accent-color: var(--accent); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-danger, .btn-outline {
  padding: 6px 12px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-primary:disabled, .btn-secondary:disabled, .btn-danger:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-primary   { background: var(--accent-bg); border-color: var(--accent);       color: var(--accent); }
.btn-secondary { background: var(--card);       border-color: var(--border-mid);   color: var(--text-dim); }
.btn-danger    { background: var(--red-bg);     border-color: var(--red);          color: var(--red); }
.btn-outline   { background: var(--card);       border-color: var(--border);       color: var(--text-dim); }
.btn-full      { width: 100%; text-align: center; padding: 8px; font-size: 14px; }

.btn-primary:not(:disabled):hover   { filter: brightness(1.15); }
.btn-secondary:not(:disabled):hover { border-color: var(--border-mid); color: var(--text); }
.btn-danger:not(:disabled):hover    { filter: brightness(1.15); }
.btn-outline:not(:disabled):hover   { border-color: var(--accent); color: var(--accent); }

/* ── Local bug list ─────────────────────────────────────────────────────── */
.local-bugs-list { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.local-bug-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 7px 9px;
  display: flex; flex-direction: column; gap: 3px;
}
.local-bug-header { display: flex; align-items: center; gap: 6px; }
.local-bug-num    { font-size: 11px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.local-bug-title  { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.local-bug-sev    { flex-shrink: 0; }
.local-bug-url    { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.local-bug-desc   { font-size: 12px; color: var(--text-dim); line-height: 1.4; }

/* ── Local bug – file-to-tracker row ───────────────────────────────────── */
.local-bug-file-row {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--border);
}
.local-bug-file-label { font-size: 11px; color: var(--text-muted); margin-right: 2px; flex-shrink: 0; }
.btn-file-to-tracker {
  font-size: 11px; padding: 2px 7px; border-radius: 4px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer; font-weight: 600;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.btn-file-to-tracker:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.btn-file-to-tracker.filed { border-color: var(--accent); color: var(--accent); opacity: 0.65; pointer-events: none; }
.btn-file-to-tracker.error { border-color: var(--red); color: var(--red); }
.local-bug-filed-status { font-size: 11px; color: var(--text-muted); margin-left: 2px; }

.report-back-row { padding: 6px 0 2px; }

.btn-accent-sm {
  padding: 3px 9px; border-radius: var(--rs);
  background: var(--accent-bg); border: 1px solid var(--accent);
  color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: opacity 0.15s;
}
.btn-accent-sm:hover { opacity: 0.8; }

.btn-link {
  background: none; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--accent);
  padding: 0; transition: opacity 0.15s;
}
.btn-link:hover { opacity: 0.75; }
.btn-link.muted { color: var(--text-muted); }

.btn-copy {
  padding: 2px 7px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--rs); color: var(--text-dim); font-size: 14px; cursor: pointer;
  flex-shrink: 0;
}
.btn-copy:hover  { border-color: var(--accent); color: var(--accent); }
.btn-copy.copied { border-color: var(--accent); color: var(--accent); }

/* ── Hint / empty states ────────────────────────────────────────────────── */
.hint-box {
  font-size: 14px; color: var(--text-muted); line-height: 1.6;
  background: var(--card); border: 1px dashed var(--border);
  border-radius: var(--r); padding: 10px 12px;
}
.hint-box strong { color: var(--text-dim); }

/* ── Status messages ────────────────────────────────────────────────────── */
.status-msg { font-size: 13px; padding: 6px 9px; border-radius: var(--rs); }
.status-msg.hidden  { display: none; }
.status-msg.success { background: var(--accent-bg); border: 1px solid var(--accent); color: var(--accent); }
.status-msg.error   { background: var(--red-bg);    border: 1px solid var(--red);    color: var(--red); }
.status-msg.info    { background: var(--blue-bg);   border: 1px solid var(--blue);   color: var(--blue); }
.status-msg.loading { background: var(--card);      border: 1px solid var(--border); color: var(--text-dim); }

/* ── Theme picker ───────────────────────────────────────────────────────── */
.theme-mode-row { display: flex; gap: 6px; }
.theme-mode-btn {
  flex: 1; padding: 7px 10px;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--r); color: var(--text-dim);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.theme-mode-btn:hover  { border-color: var(--border-mid); color: var(--text); }
.theme-mode-btn.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

.theme-swatch-row { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid transparent; cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.theme-swatch:hover  { transform: scale(1.15); }
.theme-swatch.active { border-color: var(--text); transform: scale(1.1); }

/* ── Utilities ──────────────────────────────────────────────────────────── */
.hidden  { display: none !important; }
.muted   { color: var(--text-muted) !important; }
.text-sm { font-size: 13px; }
.mt-8    { margin-top: 8px; }
.mt-12   { margin-top: 12px; }
