/* Content-aware grids and a viewport-sized investigation workspace. */
.workspace-page main {
  container-type: inline-size;
  container-name: workspace;
}
.workspace-page .agent-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.workspace-page .agent-card {
  min-width: 0;
}
.workspace-page .agent-description {
  min-height: 0;
}
.workspace-page .agent-skills {
  margin-top: 18px;
}
.workspace-page .source {
  max-width: 100%;
}
.workspace-page .sources {
  margin-top: auto;
}
@container workspace (max-width:1100px) {
  .workspace-page .agent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settings-page .settings-right {
    grid-template-columns: 1fr;
  }
  .home-page .lower {
    grid-template-columns: 1fr 1fr;
  }
}
@container workspace (max-width:640px) {
  .workspace-page .agent-grid,
  .workspace-page .platform-grid,
  .home-page .lower {
    grid-template-columns: 1fr;
  }
  .home-page .actions {
    grid-template-columns: 1fr;
  }
  .workspace-page .field-grid {
    grid-template-columns: 1fr;
  }
  .workspace-page .field {
    grid-template-columns: 20px minmax(70px, 0.75fr) minmax(0, 1fr) 24px;
    gap: 8px;
  }
}
.settings-page .pref-row {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 12px 0;
}
.settings-page .toggle-row {
  grid-template-columns: 20px minmax(0, 1fr) auto;
}
.settings-page .toggle-row .select-control {
  max-width: 165px;
}
/* The sections now sit in one .settings-body column, so the settings grid is a
   single row and neither the nav nor a panel needs to place itself by row. The
   `span 20` here left eighteen empty rows below the content, each still paying
   the 20px gap - the dead space under the last panel. */
.settings-page .settings-grid > .s-side {
  grid-row: 1;
}
.workspace-page .source-label {
  overflow-wrap: anywhere;
}
.workspace-page .agent-card .start-chat {
  min-height: 46px;
}
.investigation-page .canvas {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.investigation-page .canvas > header {
  height: 64px;
  flex: none;
}
.investigation-page .workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: 1800px;
  padding: 0 24px 18px;
}
.investigation-page .workspace-heading {
  flex: none;
  gap: 20px;
  margin: 18px 0;
  align-items: center;
}
.investigation-page .workspace-heading h1 {
  font-size: clamp(25px, 2.4vw, 36px);
  overflow-wrap: anywhere;
}
.investigation-page .workspace-heading .intro {
  font-size: 14px;
}
.investigation-page .workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(285px, 340px);
  flex: 1;
  min-height: 0;
  align-items: stretch;
  gap: 20px;
}
.investigation-page .conversation {
  display: flex;
  flex-direction: column;
  /* The composer sits under the chat box; start keeps the box at the top and
     lets it size itself rather than filling the column. */
  justify-content: flex-start;
  flex: 1 1 0%;
  min-height: 0;
  min-width: 0;
}
/* The chat box fills the column, so the workspace reaches the composer instead
   of stopping short and leaving dead space under it. A short exchange no longer
   strands the panel: an empty log shows its own placeholder, and the log below
   scrolls internally once the conversation outgrows the space. */
