/**
 * pages.css — F2 Extract
 *
 * Page-specific and panel-specific styles: agent execution panel,
 * error response panel, connections panel, session approvals, audit
 * table, skill cards, context pinning, canvas panel, file pills,
 * stop button, automated session indicator, file upload pills, drop
 * overlay, and remaining page-specific overrides.
 *
 * Lines 1274-2386 from original <style> block.
 * Will be split further into per-page files after F3 page extraction.
 */

/* Agent Execution Panel */
#agent-execution-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.agent-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}

.agent-item:hover {
  background: rgba(22, 104, 227, 0.08);
}

.agent-item:last-child {
  border-bottom: none;
}

.agent-item.expanded {
  background: rgba(22, 104, 227, 0.12);
}

.agent-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.agent-item-name {
  font-weight: 600;
  font-size: 11px;
  color: var(--text);
  flex: 1;
}

.agent-item-status {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.agent-item-status.active {
  background: rgba(15, 159, 110, 0.2);
  color: var(--ok);
}

.agent-item-status.completed {
  background: rgba(22, 104, 227, 0.2);
  color: var(--brand);
}

.agent-item-status.paused {
  background: rgba(209, 75, 75, 0.2);
  color: var(--err);
}

.agent-item-task {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
  word-break: break-word;
}

.agent-item-logs {
  display: none;
  margin-top: 8px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  max-height: 150px;
  overflow-y: auto;
  font-size: 10px;
  line-height: 1.5;
  font-family: var(--t-font-mono);
  color: var(--muted);
}

.agent-item.expanded .agent-item-logs {
  display: block;
}

.agent-log-entry {
  margin-bottom: 3px;
}

.agent-log-entry-time {
  color: var(--muted);
  opacity: 0.6;
  margin-right: 6px;
}

.agent-log-entry-type {
  color: var(--brand);
  font-weight: 600;
  margin-right: 6px;
}

.agent-log-entry-content {
  color: var(--text);
}

/* Error Response Panel */
#error-response-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(16, 32, 64, 0.16);
  z-index: 9998;
  max-width: 520px;
  width: 90vw;
  max-height: 80vh;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#error-response-panel.visible {
  display: flex;
}

.error-response-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.error-response-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.error-response-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.error-response-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.error-response-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.error-option-btn {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  transition: all 0.15s ease;
  font-family: var(--t-font-ui);
}

.error-option-btn:hover {
  border-color: var(--brand);
  background: rgba(22, 104, 227, 0.08);
}

.error-option-btn.selected {
  border-color: var(--brand);
  background: rgba(22, 104, 227, 0.15);
  color: var(--brand-2);
}

.error-option-btn.danger {
  border-color: var(--err);
  color: var(--err);
}

.error-option-btn.danger:hover {
  background: rgba(209, 75, 75, 0.1);
}

.error-response-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--panel-2);
  border-radius: 8px;
  display: none;
}

.error-response-inputs.visible {
  display: flex;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-field input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-family: var(--t-font-ui);
}

.input-field input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.input-field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(22, 104, 227, 0.1);
}

.error-response-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  justify-content: flex-end;
}

.btn-error-submit {
  padding: 8px 14px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--t-font-ui);
  transition: background 0.15s ease;
}

.btn-error-submit:hover {
  background: var(--brand-2);
}

.btn-error-cancel {
  padding: 8px 14px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--t-font-ui);
  transition: all 0.15s ease;
}

.btn-error-cancel:hover {
  border-color: var(--muted);
}

.right-panel { grid-area: right; display: flex; flex-direction: column; }
.right-section { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sys-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sys-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 8px 10px;
  min-height: 62px;
}
.sys-card.full {
  grid-column: 1 / -1;
  min-height: 74px;
}
.sys-k {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Connections Panel ── */
.conn-card {
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 10px 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.12s;
  min-height: 74px;
  user-select: none;
}
.conn-card:hover {
  border-color: var(--brand);
  box-shadow: 0 2px 12px rgba(76,141,255,0.13);
  transform: translateY(-1px);
}
.conn-card.connected {
  border-color: var(--ok);
  box-shadow: 0 0 0 1px rgba(49,184,132,0.25);
}
.conn-card.connected::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 9px;
  font-weight: 900;
  color: var(--ok);
  line-height: 1;
}
.conn-card-logo {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  flex-shrink: 0;
}
.conn-card-name {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.01em;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Dedicated Plugins page ── */
.plugins-page-view {
  background: var(--panel);
}
.plugins-page-shell {
  min-height: 100%;
  overflow-y: auto;
  padding: 30px clamp(22px, 4vw, 64px) 48px;
  color: var(--text);
}
.plugins-page-header,
.plugins-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.plugins-page-kicker {
  color: var(--brand);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.plugins-page-title {
  margin-top: 5px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -.03em;
}
.plugins-page-subtitle,
.plugins-section-subtitle {
  max-width: 680px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.plugins-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.plugins-page-btn,
.plugins-inline-btn {
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 12px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.plugins-page-btn:hover,
.plugins-inline-btn:hover {
  border-color: var(--brand);
}
.plugins-page-btn--primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.plugins-count {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.plugins-page-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 16px;
  max-width: 820px;
}
.plugins-search-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.plugins-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}
.plugins-search-icon {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  pointer-events: none;
}
.plugins-search-input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 9px 34px 9px 34px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  outline: none;
}
.plugins-search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
}
.plugins-search-clear {
  position: absolute;
  right: 7px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
}
.plugins-search-clear:hover { background: var(--line); color: var(--text); }
.plugins-search-results {
  min-width: 76px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}
.plugins-catalog-state { min-height: 0; }
.plugins-inline-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
}
.plugins-inline-state--error {
  border-color: color-mix(in srgb, var(--err) 35%, var(--line));
  color: var(--err);
}
.plugins-loading-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
.plugins-loading-grid span {
  height: 82px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(100deg, var(--panel-2) 30%, color-mix(in srgb, var(--text) 8%, var(--panel-2)) 50%, var(--panel-2) 70%);
  background-size: 220% 100%;
  animation: plugins-skeleton 1.25s ease-in-out infinite;
}
@keyframes plugins-skeleton { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.plugins-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.plugin-letter-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.plugin-letter-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 2px 8px;
  border-bottom: 1px solid var(--line-strong);
}
.plugin-letter-label {
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.plugin-letter-count {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.plugin-letter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plugin-card {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  color: var(--text);
  text-align: left;
  font: inherit;
}
.plugin-card:hover {
  border-color: var(--brand);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--brand) 12%, transparent);
  transform: translateY(-1px);
}
.plugin-card.connected { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); }
.plugin-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  grid-column: 1;
  grid-row: 1 / -1;
  width: 42px;
  min-height: 38px;
}
.plugin-card-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  grid-column: 2;
  grid-row: 1 / -1;
  min-width: 0;
  width: 100%;
}
.plugin-card-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
.plugin-card-badge {
  padding: 2px 5px;
  border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--line));
  border-radius: 5px;
  color: var(--brand);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .05em;
  flex-shrink: 0;
}
.plugin-card-name {
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plugin-card-category {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.plugin-card-desc {
  display: -webkit-box;
  width: 100%;
  min-height: 0;
  margin-top: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.plugin-card-status {
  display: inline-flex;
  align-items: center;
  grid-column: 3;
  grid-row: 1 / -1;
  align-self: center;
  gap: 5px;
  margin-top: 0;
  padding-top: 0;
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}
.plugin-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}
.plugins-mcp-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.plugins-section-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}
.plugins-mcp-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.plugins-mcp-list > div {
  margin: 0 !important;
}
.cv-connection-state {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: -4px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
}
.cv-state-line,
.cv-state-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}
.cv-state-line strong { color: var(--text); }
.cv-state-chip {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.cv-identity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding-top: 3px;
}
.cv-identity-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cv-identity-grid strong { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-identity-grid span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-identity-label { font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.cv-state-error { color: var(--err); line-height: 1.45; }
.cv-contract-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.cv-contract-heading,
.cv-attempt-title {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.cv-attempt-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.cv-attempt-field { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.cv-attempt-field input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); font: inherit; }
.cv-attempt-copy { color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.cv-attempt-command { overflow-x: auto; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); font-size: 10.5px; white-space: pre-wrap; }
.cv-attempt-link { color: var(--brand); font-size: 11px; }

@media (max-width: 760px) {
  .plugins-page-shell { padding: 22px 16px 34px; }
  .plugins-page-header { flex-direction: column; }
  .plugins-page-actions { justify-content: flex-start; }
  .plugins-page-toolbar { align-items: flex-start; flex-direction: column; gap: 7px; }
  .plugins-search-wrap { width: 100%; }
  .plugins-search-results { text-align: left; }
  .plugins-grid { gap: 14px; }
  .plugins-loading-grid { gap: 8px; }
}
/* Connector detail view permission rows */
.cv-perm-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.5;
}
.cv-perm-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  margin-top: 1px;
}
.cv-btn-connect {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  border: none;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
}
.cv-btn-connect:hover { background: var(--brand-2); transform: translateY(-1px); }
.cv-btn-connect:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.cv-btn-disconnect {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1.5px solid var(--err);
  background: transparent;
  color: var(--err);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  width: fit-content;
}
.cv-btn-disconnect:hover { background: rgba(208,75,75,0.08); }
.cv-activity-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 11.5px;
}
.cv-activity-dir {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 5px;
  border-radius: 4px;
  margin-top: 1px;
}
.cv-activity-dir.in { background: rgba(49,184,132,0.15); color: var(--ok); }
.cv-activity-dir.out { background: rgba(76,141,255,0.15); color: var(--brand); }
.sys-v {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 800;
  color: #0d2858;
  letter-spacing: -0.01em;
}
.sys-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--t-font-mono);
}
.sys-meter {
  margin-top: 6px;
  height: 6px;
  border-radius: 999px;
  background: #e5edf7;
  overflow: hidden;
}
.sys-meter > i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1e9d7b 0%, #1b75e6 55%, #0f4fba 100%);
  transition: width 0.35s ease;
}
.info-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #edf2f8; font-size: 12px; }
.info-row:last-child { border-bottom: 0; }
.info-key { color: var(--muted); }
.info-val { color: var(--text); font-weight: 700; }
.info-val.green { color: var(--ok); }
.info-val.red { color: var(--err); }

