body {
  background-image:
    radial-gradient(circle at top left, rgba(109, 140, 85, 0.12), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(57, 84, 44, 0.1), transparent 24rem);
  background-repeat: no-repeat;
  background-size: 100% 100%, 100% 100%;
  background-attachment: fixed;
}

.app-sidebar-brand-short {
  display: none;
}

html.mobile-sidebar-open,
body.mobile-sidebar-open {
  overflow: hidden;
}

.app-mobile-sidebar-drawer {
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.project-upload-zone {
  position: relative;
  isolation: isolate;
}

.project-upload-zone::before {
  content: "";
  position: absolute;
  inset: auto -4rem -5rem auto;
  width: 14rem;
  height: 14rem;
  border-radius: 9999px;
  background:
    radial-gradient(circle, rgba(109, 140, 85, 0.18) 0%, rgba(109, 140, 85, 0.02) 62%, transparent 72%);
  pointer-events: none;
  z-index: 0;
}

.project-upload-zone,
.project-upload-zone [for="upload-file"],
.project-upload-zone button[type="submit"] {
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

.project-upload-zone.is-dragover {
  border-color: rgba(57, 84, 44, 0.55);
  box-shadow: 0 18px 40px rgba(23, 34, 18, 0.12);
  transform: translateY(-1px);
}

.project-upload-zone.is-dragover [for="upload-file"] {
  border-color: rgba(57, 84, 44, 0.65);
  background: rgba(57, 84, 44, 0.08);
}

.project-upload-orb {
  position: absolute;
  inset: -2.5rem auto auto -2.5rem;
  width: 9rem;
  height: 9rem;
  border-radius: 9999px;
  background:
    radial-gradient(circle, rgba(175, 197, 154, 0.32) 0%, rgba(175, 197, 154, 0.06) 55%, transparent 72%);
  pointer-events: none;
  z-index: 0;
}

.project-upload-preview:not(.hidden) {
  display: block;
}

.chat-body-lock {
  overflow: hidden;
}

.chat-shell-lock {
  height: 100dvh;
  overflow: hidden;
}

.chat-main-lock {
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.chat-main-section {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.chat-page-shell {
  min-height: 0;
  flex: 1 1 auto;
}

.chat-composer-shell {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: #f8f8f7;
  transition:
    padding 180ms ease,
    gap 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 8px 24px rgba(15, 23, 42, 0.05);
}

.chat-composer-shell.chat-composer-expanded {
  gap: 0.7rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.chat-composer-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "attach input send";
  align-items: center;
  column-gap: 0.5rem;
  row-gap: 0.65rem;
}

.chat-composer-main.chat-composer-has-context {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "attach input context send";
}

.chat-composer-shell.chat-composer-expanded .chat-composer-main {
  grid-template-areas:
    "input input input"
    "attach tools send";
}

.chat-composer-shell.chat-composer-expanded .chat-composer-main.chat-composer-has-context {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "input input input input"
    "attach tools context send";
}

.chat-composer-input {
  grid-area: input;
  min-height: 1.5rem;
  padding-top: 0;
  padding-bottom: 0;
  transition: min-height 180ms ease;
}

.chat-composer-shell.chat-composer-expanded .chat-composer-input {
  min-height: 1.9rem;
}

.chat-composer-input:focus {
  outline: none;
  box-shadow: none;
}

.chat-composer-action,
.chat-composer-send,
#composer-tools > span {
  min-height: 2.25rem;
}

.chat-composer-action,
.chat-composer-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-composer-action {
  grid-area: attach;
}

.chat-composer-send {
  grid-area: send;
}

#composer-tools {
  grid-area: tools;
}

.chat-composer-context {
  grid-area: context;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.25rem;
  min-width: 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border: 1px solid transparent;
  background: transparent;
  padding: 0 0.7rem;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

#composer-tools > span {
  max-width: 100%;
}

.chat-composer-action {
  border: 0;
  background: transparent;
  box-shadow: none;
  min-width: 2.25rem;
  border: 1px solid transparent;
  padding: 0 0.5rem;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

#composer-tools > span {
  border: 1px solid transparent;
  background: transparent;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.chat-composer-action:hover,
.chat-composer-action:focus-visible {
  border-color: rgba(109, 140, 85, 0.45);
}

.chat-composer-context:hover,
.chat-composer-context:focus-visible {
  border-color: rgba(120, 130, 145, 0.4);
}

#composer-tools > span:hover,
#composer-tools > span:focus-within {
  border-color: rgba(120, 130, 145, 0.4);
}

.chat-thread,
.chat-conversations-scroll {
  overscroll-behavior: contain;
}

.chat-thread {
  scroll-padding-bottom: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.chat-thread:hover {
  scrollbar-color: rgba(120, 113, 108, 0.25) transparent;
}

.dark .chat-thread:hover {
  scrollbar-color: rgba(168, 162, 158, 0.2) transparent;
}

.chat-thread::-webkit-scrollbar {
  width: 6px;
}

.chat-thread::-webkit-scrollbar-track {
  background: transparent;
}

.chat-thread::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}

.chat-thread:hover::-webkit-scrollbar-thumb {
  background: rgba(120, 113, 108, 0.25);
}

.dark .chat-thread:hover::-webkit-scrollbar-thumb {
  background: rgba(168, 162, 158, 0.2);
}

.chat-conversations-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 113, 108, 0.15) transparent;
}

