/* [CB_BASELINE] cb136 */
/* === Design tokens === */
:root {
  --bg: #0f172a;
  --bg-dark: #0b0b0c;
  --surface: #1e293b;
  --surface-alt: #1a1a1a;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #5fe1cf;
  --accent-soft: #c8f8f0;
  --accent-hover: #38c5a9;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --radius-sm: 8px;
  --radius-lg: 24px;
  --radius-md: 12px;
  --cb-surface-elevated: rgba(17, 24, 39, 0.9);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --cb-sidebar-offset: 0px;
}

.cb-hidden {
  display: none !important;
}

/* === Chat Page Layout === */
.chat-page {
  background: radial-gradient(circle at top, #111827, #020203);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  overflow-x: hidden;
}

.chat-wrapper {
  max-width: 100%;
  margin: 0 auto;
  padding: 12px 24px 24px 24px;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

/* === Workspace Shell === */
.cb-app-shell {
  width: 100%;
  flex: 1;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

body.cb-shell-active .cb-app-shell {
  display: flex;
  gap: 0;
  min-height: 100vh;
}

body.cb-shell-active {
  --cb-sidebar-offset: 140px;
}

body.cb-shell-active.cb-sidebar-collapsed {
  --cb-sidebar-offset: 42px;
}

body.cb-shell-active .top-bar {
  display: none;
}

.cb-app-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

body.cb-shell-active .chat-wrapper {
  max-width: 100%;
  margin: 0;
  padding: 12px 24px 24px 24px;
}

body.cb-shell-active .top-bar-right {
  display: none;
}

.cb-sidebar {
  display: none;
}

body.cb-shell-active .cb-sidebar {
  display: flex;
  flex-direction: column;
  width: 280px;
  background: rgba(8, 10, 18, 0.96);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.35);
  padding: 14px 10px;
  color: var(--text);
  transition: width 0.25s ease;
  position: relative;
  max-height: 100vh;
  overflow: visible;
  z-index: 2;
}

body.cb-shell-active.cb-sidebar-collapsed .cb-sidebar {
  width: 64px;
  padding: 18px 6px;
  overflow: hidden;
}

body.cb-mobile {
  --cb-sidebar-offset: 0px;
  overflow-x: hidden;
}

body.cb-mobile .cb-app-shell {
  min-height: 100vh;
}

/* Chat page layout adjustments */
.chat-page .cb-app-shell {
  padding-bottom: 0;
}

body.cb-mobile .cb-sidebar {
  width: 64px !important;
  min-width: 64px;
  max-width: 64px;
  padding: 16px 6px;
  box-shadow: none;
}

body.cb-mobile .cb-sidebar[data-collapsed="true"] {
  width: 64px;
}

body.cb-mobile .cb-sidebar-toggle {
  display: none;
}

body.cb-mobile .cb-sidebar-logo {
  justify-content: center;
  padding-right: 0;
}

body.cb-mobile .cb-sidebar-scroll {
  padding-right: 0;
}

body.cb-mobile .cb-app-main {
  width: 100%;
}

body.cb-sidebar-collapsed .cb-sidebar-toggle {
  display: none;
}
body.cb-sidebar-collapsed .cb-sidebar-logo {
  justify-content: center;
  padding-right: 0;
}

.cb-sidebar-scroll {
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow: hidden;
  overflow-x: hidden;
  position: relative;
  overscroll-behavior: contain;
}

.cb-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.cb-sidebar-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: inherit;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  height: 64px;
}

.cb-sidebar-logo img {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.cb-sidebar-logo-label {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.cb-sidebar-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: inherit;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.cb-sidebar-toggle svg {
  transition: transform 0.2s ease;
}

.cb-sidebar-toggle svg path {
  transition: inherit;
}

body.cb-sidebar-collapsed .cb-sidebar-toggle svg {
  transform: scaleX(-1);
}

.cb-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

.cb-sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  overflow: visible;
}

.cb-sidebar-chats-section {
  flex: 1;
  min-height: 0;
}

.cb-sidebar-chats-section .cb-sidebar-chat-list {
  overflow-y: auto;
  padding-right: 4px;
  max-height: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.cb-sidebar-chats-section .cb-sidebar-chat-list::-webkit-scrollbar {
  width: 8px;
}

.cb-sidebar-chats-section .cb-sidebar-chat-list::-webkit-scrollbar-track {
  background: transparent;
}

.cb-sidebar-chats-section .cb-sidebar-chat-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.cb-sidebar-chats-section .cb-sidebar-chat-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

.cb-sidebar-section + .cb-sidebar-section {
  margin-top: 6px;
}

.cb-sidebar-section-header {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  margin-bottom: 0;
  padding: 1px 0;
}

.cb-sidebar-select,
.cb-sidebar-button-secondary {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.cb-sidebar-select:hover,
.cb-sidebar-button-secondary:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

.cb-sidebar-select:disabled,
.cb-sidebar-button-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cb-sidebar-button-secondary {
  justify-content: flex-start;
  border-style: dashed;
}

.cb-sidebar-button-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.cb-sidebar-button-text {
  font-size: 0.8rem;
}

.cb-sidebar-select-label {
  font-size: 0.85rem;
  font-weight: 500;
}

.cb-sidebar-chevron svg {
  transition: transform 0.2s ease;
}

.cb-sidebar-select[data-open="true"] .cb-sidebar-chevron svg {
  transform: rotate(180deg);
}

.cb-sidebar-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  background: rgba(3, 8, 20, 0.98);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 240px;
  overflow-y: auto;
  padding: 3px;
  width: max(200px, 100%);
  z-index: 1000;
  pointer-events: auto;
}

.cb-sidebar-menu.is-floating {
  position: fixed;
  top: var(--cb-menu-top, 0px);
  left: var(--cb-menu-left, 0px);
  width: var(--cb-menu-width, 220px);
  max-height: min(300px, calc(100vh - 24px));
}

.cb-sidebar-menu[hidden] {
  display: none;
}

body.cb-sidebar-collapsed .cb-sidebar-menu:not(.is-floating) {
  left: 64px;
}

.cb-sidebar-menu button {
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.cb-sidebar-menu button.cb-sidebar-item--locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.cb-sidebar-menu button.cb-sidebar-item--locked:hover {
  opacity: 0.45;
  background: transparent;
}

.cb-project-menu-new {
  display: flex;
  align-items: center;
  gap: 6px;
  font-style: italic;
}

.cb-project-menu-new span {
  display: inline-flex;
  align-items: center;
}

.cb-sidebar-menu button:hover,
.cb-sidebar-menu button.is-active {
  background: rgba(95, 225, 207, 0.12);
  color: var(--accent-soft);
}

.cb-sidebar-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
}

.cb-sidebar-error {
  font-size: 0.75rem;
  color: #f87171;
  margin: 0;
}

body.cb-sidebar-collapsed .cb-sidebar-select-label,
body.cb-sidebar-collapsed .cb-sidebar-button-text,
body.cb-sidebar-collapsed .cb-sidebar-hint,
body.cb-sidebar-collapsed .cb-sidebar-error {
  display: none;
}

body.cb-sidebar-collapsed .cb-sidebar-select,
body.cb-sidebar-collapsed .cb-sidebar-button-secondary {
  justify-content: center;
}

.cb-sidebar-new-chat {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: linear-gradient(120deg, #38c5a9, #5fe1cf);
  color: #020617;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cb-sidebar-new-chat:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(95, 225, 207, 0.35);
}

.cb-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cb-sidebar-item,
.cb-sidebar-chat {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.cb-sidebar-item:hover:not(:disabled),
.cb-sidebar-chat:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.cb-sidebar-chat-row {
  display: flex;
}

.cb-sidebar-chat-row .cb-sidebar-chat {
  flex: 1;
}

.cb-chat-delete {
  opacity: 0;
  pointer-events: none;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  padding: 0 4px;
  font-size: 0.9rem;
  line-height: 1;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.cb-sidebar-chat:hover .cb-chat-delete,
.cb-sidebar-chat:hover .cb-chat-edit,
.cb-chat-delete:focus-visible,
.cb-chat-edit:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.cb-chat-delete:hover {
  color: #f87171;
}

.cb-chat-edit {
  opacity: 0;
  pointer-events: none;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  padding: 0 4px;
  font-size: 0.85rem;
  line-height: 1;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.cb-chat-edit:hover {
  color: #60a5fa;
}

.cb-sidebar-chat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cb-chat-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.cb-chat-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  margin-left: auto;
}

.cb-sidebar-chat:hover .cb-chat-actions,
.cb-sidebar-chat:focus-visible .cb-chat-actions {
  opacity: 1;
  pointer-events: auto;
}

body.cb-sidebar-collapsed .cb-chat-actions,
.cb-sidebar[data-collapsed="true"] .cb-chat-actions {
  display: none !important;
}

.cb-sidebar-item.is-disabled {
  cursor: not-allowed;
  opacity: 0.75;
}

.cb-sidebar-icon {
  width: 22px;
  height: 22px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cb-sidebar-icon svg {
  width: 16px;
  height: 16px;
  color: currentColor;
}

.cb-sidebar-label {
  font-size: 0.9rem;
  flex: 1;
}

.cb-sidebar-pill {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cb-sidebar-item:not(.is-disabled) .cb-sidebar-pill {
  display: none;
}

.cb-sidebar-chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cb-sidebar-chat {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.04);
  justify-content: flex-start;
}

.cb-sidebar-chat.is-active {
  background: rgba(95, 225, 207, 0.15);
  border-color: rgba(95, 225, 207, 0.4);
  color: #f4fffb;
}

.cb-sidebar-empty {
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
}

.chat-message.empty-state {
  text-align: center;
  padding: 32px 20px;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  color: var(--muted);
  letter-spacing: 0.01em;
}

.cb-sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.cb-sidebar-footer #cb-user-area {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  z-index: 600;
}

.cb-sidebar-footer #cb-user-badge {
  white-space: normal;
  font-size: 0.8rem;
  line-height: 1.3;
}
.cb-user-badge-line {
  display: block;
}
.cb-user-badge-email {
  font-weight: 600;
}
.cb-user-badge-plan {
  color: rgba(255, 255, 255, 0.75);
}
.cb-user-badge-tokens {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.75rem;
}

.cb-sidebar-footer .user-avatar-button {
  width: 42px;
  height: 42px;
}

.cb-sidebar-footer .cb-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 200px;
  background: rgba(15, 23, 42, 0.98);
  display: none;
  flex-direction: column;
  z-index: 1000;
}

.cb-sidebar-footer .cb-user-menu.is-open {
  display: flex;
}

.cb-sidebar-footer .cb-user-menu.is-floating {
  position: fixed;
  top: var(--cb-user-menu-top, auto);
  left: var(--cb-user-menu-left, auto);
  transform: none;
  width: var(--cb-user-menu-width, 220px);
  max-height: min(320px, calc(100vh - 24px));
}

.cb-sidebar[data-collapsed="true"] {
  width: 84px;
}

.cb-sidebar[data-collapsed="true"] .cb-sidebar-label,
.cb-sidebar[data-collapsed="true"] .cb-sidebar-pill,
.cb-sidebar[data-collapsed="true"] .cb-sidebar-logo-label,
.cb-sidebar[data-collapsed="true"] .cb-sidebar-section-header,
.cb-sidebar[data-collapsed="true"] #cb-user-badge {
  display: none;
}

.cb-sidebar[data-collapsed="true"] .cb-sidebar-icon {
  margin: 0 auto;
}

.cb-sidebar[data-collapsed="true"] .cb-sidebar-footer #cb-user-area {
  align-items: center;
  position: relative;
}

body.cb-sidebar-collapsed #cb-user-badge {
  display: none;
}


.cb-sidebar[data-collapsed="true"] .cb-sidebar-footer .cb-user-menu:not(.is-floating) {
  left: calc(100% + 12px);
  top: calc(50% - 10px);
  transform: translateY(-50%);
  width: 220px;
}

.cb-sidebar[data-collapsed="true"] .cb-sidebar-toggle svg {
  transform: rotate(180deg);
}

@media (max-width: 1024px) {
  body.cb-shell-active {
    --cb-sidebar-offset: 120px;
  }

body.cb-shell-active .cb-sidebar {
    width: 240px;
    overflow: visible;
  }

  body.cb-shell-active.cb-sidebar-collapsed .cb-sidebar {
    width: 58px;
  }

  body.cb-shell-active .chat-wrapper {
    padding: 16px 20px 0;
  }
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.top-bar-left {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.top-bar-logo {
  width: 44px;
  height: auto;
  display: block;
  opacity: 0.95;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.35));
}

.top-bar-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.top-bar-right {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  opacity: 0.85;
  overflow: visible;
}

.top-bar-right #cb-user-area {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

#cb-user-badge {
  font-size: 0.75rem;
  opacity: 0.85;
  white-space: nowrap;
}