#approvals-list { max-height: 220px; overflow-y: auto; }
.approval-card { padding: 12px; margin-bottom: 8px; background: #fffaf0; border-color: #f1dbad; }
.approval-action { color: #8b5c00; font-weight: 700; font-size: 12px; margin-bottom: 4px; }
.approval-reason { color: #726344; font-size: 11px; line-height: 1.6; margin-bottom: 10px; }
.approval-buttons { display: flex; gap: 8px; }
/* Phase 5 – session approval panel */
#session-approvals-section { display: none !important; }
#session-approvals-list .approval-card { margin-bottom: 0; }
:root[data-theme="dark"] #session-approvals-section { border-color: var(--line); }
:root[data-theme="dark"] #session-approvals-list .approval-card {
  background: var(--panel-2) !important;
  border-color: var(--line) !important;
}
/* Phase 5 – audit log table rows */
#audit-table-body tr:hover { background: var(--panel-2); }
:root[data-theme="dark"] #audit-view table thead tr { background: var(--panel-2); }

.skills-search-bar { padding: 10px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; background: var(--panel-2); }
.skill-item { padding: 10px; margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.skill-item-name { font-size: 12px; font-weight: 700; color: #14478f; }
.skill-remove-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.skill-remove-btn:hover { color: var(--err); }
.skill-status-row { display:flex; align-items:center; gap:6px; margin-top:4px; flex-wrap: wrap; }
.skill-badge {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f5f8fd;
  color: #4e5f78;
  padding: 2px 7px;
}
.skill-badge.ready { background:#e8fbf3; color:#0f8b63; border-color:#bde9d4; }
.skill-badge.needs_setup { background:#fff6e9; color:#b06b00; border-color:#f0d49e; }
.skill-badge.blocked { background:#fff0f0; color:#c33f3f; border-color:#efc0c0; }
.skill-badge.risk-low { background:#e8fbf3; color:#0f8b63; border-color:#bde9d4; }
.skill-badge.risk-medium { background:#fff6e9; color:#b06b00; border-color:#f0d49e; }
.skill-badge.risk-high { background:#fff0f0; color:#c33f3f; border-color:#efc0c0; }
.skill-item-actions { display:flex; align-items:center; gap:6px; }
.skill-mini-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--t-font-ui);
}
.skill-mini-btn:hover { border-color:#c1d2ec; color:#26487e; }
.skill-mini-btn.enabled {
  background:#e8fbf3;
  border-color:#bde9d4;
  color:#0f8b63;
}
.skill-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,20,40,0.35);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.skill-modal-card {
  width: min(620px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
}
.skill-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.skill-modal-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
}
.skill-modal-subtitle {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}
.skill-modal-close-btn,
.skill-modal-secondary-btn {
  background: var(--panel-2) !important;
  color: var(--muted) !important;
  border: 1px solid var(--line) !important;
}
.skill-modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.skill-modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.skill-modal-chip,
.skill-kind-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: none;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.45);
  font-size: 9px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 6px;
  white-space: nowrap;
}
.skill-card > .skill-kind-badge,
.skill-card-name-row .skill-kind-badge {
  position: static;
  max-width: none;
  overflow: visible;
  flex-shrink: 0;
  font-size: 8px;
  padding: 2px 5px;
}
.skill-modal-chip.bundle,
.skill-kind-badge.bundle {
  background: rgba(49,184,132,0.15);
  border: none;
  color: #5dd4a0;
}
.skill-kind-badge.simple {
  background: rgba(255,255,255,0.06);
  border: none;
  color: rgba(255,255,255,0.35);
}
.skill-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.skill-form-grid {
  display: grid;
  grid-template-columns: minmax(90px, 0.8fr) minmax(0, 3fr);
  gap: 12px;
}
.skill-form-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}
.skill-form-label span {
  font-weight: 500;
  color: var(--muted);
}
.skill-form-input,
.skill-form-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-family: var(--t-font-ui);
  outline: none;
}
.skill-form-input {
  padding: 9px 11px;
}
.skill-form-textarea {
  min-height: 240px;
  padding: 12px;
  font-size: 12px;
  font-family: var(--t-font-mono);
  line-height: 1.62;
  resize: vertical;
}
.skill-form-input:focus,
.skill-form-textarea:focus {
  border-color: #a8c7f2;
  box-shadow: 0 0 0 3px rgba(13,79,175,0.08);
}
.skill-modal.readonly .skill-form-input,
.skill-modal.readonly .skill-form-textarea {
  background: #fbfdff;
  cursor: default;
}
.skill-modal.readonly .skill-form-textarea {
  min-height: 300px;
  resize: none;
}
.skill-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
}
:root[data-theme="dark"] .skill-modal-card {
  background: var(--panel);
}
:root[data-theme="dark"] .skill-form-input,
:root[data-theme="dark"] .skill-form-textarea,
:root[data-theme="dark"] .skill-modal.readonly .skill-form-input,
:root[data-theme="dark"] .skill-modal.readonly .skill-form-textarea {
  background: var(--panel-2);
}
:root[data-theme="dark"] .skill-modal-chip,
:root[data-theme="dark"] .skill-kind-badge {
  background: rgba(255,255,255,0.06);
}
.skill-details {
  margin: 8px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
  padding: 10px;
  display: none;
}
.skill-details.open { display:block; }
.skill-details h4 { font-size: 11px; margin: 0 0 6px; color:#17417f; }
.skill-details .line { font-size: 11px; color: var(--muted); margin: 2px 0; line-height: 1.5; }
.skill-details .line code { color:#10346f; font-family: var(--t-font-mono); }
.skill-upload-btn {
  border: 1px solid #bcd4f6;
  background: #ebf3ff;
  color: #0d4faf;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--t-font-ui);
}
.skill-upload-btn:hover { background:#dfeeff; border-color:#a8c7f2; }

/* Skill cards - same color as chat sessions, green glow when enabled */
.skill-card {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.06);
  padding: 9px 10px 9px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  transform-origin: center;
}
.skill-card:hover {
  border-color: rgba(255,255,255,0.20);
  background: rgba(255,255,255,0.09);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transform: translateY(-2px) scale(1.012);
  z-index: 10;
}
.skill-card.enabled {
  border-color: #3f8f67;
  background: linear-gradient(135deg, #273b33 0%, #23352e 100%);
  box-shadow: 0 0 0 2px rgba(49,184,132,0.18), 0 2px 8px rgba(10,20,14,0.35);
}
.skill-card.enabled:hover {
  border-color: #4faf80;
  box-shadow: 0 0 0 2px rgba(49,184,132,0.28), 0 4px 12px rgba(10,20,14,0.4);
}
.skill-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-height: 0;
}
.skill-card-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--t-accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--t-accent) 28%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--t-accent);
}
.skill-card.enabled .skill-card-icon {
  background: color-mix(in srgb, var(--t-accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--t-accent) 45%, transparent);
}
/* Pin button — top-right corner */
.skill-card {
  position: relative;
}
.skill-pin-btn {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--muted);
  opacity: 0.68;
  transition: opacity 0.15s ease, background 0.15s ease;
  padding: 0;
}
.skill-card:hover .skill-pin-btn,
.skill-pin-btn.active {
  opacity: 1;
}
.skill-pin-btn:hover {
  background: color-mix(in srgb, var(--t-accent) 10%, transparent);
  color: var(--t-accent);
}
.skill-pin-btn.active {
  color: var(--t-accent);
}
.skill-card.pinned {
  border-color: color-mix(in srgb, var(--t-accent) 45%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--t-accent) 15%, transparent);
}
.skills-show-more-btn {
  width: 100%;
  margin-top: 4px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--t-accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--t-accent) 30%, transparent);
  color: var(--text);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--t-font-ui);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.skills-show-more-btn:hover {
  background: color-mix(in srgb, var(--t-accent) 20%, transparent);
  border-color: color-mix(in srgb, var(--t-accent) 42%, transparent);
}
.skill-card-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.skill-card-name {
  font-size: 12px;
  font-weight: 700;
  color: #e8e6e1;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.skill-card-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}
.skill-card-name-row .skill-card-name {
  min-width: 0;
  flex-shrink: 1;
}
.skill-card.enabled .skill-card-name {
  color: #9fe3c2;
}
.skill-card-desc {
  font-size: 10px;
  color: #9a9890;
  line-height: 1.4;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.skill-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
  min-width: 22px;
  padding-right: 22px;
}
.skill-card-actions .skill-remove-btn {
  width: 18px;
  height: 18px;
  padding: 0;
  display: grid;
  place-items: center;
}

.skill-hover-popover {
  position: absolute;
  right: 26px;
  bottom: calc(100% + 6px);
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--t-accent) 28%, transparent);
  border-radius: 9px;
  background: #242424;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px) scale(0.96);
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 1000;
}
#skills-list .skill-card:first-child .skill-hover-popover {
  top: calc(100% + 6px);
  bottom: auto;
  transform: translateY(-4px) scale(0.96);
}
.skill-card:hover .skill-hover-popover,
.skill-card:focus-within .skill-hover-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.skill-hover-popover button {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 7px;
  background: rgba(255,255,255,0.07);
  color: var(--sidebar-text);
  font-size: 10px;
  font-weight: 800;
  font-family: var(--t-font-ui);
  padding: 4px 7px;
  cursor: pointer;
}
.skill-hover-popover button:hover {
  border-color: color-mix(in srgb, var(--t-accent) 55%, transparent);
  background: color-mix(in srgb, var(--t-accent) 18%, transparent);
  color: #fff;
}