.investigation-page .agent-workspace-card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
}
.investigation-page .session-toolbar,
.investigation-page .agent-workspace-card .session-toolbar {
  flex: 0 0 auto;
  padding: 12px 18px;
}
.investigation-page #messages,
.investigation-page .agent-workspace-card #messages {
  min-height: 0 !important;
  max-height: none !important;
  /* Grow to fill the card, and scroll inside once the conversation is taller
     than the space rather than pushing the composer off the page. */
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
}
.investigation-page #chat-form {
  flex: 0 0 auto;
  margin-top: 12px;
  min-height: 56px;
}
.investigation-page #chat-input {
  font-size: 15px;
}
.investigation-page .follow-ups {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100%;
  padding: 8px 2px 2px;
  justify-content: flex-start;
  scrollbar-width: thin;
}
.investigation-page .follow-ups button {
  white-space: nowrap;
  flex: none;
  font-size: 12px;
  min-height: 36px;
}
.investigation-page .context-rail {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
  padding-right: 6px;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 138, 0, 0.3) transparent;
}
.investigation-page .context-rail::-webkit-scrollbar {
  width: 6px;
}
.investigation-page .context-rail::-webkit-scrollbar-track {
  background: transparent;
}
.investigation-page .context-rail::-webkit-scrollbar-thumb {
  background: rgba(255, 138, 0, 0.25);
  border-radius: 9999px;
}
.investigation-page .context-rail::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 138, 0, 0.5);
}
.investigation-page .context-card {
  flex: none;
  padding: 17px;
}
.investigation-page .context-card:first-child {
  grid-row: auto;
}
.investigation-page .context-card dl > div {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 12px;
}
.investigation-page .context-card #session-id {
  font-size: 13px;
}
.investigation-page .canvas > footer {
  display: none;
}
.context-toggle {
  display: none;
}
@media (max-width: 1100px) {
  .investigation-page .workspace-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .investigation-page .context-rail {
    display: none;
  }
  .context-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .investigation-page .context-open .context-rail {
    display: flex;
  }
  .investigation-page .context-open .conversation {
    display: none;
  }
  .investigation-page .heading-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
}
@media (max-width: 700px) {
  .workspace-page .canvas > header {
    padding-inline: 16px;
    gap: 10px;
  }
  .workspace-page .account {
    gap: 8px;
  }
  .workspace-page .command-trigger span,
  .workspace-page .command-trigger kbd {
    display: none;
  }
  .workspace-page .command-trigger {
    width: 36px;
    min-width: 36px;
    justify-content: center;
    margin-left: 0;
  }
  .workspace-page .agent-search {
    min-width: 0;
  }
  .home-page .composer-heading {
    flex-wrap: wrap;
    gap: 6px;
  }
  .home-page .composer-mode {
    font-size: 11px;
  }
  .home-page .composer-bottom {
    gap: 10px;
    justify-content: space-between;
  }
  .home-page #composer-hint {
    display: none;
  }
  .home-page .agent-select .select-control {
    width: 155px;
  }
  .home-page .ask form > .composer-bottom > button {
    font-size: 12px;
    padding-inline: 10px;
  }
  .workspace-page .filter .select-control {
    min-width: 110px;
  }
  .workspace-page .filter-bar {
    gap: 8px;
  }
  .settings-page .settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .settings-page .settings-grid > .s-side {
    grid-row: auto;
    grid-column: 1;
  }
  .settings-page .settings-grid > :not(.s-side) {
    grid-column: 1;
  }
  .settings-page .s-side {
    position: static;
  }
  .settings-page .settings-actions {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
  }
  .settings-page .settings-actions #save-note:not(:empty) {
    flex-basis: 100%;
    order: -1;
    margin-bottom: 4px;
  }
  .settings-page .settings-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
  }
  .settings-page .toggle-row:has(.select-control) {
    grid-template-columns: 20px minmax(0, 1fr);
  }
  .settings-page .toggle-row .select-control {
    grid-column: 2;
    max-width: 100%;
  }
  .investigation-page .workspace {
    padding: 0 14px 12px;
  }
  .investigation-page .workspace-heading {
    flex-direction: column;
    align-items: stretch;
    margin: 10px 0;
    gap: 10px;
  }
  .investigation-page .workspace-heading .eyebrow,
  .investigation-page .workspace-heading .intro {
    display: none;
  }
  .investigation-page .workspace-heading h1 {
    font-size: 24px;
  }
  .investigation-page .title-row {
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
  }
  .investigation-page .heading-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .investigation-page .heading-actions button {
    min-height: 38px;
    font-size: 12px;
    padding: 8px 10px;
    justify-content: center;
    white-space: nowrap;
  }
  .investigation-page .session-toolbar {
    padding: 9px 12px;
    font-size: 12px;
  }
  .investigation-page .session-access {
    font-size: 11px;
  }
  .investigation-page #messages {
    padding: 14px 12px;
  }
  .investigation-page .message {
    gap: 10px;
  }
  .investigation-page .message > .avatar,
  .investigation-page .message > .agent-avatar {
    width: 28px;
    height: 28px;
    flex: none;
  }
  .investigation-page .user-message {
    font-size: 14px;
  }
  .investigation-page #chat-form {
    padding: 6px 8px;
    gap: 8px;
    min-height: 54px;
  }
}
@media (max-height: 850px) {
  .investigation-page .workspace {
    padding: 0 20px 12px;
  }
  .investigation-page .workspace-heading {
    margin: 10px 0 12px;
    gap: 14px;
  }
  .investigation-page .workspace-heading h1 {
    font-size: clamp(22px, 2.2vw, 28px);
  }
  .investigation-page .workspace-heading .intro {
    font-size: 13px;
  }
  .investigation-page .workspace-grid {
    gap: 16px;
  }
  .investigation-page .agent-workspace-card .session-toolbar {
    padding: 10px 18px 8px;
  }
  .investigation-page .agent-workspace-card #messages {
    padding: 14px 18px;
  }
  .investigation-page .context-card {
    padding: 14px 16px;
  }
  .investigation-page .context-card h2 {
    margin-bottom: 9px;
  }
  .investigation-page .context-card dl > div {
    padding-block: 4px;
  }
  .investigation-page .message {
    margin-bottom: 12px;
    gap: 12px;
  }
  .investigation-page #chat-form {
    margin-top: 10px;
  }
}

@media (max-height: 560px) {
  .investigation-page .canvas {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }
  .investigation-page .workspace {
    min-height: 480px;
  }
  .investigation-page .agent-workspace-card {
    min-height: 280px;
  }
  .investigation-page .context-rail {
    overflow: visible;
  }
}
@media (max-width: 380px) {
  .home-page .agent-select {
    width: 100%;
  }
  .home-page .agent-select .select-control {
    width: 100%;
  }
  .home-page .ask form > .composer-bottom > button {
    margin-left: auto;
  }
  .workspace-page .logo img {
    max-width: 100%;
  }
  .workspace-page .theme-row {
    gap: 6px;
  }
  .workspace-page .theme {
    padding: 12px 5px;
  }
}
