/* static/style.css — GWS Agent Web (chatbot UI redesign) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --bg:        #0d0f14;
  --surface:   #151820;
  --surface2:  #1c2030;
  --surface3:  #232840;
  --border:    #2a3050;
  --border2:   #374060;

  --text:      #e8eaf2;
  --text-muted:#8890b0;
  --text-dim:  #555f80;

  --accent:    #5b6ef5;
  --accent-h:  #7080ff;
  --accent-glow: rgba(91,110,245,.22);

  --green:     #3dd68c;
  --green-bg:  rgba(61,214,140,.12);
  --blue:      #4da6ff;
  --blue-bg:   rgba(77,166,255,.12);
  --yellow:    #f5c518;
  --yellow-bg: rgba(245,197,24,.12);
  --red:       #ff5f6d;
  --red-bg:    rgba(255,95,109,.12);
  --grey:      #8890b0;
  --grey-bg:   rgba(136,144,176,.10);

  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
  --transition: 180ms ease;

  --topbar-h:  52px;
  --sidebar-w: 260px;
  --right-w:   320px;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}

/* ── App shell ──────────────────────────────────────────────────────────── */
#app {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Top bar ────────────────────────────────────────────────────────────── */
#topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 40;
  flex-shrink: 0;
}

.logo {
  font-weight: 700;
  font-size: 15px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  margin-right: 4px;
}

/* Topbar nav icon buttons */
.btn-nav-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.btn-nav-icon:hover { background: var(--surface2); color: var(--text); }

/* ── Workspace switcher ─────────────────────────────────────────────────── */
.ws-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.ws-switch-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  max-width: 220px;
  font-family: 'Inter', sans-serif;
}
.ws-switch-btn:hover { border-color: var(--accent); background: var(--surface3); }
.ws-switch-btn.open { border-color: var(--accent); }
#ws-switch-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  color: var(--text-muted);
}
#ws-switch-name.has-ws { color: var(--text); }
.ws-chevron {
  color: var(--text-dim);
  flex-shrink: 0;
  transition: transform var(--transition);
}
.ws-switch-btn.open .ws-chevron { transform: rotate(180deg); }

/* Auth badge */
#auth-badge {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  white-space: nowrap;
  cursor: default;
  flex-shrink: 0;
}
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--grey);
  flex-shrink: 0;
  transition: background var(--transition);
}
#auth-badge.ok   .dot { background: var(--green); }
#auth-badge.warn .dot { background: var(--yellow); }
#auth-badge.ok   { border-color: rgba(61,214,140,.35); }

/* ── Workspace dropdown ─────────────────────────────────────────────────── */
.ws-dropdown {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: 280px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 200;
  display: none;
  overflow: hidden;
  animation: slideDown .15s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } }
.ws-dropdown.open { display: block; }

.ws-dropdown-header {
  padding: 10px 16px 6px;
  border-bottom: 1px solid var(--border);
}
.ws-dropdown-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.ws-dropdown-list { padding: 6px; max-height: 300px; overflow-y: auto; }
.ws-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.ws-dropdown-item:hover { background: var(--surface3); }
.ws-dropdown-item.active { background: var(--accent-glow); }
.ws-dropdown-item .ws-item-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-dropdown-item .ws-item-delete {
  opacity: 0;
  background: none;
  border: none;
  color: var(--red);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  transition: opacity var(--transition), background var(--transition);
  line-height: 1;
}
.ws-dropdown-item:hover .ws-item-delete { opacity: 1; }
.ws-dropdown-item .ws-item-delete:hover { background: var(--red-bg); }
.ws-dropdown-footer {
  padding: 6px;
  border-top: 1px solid var(--border);
}
.ws-dropdown-new-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-family: 'Inter', sans-serif;
}
.ws-dropdown-new-btn:hover { background: var(--accent-glow); color: var(--accent); }