.skill-result { padding: 10px; margin-bottom: 6px; }
.skill-result-name { font-size: 12px; font-weight: 700; margin-bottom: 3px; }
.skill-result-desc { font-size: 11px; color: var(--muted); line-height: 1.6; margin-bottom: 6px; }
.skill-install-btn { background: #ebf3ff; color: #0d4faf; border: 1px solid #bcd4f6; padding: 5px 10px; border-radius: 999px; }

.spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #d2dded;
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
.pulsing { animation: pulse 1.5s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.45} }

/* -- Canvas Panel ------------------------------- */
#canvas-panel { box-shadow: -4px 0 24px rgba(16,32,64,0.08); overflow:hidden; height:100%; min-height:0; }
#canvas-panel.canvas-drag-over { outline: 2px dashed var(--brand); outline-offset: -4px; }
.right-panel-mode-rail,
.canvas-mode-rail {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.right-panel-mode-rail::-webkit-scrollbar,
.canvas-mode-rail::-webkit-scrollbar {
  display: none;
}
.right-panel-mode-rail {
  width: 100%;
}
.canvas-mode-rail {
  justify-content: flex-start;
}
.canvas-mode-rail > * { flex-shrink: 0; }
.canvas-mode-rail { scrollbar-width: thin; }
.canvas-mode-rail::-webkit-scrollbar { display: block; height: 6px; }
.canvas-mode-rail::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
.canvas-mode-rail::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
.browser-surface-active [data-browser-surface-btn],
#canvas-browser-surface-btn[data-active="true"],
#right-panel-browser-surface-btn[data-active="true"] {
  border-color: rgba(56, 189, 248, 0.34) !important;
  background: rgba(56, 189, 248, 0.12) !important;
  color: #e0f2fe !important;
}
.browser-mode-btn-active,
[data-browser-mode-btn][data-active="true"] {
  border-color: rgba(56, 189, 248, 0.34) !important;
  background: rgba(56, 189, 248, 0.14) !important;
  color: #e0f2fe !important;
}
#canvas-browser-shell {
  background:
    radial-gradient(circle at 18% 0%, rgba(56,189,248,0.12), transparent 34%),
    linear-gradient(180deg, rgba(15,23,42,0.94), rgba(15,23,42,0.88)) !important;
  min-width: 0;
}
#canvas-browser-shell > div,
#browser-canvas-layout,
#browser-canvas-live-card,
#browser-canvas-frame-wrap {
  min-width: 0;
}
#browser-canvas-native-tabs {
  flex: 0 0 auto;
  scrollbar-width: thin;
}
#browser-canvas-native-tabs .browser-native-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 240px;
  height: 32px;
  padding: 0 9px 0 11px;
  border: 1px solid rgba(148,163,184,0.16);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: rgba(15,23,42,0.62);
  color: #94a3b8;
  font: 700 11px/1 var(--t-font-ui);
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}
#browser-canvas-native-tabs .browser-native-tab:hover {
  color: #e0f2fe;
  background: rgba(30,41,59,0.9);
}
#browser-canvas-native-tabs .browser-native-tab.active {
  color: #f8fafc;
  border-color: rgba(56,189,248,0.35);
  background: rgba(30,41,59,0.96);
  box-shadow: inset 0 -2px 0 #38bdf8;
}
#browser-canvas-native-tabs .browser-native-tab-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
#browser-canvas-native-tabs .browser-native-tab-close,
#browser-canvas-native-tabs .browser-native-tab-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font: 700 15px/1 var(--t-font-ui);
}
#browser-canvas-native-tabs .browser-native-tab-close:hover,
#browser-canvas-native-tabs .browser-native-tab-new:hover {
  background: rgba(148,163,184,0.16);
  color: #f8fafc;
}
#browser-canvas-native-tabs .browser-native-tab-new {
  align-self: center;
  margin: 0 2px 4px 2px;
  border: 1px solid rgba(148,163,184,0.16);
  color: #bae6fd;
}
#browser-canvas-layout {
  grid-template-columns: minmax(0, 1fr) clamp(300px, 27%, 390px) !important;
  gap: 0 !important;
  padding: 0 !important;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
/* Agent & Co-pilot modes hide the side panel — collapse to a single full-width
   column so the browser fills the canvas. Only Teach keeps the two-column grid.
   Higher specificity (#id[attr]) beats the base !important rule above. */
#browser-canvas-layout[data-side-panels="0"] {
  grid-template-columns: 1fr !important;
}
#browser-canvas-live-card {
  min-width: 0;
  width: 100%;
  min-height: 0;
  align-self: stretch;
  justify-self: stretch;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}
