/* =====================================================
   Wee Orchestrator WebUI — Liquid Glass Design System
   ===================================================== */

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

:root {
  --accent:         #3ecf8e;
  --accent-hover:   #34b87d;
  --accent-glow:    rgba(62,207,142,0.32);
  --accent-rgb:     62, 207, 142;
  --gold:           #f5c542;
  --gold-hover:     #e0b23a;
  --gold-glow:      rgba(245,197,66,0.34);
  --danger:         #ff5f6d;
  --danger-hover:   #e04a58;
  --text-primary:   rgba(255,255,255,0.92);
  --text-secondary: rgba(255,255,255,0.62);
  --text-muted:     rgba(255,255,255,0.38);
  --glass-bg:       rgba(18,28,25,0.58);
  --glass-border:   rgba(255,255,255,0.12);
  --glass-shadow:   0 18px 48px rgba(0,0,0,0.42), 0 0 0 1px rgba(62,207,142,0.05), inset 0 1px 0 rgba(255,255,255,0.08);
  --glass-blur:     blur(24px) saturate(180%);
  --surface-raised: rgba(255,255,255,0.08);
  --surface-sunken: rgba(6,10,16,0.38);
  --surface-overlay: rgba(7,12,18,0.74);
  --radius:         16px;
  --radius-sm:      10px;
  --radius-xs:      6px;
  --font:           -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --font-mono:      "SF Mono", "Fira Code", "Cascadia Code", monospace;
  --transition:     0.15s ease;
  --sidebar-width:  280px;
  --header-height:  56px;
  --input-height:   72px;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 10% 10%, rgba(13,74,42,0.35), transparent 32%),
    radial-gradient(circle at 82% 16%, rgba(245,197,66,0.12), transparent 24%),
    radial-gradient(circle at 88% 86%, rgba(26,42,108,0.28), transparent 30%),
    #0a0e1a;
  background-attachment: fixed;
}

.hidden { display: none !important; }

::selection {
  background: rgba(62,207,142,0.28);
  color: #f5fff8;
}

.btn:focus-visible,
.btn-icon:focus-visible,
.glass-input:focus-visible,
.message-textarea:focus-visible,
.sidebar-nav-btn:focus-visible,
.queue-pause-btn:focus-visible,
.queue-toggle-btn:focus-visible,
.fv-mode-btn:focus-visible,
.fv-close-btn:focus-visible,
.mode-toggle-btn:focus-visible,
.sched-tab:focus-visible,
.pill-popover-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow);
}


/* ---------- Background Blobs ---------- */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.5;
}

.blob-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #0d4a2a 0%, transparent 70%);
  top: -150px;
  left: -100px;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #1a2a6c 0%, transparent 70%);
  bottom: -100px;
  right: -50px;
}

.blob-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(74,21,128,0.9) 0%, transparent 72%);
  top: 40%;
  left: 40%;
}

/* ---------- Glass Primitives ---------- */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius);
}

.glass-card {
  background: rgba(255,255,255,0.08);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 40px;
}

.glass-bubble {
  background: rgba(255,255,255,0.055);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.glass-input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  padding: 10px 14px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.glass-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.glass-select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(255,255,255,0.5)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.glass-select option { background: #1a1f30; color: var(--text-primary); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
  user-select: none;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn:not(:disabled):active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:not(:disabled):hover { background: var(--accent-hover); box-shadow: 0 0 18px var(--accent-glow); }

.btn-ghost {
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}
.btn-ghost:not(:disabled):hover {
  background: rgba(255,255,255,0.14);
  color: var(--text-primary);
  border-color: rgba(62,207,142,0.22);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:not(:disabled):hover { background: var(--danger-hover); }

.btn-full { width: 100%; margin-top: 10px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-size: 16px;
  flex-shrink: 0;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }

/* ---------- Auth Overlay ---------- */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,8,18,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.auth-card {
  width: 420px;
  max-width: calc(100vw - 32px);
}

.auth-logo { font-size: 48px; text-align: center; margin-bottom: 8px; }
.auth-title { font-size: 26px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.auth-subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 28px; font-size: 14px; }
.auth-hint { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }

.code-input { letter-spacing: 0.3em; text-align: center; font-size: 22px; font-weight: 700; }

.auth-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(255,95,109,0.12);
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255,95,109,0.3);
}

/* ---------- App Layout ---------- */
.app-layout {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--glass-border);
  border-radius: 0;
  z-index: 10;
  transition: width var(--transition), transform 0.25s ease;
  overflow: hidden;
  /* Override glass-panel backdrop-filter to prevent compositing conflicts
     with adjacent backdrop-filter elements (queue panel, file viewer).
     Use a slightly more opaque background to compensate for lost blur. */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(9, 16, 24, 0.78);
}

.sidebar.collapsed {
  width: 0;
  transform: translateX(-100%);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  flex-wrap: wrap;
  row-gap: 8px;
}

.sidebar-logo { font-size: 22px; flex-shrink: 0; }

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}

.sidebar-toggle-btn { margin-left: auto; flex-shrink: 0; }

.new-chat-btn {
  margin: 12px 12px 8px;
  flex-shrink: 0;
  font-size: 13px;
  padding: 9px 14px;
}

.sessions-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sessions-list::-webkit-scrollbar { width: 4px; }
.sessions-list::-webkit-scrollbar-track { background: transparent; }
.sessions-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.session-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
  position: relative;
  min-width: 0;
}

.session-item:hover { background: rgba(255,255,255,0.08); }
.session-item.active {
  background: rgba(62,207,142,0.12);
  border-color: rgba(62,207,142,0.3);
}

.session-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.session-preview {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  font-size: 12px;
  border-radius: 4px;
  visibility: hidden;
  background: rgba(255,95,109,0.15);
  border: none;
  cursor: pointer;
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.session-item:hover .session-delete-btn { visibility: visible; }
.session-delete-btn:hover { background: rgba(255,95,109,0.3); }

/* Rename button */
.session-rename-btn {
  position: absolute;
  top: 8px;
  right: 32px;
  width: 22px;
  height: 22px;
  font-size: 11px;
  border-radius: 4px;
  visibility: hidden;
  background: rgba(62,207,142,0.15);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  padding: 0;
  line-height: 1;
}
.session-item:hover .session-rename-btn { visibility: visible; }
.session-rename-btn:hover { background: rgba(62,207,142,0.3); }
/* Agent badge in session list */
.session-agent-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
  line-height: 1.5;
  opacity: 0.9;
  color: #fff;
  background: rgba(99,102,241,0.5);
  border: 1px solid rgba(99,102,241,0.4);
}
/* Per-agent color coding */
.session-agent-badge[data-agent="orchestrator"] { background: rgba(62,207,142,0.4); border-color: rgba(62,207,142,0.5); }
.session-agent-badge[data-agent="wee-dev"]      { background: rgba(96,165,250,0.4); border-color: rgba(96,165,250,0.5); }
.session-agent-badge[data-agent="wee-qa"]       { background: rgba(251,146,60,0.4); border-color: rgba(251,146,60,0.5); }
.session-agent-badge[data-agent="email-triage"] { background: rgba(167,139,250,0.4); border-color: rgba(167,139,250,0.5); }
.session-agent-badge[data-agent="research"]     { background: rgba(34,211,238,0.4); border-color: rgba(34,211,238,0.5); }
.session-agent-badge[data-agent="devops"]       { background: rgba(251,191,36,0.4); border-color: rgba(251,191,36,0.5); color: #1a1a1a; }
.session-agent-badge[data-agent="family-knowledge"] { background: rgba(244,114,182,0.4); border-color: rgba(244,114,182,0.5); }
.session-agent-badge[data-agent="smarthome"]    { background: rgba(52,211,153,0.4); border-color: rgba(52,211,153,0.5); }
.session-agent-badge[data-agent="wee-doc"]      { background: rgba(156,163,175,0.4); border-color: rgba(156,163,175,0.5); }

/* Inline rename input */
.session-rename-input {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--accent);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  padding: 2px 6px;
  outline: none;
  font-family: var(--font);
}
.session-rename-input:focus {
  box-shadow: 0 0 0 2px rgba(62,207,142,0.22);
}

/* sidebar-flex-spacer removed — lists use flex:1, toolbar uses margin-top:auto */

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
  gap: 8px;
}

.sidebar-user {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* ---------- Main Panel ---------- */
.main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

/* ---------- Chat Header ---------- */
.chat-header {
  height: var(--header-height);
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  flex-shrink: 0;
  z-index: 5;
}

.sidebar-open-btn { margin-right: 4px; }

.chat-header-info { display: flex; align-items: baseline; gap: 8px; flex-shrink: 0; }
.chat-session-label { font-size: 11px; color: var(--text-muted); }
.chat-session-id { font-size: 12px; color: var(--text-secondary); font-family: 'SF Mono', 'Fira Code', monospace; }

/* Session meta pills */
.session-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meta-pill {
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  cursor: pointer;
  user-select: none;
}
.meta-pill:hover {
  filter: brightness(1.25);
  transform: translateY(-1px);
}
.meta-pill:active { transform: translateY(0); }
.meta-pill.meta-agent   { color: #f7d978; border-color: rgba(245,197,66,0.28); background: rgba(245,197,66,0.12); }
.meta-pill.meta-runtime { color: #8df0ba; border-color: rgba(62,207,142,0.26); background: rgba(62,207,142,0.1); }
.meta-pill.meta-model   { color: #dff6aa; border-color: rgba(210,245,163,0.2); background: rgba(171,209,91,0.12); }
.meta-pill.meta-alerts {
  color: #60a5fa;
  border-color: rgba(96,165,250,0.25);
  background: rgba(96,165,250,0.08);
  cursor: pointer;
}
.meta-pill.meta-alerts:hover {
  color: #93c5fd;
  border-color: rgba(147,197,253,0.35);
  background: rgba(147,197,253,0.12);
}
.meta-pill.empty { opacity: 0.4; }
.runtime-icon {
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
  filter: brightness(0) invert(1);
  opacity: 0.85;
  flex-shrink: 0;
}

/* ---------- Messages ---------- */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.messages-container::-webkit-scrollbar { width: 5px; }
.messages-container::-webkit-scrollbar-track { background: transparent; }
.messages-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

/* Load earlier messages button */
.load-more-btn {
  display: block;
  margin: 0 auto 8px auto;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm, 8px);
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary, rgba(255,255,255,0.65));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.12));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
  user-select: none;
}
.load-more-btn:not(:disabled):hover {
  background: rgba(255,255,255,0.12);
  color: var(--text-primary, #fff);
  border-color: rgba(62,207,142,0.25);
  transform: translateY(-1px);
}
.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 12px;
}
.empty-icon { font-size: 48px; }
.empty-state p { font-size: 14px; text-align: center; max-width: 280px; }

/* ---------- Message Bubbles ---------- */
.message-row {
  display: flex;
  gap: 10px;
  max-width: 800px;
  animation: fadeSlide 0.2s ease;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message-row.user { flex-direction: row-reverse; align-self: flex-end; }
.message-row.assistant { align-self: flex-start; }

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  border: 1px solid var(--glass-border);
}

.user .message-avatar { background: rgba(62,207,142,0.2); }
.assistant .message-avatar { background: rgba(255,255,255,0.08); }

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  max-width: calc(100% - 44px);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.user .message-bubble {
  background: rgba(62,207,142,0.18);
  border: 1px solid rgba(62,207,142,0.3);
  border-radius: var(--radius) var(--radius-xs) var(--radius) var(--radius);
  color: var(--text-primary);
  white-space: pre-wrap;
}

.assistant .message-bubble {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs) var(--radius) var(--radius) var(--radius);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}

/* Markdown inside assistant bubbles */
.assistant .message-bubble h1,
.assistant .message-bubble h2,
.assistant .message-bubble h3 {
  margin: 12px 0 6px;
  color: var(--text-primary);
}
.assistant .message-bubble p { margin-bottom: 8px; }
.assistant .message-bubble p:last-child { margin-bottom: 0; }
.assistant .message-bubble ul,
.assistant .message-bubble ol { margin: 6px 0 8px 18px; }
.assistant .message-bubble li { margin-bottom: 3px; }
.assistant .message-bubble a { color: var(--accent); }
.assistant .message-bubble img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin-top: 6px; }
.assistant .message-bubble blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--text-secondary);
  margin: 8px 0;
}
.assistant .message-bubble code {
  background: rgba(0,0,0,0.35);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
}
.assistant .message-bubble pre {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  overflow-x: auto;
  margin: 8px 0;
}
.assistant .message-bubble pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
}

/* Image in message */
.message-image {
  display: block;
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  object-fit: contain;
  cursor: pointer;
  border: 1px solid var(--glass-border);
}

/* Timing indicator */
.message-timing {
  display: block;
  font-size: 12px;
  color: var(--text-secondary, rgba(255, 255, 255, 0.5));
  text-align: right;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-style: italic;
}

.assistant .message-bubble .message-timing {
  color: var(--text-secondary, rgba(255, 255, 255, 0.45));
}

/* ---------- Markdown Table Styling ---------- */
.message-bubble table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 13px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.message-bubble table thead {
  background: rgba(255,255,255,0.08);
  border-bottom: 2px solid var(--glass-border);
}

.message-bubble table th,
.message-bubble table td {
  padding: 8px 12px;
  text-align: left;
  border-right: 1px solid var(--glass-border);
  word-break: break-word;
}

.message-bubble table th:last-child,
.message-bubble table td:last-child {
  border-right: none;
}

.message-bubble table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background var(--transition);
}

.message-bubble table tbody tr:hover {
  background: rgba(255,255,255,0.05);
}

.message-bubble table tbody tr:last-child {
  border-bottom: none;
}

/* ---------- Streaming bubble cursor ---------- */
.message-bubble.streaming {
  white-space: pre-wrap;
  word-break: break-word;
}

.message-bubble.streaming::after {
  content: '▋';
  display: inline-block;
  animation: stream-cursor 0.8s step-end infinite;
  color: var(--accent);
  margin-left: 1px;
}

@keyframes stream-cursor {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ---------- Typing Indicator ---------- */
.typing-indicator {
  padding: 0 20px 8px;
}

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border-radius: var(--radius-xs) var(--radius) var(--radius) var(--radius);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bounce 1.2s infinite ease-in-out;
}
.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-6px); opacity: 1; }
}

/* ---------- File Preview Strip ---------- */
.file-preview-strip {
  display: flex;
  gap: 8px;
  padding: 8px 16px 0;
  flex-wrap: wrap;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(62,207,142,0.15);
  border: 1px solid rgba(62,207,142,0.3);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-primary);
}