.cb-main-tabs {
  display: flex;
  gap: 10px;
  margin: 12px 0 20px;
  flex-wrap: wrap;
}

.cb-main-tab {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: transparent;
  color: inherit;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.cb-main-tab.is-active {
  border-color: rgba(59, 130, 246, 0.7);
  background: rgba(59, 130, 246, 0.15);
}

.cb-main-view {
  display: none;
  min-height: 0;
}

.cb-main-view.is-active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.cb-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 8px 0;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 0.85rem;
  display: none;
  flex-direction: column;
  z-index: 4000;
}

@media (max-width: 640px) {
  .cb-user-menu {
    position: fixed;
    top: 72px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 5000;
  }
}

/* Tablet / small desktop adjustments */
@media (max-width: 900px) {
  .cb-sidebar {
    width: 56px;
  }

  .cb-app-main {
    margin-left: 56px;
  }

  .chat-container {
    max-width: none;
    margin-left: 0;
  }
}

.cb-user-menu.is-floating {
  right: auto;
  left: var(--cb-user-menu-left, auto);
  top: var(--cb-user-menu-top, auto);
  width: var(--cb-user-menu-width, 220px);
  max-height: min(320px, calc(100vh - 24px));
  overflow-y: auto;
}

.cb-user-menu.is-open {
  display: flex;
}

