.debug-section {
  border-bottom: 1px solid var(--border-subtle);
}

.debug-section:last-child {
  border-bottom: none;
}

.terminal-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.terminal-container {
  flex: 1;
  background: var(--bg-secondary);
  padding: var(--space-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

#terminal {
  height: 100%;
}


/* Panel header uses a simple 8px status dot */

.agent-tab {
  padding: var(--space-1) var(--space-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all var(--transition-fast);
}

.agent-tab:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.agent-tab.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--border-default);
}

.agent-tab-pane {
  display: none;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.agent-tab-pane.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ── Prompt / External Agent Pane ───────────────── */
.prompt-container {
  padding: var(--space-4);
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.prompt-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  font-size: 13px;
}
.prompt-step {
  margin-bottom: var(--space-2);
}
.prompt-step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.prompt-command {
  white-space: pre-wrap;
  word-break: break-all;
  font-family: var(--font-mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 12px;
  line-height: 1.5;
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin: 0 0 8px 0;
  user-select: all;
}
/* ── Chat Messages ──────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── Chat Items (structural wrapper) ─────────────── */
/* Only show separator before user messages (marks a new conversation turn) */
.chat-item { border-bottom: none; }
.msg-user { border-top: 1px solid var(--border-subtle); }

/* ── Spin Animation (shared) ──────────────────────── */
.spin-icon { animation: spin 0.7s linear infinite; display: inline-block; }

/* ── User Messages (right-aligned bubble) ─────────── */
.msg-user { padding: 10px 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-user-bubble {
  max-width: 80%; font-size: 13px; line-height: 1.55; color: var(--text-primary);
  text-align: left; background: var(--bg-tertiary); padding: 8px 12px;
  border-radius: 10px 10px 2px 10px; word-break: break-word;
}

/* ── AI Messages (left-aligned, no bubble bg) ──────── */
.msg-ai { padding: 10px 16px; display: flex; justify-content: flex-start; }
.msg-ai-bubble {
  max-width: 85%; font-size: 13px; line-height: 1.55; color: var(--text-primary);
  word-break: break-word;
}

/* ── File Attachment Card ──────────────────────────── */
.msg-file {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; background: var(--bg-primary);
  border: 1px solid var(--border-default); border-radius: 8px;
  font-size: 12px; color: var(--text-secondary); max-width: 80%;
}
.msg-file-icon { flex-shrink: 0; color: var(--accent, #b30000); }
.msg-file-icon .material-icons-outlined { font-size: 18px; }
.msg-file-info { flex: 1; min-width: 0; }
.msg-file-name { font-weight: 600; color: var(--text-primary); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-file-meta { font-size: 10px; color: var(--text-muted); }

/* ── Generic inline spinner (used by upload status, etc.) ──── */
.work-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--accent-light, rgba(179,0,0,0.2));
  border-top-color: var(--accent, #b30000);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ── Activity Bar (unified tool-call ticker) ──────────── */
.activity-bar {
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  font-size: 12px;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.activity-bar[hidden] { display: none; }

.activity-bar-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  cursor: pointer;
}
.activity-bar-summary:hover { background: var(--bg-elevated); }

.activity-icon {
  width: 14px; height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.activity-icon > * { display: none; }

.activity-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--accent-light, rgba(179,0,0,0.2));
  border-top-color: var(--accent, #b30000);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.activity-icon-done { color: var(--green); font-size: 16px !important; }
.activity-icon-error { color: var(--red); font-size: 16px !important; }

.activity-bar.running .activity-spinner { display: block; }
.activity-bar.idle .activity-icon-done { display: inline; }
.activity-bar.error .activity-icon-error { display: inline; }

.activity-bar.running {
  background: rgba(179, 0, 0, 0.04);
  border-bottom-color: var(--accent-light, rgba(179,0,0,0.25));
}
.activity-bar.error {
  background: rgba(220, 38, 38, 0.06);
  border-bottom-color: var(--red, #dc2626);
}

.activity-phrase {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-bar.running .activity-phrase { color: var(--text-primary); }
.activity-bar.error .activity-phrase { color: var(--red); }

.activity-count {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.activity-chevron {
  font-size: 18px;
  color: var(--text-muted);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.activity-bar.expanded .activity-chevron { transform: rotate(180deg); }

.activity-bar-log {
  display: none;
  max-height: 40vh;
  overflow-y: auto;
  padding: 6px 14px 8px;
  border-top: 1px dashed var(--border-default);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.activity-bar.expanded .activity-bar-log { display: block; }

.activity-row {
  padding: 3px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.activity-row-icon { font-size: 13px; flex-shrink: 0; width: 14px; display: inline-flex; align-items: center; justify-content: center; }
.activity-row-icon.pending {
  width: 12px; height: 12px;
  border: 2px solid var(--accent-light, rgba(179,0,0,0.2));
  border-top-color: var(--accent, #b30000);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.activity-row-icon.ok { color: var(--green); }
.activity-row-icon.err { color: var(--red); }
.activity-row-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-row-text strong { color: var(--text-primary); font-weight: 600; }
.activity-row-detail {
  display: none;
  margin: 4px 0 4px 22px;
  padding: 6px 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 10px;
  color: var(--text-muted);
  max-height: 200px;
  overflow-y: auto;
}
.activity-row.show-detail .activity-row-detail { display: block; }
.activity-row.err .activity-row-detail { color: var(--red, #dc2626); background: rgba(220,38,38,0.06); }

/* ── System & Error Messages ──────────────────────── */
.chat-status {
  padding: 6px 16px; font-size: 11px; color: var(--text-muted);
  font-style: italic; text-align: center;
}
.chat-error {
  padding: 8px 16px;
  background: rgba(179, 0, 0, 0.08); border-left: 2px solid var(--accent, #b30000);
  color: var(--color-error, #b30000); font-size: 11px;
}

/* ── Input Area (two-row layout) ─────────────────── */
.input-area {
  flex-shrink: 0;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-default);
  transition: border-color 0.15s, background 0.15s;
}
.input-area.drag-over {
  border-color: var(--status-info, #3b82f6);
  background: rgba(59,130,246,0.06);
}

.input-row-1 {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.input-textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  line-height: 1.4;
  color: var(--text-primary);
  max-height: 120px;
  overflow-y: auto;
}

.input-textarea::placeholder { color: var(--text-muted); }

.input-textarea.masked {
  -webkit-text-security: disc;
  text-security: disc;
}

.input-row-2 {
  display: flex;
  align-items: center;
  margin-top: 6px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.icon-btn .material-icons-outlined { font-size: 20px; }

.input-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
}

.send-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: var(--accent, #b30000);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.1s;
  margin-left: 2px;
  flex-shrink: 0;
}
.send-btn:hover { opacity: 0.85; }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.send-btn .material-icons-outlined { font-size: 18px; }

/* Scanning state for send button */
.send-btn.scanning .material-icons-outlined { display: none; }
.send-btn.scanning::after {
  content: '';
  display: block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.autopilot-inline {
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  flex-shrink: 0;
  color: var(--amber, #f59e0b);
  background: rgba(245,158,11,0.1);
}
.autopilot-inline:hover { background: rgba(245,158,11,0.18); }
.autopilot-inline .material-icons-outlined { font-size: 20px; }

/* Protection toggle pill */
.protection-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.protection-toggle:hover { background: var(--border-subtle); }
.protection-toggle.on { background: var(--accent-light, rgba(179,0,0,0.08)); border-color: var(--accent-line, rgba(179,0,0,0.15)); }
.protection-toggle.on:hover { background: rgba(179,0,0,0.12); }
.protection-toggle .material-icons-outlined { font-size: 14px; transition: color 0.15s; }
.protection-toggle.on .material-icons-outlined { color: var(--accent, #b30000); }
.protection-toggle.off .material-icons-outlined { color: var(--text-muted); }
.protection-text { font-size: 10px; font-weight: 600; letter-spacing: 0.02em; transition: color 0.15s; }
.protection-toggle.on .protection-text { color: var(--accent, #b30000); }
.protection-toggle.off .protection-text { color: var(--text-muted); }

/* ── PII Preview Bar ──────────────────────────────── */
.pii-bar {
  flex-shrink: 0;
  padding: 10px 14px;
  background: var(--accent-light, rgba(179,0,0,0.08));
  border-top: 1px solid var(--accent-line, rgba(179,0,0,0.15));
}
.pii-bar.hidden { display: none; }

.pii-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  word-break: break-word;
  margin-bottom: 6px;
}

.pii-hl {
  color: var(--accent, #b30000);
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(179,0,0,0.06);
  padding: 1px 4px;
  border-radius: 3px;
}

.pii-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pii-actions .material-icons-outlined { font-size: 16px; color: var(--accent, #b30000); }
.pii-actions kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text-primary);
}
.pii-actions .pii-sep { color: var(--text-muted); font-size: 10px; }

/* ── Policy Approval Card ────────────────────────── */
.policy-bar {
  flex-shrink: 0;
  border-top: 1px solid var(--border-default);
  background: var(--bg-primary);
}
.policy-bar.hidden { display: none; }

.policy-card {
  margin: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.policy-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(245,158,11,0.03));
  border-bottom: 1px solid var(--border-subtle);
}
.policy-card-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(245,158,11,0.12);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.policy-card-icon .material-icons-outlined { font-size: 16px; color: var(--amber, #f59e0b); }
.policy-card-titles { flex: 1; }
.policy-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.policy-card-subtitle { font-size: 11px; font-weight: 400; color: var(--text-secondary); }
.policy-card-dismiss {
  border: none; background: none; color: var(--text-muted);
  cursor: pointer; width: 24px; height: 24px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.policy-card-dismiss:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.policy-card-body { padding: 8px 12px; }
.policy-detail-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0; font-size: 12px; color: var(--text-secondary);
}
.policy-detail-row .material-icons-outlined { font-size: 14px; color: var(--text-muted); flex-shrink: 0; }
.policy-detail-label { color: var(--text-muted); font-size: 11px; min-width: 50px; }
.policy-card-actions {
  display: flex; gap: 8px; padding: 8px 12px;
  border-top: 1px solid var(--border-subtle); background: var(--bg-secondary);
}
.policy-action-btn {
  flex: 1; padding: 7px 0; font-size: 12px; font-weight: 600;
  border-radius: 6px; cursor: pointer; border: 1px solid;
  transition: all 0.15s; text-align: center;
}
.policy-action-btn.allow { background: var(--green, #22c55e); color: #fff; border-color: var(--green, #22c55e); }
.policy-action-btn.allow:hover { filter: brightness(0.9); }
.policy-action-btn.once { background: var(--bg-primary); color: var(--text-secondary); border-color: var(--border-default); }
.policy-action-btn.once:hover { background: var(--bg-tertiary); }
.policy-action-btn.deny { background: var(--bg-primary); color: var(--accent, #b30000); border-color: var(--accent-line, rgba(179,0,0,0.15)); }
.policy-action-btn.deny:hover { background: var(--accent, #b30000); color: #fff; border-color: var(--accent, #b30000); }

/* ── Deny Button (theme red) ─────────────────── */
.btn-deny {
  background: rgba(179, 0, 0, 0.1);
  color: var(--accent);
  border-color: rgba(179, 0, 0, 0.2);
}
.btn-deny:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Policy Rules Modal ──────────────────────────── */
/* Modal overlay — works with both admin.css (opacity/visibility) and focus-view (display toggle) */
.modal-overlay.visible {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.policy-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  width: 680px;
  max-height: 85vh;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.policy-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.policy-modal-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.modal-close {
  border: none; background: none; color: var(--text-muted);
  cursor: pointer; width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.policy-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}
.policy-status-bar {
  display: flex; gap: 16px; padding: 8px 12px;
  margin-bottom: 14px; background: var(--bg-tertiary);
  border-radius: 8px; font-size: 12px;
}
.policy-stat { color: var(--text-muted); }
.policy-stat strong { color: var(--text-primary); }
.policy-section-title {
  font-size: 12px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 8px; margin-top: 14px;
}
.policy-section-title:first-child { margin-top: 0; }
.policy-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.policy-table th {
  text-align: left; padding: 5px 8px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
  border-bottom: 1px solid var(--border-default);
}
.policy-table th.center { text-align: center; }
.policy-table td {
  padding: 6px 8px; border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.policy-table td.center { text-align: center; }
.policy-table td.pattern {
  color: var(--text-primary); font-family: var(--font-mono);
  font-size: 11px; word-break: break-all;
}
.ptoggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 4px;
  cursor: pointer; transition: all 0.1s; border: none; background: none; padding: 0;
}
.ptoggle .material-icons-outlined { font-size: 16px; }
.ptoggle.yes { color: var(--green, #22c55e); }
.ptoggle.yes:hover { background: rgba(34,197,94,0.1); }
.ptoggle.no { color: var(--red, #dc2626); }
.ptoggle.no:hover { background: rgba(220,38,38,0.08); }
.scope-cycle {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 4px; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  border: 1px solid; transition: all 0.1s; background: none;
}
.scope-cycle .material-icons-outlined { font-size: 12px; }
.scope-cycle[data-scope="exact_url"] { color: var(--red, #dc2626); border-color: rgba(220,38,38,0.2); }
.scope-cycle[data-scope="origin_only"] { color: var(--amber, #f59e0b); border-color: rgba(245,158,11,0.2); }
.scope-cycle[data-scope="origin_and_links"] { color: var(--green, #22c55e); border-color: rgba(34,197,94,0.2); }
.policy-modal-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary); flex-shrink: 0;
}
.policy-save-btn {
  padding: 7px 24px; font-size: 12px; font-weight: 600;
  background: var(--accent, #b30000); color: #fff; border: none;
  border-radius: 6px; cursor: pointer;
}
.policy-save-btn:hover { opacity: 0.85; }
.policy-cancel-btn {
  padding: 7px 16px; font-size: 12px; font-weight: 600;
  background: none; color: var(--text-secondary);
  border: 1px solid var(--border-default); border-radius: 6px; cursor: pointer;
}
.policy-cancel-btn:hover { background: var(--bg-tertiary); }

/* ── URL Config Modal ───────────────────────────── */
.url-config-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  width: 420px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.url-config-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.url-config-header h3 {
  font-size: 15px; font-weight: 700; color: var(--text-primary);
  flex: 1; margin: 0;
}
.url-config-body {
  padding: 16px 20px;
}
.url-config-section {
  margin-bottom: 14px;
}
.url-config-section:last-child { margin-bottom: 0; }
.url-config-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 8px;
}
.url-config-toggles {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.url-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-primary); cursor: pointer;
  padding: 6px 8px; border-radius: 6px;
  transition: background 0.1s;
}
.url-toggle:hover { background: var(--bg-tertiary); }
.url-toggle input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--accent, #b30000);
  cursor: pointer;
}
.url-toggle.pii-master {
  margin-bottom: 0; padding: 6px 8px; border-radius: 6px;
}
.url-source-list {
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px 0 0 24px;
}
.url-source-list label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary); cursor: pointer;
  padding: 3px 0;
}
.url-source-list input[type="checkbox"] {
  width: 14px; height: 14px; accent-color: var(--accent, #b30000);
  cursor: pointer;
}
.url-config-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}
.url-config-btn {
  padding: 8px 28px; font-size: 13px; font-weight: 600;
  border: none; border-radius: 8px; cursor: pointer;
  transition: opacity 0.1s;
}
.url-config-btn:hover { opacity: 0.85; }
.url-config-btn.allow {
  background: var(--accent, #b30000); color: #fff;
}
.url-config-btn.deny {
  background: none; color: var(--text-secondary);
  border: 1px solid var(--border-default);
}
.url-config-btn.deny:hover { background: var(--bg-tertiary); }

/* ── Panel Header: Task Name ─────────────────────── */
.task-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Panel Header: Finish Button ─────────────────── */
.finish-btn {
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 600;
  border: 1.5px solid var(--accent, #b30000);
  color: var(--accent, #b30000);
  background: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.finish-btn:hover { background: var(--accent, #b30000); color: #fff; }

/* ── Panel Header: Icon Button ───────────────────── */
.header-icon-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-icon-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.visual-redaction-btn.on { color: var(--accent, #b30000); }
.visual-redaction-btn.off { color: var(--text-muted); background: var(--accent-light, rgba(179,0,0,0.08)); }
.visual-redaction-btn.off .material-icons-outlined { color: var(--accent, #b30000); }

/* ── More Dropdown ────────────────────────────────── */
.more-wrap {
  position: relative;
  flex-shrink: 0;
}

.more-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 220px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: none;
  overflow: hidden;
}
.more-dropdown.open { display: block; }

.more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
  transition: all 0.1s;
}
.more-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.more-item .material-icons-outlined { font-size: 17px; color: var(--text-muted); width: 20px; text-align: center; }
.more-item:hover .material-icons-outlined { color: var(--text-primary); }
.more-item.autopilot-on { color: var(--amber, #f59e0b); font-weight: 600; background: rgba(245,158,11,0.06); }
.more-item.autopilot-on .material-icons-outlined { color: var(--amber, #f59e0b); }
.more-sep { height: 1px; background: var(--border-subtle); margin: 4px 14px; }

/* ── Finish Modal ─────────────────────────────────── */
.finish-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  width: 420px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  overflow: hidden;
  text-align: center;
}
.finish-modal-header {
  padding: 24px 24px 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.finish-modal-task {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 24px 16px;
}
.finish-modal-options { display: flex; gap: 12px; padding: 0 24px 20px; }
.finish-option {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 8px; padding: 20px 12px;
  border-radius: 10px; border: 2px solid var(--border-default);
  background: var(--bg-secondary); cursor: pointer;
  transition: all 0.15s; font-size: 13px; font-weight: 600;
  color: var(--text-secondary); font-family: var(--font-sans);
}
.finish-option .material-icons-outlined { font-size: 32px; }
.finish-option.pass:hover {
  border-color: var(--green, #22c55e);
  background: rgba(34,197,94,0.06);
  color: var(--green, #22c55e);
}
.finish-option.fail:hover {
  border-color: var(--red, #dc2626);
  background: rgba(220,38,38,0.06);
  color: var(--red, #dc2626);
}
.finish-option-hint {
  font-size: 10px; font-weight: 400; color: var(--text-muted); margin-top: 2px;
}
.finish-modal-notes { padding: 0 24px 16px; }
.finish-notes-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-align: left; margin-bottom: 6px;
}
.finish-notes-input {
  width: 100%; border: 1px solid var(--border-subtle);
  border-radius: 8px; padding: 8px 12px; font-size: 12px;
  font-family: var(--font-sans); resize: none; outline: none;
  color: var(--text-primary); background: var(--bg-primary);
}
.finish-notes-input::placeholder { color: var(--text-muted); }
.finish-close-btn {
  position: absolute; top: 12px; right: 12px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.finish-close-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.finish-close-btn .material-icons-outlined { font-size: 20px; }

/* ── Generic Confirm Modal ────────────────────────── */
/* Used by: task delete, history delete, publish-public warning.
   Styled to match .finish-modal so the visual language is consistent. */
.confirm-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  width: 440px;
  max-width: 90vw;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  padding: 22px 24px 18px;
}
.confirm-modal .cm-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.confirm-modal .cm-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 18px;
  white-space: pre-wrap;
}
.confirm-modal .cm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.confirm-modal .cm-cancel,
.confirm-modal .cm-confirm {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.12s;
  border: 1px solid var(--border-default);
}
.confirm-modal .cm-cancel {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}
.confirm-modal .cm-cancel:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.confirm-modal .cm-confirm {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.confirm-modal .cm-confirm:hover { filter: brightness(0.9); }
.confirm-modal .cm-confirm.danger {
  background: var(--red, #dc2626);
  border-color: var(--red, #dc2626);
}
.confirm-modal .cm-confirm.danger:hover { background: #b91c1c; border-color: #b91c1c; }
.confirm-modal .cm-confirm:focus,
.confirm-modal .cm-cancel:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Autopilot Confirmation Modal ─────────────────── */
.autopilot-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  width: 400px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  overflow: hidden;
}
.autopilot-modal-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--border-subtle);
}
.autopilot-modal-header .icon-wrap {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: rgba(245,158,11,0.1);
}
.autopilot-modal-header .icon-wrap .material-icons-outlined {
  font-size: 20px; color: var(--amber, #f59e0b);
}
.autopilot-modal-header h3 {
  font-size: 15px; font-weight: 700; color: var(--text-primary);
}
.autopilot-modal-body {
  padding: 16px 20px; font-size: 13px; line-height: 1.6;
  color: var(--text-secondary);
}
.autopilot-modal-body strong { color: var(--text-primary); }
.autopilot-warn {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 12px; padding: 10px 12px;
  background: rgba(245,158,11,0.06);
  border: 1px solid rgba(245,158,11,0.15);
  border-radius: 8px; font-size: 12px; color: var(--text-secondary);
}
.autopilot-warn .material-icons-outlined {
  font-size: 16px; color: var(--amber, #f59e0b); flex-shrink: 0; margin-top: 1px;
}
.autopilot-modal-footer {
  display: flex; gap: 8px; padding: 12px 20px;
  justify-content: flex-end; border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}
.autopilot-cancel {
  padding: 7px 16px; font-size: 12px; font-weight: 600;
  background: none; color: var(--text-secondary);
  border: 1px solid var(--border-default); border-radius: 6px; cursor: pointer;
}
.autopilot-enable {
  padding: 7px 20px; font-size: 12px; font-weight: 600;
  background: var(--amber, #f59e0b); color: #fff;
  border: none; border-radius: 6px; cursor: pointer;
}

/* ── Shortcuts Modal ──────────────────────────────── */
.shortcuts-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  width: 340px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  overflow: hidden;
}
.shortcuts-header {
  display: flex; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border-subtle);
}
.shortcuts-header h3 {
  font-size: 14px; font-weight: 700; color: var(--text-primary); flex: 1;
}
.shortcuts-body { padding: 8px 18px 16px; }
.shortcut-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  margin-top: 12px; margin-bottom: 4px;
}
.shortcut-row {
  display: flex; align-items: center; padding: 5px 0;
}
.shortcut-action { flex: 1; font-size: 13px; color: var(--text-secondary); }
.shortcut-keys { display: flex; gap: 4px; }
.shortcut-key {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--text-primary); background: var(--bg-tertiary);
  padding: 2px 7px; border-radius: 4px; border: 1px solid var(--border-subtle);
}

/* ── Mobile: Chat panel fit ──────────────────── */
@media (max-width: 768px) {
  .input-area { padding: 6px 8px; }
  .input-row-2 { flex-wrap: wrap; gap: 4px; }
  .icon-btn { width: 40px; height: 40px; }
  .send-btn { width: 40px; height: 40px; }
  .protection-toggle { font-size: 10px; padding: 2px 6px; }
  .protection-text { font-size: 9px; }
  .input-textarea { font-size: 16px; min-height: 36px; }
  .debug-panel-header { padding: var(--space-1) var(--space-2); min-height: 36px; }
  .finish-btn { font-size: 11px; padding: 4px 10px; }
  .msg-user { padding: 8px 12px; }
  .msg-ai { padding: 8px 12px; }
  .msg-user-bubble { max-width: 90%; font-size: 14px; }
  .msg-ai-bubble { max-width: 95%; font-size: 14px; }
}