.file-chip-remove {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  border: none;
  background: none;
  padding: 0 0 0 2px;
  color: var(--text-secondary);
}
.file-chip-remove:hover { color: var(--danger); }

/* ---------- Input Area (contains dropdown + bar) ---------- */
.input-area {
  position: relative;
  flex-shrink: 0;
}

/* ---------- Command Dropdown ---------- */
.cmd-dropdown {
  position: absolute;
  bottom: calc(100% + 2px);
  left: 0;
  right: 0;
  background: rgba(12,17,30,0.97);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06);
  z-index: 20;
  max-height: 280px;
  overflow-y: auto;
}
.cmd-dropdown::-webkit-scrollbar { width: 3px; }
.cmd-dropdown::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.cmd-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  gap: 0 10px;
  transition: background var(--transition);
}
.cmd-row:last-child { border-bottom: none; }
.cmd-row:hover, .cmd-row.active { background: rgba(62,207,142,0.12); }

.cmd-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  font-family: 'SF Mono', 'Fira Code', monospace;
  grid-column: 1;
  grid-row: 1;
}
.cmd-row-desc {
  font-size: 12px;
  color: var(--text-secondary);
  grid-column: 2;
  grid-row: 1;
}
.cmd-row-usage {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 2px;
}

/* ---------- Input Bar ---------- */
.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  flex-shrink: 0;
}

.file-btn {
  cursor: pointer;
  font-size: 18px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: background var(--transition);
  flex-shrink: 0;
}
.file-btn:hover { background: rgba(255,255,255,0.08); }
.file-btn input { display: none; }

/* ---------- Input mirror + textarea ---------- */
.input-wrap {
  position: relative;
  flex: 1;
}

/* Shared typography for mirror and textarea — MUST match exactly */
.input-mirror,
.message-textarea {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}

.input-mirror {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  overflow: hidden;
  z-index: 0;
  /* Reserve space for scrollbar so text alignment stays exact */
  padding-right: 17px;
}

/* /command token highlight */
.cmd-token {
  background: rgba(62,207,142,0.22);
  color: #7ee7b5;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 600;
}

.message-textarea {
  position: relative;
  z-index: 1;
  width: 100%;
  resize: none;
  /* Transparent text so mirror shows through; caret stays visible */
  background: transparent;
  color: transparent;
  caret-color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.15);
  outline: none;
  max-height: 180px;
  overflow-y: auto;
  transition: border-color var(--transition);
}
.message-textarea:focus { border-color: var(--accent); }
/* When mirror is present we keep placeholder via the textarea but style it */
.message-textarea::placeholder { color: var(--text-muted); }
.message-textarea::-webkit-scrollbar { width: 3px; }
.message-textarea::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

/* Show placeholder from mirror div when textarea is empty (mirror shows nothing, textarea placeholder shows) */
.message-textarea:not(:placeholder-shown) { color: transparent; }

.send-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 16px;
  flex-shrink: 0;
}

/* ---------- Mic Button ---------- */
.mic-btn {
  width: 40px;
  height: 40px;
  font-size: 18px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition), box-shadow 0.3s ease;
  flex-shrink: 0;
  position: relative;
  padding: 0;
}
.mic-btn svg { pointer-events: none; }
.mic-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.mic-btn.recording {
  color: #ff5f6d;
  background: rgba(255,95,109,0.16);
  animation: mic-pulse 1.2s ease-in-out infinite;
}
.mic-btn.transcribing {
  color: var(--accent);
  background: rgba(62,207,142,0.15);
  pointer-events: none;
  animation: mic-breathe 1.5s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,95,109,0.38); }
  50%      { box-shadow: 0 0 0 8px rgba(255,95,109,0); }
}
@keyframes mic-breathe {
  0%, 100% { opacity: 0.4; box-shadow: 0 0 0 0 rgba(62,207,142,0); }
  50%      { opacity: 1;   box-shadow: 0 0 14px 2px var(--accent-glow); }
}
.mic-timer {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #ff5f6d;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- Image Search Results ---------- */
.image-results-bubble {
  max-width: 460px;
  padding: 14px 16px;
}

.image-results-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.image-grid-item {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  text-decoration: none;
  transition: border-color var(--transition), transform var(--transition);
  background: rgba(255,255,255,0.04);
}
.image-grid-item:hover {
  border-color: rgba(255,255,255,0.28);
  transform: translateY(-1px);
}

.search-result-img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.search-result-title {
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .sidebar { position: absolute; height: 100%; }
  .auth-card { padding: 28px 20px; }
  .message-bubble { font-size: 13px; }
}

/* ---------- Meta Pill Popover ---------- */
.pill-popover {
  position: fixed;
  z-index: 200;
  min-width: 175px;
  max-height: min(60vh, 480px);
  border-radius: var(--radius-sm);
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.08);
  padding: 4px 0;
  animation: fadeSlide 0.12s ease;
}

.pill-popover-header {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 7px 12px 5px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass-bg, rgba(20,20,30,0.95));
}

.pill-popover-item {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-primary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--transition), color var(--transition);
}
.pill-popover-item:hover {
  background: rgba(62,207,142,0.15);
  color: #b6f5d1;
}

/* ═══════════════════════════════════════════════════════
   Sidebar Nav (Chat / Scheduler switcher)
   ═══════════════════════════════════════════════════════ */
.sidebar-nav {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-nav-btn {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.sidebar-nav-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}
.sidebar-nav-btn.active {
  background: rgba(62,207,142,0.18);
  border-color: rgba(62,207,142,0.4);
  color: #b6f5d1;
}

/* ═══════════════════════════════════════════════════════
   Background Tasks Panel
   ═══════════════════════════════════════════════════════ */

/* Nav badge */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(245,197,66,0.88);
  color: #fff;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1;
}

.background-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ═══════════════════════════════════════════════════════
   Kanban Panel
   ═══════════════════════════════════════════════════════ */
.kanban-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--header-height);
  border-radius: 0;
  flex-shrink: 0;
  gap: 12px;
}

.kanban-header-left,
.kanban-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kanban-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.kanban-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

.kanban-due {
  padding: 14px;
  margin-bottom: 14px;
}

.kanban-due-toggle {
  cursor: pointer;
  user-select: none;
}

.kanban-due-chevron {
  display: inline-block;
  font-size: 10px;
  transition: transform 0.2s ease;
}

.kanban-due-chevron.collapsed {
  transform: rotate(-90deg);
}

.kanban-due-hidden {
  display: none !important;
}

.kanban-due-header,
.kanban-column-header,
.kanban-card-top,
.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-due-header,
.kanban-column-header {
  justify-content: space-between;
  margin-bottom: 10px;
}

.kanban-due-grid,
.kanban-columns {
  display: grid;
  gap: 12px;
}

.kanban-due-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.kanban-columns {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
}

.kanban-column {
  min-height: 180px;
  padding: 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.045);
}

.kanban-column-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}

.kanban-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-card {
  padding: 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
}

.kanban-card h3 {
  margin: 8px 0;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.35;
}

.kanban-card p {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card-top {
  justify-content: space-between;
}

.kanban-source,
.kanban-pill,
.kanban-issue {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
}

.kanban-source {
  color: #f5c542;
  border-color: rgba(245,197,66,0.28);
  background: rgba(245,197,66,0.12);
}

.kanban-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.kanban-due-overdue,
.kanban-urgent {
  color: #ff8888;
  border-color: rgba(255,95,109,0.32);
  background: rgba(255,95,109,0.14);
}

.kanban-due-today,
.kanban-due-soon {
  color: #f5c542;
  border-color: rgba(245,197,66,0.30);
  background: rgba(245,197,66,0.12);
}

.kanban-empty,
.kanban-column-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px 12px;
}

.kanban-error {
  color: var(--danger);
}

@media (max-width: 1100px) {
  .kanban-columns {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 768px) {
  .kanban-body {
    padding: 12px;
  }
  .kanban-columns,
  .kanban-due-grid {
    grid-template-columns: 1fr;
  }
}

.bg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--header-height);
  border-radius: 0;
  flex-shrink: 0;
  gap: 12px;
}

.bg-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bg-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.bg-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bg-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* bg-tasks-list column removed — task list now lives in sidebar as .bg-sidebar-list */
.bg-sidebar-list {
  /* visibility controlled by .hidden class — do NOT set display here */
}
.bg-sidebar-item .session-title {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bg-sidebar-item .session-title .bg-task-title-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bg-sidebar-item .session-preview {
  font-size: 11px;
}

.bg-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  margin-top: 40px;
}

.bg-task-card {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.bg-task-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
}
.bg-task-card.active {
  border-color: rgba(62,207,142,0.3);
  background: rgba(62,207,142,0.08);
}

.bg-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.bg-card-status {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.03em;
}
.bg-status-running   { background: rgba(62,207,142,0.15); color: #3ecf8e; border: 1px solid rgba(62,207,142,0.3); }
.bg-status-completed { background: rgba(62,207,142,0.15); color: #8df0ba; border: 1px solid rgba(62,207,142,0.3); }
.bg-status-failed    { background: rgba(255,95,109,0.15);  color: #ff8888; border: 1px solid rgba(255,95,109,0.3);  }
.bg-status-killed    { background: rgba(245,197,66,0.15);  color: #f5c542; border: 1px solid rgba(245,197,66,0.3);  }
.bg-status-queued    { background: rgba(139,120,255,0.15); color: #b8a9ff; border: 1px solid rgba(139,120,255,0.3); }

/* Fallback indicator badge — shown when a task retried on a secondary runtime */
.bg-fallback-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
  background: rgba(245,197,66,0.15);
  color: #f5c542;
  border: 1px solid rgba(245,197,66,0.35);
  vertical-align: middle;
  cursor: default;
}
.bg-fallback-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bg-fallback-route {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
.bg-fallback-tip {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.bg-card-agent {
  font-size: 11px;
  color: var(--text-muted);
}

.bg-card-prompt {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

.bg-card-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Detail panel */
.bg-detail {
  flex: 1;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bg-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--glass-border);
}

.bg-detail-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bg-detail-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  margin-top: 80px;
  padding: 0 24px;
  line-height: 1.7;
}

.sched-detail-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  margin-top: 80px;
  padding: 0 24px;
  line-height: 1.7;
}

.bg-detail-body {
  flex: 1;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.bg-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.bg-detail-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bg-detail-meta-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 70px;
}

.bg-detail-meta-value {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.bg-detail-prompt {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.bg-detail-output {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.bg-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--glass-border);
}

.btn-danger {
  background: rgba(255,95,109,0.2);
  border: 1px solid rgba(255,95,109,0.3);
  color: #ff8888;
}
.btn-danger:hover {
  background: rgba(255,95,109,0.35);
  box-shadow: 0 0 16px rgba(255,95,109,0.18);
}

/* ═══════════════════════════════════════════════════════
   Scheduler Panel
   ═══════════════════════════════════════════════════════ */
.scheduler-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.sched-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--header-height);
  border-radius: 0;
  flex-shrink: 0;
  gap: 12px;
}

.sched-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sched-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.sched-daemon-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.03em;
}
.badge-ok   { background: rgba(62,207,142,0.15); color: #3ecf8e; border: 1px solid rgba(62,207,142,0.3); }
.badge-warn { background: rgba(245,197,66,0.15); color: #f5c542; border: 1px solid rgba(245,197,66,0.3); }
.badge-muted{ background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid var(--glass-border); }

.sched-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sched-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0;
}

/* ─── Jobs List ─── */
.sched-jobs-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sched-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 40px 20px;
}
.sched-error { color: var(--danger); }

.sched-job-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.sched-job-card:hover {
  background: rgba(255,255,255,0.09);
  transform: translateY(-1px);
}
.sched-job-card.selected {
  border-color: var(--accent);
  background: rgba(62,207,142,0.1);
}

.sched-job-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sched-job-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.sched-job-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-enabled  { background: rgba(62,207,142,0.15); color: #3ecf8e; border: 1px solid rgba(62,207,142,0.3); }
.status-disabled { background: rgba(245,197,66,0.12); color: #f5c542; border: 1px solid rgba(245,197,66,0.25); }

.sched-job-meta, .sched-job-times {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
  margin-top: 4px;
}

/* ─── Detail Panel ─── */
.sched-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  overflow: hidden;
}

/* sched-detail-header removed — detail has no header bar */

.sched-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* ─── Detail Tabs ─── */
.sched-detail-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0;
}

.sched-tab {
  padding: 7px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  margin-bottom: -1px;
}
.sched-tab:hover { color: var(--text-primary); }
.sched-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ─── Job Detail Info ─── */
.sched-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}
.sched-dl dt { color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.sched-dl dd { color: var(--text-primary); word-break: break-word; }
.sched-dl code {
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.sched-task-box {
  margin-bottom: 14px;
}
.sched-task-box label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sched-task-pre {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
  margin: 0;
}

.sched-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ─── Job Form ─── */
.sched-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-row {
  display: flex;
  gap: 10px;
}
.form-row .form-group { flex: 1; }

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.sched-task-input {
  resize: vertical;
  min-height: 80px;
  font-size: 13px;
  font-family: var(--font);
}

.form-checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  transition: background var(--transition);
}
.form-check:hover { background: rgba(255,255,255,0.08); }
.form-check input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.form-check span { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.form-check small { font-size: 11px; color: var(--text-muted); margin-left: auto; }

.req { color: var(--danger); margin-left: 2px; }

.mode-toggle {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
}
.mode-toggle-btn {
  padding: 5px 14px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.mode-toggle-btn:hover {
  background: rgba(255,255,255,0.08);
}
.mode-toggle-btn.active {
  background: rgba(62,207,142,0.15);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.sched-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.timeout-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.timeout-input {
  width: 120px;
  flex-shrink: 0;
}
.timeout-display {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* ─── Results ─── */
.sched-result-card {
  border-radius: var(--radius-xs);
  border: 1px solid var(--glass-border);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 12px;
}
.result-ok   { border-color: rgba(62,207,142,0.3); background: rgba(62,207,142,0.06); }
.result-fail { border-color: rgba(255,95,109,0.3); background: rgba(255,95,109,0.06); }

.sched-result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.result-icon { font-size: 13px; font-weight: 700; }
.result-ok   .result-icon { color: #3ecf8e; }
.result-fail .result-icon { color: var(--danger); }
.result-ts { color: var(--text-muted); font-size: 11px; }

.result-output {
  background: rgba(0,0,0,0.3);
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
  font-size: 11px;
  margin: 4px 0 0;
}
.result-error {
  background: rgba(255,95,109,0.1);
  color: #ff9da3;
  padding: 8px 10px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 11px;
  margin: 4px 0 0;
}

/* ─── Toast ─── */
#sched-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.sched-toast-success { background: rgba(38, 92, 67, 0.94);  color: #fff; }
.sched-toast-error   { background: rgba(135, 28, 41, 0.94); color: #fff; }
.sched-toast-info    { background: rgba(24, 78, 58, 0.94); color: #fff; }

/* Responsive: collapse detail on narrow viewports */
@media (max-width: 700px) {
  .sched-detail { flex: 1; min-width: 0; }
  .bg-detail { flex: 1; min-width: 0; }
}

/* ============================================
   RESPONSIVE DESIGN — MOBILE OPTIMIZATION
   ============================================ */

/* Tablet & Small Devices (max-width: 1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
    --header-height: 48px;
    --input-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
  }

  .sidebar-title { font-size: 16px; }
  .new-chat-btn { font-size: 12px; padding: 8px 12px; }
  .session-title { font-size: 12px; }
  .session-preview { font-size: 10px; }

  .messages-container { padding: 16px 12px; gap: 12px; }
  .message-row { max-width: 700px; }

  .chat-header { padding: 0 12px; }
  .session-meta { gap: 3px; }
  .meta-pill { padding: 2px 7px; font-size: 10px; }

  .input-bar { padding: 10px 12px; }
}

/* Mobile Devices (max-width: 768px) */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
    --header-height: 44px;
    --input-height: 60px;
    --radius: 12px;
    --radius-sm: 8px;
    font-size: 14px;
  }

  html, body { font-size: 14px; }

  /* Hide large blobs on mobile */
  .blob {
    filter: blur(60px);
    opacity: 0.25;
  }
  .blob-1 { width: 400px; height: 400px; }
  .blob-2 { width: 300px; height: 300px; }
  .blob-3 { width: 250px; height: 250px; }

  /* Full-width sidebar on mobile — hidden via .collapsed (matches JS toggleSidebar logic) */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 56px; /* above mobile tab bar */
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    z-index: 300;
    transform: translateX(0);
    transition: transform 0.25s ease;
    /* Fully opaque background to prevent content bleed-through */
    background: rgb(9, 16, 24);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .sidebar.collapsed {
    width: 100%;
    transform: translateX(-100%);
  }

  .request-queue-panel {
    display: none !important;
  }

  .request-queue-panel.mobile-panel-active {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 56px; /* above tab bar */
    width: 100%;
    height: auto;
    z-index: 100;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  /* Override minimized state when showing as mobile overlay */
  .request-queue-panel.mobile-panel-active.queue-minimized {
    width: 100%;
  }
  .request-queue-panel.mobile-panel-active .queue-header-title,
  .request-queue-panel.mobile-panel-active .queue-pause-btn {
    display: flex !important;
  }
  .request-queue-panel.mobile-panel-active .queue-items-list {
    display: flex !important;
  }
  .request-queue-panel.mobile-panel-active .queue-footer {
    display: flex !important;
  }



  .sidebar-header {
    padding: 12px 14px;
    gap: 8px;
  }

  .sidebar-logo { font-size: 20px; }
  .sidebar-title { font-size: 16px; font-weight: 600; }
  .sidebar-toggle-btn { font-size: 24px; }

  .new-chat-btn {
    margin: 8px 10px 6px;
    font-size: 12px;
    padding: 8px 12px;
  }

  .sessions-list {
    padding: 3px 6px;
    gap: 2px;
  }

  .session-item {
    padding: 8px 10px;
    font-size: 13px;
  }

  .session-title { font-size: 12px; margin-bottom: 2px; }
  .session-preview { font-size: 10px; }

  .sidebar-footer {
    padding: 10px 12px 6px;
    font-size: 12px;
  }

  .sidebar-user { font-size: 11px; }

  /* Sidebar toolbar (Settings/Logs) — visible in sidebar, no overlap with tab bar */
  .sidebar-toolbar {
    padding: 6px 12px 8px;
  }

  /* Main panel adjustments — leave bottom space for mobile tab bar */
  .main-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 56px; /* space for mobile tab bar */
    z-index: 1;
    display: flex !important; /* Always visible by default */
  }

  .main-panel.hidden {
    display: none !important;
  }

  /* Background Tasks & Scheduler panels — same positioning as main-panel on mobile */
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ─── Secrets Manager Panel (F019) — Leprachaun Glassmorphism Redesign ────────
   ═══════════════════════════════════════════════════════════════════════════════ */

.secrets-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ─── Header ─── */
.secrets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: var(--header-height);
  border-radius: 0;
  flex-shrink: 0;
  gap: 12px;
}

.secrets-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.secrets-header-icon {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(62,207,142,0.4));
}

.secrets-header-text {
  display: flex;
  flex-direction: column;
}

.secrets-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.secrets-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.secrets-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.secrets-count-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  background: rgba(62,207,142,0.12);
  color: #3ecf8e;
  border: 1px solid rgba(62,207,142,0.25);
  letter-spacing: 0.03em;
}

/* ─── Body layout ─── */
.secrets-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.secrets-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
  align-content: start;
}

/* ─── Section headers ─── */
.secrets-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(62,207,142,0.15);
}

.secrets-section-icon {
  font-size: 16px;
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(62,207,142,0.35));
}

.secrets-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.005em;
}

/* ─── Store form ─── */
.secrets-form {
  padding: 24px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(62,207,142,0.1);
}

.secrets-form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}