.cb-user-menu-item {
  width: 100%;
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.cb-user-menu-item:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #fff;
}

.cb-user-menu-plan-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 12px 4px;
}

.cb-user-menu-plan-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

#cb-user-menu-name {
  font-weight: 600;
  font-size: 0.95rem;
}

#cb-user-menu-plan-short {
  color: rgba(226, 232, 240, 0.8);
}

.cb-user-menu-pill-btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.cb-user-menu-pill-btn:hover {
  border-color: rgba(59, 130, 246, 0.7);
  color: #fff;
  background: rgba(59, 130, 246, 0.16);
}

.cb-user-plan-tokens {
  font-size: 12px;
  color: rgba(226, 232, 240, 0.75);
}

.cb-user-menu-divider {
  height: 1px;
  margin: 6px 0;
  background: rgba(148, 163, 184, 0.3);
}

#cb-token-limit-banner {
  margin: 12px 0 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--text);
  font-size: 0.85rem;
}

#cb-token-limit-banner p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cb-upgrade-button {
  border: 1px solid rgba(95, 225, 207, 0.7);
  background: transparent;
  color: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.cb-upgrade-button:hover {
  background: rgba(95, 225, 207, 0.2);
  color: #0f172a;
}

.cb-upgrade-error {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: #f87171;
}

.user-usage {
  display: flex;
  flex-direction: column;
  text-align: right;
  line-height: 1.2;
}

.user-plan-label {
  font-weight: 600;
}

.user-tokens-label {
  font-weight: 400;
}

.user-avatar-button {
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.user-avatar-button:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.user-avatar-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.user-avatar-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  position: relative;
}

.user-avatar-icon::before,
.user-avatar-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.85);
}

