:root {
  --primary: #00738f;
  --foreground: #060606;
  --ink: #060606;
  --secondary-100: #180f08;
  --espresso: #180f08;
  --secondary-200: #3d2e24;
  --cocoa: #3d2e24;
  --secondary-300: #6b5a50;
  --muted: #6b5a50;
  --secondary-400: #cbc0b6;
  --quiet: #cbc0b6;
  --secondary-500: #eae2dc;
  --sand: #eae2dc;
  --secondary-600: #f1ece7;
  --border: #f1ece7;
  --secondary-700: #f5f1ee;
  --oat: #f5f1ee;
  --secondary-800: #f9f6f3;
  --mist: #f9f6f3;
  --secondary-850: #fbf8f5;
  --whisper: #fbf8f5;
  --secondary-900: #fefdfb;
  --canvas: #fefdfb;
  --secondary-950: #f4f1ee;
  --warning: #de9b4a;
  --sidebar-width: 260px;
  --sidebar-collapsed: 56px;
  --transition: 200ms ease-out;
}

*, *::before, *::after { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }

body {
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--secondary-900);
  color: var(--foreground);
  font-family: IDGrotesk, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { border: 0; margin: 0; padding: 0; background: transparent; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }

:where(button, a, [contenteditable="true"]):focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr);
  min-height: 100dvh;
  transition: grid-template-columns 260ms cubic-bezier(.32,.72,0,1);
}
.app-shell[data-sidebar="expanded"] { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-collapsed);
  height: 100dvh;
  max-height: 100dvh;
  flex-direction: column;
  overflow: visible;
  border-right: 1px solid var(--secondary-600);
  background: var(--secondary-900);
  pointer-events: auto;
  transition: width 260ms cubic-bezier(.32,.72,0,1), background-color 260ms cubic-bezier(.32,.72,0,1);
}
/* Keep explicit pointer targets available within the rail. */
.sidebar button,
.sidebar a,
.sidebar [role="dialog"],
.sidebar [contenteditable],
.sidebar .rail-flyout-wrap { pointer-events: auto; }
.app-shell[data-sidebar="collapsed"] .sidebar-spacer { cursor: pointer; }
.app-shell[data-sidebar="expanded"] .sidebar {
  width: var(--sidebar-width);
  background: var(--secondary-700);
  pointer-events: auto;
}
.app-shell[data-sidebar="expanded"] .sidebar-expanded-header,
.app-shell[data-sidebar="expanded"] .rail-nav-primary {
  flex: 0 0 auto;
}

.logo-button {
  position: relative;
  display: flex;
  width: calc(100% - 20px);
  height: 36px;
  flex: 0 0 36px;
  align-items: center;
  gap: 12px;
  margin: 10px;
  padding: 0 5px;
  border-radius: 12px;
  overflow: hidden;
  white-space: nowrap;
}
.logo-button:hover { background: var(--secondary-800); }
.cropus-logo { display: block; width: 26px; height: 26px; flex: 0 0 26px; background: transparent; object-fit: contain; transition: opacity 100ms; }
.open-sidebar-icon { position: absolute; left: 8px; width: 20px; height: 20px; opacity: 0; transition: opacity 100ms; }
.logo-button:hover .cropus-logo { opacity: 0; }
.logo-button:hover .open-sidebar-icon { opacity: 1; }

/* Expanded sidebar header: brand + Search + close icons */
.sidebar-expanded-header { display: none; align-items: center; justify-content: space-between; padding: 10px 10px 6px; }
.app-shell[data-sidebar="expanded"] .sidebar-expanded-header { display: flex; }
.app-shell[data-sidebar="expanded"] .logo-button { display: none; }
.app-shell[data-sidebar="expanded"] .rail-search-item { display: none; }
.sidebar-brand { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.sidebar-brand img { display: block; width: 26px; height: 26px; flex: 0 0 26px; background: transparent; object-fit: contain; }
.sidebar-brand strong { color: var(--secondary-100); font-size: 15px; font-weight: 500; letter-spacing: -.1px; }
.sidebar-header-actions { display: flex; align-items: center; gap: 4px; }
.sidebar-header-icon {
  position: relative;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  color: var(--secondary-100);
  transition: background-color 140ms;
}
.sidebar-header-icon:hover { background: var(--secondary-700); }
.sidebar-header-icon svg { width: 16px; height: 16px; stroke-width: 1.1; }

.header-tooltip {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  z-index: 70;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border: 1px solid rgba(61, 46, 36, 0.07);
  border-radius: 10px;
  background: var(--secondary-900);
  box-shadow: 0 4px 16px rgba(24, 15, 8, 0.08), 0 1px 3px rgba(24, 15, 8, 0.04);
  color: var(--secondary-100);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -0.1px;
  line-height: 18px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -4px);
  transition: opacity 140ms ease, transform 140ms ease;
  white-space: nowrap;
}
.header-tooltip-label { color: var(--secondary-100); }
.header-tooltip-key {
  color: var(--secondary-300);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.3px;
}
.sidebar-header-icon:hover .header-tooltip,
.sidebar-header-icon:focus-visible .header-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.rail-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.rail-nav-secondary { margin-top: 8px; }

/* Flyout panels for collapsed sidebar */
.rail-flyout-wrap { position: relative; }
.rail-flyout {
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);
  z-index: 50;
  width: 280px;
  overflow: hidden;
  border: 1px solid rgba(61,46,36,.07);
  border-radius: 16px;
  background: rgba(254,253,251,.98);
  box-shadow: 0 12px 32px rgba(24,15,8,.1), 0 2px 6px rgba(24,15,8,.04);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}
.rail-flyout::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -14px;
  width: 16px;
}
.app-shell:not([data-sidebar="expanded"]) .rail-flyout-wrap.is-open .rail-flyout {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}
.app-shell[data-sidebar="expanded"] .rail-flyout { display: none; }
.rail-flyout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}
.rail-flyout-header strong { color: var(--secondary-100); font-size: 15px; font-weight: 500; }
.rail-flyout-add {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  color: var(--secondary-200);
  transition: background-color 140ms, color 140ms;
}
.rail-flyout-add:hover { background: var(--secondary-700); color: var(--secondary-100); }
.rail-flyout-add svg { width: 16px; height: 16px; stroke-width: 1.6; }
.rail-flyout-empty { margin: 0; padding: 8px 16px 20px; color: var(--secondary-400); font-size: 14px; line-height: 20px; text-align: center; }
.explore-flyout { width: 232px; padding: 5px; }
.explore-flyout-item {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  color: var(--secondary-100);
  font-size: 15px;
  font-weight: 400;
  line-height: 22px;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}
.explore-flyout-item:hover {
  background: var(--secondary-700);
}
.explore-flyout-item svg,
.atelier-edit-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.explore-flyout-item svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.2;
}
.explore-flyout-wrap.is-open .explore-flyout {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}
.app-shell[data-sidebar="expanded"] .explore-flyout { display: block; }
.rail-action, .profile-button {
  position: relative;
  display: flex;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  border-radius: 12px;
  overflow: hidden;
  color: var(--secondary-100);
  white-space: nowrap;
  transition: width var(--transition), background-color 140ms, color 140ms;
}
.rail-action:hover, .profile-button:hover, .rail-action.is-active { background: var(--secondary-700); }
.rail-action svg { width: 16px; height: 16px; flex: 0 0 16px; }
.rail-action.is-active svg { stroke-width: 1.35; }
.rail-label { opacity: 0; font-size: 14px; font-weight: 400; transition: opacity 100ms; }
.brand-label { font-weight: 500; }
.app-shell[data-sidebar="expanded"] .rail-action, .app-shell[data-sidebar="expanded"] .profile-button { width: 240px; }
.app-shell[data-sidebar="expanded"] .rail-label { opacity: 1; }
.app-shell[data-sidebar="expanded"] .rail-action:hover,
.app-shell[data-sidebar="expanded"] .profile-button:hover,
.app-shell[data-sidebar="expanded"] .rail-action.is-active,
.app-shell[data-sidebar="expanded"] .profile-button[aria-expanded="true"] {
  background: #ece3dd;
}
.app-shell[data-sidebar="expanded"] .sidebar-header-icon:hover {
  background: #ece3dd;
}

/* Browse section: visible only when sidebar is expanded */
.sidebar-browse { display: none; flex-direction: column; padding: 12px 10px 0; }
.app-shell[data-sidebar="expanded"] .sidebar-browse {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.app-shell[data-sidebar="expanded"] .rail-nav-secondary { display: none; }
.sidebar-browse-button {
  display: flex;
  width: 100%;
  height: 32px;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--secondary-300);
  font-size: 15px;
  font-weight: 500;
  line-height: 22px;
  cursor: pointer;
  transition: color 140ms, background-color 140ms;
}
.sidebar-browse-button:hover { background: var(--secondary-800); color: var(--secondary-100); }
.app-shell[data-sidebar="expanded"] .sidebar-browse-button:hover { background: #ece3dd; color: var(--secondary-100); }
.sidebar-browse-chevron {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transform-origin: center;
  transition: transform 180ms ease;
}
.sidebar-browse-chevron.is-down { transform: rotate(90deg); }
.sidebar-projects-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  flex: 0 0 auto;
}
.sidebar-browse-button#historyToggle,
#historyToggle {
  flex: 0 0 auto;
}
.sidebar-projects-heading .sidebar-browse-button {
  min-width: 0;
  flex: 1;
}
.sidebar-project-add {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  margin-left: 2px;
  place-items: center;
  border-radius: 8px;
  color: var(--secondary-100);
  opacity: 0;
  transition: opacity 140ms ease, color 140ms ease, background-color 140ms ease;
}
.sidebar-project-add svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-projects-heading:hover .sidebar-project-add,
.sidebar-projects-heading:focus-within .sidebar-project-add { opacity: 1; }
.sidebar-project-add:hover { background: var(--secondary-800); }
.app-shell[data-sidebar="expanded"] .sidebar-project-add:hover { background: #ece3dd; }

/* New project dialog */
.project-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 170;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background: rgba(254, 253, 251, .56);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out, visibility 0s linear 200ms;
  visibility: hidden;
}
.project-dialog-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
  visibility: visible;
}
.project-dialog {
  width: min(640px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  border: 1px solid rgba(61, 46, 36, .08);
  border-radius: 20px;
  background: rgba(254, 253, 251, .985);
  box-shadow: 0 18px 42px rgba(24, 15, 8, .13), 0 2px 6px rgba(24, 15, 8, .05);
  color: var(--secondary-100);
  transform: translateY(8px) scale(.985);
  transition: transform 200ms ease-out;
}
.project-dialog-overlay.is-open .project-dialog { transform: translateY(0) scale(1); }
.project-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 22px 0;
}
.project-dialog-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid var(--secondary-600);
  border-radius: 14px;
  background: var(--secondary-850);
  color: var(--secondary-100);
}
.project-dialog-mark svg { width: 22px; height: 22px; stroke-width: 1.3; }
.project-dialog-close {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: var(--secondary-300);
  transition: color 140ms ease, background-color 140ms ease;
}
.project-dialog-close:hover { background: var(--secondary-700); color: var(--secondary-100); }
.project-dialog-close svg { width: 16px; height: 16px; stroke-width: 1.35; }
.project-dialog-body { padding: 20px 22px 22px; }
.project-dialog-title { margin: 0; color: var(--secondary-100); font-size: 22px; font-weight: 500; line-height: 28px; letter-spacing: -.2px; }
.project-dialog-description { margin: 4px 0 24px; color: var(--secondary-300); font-size: 16px; line-height: 24px; }
.project-field-label, .project-template-fieldset legend {
  display: block;
  margin: 0 0 8px;
  padding: 0;
  color: var(--secondary-200);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}
.project-dialog-input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--secondary-600);
  border-radius: 14px;
  outline: none;
  background: var(--secondary-700);
  color: var(--secondary-100);
  font-size: 16px;
  line-height: 24px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.project-dialog-input::placeholder { color: var(--secondary-300); opacity: 1; }
.project-dialog-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0, 115, 143, .14); }
.project-template-fieldset { min-width: 0; margin: 24px 0 0; padding: 0; border: 0; }
.project-template-list { display: flex; flex-wrap: wrap; gap: 8px; }
.project-template {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--secondary-600);
  border-radius: 12px;
  background: transparent;
  color: var(--secondary-200);
  font-size: 14px;
  line-height: 20px;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}