/* ── Main grid ──────────────────────────────────────────────────────────── */
#main-grid {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr 0px;
  grid-template-rows: 1fr;
  overflow: hidden;
  position: relative;
  transition: grid-template-columns .2s ease;
}
#main-grid.sidebar-collapsed {
  grid-template-columns: 0px 1fr 0px;
}
#main-grid.right-open {
  grid-template-columns: var(--sidebar-w) 1fr var(--right-w);
}
#main-grid.sidebar-collapsed.right-open {
  grid-template-columns: 0px 1fr var(--right-w);
}

/* ── Left sidebar ───────────────────────────────────────────────────────── */
.sidebar-left {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: width .2s ease;
  min-width: 0;
}
.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  min-width: var(--sidebar-w);
}
.sidebar-inner::-webkit-scrollbar { width: 4px; }
.sidebar-inner::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* New chat button */
.btn-new-chat {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  font-family: 'Inter', sans-serif;
  margin-bottom: 6px;
}
.btn-new-chat:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.btn-new-chat:disabled { opacity: .45; cursor: not-allowed; }

/* Auth warning in sidebar */
#auth-warning {
  display: none;
  align-items: flex-start;
  gap: 7px;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: var(--yellow-bg);
  border: 1px solid rgba(245,197,24,.25);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--yellow);
  line-height: 1.5;
  flex-shrink: 0;
}
#auth-warning svg { flex-shrink: 0; margin-top: 2px; }
#auth-warning.show { display: flex; }

/* Sidebar section label */
.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 10px 4px;
}

/* History groups */
.history-groups { display: flex; flex-direction: column; gap: 0; flex: 1; }
.history-date-group { display: flex; flex-direction: column; gap: 1px; margin-bottom: 4px; }
.history-date-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 10px 3px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  color: var(--text-muted);
  font-size: 12.5px;
}
.history-item:hover { background: var(--surface2); color: var(--text); }
.history-item.active { background: var(--accent-glow); color: var(--accent); }
.history-item-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-status {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  flex-shrink: 0;
}
.history-item-status.completed { background: var(--green-bg); color: var(--green); }
.history-item-status.error { background: var(--red-bg); color: var(--red); }
.history-item-status.running { background: var(--blue-bg); color: var(--blue); }

/* Sidebar sections (scheduled tasks, etc.) */
.sidebar-section { margin-top: 4px; flex-shrink: 0; }
.sidebar-section-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-family: 'Inter', sans-serif;
}
.sidebar-section-header:hover { background: var(--surface2); color: var(--text); }
.sidebar-section-header span { flex: 1; text-align: left; }
.section-chevron { flex-shrink: 0; transition: transform var(--transition); }
.sidebar-section-header[aria-expanded="true"] .section-chevron { transform: rotate(180deg); }
.sidebar-section-body { padding: 2px 4px 4px; display: flex; flex-direction: column; gap: 1px; }
.sidebar-task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
}
.sidebar-task-name { flex: 1; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-task-run {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 10px;
  padding: 1px 6px;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-task-run:hover { border-color: var(--green); color: var(--green); }

/* Sidebar bottom */
.sidebar-bottom {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-settings-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-family: 'Inter', sans-serif;
}
.sidebar-settings-btn:hover:not(:disabled) { background: var(--surface2); color: var(--text); }
.sidebar-settings-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Chat center panel ──────────────────────────────────────────────────── */
#chat-main {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  position: relative;
  min-width: 0;
}

/* Welcome state */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 14px;
  padding: 40px;
  text-align: center;
}
.welcome-icon {
  font-size: 52px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
.welcome-title { font-size: 22px; font-weight: 600; color: var(--text); }
.welcome-sub { font-size: 14px; color: var(--text-muted); max-width: 320px; }
.btn-welcome-new {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  margin-top: 4px;
  font-family: 'Inter', sans-serif;
}
.btn-welcome-new:hover { opacity: .9; transform: translateY(-1px); }

/* Chat messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 0 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Message group */
.msg-group {
  display: flex;
  gap: 12px;
  padding: 6px 24px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  animation: msgIn .18s ease;
}
@keyframes msgIn { from { opacity:0; transform:translateY(6px); } }

.msg-group.user { justify-content: flex-end; }
.msg-group.agent { justify-content: flex-start; }

/* Agent avatar */
.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 4px;
  color: #fff;
  font-weight: 700;
}