.user-avatar-icon::before {
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.user-avatar-icon::after {
  bottom: 4px;
  width: 14px;
  height: 7px;
  border-radius: 999px 999px 0 0;
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: 1000px;
  align-self: center;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  flex: 1;
  min-height: 0;
}

.chat-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 4px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.chat-body::-webkit-scrollbar {
  width: 10px;
}

.chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.chat-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.level-banner {
  padding: 12px 16px;
  background: rgba(95, 225, 207, 0.1);
  border: 1px solid rgba(95, 225, 207, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.level-banner[hidden] {
  display: none;
}

.level-pill {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-soft);
}

.level-mode {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text);
}

.level-unlock {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.reasoning-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.reasoning-badge {
  font-size: 0.75rem;
  color: var(--muted);
}

.reasoning-badge[data-state="active"] {
  color: var(--accent-soft);
}

.reasoning-badge[data-state="processing"] {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.reasoning-badge[data-state="error"] {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.campaign-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1001;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.campaign-modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.campaign-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.campaign-modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--text);
}

.campaign-modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.campaign-modal-close:hover {
  color: var(--text);
}

.campaign-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.campaign-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.campaign-form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.campaign-form-group input,
.campaign-form-group select,
.campaign-form-group textarea {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.8);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

.campaign-form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.campaign-form-group input:focus,
.campaign-form-group select:focus,
.campaign-form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.campaign-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.campaign-form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

.btn-secondary {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
}

.btn-primary {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, rgba(95, 225, 207, 0.95), rgba(59, 130, 246, 0.9));
  color: #04121f;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.cb-btn-danger {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.cb-btn-danger:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.campaign-error {
  color: #ef4444;
  font-size: 0.85rem;
  padding: 10px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.campaign-results {
  padding: 24px;
}

.campaign-results-header h3 {
  margin: 0 0 16px 0;
  font-size: 1.2rem;
  color: var(--text);
}

.campaign-results-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.campaign-plan {
  padding: 16px;
  background: rgba(30, 41, 59, 0.5);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  line-height: 1.6;
  color: var(--text);
}

.campaign-cost {
  padding: 12px;
  background: rgba(95, 225, 207, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(95, 225, 207, 0.2);
  color: var(--accent-soft);
  font-size: 0.95rem;
}

.campaign-disclaimer {
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

.campaign-results-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.top-logo {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 52px;
  opacity: 0.9;
  z-index: 1000;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-strong);
}

button {
  font: inherit;
}

/* === Layout === */
.page-shell {
  width: min(640px, 92%);
  margin: 0 auto;
  min-height: 100vh;
  padding: 64px 0 32px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.site-header {
  display: flex;
  justify-content: center;
}

.logo {
  width: 96px;
  opacity: 0.92;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.45));
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}

.hero-copy h1 {
  font-size: clamp(2.5rem, 4vw, 3rem);
  margin: 0;
  letter-spacing: -0.02em;
}

.hero-copy .subtitle {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 1.1rem;
}

.query-form {
  width: 100%;
  display: flex;
  align-items: stretch;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.query-form input {
  flex: 1;
  padding: 1.25rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.05rem;
}

.query-form input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.query-form input:focus {
  outline: none;
}

.query-form button {
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 600;
  padding: 0 2rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.query-form button:hover:not(:disabled) {
  background: #1e9b79;
  color: #fff;
}

.query-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* === Detail pages === */
.detail-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-card h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.2rem);
  line-height: 1.2;
}

.detail-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: var(--accent);
}

.cta-button {
  align-self: flex-start;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: none;
}

.cta-button:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
  color: var(--text);
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--muted);
}

/* === Chat Shell === */
.chat-shell {
  display: flex;
  flex-direction: column;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - 220px);
}

/* === Chat Header === */
.chat-header {
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chat-header h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.chat-subtitle {
  color: var(--muted);
  margin: 0;
  font-size: 0.7rem;
}

.chat-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(95, 225, 207, 0.15);
  color: var(--accent-soft);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reasoning-status {
  margin: 0;
}

.reasoning-chip {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.reasoning-chip[data-state='active'] {
  background: rgba(79, 236, 182, 0.2);
  color: #9fffd6;
}

.cb-guest-hint {
  margin: 16px 0;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  text-align: center;
  opacity: 0.85;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cb-guest-hint-button {
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.cb-guest-hint-button:hover {
  border-color: #ffffff;
  color: #ffffff;
}

/* === Messages === */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.chat-message {
  padding: 14px 18px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 0.95rem;
  word-break: break-word;
  white-space: normal;
  max-width: 70%;
  animation: messageSlideIn 0.3s ease-out;
}

.chat-message h1,
.chat-message h2,
.chat-message h3,
.chat-message h4,
.chat-message h5,
.chat-message h6 {
  margin: 0 0 8px;
  line-height: 1.25;
  font-weight: 600;
}

.chat-message p {
  margin: 0 0 8px;
}

.chat-message p:last-child,
.chat-message ul:last-child,
.chat-message ol:last-child,
.chat-message blockquote:last-child,
.chat-message pre:last-child {
  margin-bottom: 0;
}

.chat-message ul,
.chat-message ol {
  margin: 8px 0;
  padding-left: 1.25rem;
}

.chat-message li + li {
  margin-top: 4px;
}

.chat-message blockquote {
  margin: 12px 0;
  padding-left: 12px;
  border-left: 3px solid rgba(59, 130, 246, 0.4);
  opacity: 0.9;
}

.chat-message code {
  font-family: 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  background: rgba(15, 23, 42, 0.12);
  padding: 0.05rem 0.35rem;
  border-radius: 6px;
  font-size: 0.9em;
}

.chat-message.bot code {
  background: rgba(255, 255, 255, 0.18);
}

.chat-message pre {
  margin: 8px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.2);
  font-family: 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  overflow-x: auto;
}

.chat-message.bot pre {
  background: rgba(15, 23, 42, 0.25);
  border-color: rgba(255, 255, 255, 0.25);
}

.chat-message a {
  color: inherit;
  text-decoration: underline;
  word-break: break-word;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.user {
  align-self: flex-start;
  background: rgba(200, 248, 240, 0.12);
  border: 1px solid rgba(200, 248, 240, 0.2);
  color: var(--accent-soft);
}

.chat-message.bot {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(99, 102, 241, 0.85));
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.chat-message.system {
  align-self: center;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--border);
  font-size: 0.85rem;
  max-width: 90%;
}

.chat-composer {
  position: relative;
  width: 100%;
  background: rgba(17, 24, 39, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px 14px 18px 18px;
  padding: 12px 20px 16px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
  max-width: 1000px;
  align-self: center;
  width: 100%;
  margin-top: 20px;
  margin-bottom: 12px;
  z-index: 50;
}

.chat-composer form {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: 100%;
}

.cb-composer-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.cb-composer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

#cb-composer textarea,
#cb-composer #chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 96px;
  padding: 8px 12px;
  line-height: 1.3;
  border-radius: var(--radius-md);
}

.cb-composer-addon,
#cb-composer .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  flex: 0 0 44px;
}

.cb-composer-addon {
  background: var(--cb-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cb-composer-addon:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.45);
}

.cb-composer-addon:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.5);
}