.project-template:hover, .project-template.is-selected { border-color: var(--secondary-500); background: var(--secondary-800); color: var(--secondary-100); }
.project-template svg { width: 16px; height: 16px; flex: 0 0 16px; stroke-width: 1.25; }
.project-dialog-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 22px; }
.project-dialog-action {
  min-height: 44px;
  border: 1px solid var(--secondary-600);
  border-radius: 14px;
  color: var(--secondary-200);
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}
.project-dialog-cancel { background: transparent; }
.project-dialog-cancel:hover { background: var(--secondary-800); color: var(--secondary-100); }
.project-dialog-create { border-color: var(--secondary-100); background: var(--secondary-100); color: #fff; }
.project-dialog-create:not(:disabled):hover { background: var(--secondary-200); border-color: var(--secondary-200); }
.project-dialog-create:disabled { border-color: var(--secondary-500); background: var(--secondary-500); color: var(--secondary-900); cursor: default; }
.sidebar-projects-panel { display: grid; gap: 2px; padding: 6px 0 14px; }
.sidebar-projects-panel[hidden] { display: none; }
.sidebar-project-item {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--secondary-200);
  font-size: 15px;
  font-weight: 500;
  line-height: 22px;
  text-align: left;
  transition: color 140ms ease, background-color 140ms ease;
}
.sidebar-project-item:hover { background: var(--secondary-800); color: var(--secondary-100); }
.app-shell[data-sidebar="expanded"] .sidebar-project-item:hover { background: #ece3dd; }
.sidebar-project-icon { display: grid; width: 16px; height: 16px; flex: 0 0 16px; place-items: center; }
.sidebar-project-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-project-chats {
  margin: 0;
  padding: 0 10px 4px 36px;
  color: var(--secondary-300);
  font-size: 15px;
  font-weight: 500;
  line-height: 22px;
}
.sidebar-project-chats[hidden] { display: none; }
.sidebar-projects-panel {
  flex: 0 0 auto;
  max-height: 140px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--secondary-600) transparent;
}
.sidebar-projects-panel::-webkit-scrollbar {
  width: 4px;
}
.sidebar-projects-panel::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-projects-panel::-webkit-scrollbar-thumb {
  background: var(--secondary-600);
  border-radius: 999px;
}
.sidebar-projects-empty {
  margin: 0;
  padding: 0 10px;
  color: var(--secondary-300);
  font-size: 15px;
  font-weight: 400;
  line-height: 22px;
  text-align: left;
}
.sidebar-history-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--secondary-600) transparent;
}
.sidebar-history-panel[hidden] { display: none; }

.sidebar-history-panel::-webkit-scrollbar {
  width: 5px;
}
.sidebar-history-panel::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-history-panel::-webkit-scrollbar-thumb {
  background: var(--secondary-600);
  border-radius: 999px;
}
.sidebar-history-panel::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-500);
}

.sidebar-empty-text {
  margin: 0;
  padding: 12px 10px 16px;
  color: var(--secondary-300);
  font-size: 14.5px;
  font-weight: 400;
  line-height: 20px;
  text-align: center;
}

.sidebar-spacer { flex: 1; min-height: 18px; }
.app-shell[data-sidebar="expanded"] .sidebar-spacer {
  display: none;
}

.sidebar-footer {
  position: relative;
  z-index: 10;
  display: flex;
  width: 100%;
  box-sizing: border-box;
  flex: 0 0 auto;
  flex-direction: column;
  border-top: 1px solid var(--border-soft, #f1ece7);
  background: var(--secondary-700, #f5f1ee);
  margin-top: auto;
}

.app-shell[data-sidebar="expanded"] .sidebar-footer {
  padding: 12px 10px;
}

.app-shell[data-sidebar="collapsed"] .sidebar-footer {
  padding: 10px 0;
}

.sidebar-footer-row {
  display: flex;
  width: 100%;
  align-items: center;
}

/* Narrow / collapsed rail state */
.app-shell[data-sidebar="collapsed"] .sidebar-footer-row {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 36px;
  margin: 0 auto;
}

.app-shell[data-sidebar="collapsed"] .profile-pill-button {
  order: 3;
  width: 36px !important;
  height: 36px !important;
  flex: 0 0 36px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  justify-content: center !important;
  background: transparent !important;
  border: none !important;
}

.app-shell[data-sidebar="collapsed"] .profile-pill-button:hover,
.app-shell[data-sidebar="collapsed"] .profile-pill-button[aria-expanded="true"] {
  background: var(--secondary-700) !important;
}

.app-shell[data-sidebar="collapsed"] .profile-pill-name {
  display: none;
}

.app-shell[data-sidebar="collapsed"] .sidebar-notifications-btn {
  order: 2;
  width: 36px !important;
  height: 36px !important;
  flex: 0 0 36px !important;
}

.app-shell[data-sidebar="collapsed"] .sidebar-get-app-btn {
  order: 1;
  width: 36px !important;
  height: 36px !important;
  flex: 0 0 36px !important;
}

/* Wide / expanded sidebar state */
.app-shell[data-sidebar="expanded"] .sidebar-footer-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
}

.profile-pill-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 3px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(24, 15, 8, 0.08);
  color: var(--secondary-100);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.app-shell[data-sidebar="expanded"] .profile-pill-button {
  order: 1;
  width: auto !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: calc(100% - 80px) !important;
}

.app-shell[data-sidebar="expanded"] .profile-pill-button:hover,
.app-shell[data-sidebar="expanded"] .profile-pill-button[aria-expanded="true"] {
  background: #ece3dd;
  border-color: rgba(24, 15, 8, 0.12);
}

.profile-pill-name {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  color: var(--secondary-100);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.profile-photo {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: transparent;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* Small circular icon buttons in footer */
.sidebar-footer-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px !important;
  height: 36px !important;
  flex: 0 0 36px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  border: 1px solid rgba(24, 15, 8, 0.08) !important;
  background: transparent;
  color: var(--secondary-100);
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.app-shell[data-sidebar="collapsed"] .sidebar-footer-btn {
  border: none !important;
}

.sidebar-footer-btn:hover {
  background: #ece3dd;
  border-color: rgba(24, 15, 8, 0.12) !important;
  color: var(--secondary-100);
}

.sidebar-footer-btn:focus:not(:focus-visible),
.profile-pill-button:focus:not(:focus-visible) {
  outline: none;
}

.sidebar-footer-btn:focus-visible,
.profile-pill-button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.sidebar-footer-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.25;
}

.sidebar-footer-btn.is-active,
.sidebar-footer-btn[aria-expanded="true"] {
  background: #ece3dd;
  border-color: rgba(24, 15, 8, 0.12) !important;
  color: var(--secondary-100);
}

.app-shell[data-sidebar="expanded"] .sidebar-notifications-btn {
  order: 2;
}

.app-shell[data-sidebar="expanded"] .sidebar-get-app-btn {
  order: 3;
}


.app-download-card {
  position: absolute;
  bottom: 84px;
  left: calc(var(--sidebar-collapsed) + 8px);
  z-index: 60;
  width: min(336px, calc(100vw - 72px));
  max-height: calc(100dvh - 30px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(61, 46, 36, 0.08);
  border-radius: 22px;
  background: rgba(254, 253, 251, 0.985);
  box-shadow: 0 16px 40px rgba(24, 15, 8, 0.13), 0 2px 8px rgba(24, 15, 8, 0.05);
  color: var(--secondary-100);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px) scale(0.985);
  transform-origin: bottom left;
  transition: left 260ms cubic-bezier(.32,.72,0,1), opacity 160ms cubic-bezier(.32,.72,0,1), transform 160ms cubic-bezier(.32,.72,0,1), visibility 0s linear 160ms;
  visibility: hidden;
}

.app-shell[data-sidebar="expanded"] .app-download-card {
  left: calc(var(--sidebar-width) + 8px);
}

.app-download-card.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
  visibility: visible;
}

.app-download-card.is-open::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -14px;
  width: 14px;
  pointer-events: auto;
}

.app-download-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 180px;
  border-radius: 16px;
  background: var(--secondary-700);
  border: 1px solid rgba(61, 46, 36, 0.06);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.app-download-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  display: block;
}

.app-download-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 4px 0;
}

.app-download-title {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.35;
  color: #180f08;
  letter-spacing: -0.2px;
}

.app-download-desc {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--secondary-300);
}

.app-download-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 2px 0;
}

.app-download-btn {
  display: flex;
  width: 100%;
  height: 44px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 140ms, transform 120ms, border-color 140ms, box-shadow 140ms;
}

.app-download-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.app-download-btn-primary {
  background: #180f08;
  color: #ffffff;
  border: none;
}
.app-download-btn-primary:hover {
  background: #2b1d14;
  transform: translateY(-1px);
}
.app-download-btn-primary:active {
  transform: translateY(0);
}

.app-download-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
  padding: 3px 8px 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  color: rgba(254, 253, 251, 0.94);
  letter-spacing: 0.01em;
}

.app-download-badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 2px rgba(222, 155, 74, 0.25);
  animation: soon-pulse 2.4s ease-in-out infinite;
}

.app-download-btn-secondary {
  background: #faf7f4;
  color: #180f08;
  border: 1px solid rgba(61, 46, 36, 0.12);
}
.app-download-btn-secondary:hover {
  background: #f1ece7;
  border-color: rgba(61, 46, 36, 0.22);
  transform: translateY(-1px);
}
.app-download-btn-secondary:active {
  transform: translateY(0);
}

.profile-menu {
  position: absolute;
  bottom: 0;
  left: calc(100% - 4px);
  z-index: 60;
  width: min(272px, calc(100vw - 64px));
  max-height: calc(100dvh - 20px);
  overflow: visible;
  padding: 12px 8px 8px;
  border: 1px solid rgba(61,46,36,.07);
  border-radius: 16px;
  background: rgba(254,253,251,.985);
  box-shadow: 0 14px 36px rgba(24,15,8,.13), 0 2px 6px rgba(24,15,8,.05);
  color: var(--secondary-100);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px) scale(.985);
  transform-origin: bottom left;
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms;
  visibility: hidden;
}
.app-shell[data-sidebar="expanded"] .profile-menu { bottom: 46px; left: 10px; width: min(272px, calc(100vw - 20px)); }
.profile-menu.is-open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); transition-delay: 0s; visibility: visible; }
.profile-menu-header { display: flex; align-items: center; gap: 8px; padding: 0 4px 10px; }
.profile-card-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  overflow: hidden;
  place-items: center;
  border-radius: 50%;
  background: #1c2325;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}
.profile-card-avatar.avatar-initials, .profile-photo.avatar-initials {
  color: #fff;
  line-height: 1;
}
.profile-identity { display: grid; min-width: 0; gap: 1px; }
.profile-identity strong { overflow: hidden; color: var(--secondary-100); font-size: 16px; font-weight: 500; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; }
.profile-identity span { overflow: hidden; color: var(--secondary-300); font-size: 13px; line-height: 18px; text-overflow: ellipsis; white-space: nowrap; }
.profile-credits { padding: 12px; border-radius: 14px; background: var(--secondary-700); }
.profile-credits-summary { display: flex; min-height: 20px; align-items: center; gap: 8px; }
.profile-credits-summary strong { font-size: 16px; font-weight: 500; line-height: 20px; }
.profile-credit-count { margin-left: auto; font-size: 14px; line-height: 20px; }
.profile-menu-icon { display: grid; width: 18px; height: 18px; flex: 0 0 18px; place-items: center; color: var(--secondary-200); }
.profile-menu-icon svg { width: 18px; height: 18px; stroke-width: 1.35; }
.profile-credit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.profile-usage-button, .profile-upgrade-button { min-height: 36px; border-radius: 12px; font-size: 14px; font-weight: 500; transition: background-color 140ms, color 140ms, opacity 140ms; }
.profile-usage-button { border: 1px solid var(--secondary-500); background: var(--secondary-900); color: var(--secondary-100); }
.profile-usage-button:hover { background: var(--secondary-850); }
.profile-upgrade-button { background: var(--secondary-100); color: #fff; }
.profile-upgrade-button:hover { background: var(--secondary-200); }
.profile-menu-actions { display: grid; gap: 2px; margin: 12px 0 4px; }
.profile-menu-action {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  gap: 12px;
  padding: 6px;
  border-radius: 9px;
  color: var(--secondary-200);
  font-size: 14px;
  line-height: 20px;
  text-align: left;
  transition: background-color 140ms, color 140ms;
}
.profile-menu-action:hover { background: var(--secondary-700); color: var(--secondary-100); }
.profile-menu-action .profile-menu-icon { margin-left: 2px; }
.profile-reward { margin-left: auto; padding: 3px 7px; border-radius: 999px; background: var(--secondary-500); color: var(--secondary-200); font-size: 10px; line-height: 14px; white-space: nowrap; }
.profile-action-chevron { width: 14px; height: 14px; margin-left: auto; color: var(--secondary-200); stroke-width: 1.4; }
.profile-external-icon { margin-right: 1px; }
.profile-help-row, .profile-appearance-row { position: relative; }
.profile-help-row::after, .profile-appearance-row::after { position: absolute; top: -8px; left: 100%; width: 8px; height: calc(100% + 16px); content: ""; }
.profile-help-trigger[aria-expanded="true"], .profile-help-row:hover .profile-help-trigger,
.profile-appearance-trigger[aria-expanded="true"], .profile-appearance-row:hover .profile-appearance-trigger { background: var(--secondary-500); color: var(--secondary-100); }
.help-menu, .appearance-menu {
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  z-index: 70;
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid rgba(61,46,36,.07);
  border-radius: 16px;
  background: rgba(254,253,251,.985);
  box-shadow: 0 10px 28px rgba(24,15,8,.13), 0 2px 6px rgba(24,15,8,.05);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-4px) scale(.985);
  transform-origin: left center;
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms;
  visibility: hidden;
}
.help-menu { width: 240px; }
.help-menu.is-open,
.appearance-menu.is-open { opacity: 1; pointer-events: auto; transform: translateY(-50%) translateX(0) scale(1); transition-delay: 0s; visibility: visible; }
.help-menu-option, .appearance-menu-option {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 9px;
  color: var(--secondary-200);
  font-size: 14px;
  line-height: 20px;
  text-align: left;
  transition: background-color 120ms ease, color 120ms ease;
}
.help-menu-option:hover, .help-menu-option:focus-visible,
.appearance-menu-option:hover, .appearance-menu-option:focus-visible { background: var(--secondary-800); color: var(--secondary-100); }
.help-menu-option:focus-visible, .appearance-menu-option:focus-visible { outline-offset: -2px; }
.help-menu-option svg, .appearance-menu-option svg { width: 18px; height: 18px; flex: 0 0 18px; stroke-width: 1.35; }
.discord-brand-mark { display: grid; width: 18px; height: 18px; flex: 0 0 18px; place-items: center; border-radius: 5px; background: #5865f2; }
.discord-brand-mark img { display: block; width: 14px; height: auto; }
.academy-icon { stroke-width: 1.6 !important; }
.help-menu-divider { height: 1px; margin: 4px 0; background: var(--secondary-600); }
.help-coming-soon-dot { width: 4px; height: 4px; margin-left: auto; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 2px rgba(222,155,74,.13); }
.appearance-menu-option.is-selected { background: var(--secondary-500); color: var(--secondary-100); }
.appearance-selected-dot { width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: var(--foreground); }
.profile-menu-divider { height: 1px; margin: 4px 0; background: var(--secondary-600); }
.profile-log-out { color: #d95656; }
.profile-log-out .profile-menu-icon { color: currentColor; }
.profile-log-out:hover { background: rgba(217,86,86,.08); color: #c44343; }

.main-content { grid-column: 2; min-width: 0; min-height: 100dvh; background: var(--secondary-900); }
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; height: 56px; align-items: center; padding: 0 12px 0 16px; }
.topbar-left, .topbar-right { display: flex; align-items: center; }
.topbar-left { position: relative; grid-column: 1; }
.topbar-right { justify-content: flex-end; grid-column: 3; }
.topbar-account-group { display: flex; align-items: center; }
.topbar-avatar-mount { display: inline-flex; align-items: center; margin-left: 8px; }
.topbar-avatar-mount:empty { display: none; }
.topbar-profile-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  padding: 2px;
  border: 1px solid var(--secondary-600);
  border-radius: 50%;
  background: var(--secondary-900);
  transition: background-color 140ms ease, border-color 140ms ease;
}
.topbar-profile-avatar:hover { border-color: var(--secondary-500); background: var(--secondary-800); }
.topbar-profile-avatar:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.topbar-profile-avatar-photo {
  display: grid;
  width: 26px;
  height: 26px;
  overflow: hidden;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}

/* Active Chat: Hide Build/Grow Mode Toggle in Topbar */
.app-shell.is-chat-active .topbar .mode-toggle,
.topbar.is-chat-active .mode-toggle,
.main-content:has(.workspace.is-chat-active) .topbar .mode-toggle {
  display: none !important;
}

.outline-pill {
  position: relative;
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(0,0,0,.05);
  border-radius: 999px;
  color: var(--secondary-200);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 140ms;
}
.outline-pill:hover { background: var(--secondary-800); }

.soon-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 2px rgba(222,155,74,.13);
  animation: soon-pulse 2.4s ease-in-out infinite;
}

