/* Navorina AI Workspace — fullscreen finance OS (no gradients, no glass).
 * Shared dashboard tokens come from dashboard.css so responsive shell gutters
 * keep the same cascade order as every other app section.
 */

:root {
  --aiw-rail-gutter: 16px;
  --aiw-app-sidebar-w: 72px;
  --aiw-rail-w: calc(280px + var(--aiw-rail-gutter));
  --aiw-context-w: 360px;
  --aiw-thread-w: 920px;
  --aiw-radius-card: var(--dash-radius-island, 24px);
  --aiw-radius-composer: 24px;
  --aiw-radius-input: var(--dash-radius-input, 16px);
  --aiw-radius-btn: var(--dash-radius-btn, 14px);
  --aiw-radius-msg: 18px;
  --aiw-transition: var(--dash-transition, 150ms ease-out);
}

.aiw-page {
  --aiw-collapsed-item: 44px;
  --aiw-collapsed-icon: 18px;
  margin: 0;
  min-height: 100vh;
  min-width: 0;
  width: 100%;
  background: var(--aiw-bg);
  color: var(--aiw-text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  overflow: hidden;
}

.aiw-shell {
  --aiw-app-sidebar-track: calc(
    var(--dash-sidebar-w) + var(--dash-sidebar-outer-gutter, 0px)
  );
  display: grid;
  width: 100%;
  max-width: 100vw;
  grid-template-columns:
    minmax(0, var(--aiw-app-sidebar-track))
    minmax(0, var(--aiw-rail-w))
    minmax(0, 1fr)
    minmax(0, var(--aiw-context-w));
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns var(--aiw-transition);
  isolation: isolate;
}

body.dash-page:not(.dash-nav-ready) .aiw-shell {
  transition: none;
}

.aiw-shell > .dash-sidebar,
.aiw-shell > .aiw-sidebar,
.aiw-shell > .aiw-main,
.aiw-shell > .aiw-context {
  min-height: 0;
}

.aiw-shell > .dash-sidebar {
  position: sticky;
  top: 0;
  z-index: auto;
  height: 100vh;
  max-height: 100vh;
  width: var(--dash-sidebar-w);
  max-width: var(--dash-sidebar-w);
  min-width: 0;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

.aiw-shell > .dash-sidebar,
.aiw-chats,
.aiw-thread,
.aiw-context__body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.aiw-shell > .dash-sidebar::-webkit-scrollbar,
.aiw-chats::-webkit-scrollbar,
.aiw-thread::-webkit-scrollbar,
.aiw-context__body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.aiw-shell > .dash-sidebar {
  padding: 18px 12px;
  align-items: center;
}

:is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) {
  --dash-sidebar-w: 248px;
}

.aiw-shell > .dash-sidebar .dash-sidebar-toggle {
  display: grid;
  place-items: center;
  width: var(--aiw-collapsed-item);
  height: var(--aiw-collapsed-item);
  margin: 0 0 16px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--dash-text-muted);
  cursor: pointer;
  transition: background var(--aiw-transition), color var(--aiw-transition), transform var(--aiw-transition);
}

.aiw-shell > .dash-sidebar .dash-sidebar-toggle:hover,
.aiw-shell > .dash-sidebar .dash-sidebar-toggle:focus-visible {
  outline: none;
  background: var(--dash-surface);
  color: var(--dash-text);
}

.aiw-shell > .dash-sidebar .dash-sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

.aiw-shell > .dash-sidebar .dash-sidebar-toggle__icon {
  display: grid;
  place-items: center;
}

:is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-sidebar-toggle {
  position: absolute;
  top: 18px;
  right: 14px;
  margin: 0;
}

html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-logo {
  display: none;
}

html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-logo__word,
html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__label,
html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-pro__title,
html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-pro__text,
html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-pro__btn,
html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__sub {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-nav {
  order: 2;
  width: var(--aiw-collapsed-item);
  align-items: center;
  gap: 6px;
}

html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-sidebar-toggle {
  position: static;
  order: 1;
  display: grid;
  margin: 0 0 16px;
}

html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__link,
html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__link--parent,
html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__sublink {
  width: var(--aiw-collapsed-item);
  height: var(--aiw-collapsed-item);
  justify-content: center;
  padding: 0;
  gap: 0;
  border-radius: 14px;
}

html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__icon {
  width: var(--aiw-collapsed-item);
  height: var(--aiw-collapsed-item);
  background: transparent;
}

html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__link.is-active .dash-nav__icon,
html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__link--parent.is-active .dash-nav__icon {
  background: transparent;
}

html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__link svg {
  width: var(--aiw-collapsed-icon);
  height: var(--aiw-collapsed-icon);
}

html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-pro {
  order: 5;
  width: var(--aiw-collapsed-item);
  height: var(--aiw-collapsed-item);
  min-height: var(--aiw-collapsed-item);
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 16px;
}

html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-pro__icon {
  width: var(--aiw-collapsed-item);
  height: var(--aiw-collapsed-item);
  margin: 0;
  border-radius: 14px;
}

html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) > .dash-sidebar .dash-pro__icon :is(svg, img) {
  width: var(--aiw-collapsed-icon);
  height: var(--aiw-collapsed-icon);
}