#browser-canvas-frame-wrap {
  flex: 1 1 auto;
  padding: 0 !important;
  overflow: hidden !important;
  align-items: stretch !important;
}
#browser-canvas-frame-stage {
  max-width: 100% !important;
  max-height: 100%;
  margin: 0 auto !important;
}
#browser-canvas-frame-stage[data-native-browser-surface="1"] {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
}
#browser-canvas-frame {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: cover;
  object-position: top center;
}
#browser-canvas-frame-meta {
  width: 100% !important;
}
@media (max-width: 1180px) {
  #browser-canvas-layout {
    grid-template-columns: 1fr !important;
    overflow: auto;
  }
  #browser-canvas-layout > div:last-child {
    min-height: auto;
    overflow: visible !important;
  }
}
.canvas-tab {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 10px 6px 12px;
  font-size: 11px; font-weight: 700; color: var(--muted);
  border-right: 1px solid var(--line); cursor: pointer;
  white-space: nowrap; transition: background 0.12s ease; flex-shrink: 0;
  user-select: none;
}
.canvas-tab:hover { background: #f0f4fb; color: var(--text); }
.canvas-tab.active { background: #fff; color: var(--text); border-bottom: 2px solid var(--brand); }
.canvas-tab-close {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 2px; border-radius: 4px;
  transition: all 0.12s ease;
}
.canvas-tab-close:hover { background: #fee; color: var(--err); }
.canvas-new-tab {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 16px; padding: 4px 12px; flex-shrink: 0;
  transition: color 0.12s ease;
}
.canvas-new-tab:hover { color: var(--brand); }
.canvas-mode-btn.active { background: var(--brand) !important; color: #fff !important; }
#canvas-save-menu button:hover { background: var(--bg-soft); }
#canvas-save-menu button:disabled { opacity: .45; cursor: not-allowed; }
#canvas-save-menu button:disabled:hover { background: transparent; }
#canvas-save-menu-btn[aria-expanded="true"] { color: var(--text); background: color-mix(in srgb, var(--t-accent) 14%, transparent) !important; }
#canvas-editor-wrap .CodeMirror {
  height: 100%; font-family: var(--t-font-mono);
  font-size: 13px; line-height: 1.65;
  background: #1e1c1b;
}
#canvas-editor-wrap .CodeMirror-gutters { background: #161413; border-right: 1px solid rgba(255,255,255,0.05); }
#canvas-editor-wrap .CodeMirror-linenumber { color: #6b625b; }
.cm-design-highlight {
  background: color-mix(in srgb, var(--t-accent) 22%, transparent);
  border-bottom: 1px dashed color-mix(in srgb, var(--t-accent) 70%, transparent);
  border-radius: 2px;
}
#canvas-editor-wrap { height: 100%; }
#canvas-preview-frame { background: #fff; }
.canvas-preview-device-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #9a9890;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  font-family: var(--t-font-ui);
  flex-shrink: 0;
}
.canvas-preview-device-btn:hover,
.canvas-preview-device-btn.active {
  border-color: rgba(56,189,248,0.34);
  background: rgba(56,189,248,0.12);
  color: #bae6fd;
}
#canvas-preview-shell[data-device="responsive"] #canvas-preview-stage {
  padding: 0;
}
#canvas-preview-shell:not([data-device="responsive"]) #canvas-preview-stage {
  background:
    radial-gradient(circle at top center, rgba(56,189,248,0.08), transparent 34%),
    linear-gradient(180deg, #1b1917, #11100f);
  justify-content: flex-start;
}
.canvas-tab-dirty::after { content: '\25CF'; color: var(--warn); margin-left: 4px; font-size: 8px; vertical-align: middle; }
.canvas-tab-external::before { content: '\21BB'; color: var(--brand); margin-right: 2px; font-size: 11px; }
.canvas-file-tree-item { display:flex; align-items:center; gap:6px; padding:4px 12px; cursor:pointer; border-radius:6px; color:var(--text); transition:background 0.1s ease; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.canvas-file-tree-item:hover { background:var(--bg-soft); }
.canvas-file-tree-dir { font-weight:700; color:var(--muted); cursor:default; padding:5px 12px 2px; font-size:10px; text-transform:uppercase; letter-spacing:0.05em; }
.canvas-open-btn { display:inline-flex; align-items:center; gap:4px; border:1px solid var(--line); background:var(--panel-2); color:var(--muted); border-radius:6px; padding:2px 8px; font-size:10px; font-weight:700; cursor:pointer; font-family:var(--t-font-ui); transition:all 0.12s ease; }
.canvas-open-btn:hover { background:var(--brand); color:#fff; border-color:var(--brand); }
/* -- File Pills in chat messages -- */
.file-pills { display:flex; flex-direction:column; gap:7px; margin-top:10px; }
.file-pill {
  display:inline-flex; align-items:center; gap:10px;
  border:1px solid var(--line); border-radius:12px;
  background:linear-gradient(180deg, color-mix(in srgb, var(--panel-2), #fff 18%), var(--panel-2));
  overflow:hidden;
  max-width:360px;
  min-height:46px;
  padding:7px 8px;
  box-shadow:0 1px 2px rgba(20,24,32,.05);
  transition:border-color 0.12s ease, box-shadow 0.12s ease;
}
.file-pill:hover { border-color:var(--line-strong); box-shadow:0 5px 18px rgba(20,24,32,.08); }
.file-pill-icon {
  display:flex; align-items:center; justify-content:center;
  width:32px; height:32px; flex-shrink:0;
  border-radius:9px; color:var(--brand);
  background:rgba(22,104,227,0.06);
}
.file-pill-info { flex:1; min-width:0; padding:0 2px; }
.file-pill-name { font-size:13px; font-weight:800; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:1.2; }
.file-pill-meta { font-size:10px; color:var(--muted); margin-top:2px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
.file-pill-actions { display:flex; align-items:center; gap:4px; flex-shrink:0; }
.file-pill-btn {
  display:flex; align-items:center; justify-content:center;
  width:30px; height:30px; border:1px solid transparent; border-radius:8px; background:transparent;
  color:var(--muted); cursor:pointer; transition:all 0.12s ease;
  font-family:inherit;
}
.file-pill-btn:hover { background:var(--brand); color:#fff; border-color:var(--brand); }
.file-pill-btn + .file-pill-btn { border-left:0; }
:root[data-theme="dark"] .file-pill { background:var(--panel); border-color:var(--line); box-shadow:none; }
.design-selection-message-attachments { display:flex; flex-wrap:wrap; gap:5px; margin-top:7px; }
.design-selection-message-chip {
  display:inline-flex;
  align-items:center;
  gap:5px;
  min-width:0;
  max-width:min(100%, 260px);
  padding:4px 7px;
  border:1px solid color-mix(in srgb, var(--brand) 34%, var(--line));
  border-radius:7px;
  background:color-mix(in srgb, var(--brand) 8%, var(--panel-2));
  color:var(--muted);
  font-size:10px;
  font-weight:750;
  line-height:1.2;
}
.design-selection-message-chip iconify-icon { flex:0 0 auto; color:var(--brand); }
.design-selection-message-chip > span { flex:0 0 auto; }
.design-selection-message-chip > strong {
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--text);
  font-weight:800;
}
:root[data-theme="dark"] .file-pill-icon { background:rgba(76,141,255,0.1); }
:root[data-theme="dark"] .canvas-tab.active { background: var(--panel); }
:root[data-theme="dark"] .canvas-tab:hover { background: var(--panel-2); }

.assistant-image-gallery {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-top: 12px;
  max-width: 100%;
}

.assistant-image-card {
  display: block;
  width: min(100%, 420px);
  max-width: min(100%, 420px);
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.assistant-image-card--multi {
  max-width: min(100%, 420px);
}

.assistant-image-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
}

.assistant-image-stage--multi {
  display: block;
}

.assistant-image-preview {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 18px;
  padding: 0;
  margin: 0;
  cursor: zoom-in;
  overflow: hidden;
  background: #070707;
  box-shadow: 0 16px 36px rgba(0,0,0,0.2);
  transition: transform 0.16s ease, filter 0.16s ease;
}

.assistant-image-preview:hover {
  filter: saturate(1.03);
}

.assistant-image-preview--static {
  cursor: default;
}

.assistant-image-preview img {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 540px;
  height: auto;
  object-fit: cover;
  background: #050505;
}

.assistant-image-card--multi .assistant-image-preview {
  border-radius: 18px;
}

.assistant-image-card--multi .assistant-image-preview img {
  max-width: 100%;
}

.assistant-image-preview--selectable {
  cursor: zoom-in;
}

.assistant-image-gallery--pending {
  max-width: min(100%, 340px);
}

.assistant-image-card--pending {
  width: min(100%, 320px);
}

.assistant-image-pending-preview {
  position: relative;
  width: min(100vw - 80px, 320px);
  max-width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, rgba(22, 104, 227, 0.16), transparent 32%),
    linear-gradient(180deg, rgba(248, 250, 255, 0.94), rgba(232, 238, 248, 0.96));
  isolation: isolate;
}

.assistant-image-pending-grid {
  position: absolute;
  inset: 10%;
  opacity: 0.52;
  background-image: radial-gradient(circle, rgba(70, 88, 120, 0.42) 1.5px, transparent 1.7px);
  background-size: 18px 18px;
  mask-image: radial-gradient(circle at 50% 44%, #000 0 44%, transparent 70%);
  animation: assistant-image-pending-drift 3.2s ease-in-out infinite alternate;
}

.assistant-image-pending-scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0 38%, rgba(255, 255, 255, 0.62) 48%, transparent 58% 100%);
  transform: translateX(-120%);
  animation: assistant-image-pending-scan 1.9s ease-in-out infinite;
}

.assistant-image-footer--pending {
  align-items: center;
}

.assistant-image-pending-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(22, 104, 227, 0.16);
  border-top-color: var(--brand);
  animation: assistant-image-pending-spin 0.9s linear infinite;
  flex: 0 0 auto;
}

@keyframes assistant-image-pending-spin {
  to { transform: rotate(360deg); }
}

@keyframes assistant-image-pending-scan {
  0% { transform: translateX(-120%); }
  54%, 100% { transform: translateX(120%); }
}

@keyframes assistant-image-pending-drift {
  from { transform: scale(0.985) translateY(3px); opacity: 0.42; }
  to { transform: scale(1.02) translateY(-3px); opacity: 0.66; }
}


.assistant-generated-video {
  width: 100%;
  max-width: min(100%, 460px);
  max-height: 420px;
  display: block;
  background: #050816;
  border-radius: 12px;
  object-fit: contain;
}

.assistant-image-thumb-rail {
  display: flex;
  flex-direction: row;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding: 10px 0 2px;
  scrollbar-width: none;
}
.assistant-image-thumb-rail::-webkit-scrollbar { display: none; }

.assistant-image-thumb {
  width: 68px;
  height: 68px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.16s ease;
}

.assistant-image-thumb:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.assistant-image-thumb.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(22, 104, 227, 0.14);
}

.assistant-image-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.assistant-image-footer {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0 0;
  border-top: 0;
}

.assistant-image-meta {
  min-width: 0;
  flex: 1 1 0;
}

:root[data-theme="dark"] .assistant-image-pending-preview {
  background:
    radial-gradient(circle at 50% 44%, color-mix(in srgb, var(--t-accent) 18%, transparent), transparent 34%),
    linear-gradient(180deg, rgba(19, 22, 29, 0.98), rgba(10, 12, 16, 0.99));
}

:root[data-theme="dark"] .assistant-image-pending-grid {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.22) 1.5px, transparent 1.7px);
}

:root[data-theme="dark"] .assistant-image-pending-scan {
  background: linear-gradient(110deg, transparent 0 38%, rgba(255, 255, 255, 0.12) 48%, transparent 58% 100%);
}


.assistant-image-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.assistant-image-subtitle {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
  word-break: normal;
  overflow-wrap: anywhere;
}

.assistant-image-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-start;
  margin-left: 0;
}

.assistant-image-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  padding: 0;
  font-family: var(--t-font-ui);
  cursor: pointer;
  transition: all 0.16s ease;
  flex-shrink: 0;
}

.assistant-image-action-text {
  width: auto;
  gap: 7px;
  padding: 0 13px;
  font-size: 11px;
  font-weight: 900;
}

.assistant-image-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  transform: translateY(-1px);
}

.assistant-image-btn--primary {
  border-color: rgba(22, 104, 227, 0.18);
  background: rgba(22, 104, 227, 0.08);
  color: var(--brand);
}

.assistant-image-modal {
  position: fixed;
  inset: 0;
  z-index: 10080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.assistant-image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.68);
  backdrop-filter: blur(10px);
}

.assistant-image-preview-panel,
.assistant-image-quick-panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 900px);
  max-height: min(88vh, 860px);
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.assistant-image-quick-panel {
  width: min(92vw, 360px);
  padding: 18px;
}

.assistant-image-quick-panel strong,
.assistant-image-quick-panel span {
  display: block;
}

.assistant-image-quick-panel strong {
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}

.assistant-image-quick-panel span {
  margin-top: 5px;
  color: rgba(255,255,255,0.64);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.assistant-image-quick-actions,
.assistant-image-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assistant-image-quick-actions {
  margin-top: 16px;
}

.assistant-image-quick-actions button,
.assistant-image-modal-actions button {
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.assistant-image-quick-actions button:hover,
.assistant-image-modal-actions button:hover {
  border-color: color-mix(in srgb, var(--t-accent) 50%, transparent);
  color: #ffb27a;
}

.assistant-image-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  background: rgba(0,0,0,0.34);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.assistant-image-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 12px;
  align-items: stretch;
  max-height: calc(88vh - 116px);
  padding: 0;
  background: transparent;
}

.assistant-image-modal-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-height: calc(88vh - 106px);
  overflow: hidden;
  border-radius: 16px;
  background: transparent;
}

.assistant-image-modal-stage img {
  display: block;
  max-width: 100%;
  max-height: calc(88vh - 140px);
  object-fit: contain;
  border-radius: 16px;
}

.assistant-image-modal-thumbs {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  max-height: calc(88vh - 140px);
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
}

.assistant-image-modal-thumbs button {
  position: relative;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  background: transparent;
  cursor: pointer;
}

.assistant-image-modal-thumbs button.active {
  border-color: color-mix(in srgb, var(--t-accent) 92%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--t-accent) 20%, transparent);
}

