/* Shared interaction layer. Keep the established library / conversation layout. */
:root {
  --rail: 260px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}
body.shell-collapsed {
  --rail: 72px;
}
[hidden] {
  display: none !important;
}
.reference-sidebar {
  width: var(--rail) !important;
  transform: none !important;
  transition: width 0.24s var(--ease);
  overflow: hidden;
}
.main {
  margin-left: var(--rail) !important;
  transition: margin-left 0.24s var(--ease);
  min-width: 0;
}
.reference-sidebar .brand {
  height: 72px;
  padding: 12px 16px;
  flex: 0 0 72px;
  gap: 12px;
}
.reference-sidebar .brand-crop {
  display: block;
  width: 134px;
  height: 55px;
  flex: 1;
  overflow: hidden;
}
.reference-sidebar .brand-crop img {
  width: 134px;
  height: 55px;
  object-fit: contain;
  position: static;
  transform: none;
}
.reference-sidebar .brand .iconbtn {
  flex: 0 0 32px;
  border-radius: 9px;
}
.reference-sidebar .nav {
  padding: 8px;
  gap: 4px;
}
.reference-sidebar .navbtn {
  min-height: 44px;
  width: 100%;
  padding: 10px 16px;
  gap: 12px;
  text-align: left;
  white-space: nowrap;
}
.reference-sidebar .navbtn .ic {
  flex: 0 0 20px;
}
.reference-sidebar .button-label {
  display: inline;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reference-sidebar .sidebar-history {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}
.reference-sidebar .sidebar-section {
  margin-top: 20px;
}
.reference-sidebar .history-item {
  min-width: 0;
}
.reference-sidebar .history-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reference-sidebar .sidebottom {
  margin-top: auto;
  padding: 14px 16px;
  gap: 8px;
  min-width: 0;
}
.reference-sidebar .account-name {
  flex: 1;
  min-width: 0;
}
.reference-sidebar .account-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shell-collapsed .reference-sidebar .brand {
  padding: 16px 20px;
  justify-content: center;
}
.shell-collapsed .reference-sidebar .brand-crop,
.shell-collapsed .reference-sidebar .navbtn .button-label,
.shell-collapsed .reference-sidebar .sidebar-history,
.shell-collapsed .reference-sidebar .account-label {
  display: none;
}
.shell-collapsed .reference-sidebar .navbtn {
  justify-content: center;
  padding: 12px;
  border-radius: 12px;
}
.shell-collapsed .reference-sidebar .sidebottom {
  padding: 16px 10px;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.shell-collapsed .reference-sidebar .account-name {
  justify-content: center;
}
.reference-topbar {
  min-height: 48px;
}
.reader {
  min-height: 0;
}
.reader-content {
  margin: 0 auto !important;
  padding-top: 28px;
  align-self: stretch;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
}
.reader-content h1 {
  margin-top: 16px;
}
.reader-toolbar {
  flex-shrink: 0;
}
.btn,
.iconbtn,
.navbtn,
.history-item {
  transition:
    background-color 0.16s,
    border-color 0.16s,
    box-shadow 0.16s;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid #608d7e;
  outline-offset: 3px;
}
.iconbtn:hover {
  background: #e9ebe9;
}
.select-field {
  display: inline-flex;
  position: relative;
  max-width: 100%;
  min-width: 0;
  vertical-align: middle;
}
.form-field > .select-field {
  display: flex;
  width: 100%;
}
.native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: 0 !important;
  opacity: 0 !important;
  clip-path: inset(50%);
  pointer-events: none;
}
.select-trigger {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 13px;
  border: 1px solid #dedfdf;
  border-radius: 10px;
  background: #fff;
  color: #242726;
  font: inherit;
  cursor: pointer;
  min-width: 0;
  width: 100%;
  text-align: left;
}
.select-trigger:hover:not(:disabled) {
  background: #f7f9f8;
  border-color: #a3b4ad;
}
.select-trigger[aria-expanded="true"] {
  border-color: #799e8e;
  box-shadow: 0 0 0 3px #4e816713;
}
.select-trigger:disabled {
  background: #f5f6f5;
  color: #777;
  cursor: default;
}
.select-trigger > .ic {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.16s;
}
.select-trigger[aria-expanded="true"] > .ic {
  transform: rotate(180deg);
}
.select-value {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.select-popover {
  position: fixed;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: #fff;
  border: 1px solid #e0e5e2;
  border-radius: 14px;
  box-shadow:
    0 12px 36px #1d39221e,
    0 3px 8px #1d39220a;
  animation: select-in 0.14s ease-out;
  box-sizing: border-box;
}
.select-options {
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
  padding: 2px;
}
.select-options [role="option"] {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 12px;
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.5;
}
.select-options [role="option"] > span:first-child {
  flex: 1;
  overflow-wrap: anywhere;
}
.select-options [role="option"]:hover,
.select-options .highlighted {
  background: #f1f5f3;
}
.select-options [aria-selected="true"] {
  color: #285a48;
  font-weight: 600;
}
.select-check {
  color: #3b8064;
}
.select-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 10px;
  border-bottom: 1px solid #eee;
  margin-bottom: 4px;
}
.select-search input {
  width: 100%;
  min-width: 0;
  padding: 6px 0;
  font: inherit;
  font-size: 14px;
  border: 0;
  outline: 0;
  background: transparent;
}
.select-empty {
  padding: 20px 12px;
  color: #8b918e;
  font-size: 14px;
}
.agent-composer footer label {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 75%;
  gap: 8px;
}
.agent-composer .select-trigger {
  border-color: transparent;
  background: transparent;
  min-height: 36px;
  padding: 6px 8px;
}
.member-row .select-field {
  min-width: 130px;
}
#loading-mask {
  position: fixed;
  inset: 0 0 0 var(--rail);
  z-index: 1100;
  display: grid;
  place-items: center;
  background: #ffffffb8;
  backdrop-filter: blur(2px);
  cursor: progress;
  animation: mask-in 0.15s ease-out;
}
body:has(.login) #loading-mask,
body:has(.startup) #loading-mask,
body:has(.eke-layer) #loading-mask {
  left: 0;
}
.loading-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 26px;
  border-radius: 16px;
  border: 1px solid #e8ece9;
  background: #fff;
  box-shadow: 0 8px 32px #1c392015;
}
.loading-card p {
  margin: 0;
  font-size: 14px;
  color: #66736d;
}
.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid #e1e9e4;
  border-top-color: #40846b;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