.cb-composer-addon[data-has-selection="true"] {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(56, 189, 248, 0.7);
}

.cb-composer-addon[data-has-selection="true"] .cb-council-plus {
  color: #e5f3ff;
}

.cb-council-plus {
  display: block;
  font-size: 1.4rem;
  font-weight: 600;
  color: #dbeafe;
  line-height: 1;
  transform: translateY(-1px);
}

.cb-composer-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 10px 25px rgba(15, 23, 42, 0.6);
}

.cb-composer-send-icon {
  width: 14px;
  height: 18px;
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.cb-composer-send-icon::before {
  content: "";
  width: 2px;
  height: 12px;
  background: #0f172a;
  border-radius: 1px;
}

.cb-composer-send-icon::after {
  content: "";
  width: 10px;
  height: 10px;
  border-top: 2px solid #0f172a;
  border-right: 2px solid #0f172a;
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%) rotate(-45deg);
  border-radius: 1px;
}

.cb-council-active {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cb-council-item-badge {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(96, 165, 250, 0.9);
}

.cb-council-pill-clear,
.chat-composer .cb-council-pill-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: none;
  background: transparent;
  color: rgba(248, 250, 252, 0.35);
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1;
  padding: 0;
  transition: color 0.15s ease;
  min-width: auto;
  min-height: auto;
  box-shadow: none;
}

.cb-council-pill-clear:hover {
  color: rgba(248, 113, 113, 0.95);
}

.chat-composer input[type="text"] {
  flex: 1;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.8);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease, background 0.2s ease;
  height: 48px;
}

.chat-composer input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(30, 41, 59, 1);
}

.chat-composer input[type="text"]::placeholder {
  color: var(--muted);
}

.composer-form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-composer textarea {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.8);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  resize: none;
  transition: border-color 0.2s ease, background 0.2s ease;
  min-height: 44px;
  line-height: 1.35;
  overflow-y: hidden;
}

.chat-composer textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(30, 41, 59, 1);
}

.chat-composer textarea::placeholder {
  color: var(--muted);
}

.chat-composer button {
  background: linear-gradient(135deg, var(--accent), #3b82f6);
  color: #000;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(95, 225, 207, 0.3);
}

.chat-composer button:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-hover), #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(95, 225, 207, 0.4);
}


#cb-council-active,
.cb-council-active {
  transition: opacity 0.2s ease;
}

.cb-council-enabled #cb-council-active,
.cb-council-enabled .cb-council-active {
  display: none !important;
}

#cb-council-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 0 8px;
  flex-shrink: 0;
}

.cb-attach-wrapper {
  position: relative;
}

.cb-attach-button {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, var(--accent), #43ff9f);
  color: #020817;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.cb-attach-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(67, 255, 159, 0.25);
}

.cb-attach-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 250px;
  margin-bottom: 8px;
  padding: 6px 0;
  border-radius: 16px;
  background: #050b18;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  display: none;
  z-index: 30;
}

.cb-attach-menu.is-open {
  display: block;
}

.cb-attach-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: background 0.15s ease;
}

.cb-attach-menu-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.cb-attach-menu-icon {
  width: 18px;
  text-align: center;
  opacity: 0.85;
}

.cb-council-chip {
  min-width: 40px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 11, 24, 0.9);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
}

.cb-council-chip.cb-council-off {
  opacity: 0.65;
}

.cb-council-chip.cb-council-on {
  opacity: 1;
  background: linear-gradient(90deg, #10b981, #3b82f6);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e5f2ff;
}

.cb-council-dropdown {
  display: none;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(10, 16, 32, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  max-width: 100%;
  backdrop-filter: blur(10px);
}

.cb-council-dropdown.is-open {
  display: block;
}

.cb-council-dropdown-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
  width: 100%;
}

.cb-council-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: background 0.15s ease, border 0.15s ease, transform 0.1s ease;
  min-height: 38px;
}

.cb-council-option:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.cb-council-option.is-active {
  background: linear-gradient(120deg, #1bd4ff, #43ff9f);
  color: #020817;
  border-color: transparent;
}

.cb-council-option-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
}

.cb-council-option[data-status="pending"] .cb-council-option-badge::after {
  content: " •";
  opacity: 0.8;
}

.cb-council-option[data-status="ack"] .cb-council-option-badge::after {
  content: " ✓";
  color: #0f5132;
  font-weight: 700;
}

.cb-council-option[data-status="error"] .cb-council-option-badge::after {
  content: " !";
  color: #b91c1c;
  font-weight: 700;
}

.cb-council-dropdown-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.cb-council-action {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border 0.15s ease;
}

.cb-council-action:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
}

.cb-council-chip[data-status="pending"]::after {
  content: "•";
  margin-left: 6px;
  font-size: 12px;
  opacity: 0.7;
}