.outline-pill[data-coming-soon]::after {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 40;
  padding: 5px 9px;
  border: 1px solid var(--secondary-600);
  border-radius: 999px;
  background: rgba(254,253,251,.96);
  box-shadow: 0 8px 24px rgba(24,15,8,.08);
  color: var(--secondary-300);
  content: "Coming soon";
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -3px);
  transition: opacity 160ms ease, transform 160ms ease;
  white-space: nowrap;
}

.outline-pill[data-coming-soon]:hover::after,
.outline-pill[data-coming-soon]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }

.sidebar .coming-soon-trigger { overflow: visible; }

.sidebar .coming-soon-trigger::after {
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  z-index: 40;
  padding: 5px 9px;
  border: 1px solid var(--secondary-600);
  border-radius: 999px;
  background: rgba(254,253,251,.96);
  box-shadow: 0 8px 24px rgba(24,15,8,.08);
  color: var(--secondary-300);
  content: "Coming soon";
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-3px, -50%);
  transition: opacity 160ms ease, transform 160ms ease;
  white-space: nowrap;
}

.sidebar .coming-soon-trigger:hover::after,
.sidebar .coming-soon-trigger:focus-visible::after { opacity: 1; transform: translate(0, -50%); }

.coming-soon-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 100;
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 8px 13px 8px 9px;
  border: 1px solid var(--secondary-600);
  border-radius: 999px;
  background: rgba(254,253,251,.96);
  box-shadow: 0 12px 36px rgba(24,15,8,.1);
  color: var(--secondary-200);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px) scale(.98);
  transition: opacity 180ms ease, transform 180ms ease;
  white-space: nowrap;
}
.coming-soon-toast.is-visible { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast-spark { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: rgba(222,155,74,.1); color: var(--warning); }
.toast-spark svg { width: 12px; height: 12px; fill: currentColor; stroke: none; }

@keyframes soon-pulse {
  0%, 100% { opacity: .5; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1); }
}

.mode-toggle { position: relative; display: inline-flex; height: 32px; align-items: center; border-radius: 999px; background: var(--secondary-500); }
.active-pill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 79px;
  border: .5px solid rgba(0,0,0,.05);
  border-radius: 999px;
  background: var(--secondary-900);
  transition: transform var(--transition), width var(--transition);
}
.mode-toggle[data-active="Grow"] .active-pill { width: 80px; transform: translateX(79px); }
.mode-button { position: relative; z-index: 1; display: flex; height: 32px; align-items: center; gap: 6px; padding: 0 12px; color: var(--secondary-300); font-size: 14px; font-weight: 500; }
.mode-button:first-of-type { width: 78.742px; }
.mode-button:last-of-type { width: 80.297px; }
.mode-button.is-active { color: var(--secondary-200); }
.mode-button svg { width: 16px; height: 16px; }

.credits-pill {
  display: flex;
  height: 32px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(222,155,74,.12);
  border-radius: 999px;
  background: rgba(222,155,74,.08);
  color: #bd8440;
  font-size: 14px;
}
.credits-pill svg { width: 16px; height: 16px; }

.workspace { min-height: calc(100dvh - 56px); overflow: hidden; }
.workspace-container { width: min(100%, 672px); margin: 0 auto; padding: 32px 16px; }
.hero-stack { display: flex; height: 43dvh; flex-direction: column; align-items: center; justify-content: flex-end; }

.plan-pill {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--secondary-800);
  color: var(--secondary-200);
  font-size: 14px;
  transition: background-color 140ms;
}
.plan-pill:hover { background: var(--secondary-700); }
.plan-pill svg { width: 14px; height: 14px; fill: var(--secondary-400); stroke: none; }
.plan-pill strong { color: var(--primary); font-weight: 400; }

.title-wrap { display: flex; height: 40px; align-items: center; justify-content: center; margin-bottom: 32px; }
.title-wrap h1 {
  margin: 0;
  background: linear-gradient(180deg, var(--secondary-200), rgba(61,46,36,.75));
  background-clip: text;
  color: transparent;
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -.319px;
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 2px 12px var(--secondary-950);
  white-space: nowrap;
}

.composer-stack { position: relative; width: 100%; }
.composer {
  position: relative;
  z-index: 2;
  min-height: 114px;
  padding: 12px;
  border: 1px solid var(--secondary-700);
  border-radius: 16px;
  background: #fff;
  transition: border-color var(--transition);
}
.composer:focus-within { border-color: var(--secondary-500); }
.editor-wrap { position: relative; padding-bottom: 8px; }
.editor-placeholder { position: absolute; inset: 0; z-index: 1; pointer-events: none; color: var(--secondary-400); font-size: 16px; line-height: 24px; }
.message-editor { position: relative; z-index: 2; width: 100%; min-height: 54px; max-height: 200px; overflow-y: auto; outline: none; color: var(--foreground); font-size: 16px; line-height: 24px; }
.composer.has-value .editor-placeholder { display: none; }

.composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -6px -6px; }
.toolbar-group { display: flex; align-items: center; gap: 4px; }
.toolbar-group-right { margin-left: auto; }
.icon-control, .dictate-button, .send-button { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: var(--secondary-300); transition: color 140ms, background-color 140ms, box-shadow 140ms; }
.icon-control:hover, .text-control:hover { color: var(--foreground); background: rgba(0,0,0,.03); }
.icon-control svg, .dictate-button svg, .send-button svg { width: 16px; height: 16px; }
.text-control { display: inline-flex; height: 32px; align-items: center; gap: 6px; padding: 0 10px; border-radius: 999px; color: var(--secondary-300); font-size: 14px; font-weight: 500; transition: color 140ms, background-color 140ms; }
.text-control > svg:first-child { width: 16px; height: 16px; }
.agent-mode-current-icon { stroke-width: 1.4; }
.text-control .chevron { width: 14px; height: 14px; opacity: .7; }
.model-control { padding-inline: 8px; }
.agent-mode-picker { position: relative; }
.agent-control[aria-expanded="true"] { background: var(--secondary-700); color: var(--secondary-200); }
.agent-control[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.agent-control .chevron { transition: transform 160ms ease; }

.agent-mode-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: 256px;
  padding: 6px 6px 0;
  border: 1px solid rgba(61,46,36,.07);
  border-radius: 13px;
  background: rgba(254,253,251,.985);
  box-shadow: 0 10px 28px rgba(24,15,8,.13), 0 2px 6px rgba(24,15,8,.05);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(.985);
  transform-origin: top left;
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms;
  visibility: hidden;
}
.agent-mode-menu.is-open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); visibility: visible; }
.agent-mode-options { display: grid; gap: 2px; }
.agent-mode-option {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 54px;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  column-gap: 10px;
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--secondary-300);
  text-align: left;
  transition: background-color 120ms ease, color 120ms ease;
}
.agent-mode-option:hover, .agent-mode-option:focus-visible { background: var(--secondary-800); color: var(--secondary-100); }
.agent-mode-option.is-selected { background: var(--secondary-500); color: var(--secondary-100); }
.agent-mode-option:focus-visible { outline-offset: -2px; }
.agent-mode-icon { width: 20px; height: 20px; margin-top: 1px; color: var(--secondary-300); stroke-width: 1.4; }
.agent-mode-copy { display: grid; min-width: 0; gap: 1px; }
.agent-mode-copy strong { color: var(--secondary-100); font-size: 16px; font-weight: 500; line-height: 20px; }
.agent-mode-copy small { overflow: hidden; color: var(--secondary-300); font-size: 13px; font-weight: 400; line-height: 18px; text-overflow: ellipsis; white-space: nowrap; }
.agent-mode-selected { position: absolute; top: 50%; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--foreground); opacity: 0; transform: translateY(-50%); }
.agent-mode-option.is-selected .agent-mode-selected { opacity: 1; }
.agent-mode-shortcut { display: flex; height: 36px; align-items: center; gap: 3px; margin-top: 4px; padding: 0 12px; border-top: 1px solid var(--secondary-600); color: var(--secondary-400); font-size: 13px; }
.agent-mode-shortcut span { margin-right: 5px; }
.agent-mode-shortcut kbd { min-width: 12px; padding: 0; border: 0; background: transparent; color: var(--secondary-300); font-family: inherit; font-size: 14px; line-height: 1; }
.dictate-button { position: relative; background: var(--secondary-700); color: var(--secondary-100); }
.dictate-button:hover { background: var(--secondary-600); }
.dictate-button:disabled { cursor: not-allowed; opacity: .48; }
.dictate-button:focus-visible, .send-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.dictation-mic-wrap { position: relative; display: grid; }
.dictation-mic-wrap[data-tooltip]::after { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 12; width: max-content; max-width: 220px; padding: 5px 9px; border: 1px solid rgba(61,46,36,.07); border-radius: 10px; background: rgba(254,253,251,.96); box-shadow: 0 8px 18px rgba(24,15,8,.08); color: var(--secondary-200); content: attr(data-tooltip); font-size: 12px; line-height: 18px; opacity: 0; pointer-events: none; transform: translateY(3px); transition: opacity 160ms ease, transform 160ms ease; }
.dictation-mic-wrap[data-tooltip]:hover::after, .dictation-mic-wrap[data-tooltip]:focus-within::after { opacity: 1; transform: translateY(0); }
.composer.is-dictating .dictate-button { background: var(--secondary-500); box-shadow: 0 0 0 2px rgba(0,115,143,.16); }
.composer.is-dictating .dictate-button::after { position: absolute; top: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); content: ""; animation: dictation-pulse 1.4s ease-in-out infinite; }
.send-button { display: none; background: var(--secondary-100); color: #fff; }
.send-button:hover { background: var(--secondary-200); }
.send-button .send-icon { display: block; }
.composer.has-value .send-button { display: grid; }
.send-button.is-streaming { display: grid; }
.dictation-feedback { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 12; max-width: min(320px, calc(100vw - 32px)); margin: 0; padding: 5px 9px; border: 1px solid rgba(61,46,36,.07); border-radius: 10px; background: rgba(254,253,251,.96); box-shadow: 0 8px 18px rgba(24,15,8,.08); color: var(--secondary-200); font-size: 12px; line-height: 18px; }
@keyframes dictation-pulse { 0%, 100% { opacity: .45; transform: scale(.82); } 50% { opacity: 1; transform: scale(1); } }

.context-strip {
  position: relative;
  z-index: 1;
  display: flex;
  height: 40px;
  align-items: center;
  gap: 4px;
  margin: -8px 8px 0;
  padding: 12px 8px 4px;
  border-radius: 0 0 16px 16px;
  background: var(--secondary-700);
}
.context-project-wrap { position: relative; display: inline-flex; }
.context-control { display: inline-flex; height: 24px; align-items: center; gap: 8px; padding: 0 8px; border-radius: 999px; color: var(--secondary-100); font-size: 14px; transition: background-color 140ms; cursor: pointer; border: none; background: transparent; }
.context-control:first-child { min-width: 145.141px; width: auto; max-width: 240px; }
.context-control:hover { background: rgba(0,0,0,.035); }
.context-control svg { width: 16px; height: 16px; flex-shrink: 0; }
.context-control span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Project Picker Dropdown */
.project-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  width: 250px;
  padding: 6px;
  border: 1px solid rgba(61,46,36,.07);
  border-radius: 13px;
  background: rgba(254,253,251,.985);
  box-shadow: 0 10px 28px rgba(24,15,8,.13), 0 2px 6px rgba(24,15,8,.05);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.project-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--secondary-400);
}
.project-dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
}
.project-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  background: none;
  border: none;
  font-size: 13.5px;
  color: var(--secondary-100);
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}
.project-dropdown-item:hover {
  background: var(--secondary-800);
}
.project-dropdown-item.is-selected {
  background: var(--secondary-500);
  font-weight: 500;
}
.project-dropdown-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-dropdown-item-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary, #00738f);
}
.project-dropdown-empty {
  padding: 10px 8px;
  font-size: 12px;
  color: var(--secondary-300);
  text-align: center;
}
.project-dropdown-create-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px 2px;
  border-top: 1px solid rgba(61,46,36,.06);
  margin-top: 4px;
}
.project-dropdown-create-input {
  flex: 1;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--secondary-500);
  background: #fff;
  font-size: 12.5px;
  color: var(--secondary-100);
  outline: none;
}
.project-dropdown-create-input:focus {
  border-color: var(--primary, #00738f);
}
.project-dropdown-create-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  background: var(--secondary-200);
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}
.project-dropdown-create-btn:hover {
  background: var(--secondary-100);
}