:is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar {
  padding: 24px 16px;
  align-items: stretch;
}

:is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-logo {
  width: auto;
  height: auto;
  justify-content: flex-start;
  padding: 0 48px 32px 8px;
  gap: 10px;
}

:is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-logo__mark {
  background: transparent;
}

:is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-nav {
  width: auto;
  align-items: stretch;
  gap: 4px;
}

.aiw-shell.is-rail-collapsed {
  grid-template-columns:
    minmax(0, var(--aiw-app-sidebar-track))
    minmax(0, 1fr)
    minmax(0, var(--aiw-context-w));
}

.aiw-shell.is-rail-collapsed .aiw-sidebar {
  display: none;
}

.aiw-shell:not(.is-rail-collapsed) .aiw-main__head > [data-aiw-collapse-rail] {
  display: none;
}

.aiw-shell.is-rail-collapsed .aiw-main__head,
.aiw-shell.is-rail-collapsed .aiw-composer-wrap__inner {
  transform: translateX(-6px);
}

.aiw-shell.is-context-collapsed {
  grid-template-columns:
    minmax(0, var(--aiw-app-sidebar-track))
    minmax(0, var(--aiw-rail-w))
    minmax(0, 1fr);
}

.aiw-shell.is-context-collapsed .aiw-context {
  display: none;
}

.aiw-main__head [data-aiw-toggle-context] {
  display: none;
}

.aiw-shell.is-context-collapsed .aiw-main__head [data-aiw-toggle-context] {
  display: grid;
}

.aiw-shell.is-rail-collapsed.is-context-collapsed {
  grid-template-columns:
    minmax(0, var(--aiw-app-sidebar-track))
    minmax(0, 1fr);
}

/* ── Conversations rail ── */

.aiw-sidebar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--aiw-rail-w);
  padding: var(--aiw-rail-gutter) 0 var(--aiw-rail-gutter) var(--aiw-rail-gutter);
  background: transparent;
  border: none;
  overflow: hidden;
  min-width: 0;
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
}

.aiw-sidebar__island {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border-radius: var(--aiw-radius-card);
  background: var(--dash-surface);
  overflow: hidden;
  border: none;
}

.aiw-sidebar__head {
  padding: 14px 14px 12px;
  border-bottom: none;
}

.aiw-sidebar__head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  margin-bottom: 12px;
}

html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) .aiw-sidebar__head-row {
  justify-content: flex-start;
}

.aiw-sidebar__head-row [data-aiw-collapse-rail] {
  flex: 0 0 auto;
  margin-left: auto;
}

.aiw-sidebar__title {
  margin: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  color: var(--aiw-muted);
}

.aiw-sidebar__head-row .aiw-btn--icon,
.aiw-context__head .aiw-btn--icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: var(--aiw-muted);
}

.aiw-sidebar__head-row .aiw-btn--icon svg,
.aiw-context__head .aiw-btn--icon svg {
  width: 16px;
  height: 16px;
}

.aiw-workspace {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--aiw-radius-input);
  background: var(--aiw-card);
  color: var(--aiw-text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--aiw-transition), background var(--aiw-transition);
}

.aiw-workspace:hover { background: var(--dash-surface-hover); }

.aiw-workspace > svg {
  width: 16px;
  height: 16px;
  color: var(--aiw-muted);
  margin-left: auto;
}

.aiw-workspace__mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--dash-surface-hover);
  color: #fff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.aiw-workspace__mark svg {
  display: block;
  width: 14px;
  height: 19px;
  overflow: visible;
}

.aiw-sidebar__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
}

.aiw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--aiw-radius-btn);
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--aiw-transition), color var(--aiw-transition), border-color var(--aiw-transition), transform var(--aiw-transition);
}

.aiw-btn--primary {
  background: var(--aiw-primary);
  color: var(--aiw-primary-text, var(--dash-accent-text));
}

.aiw-btn--primary:hover {
  background: var(--dash-accent-hover);
  filter: none;
}

.aiw-btn--ghost {
  background: transparent;
  color: var(--aiw-secondary);
  border: none;
}

.aiw-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--aiw-text);
}

.aiw-btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--aiw-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--aiw-transition), color var(--aiw-transition);
}

.aiw-btn--icon.aiw-app-sidebar-toggle {
  display: none;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 9px;
}

:is(html.dash-sidebar-collapsed, body.dash-sidebar-collapsed) .aiw-shell .aiw-btn--icon.aiw-app-sidebar-toggle,
.aiw-shell.is-dash-sidebar-collapsed .aiw-btn--icon.aiw-app-sidebar-toggle,
html:not(.dash-sidebar-expanded) .aiw-shell:not(.is-app-sidebar-expanded) .aiw-btn--icon.aiw-app-sidebar-toggle {
  display: grid;
}