.msg-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 75%;
}
.msg-group.user .msg-content { max-width: 72%; align-items: flex-end; }

/* Message bubble */
.msg-bubble {
  padding: 11px 15px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
}
.msg-group.user .msg-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: var(--radius-sm);
}
.msg-group.agent .msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-top-left-radius: var(--radius-sm);
}

/* Thinking block (inside agent bubble area) */
.thinking-block {
  border: 1px solid rgba(167,139,250,.22);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 12px;
  max-width: 100%;
}
.thinking-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  background: rgba(167,139,250,.08);
  cursor: pointer;
  user-select: none;
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 500;
  transition: background var(--transition);
}
.thinking-header:hover { background: rgba(167,139,250,.14); }
.thinking-label { flex: 1; }
.thinking-chevron { font-size: 10px; transition: transform var(--transition); color: rgba(196,181,253,.6); }
.thinking-block.collapsed .thinking-chevron { transform: rotate(-90deg); }
.thinking-body {
  padding: 8px 12px;
  background: rgba(167,139,250,.04);
  color: #d0c4f7;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}
.thinking-block.collapsed .thinking-body { display: none; }

/* Tool call group (inside agent message area) */
.tool-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 12px;
}
.tool-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface2);
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-align: left;
  font-family: 'Inter', sans-serif;
}
.tool-group-toggle:hover { background: var(--surface3); color: var(--text); }
.tool-group-toggle svg { flex-shrink: 0; transition: transform var(--transition); }
.tool-group.expanded .tool-group-toggle svg { transform: rotate(90deg); }
.tool-group-body {
  display: none;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  max-height: 240px;
  overflow-y: auto;
}
.tool-group.expanded .tool-group-body { display: flex; }
.tool-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 10px;
  border-top: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
}
.tool-item-time { color: var(--text-dim); font-size: 10px; flex-shrink: 0; min-width: 50px; padding-top: 1px; }
.tool-item-name {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--blue-bg);
  color: var(--blue);
  align-self: flex-start;
}
.tool-item-content { flex: 1; color: var(--text); }

/* Agent markdown response area */
.agent-response {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  word-break: break-word;
}
.agent-response h1,.agent-response h2,.agent-response h3,.agent-response h4 {
  color: var(--text); font-weight: 600; margin: .9em 0 .35em; line-height: 1.3;
}
.agent-response h1 { font-size: 1.2em; }
.agent-response h2 { font-size: 1.05em; border-bottom: 1px solid var(--border); padding-bottom: .3em; }
.agent-response h3 { font-size: 1em; }
.agent-response h4 { font-size: .9em; color: var(--text-muted); }
.agent-response p { margin: .4em 0; }
.agent-response strong { font-weight: 600; }
.agent-response em { font-style: italic; color: var(--text-muted); }
.agent-response a { color: var(--accent); text-decoration: none; }
.agent-response a:hover { text-decoration: underline; }
.agent-response ul,.agent-response ol { padding-left: 1.4em; margin: .35em 0; }
.agent-response li { margin: .15em 0; }
.agent-response code {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; color: var(--blue);
}
.agent-response pre {
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; overflow-x: auto; margin: .5em 0;
}
.agent-response pre code { background: none; border: none; padding: 0; color: var(--text); font-size: 12px; }
.agent-response blockquote {
  margin: .5em 0; padding: .4em .8em;
  border-left: 3px solid var(--accent);
  background: var(--accent-glow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}
.agent-response hr { border: none; border-top: 1px solid var(--border); margin: .8em 0; }
.agent-response table { width: 100%; border-collapse: collapse; font-size: 13px; margin: .5em 0; }
.agent-response th {
  background: var(--surface3); color: var(--text-muted);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 6px 10px; border: 1px solid var(--border); text-align: left;
}
.agent-response td { padding: 5px 10px; border: 1px solid var(--border); vertical-align: top; word-break: break-word; }
.agent-response tr:nth-child(even) td { background: rgba(255,255,255,.02); }

/* Summary card (inside agent message) */
.agent-summary {
  margin-top: 4px;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--green);
}
.agent-summary-title { font-size: 11px; font-weight: 600; color: var(--green); margin-bottom: 6px; }
.agent-summary-text { font-size: 13px; color: var(--text-muted); white-space: pre-wrap; word-break: break-word; }
.agent-summary-actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.action-tag {
  font-size: 11px; padding: 2px 8px;
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text-muted);
}