.cb-council-chip[data-status="ack"]::after {
  content: "✓";
  margin-left: 6px;
  font-size: 12px;
  color: #4ade80;
}

.cb-council-chip[data-status="error"]::after {
  content: "!";
  margin-left: 6px;
  font-size: 12px;
  color: #fb7185;
}

#cb-council-button {
  display: none;
}

.cb-message-council {
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.cb-message-council-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.9);
}

.cb-message-council-count {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.35);
  color: #e0f2fe;
}

.cb-message-council-grid {
  display: grid;
  gap: 8px;
}

.cb-message-council-card-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
  color: rgba(226, 232, 240, 0.98);
}

.cb-message-council-card-body {
  font-size: 12px;
  color: rgba(209, 213, 219, 0.9);
}

.cb-council-decision {
  padding: 14px 18px;
  border-radius: 18px;
  background: #050b18;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.cb-council-decision-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
  margin-bottom: 6px;
}

.cb-council-decision-verdict {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.cb-council-decision-subtitle {
  font-size: 12px;
  opacity: 0.8;
  margin-bottom: 4px;
}

.cb-council-decision-risks {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  opacity: 0.9;
}

.chat-composer button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chat-error {
  color: #ef4444;
  font-size: 0.8rem;
  margin-top: 8px;
  margin-bottom: 0;
}

.chat-error[hidden] {
  display: none;
}

.composer-error {
  position: fixed;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  background: #dc2626;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 998;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
  animation: errorSlideIn 0.3s ease-out;
}

@keyframes errorSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 768px) {
  .cb-composer-inner {
    gap: 6px;
  }
  #cb-composer textarea {
    min-height: 56px;
  }
}

/* === Climate Badge === */
.climate-badge {
  position: fixed;
  bottom: 210px;
  left: calc(50% + var(--cb-sidebar-offset, 0px));
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.3);
  z-index: 997;
  display: flex;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  white-space: nowrap;
}

.climate-badge .climate-leaf {
  font-size: 0.9rem;
  opacity: 0.6;
}

/* === Footer === */
.chat-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(11, 11, 12, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 4px 0;
  z-index: 996;
  text-align: center;
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.2;
}

.chat-footer a {
  color: rgba(95, 225, 207, 0.6);
  text-decoration: none;
  transition: color 0.2s ease;
}

.chat-footer a:hover {
  color: var(--accent);
}

.chat-footer p {
  margin: 0;
  position: relative;
  left: calc(50% + var(--cb-sidebar-offset, 0px));
  transform: translateX(-50%);
  width: min(90vw, 820px);
}

/* === Footer === */
.site-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.site-footer p {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.leaf-icon {
  color: var(--accent);
}

.footer-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  color: rgba(255, 255, 255, 0.5);
}

.footer-nav a {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.2s ease;
}

.footer-nav a:hover {
  color: #fff;
}

.footer-nav span {
  color: rgba(255, 255, 255, 0.35);
}

body.footer-overlay-open {
  overflow: hidden;
}

.footer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 12, 24, 0.85);
  backdrop-filter: blur(4px);
  z-index: 1400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.footer-overlay.is-open {
  display: flex;
}

.footer-overlay-panel {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: hidden;
  background: rgba(12, 17, 32, 0.97);
  border-radius: 18px;
  padding: 24px 28px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  outline: none;
}

.footer-overlay-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.footer-overlay-body {
  overflow-y: auto;
  padding-right: 6px;
  flex: 1;
  font-size: 0.95rem;
  color: rgba(229, 231, 235, 0.95);
}

.footer-overlay-body p {
  line-height: 1.5;
}

