/* Chat EDEM within the canonical DeX window. The titlebar names the app; this
   surface only handles the conversation and keeps the prototype status visible. */
body[data-dex-mode="only"] .dex-window[data-app="chat"] #screen-chat {
  padding: 0 !important;
  overflow: hidden !important;
  container-type: inline-size;
}

body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  color: #e0e9f6;
  font-size: 12px;
}

/* The window chrome already says "Чат EDEM". The existing shell labels and
   footnote retain the honest demo state without consuming another header row. */
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-head {
  display: none;
}

body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-shell {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: 222px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-list {
  min-width: 0;
  padding: 13px 8px 10px;
  border-right: 1px solid rgba(255, 255, 255, .09);
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-list .sx-section-label {
  min-height: 32px;
  padding: 1px 8px 7px;
  color: #b1c5df;
  font-size: 9px;
  letter-spacing: .11em;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-icon-button {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-color: rgba(208, 226, 250, .25);
  border-radius: 6px;
  background: rgba(197, 218, 245, .10);
  color: #dae9fa;
  font-size: 17px;
  line-height: 1;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-list > button:not(.sx-icon-button) {
  min-height: 52px;
  padding: 8px 10px;
  margin: 2px 0;
  border-radius: 7px;
  color: #cfdaea;
  font-size: 12px;
  line-height: 1.28;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-list > button.is-selected {
  border-color: rgba(214, 230, 252, .31);
  background: rgba(106, 131, 170, .37);
  color: #f2f7ff;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-list > button:not(.sx-icon-button):hover {
  background: rgba(121, 148, 186, .28);
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-list > button small {
  margin-top: 4px;
  color: #a8bad1;
  font-size: 10px;
  letter-spacing: 0;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-list > p {
  margin: 14px 10px;
  color: #9fb1c9;
  font-size: 10px;
  line-height: 1.5;
}

body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-main {
  min-width: 0;
  min-height: 0;
  padding: 0 18px 12px;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-top {
  display: flex;
  align-items: center;
  flex: 0 0 40px;
  padding: 0 2px;
  border-bottom-color: rgba(204, 222, 247, .16);
  color: #a7b9d0;
  font-size: 9px;
  letter-spacing: .08em;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-top span:last-child {
  color: #bd9c74;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  padding: 15px 2px 18px;
  scrollbar-color: rgba(191, 211, 239, .30) transparent;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-empty {
  width: min(100%, 420px);
  max-width: none;
  margin: clamp(27px, 10vh, 72px) auto 0;
  color: #b4c2d4;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-orbit-mark {
  width: 42px;
  height: 42px;
  border-color: rgba(210, 226, 250, .30);
  border-radius: 11px;
  background: rgba(151, 177, 213, .10);
  box-shadow: none;
  font-size: 21px;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-empty h2 {
  margin: 12px 0 7px;
  color: #e7effa;
  font-size: 21px;
  line-height: 1.2;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-empty p {
  font-size: 12px;
  line-height: 1.5;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-prompts {
  gap: 7px;
  margin-top: 19px;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-prompts button {
  min-height: 34px;
  padding: 7px 10px;
  border-color: rgba(203, 221, 246, .26);
  border-radius: 7px;
  background: rgba(119, 147, 185, .14);
  color: #d1dfef;
  font-size: 11px;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-message {
  width: fit-content;
  max-width: min(78%, 670px);
  padding: 10px 13px;
  margin: 8px auto 8px max(0px, calc((100% - 760px) / 2));
  border-color: rgba(199, 218, 246, .19);
  border-radius: 9px;
  background: rgba(69, 91, 122, .31);
  color: #e4ecf7;
  font-size: 12px;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-message.is-user {
  margin-left: auto;
  margin-right: max(0px, calc((100% - 760px) / 2));
  border-color: rgba(186, 215, 254, .27);
  background: rgba(80, 113, 157, .62);
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-message > span {
  color: #b2c8e6;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-message p {
  margin-top: 5px;
  line-height: 1.52;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-compose {
  flex: 0 0 auto;
  width: min(100%, 760px);
  min-height: 48px;
  margin: 0 auto;
  padding: 6px 7px 6px 14px;
  border-color: rgba(211, 228, 250, .31);
  border-radius: 10px;
  background: rgba(93, 115, 149, .30);
  box-shadow: inset 0 1px rgba(235, 243, 255, .06);
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-compose:focus-within {
  border-color: rgba(210, 230, 255, .61);
  background: rgba(99, 123, 158, .40);
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-compose input {
  color: #f0f5fc;
  font-size: 13px;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-compose input::placeholder {
  color: #b5c3d6;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-compose button {
  flex: 0 0 33px;
  width: 33px;
  height: 33px;
  border-color: rgba(224, 237, 254, .40);
  border-radius: 7px;
  background: rgba(220, 235, 255, .88);
  color: #17263a;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-compose button:hover {
  background: #f1f6ff;
  color: #111b29;
}
body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-main > .sx-footnote {
  width: min(100%, 760px);
  margin: 7px auto 0;
  color: #9eafc5;
  font: 10px/1.3 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-align: center;
}

@container (max-width: 710px) {
  body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 55px minmax(0, 1fr);
  }
  body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-list {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 5px 9px;
    border-right: 0;
    border-bottom: 1px solid rgba(204, 222, 247, .17);
  }
  body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-list .sx-section-label {
    flex: 0 0 auto;
    min-height: 0;
    padding: 0;
    font-size: 0;
  }
  body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-list > button:not(.sx-icon-button) {
    flex: 0 0 auto;
    width: auto;
    min-width: 128px;
    min-height: 40px;
    margin: 0;
    padding: 5px 9px;
  }
  body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-list > button small {
    margin-top: 1px;
    font-size: 9px;
  }
  body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-list > p { display: none; }
}

@container (max-width: 470px) {
  body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-main { padding: 0 10px 9px; }
  body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-top { flex-basis: 35px; font-size: 8px; }
  body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-top span:last-child { display: none; }
  body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-empty { margin-top: 22px; }
  body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-message { max-width: 93%; }
  body[data-dex-mode="only"] .dex-window[data-app="chat"] .sx-chat-main > .sx-footnote { font-size: 9px; }
}