/* Context indicator shown in input bar when there are prior turns */
.chat-context-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--accent-glow);
  border: 1px solid rgba(91,110,245,.3);
  border-radius: 999px;
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 6px;
  width: fit-content;
}

/* Cancelled notice inside agent bubble */
.msg-cancelled {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding: 4px 10px;
  background: var(--grey-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-dim);
}

/* Stop button state — btn-send.running shows red square */
.btn-send.running {
  background: var(--red);
}
.btn-send.running .send-icon {
  display: none;
}
.btn-send.running::after {
  content: '';
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 2px;
  position: absolute;
}
.btn-send.running .send-spinner {
  display: none !important;   /* show square, not spinner */
}

/* Status in history view messages */
.msg-status-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  padding: 0 2px;
}

/* ── Chat input bar ──────────────────────────────────────────────────────── */
.chat-input-bar {
  flex-shrink: 0;
  padding: 8px 24px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  align-self: stretch;
}
/* Full width override so the bar always spans the full center column */
#chat-main .chat-input-bar { max-width: none; padding: 8px 24px 16px; }

.chat-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.chat-examples.hidden { display: none; }
.example-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}
.example-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px 6px 6px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.chat-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
#chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 4px 0;
}
#chat-input::placeholder { color: var(--text-dim); }
.btn-send {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity var(--transition), transform var(--transition);
  position: relative;
}
.btn-send:hover:not(:disabled) { opacity: .88; transform: scale(1.04); }
.btn-send:disabled { opacity: .35; cursor: not-allowed; }
.btn-send.running { background: var(--red); }
.send-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  display: none;
  position: absolute;
}
.btn-send.running .send-spinner { display: block; }
.btn-send.running .send-icon { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Right sidebar (file manager) ───────────────────────────────────────── */
.sidebar-right {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow: hidden;
  min-width: 0;
  transition: width .2s ease;
}
.sidebar-right-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: var(--right-w);
  overflow: hidden;
}
.sidebar-right-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}
.sidebar-right-header span { flex: 1; }
.btn-icon-sm {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition);
  text-decoration: none;
  flex-shrink: 0;
}
.btn-icon-sm:hover { border-color: var(--border); color: var(--text); background: var(--surface2); }

/* File tree */
.file-tree {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  min-height: 0;
}
.file-tree::-webkit-scrollbar { width: 4px; }
.file-tree::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.file-tree-empty { font-size: 12px; color: var(--text-dim); padding: 12px 10px; text-align: center; }
.file-tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-tree-item:hover { background: var(--surface2); color: var(--text); }
.file-tree-item.active { background: var(--accent-glow); color: var(--accent); }
.file-tree-item.is-dir { color: var(--blue); font-weight: 500; cursor: default; }
.file-tree-item svg { flex-shrink: 0; }
.file-tree-name { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.file-tree-size { font-size: 10px; color: var(--text-dim); flex-shrink: 0; }

/* File viewer */
.file-viewer {
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: 50%;
  min-height: 120px;
  flex-shrink: 0;
}
.file-viewer-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.file-viewer-name {
  flex: 1;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'JetBrains Mono', monospace;
}
.file-viewer-content {
  flex: 1;
  overflow: auto;
  padding: 10px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  margin: 0;
  background: var(--bg);
}

/* Right panel toggle button (tab on the right edge) */
.btn-right-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 60px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  z-index: 10;
}
.btn-right-toggle:hover { background: var(--surface2); color: var(--accent); }
#main-grid.right-open .btn-right-toggle { display: none; }