.secrets-form-fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
}

.secrets-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.secrets-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.secrets-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  font-family: var(--font-mono);
  color: var(--text-primary) !important;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.secrets-input:hover {
  background: rgba(255,255,255,0.09) !important;
  border-color: rgba(255,255,255,0.22) !important;
}

.secrets-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(255,255,255,0.08) !important;
}

.secrets-input::placeholder {
  color: var(--text-muted);
  font-family: var(--font);
}

.secrets-input-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  opacity: 0.7;
}

/* ─── Value field with eye toggle ─── */
.secrets-value-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.secrets-input-value {
  flex: 1;
  padding-right: 44px;
}

.secrets-eye-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xs);
  padding: 5px 7px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  z-index: 2;
}

.secrets-eye-btn:hover {
  background: rgba(62,207,142,0.12);
  color: var(--accent);
  border-color: rgba(62,207,142,0.2);
}

.eye-icon { font-size: 14px; }

/* ─── Form actions ─── */
.secrets-form-actions {
  display: flex;
  gap: 10px;
}

.secrets-save-btn {
  flex: 1;
  padding: 10px 20px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  border-radius: var(--radius-sm) !important;
  transition: all 0.2s !important;
  white-space: nowrap;
}

.secrets-save-btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow) !important;
}

.btn-icon-inline {
  margin-right: 4px;
}

.secrets-clear-btn {
  padding: 10px 20px !important;
  font-size: 14px !important;
  border-radius: var(--radius-sm) !important;
  white-space: nowrap;
  border: 1px solid var(--glass-border) !important;
}

/* ─── Feedback ─── */
.secrets-feedback {
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-top: 14px;
  font-weight: 500;
}

.secrets-feedback--success {
  background: rgba(62,207,142,0.1);
  color: #3ecf8e;
  border: 1px solid rgba(62,207,142,0.25);
}

.secrets-feedback--error {
  background: rgba(255,95,109,0.1);
  color: #ff8888;
  border: 1px solid rgba(255,95,109,0.25);
}

/* ─── Stored secrets list ─── */
.secrets-list-wrap {
  padding: 24px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 300px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(62,207,142,0.1);
}

.secrets-list-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(62,207,142,0.5), transparent);
  opacity: 0.5;
}

.secrets-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

/* ─── Secret item cards ─── */
.secrets-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  gap: 12px;
}

.secrets-item:hover {
  background: rgba(62,207,142,0.06);
  border-color: rgba(62,207,142,0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.secrets-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.secrets-item-icon {
  font-size: 14px;
  color: var(--accent);
  opacity: 0.7;
  flex-shrink: 0;
}

.secrets-item-name {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.secrets-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.secrets-edit-btn,
.secrets-delete-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  padding: 5px 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-muted);
  line-height: 1;
}

.secrets-edit-btn:hover {
  color: var(--accent);
  background: rgba(62,207,142,0.1);
  border-color: rgba(62,207,142,0.2);
}

.secrets-item--editing {
  border-color: rgba(62,207,142,0.3);
  background: rgba(62,207,142,0.04);
}

.secrets-edit-inline {
  padding: 12px 16px;
  background: rgba(62,207,142,0.04);
  border: 1px solid rgba(62,207,142,0.15);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.secrets-edit-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.secrets-edit-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.secrets-edit-label strong {
  color: var(--accent);
  font-family: var(--font-mono);
}

.secrets-edit-input-wrap {
  width: 100%;
}

.secrets-edit-value {
  width: 100%;
}

.secrets-edit-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.secrets-edit-save {
  background: rgba(62,207,142,0.15);
  border-color: rgba(62,207,142,0.3);
  color: var(--accent);
}

.secrets-edit-save:hover {
  background: rgba(62,207,142,0.25);
}

.secrets-edit-cancel {
  color: var(--text-muted);
}

.secrets-delete-btn:hover {
  color: var(--danger);
  background: rgba(255,95,109,0.1);
  border-color: rgba(255,95,109,0.2);
}

/* ─── Empty state ─── */
.secrets-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  flex: 1;
}

.secrets-empty-icon {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.5;
  filter: drop-shadow(0 0 12px rgba(62,207,142,0.2));
}

.secrets-empty-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 6px;
}

.secrets-empty-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
}

.secrets-error {
  color: var(--danger) !important;
}

/* ─── Loading state ─── */
.secrets-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.secrets-loading-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: secrets-pulse 1.2s ease-in-out infinite;
}

.secrets-loading-dot:nth-child(2) { animation-delay: 0.15s; }
.secrets-loading-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes secrets-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* ─── Mobile responsive ─── */
@media (max-width: 640px) {
  .secrets-grid {
    grid-template-columns: 1fr;
  }
  .secrets-body {
    padding: 16px;
  }
  .secrets-form,
  .secrets-list-wrap {
    padding: 18px;
  }
}

@media (max-width: 480px) {
  .secrets-body {
    padding: 12px;
  }
  .secrets-form,
  .secrets-list-wrap {
    padding: 14px;
  }
  .secrets-header {
    padding: 0 14px;
  }
  .secrets-form-actions {
    flex-direction: column;
  }
  .secrets-save-btn {
    width: 100%;
  }
}