.startup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 100vh;
  padding: 24px;
  box-sizing: border-box;
  color: #64756b;
}
.danger-zone {
  border-top: 1px solid #eee;
  margin-top: 32px;
  padding-top: 20px;
}
.btn.danger {
  color: #b33e37;
  border-color: #efd8d5;
  background: #fff;
}
.btn.danger:hover {
  background: #fff3f1;
}
.btn.danger.primary {
  background: #b7443c;
  color: #fff;
  border-color: #b7443c;
}
.delete-confirm {
  max-width: 500px;
  line-height: 1.8;
}
.delete-confirm h3 {
  font-size: 20px;
  color: #222;
  overflow-wrap: anywhere;
}
.delete-confirm .row {
  margin-top: 24px;
  justify-content: flex-end;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes select-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes mask-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (max-width: 1100px) {
  .scope-nav {
    width: 190px;
    min-width: 190px;
  }
  .scope-heading {
    flex-wrap: wrap;
  }
}
@media (max-width: 760px) {
  :root {
    --rail: 240px;
  }
  body.shell-collapsed {
    --rail: 60px;
  }
  .reference-sidebar {
    z-index: 80;
  }
  body:not(.shell-collapsed) .reference-sidebar {
    box-shadow: 12px 0 40px #15231e20;
  }
  .main {
    margin-left: 60px !important;
  }
  .reference-sidebar .brand {
    padding-left: 14px;
    padding-right: 14px;
  }
  .shell-collapsed .reference-sidebar .brand {
    padding: 16px 14px;
  }
  .scope-header {
    padding: 16px;
  }
  .scope-heading h1 {
    font-size: 21px;
  }
  .reader-content {
    padding: 22px 18px;
  }
  .reader-toolbar {
    padding: 10px 14px;
  }
  .agent-workspace {
    padding: 20px 14px;
  }
  .agent-composer footer label {
    max-width: 70%;
  }
  .agent-composer footer label > .ic {
    display: none;
  }
  .agent-composer .select-trigger {
    gap: 6px;
    font-size: 12px;
  }
  #loading-mask {
    left: 60px;
  }
  .member-row {
    flex-wrap: wrap;
    gap: 10px;
  }
  .member-add {
    flex-direction: column;
    align-items: stretch;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
body.is-g6 .reference-sidebar {
  display: flex;
}
.mobile-project-picker {
  display: none;
}
@media (max-width: 760px) {
  .library-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .scope-nav {
    display: none;
  }
  .mobile-project-picker {
    display: block;
    margin-top: 12px;
  }
  .mobile-project-picker .select-field {
    width: 100%;
  }
  .mobile-project-picker .select-trigger {
    font-size: 13px;
    min-height: 38px;
  }
  .scope-header-actions.file-action-row {
    flex-wrap: wrap;
    margin-left: 0;
    gap: 6px;
  }
  .scope-header-actions.file-action-row .btn {
    min-width: 0;
  }
  .scope-workspace .knowledge-detail-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
  }
  .scope-workspace .knowledge-directory-tree {
    width: 100%;
    max-height: 170px;
    flex: 0 0 auto;
    border-right: 0;
    border-bottom: 1px solid #eee;
  }
  .scope-workspace .reader {
    width: 100%;
    min-height: 180px;
    flex: 1 1 auto;
  }
  .reader-toolbar {
    position: relative;
    gap: 6px;
    flex-wrap: wrap;
  }
  .reader-toolbar .btn {
    padding: 0 8px;
    font-size: 11px;
  }
  .reader-meta {
    flex-wrap: wrap;
  }
  .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .graph-inspector {
    display: none;
  }
  .scope-files {
    padding: 12px;
  }
  .files-filter-row {
    flex-wrap: wrap;
  }
  .agent-workspace {
    width: 100%;
  }
  .agent-welcome {
    padding-top: 35px;
  }
  .agent-welcome h1 {
    font-size: 26px;
  }
  .task-suggestions {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* Keep each run's public activity and answer together in the conversation. */
.task-timeline { scroll-behavior: auto; scrollbar-gutter: stable; overflow-anchor: none; }
.agent-turn { margin: 12px 0 34px; max-width: 100%; min-width: 0; }
.turn-brand { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: #292d2b; font-size: 14px; }
.turn-avatar { width: 25px; height: 25px; overflow: hidden; display: inline-flex; align-items: center; }
.turn-avatar img { height: 25px; width: auto; max-width: none; }
.turn-activity { max-width: 100%; margin: 0 0 12px; color: #626d66; }
.turn-activity summary { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 32px; padding: 4px 8px; border-radius: 8px; cursor: pointer; font-size: 12px; list-style: none; }
.turn-activity summary::-webkit-details-marker { display: none; }
.turn-activity summary:hover { background: #f2f5f2; color: #294c3b; }
.turn-activity summary:focus-visible { outline: 2px solid #45755e; outline-offset: 2px; }
.activity-mark { display: inline-flex; color: #54866a; }
.activity-mark .ic, .activity-steps .ic { width: 15px; height: 15px; flex: none; }
.turn-active .activity-mark { animation: activity-pulse 1.6s ease-in-out infinite; }
.activity-time { color: #778079; font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.turn-activity summary > .ic { width: 12px; height: 12px; transition: transform .18s ease; }
.turn-activity[open] summary > .ic { transform: rotate(90deg); }
.activity-steps { margin: 4px 0 12px 15px; padding: 2px 0 2px 16px; border-left: 1px solid #d9e3db; list-style: none; }
.activity-steps:empty { display: none; }
.activity-steps li { display: flex; align-items: baseline; gap: 9px; padding: 4px 0; font-size: 12px; line-height: 1.6; }
.activity-steps li .ic { align-self: flex-start; margin-top: 3px; color: #658570; }
.activity-steps time { font-size: 10px; color: #79817c; font-variant-numeric: tabular-nums; }
.agent-turn .answer-text { font-size: 15px; line-height: 1.8; color: #252b28; }
.agent-turn .answer-text:empty { display: none; }
.agent-turn .answer-text.is-writing > :last-child:not(.answer-table):not(pre)::after {
  content: ""; display: inline-block; width: .38em; height: .82em; margin-left: 3px;
  border-radius: 2px; background: #528367; vertical-align: -1px; animation: activity-pulse 1s ease-in-out infinite;
}
.turn-error { padding: 10px 14px; border-left: 2px solid #c68469; background: #fbf5f1; color: #884e37; font-size: 13px; }
.agent-composer button[data-action="task-cancel"] .ic { fill: currentColor; width: 13px; }
@keyframes activity-pulse { 50% { opacity: .36; } }
@media (prefers-reduced-motion: reduce) {
  .turn-active .activity-mark, .agent-turn .answer-text.is-writing > :last-child::after { animation: none; }
  .turn-activity summary > .ic { transition: none; }
}
@media (max-width: 600px) {
  .agent-turn { margin-bottom: 24px; }
  .agent-turn .answer-text { font-size: 14px; }
  .activity-steps time { margin-left: auto; }
}
.agent-turn .answer-text :is(ul, ol) { margin: 4px 0 10px; padding-left: 1.55em; }
.agent-turn .answer-text li { margin: 4px 0; }
.agent-turn .answer-text blockquote { border-left: 3px solid #c8d5cc; margin: 8px 0; padding: 4px 0 4px 15px; color: #4b554e; }
.agent-turn .answer-text hr { border: 0; border-top: 1px solid #e5e8e5; margin: 15px 0; }
@media (max-width: 600px) {
  .has-session .session-header { padding: 4px 0 9px; gap: 8px; }
  .has-session .session-header h2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 16px; }
  .has-session .agent-composer textarea { height: 52px; }
  .has-session .agent-footnote { margin-top: 5px; }
}

.evidence-preview{position:relative;margin:20px 0;border:1px solid #e8e8e8;border-radius:12px;overflow:hidden;line-height:0}.evidence-preview img{width:100%;height:auto;display:block}.evidence-region{position:absolute;border:2px solid #578878;background:#57887818;pointer-events:none}