/* ── Settings drawer ────────────────────────────────────────────────────── */
.settings-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  /* Start after the left sidebar so the drawer covers only the center+right area */
  left: var(--sidebar-w);
  right: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(3px);
  z-index: 150;
  display: none;
  align-items: stretch;
  justify-content: flex-end;
}
.settings-overlay.open { display: flex; }
/* When sidebar is collapsed, the overlay covers the full viewport width */
.settings-overlay.sidebar-collapsed {
  left: 0;
}

.settings-drawer {
  width: 100%;
  max-width: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  animation: drawerIn .2s ease;
  overflow: hidden;
}
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } }

.settings-drawer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface2);
}
.settings-drawer-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Settings tab bar */
.stab-bar {
  display: flex;
  gap: 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}
.stab-bar::-webkit-scrollbar { display: none; }
.stab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 9px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}
.stab:hover { color: var(--text); }
.stab.active { color: var(--accent); border-bottom-color: var(--accent); }

.settings-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.stab-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  overflow-y: auto;
  height: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.stab-panel::-webkit-scrollbar { width: 4px; }
.stab-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.stab-panel.active { display: flex; }

/* SKILL editor */
#skill-editor {
  flex: 1;
  min-height: 260px;
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.65;
  padding: 12px 14px;
  outline: none;
  resize: vertical;
  transition: border-color var(--transition);
}
#skill-editor:focus { border-color: var(--accent); }
#skill-editor::placeholder { color: var(--text-dim); }

/* ── Config form components ─────────────────────────────────────────────── */
.config-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.field-row { display: flex; flex-direction: column; gap: 4px; }
.field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.field-hint { font-size: 11px; color: var(--text-dim); line-height: 1.5; }
.config-section input[type="text"],
.config-section input[type="email"],
.config-section input[type="url"],
.config-section textarea,
.config-section select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  padding: 8px 10px;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}
.config-section input:focus,
.config-section textarea:focus,
.config-section select:focus { border-color: var(--accent); }
.config-section textarea { resize: vertical; min-height: 56px; }
.config-section select { cursor: pointer; }

.toggle-row { flex-direction: row !important; align-items: center; justify-content: space-between; }
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border2);
  border-radius: 999px;
  transition: background var(--transition);
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

.btn-save { align-self: flex-start; margin-top: 4px; }
.add-row { display: flex; gap: 6px; flex-wrap: wrap; }
.add-row input, .add-row select {
  flex: 1; min-width: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  font-family: 'Inter', sans-serif;
  transition: border-color var(--transition);
}
.add-row input:focus, .add-row select:focus { border-color: var(--accent); }
.btn-add {
  padding: 7px 12px;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}