@media (max-width: 768px) {
  .background-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 56px;
    z-index: 250;
    background: rgb(9, 16, 24);
  }

  .scheduler-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 56px;
    z-index: 250;
    background: rgb(9, 16, 24);
  }

  /* Background Tasks header on mobile */
  .bg-header {
    padding: 0 12px;
    height: var(--header-height);
    gap: 8px;
  }

  .bg-title {
    font-size: 15px;
  }

  /* Background Tasks detail on mobile */
  .bg-detail {
    border-radius: 0;
  }

  .bg-detail-header {
    padding: 10px 14px;
  }

  .bg-detail-header h3 {
    font-size: 13px;
  }

  .bg-detail-body {
    padding: 0;
    font-size: 12px;
  }

  .bg-detail-meta-row {
    flex-wrap: wrap;
    gap: 4px;
  }

  .bg-detail-prompt {
    font-size: 11px;
    padding: 10px;
    max-height: 100px;
  }

  .bg-detail-output {
    font-size: 10px;
    padding: 10px;
    max-height: none;
    flex: 1;
    overflow-y: auto;
    border-radius: var(--radius-sm);
  }

  /* Scheduler header on mobile */
  .sched-header {
    padding: 8px 12px;
    gap: 6px;
  }

  .sched-title {
    font-size: 15px;
  }

  /* Scheduler detail full-screen overlay on mobile */
  .sched-detail {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 56px;
    width: 100%;
    z-index: 20;
    border-radius: 0;
    background: rgb(9, 16, 24);
    overflow-y: auto;
  }

  /* Always show sidebar toggle on mobile */
  .sidebar-open-btn { display: flex !important; }
  .sidebar-toggle-btn { display: flex; }

  /* Header adjustments */
  .chat-header {
    height: var(--header-height);
    padding: 0 10px;
    gap: 8px;
  }

  .chat-header-info { gap: 6px; }
  .chat-session-label { font-size: 10px; }
  .chat-session-id { font-size: 11px; }

  /* Messages spacing */
  .messages-container {
    padding: 12px 10px;
    gap: 10px;
  }

  .message-row {
    max-width: calc(100% - 20px);
    gap: 8px;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .message-bubble {
    max-width: calc(100vw - 80px);
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .message-bubble code {
    font-size: 12px;
    padding: 2px 5px;
  }

  .message-bubble pre {
    padding: 10px;
    font-size: 11px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .message-bubble table {
    font-size: 12px;
    width: 100%;
    max-width: calc(100vw - 100px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
  }

  .message-bubble table th,
  .message-bubble table td {
    padding: 6px 8px;
    font-size: 11px;
  }

  /* Input area */
  .input-area {
    padding: 0;
  }

  .input-bar {
    padding: 8px 10px;
    gap: 6px;
    height: auto;
    min-height: var(--input-height);
  }

  .file-btn {
    font-size: 16px;
    width: 36px;
    height: 36px;
    padding: 0;
    flex-shrink: 0;
  }

  .message-textarea {
    font-size: 14px;
    padding: 8px 10px;
    min-height: 36px;
    max-height: 120px;
  }

  .send-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    flex-shrink: 0;
    font-size: 16px;
  }

  .input-mirror {
    padding: 8px 10px;
    font-size: 14px;
  }

  /* File preview strip */
  .file-preview-strip {
    padding: 6px 10px 0;
    gap: 6px;
  }

  .file-chip {
    font-size: 11px;
    padding: 3px 8px;
    gap: 4px;
  }

  /* Command dropdown on mobile */
  .cmd-dropdown {
    max-height: 200px;
    border-radius: 12px 12px 0 0;
    bottom: var(--input-height);
  }

  .cmd-row {
    grid-template-columns: 100px 1fr;
    padding: 8px 12px;
    gap: 0 8px;
  }

  .cmd-label { font-size: 12px; }
  .cmd-desc { font-size: 11px; }
  .cmd-hint { font-size: 10px; }

  /* Auth card mobile */
  .auth-card {
    width: calc(100vw - 20px);
    padding: 30px 20px;
  }

  .auth-logo { font-size: 40px; margin-bottom: 6px; }
  .auth-title { font-size: 22px; }
  .auth-subtitle { font-size: 13px; margin-bottom: 20px; }

  .form-group { margin-bottom: 12px; }
  .form-group label { font-size: 12px; margin-bottom: 5px; }

  .glass-input {
    font-size: 14px;
    padding: 10px 12px;
  }

  .glass-select {
    background-position: right 10px center;
    padding-right: 32px;
  }

  .btn {
    padding: 10px 16px;
    font-size: 13px;
    min-height: 44px;
  }

  .btn-full { width: 100%; }

  .code-input {
    font-size: 20px;
    letter-spacing: 0.2em;
  }

  /* Empty state */
  .empty-icon { font-size: 40px; }
  .empty-state p { font-size: 13px; max-width: 260px; }

  /* Scheduler panel mobile */
  .sched-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px;
    gap: 8px;
  }

  .sched-header-left {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .sched-title { font-size: 16px; }

  .sched-header-actions {
    width: 100%;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .btn-sm {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 36px;
  }

  .sched-body {
    flex-direction: column;
  }

  .sched-jobs-list {
    width: 100%;
    max-height: 50vh;
    overflow-y: auto;
  }

  .sched-job-card {
    margin: 8px;
  }

  .sched-detail {
    width: 100%;
    position: absolute;
    inset: 0;
    z-index: 20;
    border-radius: 0;
  }

  /* Session meta pills wrapping */
  .session-meta {
    gap: 4px;
    flex-wrap: wrap;
  }

  .meta-pill {
    padding: 2px 6px;
    font-size: 9px;
  }

  /* Scrollbar improvements for touch devices */
  .messages-container::-webkit-scrollbar {
    width: 6px;
  }

  .sessions-list::-webkit-scrollbar {
    width: 4px;
  }
}

/* Small Phones (max-width: 480px) */
@media (max-width: 480px) {
  :root {
    font-size: 13px;
    --header-height: 40px;
    --input-height: 56px;
  }

  html, body { font-size: 13px; }

  .sidebar-header { padding: 10px 12px; }
  .sidebar-logo { font-size: 18px; }
  .sidebar-title { font-size: 14px; }

  .new-chat-btn { margin: 6px 8px; font-size: 11px; padding: 6px 10px; }

  .sessions-list { padding: 2px 5px; }
  .session-item { padding: 6px 8px; font-size: 12px; }
  .session-title { font-size: 11px; }

  .sidebar-footer { padding: 8px 10px; }

  .chat-header {
    padding: 0 8px;
    height: var(--header-height);
  }

  .chat-session-label { font-size: 9px; }
  .chat-session-id { font-size: 10px; }

  .messages-container {
    padding: 10px 8px;
    gap: 8px;
  }

  .message-avatar {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .message-bubble {
    max-width: calc(100vw - 60px);
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 10px;
  }

  .message-bubble code { font-size: 11px; }
  .message-bubble pre { font-size: 10px; padding: 8px; }
  .message-bubble table { font-size: 11px; }
  .message-bubble table th,
  .message-bubble table td {
    padding: 4px 6px;
    font-size: 10px;
  }

  .input-bar {
    padding: 6px 8px;
    gap: 4px;
  }

  .file-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .message-textarea {
    font-size: 13px;
    padding: 6px 8px;
    min-height: 32px;
  }

  .send-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .input-mirror {
    padding: 6px 8px;
    font-size: 13px;
  }

  .file-preview-strip { padding: 4px 8px 0; }
  .file-chip { font-size: 10px; padding: 2px 6px; }

  .auth-card {
    width: calc(100vw - 16px);
    padding: 24px 16px;
  }

  .auth-logo { font-size: 36px; margin-bottom: 4px; }
  .auth-title { font-size: 20px; }
  .auth-subtitle { font-size: 12px; margin-bottom: 16px; }

  .form-group { margin-bottom: 10px; }
  .glass-input { font-size: 13px; padding: 9px 10px; }
  .btn { min-height: 40px; padding: 8px 14px; font-size: 12px; }

  .code-input { font-size: 18px; letter-spacing: 0.15em; }

  .empty-icon { font-size: 36px; }
  .empty-state p { font-size: 12px; max-width: 240px; }

  .sched-title { font-size: 14px; }
  .btn-sm { padding: 6px 10px; font-size: 11px; min-height: 32px; }

  .meta-pill { padding: 1px 5px; font-size: 8px; }

  /* Ensure touch targets are at least 44x44px */
  .btn { min-height: 44px; }
  .glass-input { min-height: 44px; }
  .file-btn, .send-btn { min-width: 44px; min-height: 44px; }
  .sidebar-toggle-btn, .sidebar-open-btn { min-width: 44px; min-height: 44px; }
}

/* Landscape Mode Adjustments */
@media (max-height: 600px) {
  :root {
    --header-height: 40px;
    --input-height: 52px;
  }

  .messages-container { padding: 8px 10px; }
  .message-bubble { padding: 8px 10px; }

  .input-bar { padding: 6px 10px; }
  .message-textarea { min-height: 28px; max-height: 80px; }
}

/* Ultra-wide displays (desktop optimization) */
@media (min-width: 1400px) {
  :root {
    --sidebar-width: 320px;
  }

  .message-row { max-width: 900px; }
  .messages-container { padding: 32px 28px; }
  .input-bar { padding: 14px 20px; }

  .auth-card { width: 480px; padding: 48px; }
}

/* Dev Environment Badge */
@keyframes pulse-dev {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245, 197, 66, 0.45),
                inset 0 1px 2px rgba(255,255,255,0.15),
                0 4px 16px rgba(0,0,0,0.3);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(245, 197, 66, 0),
                inset 0 1px 2px rgba(255,255,255,0.15),
                0 4px 16px rgba(0,0,0,0.3);
  }
}

.dev-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin-left: 8px;
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.22), rgba(245, 197, 66, 0.16));
  border: 1px solid rgba(245, 197, 66, 0.3);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #f5c542;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: pulse-dev 2s infinite;
  backdrop-filter: var(--glass-blur);
}

/* ---------- Request Queue Panel ---------- */
.request-queue-panel {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(18,28,25,0.82), rgba(10,16,20,0.78));
  border-left: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: -16px 0 40px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.06);
  z-index: 9;
  transition: width var(--transition), transform 0.25s ease;
  overflow: hidden;
}

.request-queue-panel.queue-hidden {
  width: 0;
  transform: translateX(100%);
}

.request-queue-panel.queue-minimized {
  width: 42px;
}

.request-queue-panel.queue-minimized .queue-header-title,
.request-queue-panel.queue-minimized .queue-pause-btn,
.request-queue-panel.queue-minimized .queue-items-list,
.request-queue-panel.queue-minimized .queue-footer,
.request-queue-panel.queue-minimized .scratch-section {
  display: none;
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.queue-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.queue-icon { font-size: 15px; }
.queue-label { color: var(--text-primary); }

.queue-count {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.queue-header-buttons {
  display: flex;
  gap: 4px;
}

.queue-pause-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 15px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.request-queue-panel.queue-minimized .queue-header {
  justify-content: center;
  padding: 12px 4px;
  border-bottom: none;
}

.request-queue-panel.queue-minimized .queue-header-buttons {
  width: 100%;
  display: flex;
  justify-content: center;
}

.queue-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 15px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
  white-space: nowrap;
}

.queue-pause-btn:hover,
.queue-toggle-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.queue-items-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.queue-items-list::-webkit-scrollbar { width: 4px; }
.queue-items-list::-webkit-scrollbar-track { background: transparent; }
.queue-items-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.queue-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 20px 0;
}

.queue-item {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
}

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

.queue-status-dot {
  font-size: 11px;
  flex-shrink: 0;
}

.queue-status-pending  .queue-status-dot { color: var(--text-muted); }
.queue-status-processing .queue-status-dot { color: #f5c542; }
.queue-status-completed  .queue-status-dot { color: #3ecf8e; }
.queue-status-failed     .queue-status-dot { color: #ff5f6d; }

.queue-item-number {
  font-weight: 700;
  color: var(--text-primary);
}

.queue-item-time {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 10px;
}

.queue-item-preview {
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
  margin-bottom: 6px;
}

.queue-item-actions {
  display: flex;
  gap: 6px;
}

.queue-btn-edit,
.queue-btn-delete {
  background: none;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 7px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.queue-btn-edit:hover  { background: rgba(62,207,142,0.15); color: var(--text-primary); }
.queue-btn-delete:hover { background: rgba(255,95,109,0.15); color: #ff5f6d; }

.queue-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.queue-footer small {
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.4;
}

/* ========== QUEUE SECTION (Collapsible) ========== */
.queue-section {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--glass-border);
  flex: 1 1 0;
  min-height: 0;
  max-height: 33vh;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.queue-section-collapsed {
  flex: 0 0 auto;
  max-height: 46px;
  overflow: hidden;
}

.queue-section-collapsed .queue-items-list,
.queue-section-collapsed .queue-footer {
  display: none;
}

.queue-section-collapsed .queue-footer {
  display: none;
}

.queue-section-collapsed .queue-pause-btn {
  display: none;
}

.queue-section-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0 4px;
  margin-right: 2px;
  transition: transform 0.2s ease;
  line-height: 1;
}

.queue-section-toggle:hover {
  color: var(--text-primary);
}

.queue-section-collapsed .queue-section-toggle {
  transform: rotate(-90deg);
}

/* ========== SCRATCH SECTION ========== */
.scratch-section {
  display: flex;
  flex-direction: column;
  padding: 12px;
  border-top: 1px solid var(--glass-border);
  gap: 8px;
  flex-shrink: 0;
}

.scratch-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.scratch-icon {
  font-size: 14px;
}

.scratch-label {
  color: var(--text-primary);
}

.scratch-char-count {
  color: var(--text-muted);
  font-size: 10px;
  margin-left: auto;
}

.scratch-textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  padding: 8px;
  resize: vertical;
  max-height: 100px;
  min-height: 60px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.scratch-textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

.scratch-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* Detail panel title editing */


.request-queue-panel.queue-minimized .queue-toggle-btn {
  width: 100%;
  padding: 6px 2px;
  flex-shrink: 0;
}


/* ========== FILE VIEWER PANEL ========== */
.file-viewer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 50vw);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(20,30,27,0.9), rgba(8,13,18,0.86));
  border-left: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  z-index: 20;
  transition: transform 0.28s cubic-bezier(.4,0,.2,1), opacity 0.22s ease;
  overflow: hidden;
  box-shadow: -18px 0 42px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.05);
}
.file-viewer-panel.fv-hidden {
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Header */
.fv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  gap: 8px;
}
.fv-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.fv-icon { font-size: 16px; flex-shrink: 0; }
.fv-filename {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fv-header-buttons {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.fv-mode-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.fv-mode-btn:hover { background: rgba(62,207,142,0.18); color: var(--text-primary); }
.fv-mode-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.fv-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}
.fv-close-btn:hover { color: var(--danger); }

/* Meta bar */
.fv-meta {
  padding: 6px 14px;
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  align-items: center;
}
.fv-meta-pill {
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
}
.fv-meta-path {
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.fv-meta-path:hover { opacity: 1; text-decoration: underline; }

/* Content area */
.fv-content {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

/* Preview mode (markdown / html) */
.fv-content .fv-preview {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}
.fv-content .fv-preview h1,
.fv-content .fv-preview h2,
.fv-content .fv-preview h3 {
  margin-top: 1.2em;
  margin-bottom: 0.4em;
  color: var(--text-primary);
}
.fv-content .fv-preview h1 { font-size: 1.6em; border-bottom: 1px solid var(--glass-border); padding-bottom: 6px; }
.fv-content .fv-preview h2 { font-size: 1.3em; }
.fv-content .fv-preview h3 { font-size: 1.1em; }
.fv-content .fv-preview p { margin: 0.5em 0; }
.fv-content .fv-preview a { color: var(--accent); text-decoration: underline; }
.fv-content .fv-preview code {
  background: rgba(255,255,255,0.06);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}
.fv-content .fv-preview pre {
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow-x: auto;
  margin: 0.6em 0;
}
.fv-content .fv-preview pre code {
  background: none;
  padding: 0;
}
.fv-content .fv-preview table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.6em 0;
}
.fv-content .fv-preview th,
.fv-content .fv-preview td {
  border: 1px solid var(--glass-border);
  padding: 6px 10px;
  font-size: 13px;
  text-align: left;
}
.fv-content .fv-preview th {
  background: rgba(255,255,255,0.05);
  font-weight: 600;
}
.fv-content .fv-preview blockquote {
  border-left: 3px solid var(--accent);
  margin: 0.5em 0;
  padding: 4px 12px;
  color: var(--text-secondary);
}
.fv-content .fv-preview img {
  max-width: 100%;
  border-radius: var(--radius-sm);
}
.fv-content .fv-preview ul, .fv-content .fv-preview ol {
  padding-left: 1.5em;
  margin: 0.4em 0;
}
.fv-content .fv-preview li { margin: 0.2em 0; }

/* Raw mode (code view with line numbers) */
.fv-content .fv-raw {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre;
  tab-size: 4;
  color: var(--text-secondary);
  counter-reset: fv-line;
}
.fv-raw-line {
  display: block;
  counter-increment: fv-line;
  padding-left: 4.5em;
  position: relative;
  min-height: 1.6em;
}
.fv-raw-line::before {
  content: counter(fv-line);
  position: absolute;
  left: 0;
  width: 3.8em;
  text-align: right;
  color: rgba(255,255,255,0.18);
  font-size: 11px;
  user-select: none;
  padding-right: 0.5em;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.fv-raw-line:hover {
  background: rgba(255,255,255,0.04);
}

/* Image display */
.fv-content .fv-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.fv-content .fv-image-wrap img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}

/* Loading spinner */
.fv-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 14px;
  gap: 8px;
}
.fv-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: fv-spin 0.7s linear infinite;
}
@keyframes fv-spin { to { transform: rotate(360deg); } }

/* Error state */
.fv-error {
  text-align: center;
  color: var(--danger);
  padding: 2em;
  font-size: 13px;
}

/* Clickable file paths in messages */
.file-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  transition: color 0.15s;
  word-break: break-all;
}
.file-link:hover {
  color: #5da5ff;
  text-decoration-style: solid;
}

/* ============================================
/* Mobile */
@media (max-width: 768px) {
  .file-viewer-panel {
    width: 100vw;
  }
}

/* ============================================
   MOBILE BOTTOM TAB BAR
   ============================================ */