:is(html.dash-sidebar-expanded, body.dash-sidebar-expanded) .aiw-shell .aiw-btn--icon.aiw-app-sidebar-toggle,
:is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) .aiw-btn--icon.aiw-app-sidebar-toggle {
  display: none;
}

.aiw-btn--icon:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--aiw-text);
}

.aiw-btn--icon:focus-visible,
.aiw-btn:focus-visible,
.aiw-sidebar__link:focus-visible,
.aiw-chat-item:focus-visible,
.aiw-suggestion:focus-visible,
.aiw-object:focus-visible,
.aiw-chip:focus-visible,
.aiw-workspace:focus-visible,
.aiw-composer-send:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--dash-text) 72%, transparent);
  outline-offset: 2px;
}

.aiw-btn--icon.is-active,
.aiw-btn--icon[aria-pressed="true"] {
  background: var(--dash-surface-hover);
  color: var(--aiw-text);
}

.aiw-search {
  position: relative;
  margin: 0 14px 8px;
}

.aiw-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--aiw-muted);
  pointer-events: none;
}

.aiw-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  border: none;
  border-radius: var(--aiw-radius-input);
  background: var(--aiw-card);
  color: var(--aiw-text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color var(--aiw-transition);
}

.aiw-search input:focus { background: var(--dash-surface-hover); }

.aiw-chats {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 12px;
}

.aiw-chats__group {
  margin-bottom: 12px;
}

.aiw-chats__label {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--aiw-muted);
}

.aiw-chat-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--aiw-transition);
}

.aiw-chat-item:hover { background: rgba(255, 255, 255, 0.04); }

.aiw-chat-item.is-active {
  background: var(--dash-surface-hover);
}

.aiw-chat-item[hidden],
.aiw-chats__group[hidden] {
  display: none;
}

.aiw-chat-item__icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--aiw-elevated);
  display: grid;
  place-items: center;
  color: var(--aiw-muted);
  flex-shrink: 0;
}

.aiw-chat-item__body { flex: 1; min-width: 0; }

.aiw-chat-item__title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--aiw-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aiw-chat-item__preview {
  margin: 0;
  font-size: 12px;
  color: var(--aiw-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aiw-chat-item__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.aiw-chat-item__time {
  font-size: 11px;
  color: var(--aiw-muted);
}

.aiw-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--aiw-primary);
  color: var(--aiw-primary-text, var(--dash-accent-text));
  font-size: 10px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.aiw-chat-item__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dash-text-muted);
  flex-shrink: 0;
}

.aiw-chat-item.is-active .aiw-chat-item__dot {
  background: var(--dash-accent);
}

.aiw-chat-item__hover {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  gap: 2px;
}

.aiw-chat-item:hover .aiw-chat-item__meta { opacity: 0; }
.aiw-chat-item:hover .aiw-chat-item__hover { display: flex; }

.aiw-sidebar__foot {
  padding: 12px 10px;
  border-top: none;
}

.aiw-sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--aiw-secondary);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  font-family: inherit;
  text-align: left;
  transition: background var(--aiw-transition), color var(--aiw-transition);
}

.aiw-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--aiw-text);
}

.aiw-sidebar__link svg { width: 16px; height: 16px; color: var(--aiw-muted); }

/* ── Main ── */

.aiw-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
  background: var(--aiw-bg);
  position: relative;
}

.aiw-main__head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(calc(100% - 48px), var(--aiw-thread-w));
  margin: 0 auto;
  padding: 16px 0;
  border-bottom: none;
  flex-shrink: 0;
  box-sizing: border-box;
}

.aiw-main__title {
  margin: 0;
  font-family: var(--font-serif, 'Instrument Serif', serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--aiw-text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aiw-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  border: none;
  background: var(--aiw-card);
  font-size: 12px;
  color: var(--aiw-secondary);
  cursor: pointer;
  transition: background var(--aiw-transition), color var(--aiw-transition);
}

.aiw-chip:hover {
  background: var(--aiw-elevated);
  color: var(--aiw-text);
}

.aiw-chip[aria-expanded="true"] {
  background: var(--aiw-elevated);
  color: var(--aiw-text);
}

.aiw-chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--aiw-success);
}