.btn-add:hover { background: var(--accent); color: #fff; }

.id-list, .refs-list, .mcps-list, .tasks-list { display: flex; flex-direction: column; gap: 4px; }
.id-row, .ref-row, .mcp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.id-value { font-family: 'JetBrains Mono', monospace; color: var(--text); flex: 1; word-break: break-all; }
.id-label { color: var(--text-muted); font-size: 11px; }
.id-remove {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 13px; padding: 2px 5px;
  border-radius: 4px; line-height: 1; flex-shrink: 0;
  transition: all var(--transition);
}
.id-remove:hover { background: var(--red-bg); color: var(--red); }

/* Members */
.member-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.member-row {
  display: grid;
  grid-template-columns: 30px 1fr auto auto 28px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.member-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.member-email { font-size: 13px; font-weight: 500; }
.member-email em { color: var(--text-dim); font-style: normal; font-size: 11px; }
.member-name { font-size: 11px; color: var(--text-muted); }
.badge-role-manager { background: rgba(167,139,250,.18); color: #c4b5fd; font-size: 10px; padding: 2px 7px; border-radius: 999px; }
.badge-role-member  { background: var(--grey-bg); color: var(--grey); font-size: 10px; padding: 2px 7px; border-radius: 999px; }

/* Tasks */
.tasks-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.task-row {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius);
}
.task-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-label { font-size: 13px; font-weight: 600; flex: 1; }
.task-cron code { font-size: 11px; color: var(--text-muted); }
.task-prompt { font-size: 12px; color: var(--text-muted); padding: 5px 8px; background: var(--surface3); border-radius: var(--radius-sm); }
.task-meta { font-size: 11px; color: var(--text-dim); }
.btn-trigger {
  background: var(--green-bg); border: 1px solid rgba(61,214,140,.3);
  border-radius: var(--radius-sm); color: var(--green);
  font-size: 11px; font-weight: 600; padding: 3px 8px; cursor: pointer;
  transition: all var(--transition);
}
.btn-trigger:hover { background: var(--green); color: #000; }
.btn-task-toggle {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 11px; padding: 3px 8px; cursor: pointer;
  transition: all var(--transition);
}
.btn-task-toggle:hover { border-color: var(--accent); color: var(--accent); }
.btn-task-delete {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 13px; padding: 2px 5px;
  border-radius: 4px; transition: all var(--transition);
}
.btn-task-delete:hover { background: var(--red-bg); color: var(--red); }

/* Web refs */
.ref-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  position: relative;
}
.ref-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ref-label {
  flex: 1;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ref-label:hover { text-decoration: underline; }
.ref-url {
  color: var(--text-dim);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-family: 'JetBrains Mono', monospace;
}
.ref-desc {
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.4;
}

/* MCPs */
.mcp-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; background: var(--surface3);
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px;
}
.mcp-name { font-weight: 600; color: var(--blue); min-width: 70px; }
.mcp-cmd { flex: 1; font-family: 'JetBrains Mono', monospace; color: var(--text-muted); font-size: 11px; word-break: break-all; }

.tab-desc { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.empty-hint { font-size: 12px; color: var(--text-dim); padding: 8px 0; }

/* ── Status badges ───────────────────────────────────────────────────────── */
.badge {
  font-size: 10px; font-weight: 600; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 999px; text-transform: uppercase; flex-shrink: 0;
}
.badge-idle      { background: var(--grey-bg);   color: var(--grey);  }
.badge-running   { background: var(--blue-bg);   color: var(--blue);  animation: pulse 1.5s infinite; }
.badge-completed { background: var(--green-bg);  color: var(--green); }
.badge-error     { background: var(--red-bg);    color: var(--red);   }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* Buttons */
.btn-primary {
  padding: 8px 18px;
  background: var(--accent); border: 1px solid transparent;
  border-radius: var(--radius-sm); color: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: opacity var(--transition); font-family: 'Inter', sans-serif;
}
.btn-primary:hover { opacity: .88; }
.btn-secondary {
  padding: 8px 18px;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 13px; cursor: pointer;
  transition: all var(--transition); font-family: 'Inter', sans-serif;
}
.btn-secondary:hover { border-color: var(--border2); color: var(--text); }

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 13px; color: var(--text);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 300;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok    { border-color: rgba(61,214,140,.4); color: var(--green); }
#toast.error { border-color: rgba(255,95,109,.4); color: var(--red); }

/* ── New workspace modal ─────────────────────────────────────────────────── */
#modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 250;
  align-items: center;
  justify-content: center;
}
#modal-overlay.show { display: flex; }
#modal {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 400px; max-width: 94vw;
  box-shadow: var(--shadow);
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform:translateY(20px); opacity:0; } }
#modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
#modal input {
  width: 100%; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 14px;
  outline: none; transition: border-color var(--transition);
  font-family: 'JetBrains Mono', monospace;
}
#modal input:focus { border-color: var(--accent); }
#modal-hint { font-size: 11px; color: var(--text-dim); margin-top: 6px; }
#modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  body { overflow: auto; }
  #app { height: auto; overflow: visible; }
  #main-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto 1fr auto;
    height: auto;
  }
  .sidebar-left { border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar-right { display: none; }
  .btn-right-toggle { display: none; }
  .chat-messages { min-height: 60vh; }
  /* On mobile the sidebar stacks vertically; overlay should cover full width */
  .settings-overlay { left: 0; }
}

