/* Loaded right after chat.css (index.html keeps this order, so the cascade is unchanged). */
/* Composer */

.chat-composer {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 8px 18px 14px;
  border-top: 1px solid var(--line);
}

.chat-composer-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 6px 6px 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-solid);
}

.chat-composer-box:focus-within {
  border-color: var(--cyan);
}

.chat-composer textarea {
  width: 100%;
  min-height: 24px;
  max-height: 180px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  outline: none;
  resize: none;
}

.chat-composer-tools {
  display: flex;
  gap: 4px;
  align-items: center;
}

.chat-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-attachment {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: 260px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-raised);
}

.chat-attachment img {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
}

.chat-attachment-meta {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.chat-attachment-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-attachment-size {
  color: var(--muted);
  font-size: 12px;
}

.chat-attachment button {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  line-height: 1;
}

.chat-composer-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.chat-picker {
  position: absolute;
  right: 18px;
  bottom: calc(100% - 4px);
  left: 18px;
  z-index: 6;
  max-height: 280px;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-solid);
  box-shadow: 0 -8px 28px rgba(20, 33, 38, 0.14);
  list-style: none;
}

.chat-picker-options {
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-picker-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.chat-picker-open {
  flex: none;
  margin-right: 8px;
  color: var(--cyan);
  font-size: 12px;
}

.chat-picker-item {
  display: flex;
  flex: 1;
  gap: 8px;
  align-items: baseline;
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.chat-picker-item[aria-current="true"] {
  background: var(--cyan-soft);
}

.chat-picker-main {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-picker-sub {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

.chat-picker-hint {
  padding: 6px 8px;
  color: var(--muted);
  font-size: 13px;
}

/* Narrow screens: the pane layout moved to chat.css (chat panel) and mobile_shell.css (phones, tablets). */

/* The "Photo or file" row of the composer's "+" sheet (composer_mobile.js) is the label of a file
   input in the sheet's content; it lines up with the sheet's own rows below it (sheet.css). */
.chat-sheet-body > .chat-plus-file {
  width: calc(100% + 16px);
  margin: 0 -8px -8px;
  cursor: pointer;
}

.chat-plus-file:focus-within {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}

/* Phones (<html data-chat-layout="phone">, mobile_shell.js; EPIC 0caed80242c8 item 4): one row
   "+ | text | Aa | send" like a mobile chat app. The text box grows to about five lines, then
   scrolls; "Aa" shows the formatting bar (data-format="shown"); every control is 44 px. The padding
   around the composer (safe area, keyboard) belongs to mobile_shell.css. Wide screens and the chat
   panel keep the rules above. */

html[data-chat-layout="phone"] .chat-composer[data-kind] {
  gap: 4px;
  padding-top: 6px;
}

html[data-chat-layout="phone"] .chat-composer[data-kind] > .chat-error:empty {
  display: none;
}

html[data-chat-layout="phone"] .chat-composer-box {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "format format format format"
    "plus text aa tools";
  gap: 0;
  align-items: end;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 23px;
  background: var(--panel-raised);
}

html[data-chat-layout="phone"] .chat-composer-box:focus-within {
  border-color: var(--cyan);
  background: var(--panel-solid);
}

html[data-chat-layout="phone"] .chat-composer textarea {
  grid-area: text;
  min-height: 44px;
  max-height: 132px;
  padding: 11px 4px;
  font-size: 16px;
  line-height: 22px;
  overflow-y: auto;
}

html[data-chat-layout="phone"] :is(.chat-composer-plus, .chat-composer-aa) {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 6px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  background-clip: content-box;
  color: var(--muted-bright);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

html[data-chat-layout="phone"] .chat-composer-plus {
  grid-area: plus;
  background-color: var(--cyan-soft);
  color: var(--cyan);
}

html[data-chat-layout="phone"] .chat-composer-aa {
  grid-area: aa;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

html[data-chat-layout="phone"] .chat-composer-aa[aria-pressed="true"] {
  background-color: var(--cyan-soft);
  color: var(--cyan);
}

html[data-chat-layout="phone"] :is(.chat-composer-plus, .chat-composer-aa):disabled {
  opacity: 0.5;
  cursor: default;
}

html[data-chat-layout="phone"] .chat-composer-icon {
  display: block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

html[data-chat-layout="phone"] .chat-composer-tools {
  grid-area: tools;
  gap: 0;
}

/* Emoji, GIF and files are in the "+" sheet on a phone. */
html[data-chat-layout="phone"] .chat-composer-tools > :is(.chat-composer-emoji, .chat-composer-gif, .chat-composer-attach) {
  display: none;
}

/* Send: a round arrow, grey until there is something to send; "Send" stays its name. */
html[data-chat-layout="phone"] .chat-composer[data-kind="page"] .chat-composer-send.chat-button {
  position: relative;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 5px;
  border: 0;
  border-radius: 50%;
  background-color: var(--cyan);
  background-clip: content-box;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

html[data-chat-layout="phone"] .chat-composer[data-kind="page"] .chat-composer-send.chat-button:active:not(:disabled) {
  background-color: #005a62;
}

html[data-chat-layout="phone"] .chat-composer[data-kind="page"] .chat-composer-send.chat-button:disabled {
  background-color: var(--line);
  color: var(--muted);
  opacity: 1;
}

html[data-chat-layout="phone"] .chat-composer[data-kind="page"] .chat-composer-send-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The formatting bar: hidden until "Aa"; 44 px buttons in one row that scrolls sideways. */
html[data-chat-layout="phone"] .chat-composer:not([data-format="shown"]) .chat-format-bar {
  display: none;
}

html[data-chat-layout="phone"] .chat-composer-box > .chat-format-bar {
  grid-area: format;
  gap: 0;
  margin: 0;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

html[data-chat-layout="phone"] .chat-format-button {
  min-width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 17px;
}

html[data-chat-layout="phone"] .chat-format-button[data-format="code"] {
  font-size: 15px;
}

/* Editing a sent message: "+ | text | Aa", then Cancel and Save on their own row. */
html[data-chat-layout="phone"] .chat-composer[data-kind="editor"] {
  padding: 6px 0 0;
  border-top: 0;
}

html[data-chat-layout="phone"] .chat-composer[data-kind="editor"] .chat-composer-box {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "format format format"
    "plus text aa"
    "tools tools tools";
}

html[data-chat-layout="phone"] .chat-composer[data-kind="editor"] .chat-composer-tools {
  justify-content: flex-end;
  gap: 8px;
  padding: 4px 6px 6px;
  border-top: 1px solid var(--line);
}

html[data-chat-layout="phone"] .chat-composer[data-kind="editor"] .chat-composer-tools > .chat-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 15px;
}

/* Attachments: one row that scrolls sideways; the remove control is a 44 px target in the card. */
html[data-chat-layout="phone"] .chat-attachments {
  flex-wrap: nowrap;
  padding: 2px 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

html[data-chat-layout="phone"] .chat-attachment {
  flex: none;
  max-width: min(260px, 78vw);
  min-height: 56px;
  padding: 5px 0 5px 6px;
  border-radius: 12px;
}

html[data-chat-layout="phone"] .chat-attachment img {
  width: 44px;
  height: 44px;
}

html[data-chat-layout="phone"] .chat-attachment button {
  position: static;
  flex: none;
  width: 44px;
  height: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted-bright);
  font-size: 22px;
}

/* Suggestions (people, work items, commands): 44 px rows that fit above the keyboard. */
html[data-chat-layout="phone"] .chat-picker {
  right: max(8px, env(safe-area-inset-right));
  left: max(8px, env(safe-area-inset-left));
  max-height: min(280px, calc(var(--chat-vvh, 100dvh) * 0.55));
}

/* The name stays whole; a long hint (a command's) goes on the line below it. */
html[data-chat-layout="phone"] .chat-picker-item {
  flex-wrap: wrap;
  gap: 0 8px;
  align-content: center;
  align-items: baseline;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 15px;
}

html[data-chat-layout="phone"] .chat-picker-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
}

html[data-chat-layout="phone"] .chat-picker-sub {
  flex: 0 1 auto;
  min-width: 0;
}

html[data-chat-layout="phone"] .chat-composer[data-kind] > .chat-composer-hint {
  font-size: 13px;
}