.aiw-header-menu {
  position: fixed;
  z-index: 1200;
  display: none;
  width: max-content;
  min-width: 224px;
  padding: 6px;
  border-radius: 14px;
  background: var(--dash-popover-bg-solid, #202020);
  border: 1px solid var(--dash-border-strong, rgba(238, 238, 238, 0.14));
  box-shadow: var(--dash-popover-shadow, 0 18px 50px rgba(0, 0, 0, 0.56));
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.aiw-header-menu.is-open {
  display: grid;
  gap: 2px;
}

.aiw-header-menu__item {
  display: grid;
  gap: 2px;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: var(--dash-popover-bg-solid, #202020);
  color: var(--aiw-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.aiw-header-menu__item small {
  color: var(--aiw-muted);
  font-size: 11px;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.aiw-header-menu__item span {
  min-width: 0;
  display: block;
}

.aiw-header-menu__item:hover,
.aiw-header-menu__item:focus-visible,
.aiw-header-menu__item.is-active {
  outline: none;
  background: var(--dash-popover-row-bg, #2b2b2b);
}

.aiw-header-menu__item.is-active span::after {
  content: "✓";
  float: right;
  color: var(--aiw-secondary);
}

.aiw-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1400;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--dash-popover-bg-solid, #202020);
  border: 1px solid var(--dash-border-strong, rgba(238, 238, 238, 0.14));
  color: var(--aiw-text);
  font-size: 13px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.44);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity var(--aiw-transition), transform var(--aiw-transition);
}

.aiw-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.aiw-thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  padding-bottom: 32px;
  scrollbar-width: none;
}

.aiw-thread__inner {
  max-width: var(--aiw-thread-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 24px;
}

.aiw-scroll-bottom {
  position: absolute;
  left: 50%;
  bottom: 118px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(242, 242, 242, 0.96);
  color: #0d0d0f;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.06);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity var(--aiw-transition), transform var(--aiw-transition), background var(--aiw-transition), box-shadow var(--aiw-transition);
}

.aiw-scroll-bottom.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.aiw-scroll-bottom:hover,
.aiw-scroll-bottom:focus-visible {
  outline: none;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.aiw-scroll-bottom[hidden] {
  display: none;
}

/* Welcome */

.aiw-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px 32px;
  animation: aiw-fade-in 200ms ease-out;
}

.aiw-welcome.is-hidden { display: none; }

.aiw-welcome__illus {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  border: 1px solid var(--aiw-border);
  background: var(--aiw-card);
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  color: var(--aiw-primary);
}

.aiw-welcome__title {
  margin: 0 0 8px;
  font-family: var(--font-serif, 'Instrument Serif', serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.aiw-welcome__sub {
  margin: 0 0 28px;
  font-size: 15px;
  color: var(--aiw-muted);
  max-width: 420px;
}

.aiw-suggestions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 640px;
}

.aiw-suggestion {
  padding: 14px 16px;
  border-radius: var(--aiw-radius-card);
  border: none;
  background: var(--aiw-card);
  text-align: left;
  cursor: pointer;
  transition: background var(--aiw-transition), transform var(--aiw-transition), box-shadow var(--aiw-transition);
}

.aiw-suggestion:hover {
  background: var(--dash-surface-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.aiw-suggestion strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--aiw-text);
  margin-bottom: 4px;
}

.aiw-suggestion span {
  font-size: 12px;
  color: var(--aiw-muted);
  line-height: 1.4;
}

/* Messages */

.aiw-messages { display: flex; flex-direction: column; gap: 28px; }

.aiw-msg {
  display: flex;
  flex-direction: column;
  animation: aiw-fade-in 200ms ease-out;
}

.aiw-msg--user {
  align-items: flex-end;
}

.aiw-msg--ai,
.aiw-msg--system {
  align-items: flex-start;
}

.aiw-msg__avatar {
  display: none;
}

.aiw-msg__bubble {
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.aiw-msg--user .aiw-msg__bubble {
  max-width: min(85%, 640px);
  align-items: flex-end;
}

.aiw-msg--ai .aiw-msg__bubble,
.aiw-msg--system .aiw-msg__bubble {
  width: 100%;
  max-width: 100%;
  align-items: flex-start;
}

.aiw-msg--user .aiw-msg__content {
  padding: 12px 16px;
  border-radius: var(--aiw-radius-msg);
  background: var(--aiw-elevated);
  border: none;
  font-size: 16px;
  color: var(--aiw-text);
  text-align: left;
}

.aiw-msg__content {
  font-size: 16px;
  color: var(--aiw-text);
  line-height: 1.6;
  width: 100%;
}

.aiw-msg__content h3 {
  margin: 0 0 10px;
  font-family: var(--font-serif, 'Instrument Serif', serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.aiw-msg__content p { margin: 0 0 12px; }
.aiw-msg__content p:last-child { margin-bottom: 0; }

.aiw-msg__content ul {
  margin: 0 0 12px;
  padding-left: 20px;
  color: var(--aiw-secondary);
}

.aiw-msg__content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--aiw-code);
  color: #e4e4e7;
}

.aiw-msg__content pre {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--aiw-code);
  border: 1px solid var(--aiw-border);
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.5;
  color: #e4e4e7;
}

.aiw-msg__meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--aiw-muted);
}

.aiw-msg--user .aiw-msg__meta {
  text-align: right;
}

.aiw-msg--ai .aiw-msg__meta,
.aiw-msg--system .aiw-msg__meta {
  text-align: left;
}

.aiw-reasoning {
  margin-top: 12px;
  border: none;
  border-radius: 14px;
  overflow: hidden;
  background: var(--dash-surface);
}

.aiw-reasoning__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: var(--aiw-card);
  color: var(--aiw-secondary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.aiw-reasoning__body {
  display: none;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--aiw-muted);
  border-top: none;
  line-height: 1.5;
}

.aiw-reasoning.is-open .aiw-reasoning__body { display: block; }

/* Tables in messages */

.aiw-table-wrap {
  margin: 14px 0;
  border-radius: 14px;
  border: 1px solid var(--aiw-border);
  overflow: hidden;
}

.aiw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.aiw-table th,
.aiw-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--aiw-border);
}

.aiw-table th {
  background: var(--aiw-elevated);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--aiw-muted);
}

.aiw-table td.is-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.aiw-table tr:last-child td { border-bottom: none; }

/* Action cards */

.aiw-action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: var(--aiw-radius-card);
  border: none;
  background: var(--aiw-card);
  transition: background var(--aiw-transition), transform var(--aiw-transition);
}