.chat-mobile-drawer {
  max-height: calc(100dvh - 1.5rem);
}

.chat-desktop-drawer {
  max-height: calc(100dvh - 1.5rem);
  min-height: 0;
}

.chat-thread-column {
  min-width: 0;
}

/* Jump control: ensure [hidden] always wins over utility display classes */
#chat-jump-latest[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.chat-thread-prose pre {
  padding: 1rem 1.15rem;
  border-radius: 0.75rem;
  margin-top: 0.85rem;
  margin-bottom: 0.85rem;
  overflow-x: auto;
}

.chat-thread-prose pre code {
  padding: 0;
  background: transparent;
  font-size: 0.8125rem;
  line-height: 1.55;
}

.chat-thread-prose :not(pre) > code {
  padding: 0.15rem 0.4rem;
  border-radius: 0.35rem;
  font-size: 0.8125em;
}

.dark .chat-thread-prose pre {
  background: rgba(10, 10, 10, 0.92);
  border: 1px solid rgba(63, 63, 70, 0.85);
}

@media (max-width: 1023px) {
  .chat-shell-lock {
    display: flex;
    flex-direction: column;
  }

  .chat-shell-lock > main {
    flex: 1 1 auto;
    min-height: 0;
  }
}

@media (min-width: 1024px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
    transition: grid-template-columns 180ms ease;
  }

  .app-sidebar {
    overflow: hidden;
  }

  .app-sidebar-panel {
    min-height: 100%;
  }

  .app-sidebar-header {
    align-items: flex-start;
  }

  .app-sidebar-brand {
    transition: font-size 180ms ease;
  }

  .app-sidebar-copy,
  .app-sidebar-projects {
    transition:
      opacity 140ms ease,
      transform 140ms ease,
      max-height 180ms ease,
      margin 140ms ease;
  }

  .app-sidebar-nav-link {
    transition:
      gap 180ms ease,
      padding 180ms ease,
      background-color 140ms ease,
      justify-content 180ms ease;
  }

  .app-sidebar-toggle {
    flex-shrink: 0;
    min-width: 2.75rem;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .app-sidebar-toggle-icon {
    flex-shrink: 0;
    line-height: 1;
  }

  .app-sidebar-toggle-glyph {
    display: block;
    line-height: 1;
    transform-origin: center;
    transition: transform 180ms ease;
  }

  .app-sidebar-footer {
    transition:
      padding 180ms ease,
      border-color 140ms ease;
  }

  .app-shell.sidebar-collapsed,
  .sidebar-pref-collapsed .app-shell {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .app-shell.sidebar-collapsed .app-sidebar,
  .sidebar-pref-collapsed .app-shell .app-sidebar {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .app-shell.sidebar-collapsed .app-sidebar-header,
  .sidebar-pref-collapsed .app-shell .app-sidebar-header {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }

  .app-shell.sidebar-collapsed .app-sidebar-main,
  .sidebar-pref-collapsed .app-shell .app-sidebar-main {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .app-shell.sidebar-collapsed .app-sidebar-nav-link,
  .app-shell.sidebar-collapsed .app-sidebar-footer form,
  .sidebar-pref-collapsed .app-shell .app-sidebar-nav-link,
  .sidebar-pref-collapsed .app-shell .app-sidebar-footer form {
    width: 100%;
  }

  .app-shell.sidebar-collapsed .app-sidebar-nav-link,
  .sidebar-pref-collapsed .app-shell .app-sidebar-nav-link {
    justify-content: center;
    gap: 0;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  .app-shell.sidebar-collapsed .app-sidebar-copy,
  .sidebar-pref-collapsed .app-shell .app-sidebar-copy {
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-0.35rem);
  }

  .app-shell.sidebar-collapsed .app-sidebar-projects,
  .sidebar-pref-collapsed .app-shell .app-sidebar-projects {
    max-height: 0;
    margin: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-0.35rem);
  }

  .app-shell.sidebar-collapsed .app-sidebar-brand,
  .sidebar-pref-collapsed .app-shell .app-sidebar-brand {
    justify-content: center;
    width: 100%;
  }

  .app-shell.sidebar-collapsed .app-sidebar-brand-long,
  .sidebar-pref-collapsed .app-shell .app-sidebar-brand-long {
    display: none;
  }

  .app-shell.sidebar-collapsed .app-sidebar-brand-short,
  .sidebar-pref-collapsed .app-shell .app-sidebar-brand-short {
    display: inline;
  }

  .app-shell.sidebar-collapsed .app-sidebar-toggle,
  .sidebar-pref-collapsed .app-shell .app-sidebar-toggle {
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  .app-shell.sidebar-collapsed .app-sidebar-footer,
  .sidebar-pref-collapsed .app-shell .app-sidebar-footer {
    width: 100%;
    padding-top: 0;
    border-top-color: transparent;
  }
}

.dark body {
  background-image:
    radial-gradient(circle at top left, rgba(109, 140, 85, 0.16), transparent 24rem),
    radial-gradient(circle at bottom right, rgba(57, 84, 44, 0.14), transparent 22rem);
  background-repeat: no-repeat;
  background-size: 100% 100%, 100% 100%;
  background-attachment: fixed;
}

.dark .project-upload-zone::before {
  background:
    radial-gradient(circle, rgba(109, 140, 85, 0.24) 0%, rgba(109, 140, 85, 0.04) 58%, transparent 72%);
}

.dark .chat-composer-shell {
  background: #171717;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 24px rgba(0, 0, 0, 0.18);
}

.dark .chat-composer-action:hover,
.dark .chat-composer-action:focus-visible {
  border-color: rgba(175, 197, 154, 0.45);
}

.dark .chat-composer-context:hover,
.dark .chat-composer-context:focus-visible {
  border-color: rgba(120, 130, 145, 0.65);
}

.dark #composer-tools > span:hover,
.dark #composer-tools > span:focus-within {
  border-color: rgba(120, 130, 145, 0.65);
}

.dark .project-upload-zone.is-dragover {
  border-color: rgba(175, 197, 154, 0.55);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.26);
}

.dark .project-upload-zone.is-dragover [for="upload-file"] {
  border-color: rgba(175, 197, 154, 0.6);
  background: rgba(109, 140, 85, 0.14);
}

.dark .project-upload-orb {
  background:
    radial-gradient(circle, rgba(109, 140, 85, 0.3) 0%, rgba(109, 140, 85, 0.06) 52%, transparent 72%);
}

@media print {
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
  }

  aside,
  nav,
  header,
  form,
  button,
  [data-dropzone],
  .no-print {
    display: none !important;
  }

  main {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .lg\:grid {
    display: block !important;
  }

  .prose {
    max-width: 100% !important;
  }

  a {
    text-decoration: none !important;
    color: inherit !important;
  }
}