/* Search Modal Overlay */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(254, 253, 251, 0.56);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out, visibility 0s linear 200ms;
  visibility: hidden;
}
.search-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
  visibility: visible;
}
.search-modal {
  display: flex;
  flex-direction: column;
  width: min(580px, calc(100vw - 32px));
  height: 380px;
  max-height: calc(100dvh - 64px);
  border: 1px solid rgba(61, 46, 36, 0.08);
  border-radius: 18px;
  background: var(--secondary-850);
  box-shadow: 0 20px 50px rgba(24, 15, 8, 0.12), 0 2px 8px rgba(24, 15, 8, 0.04);
  color: var(--secondary-100);
  overflow: hidden;
  transform: translateY(8px) scale(0.985);
  transition: transform 200ms ease-out;
}
.search-overlay.is-open .search-modal {
  transform: translateY(0) scale(1);
}
.search-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(61, 46, 36, 0.06);
}
.search-modal-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--secondary-300);
  stroke-width: 1.2;
}
.search-modal-input {
  flex: 1;
  min-width: 0;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--secondary-100);
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  line-height: 22px;
  caret-color: var(--primary);
  outline: none;
}
.search-modal-input::placeholder {
  color: var(--secondary-300);
  opacity: 0.7;
}
.search-modal-esc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border: 1px solid rgba(61, 46, 36, 0.12);
  border-radius: 6px;
  background: rgba(254, 253, 251, 0.7);
  color: var(--secondary-300);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.4px;
  line-height: 16px;
  cursor: pointer;
  transition: background-color 140ms, color 140ms, border-color 140ms;
}
.search-modal-esc:hover {
  background: var(--secondary-600);
  color: var(--secondary-100);
  border-color: rgba(61, 46, 36, 0.2);
}
.search-modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
}
.search-modal-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.search-modal-empty-icon {
  width: 24px;
  height: 24px;
  color: var(--secondary-400);
  stroke-width: 1.15;
}
.search-modal-empty-text {
  color: var(--secondary-300);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.1px;
}
.search-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid rgba(61, 46, 36, 0.05);
}
.search-modal-hint {
  display: flex;
  align-items: center;
  gap: 6px;
}
.search-modal-key-combo,
.search-modal-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px 5px;
  border: 1px solid rgba(61, 46, 36, 0.12);
  border-radius: 5px;
  background: rgba(254, 253, 251, 0.6);
  color: var(--secondary-300);
}
.search-modal-key-combo svg,
.search-modal-key svg {
  width: 9px;
  height: 9px;
  stroke-width: 1.3;
}
.search-modal-hint-label {
  color: var(--secondary-300);
  font-size: 12px;
  font-weight: 400;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(254,253,251,.56);
  backdrop-filter: blur(7px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out, visibility 0s linear 200ms;
  visibility: hidden;
}
.settings-overlay.is-open { opacity: 1; pointer-events: auto; transition-delay: 0s; visibility: visible; }
.settings-dialog {
  display: grid;
  width: min(920px, 100%);
  height: min(690px, calc(100dvh - 64px));
  max-height: min(690px, calc(100dvh - 64px));
  grid-template-columns: 224px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(61,46,36,.07);
  border-radius: 20px;
  background: rgba(254,253,251,.985);
  box-shadow: 0 18px 42px rgba(24,15,8,.13), 0 2px 6px rgba(24,15,8,.05);
  color: var(--secondary-100);
  transform: translateY(8px) scale(.985);
  transition: transform 200ms ease-out;
}
.settings-overlay.is-open .settings-dialog { transform: translateY(0) scale(1); }
.settings-sidebar { display: flex; min-width: 0; flex-direction: column; padding: 16px 10px 12px; border-right: 1px solid var(--secondary-600); background: var(--secondary-850); }
.settings-nav-group { display: grid; gap: 2px; margin-bottom: 16px; }
.settings-nav-heading { padding: 0 8px 4px; color: var(--secondary-400); font-size: 12px; line-height: 18px; }
.settings-nav-item, .settings-help { display: flex; width: 100%; min-height: 36px; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; color: var(--secondary-200); font-size: 14px; line-height: 20px; text-align: left; transition: color 140ms, background-color 140ms; }
.settings-nav-item:hover, .settings-nav-item:focus-visible, .settings-nav-item.is-active, .settings-help:hover { background: var(--secondary-500); color: var(--secondary-100); }
.settings-nav-item svg, .settings-help svg { width: 18px; height: 18px; flex: 0 0 18px; stroke-width: 1.35; }
.settings-help { margin-top: auto; }
.settings-help .settings-external { width: 14px; height: 14px; margin-left: auto; color: var(--secondary-300); stroke-width: 1.4; }
.settings-main { display: flex; min-width: 0; flex-direction: column; background: var(--secondary-900); }
.settings-header { display: flex; min-height: 62px; align-items: center; justify-content: space-between; padding: 0 18px 0 22px; }
.settings-header h2 { margin: 0; color: var(--secondary-100); font-size: 22px; font-weight: 500; letter-spacing: -.2px; line-height: 28px; }
.settings-close { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: var(--secondary-300); transition: color 140ms, background-color 140ms; }
.settings-close:hover { background: var(--secondary-700); color: var(--secondary-100); }
.settings-close svg { width: 16px; height: 16px; stroke-width: 1.4; }
.settings-scroll { overflow-y: auto; padding: 8px 22px 28px; }
.settings-view[hidden] { display: none; }
.settings-section h3 { margin: 0 0 8px 4px; color: var(--secondary-400); font-size: 13px; font-weight: 400; line-height: 18px; }
.settings-section + .settings-section { margin-top: 24px; }
.settings-card { overflow: hidden; border: 1px solid var(--secondary-600); border-radius: 16px; background: var(--secondary-900); }
.settings-profile-photo-row { display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; color: var(--secondary-200); font-size: 16px; line-height: 22px; }
.settings-profile-photo-row + .settings-row { border-top: 1px solid var(--secondary-600); }
.settings-account-avatar-mount, .settings-account-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  overflow: hidden;
  place-items: center;
  border-radius: 50%;
}
.settings-account-avatar-mount { background: var(--secondary-700); }
.settings-account-avatar { color: #fff; font-size: 14px; font-weight: 500; line-height: 1; }
.settings-row { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; color: var(--secondary-200); font-size: 16px; line-height: 22px; }
.settings-row + .settings-row { border-top: 1px solid var(--secondary-600); }
.settings-row > strong { color: var(--secondary-300); font-size: 14px; font-weight: 400; text-align: right; }
.settings-signout { display: flex; min-height: 56px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 6px; color: var(--secondary-300); font-size: 13px; line-height: 18px; }
.settings-secondary-button, .settings-enable-button { display: inline-flex; min-height: 32px; align-items: center; gap: 5px; padding: 0 10px; border: 1px solid var(--secondary-600); border-radius: 10px; background: var(--secondary-900); color: var(--secondary-200); font-size: 13px; font-weight: 500; transition: background-color 140ms; }
.settings-secondary-button:hover { background: var(--secondary-800); }
.settings-secondary-button svg { width: 16px; height: 16px; stroke-width: 1.35; }
.settings-general-card .settings-row { min-height: 66px; }
.settings-theme-options { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--secondary-600); border-radius: 10px; background: var(--secondary-900); }
.settings-theme-options button { display: inline-flex; height: 28px; align-items: center; gap: 5px; padding: 0 8px; border-radius: 7px; color: var(--secondary-300); font-size: 13px; transition: color 120ms ease, background-color 120ms ease; }
.settings-theme-options button:hover, .settings-theme-options button.is-selected { background: var(--secondary-500); color: var(--secondary-100); }
.settings-theme-options svg { width: 16px; height: 16px; stroke-width: 1.35; }
.settings-value-button { display: inline-flex; min-height: 28px; align-items: center; gap: 7px; padding: 0; color: var(--secondary-300); font-size: 14px; }
.settings-value-button:hover { color: var(--secondary-100); }
.settings-value-button svg { width: 14px; height: 14px; stroke-width: 1.4; }
.settings-static-value { display: inline-flex; min-height: 28px; align-items: center; padding: 0; color: var(--secondary-300); font-size: 14px; font-weight: 400; user-select: none; cursor: default; }
.settings-value-input { width: min(54%, 240px); min-height: 28px; padding: 0; border: 0; border-bottom: 1px solid var(--primary); outline: none; background: transparent; color: var(--secondary-200); font: inherit; font-size: 14px; text-align: right; }
.settings-value-input[aria-invalid="true"] { border-bottom-color: #9a4b3b; }
.settings-enable-button { border-color: var(--secondary-500); background: var(--secondary-700); }
.settings-enable-button:hover { background: var(--secondary-500); }
.billing-tabs { display: flex; height: 40px; align-items: stretch; gap: 20px; border-bottom: 1px solid var(--secondary-600); }
.billing-tabs button { position: relative; display: inline-flex; min-width: 40px; align-items: center; justify-content: center; color: var(--secondary-300); font-size: 15px; line-height: 20px; transition: color 140ms; }
.billing-tabs button:hover, .billing-tabs button.is-active { color: var(--secondary-100); }
.billing-tabs button.is-active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; border-radius: 999px; background: var(--secondary-100); content: ""; }
.billing-tabs button .help-coming-soon-dot { margin-left: 6px; flex: 0 0 4px; }
.settings-nav-item .help-coming-soon-dot { margin-left: auto; flex: 0 0 4px; }
.settings-coming-soon-notice { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; padding: 0 4px; }
.settings-coming-soon-notice .help-coming-soon-dot { flex: 0 0 4px; margin-top: 7px; margin-left: 0; }
.settings-coming-soon-notice p { margin: 0; color: var(--secondary-400); font-size: 13px; line-height: 19px; }
.settings-card button:disabled, .settings-card button[aria-disabled="true"], .billing-upgrade-card button:disabled, .billing-upgrade-card button[aria-disabled="true"], .billing-inline-action button:disabled, .billing-inline-action button[aria-disabled="true"], .billing-auto-refill button:disabled, .billing-auto-refill button[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.billing-upgrade-card { display: flex; min-height: 86px; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 14px 20px; border: 1px solid var(--secondary-600); border-radius: 16px; background: var(--secondary-900); }
.billing-upgrade-card > span, .billing-auto-refill > span { display: grid; min-width: 0; gap: 1px; }
.billing-upgrade-card strong, .billing-auto-refill strong { color: var(--secondary-200); font-size: 16px; font-weight: 400; line-height: 22px; }
.billing-upgrade-card small, .billing-auto-refill small { color: var(--secondary-300); font-size: 14px; line-height: 20px; }
.settings-primary-button { display: inline-flex; min-height: 36px; flex: 0 0 auto; align-items: center; padding: 0 12px; border: 1px solid var(--secondary-500); border-radius: 10px; background: var(--secondary-700); color: var(--secondary-200); font-size: 14px; font-weight: 500; transition: background-color 140ms, color 140ms; }
.settings-primary-button:hover { background: var(--secondary-500); color: var(--secondary-100); }
.billing-subscription { margin-top: 24px; }
.billing-inline-action, .billing-auto-refill { display: flex; min-height: 56px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 6px; color: var(--secondary-300); font-size: 13px; line-height: 18px; }
.billing-auto-refill { min-height: 66px; }
.token-balance-section { margin-top: 0; }
.token-summary-row { min-height: 88px; }
.token-summary-row > strong { color: var(--secondary-200); font-size: 16px; }
.token-today-row > span { display: grid; min-width: 0; gap: 1px; }
.token-today-row > span:first-child > strong, .token-today-row > span:last-child > strong { color: var(--secondary-200); font-size: 16px; font-weight: 400; line-height: 22px; }
.token-today-row > span:last-child { align-items: end; text-align: right; }
.token-today-row small { color: var(--secondary-400); font-size: 12px; line-height: 18px; }
.token-recent-section { margin-top: 24px; }
.token-recent-row { display: flex; width: 100%; min-height: 90px; align-items: center; gap: 12px; padding: 14px 20px; color: var(--secondary-200); text-align: left; transition: background-color 140ms, border-color 140ms; }
.token-recent-row:hover { border-color: var(--secondary-500); background: var(--secondary-850); }
.token-recent-row > span { display: grid; min-width: 0; gap: 1px; }
.token-recent-row > span:first-child { flex: 1 1 auto; }
.token-recent-row strong { overflow: hidden; color: var(--secondary-200); font-size: 16px; font-weight: 400; line-height: 22px; text-overflow: ellipsis; white-space: nowrap; }
.token-recent-row small { color: var(--secondary-400); font-size: 13px; line-height: 18px; }
.token-recent-total { flex: 0 0 auto; align-items: end; text-align: right; }
.token-recent-row svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--secondary-400); stroke-width: 1.35; }