.aiw-action-card:hover {
  background: var(--dash-surface-hover);
  transform: translateY(-2px);
}

.aiw-action-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--dash-surface-hover);
  color: #a78bfa;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.aiw-action-card__body { flex: 1; min-width: 0; }

.aiw-action-card__title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--aiw-text);
}

.aiw-action-card__desc {
  margin: 0;
  font-size: 13px;
  color: var(--aiw-muted);
}

.aiw-action-card__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Inline objects */

.aiw-object {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--dash-radius-island, 24px);
  border: none;
  background: var(--aiw-card);
  cursor: pointer;
  transition: background var(--aiw-transition);
}

.aiw-object:hover {
  background: var(--aiw-elevated);
}

.aiw-object__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--aiw-elevated);
  display: grid;
  place-items: center;
  color: var(--aiw-muted);
}

.aiw-object__body { flex: 1; min-width: 0; }

.aiw-object__title {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--aiw-text);
}

.aiw-object__meta {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--aiw-muted);
}

.aiw-object__amount {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--aiw-text);
}

/* Embedded chart (Bklit pill bars — https://bklit.com/charts/bar-chart) */

.aiw-chart {
  margin-top: 14px;
  padding: 16px 16px 14px;
  border-radius: var(--aiw-radius-card);
  border: none;
  background: var(--aiw-card);
}

.aiw-chart__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.aiw-chart__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--aiw-text);
}

.aiw-chart__sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--aiw-muted);
}

.aiw-chart__plot {
  position: relative;
  padding: 8px 4px 0;
  overflow: hidden;
}

.aiw-chart__plot--dotgrid {
  border-radius: 14px;
  background-image: radial-gradient(rgba(238, 238, 238, 0.08) 1px, transparent 1px);
  background-size: 14px 14px;
}

.aiw-chart__plot--dotgrid::after {
  content: "";
  position: absolute;
  inset: 0 0 4px;
  z-index: 0;
  border-radius: 12px;
  pointer-events: none;
  background: linear-gradient(90deg, var(--aiw-card) 0%, transparent 10%, transparent 90%, var(--aiw-card) 100%);
}

.aiw-chart__svg {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
  z-index: 1;
}

.aiw-chart__bar {
  transform-box: fill-box;
  transform-origin: center bottom;
  transition: opacity 150ms ease, filter 150ms ease;
  cursor: pointer;
  outline: none;
  animation: aiw-bar-grow 900ms cubic-bezier(0.85, 0, 0.15, 1) backwards;
}

.aiw-chart__bar:nth-child(1) { animation-delay: 0ms; }
.aiw-chart__bar:nth-child(2) { animation-delay: 70ms; }
.aiw-chart__bar:nth-child(3) { animation-delay: 140ms; }

.aiw-chart__bar:not(.is-active) {
  opacity: 0.68;
}

.aiw-chart__bar.is-active,
.aiw-chart__bar:hover,
.aiw-chart__bar:focus-visible {
  opacity: 1;
  filter: brightness(1.1);
}

.aiw-chart__indicator {
  stroke: var(--dash-text);
  stroke-width: 1.5;
  opacity: 0.75;
  pointer-events: none;
}

.aiw-chart__axis text {
  fill: var(--aiw-muted);
  font-size: 11px;
  font-family: Inter, system-ui, sans-serif;
  text-anchor: middle;
}

.aiw-chart__tooltip {
  position: absolute;
  z-index: 3;
  min-width: 148px;
  padding: 10px 12px;
  border-radius: 14px;
  border: none;
  background: var(--dash-tooltip-bg);
  box-shadow: var(--dash-tooltip-shadow);
  font-size: 13px;
  pointer-events: none;
}

.aiw-chart__tooltip-date {
  margin: 0 0 6px;
  font-size: 11px;
  color: var(--aiw-muted);
}

.aiw-chart__tooltip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.aiw-chart__tooltip-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--aiw-secondary);
  font-size: 12px;
}

.aiw-chart__tooltip-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dash-text);
}

.aiw-chart__tooltip-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--aiw-text);
}

.aiw-chart__foot {
  margin-top: 10px;
  padding-top: 2px;
}

