/* Full-screen conversation workspace. Business flows remain unchanged. */
.model-status {
  min-width: 0;
  max-width: min(310px, 100%);
  gap: 9px;
  padding: 8px 11px;
  background: #fff;
  border: 1px solid #e5e7ef;
  border-radius: 12px;
}
.model-status > .model-status-copy { display: grid; min-width: 0; gap: 2px; }
.model-status #model-status-title,
.model-status #model-status-detail {
  display: block;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}
.model-status #model-status-title { font-size: .75rem; }
.model-status #model-status-detail { font-size: .6875rem; color: #70788a; }
.model-status > .status-indicator { flex: 0 0 8px; width: 8px; height: 8px; }

.support-summary { margin: 0 8px 26px; }
.support-summary .eyebrow { color: #a99cf4; margin-bottom: 8px; }
.support-summary h1 { color: #f5f6fb; font-size: 1.35rem; line-height: 1.35; letter-spacing: -.5px; }
.support-summary p { margin-top: 8px; color: #a8aec1; font-size: .75rem; line-height: 1.7; }

.layout-controls { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.workspace-toggle {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid #dfe2eb;
  border-radius: 9px;
  background: #fff;
  color: #697184;
  font-size: .72rem;
  white-space: nowrap;
}
.workspace-toggle svg { width: 16px; height: 16px; }
.workspace-toggle:hover { color: var(--accent); border-color: #c8c0ef; background: #fbfaff; }
.workspace-toggle.is-active { color: #5e50b8; border-color: #d7d0f5; background: #f4f1ff; }
.workspace-toggle:focus-visible { outline-offset: 2px; }

.agent-trace {
  margin-top: 9px;
  border-top: 1px solid #eceef4;
  padding-top: 8px;
  color: #70788a;
}
body:not(.trace-visible) .agent-trace { display: none !important; }
.agent-trace summary {
  width: fit-content;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: .8125rem;
  cursor: pointer;
  list-style-position: inside;
}
.agent-trace summary:hover { background: #f6f4fc; color: #6758b5; }
.agent-trace summary:focus-visible { outline: 3px solid #a69af5; outline-offset: 2px; }
.agent-trace p, .agent-trace small {
  display: block;
  margin: 7px 0 0 16px;
  font-size: .75rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.sidebar[hidden], .context-panel[hidden], .workspace-toggle[hidden] { display: none !important; }
body.topbar-collapsed .topbar { display: none !important; }
body.topbar-collapsed .workspace { padding-top: 6px !important; }

  html, body { height: 100%; }
  body { height: 100vh; height: 100dvh; overflow: hidden; }

  .sidebar {
    width: clamp(224px, 15vw, 252px);
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: 22px 16px 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
  .sidebar .brand { margin: 2px 8px 27px; }
  .sidebar .side-note { margin: 30px 8px 24px; padding-top: 20px; }
  .sidebar .side-note h2 { font-size: 1rem; line-height: 1.55; }
  .sidebar .side-note p { line-height: 1.65; }
  .sidebar .profile { padding-top: 15px; }

  main {
    max-width: none;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 0 clamp(14px, 1.3vw, 24px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .topbar {
    height: 58px;
    min-height: 58px;
    gap: 12px;
    justify-content: flex-start;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .breadcrumb { min-width: 0; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-meta { display: flex; align-items: center; gap: 9px; min-width: 0; }

  body.topbar-collapsed .topbar {
    height: 0 !important;
    min-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin: 0 !important;
    border-bottom: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
  }
  body.topbar-collapsed .workspace {
    padding-top: 6px !important;
  }
  body.topbar-collapsed footer {
    display: none !important;
  }

  .workspace {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
    gap: clamp(12px, 1.1vw, 18px);
    align-items: stretch;
    padding-top: 12px;
    transition: padding-top 0.22s ease;
  }
  body.context-collapsed .workspace { grid-template-columns: minmax(0, 1fr); }

  .chat-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    border-radius: 13px;
    transition: all 0.22s ease;
  }
  body.topbar-collapsed .panel-heading {
    padding: 10px 18px;
  }
  body.topbar-collapsed .provider-controls {
    padding: 6px 18px;
  }
  .panel-heading { padding: 13px 18px; }
  .provider-controls {
    display: flex;
    align-items: center;
    gap: 7px 10px;
    flex-wrap: wrap;
    padding: 9px 18px;
  }
  .provider-controls label { flex: 0 0 auto; margin: 0; font-size: .7rem; }
  .provider-controls select { width: min(290px, 36vw); min-width: 190px; }
  #provider-detail { margin: 0 0 0 auto; min-width: 0; max-width: 42%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #provider-notice { margin: 0; }
  #provider-notice:empty { display: none; }
  #provider-switch-note { flex-basis: 100%; margin: -2px 0 0; padding-left: 0; }
  .conversation-context { margin-block: 0; padding-block: 7px; }
  .messages { padding: 20px clamp(22px, 3vw, 48px) 14px; }
  .message { max-width: min(92%, 980px); }
  .message.user { max-width: min(82%, 800px); }
  .bubble { line-height: 1.7; }
  .composer-area { padding: 12px 16px 10px; }
  .suggestions { margin-bottom: 9px; }

  .context-panel {
    height: 100%;
    max-height: none;
    overflow-y: auto;
    gap: 12px;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
  .context-panel > * { flex-shrink: 0; }
  .order-panel, .activity-panel { padding: 16px; }
  .section-header { margin-bottom: 14px; }
  .order-tabs { margin-bottom: 16px; }

  footer {
    min-height: 30px;
    padding: 8px 2px 7px;
    flex: 0 0 auto;
  }
}

@media (min-width: 981px) and (max-width: 1240px) {
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(280px, 31vw); }
  .model-status { max-width: 235px; }
  .demo-badge { display: none; }
  .workspace-toggle { padding-inline: 8px; }
  #provider-detail { max-width: 35%; }
}

@media (max-width: 980px) {
  body { overflow: auto; }
  .layout-controls .panel-layout-toggle { display: none !important; }
  .topbar { gap: 8px; }
  .topbar-meta { margin-left: auto; }
  .model-status { max-width: min(260px, 48vw); }
  .workspace { grid-template-columns: 1fr; }
  .context-panel { height: auto; max-height: none; overflow: visible; }
}

@media (max-width: 680px) {
  .model-status { display: none; }
  .workspace-toggle span { display: none; }
  .workspace-toggle { width: 34px; padding: 7px; }
}

/* Source evidence stays accessible even when technical traces are hidden. */
.knowledge-sources { margin: 0.7rem 0 0; padding: 0.65rem 0.8rem; border: 1px solid #e1e3ed; border-radius: 10px; font-size: 0.86rem; min-width: 0; }
.knowledge-sources summary { cursor: pointer; font-weight: 600; }
.knowledge-sources small { display: block; margin-top: 0.4rem; overflow-wrap: anywhere; }
.knowledge-source { margin-top: 0.7rem; padding-top: 0.6rem; border-top: 1px solid #e1e3ed; }
.knowledge-source p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