/* Hidden on desktop — only shown via media query */
.mobile-tab-bar {
  display: none;
}

.mobile-tab-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0px 5px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
  display: inline-block;
  vertical-align: middle;
  margin-left: 2px;
}

.mobile-tab-badge.hidden {
  display: none;
}

@media (max-width: 768px) {
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: rgba(18, 18, 35, 0.97);
    border-top: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 150;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.4);
  }

  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    border-top: 2px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 4px;
    transition: color 0.2s, background 0.15s, border-color 0.2s;
    min-height: 44px;
    touch-action: manipulation;
  }

  .mobile-tab-icon {
    font-size: 18px;
    line-height: 1;
  }

  .mobile-tab-label {
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
  }

  .mobile-tab.active {
    color: var(--accent);
    border-top-color: var(--accent);
  }

  .mobile-tab:hover,
  .mobile-tab:active {
    background: rgba(255, 255, 255, 0.06);
  }
}

/* ============================================
   NOTIFICATION CENTER
   ============================================ */

.notif-badge-red {
  background: #e53935 !important;
}

.notification-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 45vw);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(20,30,27,0.9), rgba(8,13,18,0.86));
  border-left: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  z-index: 30;
  transition: transform 0.28s cubic-bezier(.4,0,.2,1), opacity 0.22s ease;
  overflow: hidden;
  box-shadow: -18px 0 42px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.05);
}

.notification-panel.notif-hidden {
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.03);
}

.notif-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notif-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.notif-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.notif-settings-bar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.02);
}

.notif-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
}

.notif-toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.notif-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notif-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 48px 24px;
  line-height: 1.6;
}

/* Notification cards */
.notif-card {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.04);
  transition: background 0.15s, opacity 0.2s;
  position: relative;
}

.notif-card.notif-unread {
  border-left: 3px solid var(--accent);
}

.notif-card.notif-success {
  border-left-color: #3ecf8e;
  background: rgba(62, 207, 142, 0.06);
}

.notif-card.notif-success.notif-unread {
  border-left-color: #3ecf8e;
}

.notif-card.notif-failure {
  border-left-color: #e53935;
  background: rgba(229, 57, 53, 0.06);
}

.notif-card.notif-failure.notif-unread {
  border-left-color: #e53935;
}

.notif-card.notif-read {
  opacity: 0.65;
}

.notif-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.notif-card-icon-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.notif-card-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.notif-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-card-title.notif-title-success {
  color: #3ecf8e;
}

.notif-card-title.notif-title-failure {
  color: #ef5350;
}

.notif-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.notif-card-btn {
  background: none;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.notif-card-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

.notif-card-btn.notif-btn-danger:hover {
  background: rgba(229,57,53,0.15);
  border-color: rgba(229,57,53,0.4);
  color: #ef5350;
}

.notif-card-description {
  font-size: 13px;
  color: var(--text-secondary, rgba(255,255,255,0.65));
  margin-bottom: 6px;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notif-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.notif-card-task-id {
  font-size: 11px;
  font-family: monospace;
  color: var(--text-muted);
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.notif-card-time {
  font-size: 11px;
  color: var(--text-muted);
}

.notif-preview {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.25);
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-family: monospace;
  color: var(--text-secondary, rgba(255,255,255,0.65));
  line-height: 1.4;
  max-height: 80px;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-all;
}

.notif-error-preview {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(229,57,53,0.08);
  border: 1px solid rgba(229,57,53,0.25);
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-family: monospace;
  color: #ef9a9a;
  line-height: 1.4;
  max-height: 80px;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Floating notification toast (bottom-right) */
#notif-popup-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
}

.notif-popup {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(18,22,40,0.97);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: notif-slide-in 0.25s ease;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.notif-popup.notif-popup-success {
  border-left: 3px solid #3ecf8e;
}

.notif-popup.notif-popup-failure {
  border-left: 3px solid #e53935;
}

.notif-popup-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.notif-popup-body {
  flex: 1;
  min-width: 0;
}

.notif-popup-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.notif-popup-title.notif-popup-title-success { color: #3ecf8e; }
.notif-popup-title.notif-popup-title-failure { color: #ef5350; }

.notif-popup-desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-popup-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 1;
}

.notif-popup-close:hover { color: var(--text-primary); }

@keyframes notif-slide-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@media (max-width: 768px) {
  .notification-panel {
    width: 100vw;
    top: auto;
    right: 0;
    bottom: 56px; /* above mobile tab bar */
    height: 70vh;
    border-left: none;
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
    background: rgb(9, 16, 24);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 110;
  }
  .notification-panel.notif-hidden {
    transform: translateY(100%);
  }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   ─── Live Canvas Panel ──────────────────────────────────────────────────────
   ═══════════════════════════════════════════════════════════════════════════════ */

.canvas-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 50vw;
  height: 100vh;
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: row;
}

.canvas-panel.canvas-open {
  transform: translateX(0);
}

.canvas-panel.canvas-hidden {
  transform: translateX(100%);
}

.canvas-edge-tab {
  position: absolute;
  left: -36px;
  top: calc(50% + 32px);
  transform: translateY(-50%);
  width: 36px;
  height: 64px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-right: none;
  border-radius: 10px 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s, width 0.2s;
  z-index: 201;
}

.canvas-edge-tab:hover {
  background: rgba(255,255,255,0.1);
  width: 42px;
  left: -42px;
}

.canvas-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(10, 14, 26, 0.95);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: 1px solid var(--glass-border);
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
  overflow: hidden;
}

.canvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass-bg);
  flex-shrink: 0;
}

.canvas-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.canvas-tab-bar {
  display: flex;
  gap: 2px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.02);
  overflow-x: auto;
  flex-shrink: 0;
  min-height: 36px;
}

.canvas-tab-bar:empty {
  display: none;
}

.canvas-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.canvas-tab:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}

.canvas-tab.active {
  background: rgba(62, 207, 142, 0.12);
  border-color: rgba(62, 207, 142, 0.3);
  color: var(--accent);
}

.canvas-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: all 0.15s;
}

.canvas-tab-close:hover {
  background: rgba(255,95,109,0.2);
  color: var(--danger);
}

.canvas-tab-rename {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 11px;
  padding: 1px 4px;
  outline: none;
  width: 80px;
  font-family: inherit;
}

.canvas-closed-sessions {
  padding: 0 10px;
}

.canvas-closed-sessions:empty {
  display: none;
}

.canvas-closed-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.canvas-closed-toggle:hover {
  color: var(--text-secondary);
}

.canvas-closed-list {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0 8px 0;
}

.canvas-closed-list.expanded {
  display: flex;
}

.canvas-closed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-secondary);
}

.canvas-closed-item-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.canvas-closed-item-name {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.canvas-closed-item-time {
  font-size: 10px;
  color: var(--text-muted);
}

.canvas-closed-restore-btn {
  background: rgba(62,207,142,0.12);
  border: 1px solid rgba(62,207,142,0.3);
  color: var(--accent);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.canvas-closed-restore-btn:hover {
  background: rgba(62,207,142,0.25);
}

.canvas-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.canvas-content::-webkit-scrollbar { width: 6px; }
.canvas-content::-webkit-scrollbar-track { background: transparent; }
.canvas-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.canvas-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
}

/* Canvas component rendering styles (matching live-canvas viewer) */
.canvas-content .glass-panel {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius);
  padding: 16px;
}

.canvas-content .glass-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.08);
  padding: 14px;
}

.canvas-content .board-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.canvas-content .board-col { background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.canvas-content .board-col-title { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.canvas-content .board-item { background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12px; }

.canvas-content .c-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.canvas-content .c-col { display: flex; flex-direction: column; gap: 8px; }
.canvas-content .c-grid { display: grid; gap: 12px; }

.canvas-content .c-h1 { font-size: 24px; font-weight: 700; line-height: 1.2; }
.canvas-content .c-h2 { font-size: 18px; font-weight: 600; }
.canvas-content .c-h3 { font-size: 15px; font-weight: 600; }
.canvas-content .c-h4 { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

.canvas-content .progress-wrap { background: rgba(255,255,255,0.08); border-radius: 99px; height: 6px; overflow: hidden; }
.canvas-content .progress-bar { height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.4s ease; }

.canvas-content .metric-value { font-size: 24px; font-weight: 700; line-height: 1; }
.canvas-content .metric-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }
.canvas-content .trend-up { color: var(--accent); }
.canvas-content .trend-down { color: var(--danger); }

.canvas-content .glass-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.canvas-content .glass-table { width: 100%; border-collapse: collapse; table-layout: auto; font-size: 13px; }
.canvas-content .glass-table th { text-align: left; padding: 10px 12px; color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--glass-border); white-space: nowrap; }
.canvas-content .glass-table td { padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.05); color: var(--text-primary); font-size: 13px; word-break: break-word; }
.canvas-content .glass-table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.025); }
.canvas-content .glass-table tbody tr:hover td { background: rgba(255,255,255,0.06); }

.canvas-content .log-area { background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 10px; font-family: var(--font-mono); font-size: 11px; max-height: 200px; overflow-y: auto; color: #7fffd4; white-space: pre-wrap; word-break: break-all; }
.canvas-content .code-block { background: rgba(0,0,0,0.4); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 12px; font-family: var(--font-mono); font-size: 11px; overflow-x: auto; color: #e2e8f0; white-space: pre; }

.canvas-content .glass-divider { height: 1px; background: var(--glass-border); border: none; margin: 4px 0; }

.canvas-content .badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; }
.canvas-content .badge-success { background: rgba(62,207,142,0.15); color: #3ecf8e; border: 1px solid rgba(62,207,142,0.3); }
.canvas-content .badge-warning { background: rgba(245,197,66,0.15); color: #f5c542; border: 1px solid rgba(245,197,66,0.3); }
.canvas-content .badge-danger  { background: rgba(255,95,109,0.15); color: #ff8888; border: 1px solid rgba(255,95,109,0.3); }
.canvas-content .badge-info    { background: rgba(79,140,255,0.15); color: #7fb5ff; border: 1px solid rgba(79,140,255,0.3); }
.canvas-content .badge-neutral { background: rgba(255,255,255,0.08); color: var(--text-secondary); border: 1px solid var(--glass-border); }

.canvas-content .mermaid-wrap { background: rgba(0,0,0,0.2); border-radius: var(--radius-sm); padding: 12px; overflow-x: auto; }
.canvas-content .mermaid svg { max-width: 100%; }

.canvas-content .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border: none; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
}
.canvas-content .btn-primary { background: var(--accent); color: #fff; }
.canvas-content .btn-primary:hover { background: var(--accent-hover); }
.canvas-content .btn-ghost { background: rgba(255,255,255,0.08); color: var(--text-secondary); border: 1px solid var(--glass-border); }
.canvas-content .btn-ghost:hover { background: rgba(255,255,255,0.14); color: var(--text-primary); }
.canvas-content .btn-danger { background: var(--danger); color: #fff; }
.canvas-content .btn-danger:hover { background: var(--danger-hover); }
.canvas-content .btn-gold { background: var(--gold); color: #1a1a2e; font-weight: 600; }

.canvas-content .glass-input, .canvas-content .glass-select {
  width: 100%; padding: 8px 12px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font); font-size: 13px;
  outline: none;
}
.canvas-content .glass-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(62,207,142,0.2); }

.canvas-content .anim-in { animation: fadeSlideIn 0.2s ease both; }

@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Canvas responsive */
@media (max-width: 768px) {
  .canvas-panel {
    width: 100vw;
  }
  .canvas-edge-tab {
    display: none;
  }
}

/* ── Settings & Logs ──────────────────────────────────────────────────── */

/* Sidebar toolbar */
.sidebar-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 4px;
  border-top: 1px solid var(--glass-border);
  margin-top: auto;
}
.sidebar-tool-btn {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8rem;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-tool-btn.active {
  background: rgba(62,207,142,0.18);
  border-color: rgba(62,207,142,0.4);
  color: #b6f5d1;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

.modal-box {
  width: min(680px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--glass-border);
}
.modal-header h3 { margin: 0; font-size: 1rem; }
.modal-body {
  flex: 1;
  padding: 14px 18px;
  overflow-y: auto;
}
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--glass-border);
}

/* Settings textarea */
.settings-textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  border: 1px solid var(--glass-border);
  tab-size: 2;
}
.settings-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}
.settings-error {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  font-size: 0.82rem;
  font-family: monospace;
  white-space: pre-wrap;
}
.settings-error.hidden { display: none; }

/* Logs panel */
.logs-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 42vh;
  z-index: 8000;
  display: flex;
  flex-direction: column;
  border-top: 2px solid var(--primary);
  border-radius: 0;
}
.logs-panel.hidden { display: none; }

.logs-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--glass-border);
  flex-wrap: wrap;
}
.logs-title {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}
.logs-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
}
.logs-select {
  max-width: 180px;
  font-size: 0.8rem;
  padding: 4px 8px;
}
.logs-search-input {
  max-width: 150px;
  font-size: 0.8rem;
  padding: 4px 8px;
}
.logs-date-input {
  max-width: 190px;
  font-size: 0.78rem;
  padding: 3px 6px;
  color-scheme: dark;
}
.logs-live-label {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  cursor: pointer;
}
.logs-output {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 8px 14px;
  margin: 0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  white-space: pre;
}