.aiw-chart__trend {
  font-size: 12px;
  font-weight: 500;
  color: var(--aiw-muted);
}

.aiw-chart__trend--up { color: var(--dash-green); }

@keyframes aiw-bar-grow {
  from { transform: scaleY(0); opacity: 0.35; }
  to { transform: scaleY(1); opacity: 1; }
}

/* Tool execution */

.aiw-tool {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  background: var(--aiw-card);
  font-size: 13px;
  color: var(--aiw-secondary);
}

.aiw-tool__spin {
  width: 14px;
  height: 14px;
  border: 2px solid var(--dash-border);
  border-top-color: var(--aiw-primary);
  border-radius: 50%;
  animation: aiw-spin 0.7s linear infinite;
}

@keyframes aiw-spin { to { transform: rotate(360deg); } }

/* Composer */

.aiw-composer-wrap {
  flex-shrink: 0;
  position: relative;
  z-index: 3;
  margin-top: -72px;
  padding: 72px 24px 24px;
  border-top: none;
  background: linear-gradient(180deg, transparent 0%, var(--aiw-bg) 72px);
  pointer-events: none;
}

.aiw-composer-wrap__inner {
  max-width: var(--aiw-thread-w);
  margin: 0 auto;
  position: relative;
  pointer-events: auto;
}

.aiw-slash-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--dash-border-strong, rgba(238, 238, 238, 0.14));
  background: var(--dash-popover-bg-solid, #202020);
  box-shadow: var(--dash-popover-shadow, 0 16px 48px rgba(0, 0, 0, 0.52));
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: none;
  z-index: 10;
}

.aiw-slash-menu.is-open { display: block; }

.aiw-slash-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--aiw-text);
  cursor: pointer;
  transition: background var(--aiw-transition);
}

.aiw-slash-item:hover,
.aiw-slash-item.is-active { background: var(--dash-popover-row-bg, #2b2b2b); }

.aiw-slash-item code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--aiw-primary);
}

.aiw-slash-item span { color: var(--aiw-muted); font-size: 12px; }

.aiw-composer {
  display: flex;
  flex-direction: column;
  border-radius: var(--aiw-radius-composer);
  border: none;
  background: var(--aiw-card);
  transition: box-shadow var(--aiw-transition);
}

.aiw-composer:focus-within {
  box-shadow: 0 0 0 3px rgba(238, 238, 238, 0.08);
}

.aiw-composer__input {
  width: 100%;
  min-height: 56px;
  max-height: 180px;
  padding: 16px 18px 8px;
  border: none;
  background: transparent;
  resize: none;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  color: var(--aiw-text);
  outline: none;
}

.aiw-composer__input::placeholder { color: var(--aiw-muted); }

.aiw-composer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 10px;
}

/* Send — parity with Navorina chat-input-primary-btn (chat.css) */
.aiw-composer-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-full, 9999px);
  background: color-mix(in srgb, var(--dash-text) 88%, var(--dash-bg) 12%);
  color: var(--dash-bg);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--dash-text) 12%, transparent);
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s ease, transform 0.12s ease;
}

.aiw-composer-send:hover:not(:disabled) {
  opacity: 0.92;
}

.aiw-composer-send:active:not(:disabled) {
  transform: scale(0.98);
}

.aiw-composer-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.aiw-composer-send svg {
  width: 18px;
  height: 18px;
}

.aiw-composer-send svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aiw-composer__tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.aiw-composer__hint {
  font-size: 11px;
  color: var(--aiw-muted);
  margin-right: 8px;
}

.aiw-composer__hint kbd {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  font-family: inherit;
  font-size: 10px;
}

.aiw-attach-preview {
  display: none;
  align-items: center;
  gap: 10px;
  margin: 0 14px 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--aiw-elevated);
  border: 1px solid var(--aiw-border);
}

.aiw-attach-preview.is-visible { display: flex; }

.aiw-attach-preview__icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  display: grid;
  place-items: center;
}

.aiw-attach-preview__name {
  flex: 1;
  font-size: 13px;
  color: var(--aiw-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Context panel ── */

.aiw-context {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--aiw-context-w);
  height: 100%;
  max-height: 100%;
  min-height: 0;
  padding: var(--aiw-rail-gutter) var(--aiw-rail-gutter) var(--aiw-rail-gutter) 0;
  background: transparent;
  border-left: none;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
}

.aiw-context__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 14px 14px 12px;
  border-radius: var(--aiw-radius-card) var(--aiw-radius-card) 0 0;
  background: var(--dash-surface);
  border-bottom: none;
}

.aiw-context__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--aiw-muted);
}

.aiw-context__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-radius: 0 0 var(--aiw-radius-card) var(--aiw-radius-card);
  background: var(--dash-surface);
}

.aiw-ctx-section h4 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--aiw-muted);
}

.aiw-ctx-card {
  padding: 12px 14px;
  border-radius: 14px;
  border: none;
  background: var(--aiw-card);
  font-size: 13px;
  color: var(--aiw-secondary);
}