/* MCP settings view */
.mcp-intro-section { margin-top: 0; }
.mcp-server-row { min-height: 60px; }
.mcp-server-row > span:first-child { color: var(--secondary-200); font-size: 16px; font-weight: 400; }
.mcp-server-url-group { display: inline-flex; align-items: center; gap: 8px; }
.mcp-server-url { padding: 5px 10px; border: 1px solid var(--secondary-600); border-radius: 8px; background: var(--secondary-850); color: var(--secondary-300); font-family: "SF Mono", "Fira Code", "Cascadia Code", Menlo, Consolas, monospace; font-size: 13px; line-height: 20px; word-break: break-all; }
.mcp-copy-button { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; border: 1px solid var(--secondary-600); border-radius: 8px; background: var(--secondary-900); color: var(--secondary-300); transition: background-color 140ms, color 140ms; }
.mcp-copy-button:hover { background: var(--secondary-700); color: var(--secondary-100); }
.mcp-copy-button svg { width: 15px; height: 15px; stroke-width: 1.4; }
.mcp-description { margin: 12px 4px 0; color: var(--secondary-400); font-size: 13px; line-height: 20px; }
.mcp-apps-section { margin-top: 28px; }
.mcp-empty-state { padding: 20px; color: var(--secondary-400); font-size: 14px; line-height: 22px; }