.assistant-image-modal-thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.assistant-image-modal-thumbs span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(0,0,0,0.58);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.assistant-image-modal-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0 0;
  border-top: 0;
  background: transparent;
}

.assistant-image-modal-meta {
  min-width: 0;
  flex: 1 1 180px;
}

.assistant-image-modal-meta strong,
.assistant-image-modal-meta span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-image-modal-meta strong {
  max-width: 340px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.assistant-image-modal-meta span {
  margin-top: 3px;
  color: rgba(255,255,255,0.58);
  font-size: 11px;
}

.assistant-image-modal-actions {
  justify-content: flex-end;
  max-width: min(100%, 560px);
}

@media (max-width: 720px) {
  .assistant-image-modal-body {
    grid-template-columns: 1fr;
  }
  .assistant-image-modal-thumbs {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .assistant-image-modal-footer {
    align-items: stretch;
    flex-direction: column;
  }
}

:root[data-theme="dark"] .assistant-image-card {
  background: transparent;
  box-shadow: none;
}

:root[data-theme="dark"] .assistant-image-preview {
  background: #070707;
}

:root[data-theme="dark"] .assistant-image-card--multi .assistant-image-preview {
  border-color: rgba(76, 141, 255, 0.12);
}

:root[data-theme="dark"] .assistant-image-footer {
  border-top-color: transparent;
}

:root[data-theme="dark"] .assistant-image-btn {
  background: rgba(255, 255, 255, 0.03);
}

@media (max-width: 720px) {
  .assistant-image-gallery {
    max-width: 100%;
  }

  .assistant-image-stage--multi {
    display: block;
  }

  .assistant-image-thumb-rail {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .assistant-image-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .assistant-image-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.memory-page-shell {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background:
    radial-gradient(680px 340px at 0% 0%, rgba(27, 94, 212, 0.1), transparent 62%),
    radial-gradient(720px 360px at 100% 100%, rgba(24, 164, 206, 0.08), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(247, 250, 255, 0.94));
}

.memory-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.memory-page-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.memory-page-subtitle {
  margin-top: 4px;
  max-width: 760px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.memory-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.memory-action-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
  font-family: var(--t-font-ui);
}

.memory-action-btn--primary {
  border-color: color-mix(in srgb, var(--t-accent) 30%, transparent);
  background: color-mix(in srgb, var(--t-accent) 12%, transparent);
  color: var(--brand);
}

.memory-action-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.memory-page-body {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.memory-graph-panel {
  min-width: 0;
  min-height: 0;
  position: relative;
  height: 100%;
}

.memory-graph-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  z-index: 6;
  pointer-events: none;
}

.memory-search-input {
  flex: 1 1 520px;
  min-width: 220px;
  max-width: 720px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  padding: 10px 14px;
  font-size: 12px;
  outline: none;
  font-family: var(--t-font-ui);
  pointer-events: auto;
}

.memory-search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 104, 227, 0.08);
}

.memory-graph-stats {
  font-size: 11px;
  color: var(--muted);
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  pointer-events: auto;
}

.memory-graph-stage {
  position: relative;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.18), transparent 30%),
    linear-gradient(180deg, #07111f 0%, #0a1626 44%, #0d1a2b 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 18px 48px rgba(7, 17, 31, 0.12);
}

.memory-graph-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

.memory-graph-stage canvas.is-dragging {
  cursor: grabbing;
}

.memory-graph-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(232, 237, 246, 0.82);
  font-size: 13px;
  letter-spacing: 0.01em;
  pointer-events: none;
}

.memory-drop-overlay {
  position: absolute;
  inset: 22px;
  border: 2px dashed rgba(255, 255, 255, 0.28);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(238, 244, 255, 0.9);
  font-size: 16px;
  font-weight: 700;
  background: rgba(7, 17, 31, 0.62);
  backdrop-filter: blur(8px);
  z-index: 6;
  pointer-events: none;
}

.memory-graph-tooltip {
  position: absolute;
  max-width: 280px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(8, 16, 29, 0.92);
  backdrop-filter: blur(10px);
  color: #eef4ff;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  z-index: 4;
}

.memory-graph-tooltip strong {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.memory-graph-tooltip .meta {
  font-size: 10px;
  opacity: 0.72;
  margin-bottom: 6px;
}

.memory-graph-tooltip .body {
  font-size: 11px;
  line-height: 1.45;
  color: rgba(238, 244, 255, 0.88);
}

.memory-side-panel {
  position: absolute;
  right: 20px;
  bottom: 20px;
  top: 116px;
  width: min(340px, calc(100% - 40px));
  z-index: 7;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.52);
  backdrop-filter: blur(10px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 16px 36px rgba(10, 24, 43, 0.2);
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.memory-side-panel.collapsed {
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
}

.memory-side-panel-header,
.memory-detail-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.memory-side-panel-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.memory-panel-collapse-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.memory-panel-collapse-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.memory-controls-fab {
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 64px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(8, 16, 29, 0.92);
  color: #eef4ff;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  z-index: 8;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.memory-controls-fab:hover {
  transform: translateY(-1px);
}

.memory-detail-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 34%);
  z-index: 8;
  border: 1px solid var(--line);
  border-right: none;
  border-radius: 24px 0 0 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: -8px 0 32px rgba(10, 24, 43, 0.18);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.memory-panel-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
  box-shadow: 0 10px 24px rgba(16, 32, 64, 0.06);
}

.memory-panel-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.memory-control-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.memory-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
}

.memory-control span {
  font-weight: 700;
}

.memory-control select,
.memory-control input[type="range"] {
  width: 100%;
}

.memory-control select {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  padding: 9px 10px;
  font-size: 12px;
  font-family: var(--t-font-ui);
}

.memory-control-hint {
  font-size: 11px;
  color: var(--muted);
}

.memory-check {
  flex-direction: row;
  align-items: center;
}

.memory-check input {
  accent-color: var(--brand);
}


.memory-panel-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.memory-panel-header-line .memory-panel-title {
  margin-bottom: 0;
}

.memory-panel-hint {
  color: rgba(232, 237, 246, 0.58);
  font-size: 10px;
  white-space: nowrap;
}

.memory-particle-controls {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035));
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.memory-particle-modes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.memory-particle-mode-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
  color: #f4f4f5;
  padding: 10px 8px;
  font: 700 12px var(--t-font-ui);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.memory-particle-mode-btn:hover,
.memory-particle-mode-btn.active {
  transform: translateY(-1px);
  border-color: rgba(57, 232, 255, 0.58);
  background: rgba(57, 232, 255, 0.1);
  box-shadow: 0 0 22px rgba(57, 232, 255, 0.14);
}

.memory-particle-controls.is-shape-disabled .memory-particle-modes {
  opacity: 0.42;
  filter: grayscale(0.72);
}

.memory-particle-mode-btn:disabled {
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.memory-sub-check {
  padding-left: 22px;
  color: rgba(222, 230, 245, 0.78);
}

.memory-control-row {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
}

.memory-control-row span {
  color: var(--muted);
  font-weight: 700;
}

.memory-control-row input[type='range'] {
  accent-color: #39e8ff;
}

.memory-control-value {
  color: var(--text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  cursor: text;
  min-width: 42px;
}

.memory-control-value-input {
  width: 48px;
  box-sizing: border-box;
  border: 1px solid rgba(57, 232, 255, 0.45);
  border-radius: 7px;
  background: rgba(5, 7, 12, 0.92);
  color: var(--text);
  font: 700 11px var(--t-font-ui);
  padding: 3px 4px;
  text-align: right;
}

.memory-filter-save-btn {
  appearance: none;
  border: 1px solid rgba(57, 232, 255, 0.28);
  border-radius: 10px;
  background: rgba(57, 232, 255, 0.08);
  color: #eafcff;
  cursor: pointer;
  font: 800 11px var(--t-font-ui);
  padding: 8px 10px;
  text-align: center;
}

.memory-filter-save-btn:hover {
  border-color: rgba(57, 232, 255, 0.54);
  background: rgba(57, 232, 255, 0.14);
}

.memory-graph-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: screen;
  background-image:
    radial-gradient(circle at 20% 25%, rgba(255, 106, 26, 0.16), transparent 27%),
    radial-gradient(circle at 80% 35%, rgba(57, 232, 255, 0.14), transparent 25%),
    radial-gradient(circle at 50% 86%, rgba(255, 79, 216, 0.12), transparent 22%);
  filter: blur(22px);
}

.memory-detail-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.memory-detail-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.memory-detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.memory-detail-heading h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.memory-detail-chip {
  align-self: flex-start;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--brand);
  background: rgba(22, 104, 227, 0.08);
}

.memory-detail-meta {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 10px 12px;
}

.memory-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.memory-detail-meta div {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.memory-detail-meta strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
}

.memory-detail-summary {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text);
  background: rgba(22, 104, 227, 0.06);
  border: 1px solid rgba(22, 104, 227, 0.18);
  border-radius: 12px;
  padding: 14px 16px;
}

.memory-detail-summary p {
  margin: 0 0 10px;
}

.memory-detail-summary p:last-child {
  margin-bottom: 0;
}

.memory-detail-empty-inline {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.memory-detail-loading-row {
  margin: 0 0 10px;
  color: rgba(57, 232, 255, 0.76);
  font-size: 11px;
  font-weight: 800;
}

.memory-detail-section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  padding-left: 10px;
  border-left: 2px solid var(--brand);
  opacity: 0.72;
}

.memory-compose-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.memory-compose-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.memory-compose-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.memory-compose-input,
.memory-compose-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  padding: 11px 12px;
  font-size: 12px;
  font-family: var(--t-font-ui);
  outline: none;
}

.memory-compose-input:focus,
.memory-compose-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--t-accent) 12%, transparent);
}

.memory-compose-textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.7;
}