/* Animations */
@keyframes fadeIn { from { opacity:0; transform:translateY(4px); } }

/* ── User account chip (topbar) ─────────────────────────────────────────────── */
.btn-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 4px;
  border-radius: 20px;
  border: 1px solid var(--border, #2a2a2a);
  background: transparent;
  cursor: pointer;
  color: var(--fg, #e8e8e8);
  font-size: 0.78rem;
  transition: background 0.15s, border-color 0.15s;
  margin-left: auto;
  flex-shrink: 0;
}
.btn-user-chip:hover {
  background: var(--surface-2, #1c1c1c);
  border-color: var(--muted, #555);
}
.user-chip-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent, #4f8ef7);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.user-chip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.user-chip-email {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted, #aaa);
}

/* ── Login overlay ─────────────────────────────────────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg, #0d0d0d);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 40px;
  background: var(--surface, #161616);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 16px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.login-logo {
  font-size: 2.5rem;
  line-height: 1;
  color: var(--accent, #4f8ef7);
}
.login-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  color: var(--fg, #e8e8e8);
}
.login-sub {
  font-size: 0.875rem;
  color: var(--muted, #888);
  margin: 0;
}
.btn-google-signin {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 22px;
  background: #fff;
  color: #3c4043;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid #dadce0;
  transition: box-shadow 0.15s, background 0.15s;
}
.btn-google-signin:hover {
  background: #f8f8f8;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.login-error {
  font-size: 0.8rem;
  color: #f87171;
  margin: 0;
}

/* ── My Connections tab ─────────────────────────────────────────────────────── */
.connections-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--border, #2a2a2a);
  margin-bottom: 16px;
}
.connections-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent, #4f8ef7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  overflow: hidden;
}
.connections-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.connections-user-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.connections-email {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg, #e8e8e8);
}
.connections-display-name {
  font-size: 0.78rem;
  color: var(--muted, #888);
}
.connections-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.conn-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2, #1c1c1c);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  transition: border-color 0.15s;
}
.conn-card.connected {
  border-color: var(--green, #22c55e);
}
.conn-card.unavailable {
  opacity: 0.55;
}
.conn-icon {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.conn-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.conn-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg, #e8e8e8);
}
.conn-desc {
  font-size: 0.75rem;
  color: var(--muted, #888);
}
.conn-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.conn-status-ok {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--green, #22c55e);
}
.conn-status-off {
  font-size: 0.75rem;
  color: var(--muted, #888);
}
.btn-conn-action {
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border, #2a2a2a);
  background: transparent;
  color: var(--fg, #e8e8e8);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s, border-color 0.15s;
}
.btn-conn-action:hover:not([disabled]) {
  background: var(--surface-3, #252525);
  border-color: var(--muted, #888);
}
.btn-conn-action[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-conn-connect {
  border-color: var(--accent, #4f8ef7);
  color: var(--accent, #4f8ef7);
}
.btn-conn-connect:hover {
  background: rgba(79,142,247,.08) !important;
}
.btn-conn-disconnect {
  border-color: #f87171;
  color: #f87171;
}
.btn-conn-disconnect:hover {
  background: rgba(248,113,113,.08) !important;
}
.connections-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border, #2a2a2a);
}
.btn-signout {
  font-size: 0.8rem;
  color: var(--muted, #888);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border, #2a2a2a);
  display: inline-block;
  transition: color 0.15s, border-color 0.15s;
}
.btn-signout:hover {
  color: #f87171;
  border-color: #f87171;
}

/* ── Account drawer: section headers ────────────────────────────────────── */
.account-section {
  margin-top: 20px;
}
.account-section-header {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #888);
  margin-bottom: 10px;
}

/* ── GWS connection card ────────────────────────────────────────────────── */
.gws-conn-card {
  background: var(--surface-2, #1c1c1c);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gws-conn-status {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gws-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gws-status-unknown { background: var(--muted, #888); }
.gws-status-ok      { background: var(--green, #22c55e); box-shadow: 0 0 6px rgba(34,197,94,.5); }
.gws-status-off     { background: #f87171; }
.gws-status-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg, #e8e8e8);
}
.gws-status-email {
  font-size: 0.78rem;
  color: var(--muted, #888);
}
.gws-conn-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.btn-gws-reauth {
  font-size: 0.78rem;
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--accent, #4f8ef7);
  background: transparent;
  color: var(--accent, #4f8ef7);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-gws-reauth:hover:not([disabled]) {
  background: rgba(79,142,247,.1);
}
.btn-gws-reauth[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.gws-reauth-msg {
  font-size: 0.75rem;
  color: var(--muted, #888);
  flex: 1;
}
.gws-reauth-msg a {
  color: var(--accent, #4f8ef7);
  text-decoration: underline;
}

/* ── Tool status grid ──────────────────────────────────────────────────── */
.tool-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}
.tool-status-item {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-2, #1c1c1c);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
  padding: 8px 10px;
}
.tool-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted, #555);
}
.tool-dot-ok  { background: var(--green, #22c55e); }
.tool-dot-off { background: var(--muted, #555); }
.tool-status-name {
  font-size: 0.8rem;
  color: var(--fg, #e8e8e8);
}

/* ── Multi-skill manager ────────────────────────────────────────────────── */
.skills-layout {
  display: flex;
  gap: 12px;
  height: 420px;
  overflow: hidden;
}
.skills-sidebar {
  width: 160px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  overflow: hidden;
}
.skills-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--surface-2, #1c1c1c);
  border-bottom: 1px solid var(--border, #2a2a2a);
}
.skills-sidebar-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted, #888);
}
.btn-icon-sm {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid var(--border, #2a2a2a);
  background: transparent;
  color: var(--fg, #e8e8e8);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.btn-icon-sm:hover { background: var(--surface-3, #252525); }
.skills-list {
  list-style: none;
  padding: 6px 4px;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}
.skills-list-empty {
  font-size: 0.75rem;
  color: var(--muted, #888);
  padding: 8px;
  text-align: center;
}
.skills-list-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--fg, #e8e8e8);
  transition: background 0.12s;
  overflow: hidden;
}
.skills-list-item:hover { background: var(--surface-3, #252525); }
.skills-list-item.active {
  background: var(--surface-3, #252525);
  color: var(--accent, #4f8ef7);
}
.skill-icon { flex-shrink: 0; font-size: 0.85rem; }
.skill-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.skills-editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.skills-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted, #888);
  font-size: 0.85rem;
  text-align: center;
  border: 1px dashed var(--border, #2a2a2a);
  border-radius: 8px;
  padding: 20px;
}
.skills-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.skill-editing-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted, #888);
  font-family: monospace;
}
.btn-danger-sm {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid #f87171;
  background: transparent;
  color: #f87171;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger-sm:hover { background: rgba(248,113,113,.1); }
#stab-skill textarea#skill-editor {
  flex: 1;
  resize: none;
  min-height: 0;
}

/* ── Workspace role badge + readonly banner ─────────────────────────────── */
.role-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 10px;
  vertical-align: middle;
}
.role-owner   { background: rgba(34,197,94,.15);  color: #22c55e; border: 1px solid rgba(34,197,94,.3); }
.role-manager { background: rgba(79,142,247,.15); color: #4f8ef7; border: 1px solid rgba(79,142,247,.3); }
.role-member  { background: rgba(156,163,175,.1); color: #9ca3af; border: 1px solid rgba(156,163,175,.3); }

.settings-readonly-banner {
  background: rgba(248,113,113,.08);
  border: 1px solid rgba(248,113,113,.25);
  color: #f87171;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.8rem;
  margin-bottom: 16px;
  line-height: 1.5;
}