/* Log line severity highlighting */
.log-line-error { color: #f87171; }
.log-line-warn  { color: #fbbf24; }
.log-line-info  { color: #60a5fa; }

/* ── Agent Settings Form (asf-*) ─────────────────────────────────────────── */
.modal-box-agent {
  width: min(720px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.asf-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.asf-selector {
  font-size: 0.85rem;
  padding: 5px 28px 5px 10px;
  min-width: 0;
  flex: 1;
  max-width: 240px;
}
.asf-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.asf-section {
  margin-bottom: 14px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.asf-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--surface-raised);
  padding: 9px 12px;
  border-bottom: 1px solid var(--glass-border);
}
.asf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  padding: 12px;
}
.asf-full { grid-column: 1 / -1; }
.asf-field { display: flex; flex-direction: column; gap: 4px; }
.asf-label {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.asf-req { color: var(--accent); }
.asf-input, .asf-textarea, .asf-select {
  background: var(--surface-sunken);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 7px 10px;
  outline: none;
  font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.asf-input:focus, .asf-textarea:focus, .asf-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.asf-input.asf-error, .asf-textarea.asf-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(255,95,109,0.2);
}
.asf-mono { font-family: var(--font-mono); font-size: 0.82rem; }
.asf-textarea { resize: vertical; min-height: 56px; }

/* Permissions section */
.asf-mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.asf-mode-restricted {
  background: rgba(62,207,142,0.14);
  border: 1px solid rgba(62,207,142,0.28);
  color: var(--accent);
}
.asf-mode-elevated {
  background: rgba(245,197,66,0.14);
  border: 1px solid rgba(245,197,66,0.28);
  color: var(--gold);
}
.asf-mode-yolo, .asf-mode-sandboxed {
  background: rgba(255,95,109,0.14);
  border: 1px solid rgba(255,95,109,0.28);
  color: var(--danger);
}
.asf-changed-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(245,197,66,0.12);
  border: 1px solid rgba(245,197,66,0.25);
  color: var(--gold);
}
.asf-details {
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  margin: 8px 12px 0;
  overflow: hidden;
}
.asf-details + .asf-details { margin-top: 6px; }
.asf-details-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  background: rgba(255,255,255,0.04);
  user-select: none;
  list-style: none;
  transition: background 0.15s;
}
.asf-details-summary:hover { background: rgba(255,255,255,0.07); }
.asf-details-summary::marker, .asf-details-summary::-webkit-details-marker { display: none; }
.asf-details-summary::after {
  content: '▶';
  margin-left: auto;
  font-size: 0.6rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.asf-details[open] > .asf-details-summary::after { transform: rotate(90deg); }
.asf-details-body { padding: 10px 12px 12px; }
.asf-perm-group { margin-bottom: 10px; }
.asf-perm-group:last-child { margin-bottom: 0; }
.asf-perm-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.asf-allow-label { color: var(--accent); }
.asf-deny-label  { color: var(--danger); }

/* Tag lists */
.asf-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
  min-height: 24px;
}
.asf-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px 2px 8px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-family: var(--font-mono);
  max-width: 240px;
  cursor: default;
}
.asf-tag-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asf-tag-rm {
  background: none; border: none; cursor: pointer;
  padding: 0; font-size: 0.68rem; line-height: 1;
  opacity: 0.6; transition: opacity 0.1s; color: inherit; flex-shrink: 0;
}
.asf-tag-rm:hover { opacity: 1; }
.asf-tag-allow {
  background: rgba(62,207,142,0.12);
  border: 1px solid rgba(62,207,142,0.28);
  color: var(--accent);
}
.asf-tag-deny {
  background: rgba(255,95,109,0.12);
  border: 1px solid rgba(255,95,109,0.28);
  color: var(--danger);
}
.asf-tag-wild {
  background: rgba(245,197,66,0.12);
  border: 1px solid rgba(245,197,66,0.28);
  color: var(--gold);
}

/* Add row */
.asf-add-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.asf-tag-input {
  flex: 1;
  font-size: 0.8rem;
  padding: 5px 8px;
}
.asf-add-btn {
  font-size: 0.78rem;
  padding: 4px 10px;
  flex-shrink: 0;
  color: var(--accent);
  border-color: rgba(62,207,142,0.3);
}
.asf-btn-deny { color: var(--danger); border-color: rgba(255,95,109,0.3); }

/* Footer */
.asf-footer {
  display: flex;
  align-items: center;
  padding: 10px 18px 12px;
  border-top: 1px solid var(--glass-border);
}
.asf-footer-left { flex: 1; }
.asf-footer-right { display: flex; gap: 8px; }
.asf-btn-reload {
  background: rgba(245,197,66,0.12);
  color: var(--gold);
  border: 1px solid rgba(245,197,66,0.3);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.asf-btn-reload:hover { background: rgba(245,197,66,0.22); }

/* Dirty indicator in header */
.asf-dirty-dot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(245,197,66,0.12);
  border: 1px solid rgba(245,197,66,0.28);
  border-radius: 20px;
  padding: 2px 8px;
  margin-left: 8px;
}
.asf-dirty-dot::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
  animation: asp-pulse 1.6s ease-in-out infinite;
}
@keyframes asp-pulse {
  0%,100%{opacity:1}50%{opacity:.4}
}

/* Error and success banners */
.settings-error {
  background: rgba(255,95,109,0.1);
  border: 1px solid rgba(255,95,109,0.3);
  border-radius: var(--radius-sm);
  color: var(--danger);
  padding: 8px 12px;
  font-size: 0.82rem;
}
.asf-success {
  background: rgba(62,207,142,0.1);
  border: 1px solid rgba(62,207,142,0.3);
  border-radius: var(--radius-sm);
  color: var(--accent);
  padding: 8px 12px;
  font-size: 0.82rem;
}

/* Add new agent button */
.asf-add-agent-btn {
  background: rgba(62,207,142,0.1);
  border: 1px solid rgba(62,207,142,0.25);
  border-radius: 8px;
  color: var(--accent);
  font-size: 1.1rem;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.asf-add-agent-btn:hover { background: rgba(62,207,142,0.2); }

/* Danger zone */
.asf-danger-section .asf-section-title { color: var(--danger); background: rgba(255,95,109,0.06); }
.asf-delete-btn {
  background: rgba(255,95,109,0.1);
  border: 1px solid rgba(255,95,109,0.3);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.85rem;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.15s;
  width: calc(100% - 24px);
  margin: 12px;
  text-align: left;
}
.asf-delete-btn:hover { background: rgba(255,95,109,0.18); border-color: var(--danger); }

@media (max-width: 640px) {
  .asf-grid { grid-template-columns: 1fr; }
  .asf-full { grid-column: 1; }
}

/* ══════════════════════════════════════════════════════════════════
   Agent Settings Form Panel  (Leprachuan Glassmorphism)
   ══════════════════════════════════════════════════════════════════ */

/* Wide modal variant for the settings panel */
.modal-box-agent {
  width: min(860px, 94vw);
  max-height: 88vh;
}

/* Header with inline agent selector */
.asf-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.asf-selector {
  flex: 1;
  max-width: 220px;
  font-size: 0.84rem;
  padding: 5px 28px 5px 10px;
  border-radius: var(--radius-sm, 10px);
}

/* Scrollable body */
.asf-body {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.asf-body::-webkit-scrollbar { width: 5px; }
.asf-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 3px; }

/* Section card */
.asf-section {
  margin-bottom: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-sm, 10px);
}

.asf-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #3ecf8e;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 2-column grid for basic fields */
.asf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

.asf-field { display: flex; flex-direction: column; gap: 4px; }
.asf-full  { grid-column: 1 / -1; }

.asf-label {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.50);
  font-weight: 500;
}

.asf-req { color: #3ecf8e; }

.asf-input,
.asf-textarea,
.asf-select {
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: rgba(255,255,255,0.92);
  font-size: 0.85rem;
  padding: 7px 10px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.14s, box-shadow 0.14s;
  font-family: inherit;
}

.asf-mono { font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace; }

.asf-input:focus,
.asf-textarea:focus,
.asf-select:focus {
  outline: none;
  border-color: #3ecf8e;
  box-shadow: 0 0 0 2px rgba(62,207,142,0.28);
}

.asf-textarea {
  resize: vertical;
  min-height: 56px;
}

.asf-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(255,255,255,0.4)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
  cursor: pointer;
}

/* Mode badge */
.asf-mode-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.asf-mode-elevated   { background: rgba(245,197,66,0.16); color: #f5c542; border: 1px solid rgba(245,197,66,0.28); }
.asf-mode-restricted { background: rgba(62,207,142,0.14); color: #3ecf8e; border: 1px solid rgba(62,207,142,0.28); }
.asf-mode-sandboxed  { background: rgba(139,92,246,0.16); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.28); }

/* Permissions changed indicator */
.asf-changed-badge {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.30);
  cursor: help;
}

/* Collapsible details */
.asf-details {
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  overflow: hidden;
}

.asf-details-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255,255,255,0.80);
  background: rgba(255,255,255,0.04);
  user-select: none;
  list-style: none;
  transition: background 0.14s;
}
.asf-details-summary::-webkit-details-marker { display: none; }
.asf-details-summary::before {
  content: '▶';
  font-size: 0.6rem;
  color: rgba(255,255,255,0.35);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.asf-details[open] .asf-details-summary::before { transform: rotate(90deg); }
.asf-details-summary:hover { background: rgba(255,255,255,0.08); }

.asf-details-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Permission list group */
.asf-perm-group { display: flex; flex-direction: column; gap: 5px; }

.asf-perm-group-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.asf-allow-label { color: rgba(62,207,142,0.70); }
.asf-deny-label  { color: rgba(255,95,109,0.70);  }

/* Tag list container */
.asf-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 26px;
  align-items: flex-start;
}