.memory-compose-help {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}

.memory-compose-dropzone {
  border: 1px dashed color-mix(in srgb, var(--t-accent) 34%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--t-accent) 6%, transparent);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.memory-compose-dropzone strong {
  font-size: 12px;
  color: var(--text);
}

.memory-compose-file-picker {
  align-self: flex-start;
  border: 1px solid color-mix(in srgb, var(--t-accent) 24%, transparent);
  background: color-mix(in srgb, var(--t-accent) 14%, transparent);
  color: var(--brand);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.memory-compose-file-list,
.memory-attachment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.memory-compose-file-item,
.memory-attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 10px 12px;
}

.memory-compose-file-meta,
.memory-attachment-meta {
  min-width: 0;
}

.memory-compose-file-meta strong,
.memory-attachment-meta strong {
  display: block;
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
}

.memory-compose-file-meta span,
.memory-attachment-meta span {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: var(--muted);
}

.memory-compose-file-remove,
.memory-attachment-open {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  padding: 7px 10px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.memory-compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
}

.memory-compose-submit {
  border: 1px solid color-mix(in srgb, var(--t-accent) 28%, transparent);
  background: var(--brand);
  color: #fff7ed;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.memory-compose-submit:disabled {
  opacity: 0.55;
  cursor: progress;
}

.memory-detail-chunk {
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(22, 104, 227, 0.14);
  border-left: 3px solid color-mix(in srgb, var(--t-accent) 42%, transparent);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--t-font-ui);
}

.memory-detail-chunk p {
  margin: 0 0 8px;
}

.memory-detail-chunk p:last-child {
  margin-bottom: 0;
}

.memory-related-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.memory-related-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.14s ease, transform 0.14s ease;
}

.memory-related-item:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.memory-related-item strong {
  display: block;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 3px;
}

.memory-related-item .meta {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 6px;
}

.memory-related-item .body {
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

:root[data-theme="dark"] .memory-page-shell {
  background:
    radial-gradient(680px 340px at 0% 0%, rgba(76, 141, 255, 0.14), transparent 62%),
    radial-gradient(720px 360px at 100% 100%, rgba(61, 183, 255, 0.1), transparent 62%),
    linear-gradient(180deg, rgba(36, 43, 54, 0.95), rgba(32, 38, 48, 0.98));
}

:root[data-theme="dark"] .memory-side-panel,
:root[data-theme="dark"] .memory-panel-card:not(.memory-particle-controls),
:root[data-theme="dark"] .memory-search-input,
:root[data-theme="dark"] .memory-graph-stats,
:root[data-theme="dark"] .memory-detail-drawer {
  background: rgba(42, 49, 61, 0.82);
}

:root[data-theme="dark"] .memory-detail-summary {
  background: rgba(76, 141, 255, 0.09);
  border-color: rgba(76, 141, 255, 0.22);
}

:root[data-theme="dark"] .memory-detail-meta,
:root[data-theme="dark"] .memory-related-item,
:root[data-theme="dark"] .memory-control select,
:root[data-theme="dark"] .memory-action-btn,
:root[data-theme="dark"] .memory-panel-collapse-btn {
  background: var(--panel);
}

:root[data-theme="dark"] .memory-compose-input,
:root[data-theme="dark"] .memory-compose-textarea,
:root[data-theme="dark"] .memory-compose-file-item,
:root[data-theme="dark"] .memory-attachment-item,
:root[data-theme="dark"] .memory-compose-file-remove,
:root[data-theme="dark"] .memory-attachment-open {
  background: var(--panel);
}

:root[data-theme="dark"] .memory-detail-chunk {
  background: rgba(0, 0, 0, 0.22);
  border-color: var(--line);
  border-left-color: var(--line-strong);
}
/* -- Stop Button ---------------------------------- */
.send-btn { transition: background 0.15s ease !important; display: flex; align-items: center; justify-content: center; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd7e8; border-radius: 999px; }

@media (max-width: 1200px) {
  body {
    grid-template-columns: 250px 1fr;
    grid-template-areas:
      "header header"
      "main right";
  }
  aside { display: none; }
}

@media (max-width: 900px) {
  body {
    padding: 8px;
    gap: 8px;
    grid-template-rows: 58px 1fr 280px;
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main"
      "right";
  }
  header { border-radius: 14px; }
  .status-bar { display: none; }
  #chat-messages,
  #main-content { padding: 14px; }
  .mission-bar { padding: 10px; }
  .chat-input-area { bottom: 12px; width: calc(100% - 24px); border-radius: 14px; }
  .memory-side-panel {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: 52%;
    padding: 12px;
    border-radius: 18px;
  }
  .memory-detail-drawer {
    top: 0;
    left: 10px;
    right: 0;
    bottom: 0;
    width: auto;
    border-radius: 18px 0 0 18px;
    border-right: none;
  }
  .memory-controls-fab {
    right: 14px;
    bottom: 14px;
  }
  .memory-graph-toolbar {
    top: 12px;
    left: 12px;
    right: 12px;
    gap: 8px;
  }
  .memory-search-input {
    flex-basis: 100%;
    max-width: none;
  }
}
/* Automated session indicator in sidebar */
.session-auto-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 9px; color: #c77d00; background: #fff8e7;
  border: 1px solid #f0dfa0; border-radius: 4px;
  padding: 1px 5px; font-weight: 700;
}
.session-auto-badge.tele {
  color: #0f4ea8;
  background: #eaf3ff;
  border-color: #b8d4ff;
}

/* Error Response Panel - Inline Styling */
.error-response-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: var(--panel);
  margin: 12px 0;
  animation: slideDown 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.error-header {
  margin-bottom: 16px;
}

.error-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.error-description {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.error-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.error-option-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  white-space: normal;
}

.error-option-btn:hover:not(.danger):not(:disabled) {
  background: rgba(22, 104, 227, 0.08);
  border-color: var(--brand);
  transform: translateY(-1px);
}

.error-option-btn:active:not(.danger):not(:disabled) {
  transform: translateY(0);
}

.error-option-btn.danger {
  border-color: var(--err);
  color: var(--err);
}

.error-option-btn.danger:hover {
  background: rgba(209, 75, 75, 0.1);
}

.error-option-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error-inputs {
  display: none;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  padding-top: 0;
  border-top: 1px solid var(--line);
}

.error-inputs.visible {
  display: flex;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.input-field input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  background: var(--panel-2);
  color: var(--text);
  transition: all 0.2s ease;
}

.input-field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 104, 227, 0.1);
}

