:root {
  --bg: #1c1b1a;
  --panel-bg: #262523;
  --raised: #2d2c29;
  --panel-border: #363531;
  --text: #ece9e2;
  --text-dim: #9d9a91;
  --accent: #6aa38a;
  --on-accent: #fff;
  --danger: #e5484d;
  --danger-strong: #c93b40;
  --warning: #e0a33b;
  --idle: #6f6d66;
  --busy: #e0a33b;
  --live: #3ecf8e;
  --accent-text: #86b9a1;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

::selection { background: rgba(106, 163, 138, 0.35); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #4a4843; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
}

h1, h2 { margin: 0 0 1rem; font-weight: 600; }

button {
  font: inherit;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button.secondary { background: transparent; border: 1px solid var(--panel-border); color: var(--text); }
button.danger { background: var(--danger-strong); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}
.checkbox-label input { display: inline; width: auto; margin: 0; }
input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.7rem;
  background: #1f1e1c;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
}

.screen { min-height: 100vh; }

#login-screen, #setup-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 320px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 2rem;
}
.login-card button { width: 100%; margin-top: 0.5rem; }
.setup-card { max-width: 420px; }

.error { color: var(--danger); font-size: 0.85rem; margin-top: 0.75rem; }
.success { color: var(--live); font-size: 0.85rem; margin: -0.5rem 0 1rem; }

.totp-secret-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.totp-secret {
  flex: 1;
  display: block;
  padding: 0.7rem 0.8rem;
  background: #1f1e1c;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  line-height: 1.6;
  user-select: all;
}
.totp-secret-row button { width: auto; flex-shrink: 0; padding: 0.6rem 0.9rem; margin-top: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--panel-border);
}
.topbar h1 { font-size: 1.1rem; }
.topbar-actions { display: flex; gap: 0.6rem; }

/* --- Dashboard shell: ChatGPT-style sidebar + single main pane --- */

#dashboard-screen { min-height: 100vh; position: relative; }

.hamburger-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 70;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 0.5rem;
  border-radius: 8px;
  display: flex;
}
.hamburger-btn:hover { border-color: #4a4843; }

.app-shell { display: flex; height: 100vh; }

.sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--panel-border);
  overflow: hidden;
  transition: width 0.18s ease;
}
#dashboard-screen.sidebar-collapsed .sidebar { width: 0; border-right: none; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1rem 1rem 3.25rem;
  flex-shrink: 0;
}
.sidebar-title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; }
.sidebar-new-btn { font-size: 0.85rem; padding: 0.4rem 0.75rem; white-space: nowrap; }

.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 280px;
}

.session-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-dim);
}
.session-row:hover { background: #242321; color: var(--text); }
.session-row.active { background: var(--panel-bg); color: var(--text); }
.session-row.bypass { box-shadow: inset 2px 0 0 var(--warning); }
.session-row-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
}

.hidden-section { flex-shrink: 0; border-top: 1px solid var(--panel-border); min-width: 280px; }
.hidden-toggle {
  width: 100%;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  text-align: left;
  padding: 0.7rem 1rem;
  border-radius: 0;
}
.hidden-toggle:hover { color: var(--text); }
.hidden-section .session-list { padding: 0 0.6rem 0.5rem; }
.hidden-chip { cursor: default; }
.hidden-chip button { flex-shrink: 0; padding: 0.25rem 0.6rem; font-size: 0.75rem; }

.sidebar-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem;
  border-top: 1px solid var(--panel-border);
  min-width: 280px;
}
.sidebar-footer-btn { width: 100%; text-align: left; font-size: 0.85rem; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 55;
}

@media (max-width: 880px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 60;
    width: 280px;
    transform: translateX(0);
    transition: transform 0.18s ease;
  }
  #dashboard-screen.sidebar-collapsed .sidebar {
    width: 280px;
    border-right: 1px solid var(--panel-border);
    transform: translateX(-100%);
  }
  #dashboard-screen:not(.sidebar-collapsed) .sidebar-backdrop { display: block; }
}

.main-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-top: 3.5rem;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--panel-border);
  flex-shrink: 0;
}
.chat-session-name {
  flex: 1;
  min-width: 4rem;
  font-weight: 600;
  font-size: 1rem;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  margin: 0;
}
.chat-session-name:focus { background: #1f1e1c; outline: 1px solid var(--accent); }
.chat-header-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.chat-header button { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.chat-header button.icon-btn { padding: 0.35rem 0.55rem; min-width: 2rem; line-height: 1; }

.chat-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 1.5rem;
}
.chat-body .xterm-viewport { border-radius: 10px; }
.chat-terminal {
  width: 100%;
  height: 100%;
  max-width: 1080px;
  margin: 0 auto;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  overflow: hidden;
}
.chat-terminal .xterm { padding: 0.75rem; }

.chat-empty { color: var(--text-dim); text-align: center; }

.bubble-view {
  width: 100%;
  height: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.bubble-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.25rem;
}
.bubble-row { display: flex; }
.bubble-row-user { justify-content: flex-end; }
.bubble-row-assistant { justify-content: flex-start; }
.bubble {
  max-width: 80%;
  padding: 0.6rem 0.85rem;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.4;
}
.bubble-user { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble-assistant { background: var(--panel-bg); border: 1px solid var(--panel-border); border-bottom-left-radius: 4px; }
.bubble-empty { text-align: center; margin: auto; }
.bubble-composer { display: flex; gap: 0.5rem; flex-shrink: 0; }
.bubble-composer input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text);
}
.cmd-menu {
  flex-shrink: 0;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--panel-bg);
  overflow: hidden;
}
.cmd-item { display: flex; gap: 0.75rem; align-items: baseline; padding: 0.45rem 0.85rem; cursor: pointer; }
.cmd-item.active, .cmd-item:hover { background: var(--accent); color: #fff; }
.cmd-item.active .meta, .cmd-item:hover .meta { color: inherit; opacity: 0.85; }
.cmd-name { font-family: monospace; white-space: nowrap; }
.cmd-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble-composer input:focus { outline: 1px solid var(--accent); }

.uploads-panel {
  margin: 0 1.5rem;
  padding: 1.25rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
}
.uploads-dropzone {
  text-align: center;
  padding: 1.5rem;
  border: 1px dashed var(--panel-border);
  border-radius: 8px;
  color: var(--text-dim);
  margin-bottom: 1rem;
}
.uploads-dropzone.drag-over { border-color: var(--accent); color: var(--text); }
.uploads-browse {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}
.uploads-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.uploads-table th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.8rem;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--panel-border);
}
.uploads-table td { padding: 0.5rem; border-bottom: 1px solid var(--panel-border); }
.uploads-table tr:last-child td { border-bottom: none; }
.uploads-empty { color: var(--text-dim); }