.footer-overlay-close {
  position: absolute;
  right: 16px;
  top: 14px;
  border: none;
  background: transparent;
  color: rgba(248, 250, 252, 0.8);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.footer-overlay-close:hover {
  color: #5fe1cf;
}

.footer-overlay-actions {
  text-align: right;
  margin-top: 6px;
}

.footer-overlay-loading,
.footer-overlay-error {
  font-size: 0.9rem;
  margin: 0;
}

.footer-overlay-error {
  color: #f87171;
}

.btn:hover {
  background-color: #2bdac8;
  color: #000;
  filter: brightness(1.05);
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  justify-content: center;
  text-align: center;
}

.chat-suggestions[data-enabled="false"] {
  display: none;
}

.suggestions-heading {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 10px 0;
  font-weight: 500;
  text-align: center;
  width: 100%;
}

.suggestion-button,
.prompt-chip {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.suggestion-button:hover,
.prompt-chip:hover {
  background: rgba(95, 225, 207, 0.15);
  border-color: var(--accent);
  color: var(--accent-soft);
  transform: translateY(-1px);
}

.user-overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 16px;
}

.user-overlay {
  max-width: 420px;
  width: 100%;
  background: rgba(15, 23, 42, 0.97);
  border-radius: 1rem;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.user-overlay h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

.user-overlay p {
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.user-overlay ol {
  padding-left: 1.25rem;
  margin: 0 0 1rem;
}

.user-overlay ol li {
  margin-bottom: 0.35rem;
}

.user-overlay-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.cb-onboarding-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cb-onboarding-label {
  font-size: 13px;
  opacity: 0.85;
}

.cb-onboarding-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 14px;
}

.cb-onboarding-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.cb-onboarding-error {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #f87171;
}

.cb-modal-actions {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

body.cb-modal-open {
  overflow: hidden;
}

.cb-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1300;
  padding: 24px;
}

.cb-modal-backdrop[hidden] {
  display: none !important;
}

.cb-modal {
  background: #050814;
  border-radius: 16px;
  padding: 20px 24px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.cb-council-popover-backdrop {
  align-items: flex-end;
  justify-content: center;
}

.cb-council-popover {
  max-width: 520px;
  width: 100%;
}

.cb-council-popover .cb-modal {
  padding: 16px 18px;
}

.cb-council-header {
  padding-bottom: 6px;
}

.cb-council-body {
  padding-top: 4px;
}

.cb-council-subtitle {
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.8);
}

.cb-council-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cb-council-item {
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.cb-council-item:hover {
  background: rgba(30, 64, 175, 0.9);
  border-color: rgba(56, 189, 248, 0.8);
  transform: translateY(-1px);
}

.cb-council-item.is-selected {
  border-color: rgba(56, 189, 248, 0.9);
  background: rgba(37, 99, 235, 0.25);
}

.cb-council-item-role {
  font-size: 0.88rem;
  font-weight: 600;
}

.cb-council-item-desc {
  font-size: 0.82rem;
  color: rgba(226, 232, 240, 0.85);
}

.cb-council-item-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(96, 165, 250, 0.9);
}

.cb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cb-modal-title {
  font-size: 18px;
  font-weight: 600;
}

.cb-modal-close {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.cb-modal-body {
  font-size: 14px;
  line-height: 1.5;
}

.cb-modal-section {
  margin-bottom: 16px;
}

.cb-modal-label {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cb-modal-value {
  font-size: 14px;
}

.cb-modal-note {
  font-size: 0.85rem;
  color: rgba(229, 231, 235, 0.65);
  margin: 4px 0 0;
}

.cb-modal-primary-button {
  margin-top: 8px;
  width: 100%;
}

.cb-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  gap: 12px;
}

.cb-settings-row:last-child {
  border-bottom: none;
}

.cb-settings-row-text {
  flex: 1;
}

.cb-account-panel-modal {
  width: min(960px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.cb-account-panel-modal::-webkit-scrollbar {
  width: 8px;
}

.cb-account-panel-modal::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

.cb-account-panel-modal::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.cb-account-panel-modal::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

.cb-account-panel-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 8px;
}

.cb-account-card {
  background: rgba(15, 23, 42, 0.85);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.cb-account-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cb-account-plan-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cb-account-plan-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.cb-account-plan-price {
  font-weight: 500;
  font-size: 1rem;
  opacity: 0.85;
}

.cb-account-plan-status {
  font-size: 0.95rem;
  color: rgba(226, 232, 240, 0.85);
}

.cb-account-plan-next-charge {
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.9);
}

.cb-account-plan-message {
  font-size: 0.85rem;
  color: rgba(248, 250, 252, 0.85);
}

.cb-account-plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cb-account-tokens-progress {
  margin-top: 8px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.cb-account-tokens-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--cb-accent-color, #38bdf8);
  transition: width 0.3s ease;
}

.cb-account-tokens-warning {
  color: #f87171;
  font-size: 0.85rem;
}

.cb-account-limits-list {
  list-style: none;
  margin: 0;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cb-plan-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .cb-plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.cb-plan-card {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 16px 18px;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cb-plan-card.is-current {
  border-color: var(--cb-accent-color, #38bdf8);
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.45);
}

.cb-plan-card.is-highlighted {
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.cb-plan-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.cb-plan-card-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.cb-plan-price {
  margin: 0;
  font-weight: 600;
}

.cb-plan-bullets {
  margin: 12px 0;
  padding-left: 20px;
  line-height: 1.5;
}

.cb-plan-badge {
  font-size: 0.85rem;
  color: #a5f3fc;
}

.cb-plan-card-action {
  margin-top: auto;
}

.cb-plan-current-pill {
  width: 100%;
  border-radius: 999px;
  padding: 10px;
  text-transform: uppercase;
  font-size: 0.85rem;
  background: rgba(148, 163, 184, 0.2);
  border: 1px solid transparent;
  color: rgba(226, 232, 240, 0.8);
}

.cb-plan-select-btn {
  width: 100%;
}

@media (max-width: 768px) {
  .cb-account-panel-modal {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 16px 14px;
  }
  .cb-account-panel-body {
    gap: 10px;
  }
}

.cb-account-footer-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

.cb-account-footer-btn {
  flex: 1;
  text-align: center;
}

.cb-settings-toggle {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: none;
  cursor: pointer;
  position: relative;
  padding: 0;
  transition: background 0.2s ease;
}

.cb-settings-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease-out;
}

.cb-settings-toggle.is-on {
  background: linear-gradient(90deg, #42e9ff, #6a7dff);
}

.cb-settings-toggle.is-on .cb-settings-toggle-thumb {
  transform: translateX(16px);
}

.legal-document {
  text-align: left;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.legal-document h2 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.4rem;
  color: var(--text);
}

.legal-document h3 {
  font-size: 1.05rem;
  margin: 1rem 0 0.35rem;
  color: var(--text);
}

.legal-document ul {
  padding-left: 1.2rem;
  margin: 0.5rem 0 0.75rem;
  list-style: disc;
}

.legal-document li {
  margin-bottom: 0.35rem;
}

.legal-updated {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}



.user-overlay-popover {
  min-width: 220px;
  background: rgba(15, 23, 42, 0.97);
  border-radius: 0.75rem;
  padding: 0.75rem 0.9rem;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.45);
  z-index: 1205;
}

.user-menu-header {
  margin-bottom: 0.5rem;
}

.user-menu-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.user-menu-plan {
  font-size: 0.8rem;
  opacity: 0.75;
}

.user-menu-section {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.user-menu-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.user-menu-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  cursor: pointer;
  color: inherit;
}

.user-menu-item:hover {
  color: var(--accent-soft);
}

#cb-onboarding-modal {
  display: none;
}

#cb-onboarding-modal.is-open {
  display: flex;
}

/* === Responsive === */
@media (max-width: 960px) {
  .chat-wrapper {
    padding: 12px 12px 0 12px;
  }

  body.cb-shell-active .chat-wrapper {
    padding: 12px 12px 0 12px;
  }

  .chat-container {
    border-radius: 20px;
    box-shadow: none;
  }

  .chat-panel {
    padding: 18px;
  }

  .chat-message {
    max-width: min(100%, 640px);
  }

  .climate-badge {
    font-size: 0.65rem;
    bottom: 200px;
  }

  .climate-badge svg {
    width: 12px;
    height: 12px;
  }

  .chat-suggestions {
    justify-content: flex-start;
  }

  .suggestion-button,
  .prompt-chip {
    white-space: normal;
    text-align: left;
  }

  body.cb-mobile .chat-composer form {
    flex-direction: column;
    gap: 10px;
  }

  body.cb-mobile .chat-composer button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .chat-header {
    padding: 6px 16px;
  }

  .chat-header h1 {
    font-size: 1rem;
  }

  .chat-subtitle {
    font-size: 0.65rem;
  }

  .chat-pills {
    gap: 6px;
  }

  .chat-message {
    max-width: 100%;
    font-size: 0.9rem;
  }

  .chat-composer textarea {
    font-size: 0.95rem;
  }

  .chat-composer button {
    padding: 12px 20px;
  }

  .user-usage {
    display: none;
  }

  .top-logo {
    width: 44px;
    top: 16px;
    left: 16px;
  }

  .climate-badge {
    font-size: 0.6rem;
    bottom: 180px;
  }

  .chat-footer {
    font-size: 0.6rem;
    padding: 3px 12px;
  }

  .climate-badge {
    font-size: 0.6rem;
    bottom: 105px;
  }

  .climate-badge svg {
    width: 11px;
    height: 11px;
  }
}

#cb-agents-view {
  height: 100%;
}

.cb-agents-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.cb-agents-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 280px;
  gap: 16px;
  height: 100%;
}

.cb-agents-sidebar,
.cb-agents-main,
.cb-agents-registry {
  display: flex;
  flex-direction: column;
}

.cb-agents-title {
  font-size: 14px;
  font-weight: 600;
}

.cb-agents-desc,
.cb-agents-footnote {
  font-size: 12px;
  color: var(--cb-text-muted, #9ca3af);
}

.cb-agents-run-btn {
  margin-top: 16px;
  width: 100%;
}

.cb-agents-card {
  height: 100%;
  overflow: hidden;
}

.cb-card-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.cb-card-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cb-card-subtitle {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cb-text-muted, #9ca3af);
  margin-bottom: 4px;
}

.cb-empty {
  font-size: 12px;
  color: var(--cb-text-muted, #9ca3af);
}

.cb-runs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cb-run-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.cb-run-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cb-run-agent {
  font-family: var(--cb-font-mono, monospace);
  font-size: 11px;
}

.cb-run-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 10px;
  color: var(--cb-text-muted, #9ca3af);
}

.cb-run-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.cb-run-tool {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
}

.cb-run-status {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

.cb-run-status--ok {
  background: rgba(16, 185, 129, 0.15);
  color: #22c55e;
}

.cb-run-status--err {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.cb-agent-card {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.9);
}

.cb-agent-card--soon {
  opacity: 0.5;
}

.cb-agent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cb-agent-label {
  font-size: 11px;
  font-weight: 600;
}

.cb-agent-role {
  font-size: 10px;
  color: var(--cb-text-muted, #9ca3af);
}

.cb-agent-tag {
  font-size: 10px;
  font-family: var(--cb-font-mono, monospace);
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
}

.cb-agent-meta {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 10px;
}

.cb-agent-meta span {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
}

.cb-agent-apply {
  background: rgba(16, 185, 129, 0.15);
  color: #22c55e;
}

.cb-agent-tools {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cb-agent-tool {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
}

@media (max-width: 1100px) {
  .cb-agents-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .cb-agents-registry {
    grid-column: 1 / -1;
  }
}

@media (max-width: 540px) {
  .page-shell {
    padding: 48px 0 24px;
  }

  .detail-card {
    padding: 1.75rem;
  }

  .query-form button {
    padding: 0 1.25rem;
  }
}

/* Mobile-specific overrides for chat/layout */
@media (max-width: 640px) {
  .cb-user-menu {
    position: fixed;
    top: 56px;
    right: 12px;
    left: 12px;
    width: calc(100vw - 24px);
    max-width: 480px;
    margin: 0 auto;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 12000;
  }

  .cb-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 56px;
    z-index: 3000;
  }

  .cb-sidebar-scroll {
    overflow-y: auto;
    max-height: calc(100vh - 80px);
    padding-right: 0;
  }

  .cb-app-main {
    margin-left: 56px;
  }

  .chat-wrapper {
    height: auto;
    max-height: none;
    padding: 8px 12px 120px 12px;
  }

  body.cb-shell-active .chat-wrapper {
    padding: 8px 12px 120px 12px;
  }

  .chat-container {
    max-width: none;
    margin-bottom: 12px;
    margin-left: 0;
  }

  .chat-body {
    overflow-y: auto;
  }

  .chat-messages {
    overflow: visible;
  }

.cb-council-has-selection [data-role="cb-council-count"] {
  opacity: 1;
}

.cb-council-has-selection [data-role="cb-council-count"] {
  opacity: 1;
}