.aiw-ctx-card strong {
  display: block;
  color: var(--aiw-text);
  font-weight: 500;
  margin-bottom: 4px;
}

.aiw-ctx-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.aiw-ctx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  border: none;
  background: var(--aiw-card);
  cursor: pointer;
  transition: background var(--aiw-transition);
}

.aiw-ctx-item:hover,
.aiw-ctx-item.is-active {
  background: var(--aiw-elevated);
}

.aiw-ctx-item span:first-child {
  font-size: 13px;
  color: var(--aiw-text);
}

.aiw-ctx-item span:last-child {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--aiw-muted);
}

.aiw-insight {
  padding: 12px 14px;
  border-radius: 14px;
  border: none;
  background: var(--dash-surface);
  font-size: 13px;
  color: var(--aiw-text);
  line-height: 1.45;
}

@keyframes aiw-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .aiw-msg,
  .aiw-welcome,
  .aiw-chart__bar,
  .aiw-tool__spin {
    animation: none;
    transition: none;
  }
}

@media (max-width: 1279px) {
  .aiw-page {
    overflow: hidden;
  }

  .aiw-shell {
    --aiw-context-w: 320px;
    --aiw-rail-w: 260px;
  }

  .aiw-shell:not(.is-context-collapsed),
  .aiw-shell.is-context-collapsed {
    grid-template-columns:
      minmax(0, var(--aiw-app-sidebar-track))
      minmax(0, var(--aiw-rail-w))
      minmax(0, 1fr);
  }

  .aiw-context {
    position: fixed;
    inset: var(--aiw-rail-gutter) var(--aiw-rail-gutter) var(--aiw-rail-gutter) auto;
    z-index: 20;
    inline-size: min(var(--aiw-context-w), calc(100dvw - 32px));
    max-inline-size: none;
    block-size: auto;
    max-block-size: none;
    padding: 0;
    filter: drop-shadow(0 24px 64px rgba(0, 0, 0, 0.44));
  }

  .aiw-shell.is-context-collapsed .aiw-context {
    display: none;
  }

  .aiw-main__head [data-aiw-toggle-context] {
    display: grid;
  }
}

@media (max-width: 1120px) {
  .aiw-shell {
    --dash-sidebar-w: var(--aiw-app-sidebar-w);
  }

  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded),
  .aiw-shell.is-dash-sidebar-expanded {
    --dash-sidebar-w: var(--aiw-app-sidebar-w);
  }

  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar,
  .aiw-shell.is-dash-sidebar-expanded > .dash-sidebar {
    inline-size: var(--dash-sidebar-w);
    max-inline-size: var(--dash-sidebar-w);
    padding: 18px 12px;
    align-items: center;
  }

  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-sidebar-toggle,
  .aiw-shell.is-dash-sidebar-expanded > .dash-sidebar .dash-sidebar-toggle {
    position: static;
    order: 1;
    inline-size: var(--aiw-collapsed-item);
    block-size: var(--aiw-collapsed-item);
    margin: 0 0 16px;
  }

  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-logo {
    display: none;
  }

  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-logo__word,
  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__label,
  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-pro__title,
  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-pro__text,
  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-pro__btn,
  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__sub,
  .aiw-shell.is-dash-sidebar-expanded > .dash-sidebar .dash-logo__word,
  .aiw-shell.is-dash-sidebar-expanded > .dash-sidebar .dash-nav__label,
  .aiw-shell.is-dash-sidebar-expanded > .dash-sidebar .dash-pro__title,
  .aiw-shell.is-dash-sidebar-expanded > .dash-sidebar .dash-pro__text,
  .aiw-shell.is-dash-sidebar-expanded > .dash-sidebar .dash-pro__btn,
  .aiw-shell.is-dash-sidebar-expanded > .dash-sidebar .dash-nav__sub {
    position: absolute !important;
    inline-size: 1px !important;
    block-size: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-nav,
  .aiw-shell.is-dash-sidebar-expanded > .dash-sidebar .dash-nav {
    inline-size: var(--aiw-collapsed-item);
    align-items: center;
    gap: 6px;
  }

  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__link,
  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__link--parent,
  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-nav__sublink,
  .aiw-shell.is-dash-sidebar-expanded > .dash-sidebar .dash-nav__link,
  .aiw-shell.is-dash-sidebar-expanded > .dash-sidebar .dash-nav__link--parent,
  .aiw-shell.is-dash-sidebar-expanded > .dash-sidebar .dash-nav__sublink {
    inline-size: var(--aiw-collapsed-item);
    block-size: var(--aiw-collapsed-item);
    justify-content: center;
    padding: 0;
    gap: 0;
  }

  :is(html.dash-sidebar-expanded .aiw-shell, .aiw-shell.is-app-sidebar-expanded) > .dash-sidebar .dash-pro,
  .aiw-shell.is-dash-sidebar-expanded > .dash-sidebar .dash-pro {
    inline-size: var(--aiw-collapsed-item);
    block-size: var(--aiw-collapsed-item);
    min-block-size: var(--aiw-collapsed-item);
    display: grid;
    place-items: center;
    padding: 0;
  }
}