.support-chat {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 220;
  display: flex;
  width: min(390px, calc(100vw - 48px));
  height: min(620px, calc(100dvh - 48px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 24px;
  background: #171719;
  box-shadow: 0 20px 44px rgba(24,15,8,.28), 0 4px 12px rgba(0,0,0,.24);
  color: #f8f5f2;
  opacity: 0;
  pointer-events: none;
  transform: translateX(16px) scale(.99);
  transform-origin: bottom right;
  transition: opacity 160ms ease-in, transform 160ms ease-in, visibility 0s linear 160ms;
  visibility: hidden;
  will-change: opacity, transform;
}
.support-chat.is-open { opacity: 1; pointer-events: auto; transform: translateX(0) scale(1); transition: opacity 220ms cubic-bezier(.22,.75,.25,1), transform 220ms cubic-bezier(.22,.75,.25,1), visibility 0s; visibility: visible; }
.support-chat-header { display: flex; min-height: 64px; align-items: center; gap: 10px; padding: 0 12px; border-bottom: 1px solid rgba(255,255,255,.09); }
.support-header-button { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border-radius: 50%; color: #aaa7a8; transition: background-color 140ms, color 140ms; }
.support-header-button:hover { background: rgba(255,255,255,.075); color: #fff; }
.support-header-button svg { width: 18px; height: 18px; stroke-width: 1.45; }
.support-chat-identity { display: flex; min-width: 0; align-items: center; }
.support-brand-avatar, .support-member-avatar { display: grid; width: 32px; height: 32px; align-items: center; justify-content: center; border: 2px solid #171719; border-radius: 50%; }
.support-brand-avatar { position: relative; z-index: 3; background: #060606; }
.support-brand-avatar img { display: block; width: 18px; height: 18px; }
.support-member-avatar { position: relative; z-index: 2; margin-left: -7px; background: #d8c4b7; color: #211713; font-size: 12px; font-weight: 500; }
.support-member-avatar-muted { z-index: 1; margin-left: -7px; background: #c6c4c4; color: #282526; }
.support-chat-identity strong { overflow: hidden; margin-left: 9px; color: #f8f5f2; font-size: 16px; font-weight: 500; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; }
.support-header-actions { display: flex; gap: 2px; margin-left: auto; }
.support-chat-body { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; padding: 24px; overflow: hidden; }
.support-empty-copy { margin: 0; color: #9f9ca0; font-size: 14px; line-height: 20px; text-align: center; }
.support-message-list { display: grid; min-height: 0; flex: 1 1 auto; align-content: start; gap: 8px; margin-top: 22px; overflow-y: auto; }
.support-message-list:not(:empty) { padding-bottom: 8px; }
.support-conversation-date { margin: 2px 0 8px; color: #a4a1a5; font-size: 13px; line-height: 18px; text-align: center; }
.support-message { max-width: 84%; margin: 0; padding: 12px 14px; font-size: 15px; line-height: 22px; overflow-wrap: anywhere; animation: support-message-in 180ms ease-out both; }
.support-message--user { justify-self: end; border: 1px solid rgba(255,255,255,.5); border-radius: 24px 24px 7px 24px; background: #fcfbfa; color: #171719; }
.support-message--reply { justify-self: start; border: 1px solid rgba(255,255,255,.035); border-radius: 24px 24px 24px 7px; background: #303136; color: #f8f5f2; }
.support-message-meta { justify-self: start; margin: -2px 0 0; padding-left: 4px; color: #a4a1a5; font-size: 12px; line-height: 18px; animation: support-message-in 180ms ease-out both; }
.support-join-notice { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 4px 0 8px; color: #aaa7aa; font-size: 13px; line-height: 18px; text-align: center; animation: support-message-in 180ms ease-out both; }
.support-join-notice strong { color: #f8f5f2; font-weight: 500; }
.support-join-notice .support-brand-avatar { width: 24px; height: 24px; flex: 0 0 24px; border-width: 1px; }
.support-join-notice .support-brand-avatar img { width: 14px; height: 14px; }
.support-composer { position: relative; display: grid; min-height: 114px; grid-template-rows: minmax(42px, 1fr) 28px; margin: 12px; padding: 12px 50px 10px 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 18px; background: #1b1c1f; transition: border-color 140ms; }
.support-composer:focus-within { border-color: rgba(255,255,255,.28); }
.support-composer textarea { width: 100%; min-height: 42px; max-height: 92px; resize: none; border: 0; outline: 0; background: transparent; color: #f8f5f2; font-size: 14px; line-height: 20px; }
.support-composer textarea::placeholder { color: #a4a1a5; opacity: 1; }
.support-composer-tools { display: flex; align-items: center; gap: 3px; }
.support-composer-tools button { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; color: #9f9ca0; transition: color 140ms, background-color 140ms; }
.support-composer-tools button:hover { background: rgba(255,255,255,.07); color: #f8f5f2; }
.support-composer-tools svg { width: 17px; height: 17px; stroke-width: 1.4; }
.support-composer-tools .support-gif-button { width: 30px; font-size: 9px; font-weight: 500; letter-spacing: -.2px; }
.support-send-button { position: absolute; right: 10px; bottom: 10px; display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #4c4e53; color: #bfc0c2; transition: background-color 140ms, color 140ms; }
.support-send-button:not(:disabled) { background: #f6f2ee; color: #191719; }
.support-send-button:not(:disabled):hover { background: #fff; }
.support-send-button:disabled { cursor: default; }
.support-send-button svg { width: 18px; height: 18px; stroke-width: 1.5; }
@keyframes support-message-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 767px) {
  .project-dialog-overlay { align-items: center; padding: 16px; }
  .project-dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
}

@media (max-width: 440px) {
  .project-dialog-overlay { padding: 12px; }
  .project-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 16px; }
  .project-dialog-header { padding: 16px 16px 0; }
  .project-dialog-body { padding: 18px 16px 16px; }
  .project-dialog-description { margin-bottom: 20px; }
  .project-dialog-actions { gap: 8px; margin-top: 18px; }
  .project-dialog-action { min-height: 42px; font-size: 14px; }
}

@media (max-width: 767px) {
  .app-shell, .app-shell[data-sidebar="expanded"] { display: block; }
  .sidebar { display: none; }
  .main-content { width: 100%; }
  .topbar { padding-inline: 12px; }
  .workspace-container { padding-inline: 16px; }
  .title-wrap h1 { font-size: 24px; }
  .mode-button:not(.is-active) span { display: none; }
  .mode-button:not(.is-active) { width: 40px; padding: 0 12px; }
  .mode-toggle[data-active="Grow"] .active-pill { transform: translateX(40px); }
  .credits-pill svg { display: none; }
  .settings-overlay { align-items: stretch; padding: 12px; }
  .settings-dialog { width: 100%; height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .settings-sidebar { display: block; overflow-x: auto; padding: 12px; border-right: 0; border-bottom: 1px solid var(--secondary-600); white-space: nowrap; }
  .settings-nav-group { display: inline-flex; gap: 4px; margin: 0 8px 0 0; vertical-align: middle; }
  .settings-nav-heading { display: none; }
  .settings-nav-item { display: inline-flex; width: auto; min-height: 32px; padding: 6px 8px; }
  .settings-nav-group:nth-of-type(n+2) { display: none; }
  .settings-help { display: inline-flex; width: auto; margin: 0; vertical-align: middle; }
  .settings-help .settings-external { display: none; }
  .settings-main { min-height: 0; }
  .billing-tabs { height: 36px; }
  .support-chat { right: 16px; bottom: 16px; width: min(390px, calc(100vw - 32px)); height: min(620px, calc(100dvh - 32px)); }
  .app-download-card {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translate(-50%, 6px) scale(0.985);
    transform-origin: bottom center;
    width: min(340px, calc(100vw - 32px));
  }
  .app-download-card.is-open {
    transform: translate(-50%, 0) scale(1);
  }
}

@media (max-width: 440px) {
  .outline-pill { width: 32px; padding: 0; overflow: hidden; color: transparent; }
  .hero-stack { min-height: 320px; }
  .plan-pill, .title-wrap { margin-bottom: 24px; }
  .composer { min-height: 122px; }
  .message-editor { min-height: 62px; }
  .settings-overlay { padding: 0; }
  .settings-dialog { height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .settings-header { min-height: 56px; padding-inline: 16px; }
  .settings-header h2 { font-size: 20px; }
  .settings-scroll { padding: 8px 16px 24px; }
  .settings-row { min-height: 64px; padding: 12px 14px; font-size: 14px; }
  .settings-profile-photo-row { min-height: 72px; padding: 12px 14px; font-size: 14px; }
  .settings-row > strong, .settings-value-button, .settings-static-value { max-width: 54%; font-size: 13px; overflow-wrap: anywhere; }
  .settings-general-card .settings-row:first-child { align-items: flex-start; flex-direction: column; gap: 8px; }
  .settings-theme-options button { padding-inline: 6px; }
  .settings-theme-options button svg { display: none; }
  .billing-upgrade-card { align-items: flex-start; flex-direction: column; padding: 14px; }
  .settings-primary-button { min-height: 34px; }
  .billing-inline-action, .billing-auto-refill { align-items: flex-start; flex-direction: column; padding: 12px 2px; }
  .billing-inline-action { min-height: 76px; }
  .billing-auto-refill { min-height: 92px; }
  .token-summary-row { min-height: 72px; }
  .token-today-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  .token-today-row > span:last-child { align-items: flex-start; text-align: left; }
  .token-recent-row { min-height: 82px; padding: 12px 14px; }
  .token-recent-row strong { font-size: 14px; }
  .support-chat { right: 12px; bottom: 12px; width: calc(100vw - 24px); height: min(620px, calc(100dvh - 24px)); border-radius: 20px; }
  .support-chat-header { min-height: 60px; padding-inline: 10px; }
  .support-chat-body { padding: 20px 16px; }
}

/* ==========================================================================
   Universal Drag & Drop Overlay (Cropus AI UI/UX)
   ========================================================================== */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(254, 253, 251, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}

.drop-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.drop-overlay-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 44px 48px;
  width: min(460px, calc(100vw - 32px));
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px dashed var(--quiet);
  box-shadow: 0 24px 64px rgba(24, 15, 8, 0.10), 0 4px 16px rgba(24, 15, 8, 0.03);
  pointer-events: none;
  transform: scale(0.95) translateY(8px);
  transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.drop-overlay.is-active .drop-overlay-box {
  transform: scale(1) translateY(0);
}

.drop-overlay:hover .drop-overlay-box,
.drop-overlay.is-drag-target .drop-overlay-box {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 115, 143, 0.12), 0 24px 64px rgba(24, 15, 8, 0.14);
}

.drop-cards-cluster {
  position: relative;
  width: 136px;
  height: 96px;
  margin-bottom: 22px;
}

.drop-card {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 16px;
  transition: transform 0.24s ease, box-shadow 0.2s ease;
}

.drop-card-media {
  top: 4px;
  left: 14px;
  width: 50px;
  height: 50px;
  background: #ffffff;
  border: 1px solid rgba(61, 46, 36, 0.10);
  box-shadow: 0 10px 24px rgba(24, 15, 8, 0.07), 0 2px 6px rgba(24, 15, 8, 0.03);
  transform: rotate(-12deg);
  color: var(--cocoa);
}

.drop-card-media svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.35;
}

.drop-card-doc {
  top: 4px;
  right: 14px;
  width: 50px;
  height: 50px;
  background: #ffffff;
  border: 1px solid rgba(61, 46, 36, 0.10);
  box-shadow: 0 10px 24px rgba(24, 15, 8, 0.07), 0 2px 6px rgba(24, 15, 8, 0.03);
  transform: rotate(12deg);
  color: var(--cocoa);
}

.drop-card-doc svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.35;
}

.drop-card-plus {
  bottom: 0;
  left: 50%;
  width: 56px;
  height: 56px;
  transform: translateX(-50%);
  z-index: 2;
  background: var(--primary);
  border: 2.5px solid #ffffff;
  border-radius: 17px;
  box-shadow: 0 12px 28px rgba(0, 115, 143, 0.32), 0 4px 10px rgba(24, 15, 8, 0.10);
  color: #ffffff;
}

.drop-card-plus svg {
  width: 23px;
  height: 23px;
  stroke-width: 2.2;
}

.drop-overlay-title {
  margin: 0 0 6px;
  color: var(--espresso);
  font-family: IDGrotesk, ui-sans-serif, -apple-system, sans-serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.drop-overlay-subtitle {
  margin: 0;
  color: var(--muted);
  font-family: IDGrotesk, ui-sans-serif, -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  max-width: 340px;
}

/* Home Composer Attachments Tray */
.composer-attachments {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--secondary-700);
  overflow-x: auto;
  scrollbar-width: thin;
}

.composer-attachments[hidden] {
  display: none !important;
}

.composer-attachment-item {
  position: relative;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--secondary-700);
  background: var(--surface-container-low);
  box-shadow: 0 1px 4px rgba(24, 15, 8, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.composer-attachment-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(24, 15, 8, 0.1);
}

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

.composer-attachment-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(24, 15, 8, 0.82);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.14s ease, transform 0.14s ease, background-color 0.14s ease;
}

.composer-attachment-item:hover .composer-attachment-remove,
.composer-attachment-remove:focus-visible {
  opacity: 1;
}

.composer-attachment-remove:hover {
  background: #a82e2e;
  transform: scale(1.08);
}

.composer-attachment-remove svg {
  width: 10px;
  height: 10px;
  stroke: #fff;
  stroke-width: 2;
}

@media (max-width: 440px) {
  .drop-cards-cluster {
    width: 120px;
    height: 84px;
    margin-bottom: 18px;
  }
  .drop-card-media, .drop-card-doc {
    width: 42px;
    height: 42px;
  }
  .drop-card-plus {
    width: 48px;
    height: 48px;
  }
  .drop-overlay-title {
    font-size: 20px;
  }
  .drop-overlay-subtitle {
    font-size: 13px;
    padding-inline: 12px;
  }
}

/* ==========================================================================
   Cropus AI Image Lightbox Preview Modal
   ========================================================================== */
.cropus-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(18, 12, 8, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.24s cubic-bezier(0.32, 0.72, 0, 1);
}

.cropus-lightbox-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cropus-lightbox-close {
  position: absolute;
  top: 24px;
  right: 28px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 10;
  transition: background-color 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.cropus-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.38);
  transform: scale(1.08);
}

.cropus-lightbox-close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.cropus-lightbox-close svg {
  width: 18px;
  height: 18px;
  stroke: #ffffff;
  stroke-width: 1.8;
}

.cropus-lightbox-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: min(92vw, 1100px);
  max-height: min(86vh, 880px);
  transform: scale(0.95) translateY(6px);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: auto;
}

.cropus-lightbox-overlay.is-active .cropus-lightbox-stage {
  transform: scale(1) translateY(0);
}

.cropus-lightbox-img {
  width: auto;
  height: auto;
  min-width: min(460px, 86vw);
  max-width: min(92vw, 1100px);
  max-height: calc(min(86vh, 880px) - 48px);
  object-fit: contain;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), 0 10px 30px rgba(24, 15, 8, 0.35);
  user-select: none;
  background: rgba(255, 255, 255, 0.04);
}

.cropus-lightbox-caption {
  margin-top: 14px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fbf8f5;
  font-family: IDGrotesk, ui-sans-serif, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  max-width: min(85vw, 440px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.cropus-lightbox-caption[hidden] {
  display: none !important;
}

.image-reference-item,
.composer-attachment-item {
  cursor: zoom-in;
}

.image-reference-item:focus-visible,
.composer-attachment-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Cropus AI Conversational Chat & Transcript
   ========================================================================== */
.workspace.is-chat-active {
  height: calc(100dvh - 56px);
  min-height: 0;
  overflow: hidden;
}

.workspace.is-chat-active .workspace-container {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
}

.workspace.is-chat-active .hero-stack {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  width: 100%;
}

.workspace.is-chat-active .plan-pill,
.workspace.is-chat-active .title-wrap {
  display: none !important;
}

.chat-transcript-mount {
  width: 100%;
}

.workspace.is-chat-active .chat-transcript-mount {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0 16px;
}

.workspace.is-chat-active .chat-transcript-mount::-webkit-scrollbar {
  width: 6px;
}
.workspace.is-chat-active .chat-transcript-mount::-webkit-scrollbar-track {
  background: transparent;
}
.workspace.is-chat-active .chat-transcript-mount::-webkit-scrollbar-thumb {
  background: var(--secondary-700);
  border-radius: 999px;
}
.workspace.is-chat-active .chat-transcript-mount::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-500);
}

.workspace.is-chat-active .composer-stack {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 24px;
  background: linear-gradient(180deg, rgba(254, 253, 251, 0) 0%, rgba(254, 253, 251, 0.96) 24%, var(--background, #fefdfb) 100%);
  position: relative;
  z-index: 10;
}

.workspace.is-chat-active .composer-stack .composer {
  width: min(calc(100% - 32px), 640px);
  max-width: 640px;
  margin: 0 auto;
  box-sizing: border-box;
}

.workspace.is-chat-active .composer-stack .context-strip {
  display: none !important;
}

.composer-toolbar .toolbar-group:first-child {
  position: relative;
}

.composer-plus-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  z-index: 60;
  width: 264px;
  padding: 6px;
  border: 1px solid rgba(61, 46, 36, 0.08);
  border-radius: 13px;
  background: rgba(254, 253, 251, 0.985);
  box-shadow: 0 10px 28px rgba(24, 15, 8, 0.13), 0 2px 6px rgba(24, 15, 8, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: composerMenuIn 140ms ease-out;
}

@keyframes composerMenuIn {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.composer-plus-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  background: transparent;
  border: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--secondary-300);
  transition: background-color 120ms ease, color 120ms ease;
  box-sizing: border-box;
}

.composer-plus-item:hover {
  background: var(--secondary-800);
  color: var(--secondary-100);
}

.composer-plus-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.composer-plus-icon {
  width: 18px;
  height: 18px;
  color: var(--secondary-200);
  display: flex;
  align-items: center;
  justify-content: center;
}

.composer-plus-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.3;
}

.composer-plus-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.composer-plus-copy strong {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--secondary-100);
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-plus-copy small {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--secondary-300);
  line-height: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-plus-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--secondary-700);
  color: var(--secondary-200);
  font-weight: 450;
}

.composer-plus-sublist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 4px 10px;
  margin: 2px 0 4px 20px;
  border-left: 1px solid var(--border-soft);
}

.composer-plus-subitem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 8px;
  border-radius: 7px;
  background: transparent;
  border: none;
  font-size: 12.5px;
  color: var(--secondary-200);
  cursor: pointer;
  text-align: left;
  transition: background-color 100ms;
}

.composer-plus-subitem:hover {
  background: var(--secondary-800);
  color: var(--secondary-100);
}

.composer-plus-subitem.is-selected {
  background: var(--secondary-700);
  font-weight: 500;
  color: var(--primary);
}


.chat-transcript {
  width: min(100%, 672px);
  max-width: 672px;
  margin: 0 auto;
  padding: 0 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  box-sizing: border-box;
}

.chat-msg-user {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.chat-msg-user-bubble {
  background: var(--secondary-700);
  color: var(--secondary-100);
  padding: 12px 18px;
  border-radius: 18px 18px 4px 18px;
  max-width: 82%;
  font-size: 15px;
  line-height: 23px;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-msg-assistant {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 8px;
}

.chat-msg-assistant-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--secondary-200);
}

.chat-msg-assistant-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #180f08;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.chat-msg-assistant-avatar img {
  width: 14px;
  height: 14px;
}

.chat-msg-assistant-mode {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--secondary-800);
  border: 1px solid var(--border-soft);
  color: var(--secondary-300);
  font-weight: 400;
  line-height: 16px;
}

.chat-msg-assistant-content {
  font-size: 15px;
  line-height: 25px;
  color: var(--secondary-100);
  word-break: break-word;
}

.chat-msg-assistant-content p {
  margin: 0 0 12px;
}
.chat-msg-assistant-content p:last-child {
  margin-bottom: 0;
}

.chat-msg-assistant-content ul,
.chat-msg-assistant-content ol {
  margin: 6px 0 14px;
  padding-left: 20px;
}

.chat-msg-assistant-content li {
  margin-bottom: 6px;
}

.chat-msg-assistant-content strong {
  font-weight: 500;
  color: var(--secondary-100);
}

.chat-msg-assistant-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13.5px;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--secondary-800);
  border: 1px solid var(--border-soft);
  color: var(--secondary-100);
}

.chat-msg-assistant-content pre {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--secondary-850);
  border: 1px solid var(--border-soft);
  overflow-x: auto;
}

.chat-msg-assistant-content pre code {
  padding: 0;
  border: none;
  background: none;
  font-size: 13px;
  line-height: 20px;
}

/* Assistant Message Action Buttons */
.chat-msg-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.chat-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--secondary-300);
  cursor: pointer;
  transition: background-color 120ms, color 120ms, border-color 120ms;
  padding: 0;
}

.chat-action-btn:hover {
  background: var(--secondary-700);
  color: var(--secondary-100);
}

.chat-action-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.chat-action-btn svg {
  width: 14px;
  height: 14px;
}

.chat-action-btn.is-active {
  background: var(--secondary-700);
  color: var(--primary);
  border-color: var(--border-soft);
}

.chat-action-btn.is-copied {
  color: var(--primary);
}

.chat-copy-feedback {
  font-size: 11.5px;
  color: var(--secondary-300);
  margin-left: 4px;
  animation: chatFadeIn 140ms ease;
}

@keyframes chatFadeIn {
  from { opacity: 0; transform: translateX(-2px); }
  to { opacity: 1; transform: translateX(0); }
}

.chat-cursor {
  display: inline-block;
  width: 2px;
  height: 15px;
  background: var(--primary);
  vertical-align: -2px;
  margin-left: 2px;
  animation: chatCursorBlink 1s infinite;
}

@keyframes chatCursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Chat Thinking Indicator (Claude-style refinement with Cropus AI tokens) */
.chat-thinking-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  background: var(--secondary-850, #fbf8f5);
  border: 1px solid var(--border-soft, #f1ece7);
  font-size: 12.5px;
  line-height: 16px;
  font-weight: 400;
  color: var(--secondary-300, #6b5a50);
  user-select: none;
  box-sizing: border-box;
}

.chat-thinking-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--primary, #00738f);
  opacity: 0.85;
  flex-shrink: 0;
  animation: thinkingDotBreathe 2s ease-in-out infinite;
}

@keyframes thinkingDotBreathe {
  0%, 100% {
    opacity: 0.25;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

.chat-thinking-label {
  font-size: 12.5px;
  font-weight: 450;
  color: var(--secondary-300, #6b5a50);
  letter-spacing: -0.01em;
}

.chat-thinking-timer {
  font-size: 11.5px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--secondary-400, #cbc0b6);
  padding-left: 1px;
}


/* Chat Not Found State */
.chat-not-found {
  width: 100%;
  max-width: 440px;
  margin: 48px auto;
  text-align: center;
  padding: 36px 24px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(24, 15, 8, 0.04);
}

.chat-not-found-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--secondary-800);
  display: grid;
  place-items: center;
  color: var(--secondary-300);
}

.chat-not-found-icon svg {
  width: 20px;
  height: 20px;
}

.chat-not-found-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--secondary-100);
  margin: 0;
}

.chat-not-found-desc {
  font-size: 14px;
  color: var(--secondary-300);
  margin: 0 0 6px;
  line-height: 20px;
}

.chat-not-found-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--secondary-100);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 140ms;
}

.chat-not-found-btn:hover {
  opacity: 0.88;
}

/* Sidebar History List */
.sidebar-history-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: none;
  border: none;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--secondary-200);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 120ms;
}

.sidebar-history-item:hover {
  background: var(--secondary-500);
}

.sidebar-history-item.is-active {
  background: var(--secondary-500);
  font-weight: 500;
  color: var(--secondary-100);
  box-shadow: 0 1px 2px rgba(24, 15, 8, 0.05);
}

.app-shell[data-sidebar="expanded"] .sidebar-history-item.is-active {
  background: #eae2dc;
  color: var(--secondary-100);
  box-shadow: 0 1px 2px rgba(24, 15, 8, 0.05);
}

.sidebar-history-item.is-active .sidebar-history-title {
  color: var(--secondary-100);
  font-weight: 500;
}

.sidebar-history-icon {
  display: flex;
  align-items: center;
  opacity: 0.7;
  flex-shrink: 0;
}

.sidebar-history-item.is-active .sidebar-history-icon {
  opacity: 1;
  color: var(--primary, #00738f);
}

.sidebar-history-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  font-weight: 500;
}

/* Sidebar History Items & Context Menu Button */
.sidebar-history-item {
  position: relative;
}

.sidebar-history-pin-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  color: var(--secondary-300, #8c7a6e);
  flex-shrink: 0;
  margin-right: 4px;
}

.sidebar-history-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 5px;
  background: transparent;
  border: none;
  color: var(--secondary-300, #8c7a6e);
  opacity: 0;
  cursor: pointer;
  transition: opacity 120ms, background-color 120ms, color 120ms;
  flex-shrink: 0;
  margin-left: auto;
}

.sidebar-history-item:hover .sidebar-history-more-btn,
.sidebar-history-more-btn.is-active,
.sidebar-history-more-btn:focus-visible {
  opacity: 1;
}

.sidebar-history-more-btn:hover {
  background: rgba(24, 15, 8, 0.08);
  color: var(--secondary-100, #180f08);
}

.sidebar-history-rename-input {
  flex: 1;
  min-width: 0;
  background: #ffffff;
  border: 1px solid var(--primary, #00738f);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--secondary-100, #180f08);
  outline: none;
}

/* Sidebar History Context Menu Popover */
.history-context-menu {
  position: fixed;
  z-index: 10000;
  min-width: 184px;
  background: var(--surface, #fefdfb);
  border: 1px solid var(--outline-soft, #f1ece7);
  border-radius: 9px;
  box-shadow: 0 4px 18px rgba(24, 15, 8, 0.1), 0 1px 4px rgba(24, 15, 8, 0.04);
  padding: 4px;
  font-family: IDGrotesk, sans-serif;
  animation: contextMenuFadeIn 100ms ease-out;
}

@keyframes contextMenuFadeIn {
  from { opacity: 0; transform: scale(0.97) translateY(-2px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.history-context-menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 400;
  color: var(--secondary-200, #3d2e24);
  cursor: pointer;
  text-align: left;
  transition: background-color 100ms, color 100ms;
}

.history-context-menu-item:hover {
  background: rgba(24, 15, 8, 0.05);
  color: var(--secondary-100, #180f08);
}

.history-context-menu-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.75;
}

.history-context-menu-item.is-danger {
  color: #b3261e;
}

.history-context-menu-item.is-danger:hover {
  background: rgba(179, 38, 30, 0.08);
  color: #b3261e;
}

.history-context-menu-divider {
  height: 1px;
  background: var(--outline-soft, #f1ece7);
  margin: 4px 0;
}

.history-context-submenu {
  position: absolute;
  left: 100%;
  top: -4px;
  margin-left: 4px;
  min-width: 160px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface, #fefdfb);
  border: 1px solid var(--outline-soft, #f1ece7);
  border-radius: 9px;
  box-shadow: 0 4px 18px rgba(24, 15, 8, 0.1);
  padding: 4px;
}

/* Toast / Floating Notification */
.cropus-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--secondary-900, #180f08);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: toastFadeIn 200ms ease-out;
}

@keyframes toastFadeIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Project Detail View */
.workspace.is-project-active {
  height: 100%;
  overflow-y: auto;
}

.workspace.is-project-active .workspace-container {
  height: auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 60px;
}

.workspace.is-project-active .hero-stack {
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: 760px;
}

.workspace.is-project-active .composer-stack {
  width: 100%;
}

.workspace.is-project-active .plan-pill,
.workspace.is-project-active .title-wrap,
.workspace.is-project-active .context-strip {
  display: none !important;
}

.project-detail-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.project-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 24px;
}

.project-detail-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  position: relative;
}

.project-detail-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(24, 15, 8, 0.04);
  border: 1px solid rgba(24, 15, 8, 0.06);
  color: var(--secondary-200, #3d2e24);
  flex-shrink: 0;
}

.project-detail-icon svg {
  width: 18px;
  height: 18px;
}

.project-detail-title {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
  color: var(--secondary-100, #180f08);
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-detail-rename-input {
  font-size: 22px;
  font-weight: 500;
  font-family: inherit;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--primary, #00738f);
  background: #ffffff;
  color: var(--secondary-100, #180f08);
  outline: none;
}

.project-actions-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--secondary-300, #8c7a6e);
  cursor: pointer;
  transition: all 120ms;
  position: relative;
}

.project-actions-btn:hover,
.project-actions-btn.is-active {
  background: rgba(24, 15, 8, 0.05);
  border-color: rgba(24, 15, 8, 0.08);
  color: var(--secondary-100, #180f08);
}

.project-context-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 28px;
  width: 100%;
}

.project-context-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 450;
  color: var(--secondary-200, #3d2e24);
  background: rgba(24, 15, 8, 0.04);
  border: 1px solid rgba(24, 15, 8, 0.06);
  cursor: pointer;
  transition: all 120ms;
  text-decoration: none;
}

.project-context-btn:hover {
  background: rgba(24, 15, 8, 0.08);
  color: var(--secondary-100, #180f08);
}

.project-context-btn.has-instructions {
  border-color: rgba(0, 115, 143, 0.3);
  background: rgba(0, 115, 143, 0.06);
  color: #00738f;
}

.project-tabs-container {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.project-tabs-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--outline-soft, #f1ece7);
  margin-bottom: 16px;
}

.project-tab-btn {
  position: relative;
  padding: 8px 4px 10px;
  background: transparent;
  border: none;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--secondary-300, #8c7a6e);
  cursor: pointer;
  transition: color 120ms;
}

.project-tab-btn:hover {
  color: var(--secondary-100, #180f08);
}

.project-tab-btn.is-active {
  color: var(--secondary-100, #180f08);
}

.project-tab-btn.is-active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--secondary-100, #180f08);
  border-radius: 1px;
}

.project-chat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.project-chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-container-low, #fbf8f5);
  border: 1px solid rgba(24, 15, 8, 0.04);
  text-decoration: none;
  transition: background-color 120ms, border-color 120ms;
}

.project-chat-item:hover {
  background: var(--surface-container, #f9f6f3);
  border-color: rgba(24, 15, 8, 0.08);
}

.project-chat-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.project-chat-icon {
  display: flex;
  align-items: center;
  color: var(--secondary-300, #8c7a6e);
  flex-shrink: 0;
}

.project-chat-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--secondary-100, #180f08);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-chat-date {
  font-size: 12px;
  color: var(--secondary-300, #8c7a6e);
  flex-shrink: 0;
}

.project-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 44px 20px;
  border-radius: 12px;
  background: rgba(24, 15, 8, 0.015);
  border: 1px dashed rgba(24, 15, 8, 0.08);
  margin-top: 8px;
}

.project-empty-state p {
  margin: 0;
  font-size: 13.5px;
  color: var(--secondary-300, #8c7a6e);
  line-height: 1.5;
  max-width: 440px;
}

.project-empty-title {
  font-weight: 500;
  color: var(--secondary-200, #3d2e24) !important;
  margin-bottom: 4px !important;
}

/* Modal Overlay & Cards */
.cropus-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(24, 15, 8, 0.35);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modalFadeIn 140ms ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cropus-modal-card {
  width: 100%;
  max-width: 480px;
  background: #fefdfb;
  border: 1px solid rgba(61, 46, 36, 0.1);
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(24, 15, 8, 0.15), 0 2px 6px rgba(24, 15, 8, 0.04);
  padding: 22px;
  font-family: IDGrotesk, sans-serif;
  animation: modalScaleUp 140ms ease-out;
}

@keyframes modalScaleUp {
  from { transform: scale(0.96); }
  to { transform: scale(1); }
}

.cropus-modal-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 500;
  color: var(--secondary-100, #180f08);
}

.cropus-modal-desc {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--secondary-300, #8c7a6e);
  line-height: 1.45;
}

.cropus-modal-textarea {
  width: 100%;
  min-height: 140px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-container-low, #fbf8f5);
  border: 1px solid var(--outline-soft, #f1ece7);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--secondary-100, #180f08);
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 140ms;
}

.cropus-modal-textarea:focus {
  border-color: var(--primary, #00738f);
  background: #ffffff;
}

.cropus-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.cropus-btn-primary {
  background: var(--primary, #00738f);
  color: #ffffff;
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: opacity 120ms;
}

.cropus-btn-primary:hover {
  opacity: 0.9;
}

.cropus-btn-secondary {
  background: rgba(24, 15, 8, 0.05);
  color: var(--secondary-200, #3d2e24);
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 450;
  border: 1px solid rgba(24, 15, 8, 0.08);
  cursor: pointer;
  transition: background-color 120ms;
}

.cropus-btn-secondary:hover {
  background: rgba(24, 15, 8, 0.09);
}

.cropus-btn-danger {
  background: #b3261e;
  color: #ffffff;
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: opacity 120ms;
}

.cropus-btn-danger:hover {
  opacity: 0.9;
}

/* ==================================================
   Sign-out Confirmation Overlay & Logged-out UI
   ================================================== */
.signout-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 15, 8, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease-out;
}

.signout-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.signout-overlay.is-leaving {
  opacity: 0;
  transition: opacity 180ms ease-in;
}

.signout-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: min(360px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 30px 24px 26px;
  border: 1px solid rgba(61, 46, 36, 0.08);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 20px 48px rgba(24, 15, 8, 0.16), 0 2px 8px rgba(24, 15, 8, 0.04);
  color: var(--secondary-100, #180f08);
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), opacity 220ms ease-out;
}

.signout-overlay.is-visible .signout-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.signout-overlay.is-leaving .signout-card {
  transform: translateY(-4px) scale(0.99);
  opacity: 0;
  transition: transform 180ms ease-in, opacity 180ms ease-in;
}

.signout-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--secondary-700, #f5f1ee);
  border: 1px solid var(--border-soft, #f1ece7);
  color: var(--secondary-100, #180f08);
  margin-bottom: 14px;
}

.signout-icon-badge svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.4;
}

.signout-title {
  margin: 0 0 6px;
  font-family: inherit;
  font-size: 16.5px;
  font-weight: 500;
  line-height: 23px;
  color: var(--secondary-100, #180f08);
  letter-spacing: -0.01em;
}

.signout-desc {
  margin: 0;
  font-size: 13.5px;
  font-weight: 400;
  line-height: 19px;
  color: var(--secondary-300, #6b5a50);
}

/* Logged-out Topbar & Sidebar Actions */
:is(.credits-pill, .image-credit, .video-credit).is-logged-out {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  height: 32px !important;
  padding: 0 13px !important;
  border-radius: 999px !important;
  background: rgba(24, 15, 8, 0.04) !important;
  border: 1px solid rgba(24, 15, 8, 0.08) !important;
  color: var(--secondary-100, #180f08) !important;
  font-family: inherit !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  box-shadow: none !important;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

:is(.credits-pill, .image-credit, .video-credit).is-logged-out:hover {
  background: #ece3dd !important;
  border-color: rgba(24, 15, 8, 0.12) !important;
  color: var(--secondary-100, #180f08) !important;
}

:is(.credits-pill, .image-credit, .video-credit).is-logged-out svg {
  width: 15px !important;
  height: 15px !important;
  stroke: currentColor !important;
  fill: none !important;
  display: inline-block !important;
}

/*
  Brief, auth-independent placeholder for the topbar credit widget between
  server render and the client-side patch that fills in the real state
  (Component 4, Part B) -- neutral rather than "Sign in" or a stale number,
  since we no longer know auth state at server-render time for this widget.
*/
:is(.credits-pill, .image-credit, .video-credit).is-loading {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 32px !important;
  padding: 0 13px !important;
  border-radius: 999px !important;
  background: rgba(24, 15, 8, 0.04) !important;
  border: 1px solid rgba(24, 15, 8, 0.08) !important;
  box-shadow: none !important;
  cursor: default !important;
}

.credits-pill-skeleton {
  display: inline-block;
  width: 40px;
  height: 10px;
  border-radius: 999px;
  background: currentColor;
  color: var(--secondary-100, #180f08);
  opacity: 0.14;
}

.profile-pill-button.is-logged-out .profile-photo {
  background: transparent;
  color: var(--secondary-100, #180f08);
}

.profile-pill-button.is-logged-out .profile-photo svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
}

/* ==========================================================================
   Onboarding Modal (3-step flow for email-registered users)
   ========================================================================== */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(24, 15, 8, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease-out;
}

.onboarding-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.onboarding-overlay.is-leaving {
  opacity: 0;
  transition: opacity 180ms ease-in;
}

.onboarding-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, calc(100vw - 32px));
  max-height: min(660px, calc(100vh - 36px));
  box-sizing: border-box;
  padding: 26px 30px 28px;
  background: #fefdfb;
  border: 1px solid #f1ece7;
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(24, 15, 8, 0.14), 0 4px 16px rgba(24, 15, 8, 0.04);
  color: var(--secondary-100, #180f08);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1), opacity 240ms ease-out;
  font-family: "IDGrotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-y: auto;
  overflow-x: hidden;
}

.onboarding-overlay.is-visible .onboarding-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.onboarding-overlay.is-leaving .onboarding-card {
  transform: translateY(-8px) scale(0.98);
  opacity: 0;
  transition: transform 180ms ease-in, opacity 180ms ease-in;
}

.onboarding-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  margin-bottom: 18px;
}

.onboarding-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #f1ece7;
  background: #ffffff;
  color: #3d2e24;
  cursor: pointer;
  padding: 0;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 120ms ease;
}

.onboarding-back-btn:hover {
  background: #f5f1ee;
  border-color: #eae2dc;
  color: #180f08;
  transform: translateX(-1px);
}

.onboarding-top-bar-placeholder {
  width: 32px;
  height: 32px;
}

.onboarding-stepper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.onboarding-stepper-bars {
  display: flex;
  align-items: center;
  gap: 6px;
}

.onboarding-step-bar {
  width: 24px;
  height: 3.5px;
  border-radius: 999px;
  background: #eae2dc;
  transition: background-color 180ms ease, width 180ms ease;
}

.onboarding-step-bar.is-active {
  background: #180f08;
  width: 28px;
}

.onboarding-step-label {
  font-size: 11px;
  font-weight: 500;
  color: #6b5a50;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.onboarding-skip-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: #6b5a50;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 140ms ease, background-color 140ms ease;
}

.onboarding-skip-btn:hover {
  color: #180f08;
  background: rgba(24, 15, 8, 0.04);
}

.onboarding-header-group {
  margin-bottom: 22px;
}

.onboarding-title {
  font-size: 24px;
  font-weight: 500;
  line-height: 1.25;
  color: #180f08;
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}

.onboarding-subtitle {
  font-size: 14px;
  line-height: 20px;
  color: #6b5a50;
  margin: 0;
}

.onboarding-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin-bottom: 24px;
}

/* Step 1 Avatar Showcase */
.onboarding-avatar-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 6px 0 8px;
  width: 100%;
}

.onboarding-avatar-frame {
  position: relative;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fbf8f5 0%, #f5f1ee 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 0 4px #ffffff, 0 0 0 5px #f1ece7, 0 10px 24px rgba(24, 15, 8, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease;
  user-select: none;
}

.onboarding-avatar-frame:hover {
  transform: scale(1.03);
  box-shadow: 0 0 0 4px #ffffff, 0 0 0 5px #00738f, 0 12px 28px rgba(0, 115, 143, 0.12);
}

.onboarding-avatar-frame.has-image {
  box-shadow: 0 0 0 4px #ffffff, 0 0 0 5px #eae2dc, 0 10px 24px rgba(24, 15, 8, 0.1);
}

.onboarding-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.onboarding-avatar-monogram {
  font-size: 36px;
  font-weight: 500;
  color: #180f08;
  letter-spacing: -0.5px;
  line-height: 1;
  font-family: "IDGrotesk", sans-serif;
}

.onboarding-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.onboarding-avatar-badge {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #180f08;
  color: #ffffff;
  border: 2.5px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(24, 15, 8, 0.18);
  transition: background-color 140ms ease, transform 140ms ease;
}

.onboarding-avatar-frame:hover .onboarding-avatar-badge {
  transform: scale(1.08);
  background: #00738f;
}

.onboarding-dropzone {
  width: 100%;
  box-sizing: border-box;
  background: #fbf8f5;
  border: 1.5px dashed #cbc0b6;
  border-radius: 16px;
  padding: 20px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 160ms ease;
  user-select: none;
}

.onboarding-dropzone:hover {
  border-color: #00738f;
  background: #f9f6f3;
}

.onboarding-dropzone.is-dragging {
  border-color: #00738f;
  border-style: solid;
  background: rgba(0, 115, 143, 0.05);
  transform: scale(1.01);
}

.onboarding-dropzone.has-file {
  border-style: solid;
  border-color: #f1ece7;
  background: #ffffff;
  cursor: default;
  padding: 14px 18px;
}

.onboarding-dropzone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.onboarding-dropzone-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #f1ece7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #180f08;
  box-shadow: 0 2px 6px rgba(24, 15, 8, 0.04);
}

.onboarding-dropzone-text {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
}

.onboarding-dropzone-action {
  font-weight: 500;
  color: #00738f;
  text-decoration: underline;
  text-underline-offset: 2.5px;
}

.onboarding-dropzone-sub {
  color: #6b5a50;
}

.onboarding-dropzone-hint {
  font-size: 12px;
  color: #a19286;
}

.onboarding-file-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.onboarding-file-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.onboarding-file-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 115, 143, 0.1);
  color: #00738f;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.onboarding-file-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
}

.onboarding-file-name {
  font-size: 13px;
  font-weight: 500;
  color: #180f08;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.onboarding-file-size {
  font-size: 11.5px;
  color: #6b5a50;
}

.onboarding-file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.onboarding-change-btn {
  background: #f5f1ee;
  border: 1px solid #eae2dc;
  border-radius: 999px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #180f08;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.onboarding-change-btn:hover {
  background: #eae2dc;
}

.onboarding-remove-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #9c2e2e;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 6px;
  transition: background-color 140ms ease;
}

.onboarding-remove-btn:hover {
  background: rgba(156, 46, 46, 0.08);
}

.onboarding-error-msg {
  font-size: 13px;
  color: #d03d3d;
  text-align: center;
  margin-top: 2px;
}

/* Steps 2 & 3: Pill Grid */
.onboarding-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 12px;
}

.onboarding-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #f1ece7;
  color: #3d2e24;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 450;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 120ms ease, box-shadow 120ms ease;
  outline: none;
}

.onboarding-pill:hover {
  background: #f5f1ee;
  border-color: #eae2dc;
  color: #180f08;
}

.onboarding-pill.is-selected {
  background: #180f08;
  border-color: #180f08;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(24, 15, 8, 0.15);
  transform: scale(1.02);
}

.onboarding-pill.is-selected svg {
  stroke: #ffffff;
}

.onboarding-pill.is-selected svg [fill="currentColor"] {
  fill: #ffffff;
}

.onboarding-pill:focus-visible {
  outline: 2px solid #00738f;
  outline-offset: 2px;
}

.onboarding-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.onboarding-pill-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.onboarding-pill-icon svg [fill="currentColor"] {
  fill: currentColor;
}

.onboarding-other-wrapper {
  width: 100%;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: onboardingFadeIn 180ms ease-out;
}

.onboarding-other-label {
  font-size: 12px;
  font-weight: 500;
  color: #6b5a50;
}

.onboarding-other-input {
  width: 100%;
  box-sizing: border-box;
  height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1.5px solid #00738f;
  background: #ffffff;
  color: #180f08;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 115, 143, 0.12);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.onboarding-other-input:focus {
  border-color: #00738f;
  box-shadow: 0 0 0 3.5px rgba(0, 115, 143, 0.22);
}

/* Bottom full-width Continue / Get started button */
.onboarding-continue-btn {
  width: 100%;
  height: 48px;
  border-radius: 999px;
  background: #180f08;
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 140ms ease, transform 120ms ease, box-shadow 140ms ease;
  margin-top: auto;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(24, 15, 8, 0.14);
}

.onboarding-continue-btn:hover:not(:disabled) {
  background: #2e1e13;
  box-shadow: 0 6px 18px rgba(24, 15, 8, 0.2);
}

.onboarding-continue-btn:active:not(:disabled) {
  transform: scale(0.99);
}

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

/* Dark Mode Tokens */
html[data-theme="dark"] .onboarding-card {
  background: #191614;
  border-color: #2b2520;
  color: #fbf8f5;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .onboarding-title {
  color: #fefdfb;
}

html[data-theme="dark"] .onboarding-subtitle {
  color: #b09f92;
}

html[data-theme="dark"] .onboarding-step-bar {
  background: #2e2621;
}

html[data-theme="dark"] .onboarding-step-bar.is-active {
  background: #eae2dc;
}

html[data-theme="dark"] .onboarding-step-label {
  color: #b09f92;
}

html[data-theme="dark"] .onboarding-back-btn {
  background: #241e1a;
  border-color: #382e27;
  color: #eae2dc;
}

html[data-theme="dark"] .onboarding-back-btn:hover {
  background: #2e2621;
  border-color: #483c33;
  color: #ffffff;
}

html[data-theme="dark"] .onboarding-skip-btn {
  color: #b09f92;
}

html[data-theme="dark"] .onboarding-skip-btn:hover {
  color: #fefdfb;
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .onboarding-avatar-frame {
  background: linear-gradient(145deg, #241e1a 0%, #1c1815 100%);
  box-shadow: 0 0 0 4px #191614, 0 0 0 5px #382e27, 0 10px 24px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .onboarding-avatar-frame:hover {
  box-shadow: 0 0 0 4px #191614, 0 0 0 5px #00738f, 0 12px 28px rgba(0, 115, 143, 0.2);
}

html[data-theme="dark"] .onboarding-avatar-monogram {
  color: #eae2dc;
}

html[data-theme="dark"] .onboarding-avatar-badge {
  background: #eae2dc;
  color: #180f08;
  border-color: #191614;
}

html[data-theme="dark"] .onboarding-dropzone {
  background: #201b17;
  border-color: #382e27;
}

html[data-theme="dark"] .onboarding-dropzone:hover {
  border-color: #00738f;
  background: #25201b;
}

html[data-theme="dark"] .onboarding-dropzone.has-file {
  background: #241e1a;
  border-color: #382e27;
}

html[data-theme="dark"] .onboarding-dropzone-icon {
  background: #241e1a;
  border-color: #382e27;
  color: #eae2dc;
}

html[data-theme="dark"] .onboarding-dropzone-sub {
  color: #b09f92;
}

html[data-theme="dark"] .onboarding-dropzone-hint {
  color: #7d6e64;
}

html[data-theme="dark"] .onboarding-file-name {
  color: #fefdfb;
}

html[data-theme="dark"] .onboarding-file-size {
  color: #b09f92;
}

html[data-theme="dark"] .onboarding-change-btn {
  background: #2e2621;
  border-color: #483c33;
  color: #eae2dc;
}

html[data-theme="dark"] .onboarding-change-btn:hover {
  background: #382e27;
}

html[data-theme="dark"] .onboarding-pill {
  background: #241e1a;
  border-color: #382e27;
  color: #e5dbd3;
}

html[data-theme="dark"] .onboarding-pill:hover {
  background: #2e2621;
  border-color: #483c33;
}

html[data-theme="dark"] .onboarding-pill.is-selected {
  background: #eae2dc;
  border-color: #eae2dc;
  color: #180f08;
}

html[data-theme="dark"] .onboarding-pill.is-selected svg {
  stroke: #180f08;
}

html[data-theme="dark"] .onboarding-pill.is-selected svg [fill="currentColor"] {
  fill: #180f08;
}

html[data-theme="dark"] .onboarding-other-label {
  color: #b09f92;
}

html[data-theme="dark"] .onboarding-other-input {
  background: #241e1a;
  border-color: #483c33;
  color: #fefdfb;
}

html[data-theme="dark"] .onboarding-continue-btn {
  background: #eae2dc;
  color: #180f08;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .onboarding-continue-btn:hover:not(:disabled) {
  background: #d5d5d5;
}

@media (max-width: 580px) {
  .onboarding-card {
    padding: 18px 20px 22px;
    border-radius: 22px;
  }
  .onboarding-title {
    font-size: 22px;
  }
  .onboarding-pill {
    padding: 0 13px;
    font-size: 13px;
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