/* Individual tags */
.asf-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.asf-tag-allow { background: rgba(62,207,142,0.12); border: 1px solid rgba(62,207,142,0.28); color: #3ecf8e; }
.asf-tag-deny  { background: rgba(255,95,109,0.10); border: 1px solid rgba(255,95,109,0.26); color: #fca5a5; }
.asf-tag-wild  { background: rgba(245,197,66,0.12); border: 1px solid rgba(245,197,66,0.28); color: #f5c542; }

.asf-tag-text { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.asf-tag-rm {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.50;
  cursor: pointer;
  padding: 0 1px;
  font-size: 0.82rem;
  line-height: 1;
  transition: opacity 0.12s;
}
.asf-tag-rm:hover { opacity: 1; }

/* Add row */
.asf-add-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.asf-tag-input {
  flex: 1;
  font-size: 0.8rem;
  padding: 5px 8px;
  border-radius: 6px;
}

.asf-add-btn {
  white-space: nowrap;
  font-size: 0.76rem;
  padding: 4px 10px;
}

.asf-btn-deny {
  background: rgba(255,95,109,0.09);
  border-color: rgba(255,95,109,0.24);
  color: #fca5a5;
}
.asf-btn-deny:hover { background: rgba(255,95,109,0.16); }

/* Footer layout */
.asf-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.asf-footer-left  { display: flex; gap: 8px; }
.asf-footer-right { display: flex; gap: 8px; }

/* Reload Services button */
.asf-btn-reload {
  background: rgba(245,158,11,0.14);
  border: 1px solid rgba(245,158,11,0.32);
  color: #f59e0b;
  transition: background 0.14s, border-color 0.14s;
}
.asf-btn-reload:hover:not(:disabled) {
  background: rgba(245,158,11,0.24);
  border-color: #f59e0b;
}

/* Success banner */
.asf-success {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(62,207,142,0.12);
  border: 1px solid rgba(62,207,142,0.28);
  color: #3ecf8e;
  font-size: 0.82rem;
  font-weight: 500;
}
.asf-success.hidden { display: none; }

/* Responsive: collapse grid on mobile */
@media (max-width: 600px) {
  .asf-grid { grid-template-columns: 1fr; }
  .asf-full { grid-column: 1; }
  .asf-selector { max-width: 140px; }
  .modal-box-agent { width: 100%; max-height: 100%; border-radius: 0; }
}

/* ─── Run Now button style ─────────────────────────────────────────────────── */
.btn-accent {
  background: rgba(62,207,142,0.16);
  color: var(--accent);
  border: 1px solid rgba(62,207,142,0.36);
}
.btn-accent:not(:disabled):hover {
  background: rgba(62,207,142,0.26);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.btn-accent:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Background Task: Tab bar ─────────────────────────────────────────────── */
.bg-detail-tabs {
  display: flex;
  gap: 4px;
  padding: 0 0 12px 0;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 12px;
  flex-shrink: 0;
}

.bg-tab {
  padding: 5px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
}
.bg-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.bg-tab.active {
  color: var(--accent);
  background: rgba(62,207,142,0.1);
  border-color: rgba(62,207,142,0.28);
}

.bg-tab-pane { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.bg-tab-pane.hidden { display: none; }

/* ─── Live dot indicator ────────────────────────────────────────────────────── */
.bg-live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ecf8e;
  animation: livePulse 1.4s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.75); }
}

/* ─── Transcript panel ──────────────────────────────────────────────────────── */
.bg-transcript-timing {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 6px 0 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 8px;
}

.bg-transcript-panel {
  flex: 1;
  overflow-y: auto;
  background: rgba(6,10,16,0.5);
  border: none;
  border-radius: 0;
  padding: 10px 12px;
  min-height: 120px;
  scroll-behavior: smooth;
}

.bg-transcript-pre {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* ── Split detail layout ──────────────────────────────────── */
.bg-detail-split {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 0;
}
.bg-detail-left {
  width: 340px;
  flex-shrink: 0;
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 18px;
}
.bg-detail-left .bg-tab-pane {
  overflow-y: auto;
}
.bg-detail-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.bg-logs-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.bg-logs-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Rendered markdown logs ──────────────────────────────── */
.bg-log-rendered {
  padding: 12px 16px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-secondary);
}
.bg-log-rendered h1, .bg-log-rendered h2, .bg-log-rendered h3 {
  color: var(--text-primary);
  margin: 12px 0 6px;
}
.bg-log-rendered h1 { font-size: 18px; }
.bg-log-rendered h2 { font-size: 15px; }
.bg-log-rendered h3 { font-size: 13px; }
.bg-log-rendered code {
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.bg-log-rendered pre {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 11px;
  line-height: 1.5;
}
.bg-log-rendered pre code {
  background: none;
  padding: 0;
}
.bg-log-rendered p { margin: 4px 0 8px; }
.bg-log-rendered ul, .bg-log-rendered ol { padding-left: 20px; margin: 4px 0 8px; }
.bg-log-rendered a { color: var(--accent); text-decoration: underline; }
.bg-log-rendered blockquote {
  border-left: 3px solid var(--accent);
  margin: 4px 0 8px;
  padding: 4px 12px;
  color: var(--text-muted);
}
.bg-log-rendered table {
  border-collapse: collapse;
  font-size: 11px;
  margin: 8px 0;
}
.bg-log-rendered th, .bg-log-rendered td {
  border: 1px solid var(--glass-border);
  padding: 4px 8px;
}
.bg-log-rendered th {
  background: rgba(255,255,255,0.05);
  font-weight: 600;
}

/* ── Tool Call Panel ─────────────────────────────────────── */

.bg-tool-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(62, 207, 142, 0.2);
  color: var(--accent, #3ecf8e);
  margin-left: 6px;
  vertical-align: middle;
}

.bg-tools-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted, #6b7280);
  font-size: 13px;
  gap: 8px;
}

.bg-tools-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  border-bottom: 1px solid var(--border-color, #333);
}

.bg-tools-count {
  font-weight: 600;
  color: var(--text-secondary, #b0b8c4);
}

.bg-tools-runtime {
  font-size: 11px;
  text-transform: capitalize;
}

.bg-tool-calls-panel {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  max-height: 420px;
  padding-bottom: 8px;
}

.bg-tools-timeline {
  padding: 8px 12px;
  position: relative;
}

/* Timeline connector line */
.bg-tools-timeline::before {
  content: '';
  position: absolute;
  left: 24px;
  top: 16px;
  bottom: 16px;
  width: 2px;
  background: var(--border-color, #333);
  border-radius: 1px;
}

.bg-tc-item {
  position: relative;
  margin-bottom: 4px;
  border-radius: 8px;
  transition: background 0.15s;
}

.bg-tc-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.bg-tc-connector {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tc-color, #888);
  z-index: 1;
  box-shadow: 0 0 0 3px var(--bg-primary, #0a0a0f);
}

.bg-tc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 28px;
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}

.bg-tc-icon {
  font-size: 12px;
  flex-shrink: 0;
}

.bg-tc-name {
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  font-family: var(--font-mono);
  font-size: 12px;
}

.bg-tc-runtime {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted, #6b7280);
  text-transform: capitalize;
}

.bg-tc-time {
  font-size: 10px;
  color: var(--text-muted, #6b7280);
  margin-left: auto;
  flex-shrink: 0;
}

.bg-tc-expand {
  font-size: 10px;
  color: var(--text-muted, #6b7280);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.bg-tc-item.expanded .bg-tc-expand {
  transform: rotate(90deg);
}

.bg-tc-body {
  display: none;
  padding: 0 10px 10px 28px;
}

.bg-tc-item.expanded .bg-tc-body {
  display: block;
}

.bg-tc-id {
  font-size: 10px;
  color: var(--text-muted, #6b7280);
  font-family: var(--font-mono);
  margin-bottom: 6px;
  opacity: 0.7;
}

.bg-tc-section {
  margin-top: 6px;
}

.bg-tc-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #6b7280);
  margin-bottom: 3px;
}

.bg-tc-code {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-secondary, #b0b8c4);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color, #333);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

/* Streaming tool indicator — interleaved tool call blocks */
@keyframes toolSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Legacy: keep for any remaining references (inline in bubble) */
.stream-inline-tools { display: none; }
.tool-inline-icon { display: none; }
.tool-inline-icon .tool-name { display: none; }
.tool-gear { display: none; }

/* ─── Tool calls rendered inside the streaming bubble ─── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
/* ── Tool call blocks: expandable accordion (Issue #115) ── */
.tc-block {
  margin: 4px 0;
  border-radius: 6px;
  overflow: hidden;
  transition: background 0.15s;
}
.tc-block:hover {
  background: rgba(255,255,255,0.03);
}
.tc-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  padding: 4px 6px;
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
  transition: background 0.15s;
}
.tc-line:hover {
  background: rgba(255,255,255,0.05);
}
.tc-toggle {
  font-size: 10px;
  color: var(--text-muted, #6b7280);
  flex-shrink: 0;
  width: 14px;
  text-align: center;
  transition: color 0.15s;
}
.tc-toggle.has-output {
  color: var(--text-secondary, #d1d5db);
}
.tc-spinner {
  font-size: 12px;
  display: inline-block;
  flex-shrink: 0;
}
.tc-spinner.spinning {
  animation: spin 1.2s linear infinite;
}
.tc-name {
  font-weight: 600;
  color: var(--text-secondary, #d1d5db);
  font-size: 12px;
  flex-shrink: 0;
}
.tc-input {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-muted, #6b7280);
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 350px;
  display: inline-block;
}
.tc-status {
  font-size: 11px;
  flex-shrink: 0;
  margin-left: auto;
}
.tc-status.running { color: #f5c542; }
.tc-status.done { color: #3ecf8e; }
.tc-status.error { color: #ef4444; }
/* Expandable output area */
.tc-output {
  display: none;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-secondary, #d1d5db);
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  margin: 2px 6px 6px 26px;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}
.tc-block.tc-expanded .tc-output:not(:empty) {
  display: block;
}
/* Error state */
.tc-block.tc-error .tc-line {
  color: #ef4444;
}
.tc-block.tc-error .tc-name {
  color: #ef4444;
}
.tc-block.tc-error .tc-output {
  border-color: rgba(239,68,68,0.25);
  background: rgba(239,68,68,0.08);
  color: #fca5a5;
}
/* F027: Verbose mode toggle */
.meta-pill.meta-verbose {
  color: #a0d4ff;
  border-color: rgba(160,212,255,0.28);
  background: rgba(160,212,255,0.12);
  cursor: pointer;
  transition: opacity 0.2s, background 0.2s;
}
.meta-pill.meta-verbose:hover {
  background: rgba(160,212,255,0.22);
}
.meta-pill.meta-verbose.verbose-off {
  opacity: 0.5;
  color: var(--text-muted, #6b7280);
  border-color: rgba(107,114,128,0.28);
  background: rgba(107,114,128,0.08);
}
.tool-calls-hidden .tc-block { display: none !important; }
.tool-calls-hidden .tc-line { display: none !important; }

/* Hide old standalone row */
.tool-call-row { display: none; }

/* Background task log: tool call line marker */
.bg-tool-line {
  display: block;
}

/* Spinning gear on last tool call line in running bg tasks */
.bg-tool-spinning {
  display: inline-block;
  animation: toolSpin 2s linear infinite;
}

/* Legacy: keep for any remaining references */
.stream-tool-indicator { display: none; }
.tool-indicator-dot { display: none; }

/* Cron preview for schedule validation */
.sched-cron-preview {
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  background: rgba(62, 207, 142, 0.08);
  border: 1px solid rgba(62, 207, 142, 0.2);
  color: var(--text-secondary, #b0b8c4);
  transition: all 0.2s;
}
.sched-cron-preview.hidden { display: none; }
.sched-cron-preview.cron-ok {
  background: rgba(62, 207, 142, 0.1);
  border-color: rgba(62, 207, 142, 0.3);
}
.sched-cron-preview.cron-error {
  background: rgba(255, 171, 0, 0.08);
  border-color: rgba(255, 171, 0, 0.25);
}
.sched-cron-preview code {
  background: rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  color: var(--accent, #3ecf8e);
}
.sched-cron-preview small {
  color: var(--text-muted, #6b7280);
  font-size: 11px;
}
.cron-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(62, 207, 142, 0.15);
  color: var(--accent, #3ecf8e);
  margin-right: 4px;
}
.cron-badge.cron-warn {
  background: rgba(255, 171, 0, 0.15);
  color: #ffab00;
}
.cron-loading { color: var(--text-muted, #6b7280); font-style: italic; }
.cron-inline {
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  margin-left: 6px;
  color: var(--accent, #3ecf8e);
  font-family: 'Fira Code', 'Consolas', monospace;
}
.sched-cron-saved {
  margin-top: 4px;
  padding: 4px 8px;
  font-size: 12px;
  opacity: 0.8;
}
/* ============================================
   MOBILE RESPONSIVE FIXES — 2026-03-21
   ============================================ */

/* --- Logs panel mobile (768px) --- */
@media (max-width: 768px) {
  .logs-panel {
    bottom: 56px; /* above mobile tab bar */
    height: calc(100vh - 56px);
    z-index: 8000;
    background: rgb(9, 16, 24);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .logs-header {
    padding: 8px 10px;
    gap: 6px;
    flex-direction: column;
    align-items: stretch;
  }

  .logs-title {
    font-size: 0.85rem;
  }

  .logs-controls {
    gap: 6px;
    flex-wrap: wrap;
  }

  .logs-select {
    max-width: none;
    width: 100%;
    font-size: 0.8rem;
    padding: 8px 10px;
    min-height: 36px;
  }

  .logs-search-input {
    max-width: none;
    width: 100%;
    font-size: 0.8rem;
    padding: 8px 10px;
    min-height: 36px;
  }

  .logs-date-input {
    max-width: none;
    width: 100%;
    font-size: 0.8rem;
    padding: 6px 10px;
    min-height: 36px;
  }

  .logs-live-label {
    font-size: 0.8rem;
    padding: 4px 0;
  }

  .logs-output {
    padding: 8px 10px;
    font-size: 0.72rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .logs-close-btn,
  .logs-toggle-btn {
    min-width: 36px;
    min-height: 36px;
  }
}

/* --- Chat header meta pills — better wrapping on mobile --- */
@media (max-width: 768px) {
  .session-meta {
    gap: 3px;
    flex-wrap: wrap;
    max-width: calc(100vw - 120px);
    overflow: hidden;
  }

  /* Hide less important meta pills on narrow screens */

  .meta-pill {
    padding: 1px 6px;
    font-size: 9px;
    white-space: nowrap;
  }

  .chat-header-info {
    min-width: 0;
    overflow: hidden;
  }

  .chat-session-id {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* --- File viewer on mobile --- */
@media (max-width: 768px) {
  .file-viewer-panel {
    width: 100vw;
    bottom: 56px;
    background: rgb(9, 16, 24);
  }

}

/* --- Landscape mode on mobile --- */
@media (max-width: 768px) and (max-height: 500px) {
  .sidebar {
    bottom: 48px;
  }

  .main-panel,
  .background-panel,
  .scheduler-panel {
    bottom: 48px;
  }

  .mobile-tab-bar {
    height: 48px;
  }
}

/* --- 480px (small phones) extra fixes --- */
@media (max-width: 480px) {
  /* Background Tasks detail on small screens */
  .bg-detail-meta-label {
    font-size: 10px;
    min-width: 60px;
  }

  .bg-detail-meta-value {
    font-size: 12px;
  }

  .bg-detail-output {
    font-size: 10px;
    padding: 8px;
  }

  .bg-header {
    padding: 0 8px;
  }

  .bg-title {
    font-size: 14px;
  }

  /* Scheduler on small phones */
  .sched-header {
    padding: 6px 8px;
    gap: 4px;
  }

  .sched-title {
    font-size: 14px;
  }

  .sched-job-card {
    margin: 4px;
    padding: 8px;
  }

  /* Logs on small phones */
  .logs-output {
    font-size: 0.68rem;
    padding: 6px 8px;
  }

  .logs-header {
    padding: 6px 8px;
    gap: 4px;
  }

  /* Meta pills */
  .session-meta {
    max-width: calc(100vw - 100px);
  }

  .meta-runtime {
    display: none;
  }
}

/* --- Background Task detail tabs on mobile --- */
@media (max-width: 768px) {
  .bg-detail-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    padding: 0 8px;
  }

  .bg-tab {
    font-size: 12px;
    padding: 8px 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Ensure bg-detail body scrolls properly */
  .bg-detail-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px;
  }

  /* Background Task detail actions on mobile */
  .bg-detail-actions {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 6px;
    position: sticky;
    bottom: 0;
    background: rgb(9, 16, 24);
  }
}

/* --- Canvas panel on mobile --- */
@media (max-width: 768px) {
  .canvas-panel {
    width: 100vw;
    bottom: 56px;
    visibility: hidden;
  }

  .canvas-panel.canvas-open {
    visibility: visible;
  }

  .canvas-edge-tab {
    display: none;
  }
}

/* --- Fix bg-detail-split bleed-through on mobile --- */
@media (max-width: 768px) {
  .bg-detail.glass-panel {
    background: rgb(14, 22, 20) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .bg-detail-split {
    flex-direction: column !important;
  }
  .bg-detail-left {
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .bg-detail-right {
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    border-left: none !important;
    border-top: 1px solid var(--glass-border);
  }
}

/* --- Mobile: Force all panels fully opaque, no bleed-through --- */
@media (max-width: 768px) {
  .background-panel {
    overflow: hidden !important;
  }
  .background-panel .bg-detail {
    background: rgb(14, 22, 20) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: hidden !important;
  }
  .background-panel .glass-panel,
  .scheduler-panel .glass-panel {
    background: rgb(14, 22, 20) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}


/* ── Session Permissions Pill ──────────────────────────────────────────────── */
.meta-permissions {
  cursor: pointer;
  font-size: 0.72rem;
  transition: background 0.2s, color 0.2s;
}
.meta-permissions.perm-elevated {
  background: rgba(255, 165, 0, 0.25);
  color: #ffb347;
  border-color: rgba(255, 165, 0, 0.4);
}
.meta-permissions.perm-sandboxed {
  background: rgba(100, 149, 237, 0.25);
  color: #87CEFA;
  border-color: rgba(100, 149, 237, 0.4);
}

/* ── .env Editor ───────────────────────────────────────────────────────────── */
.asf-env-editor-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.asf-env-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}
.asf-env-textarea {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  min-height: 200px;
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
  tab-size: 4;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  color: #e0e0e0;
}
.asf-env-textarea:focus {
  border-color: rgba(16, 185, 129, 0.5);
  outline: none;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}
.asf-env-status {
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 6px;
  transition: opacity 0.3s;
}
.asf-env-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.asf-env-error {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.asf-env-warning {
  font-size: 0.75rem;
  color: #fbbf24;
  opacity: 0.8;
  margin: 0;
}
.asf-btn-restart {
  margin-left: auto;
}

/* ── Skills Panel (pushover, mirrors Canvas panel) ──────────────────────── */

.skills-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 50vw;
  height: 100vh;
  z-index: 199;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: row;
}

.skills-panel.skills-open {
  transform: translateX(0);
}

.skills-panel.skills-hidden {
  transform: translateX(100%);
}

.skills-edge-tab {
  position: absolute;
  left: -36px;
  top: calc(50% - 32px);
  transform: translateY(-50%);
  width: 36px;
  height: 64px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-right: none;
  border-radius: 10px 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s, width 0.2s;
  z-index: 200;
}

.skills-edge-tab:hover {
  background: rgba(255,255,255,0.1);
  width: 42px;
  left: -42px;
}

.skills-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(10, 14, 26, 0.97);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: 1px solid var(--glass-border);
  overflow: hidden;
}

.skills-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--glass-border);
}

.skills-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.skills-header-actions {
  display: flex;
  gap: 6px;
}

.skills-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.skills-search-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm, 6px);
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

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

.skills-search-input:focus {
  border-color: var(--accent);
}

.skills-filter-select {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm, 6px);
  padding: 6px 8px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.skills-filter-select option {
  background: #1a1e2e;
}

.skills-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px;
}

.skills-list::-webkit-scrollbar { width: 6px; }
.skills-list::-webkit-scrollbar-track { background: transparent; }
.skills-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.skills-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  text-align: center;
  color: var(--text-muted);
}

/* ── Skill card ─────────────────────────────────────────────────────────── */

.skill-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.skill-card:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(62,207,142,0.3);
}

.skill-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.skill-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.skill-card-badges {
  display: flex;
  gap: 4px;
  align-items: center;
}

.skill-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.skill-badge-git {
  background: rgba(62,207,142,0.15);
  color: var(--accent);
}

.skill-badge-website {
  background: rgba(245,197,66,0.15);
  color: var(--gold);
}

.skill-badge-local {
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}

.skill-badge-unknown {
  background: rgba(255,95,109,0.12);
  color: var(--danger);
  border: 1px dashed rgba(255,95,109,0.3);
}

.skill-badge-update {
  background: rgba(62,207,142,0.2);
  color: var(--accent);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(62,207,142,0); }
  50% { box-shadow: 0 0 6px 2px rgba(62,207,142,0.25); }
}

.skill-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skill-card-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.skill-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* ── Skill detail panel ─────────────────────────────────────────────────── */

.skills-detail {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 14, 26, 0.98);
  display: flex;
  flex-direction: column;
  z-index: 5;
}

.skills-detail.hidden {
  display: none;
}

.skills-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--glass-border);
}

.skills-detail-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.skills-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.skills-detail-body::-webkit-scrollbar { width: 6px; }
.skills-detail-body::-webkit-scrollbar-track { background: transparent; }
.skills-detail-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.skill-detail-section {
  margin-bottom: 18px;
}

.skill-detail-section h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.skill-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}

.skill-detail-row .label {
  color: var(--text-secondary);
}

.skill-detail-row .value {
  color: var(--text-primary);
  text-align: right;
  max-width: 60%;
  word-break: break-all;
}

.skill-detail-row .value a {
  color: var(--accent);
  text-decoration: none;
}

.skill-detail-row .value a:hover {
  text-decoration: underline;
}

/* ── Origin form ────────────────────────────────────────────────────────── */

.skill-origin-form {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 14px;
}

.skill-origin-form label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
  margin-top: 10px;
}

.skill-origin-form label:first-child {
  margin-top: 0;
}

.skill-origin-form input,
.skill-origin-form select,
.skill-origin-form textarea {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm, 6px);
  padding: 7px 10px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.skill-origin-form select option {
  background: #1a1e2e;
}

.skill-origin-form input:focus,
.skill-origin-form select:focus,
.skill-origin-form textarea:focus {
  border-color: var(--accent);
}

.skill-origin-form textarea {
  resize: vertical;
  min-height: 50px;
  font-family: inherit;
}

.skill-origin-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.btn-skill-action {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-skill-action:active {
  transform: scale(0.97);
}

.btn-skill-primary {
  background: var(--accent);
  color: #0a0e1a;
}

.btn-skill-primary:hover {
  background: var(--accent-hover);
}

.btn-skill-danger {
  background: rgba(255,95,109,0.15);
  color: var(--danger);
}

.btn-skill-danger:hover {
  background: rgba(255,95,109,0.25);
}

.btn-skill-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

.btn-skill-secondary:hover {
  background: rgba(255,255,255,0.12);
}

.btn-skill-update {
  background: rgba(62,207,142,0.15);
  color: var(--accent);
  border: 1px solid rgba(62,207,142,0.3);
}

.btn-skill-update:hover {
  background: rgba(62,207,142,0.25);
}

/* Status indicators */
.skill-status-checking { color: var(--gold); }
.skill-status-updating { color: var(--accent); }
.skill-status-error    { color: var(--danger); }
.skill-status-success  { color: var(--accent); }

/* Toast notification for skill actions */
.skill-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 300;
  animation: slide-up-fade 0.3s ease;
  max-width: 400px;
}

.skill-toast-success {
  background: rgba(62,207,142,0.2);
  color: var(--accent);
  border: 1px solid rgba(62,207,142,0.3);
}

.skill-toast-error {
  background: rgba(255,95,109,0.2);
  color: var(--danger);
  border: 1px solid rgba(255,95,109,0.3);
}

.skill-toast-info {
  background: rgba(245,197,66,0.2);
  color: var(--gold);
  border: 1px solid rgba(245,197,66,0.3);
}

@keyframes slide-up-fade {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Responsive: mobile */
@media (max-width: 768px) {
  .skills-panel { width: 100vw; }
  .skills-edge-tab { display: none; }
}


/* ── Agents Panel (mirrors Canvas/Skills panels) ─────────────────────────── */



/* ─── Text-to-Speech Button ────────────────────────────────────────────────── */
.tts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary, #8b95a5);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.15s ease;
  float: right;
  clear: both;
}

.message-bubble:hover .tts-btn,
.tts-btn.tts-loading,
.tts-btn.tts-playing {
  opacity: 1;
}

.tts-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.1);
}

.tts-btn.tts-loading {
  animation: tts-pulse 1s ease-in-out infinite;
  pointer-events: none;
}

.tts-btn.tts-playing {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.tts-btn.tts-playing:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

@keyframes tts-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ── F017: In-thread BG task completion banner ── */
.bg-task-banner {
  text-align: center;
  font-size: 13px;
  padding: 8px 16px;
  margin: 8px auto;
  max-width: 85%;
  border-radius: 8px;
  line-height: 1.5;
}
.bg-task-banner.bg-task-ok {
  color: #3ecf8e;
  background: rgba(62, 207, 142, 0.08);
  border: 1px solid rgba(62, 207, 142, 0.2);
}
.bg-task-banner.bg-task-fail {
  color: #e53935;
  background: rgba(229, 57, 53, 0.08);
  border: 1px solid rgba(229, 57, 53, 0.2);
}
.bg-task-banner-id {
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  font-size: 12px;
}
.bg-task-banner-agent {
  opacity: 0.7;
}
.bg-task-banner-summary {
  opacity: 0.85;
  font-style: italic;
}


/* ═══════════════════════════════════════════════════════════════════════════
   Keyring Status Banner & Unlock Dialog (Issue #93)
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- Keyring status banner --- */
.keyring-banner {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 10px;
  margin: 0 16px 12px;
  font-size: 13px;
  animation: keyring-slide-in 0.3s ease;
}
@keyframes keyring-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.keyring-banner--locked {
  background: rgba(255, 165, 0, 0.12);
  border: 1px solid rgba(255, 165, 0, 0.3);
  color: var(--text-primary, #e0e0e0);
}
.keyring-banner--warn {
  background: rgba(255, 200, 50, 0.08);
  border: 1px solid rgba(255, 200, 50, 0.2);
  color: var(--text-secondary, #aaa);
}
.keyring-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.keyring-banner-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.keyring-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.keyring-banner-text strong {
  font-weight: 600;
  font-size: 13px;
}
.keyring-banner-text span {
  font-size: 12px;
  opacity: 0.8;
}
.keyring-unlock-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* --- Keyring unlock dialog overlay --- */
.keyring-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: keyring-fade-in 0.2s ease;
}
@keyframes keyring-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- Keyring unlock dialog panel --- */
.keyring-dialog {
  width: min(420px, 90vw);
  padding: 28px 24px 24px;
  border-radius: 16px;
  animation: keyring-dialog-pop 0.25s ease;
}
@keyframes keyring-dialog-pop {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.keyring-dialog-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.keyring-dialog-icon {
  font-size: 24px;
}
.keyring-dialog-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary, #fff);
}
.keyring-dialog-hint {
  font-size: 13px;
  color: var(--text-secondary, #aaa);
  margin: 0 0 16px;
  line-height: 1.4;
}
.keyring-dialog-field {
  margin-bottom: 12px;
}
.keyring-dialog-field input {
  width: 100%;
  box-sizing: border-box;
}
.keyring-dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.keyring-dialog-actions .btn {
  flex: 1;
}
.keyring-dialog-alt {
  font-size: 11px;
  color: var(--text-muted, #777);
  margin: 14px 0 0;
  text-align: center;
}
.keyring-dialog-alt code {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 5px;
  border-radius: 4px;
}

/* --- Keyring feedback messages --- */
.keyring-dialog-feedback {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  line-height: 1.4;
}
.keyring-dialog-feedback--error {
  background: rgba(255, 80, 80, 0.12);
  color: #ff6b6b;
  border: 1px solid rgba(255, 80, 80, 0.2);
}
.keyring-dialog-feedback--success {
  background: rgba(80, 200, 120, 0.12);
  color: #50c878;
  border: 1px solid rgba(80, 200, 120, 0.2);
}
.keyring-dialog-feedback--info {
  background: rgba(80, 160, 255, 0.12);
  color: #6cb4ff;
  border: 1px solid rgba(80, 160, 255, 0.2);
}

/* ── Service Status Section ──────────────────────────────────────────── */
.service-status-section {
  display: flex;
  flex-direction: column;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  gap: 6px;
}

.request-queue-panel.queue-minimized .service-status-section {
  display: none;
}

.service-status-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.service-status-icon {
  font-size: 13px;
}

.service-status-label {
  color: var(--text-primary);
  flex: 1;
}

.btn-refresh-status {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.2s, transform 0.3s;
  border-radius: 4px;
}

.btn-refresh-status:hover {
  color: var(--accent);
  background: rgba(255,255,255,0.06);
}

.btn-refresh-status.spinning {
  transform: rotate(360deg);
  transition: transform 0.5s linear;
}

.service-status-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.service-status-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}

.service-name {
  flex: 1;
  color: var(--text-secondary);
  font-size: 11px;
}

.service-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-loading { background: var(--text-muted); opacity: 0.5; }
.dot-active  { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.6); }
.dot-inactive{ background: #f87171; box-shadow: 0 0 6px rgba(248,113,113,0.6); }
.dot-failed  { background: #fb923c; box-shadow: 0 0 6px rgba(251,146,60,0.6); }
.dot-unknown { background: var(--text-muted); }

.service-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-loading  { background: rgba(255,255,255,0.08); color: var(--text-muted); }
.badge-active   { background: rgba(74,222,128,0.15);  color: #4ade80; }
.badge-inactive { background: rgba(248,113,113,0.15); color: #f87171; }
.badge-failed   { background: rgba(251,146,60,0.15);  color: #fb923c; }
.badge-unknown  { background: rgba(255,255,255,0.08); color: var(--text-muted); }

.service-status-footer {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Mobile Bot Token Settings ──────────────────────────────────────────── */
.asf-mobile-bots-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.asf-info-banner {
  background: rgba(96,165,250,0.12);
  border: 1px solid rgba(96,165,250,0.3);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.asf-bot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.asf-bot-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.asf-bot-icon { font-size: 16px; }
.asf-bot-name { font-weight: 500; }
.asf-bot-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.asf-bot-badge--configured {
  background: rgba(74,222,128,0.15);
  color: #4ade80;
}
.asf-bot-badge--unconfigured {
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
}
.asf-bot-token-form {
  margin-top: 8px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
}
.asf-bot-token-input {
  width: 100%;
  margin-bottom: 8px;
  font-family: monospace;
  font-size: 12px;
}
.asf-bot-form-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.asf-bot-form-status {
  margin-top: 6px;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
}
.asf-bot-form-status--ok    { color: #4ade80; background: rgba(74,222,128,0.1); }
.asf-bot-form-status--error { color: #f87171; background: rgba(248,113,113,0.1); }

/* ── Kanban Card Detail Modal ─────────────────────────────────────────────── */

.kanban-card-clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.kanban-card-clickable:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.kanban-detail-modal-box {
  width: min(760px, 94vw);
  max-height: 88vh;
}

.kanban-detail-loading,
.kanban-detail-error {
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
}
.kanban-detail-error { color: var(--danger, #e74c3c); }

.kanban-detail-summary {
  padding: 12px 14px;
  margin-bottom: 12px;
}
.kanban-detail-summary-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.kanban-detail-link {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
}
.kanban-detail-link:hover { text-decoration: underline; }

.kanban-detail-status-msg {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--accent);
}
.kanban-detail-status-error { color: var(--danger, #e74c3c); }

.kanban-detail-section {
  padding: 14px;
  margin-bottom: 12px;
}
.kanban-detail-section h4 {
  margin: 0 0 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.kanban-detail-input,
.kanban-detail-select,
.kanban-detail-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius, 8px);
  background: rgba(0,0,0,0.25);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  margin-bottom: 8px;
  box-sizing: border-box;
}
.kanban-detail-input:focus,
.kanban-detail-select:focus,
.kanban-detail-textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.kanban-detail-textarea {
  resize: vertical;
  min-height: 60px;
}

.kanban-detail-section label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.kanban-detail-row {
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
}
.kanban-detail-field {
  flex: 1;
  min-width: 0;
}

.kanban-detail-btn {
  padding: 7px 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius, 8px);
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.kanban-detail-btn:hover { background: rgba(255,255,255,0.12); }
.kanban-detail-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.kanban-detail-btn-primary:hover { opacity: 0.85; }
.kanban-detail-btn-success {
  border-color: var(--success, #2ecc71);
  color: var(--success, #2ecc71);
}
.kanban-detail-btn-danger {
  border-color: var(--danger, #e74c3c);
  color: var(--danger, #e74c3c);
}

.kanban-detail-actions {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
}

.kanban-detail-comment {
  padding: 10px;
  margin-bottom: 8px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius, 8px);
}
.kanban-detail-comment-author {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.kanban-detail-comment p {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.modal-close-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

/* ── Kanban Filter Toolbar ────────────────────────────────────────────────── */

.kanban-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  margin: 0 0 10px;
  gap: 10px;
  flex-wrap: wrap;
}

.kanban-filters-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.kanban-filters-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-filters-icon {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.kanban-filters-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.kanban-filter-select {
  padding: 5px 10px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius, 8px);
  background: rgba(0,0,0,0.25);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  min-width: 120px;
}
.kanban-filter-select:focus {
  outline: none;
  border-color: var(--accent);
}

.kanban-filter-checkbox {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}
.kanban-filter-checkbox input {
  accent-color: var(--accent);
}

.kanban-filter-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.08);
  padding: 2px 8px;
  border-radius: 10px;
}

@media (max-width: 640px) {
  .kanban-filters {
    flex-direction: column;
    align-items: flex-start;
  }
  .kanban-filter-select {
    min-width: 100px;
  }
}

/* ── Kanban Custom Date Range Filter ──────────────────────────────────────── */

.kanban-custom-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
}
.kanban-custom-date-range.hidden { display: none; }

.kanban-date-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.kanban-filter-date {
  padding: 4px 8px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius, 8px);
  background: rgba(0,0,0,0.25);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
}
.kanban-filter-date:focus {
  outline: none;
  border-color: var(--accent);
}