@media (max-width: 900px) {
  .aiw-shell:not(.is-rail-collapsed),
  .aiw-shell.is-rail-collapsed,
  .aiw-shell:not(.is-context-collapsed),
  .aiw-shell.is-context-collapsed,
  .aiw-shell.is-rail-collapsed.is-context-collapsed {
    grid-template-columns: minmax(0, var(--aiw-app-sidebar-track)) minmax(0, 1fr);
  }

  .aiw-sidebar {
    position: fixed;
    inset: var(--aiw-rail-gutter) auto var(--aiw-rail-gutter) calc(var(--dash-sidebar-w) + var(--aiw-rail-gutter));
    z-index: 18;
    inline-size: min(var(--aiw-rail-w), calc(100dvw - var(--dash-sidebar-w) - 32px));
    max-inline-size: none;
    block-size: auto;
    max-block-size: none;
    padding: 0;
    filter: drop-shadow(0 24px 64px rgba(0, 0, 0, 0.44));
  }

  .aiw-shell.is-rail-collapsed .aiw-sidebar {
    display: none;
  }

  .aiw-shell:not(.is-rail-collapsed) .aiw-main__head > [data-aiw-collapse-rail] {
    display: grid;
  }

  .aiw-shell.is-rail-collapsed .aiw-main__head,
  .aiw-shell.is-rail-collapsed .aiw-composer-wrap__inner {
    transform: none;
  }

  .aiw-main__head {
    inline-size: min(calc(100% - 32px), var(--aiw-thread-w));
    gap: 8px;
    padding-block: 12px;
  }

  .aiw-main__title {
    font-size: 21px;
  }

  .aiw-chip {
    max-inline-size: 138px;
    min-inline-size: 0;
  }

  .aiw-chip span:not(.aiw-chip__dot) {
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .aiw-thread {
    padding: 18px 16px 28px;
  }

  .aiw-composer-wrap {
    padding-inline: 16px;
  }
}

@media (max-width: 640px) {
  .aiw-shell,
  .aiw-shell:not(.is-rail-collapsed),
  .aiw-shell.is-rail-collapsed,
  .aiw-shell:not(.is-context-collapsed),
  .aiw-shell.is-context-collapsed,
  .aiw-shell.is-rail-collapsed.is-context-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  .aiw-shell > .dash-sidebar {
    display: none;
  }

  .aiw-main__head {
    inline-size: min(calc(100% - 24px), var(--aiw-thread-w));
    flex-wrap: wrap;
    align-content: center;
    min-block-size: 56px;
    padding-block: 10px;
  }

  .aiw-main__title {
    order: 1;
    flex: 1 1 calc(100% - 96px);
    min-inline-size: 140px;
    font-size: 20px;
  }

  .aiw-main__head > .aiw-chip {
    order: 3;
    flex: 1 1 auto;
    max-inline-size: none;
  }

  .aiw-main__head > .aiw-btn--icon {
    flex: 0 0 36px;
  }

  .aiw-sidebar {
    inset: 12px 12px 12px 12px;
    inline-size: auto;
  }

  .aiw-context {
    inset: 12px;
    inline-size: auto;
  }

  .aiw-thread {
    padding: 14px 12px 24px;
  }

  .aiw-thread__inner {
    gap: 20px;
  }

  .aiw-msg--user .aiw-msg__bubble {
    max-inline-size: 92%;
  }

  .aiw-msg__content,
  .aiw-msg--user .aiw-msg__content {
    font-size: 15px;
  }

  .aiw-chart {
    padding: 12px;
    border-radius: 18px;
  }

  .aiw-chart__head {
    align-items: stretch;
  }

  .aiw-chart__head > * {
    min-inline-size: 0;
  }

  .aiw-chart .dash-chart-controls,
  .aiw-chart .dash-chart-segment {
    inline-size: 100%;
  }

  .aiw-chart .dash-chart-segment {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .aiw-chart .dash-chart-segment__btn {
    min-inline-size: 0;
    padding-inline: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .aiw-table-wrap {
    overflow-x: auto;
    scrollbar-gutter: stable;
  }

  .aiw-table {
    min-inline-size: 420px;
  }

  .aiw-action-card {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
  }

  .aiw-action-card__actions {
    inline-size: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .aiw-object {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 12px;
    border-radius: 18px;
  }

  .aiw-object__amount {
    margin-inline-start: 48px;
  }

  .aiw-suggestions {
    grid-template-columns: minmax(0, 1fr);
  }

  .aiw-composer-wrap {
    padding: 64px 12px 12px;
  }

  .aiw-composer__bar {
    gap: 8px;
  }

  .aiw-composer__hint {
    display: none;
  }

  .aiw-toast {
    inset-inline: 12px;
    right: auto;
    bottom: 12px;
    max-inline-size: none;
  }
}