.bypass-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(242, 169, 60, 0.15);
  color: var(--warning);
  border: 1px solid var(--warning);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.idle { background: var(--idle); }
.status-dot.busy { background: var(--busy); }
.status-dot.live { background: var(--live); }

.attach-prompt { text-align: center; color: var(--text-dim); }
.attach-prompt .meta { font-size: 0.8rem; margin-top: -0.5rem; }
.attach-prompt button { margin-top: 0.75rem; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100; /* above the slide-out sidebar (60), below right-click menus (1000) */
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 1.5rem;
}
.modal-subtext { color: var(--text-dim); font-size: 0.85rem; margin: -0.5rem 0 1rem; }
.modal-subtext.warning { color: var(--warning); }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.5rem; }

/* --- Marketplace page --- */

.mp-screen { display: flex; flex-direction: column; }

.mp-topbar {
  position: relative;
  justify-content: flex-start;
}
.mp-topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 60%);
}
.mp-topbar-title { display: flex; align-items: center; gap: 1rem; }
.mp-topbar-title h1 { font-size: 1.1rem; }

.mp-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.3rem 0.4rem 0.3rem 0;
  font-size: 0.9rem;
}
.mp-back:hover { color: var(--text); }

.mp-body {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1.75rem;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}

.mp-section-heading {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.mp-section-heading h2 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.mp-section-heading .meta { color: var(--text-dim); font-size: 0.8rem; }

.mp-sources-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.mp-chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; flex: 1; min-width: 200px; }
.mp-empty-inline { color: var(--text-dim); font-size: 0.85rem; padding: 0.6rem 0; }

.mp-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 0.4rem 0.5rem 0.4rem 0.8rem;
  font-size: 0.85rem;
}
.mp-chip-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.mp-chip-dot.mp-source-claude { background: var(--accent); }
.mp-chip-name { font-weight: 500; }
.mp-chip-meta { color: var(--text-dim); font-size: 0.75rem; }
.mp-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-dim);
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  border-radius: 50%;
}
.mp-chip-remove:hover { background: rgba(229, 72, 77, 0.15); color: var(--danger); }

.mp-add-source-form { display: flex; gap: 0.5rem; flex: 1 1 280px; min-width: 0; }
.mp-add-source-form input { margin: 0; flex: 1 1 auto; min-width: 0; }
.mp-add-source-form button { flex-shrink: 0; }

.mp-suggested-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}
.mp-suggested-label { color: var(--text-dim); font-size: 0.8rem; flex-shrink: 0; }
.mp-suggested-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.mp-suggested-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px dashed var(--panel-border);
  border-radius: 999px;
  padding: 0.3rem 0.4rem 0.3rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.mp-suggested-pill button {
  background: transparent;
  border: 1px solid var(--accent-text);
  color: var(--accent-text);
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 999px;
}
.mp-suggested-pill button:hover { background: var(--accent); color: #fff; }

.mp-search-row {
  position: relative;
  margin-bottom: 1rem;
  max-width: 420px;
}
.mp-search-row input { padding-left: 2.2rem; margin: 0; }
.mp-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.mp-plugin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.mp-empty { color: var(--text-dim); font-size: 0.85rem; padding: 0.75rem 0; grid-column: 1 / -1; }

.mp-plugin-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.mp-plugin-card:hover { transform: translateY(-2px); border-color: #4a4843; }
.mp-installed .mp-plugin-card {
  background: #242321;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

@keyframes mp-highlight {
  0% { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.55); }
  100% { box-shadow: 0 0 0 14px rgba(62, 207, 142, 0); }
}
.mp-plugin-card.mp-just-changed { animation: mp-highlight 900ms ease-out; }

.mp-plugin-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.mp-plugin-source {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
}
.mp-plugin-source.mp-source-claude { color: var(--accent-text); }
.mp-installed-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--live);
  background: rgba(62, 207, 142, 0.12);
  border: 1px solid var(--live);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}