.continue-btn {
  padding: 10px 16px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.continue-btn:hover {
  background: #0f4ac9;
  transform: translateY(-1px);
}

.continue-btn:active {
  transform: translateY(0);
}

.continue-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error-context {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.error-context-btn {
  background: none;
  border: none;
  color: var(--brand);
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  padding: 0;
}

.error-context-detail {
  display: none;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.02);
  border-radius: 6px;
  border-left: 3px solid var(--muted);
  font-size: 12px;
  color: var(--muted);
  font-family: var(--t-font-mono);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.error-context-detail.visible {
  display: block;
}
/* ── File upload pill styles ─────────────────────────────────────────── */
.chat-composer-attachment-stack {
  display: none;
  grid-area: staging;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
  margin: 0 0 2px;
  align-self: stretch;
}
.chat-composer-attachment-stack > .chat-file-staging {
  padding: 0;
  margin: 0;
  max-width: none;
  overflow: visible;
}
.chat-file-staging {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0 0;
  margin: 0 0 6px 0;
  max-width: 100%;
  overflow: hidden;
}
.chat-file-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2, #f0f0f0);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  max-width: min(260px, 100%);
  min-width: 0;
  overflow: hidden;
  cursor: default;
  position: relative;
}
.chat-file-pill .pill-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.connector-logo-image {
  display: block;
  box-sizing: border-box;
  border-radius: 5px;
  background: var(--connector-logo-color, currentColor);
  -webkit-mask-image: var(--connector-logo-url);
  mask-image: var(--connector-logo-url);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.chat-file-pill .pill-thumb {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  display: block;
}
.chat-file-pill .pill-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.chat-file-pill .pill-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  display: block;
  font-size: 11px;
  font-weight: 750;
}
.chat-file-pill .pill-copy .pill-ext {
  padding: 0;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  background: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-style: normal;
}
.chat-file-pill .pill-ext {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--brand, #6c8ebf);
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.04em;
  max-width: min(32vw, 116px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-file-pill .pill-remove {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}
.chat-file-pill .pill-remove:hover { background: var(--line); color: var(--text); }
:root[data-theme="dark"] .chat-file-pill {
  background: #2c3442;
  border-color: #3d4a5c;
}

/* ── Uploaded image thumbnails in chat bubbles ── */
.msg-img-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  flex-shrink: 0;
  cursor: zoom-in;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.msg-img-thumb:hover {
  transform: scale(1.09);
  box-shadow: 0 6px 20px rgba(0,0,0,0.22);
}

/* ── Image preview modal ── */
.img-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: imgOverlayIn 0.15s ease;
  cursor: zoom-out;
}
@keyframes imgOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.img-preview-box {
  position: relative;
  max-width: 88vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: imgBoxIn 0.18s cubic-bezier(0.34,1.56,0.64,1);
  cursor: default;
}
@keyframes imgBoxIn {
  from { transform: scale(0.88); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.img-preview-box img {
  max-width: 88vw;
  max-height: 80vh;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 16px 60px rgba(0,0,0,0.55);
  display: block;
}
.img-preview-name {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  text-align: center;
  max-width: 88vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.img-preview-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.img-preview-close:hover { background: rgba(255,255,255,0.28); }

.chat-attach-btn,
.chat-voice-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  box-sizing: border-box;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2, #f5f5f5);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  will-change: transform;
  transition: background 0.15s, color 0.15s;
}
.chat-attach-btn > svg,
.chat-voice-btn > svg,
.chat-attach-btn > iconify-icon,
.chat-voice-btn > iconify-icon {
  display: block;
  width: 15px;
  height: 15px;
}
.chat-voice-btn > .voice-btn-icon[hidden] {
  display: none;
}
.chat-voice-btn[data-voice-mode="openai_realtime"] > iconify-icon {
  transform: translateX(0.5px);
}
.chat-attach-btn:hover,
.chat-voice-btn:hover { background: var(--line); color: var(--text); }
.chat-voice-btn.recording {
  border-color: rgba(239,68,68,0.45);
  background: rgba(239,68,68,0.12);
  color: var(--err);
}
.chat-voice-btn.active {
  border-color: rgba(22,163,74,0.45);
  background: rgba(22,163,74,0.12);
  color: var(--ok);
}
.chat-voice-btn.voice-mode-active {
  border-color: rgba(216,71,58,0.7);
  background: #d8473a;
  color: #fff;
}
.chat-voice-btn.silent {
  border-color: rgba(245,158,11,0.5);
  background: rgba(245,158,11,0.14);
  color: #b45309;
}
.chat-voice-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
:root[data-theme="dark"] .chat-attach-btn,
:root[data-theme="dark"] .chat-voice-btn { background: #2c3442; }
.voice-provider-controls {
  display: none;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  vertical-align: middle;
  min-width: 0;
}
.voice-provider-controls.visible {
  display: inline-flex;
}
.voice-provider-controls [hidden],
.voice-provider-controls label[hidden] {
  display: none !important;
}
.voice-provider-controls label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.voice-provider-controls select {
  max-width: 110px;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2, #f5f5f5);
  color: var(--text);
  font: inherit;
  font-size: 10px;
  padding: 2px 18px 2px 6px;
}
.voice-settings-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.voice-settings-btn {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2, #f5f5f5);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.voice-settings-btn:hover,
.voice-settings-btn:focus-visible,
.voice-settings-btn[aria-expanded="true"] {
  outline: none;
  border-color: color-mix(in srgb, var(--pm-orange, var(--t-accent)), transparent 38%);
  color: var(--text);
  background: color-mix(in srgb, var(--panel-2, #f5f5f5), var(--pm-orange, var(--t-accent)) 7%);
}
.voice-settings-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: min(300px, calc(100vw - 40px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-strong, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel), transparent 2%);
  color: var(--text);
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  z-index: 160;
}
.voice-settings-popover label {
  width: 100%;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
}
.voice-settings-popover select {
  width: 150px;
  max-width: 150px;
}
:root[data-theme="dark"] .voice-settings-btn {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
}
:root[data-theme="dark"] .voice-settings-popover {
  background: rgba(42,42,42,0.98);
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 14px 36px rgba(0,0,0,0.36);
}
.realtime-wake-gate-status {
  display: none;
  align-items: center;
  gap: 4px;
}
.realtime-wake-gate-status.visible {
  display: inline-flex;
}
.realtime-wake-gate-pill {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(245,158,11,0.34);
  border-radius: 999px;
  background: rgba(245,158,11,0.1);
  color: #92400e;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 7px;
}
.realtime-wake-gate-btn {
  border: 1px solid rgba(22,163,74,0.36);
  border-radius: 7px;
  background: rgba(22,163,74,0.1);
  color: var(--ok);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  min-height: 22px;
  padding: 2px 7px;
}
.realtime-wake-gate-btn:hover {
  background: rgba(22,163,74,0.18);
}
@media (max-width: 760px) {
  .voice-provider-controls.visible {
    display: flex;
    width: 100%;
    margin: 6px 0 0;
  }
  .voice-settings-popover {
    right: auto;
    left: 0;
  }
}
/* Drop overlay */
#chat-view.drag-over::after {
  content: 'Drop files here';
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--brand, #6c8ebf) 15%, transparent);
  border: 2px dashed var(--brand, #6c8ebf);
  border-radius: var(--radius-lg, 12px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand, #6c8ebf);
  z-index: 10;
  pointer-events: none;
}
#chat-view { position: relative; overflow: hidden; }

/* The detail surface is fixed to the active chat or Plugins page bounds by
   ConnectionsPage, leaving both side panels outside of the connector view. */
#connector-view.connector-view {
  position: fixed;
  z-index: 50;
  min-width: 0;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  flex-direction: column;
}

.panel-chat-shell {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.panel-chat-attach-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  margin-bottom: 1px;
}

.panel-chat-file-staging {
  max-height: 82px;
  overflow-y: auto;
  padding-top: 0;
}

/* Subagent chat reasoning control. It intentionally uses the same
   pm-reasoning-control vocabulary as the mobile selector while keeping the
   desktop popover inside the active theme and above the panel scrollport. */
.subagent-reasoning-trigger {
  min-width: 0;
  max-width: min(260px, 42vw);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  line-height: 1.25;
  cursor: pointer;
}
.subagent-reasoning-trigger:hover,
.subagent-reasoning-trigger:focus-visible,
.subagent-reasoning-trigger[aria-expanded="true"] {
  color: var(--text);
  border-color: color-mix(in srgb, var(--brand) 58%, var(--line));
  outline: none;
}
.subagent-reasoning-trigger-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subagent-reasoning-trigger-chevron {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1;
}
.subagent-reasoning-popover {
  position: fixed;
  z-index: 10020;
  box-sizing: border-box;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line-strong, var(--line));
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-lg, 0 18px 48px rgba(0,0,0,.28));
}
.subagent-reasoning-popover .pm-reasoning-selector {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.subagent-reasoning-popover .pm-reasoning-summary {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  padding: 0 2px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
}
.subagent-reasoning-popover .pm-reasoning-summary strong {
  max-width: 56%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subagent-reasoning-popover .pm-reasoning-control { width: 100%; --pm-reasoning-inset: 5px; }
.subagent-reasoning-popover .pm-reasoning-track {
  height: 48px;
  padding: 5px;
  background: color-mix(in srgb, var(--panel-2) 88%, var(--text) 12%);
  border-color: var(--line-strong, var(--line));
  box-shadow: inset 0 1px 2px rgba(0,0,0,.18);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.subagent-reasoning-popover .pm-reasoning-fill {
  left: 5px;
  top: 5px;
  bottom: 5px;
  background: var(--brand);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.24), 0 4px 12px color-mix(in srgb, var(--brand) 24%, transparent);
}
.subagent-reasoning-popover .pm-reasoning-fill::after { width: 36px; }
.subagent-reasoning-popover .pm-reasoning-segment span {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subagent-reasoning-popover .pm-reasoning-segment::after { display: none; }
.subagent-reasoning-popover .pm-reasoning-control:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: 999px;
}
.subagent-reasoning-popover[aria-busy="true"] { cursor: progress; }
.subagent-reasoning-popover[aria-busy="true"] .pm-reasoning-segment { opacity: .68; }

.subagent-run-recovery-composer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  transition: border-color 160ms ease, background 160ms ease;
}
.subagent-run-recovery-composer:focus-within,
.subagent-run-recovery-composer.is-busy {
  border-color: color-mix(in srgb, var(--brand) 52%, var(--line));
}
.subagent-run-composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}
.subagent-run-composer-row .chat-textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  max-height: 140px;
  resize: vertical;
}
.subagent-run-recovery-files-label {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subagent-run-composer-status {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}
.subagent-run-composer-status:not([hidden]) { display: block; }
.subagent-run-recovery-composer .send-btn.is-abort {
  background: var(--err, #e05c5c);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--err, #e05c5c) 22%, transparent);
}
.subagent-run-recovery-composer .send-btn:focus-visible,
.subagent-run-recovery-composer .chat-attach-btn:focus-visible,
.subagent-run-recovery-composer .chat-textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 72%, transparent);
  outline-offset: 2px;
}

.proposal-execution-step-title { font-weight: 500; }
.proposal-execution-step.is-approved .proposal-execution-step-title {
  font-weight: 800;
}
@media (max-width: 720px) {
  .subagent-reasoning-trigger { max-width: 48vw; }
  .subagent-run-composer-row { gap: 6px; }
  .subagent-run-recovery-composer .chat-attach-btn { width: 34px; height: 34px; }
}

.team-chat-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
}

.team-chat-attachment-thumb,
.team-chat-attachment-file {
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: inherit;
  cursor: zoom-in;
  padding: 0;
  font: inherit;
}

.team-chat-attachment-thumb {
  width: 62px;
  height: 62px;
  border-radius: 8px;
  overflow: hidden;
}

.team-chat-attachment-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.team-chat-attachment-file {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 1px 7px;
  max-width: 220px;
  border-radius: 8px;
  padding: 7px 9px;
  text-align: left;
}

.team-chat-attachment-file span {
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 18px;
}

.team-chat-attachment-file strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.team-chat-attachment-file em {
  font-style: normal;
  font-size: 9px;
  opacity: 0.7;
  text-transform: uppercase;
}

.team-chat-attachment-thumb:hover,
.team-chat-attachment-file:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 20px rgba(0,0,0,0.14);
}

.panel-attachment-preview-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  background: color-mix(in srgb, var(--panel) 94%, rgba(0,0,0,0.74));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px 18px 18px;
}

.panel-attachment-preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.panel-attachment-preview-body {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text);
}

.panel-attachment-preview-body img {
  max-width: 100%;
  max-height: calc(100% - 28px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 14px 44px rgba(0,0,0,0.28);
}

.panel-attachment-preview-body pre {
  width: 100%;
  height: 100%;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.55;
}

.panel-attachment-preview-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
}

.panel-attachment-preview-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: min(420px, 90%);
  text-align: center;
  color: var(--muted);
}