.mp-plugin-name { font-weight: 600; font-size: 0.95rem; }
.mp-plugin-desc {
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.4;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mp-plugin-meta { display: flex; gap: 0.6rem; color: var(--text-dim); font-size: 0.75rem; }
.mp-plugin-actions { display: flex; justify-content: flex-end; margin-top: 0.25rem; }
.mp-plugin-actions button, .mp-plugin-view { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.mp-plugin-view { text-decoration: none; display: inline-block; }

.board-messages {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.board-message { display: flex; gap: 0.7rem; align-items: flex-start; }
.board-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel-border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  overflow: hidden;
}
.board-avatar img { width: 100%; height: 100%; object-fit: cover; }
.board-message-body { flex: 1; min-width: 0; }
.board-message-head { display: flex; gap: 0.5rem; align-items: baseline; }
.board-message-agent { font-weight: 600; }
.board-message-time { color: var(--text-dim); font-size: 0.75rem; }
.board-message-blurb { color: var(--text-dim); font-size: 0.75rem; margin-top: 0.1rem; }
.board-message-text { white-space: pre-wrap; margin-top: 0.25rem; font-size: 0.9rem; }

.persona-list { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 1rem; }
.persona-row { display: flex; gap: 0.7rem; align-items: flex-start; }
.persona-row-fields { flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }
.persona-blurb-input {
  width: 100%;
  resize: vertical;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  font-family: inherit;
  font-size: 0.85rem;
}
.persona-row-actions { display: flex; gap: 0.5rem; align-items: center; }
.persona-avatar-label { cursor: pointer; }
.persona-row-status { margin: 0; }

.modal-card textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

/* drag-to-reorder + groups */
.session-row[draggable="true"] { cursor: grab; }
.session-row.dragging { opacity: 0.4; }
.session-row.drop-before { box-shadow: 0 -2px 0 var(--accent); }
.session-row.drop-after { box-shadow: 0 2px 0 var(--accent); }
.session-row.drop-into { background: var(--accent); color: #fff; }
.groups-header { padding-left: 1rem; border-top: 1px solid var(--panel-border); }
.group-list { flex: 0 0 auto; max-height: 30%; min-height: 1.5rem; }
.group-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 1rem; gap: 0.75rem; }
.group-panel[hidden] { display: none; }
.group-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; flex-shrink: 0; }
.group-head .chat-header-actions { margin-left: auto; }
.group-body { flex: 1; min-height: 0; display: flex; gap: 1rem; }
.group-chat { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.group-chat .bubble-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.group-files { width: 260px; flex-shrink: 0; overflow-y: auto; border-left: 1px solid var(--panel-border); padding-left: 1rem; word-break: break-word; }
.group-files h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.group-file { display: block; padding: 0.35rem 0; font-size: 0.85rem; color: var(--text); }
.bubble-from { font-size: 0.72rem; color: var(--text-dim); margin: 0 0.25rem 0.15rem; }
.bubble-system { align-self: center; font-size: 0.8rem; color: var(--text-dim); }
.member-picks { max-height: 220px; overflow-y: auto; margin-bottom: 1rem; }
@media (max-width: 880px) {
  .group-body { flex-direction: column; }
  .group-files { width: auto; border-left: none; padding-left: 0; max-height: 30%; }
}
.group-chat .bubble-row > div { display: flex; flex-direction: column; max-width: 80%; min-width: 0; }
.group-chat .bubble-row-user > div { align-items: flex-end; }
.group-chat .bubble { max-width: none; white-space: pre-wrap; overflow-wrap: anywhere; }

/* marketplace: hero + pills + icon cards (same palette as before) */
.mp-hero { text-align: center; padding: 1.5rem 0 0.5rem; }
.mp-hero-count { margin: 0 0 0.5rem; }
.mp-hero-title { font-size: 2rem; margin: 0 0 0.5rem; }
.mp-hero-sub { color: var(--text-dim); margin: 0 auto 1.25rem; max-width: 520px; font-size: 0.95rem; }
.mp-search-big { max-width: 640px; margin: 0 auto 1rem; }
.mp-search-big input { padding-top: 0.8rem; padding-bottom: 0.8rem; font-size: 1rem; border-radius: 999px; }
.mp-filter-row { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.mp-pill { background: transparent; border: 1px solid var(--panel-border); color: var(--text-dim); border-radius: 999px; padding: 0.35rem 0.85rem; font-size: 0.82rem; }
.mp-pill:hover { color: var(--text); }
.mp-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.mp-plugin-head { display: flex; align-items: center; gap: 0.7rem; }
.mp-plugin-icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; background: #242321; border: 1px solid var(--panel-border); color: var(--accent-text); }
.mp-plugin-titles { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.1rem; }
.mp-plugin-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-plugin-desc { -webkit-line-clamp: 2; min-height: 2.8em; }
.mp-plugin-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.25rem; }
.mp-plugin-foot .mp-plugin-actions { margin-top: 0; }
.mp-sources-summary { cursor: pointer; color: var(--text-dim); font-size: 0.85rem; margin-bottom: 0.9rem; }
.mp-sources-summary:hover { color: var(--text); }

/* sidebar sections + context menu */
.section-header { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.7rem; margin-top: 0.4rem; border-radius: 8px; cursor: pointer; color: var(--text-dim); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.section-header:hover { color: var(--text); background: #242321; }
.section-header.drop-into { background: var(--accent); color: #fff; }
.section-chevron { width: 0.8rem; flex-shrink: 0; }
.ctx-menu { position: fixed; z-index: 1000; min-width: 190px; padding: 0.3rem; background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }
.ctx-menu[hidden] { display: none; }
.ctx-item { display: block; width: 100%; text-align: left; background: transparent; color: var(--text); border-radius: 6px; padding: 0.45rem 0.7rem; font-size: 0.85rem; }
.ctx-item:hover { background: var(--accent); color: #fff; }
.ctx-item.danger-text { color: var(--danger); }
.ctx-item.danger-text:hover { background: var(--danger-strong); color: #fff; }
.ctx-sep { height: 1px; background: var(--panel-border); margin: 0.3rem 0; }

/* session profile pictures */
.avatar { display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 50%; overflow: hidden; color: #fff; font-weight: 600; line-height: 1; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-btn { cursor: pointer; }
.bubble-row-assistant { align-items: flex-end; gap: 0.5rem; }

/* hover-to-reveal sidebar (desktop): slides over the page instead of pushing it */
.sidebar-hotzone { display: none; }
@media (min-width: 881px) {
  #dashboard-screen.sidebar-hover .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 60;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
  }
  #dashboard-screen.sidebar-hover .sidebar.peek { transform: none; box-shadow: 8px 0 24px rgba(0, 0, 0, 0.45); }
  #dashboard-screen.sidebar-hover .sidebar-hotzone { display: block; position: fixed; left: 0; top: 0; bottom: 0; width: 10px; z-index: 59; }
}

/* workspace: files / preview / canvas / browser */
.ws-screen .topbar { justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ws-tabs { display: flex; gap: 0.5rem; }
.ws-body { flex: 1; min-height: 0; display: flex; padding: 1rem 1.5rem; }
.ws-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.ws-pane[hidden] { display: none; }
.ws-bar { display: flex; gap: 0.5rem; align-items: center; }
.ws-bar input { flex: 1; margin: 0; }
.ws-split { flex: 1; min-height: 0; display: flex; gap: 1rem; }
.ws-list { width: 320px; flex-shrink: 0; overflow-y: auto; border: 1px solid var(--panel-border); border-radius: 10px; padding: 0.3rem; }
.ws-item { display: flex; gap: 0.5rem; padding: 0.4rem 0.6rem; border-radius: 6px; cursor: pointer; font-size: 0.85rem; color: var(--text-dim); }
.ws-item:hover { background: #242321; color: var(--text); }
.ws-item.active { background: var(--panel-bg); color: var(--text); }
.ws-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-viewer { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; overflow: auto; border: 1px solid var(--panel-border); border-radius: 10px; padding: 0.75rem; }
.ws-viewer pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 0.8rem; }
.ws-viewer img { max-width: 100%; align-self: flex-start; }
.ws-frame { flex: 1; width: 100%; min-height: 300px; border: 1px solid var(--panel-border); border-radius: 10px; background: #fff; }
.ws-viewer .ws-frame { min-height: 400px; }
.ws-note { margin: 0; }
/* artifact previews inside chat bubbles */
.bubble-col { display: flex; flex-direction: column; gap: 0.4rem; max-width: 80%; min-width: 0; }
.bubble-col .bubble { max-width: none; }
.art-card { border: 1px solid var(--panel-border); border-radius: 10px; overflow: hidden; background: var(--panel-bg); }
.art-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.7rem; font-size: 0.8rem; }
.art-head .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-head button, .art-head a { padding: 0.2rem 0.6rem; font-size: 0.75rem; }
.art-card iframe { width: 100%; height: 280px; border: none; border-top: 1px solid var(--panel-border); background: #fff; }
@media (max-width: 880px) { .ws-split { flex-direction: column; } .ws-list { width: auto; max-height: 40%; } }

/* queued messages + permission/question card */
.queue-bubble { align-items: center; gap: 0.5rem; }
.queue-bubble .bubble { opacity: 0.6; }
.queue-side { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
.queue-status { font-size: 0.72rem; color: var(--text-dim); }
.queue-failed .queue-status { color: #e07a6e; }
.queue-cancel { padding: 0.15rem 0.5rem; font-size: 0.72rem; }
.prompt-card { align-self: flex-start; max-width: 85%; display: flex; flex-direction: column; gap: 0.4rem; padding: 0.8rem; border: 1px solid var(--warning); border-radius: 10px; background: var(--panel-bg); }
.prompt-q { white-space: pre-wrap; font-size: 0.85rem; margin-bottom: 0.2rem; }
.prompt-card button { text-align: left; }

/* in-page file viewer */
.file-card { max-width: min(1000px, 94vw); width: 94vw; max-height: 90vh; display: flex; flex-direction: column; }
.file-card-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.file-card-head h2 { margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.file-modal-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.file-modal-body .ws-frame { min-height: 60vh; }
.file-modal-body pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 0.8rem; }
.file-modal-body img { max-width: 100%; align-self: flex-start; }
.file-link { color: var(--accent-text); text-decoration: underline; cursor: pointer; }
.group-file-row { display: flex; align-items: center; gap: 0.5rem; }
.group-file-row .group-file { flex: 1; min-width: 0; text-align: left; background: none; border: none; padding: 0.35rem 0; color: var(--text); cursor: pointer; }
.group-file-row .group-file:hover { color: var(--accent-text); }
.group-file-row a { font-size: 0.75rem; color: var(--text-dim); }

/* composer, pickers, chips, long-text bar */
.composer { display: flex; flex-direction: column; gap: 0.4rem; position: relative; flex-shrink: 0; }
.composer .bubble-composer { align-items: flex-end; }
.composer textarea { flex: 1; resize: none; padding: 0.6rem 0.85rem; border-radius: 10px; border: 1px solid var(--panel-border); background: var(--panel-bg); color: var(--text); font: inherit; max-height: 180px; }
.composer textarea:focus { outline: 1px solid var(--accent); }
.composer-plus { width: 2.4rem; padding: 0.55rem 0; font-size: 1.1rem; line-height: 1; }
.composer-hint { min-height: 1em; font-size: 0.75rem; }
.cmd-section { padding: 0.35rem 0.85rem 0.1rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.cmd-menu { max-height: 260px; overflow-y: auto; }
.ctx-chips { display: flex; flex-direction: column; gap: 0.3rem; }
.ctx-chips:empty { display: none; }
.ctx-chip { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.6rem; border-left: 3px solid var(--accent); background: var(--panel-bg); border-radius: 6px; font-size: 0.8rem; color: var(--text-dim); }
.ctx-chip span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-chip button { padding: 0.1rem 0.45rem; font-size: 0.75rem; }
.long-bar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.55rem 0.75rem; border: 1px solid var(--warning); border-radius: 10px; background: var(--panel-bg); font-size: 0.85rem; }
.long-bar span { flex: 1; min-width: 200px; }
.long-bar button { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
/* model select, files button, group head */
.model-select { background: var(--panel-bg); color: var(--text); border: 1px solid var(--panel-border); border-radius: 6px; padding: 0.4rem 0.5rem; font: inherit; font-size: 0.8rem; max-width: 9.5rem; }
#chat-files-btn.active { border-color: var(--accent); color: var(--accent-text); }
.group-head { justify-content: space-between; }
.group-head-side { flex: 1; display: flex; }
.group-head .chat-header-actions { justify-content: flex-end; margin-left: 0; }
.group-title { background: transparent; color: var(--text); font-size: 1.05rem; font-weight: 600; padding: 0.3rem 0.8rem; border-radius: 8px; border: 1px solid transparent; }
.group-title:hover { border-color: var(--panel-border); background: var(--raised); }
.group-members-line { margin: -0.4rem 0 0; text-align: center; flex-shrink: 0; }
.member-picks .checkbox-label { align-items: center; }
/* explorer inside chats */
.chat-body.with-files { display: flex; gap: 0.75rem; }
.chat-body.with-files > :first-child { flex: 1; min-width: 0; }
.chat-body.with-files .explorer { width: 300px; flex-shrink: 0; }
.explorer { display: flex; flex-direction: column; gap: 0.5rem; min-height: 0; }
.explorer-list { width: auto; flex: 1; }
#group-explorer { margin-top: 0.5rem; height: 320px; display: flex; }
#group-explorer[hidden] { display: none; }
#group-explorer .explorer { flex: 1; min-width: 0; }
#group-browse-btn { margin-top: 0.5rem; width: 100%; }
/* sidebar: tighter */
.session-row { padding: 0.45rem 0.65rem; }
.group-row .ico { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-header { padding-top: 0.8rem; padding-bottom: 0.6rem; }
.sidebar-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; padding: 0.6rem; }
.sidebar-footer-btn { padding: 0.4rem 0.5rem; font-size: 0.78rem; margin: 0; min-width: 0; }

.auto-section { color: var(--text-dim); }

.mp-row-label { margin: 1rem 0 0.4rem; text-align: center; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.mp-cat-section { margin-bottom: 2rem; }
.mp-cat-heading { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.9rem; }
.mp-cat-heading h2 { margin: 0; font-size: 1.05rem; }
.mp-cat-heading button { margin-left: auto; background: none; color: var(--accent-text); padding: 0.2rem 0.4rem; font-size: 0.85rem; }
.mp-pill .count { opacity: 0.65; margin-left: 0.3rem; font-size: 0.75em; }

/* built avatars: blinking eyes */
.avatar-svg { background: none !important; overflow: visible; }
.avatar-svg svg { width: 100%; height: 100%; display: block; }
.pfp-eyes { transform-box: fill-box; transform-origin: center; animation: pfp-blink 4.6s infinite; }
@keyframes pfp-blink { 0%, 90%, 100% { transform: scaleY(1); } 94% { transform: scaleY(0.08); } }
@media (prefers-reduced-motion: reduce) { .pfp-eyes { animation: none; } }
.avatar-card { max-width: 600px; }
.avatar-builder { display: flex; gap: 1.25rem; align-items: flex-start; margin-bottom: 1rem; }
.avatar-preview { width: 120px; height: 120px; flex-shrink: 0; background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 12px; padding: 10px; }
.avatar-preview svg { width: 100%; height: 100%; }
.avatar-options { flex: 1; min-width: 0; }
.avatar-options p { margin: 0.5rem 0 0.3rem; }
.opt-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.opt-tile { width: 44px; height: 44px; padding: 4px; background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 8px; }
.opt-tile svg { width: 100%; height: 100%; display: block; }
.opt-tile.active { border-color: var(--accent); background: var(--raised); }
.opt-swatch { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.opt-swatch.active { border-color: var(--text); }
.opt-color { width: 32px; height: 28px; padding: 0; border: 1px solid var(--panel-border); background: none; border-radius: 6px; }
@media (max-width: 520px) { .avatar-builder { flex-direction: column; } }

.mp-pager { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; align-items: center; margin-top: 1.5rem; }
.mp-pager button { min-width: 2.2rem; padding: 0.4rem 0.7rem; }
.mp-pager button.active { background: var(--accent); color: var(--on-accent, #fff); border-color: var(--accent); }
.mp-pager .meta { padding: 0 0.5rem; }

.settings-card { max-width: 560px; max-height: 90vh; overflow-y: auto; }
.settings-card h3 { margin: 1.4rem 0 0.6rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); border-top: 1px solid var(--panel-border); padding-top: 1rem; }
.settings-card h3:first-of-type { border-top: none; padding-top: 0; margin-top: 0.5rem; }
.settings-card select, .settings-card input[type="number"] { display: block; margin-top: 0.3rem; background: var(--panel-bg); color: var(--text); border: 1px solid var(--panel-border); border-radius: 6px; padding: 0.45rem 0.6rem; font: inherit; max-width: 100%; }
.settings-card input[type="number"] { width: 8rem; }
.no-blink .pfp-eyes { animation: none; }

/* files: slide-in drawer on the right (sessions and groups) */
.side-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 55; display: flex; flex-direction: column; gap: 0.6rem; padding: 0.9rem; overflow-y: auto; background: var(--bg); border-left: 1px solid var(--panel-border); box-shadow: -10px 0 28px rgba(0, 0, 0, 0.45); transform: translateX(105%); transition: transform 0.18s ease; visibility: hidden; }
.side-drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; gap: 0.5rem; }
.drawer-head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1; min-height: 0; display: flex; }
.drawer-body .explorer { flex: 1; min-width: 0; }
.drawer-sub { margin: 0.6rem 0 0; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.06em; }
.group-files.side-drawer { width: min(380px, 92vw); border-left: 1px solid var(--panel-border); padding: 0.9rem; max-height: none; }
#group-explorer { height: 360px; flex-shrink: 0; }
#chat-files-btn.active, #group-files-btn.active { border-color: var(--accent); }


/* ---- Claude-desktop look: warm graphite, flat, no glow ---- */
body { font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Inter, system-ui, sans-serif; font-size: 15px; }
button { background: var(--text); color: #1c1b1a; border-radius: 8px; font-weight: 500; }
button:hover:not(:disabled) { background: #fff; }
button.secondary { background: transparent; border: 1px solid var(--panel-border); color: var(--text); font-weight: 400; }
button.secondary:hover:not(:disabled) { background: var(--raised); }
button.danger { background: var(--danger-strong); color: #fff; }
input, textarea, select { border-radius: 8px; }
.login-card, .modal-card, .settings-card { border-radius: 14px; }

.sidebar { width: 280px; background: var(--bg); border-right: 1px solid var(--panel-border); }
.sidebar-nav { padding: 0.75rem 0.5rem 0.25rem 3.25rem; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; min-width: 280px; }
.sidebar-nav { padding-left: 0.5rem; padding-top: 3rem; }
.nav-item { display: flex; align-items: center; gap: 0.7rem; width: 100%; text-align: left; background: transparent; color: var(--text); border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.92rem; font-weight: 400; }
.nav-item:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.nav-item svg { color: var(--text-dim); flex-shrink: 0; }
.session-list { min-width: 280px; padding: 0.5rem 0.5rem; gap: 1px; }
.session-row { border-radius: 8px; color: var(--text); padding: 0.42rem 0.7rem; }
.session-row:hover { background: var(--raised); }
.session-row.active { background: var(--raised); }
.session-row-name { font-size: 0.9rem; }
.hidden-section { min-width: 280px; }
.sidebar-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.1rem; padding: 0.6rem; min-width: 280px; border-top: 1px solid var(--panel-border); }
.user-row { display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.15rem 0.35rem 0.5rem; }
.user-av { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 0.7rem; display: grid; place-items: center; font-weight: 600; }
.user-name { font-size: 0.9rem; }
.foot-icon { background: transparent; color: var(--text-dim); font-size: 0.75rem; padding: 0.25rem 0.5rem; font-weight: 400; }
.foot-icon:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.hamburger-btn { background: transparent; border: none; color: var(--text-dim); }
.hamburger-btn:hover { background: var(--raised); color: var(--text); }
.main-pane { background: var(--bg); }

/* start screen */
.start-screen { max-width: 680px; width: 100%; margin: 0 auto; min-height: 70vh; display: flex; flex-direction: column; justify-content: center; align-items: stretch; padding: 0 1rem; text-align: left; }
.start-title { display: flex; align-items: center; justify-content: center; gap: 0.7rem; margin: 0 0 1.4rem; font-family: "Tiempos Headline", Georgia, "Times New Roman", serif; font-weight: 400; font-size: 2rem; letter-spacing: -0.01em; color: var(--text); }
.start-star { color: var(--accent); flex-shrink: 0; }
.start-box { display: flex; align-items: flex-end; justify-content: space-between; width: 100%; min-height: 96px; padding: 1rem 1.1rem; background: var(--raised); color: var(--text-dim); border: 1px solid var(--panel-border); border-radius: 16px; font-size: 0.95rem; font-weight: 400; text-align: left; }
.start-box:hover:not(:disabled) { background: var(--raised); border-color: #4a4843; color: var(--text); }
.start-plus { font-size: 1.4rem; line-height: 1; color: var(--text-dim); }
.start-recent-head { display: flex; justify-content: space-between; margin: 2.2rem 0.2rem 0.6rem; font-size: 0.82rem; color: var(--text-dim); }
.start-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.7rem; }
.start-card { display: flex; align-items: center; gap: 0.6rem; background: var(--panel-bg); color: var(--text); border: 1px solid var(--panel-border); border-radius: 12px; padding: 0.8rem; text-align: left; font-weight: 400; }
.start-card:hover:not(:disabled) { background: var(--raised); }
.start-card-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.section-header { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 0.78rem; margin-top: 0.9rem; }
.bubble-user { background: var(--raised); color: var(--text); border: 1px solid var(--panel-border); }
.sidebar-footer { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; }
.user-row { grid-column: 1 / -1; }
.foot-icon { width: auto; margin: 0; text-align: center; }
#dashboard-screen.sidebar-hover .sidebar.peek { box-shadow: none; border-right: 1px solid var(--panel-border); }
.side-drawer { box-shadow: none; }
.foot-icon { white-space: nowrap; font-size: 0.72rem; padding: 0.25rem 0.35rem; }

.sidebar-footer { display: flex; flex-direction: column; gap: 1px; padding: 0.4rem 0.5rem 0.6rem; }
.sidebar-footer .user-row { padding: 0.4rem 0.7rem 0.5rem; }
.sidebar-footer .nav-item { padding: 0.4rem 0.7rem; font-size: 0.88rem; }

.google-btn { display: flex; align-items: center; justify-content: center; gap: 0.6rem; padding: 0.6rem 1rem; margin-bottom: 1rem; border-radius: 8px; background: #fff; color: #1f1f1f; font-weight: 500; text-decoration: none; }
.google-btn:hover { background: #f1f1f1; }

/* start screen: own look, no logo */
.start-title { font-family: "Segoe UI", -apple-system, system-ui, sans-serif; font-weight: 600; font-size: 1.6rem; letter-spacing: -0.015em; }
.start-box { border-radius: 12px; }
.start-card { border-radius: 10px; }

.update-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }

/* Customize (connectors + skills), profile panel */
.cust-body { max-width: 860px; margin: 0 auto; width: 100%; padding: 1rem; }
.cust-tabs { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.5rem; }
.cust-tabs input { flex: 1; min-width: 140px; }
.cust-list { display: flex; flex-direction: column; gap: 0.4rem; }
.cust-row { display: flex; align-items: center; gap: 0.75rem; width: 100%; text-align: left; background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 10px; padding: 0.65rem 0.8rem; color: var(--text); font-weight: 400; }
.cust-row:hover { background: var(--raised); color: var(--text); }
.cust-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); flex-shrink: 0; opacity: 0.5; }
.cust-dot.connected { background: var(--accent); opacity: 1; }
.cust-dot.needs-auth { background: #d6a64f; opacity: 1; }
.cust-dot.failed { background: #d36a5e; opacity: 1; }
.cust-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.cust-title { font-size: 0.92rem; }
.cust-sub { font-size: 0.78rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust-badge { font-size: 0.72rem; color: var(--text-dim); border: 1px solid var(--panel-border); border-radius: 999px; padding: 0.1rem 0.55rem; white-space: nowrap; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.cap-body { gap: 0.6rem; }
.cap-fact { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid var(--panel-border); font-size: 0.88rem; }
.cap-fact span:first-child { color: var(--text-dim); flex-shrink: 0; }
.cap-fact span:last-child { text-align: right; word-break: break-word; }
.cap-desc { margin: 0 0 0.25rem; line-height: 1.5; }
.cap-skill-text { background: var(--raised); border-radius: 8px; padding: 0.8rem; }
.profile-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.5rem; }
.profile-head h2 { margin: 0; }
.profile-head p { margin: 0; }
.user-av.big { width: 42px; height: 42px; font-size: 1.1rem; }
.profile-uri { display: block; background: var(--raised); border-radius: 6px; padding: 0.5rem 0.6rem; font-size: 0.8rem; word-break: break-all; margin-bottom: 0.5rem; }
button.user-row { background: transparent; border: 0; color: var(--text); text-align: left; border-radius: 8px; cursor: pointer; font-weight: 400; }
button.user-row:hover { background: var(--raised); }
#profile-google .google-btn { display: inline-flex; margin-top: 0.5rem; }
.set-h { margin: 1rem 0 0.4rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
#cust-note { margin: 0.4rem 0 0.8rem; }
.cap-signin { display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; padding-top: 0.4rem; } .cap-signin .google-btn { margin-bottom: 0; }
/* avatar builder: tabs + item grid */
.avatar-card { max-width: 680px; width: 94vw; }
.avatar-side { display: flex; flex-direction: column; gap: 0.6rem; align-items: stretch; }
.pfp-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.pfp-vibes .mp-pill { font-size: 0.75rem; padding: 0.2rem 0.6rem; }
.pfp-grid { max-height: 290px; overflow-y: auto; align-content: flex-start; padding: 2px; }
.pfp-grid .opt-tile { width: 54px; height: 54px; }
.pfp-none { font-size: 0.72rem; color: var(--text-dim); }
.pfp-tint { margin-top: 0.6rem; }
.pfp-tint .meta { width: 100%; margin: 0; }

/* home screen: type to start a chat */
form.start-box { align-items: flex-end; gap: 0.6rem; cursor: text; }
form.start-box:focus-within { border-color: #4a4843; }
#start-input { flex: 1; min-height: 64px; max-height: 40vh; resize: none; background: transparent; border: 0; outline: none; padding: 0; color: var(--text); font: inherit; font-size: 1rem; line-height: 1.5; }
#start-input::placeholder { color: var(--text-dim); }
.start-send { width: 34px; height: 34px; flex-shrink: 0; padding: 0; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: #fff; border: 0; }
.start-send:disabled { opacity: 0.5; }
.start-note { margin: 0.6rem 0.2rem 0; font-size: 0.8rem; color: var(--text-dim); }
.start-note.error { color: #e07a6e; }

/* group members picker */
.group-card { max-width: 520px; width: 94vw; }
.member-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0.9rem 0 0.4rem; font-size: 0.85rem; }
.member-picks { max-height: 50vh; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.8rem; }
.member-row { border: 1px solid var(--panel-border); border-radius: 10px; background: var(--panel-bg); transition: border-color 0.15s; }
.member-row.on { border-color: var(--accent); }
.member-picks .member-top { display: flex; flex-direction: row; align-items: center; gap: 0.65rem; padding: 0.55rem 0.7rem; margin: 0; cursor: pointer; color: var(--text); font-size: 0.92rem; }
.member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-check { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; margin: 0; flex-shrink: 0; border-radius: 999px; background: var(--panel-border); position: relative; cursor: pointer; transition: background 0.15s; }
.member-check::before { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.member-check:checked { background: var(--accent); }
.member-check:checked::before { transform: translateX(14px); }
.member-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.member-opts { display: flex; gap: 0.5rem; padding: 0 0.7rem 0.65rem 3.2rem; }
.member-opts[hidden] { display: none; }
.member-picks .member-opts label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; margin: 0; font-size: 0.72rem; color: var(--text-dim); }
.member-opts select { width: 100%; min-width: 0; }
.member-opts select.model-select { width: 100%; max-width: none; }

/* friend accounts: owner-only controls are hidden */
body.role-friend .owner-only, body.role-friend .composer-plus { display: none !important; }
.friend-badge { font-size: 0.72rem; color: #d6a64f; border: 1px solid #6b5a2e; border-radius: 999px; padding: 0.1rem 0.55rem; white-space: nowrap; }

/* Friends screen */
.fr-card { background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 12px; padding: 0.9rem 1rem; margin-bottom: 0.8rem; }
.fr-card .set-h:first-child { margin-top: 0; }
.fr-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin: 0.4rem 0; }
.fr-row input { flex: 1; min-width: 180px; }
.fr-invite-out { display: flex; gap: 0.5rem; align-items: center; margin: 0.5rem 0; }
.fr-invite-out code { margin: 0; flex: 1; }
.fr-line { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; font-size: 0.85rem; padding: 0.3rem 0; border-top: 1px solid var(--panel-border); }
.fr-line span { flex: 1; min-width: 160px; }
.fr-warn { color: #d6a64f; font-size: 0.88rem; }
.fr-list { display: flex; flex-direction: column; gap: 0.6rem; }
.fr-friend.paused { opacity: 0.7; }
.fr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem; }
.fr-name { min-width: 0; word-break: break-word; }
.fr-status { font-size: 0.72rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--accent); color: #fff; white-space: nowrap; }
.fr-status.off { background: #6b5a2e; }
.fr-sessions, .fr-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.fr-last { font-size: 0.8rem; color: var(--text-dim); margin: 0.5rem 0 0; word-break: break-word; }
.fr-msg { border-bottom: 1px solid var(--panel-border); padding: 0.5rem 0; }
.fr-msg-text { white-space: pre-wrap; word-break: break-word; font-size: 0.9rem; margin-top: 0.2rem; }
.fr-limits { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.6rem 0; }
.fr-model { display: flex !important; align-items: center; gap: 0.6rem; margin: 0 !important; color: var(--text) !important; }
.fr-model span { flex: 1; }
.fr-row2 { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.fr-row2 label { flex: 1; min-width: 130px; }
.fr-row2 select, .fr-row2 input { width: 100%; max-width: none; }

/* attachments: thumbnails in the message box, pictures and file cards in bubbles */
.file-chip { align-items: center; gap: 0.45rem; }
.file-chip img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.file-chip span { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-strip { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.5rem; }
.att-img { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--panel-border); background: var(--bg); line-height: 0; }
.att-img img { max-width: min(320px, 70vw); max-height: 260px; display: block; object-fit: contain; }
.att-file { display: inline-flex; align-items: center; gap: 0.5rem; max-width: 260px; padding: 0.45rem 0.6rem; background: var(--bg); color: var(--text); border: 1px solid var(--panel-border); border-radius: 10px; font-weight: 400; font-size: 0.85rem; text-align: left; }
.att-file:hover { background: var(--raised); }
.att-ext { font-size: 0.65rem; font-weight: 700; color: var(--accent-text); background: var(--raised); border-radius: 5px; padding: 0.2rem 0.35rem; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* invite accept page + friend sign-in */
.link-btn { background: none !important; border: 0; color: var(--text-dim) !important; font-weight: 400; font-size: 0.85rem; padding: 0.4rem 0 0; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--text) !important; }
.invite-card h1 { margin: 0.2rem 0 0.8rem; }
.invite-card .meta { margin: 0; }
.invite-text { font-size: 0.95rem; line-height: 1.5; margin: 0 0 1.2rem; }
.invite-step { margin: 0.2rem 0 0.8rem; font-size: 0.9rem; color: var(--text-dim); }
.or-line { display: flex; align-items: center; gap: 0.6rem; margin: 0.2rem 0 1rem; color: var(--text-dim); font-size: 0.8rem; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--panel-border); }
#invite-google[hidden] { display: none; }

/* activity trail between chat bubbles */
.trail-row { display: flex; align-items: flex-start; gap: 0.5rem; margin: -0.15rem 0 -0.15rem 2.6rem; padding-left: 0.75rem; border-left: 2px solid var(--panel-border); font-size: 0.8rem; color: var(--text-dim); }
.trail-icon { width: 1rem; text-align: center; flex-shrink: 0; line-height: 1.5; }
.trail-row[data-kind="done"] .trail-icon { color: var(--accent-text); }
.trail-body { min-width: 0; line-height: 1.5; }
.trail-more summary { cursor: pointer; font-size: 0.72rem; color: var(--text-dim); }
.trail-more pre { margin: 0.25rem 0 0; padding: 0.4rem 0.55rem; background: var(--raised); border-radius: 6px; font-size: 0.72rem; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; color: var(--text); }
.trail-live .trail-icon::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: trail-pulse 1.1s ease-in-out infinite; }
@keyframes trail-pulse { 0%, 100% { opacity: 0.35; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .trail-live .trail-icon::before { animation: none; } }

/* Admin session pinned at the top */
.session-row.admin-row { border: 1px solid var(--accent); margin-bottom: 0.4rem; }
.session-row.admin-row .session-row-name::after { content: "Admin"; margin-left: 0.4rem; font-size: 0.65rem; padding: 0.05rem 0.4rem; border-radius: 999px; background: var(--accent); color: #fff; vertical-align: middle; }

/* API screen */
.api-key-new { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.5rem 0; }
.api-ex { background: var(--raised); border-radius: 8px; padding: 0.7rem 0.8rem; font-size: 0.78rem; overflow-x: auto; white-space: pre; margin: 0.4rem 0 0.8rem; }
.api-list { display: flex; flex-direction: column; }
.api-ep { display: grid; grid-template-columns: 4.2rem minmax(0, 15rem) 1fr; gap: 0.6rem; align-items: baseline; padding: 0.45rem 0; border-top: 1px solid var(--panel-border); font-size: 0.85rem; }
.api-m { font-size: 0.7rem; font-weight: 700; text-align: center; border-radius: 5px; padding: 0.1rem 0; background: var(--raised); }
.api-get { color: #6ec6ff; } .api-post { color: #86b9a1; } .api-put, .api-patch { color: #d6a64f; } .api-delete { color: #e07a6e; }
.api-p { font-size: 0.78rem; word-break: break-all; }
.api-d { color: var(--text-dim); min-width: 0; }
.api-d code { font-size: 0.75rem; }
@media (max-width: 640px) { .api-ep { grid-template-columns: 4.2rem 1fr; } .api-d { grid-column: 1 / -1; } }

/* markdown in Claude's replies */
.bubble-assistant code { font-size: 0.85em; background: var(--raised); border-radius: 4px; padding: 0.05rem 0.3rem; }
.bubble-assistant pre.md-code { margin: 0.4rem 0; padding: 0.6rem 0.7rem; background: var(--bg); border: 1px solid var(--panel-border); border-radius: 8px; font-size: 0.8rem; white-space: pre; overflow-x: auto; }