.panel-attachment-preview-file div {
  font-size: 42px;
}

.panel-attachment-preview-file strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.panel-attachment-preview-file span {
  overflow-wrap: anywhere;
  font-size: 11px;
}

.panel-attachment-preview-file button {
  border: 1px solid var(--line);
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.team-chat-drag-over::after {
  content: 'Drop files here';
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--brand);
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  pointer-events: none;
}

/* Inline chat video save button (desktop; mobile rules live in mobile.css) */
.prom-inline-video-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.prom-inline-video-row .prom-inline-caption { flex: 1; min-width: 0; }
.prom-inline-save { flex: none; margin-top: 4px; padding: 4px; border: 0; background: none; color: var(--prom-muted, rgba(127,127,127,.9)); cursor: pointer; line-height: 0; }
.prom-inline-save:hover { color: var(--prom-text, inherit); }
.prom-inline-save.is-busy { opacity: .45; }
.prom-inline-save.is-done { color: var(--prom-success, #22c55e); }
.prom-inline-save.is-error { color: var(--prom-danger, #ef4444); }

/* ── Tasks: header icons + "Needs you" rows ─────────────────────── */
.bgt-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.bgt-icon-btn:hover,
.bgt-icon-btn:focus-visible { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
#bgt-edit-btn.active { color: var(--brand); }
/* Needs You entries: same shell as a task card (desktop Tasks column). */
.bgt-ny-entry {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.bgt-ny-entry-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bgt-ny-entry-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.bgt-ny-entry-kind {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: #f5eeff;
  color: #6d2d9e;
}
.bgt-ny-summary { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.bgt-ny-entry .chat-approval-card { margin: 0; min-width: 0; max-width: none; padding: 10px 12px; overflow-wrap: anywhere; box-shadow: none; }

/* Desktop Tasks columns share the board width and shrink with the window instead of a fixed 240-280px. */
.bgt-col { flex: 1 1 0; min-width: 210px; max-width: 360px; display: flex; flex-direction: column; gap: 0; }

/* Team escalation text: readable body copy, clamped until clicked (long PICK updates were filling the column). */
.bgt-ny-message {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  cursor: pointer;
  border-radius: 6px;
}
.bgt-ny-message.is-expanded { display: block; -webkit-line-clamp: unset; line-clamp: unset; max-height: 320px; overflow-y: auto; cursor: auto; }
.bgt-ny-message:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand) 50%, transparent); outline-offset: 2px; }

/* Team reply form: rounded field with breathing room above the actions. */
.bgt-team-reply { display: grid; gap: 8px; margin-top: 10px; }
.bgt-team-reply input[name="reply"] {
  width: 100%;
  box-sizing: border-box;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel-2) 70%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.bgt-team-reply input[name="reply"]::placeholder { color: var(--muted); }
.bgt-team-reply input[name="reply"]:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.bgt-team-reply .chat-approval-actions { margin-top: 0; }
.bgt-team-reply .chat-approval-btn:not(.chat-approval-approve) { background: transparent; border: 1px solid var(--line); color: var(--text); }
.bgt-team-reply .chat-approval-btn:not(.chat-approval-approve):hover { background: var(--panel-2); }


/* Tasks: Option B live run cards + tabbed detail panel (shared view-model task-card-view-model.js). */
#bgt-board, #bgt-panel {
  --lr-run: var(--brand);
  --lr-ok: var(--ok, #16a34a);
  --lr-warn: var(--warn, #d18b19);
  --lr-bad: var(--danger, #dc2626);
  --lr-muted: var(--muted);
}
.bgt-lr-card { background: var(--panel); border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 11px; cursor: pointer; display: flex; flex-direction: column; gap: 5px; overflow-wrap: anywhere; transition: border-color .15s, box-shadow .15s; }
.bgt-lr-card:hover, .bgt-lr-card.is-open { border-color: var(--brand); }
.bgt-lr-card.is-open { box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 18%, transparent); }
.bgt-lr-card.is-compact { padding: 8px 12px; gap: 3px; }
.bgt-lr-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bgt-lr-avatar { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.bgt-lr-who { flex: 1; min-width: 0; }
.bgt-lr-actor { font-size: 11px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bgt-lr-sub { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bgt-lr-hide { border: none; background: none; color: var(--lr-bad); font-size: 14px; cursor: pointer; padding: 0 2px; }
.bgt-lr-pill { flex: 0 0 auto; font-size: 10px; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.bgt-lr-pill.tone-run { color: var(--lr-run); }
.bgt-lr-pill.tone-ok { color: var(--lr-ok); }
.bgt-lr-pill.tone-warn { color: var(--lr-warn); }
.bgt-lr-pill.tone-bad { color: var(--lr-bad); }
.bgt-lr-pill.tone-muted { color: var(--lr-muted); }
.bgt-lr-title { font-size: 13px; font-weight: 700; line-height: 1.3; color: var(--text); }
.bgt-lr-progress { display: flex; align-items: center; gap: 7px; }
.bgt-lr-bar { flex: 1; display: flex; gap: 2px; }
.bgt-lr-seg { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.bgt-lr-seg.is-done { background: var(--lr-ok); }
.bgt-lr-seg.is-current { background: var(--lr-run); }
.bgt-lr-seg.is-failed { background: var(--lr-bad); }
.bgt-lr-count { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bgt-lr-step, .bgt-lr-now { font-size: 11px; color: var(--muted); line-height: 1.4; }
.bgt-lr-step span { color: var(--lr-run); font-weight: 800; }
.bgt-lr-now code, .bgt-lr-act code { font-size: 10px; padding: 1px 4px; border-radius: 4px; background: var(--panel-2); color: var(--text); }
.bgt-lr-stall { font-size: 11px; font-weight: 600; color: var(--lr-warn); }
.bgt-lr-attn { font-size: 11px; line-height: 1.4; color: var(--text); padding: 5px 8px; border-radius: 7px; border-left: 3px solid var(--lr-warn); background: var(--panel-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bgt-lr-attn.tone-bad, .bgt-lr-attn-box.tone-bad { border-left-color: var(--lr-bad); }
.bgt-lr-attn.tone-muted, .bgt-lr-attn-box.tone-muted { border-left-color: var(--lr-muted); }
.bgt-lr-attn-box { font-size: 12px; line-height: 1.55; color: var(--text); padding: 10px 12px; border-radius: 10px; border-left: 3px solid var(--lr-warn); background: var(--panel-2); }
.bgt-lr-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bgt-lr-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.bgt-lr-result { font-size: 12px; line-height: 1.6; color: var(--text); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); border-left: 3px solid var(--lr-ok); background: var(--panel-2); }
.bgt-lr-result.tone-bad { border-left-color: var(--lr-bad); }
.bgt-lr-origin { font-size: 12px; line-height: 1.55; color: var(--text); white-space: pre-wrap; max-height: 220px; overflow: auto; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); }
.bgt-lr-raw summary { cursor: pointer; font-size: 11px; color: var(--muted); margin-top: 6px; }
.bgt-lr-raw pre { white-space: pre-wrap; word-break: break-word; font-size: 11px; color: var(--muted); max-height: 300px; overflow: auto; }
.bgt-lr-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.bgt-lr-tabs button { border: none; background: none; color: var(--muted); font-size: 12px; font-weight: 700; padding: 6px 10px; cursor: pointer; border-bottom: 2px solid transparent; }
.bgt-lr-tabs button.active { color: var(--text); border-bottom-color: var(--brand); }
.bgt-lr-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bgt-lr-steps li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start; font-size: 12px; line-height: 1.45; color: var(--text); }
.bgt-lr-step-dot { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; border: 1px solid var(--line); color: var(--muted); }
.bgt-lr-steps li.is-done .bgt-lr-step-dot { color: var(--lr-ok); border-color: var(--lr-ok); }
.bgt-lr-steps li.is-current .bgt-lr-step-dot { color: var(--lr-run); border-color: var(--lr-run); }
.bgt-lr-steps li.is-failed .bgt-lr-step-dot { color: var(--lr-bad); border-color: var(--lr-bad); }
.bgt-lr-step-time { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bgt-lr-activity { display: flex; flex-direction: column; gap: 5px; }
.bgt-lr-act { font-size: 11px; line-height: 1.4; padding: 5px 8px; border-radius: 7px; border: 1px solid var(--line); color: var(--text); }
.bgt-lr-act.is-error { border-color: var(--lr-bad); color: var(--lr-bad); }
.bgt-lr-act-line { display: flex; align-items: center; gap: 6px; }
.bgt-lr-act-time { margin-left: auto; font-size: 10px; color: var(--muted); }
.bgt-lr-act-run { font-size: 10px; color: var(--lr-run); }
.bgt-lr-act-call, .bgt-lr-act-result { margin-top: 2px; color: var(--muted); word-break: break-word; }
.bgt-lr-hidden summary { font-size: 11px; color: var(--muted); cursor: pointer; }

/* Tasks card avatar: provider logo of the model the task ran on (initials only when unknown). */
/* Logo avatars sit bare on the card; OpenAI/xAI keep the white tile used by chat lists. */
.bgt-lr-avatar.has-logo { width: auto; height: auto; padding: 0; background: transparent; border: 0; }
.bgt-lr-avatar .bgt-lr-logo { width: 18px; height: 18px; display: block; color: var(--text); }
.bgt-lr-avatar.has-logo[data-provider="openai"], .bgt-lr-avatar.has-logo[data-provider="xai"] { padding: 2px; border-radius: 4px; background: #fff; }
.bgt-lr-avatar.has-logo[data-provider="openai"] .bgt-lr-logo, .bgt-lr-avatar.has-logo[data-provider="xai"] .bgt-lr-logo { width: 16px; height: 16px; color: #111; }

