/* Generated from app/web/styles/shared/chat-media.css. */
/* Shared authenticated photo loading controls; no nested cards inside bubbles. */
[data-photo-frame].fo-chat-photo{position:relative;display:block;isolation:isolate;overflow:hidden;width:100%;min-width:0;margin:0;padding:0;aspect-ratio:4/3;background:var(--fo-bg-muted,#e7ebee);border:0;border-radius:inherit;box-shadow:none}
[data-photo-frame] .fo-photo-open{display:block;width:100%;height:100%;padding:0;border:0;border-radius:inherit;background:transparent;cursor:zoom-in;overflow:hidden;position:relative;z-index:0}
[data-photo-frame] .fo-photo-open img{display:block;width:100%;height:100%;max-height:none;max-width:none;object-fit:contain;margin:0;filter:blur(12px);transform:scale(1.04);transition:filter .22s ease-out,transform .22s ease-out}
[data-photo-frame][data-photo-state=ready] .fo-photo-open img{filter:none;transform:none}
[data-photo-frame] .fo-photo-transfer{position:absolute;z-index:2;inset:50% auto auto 50%;transform:translate(-50%,-50%);display:grid;place-items:center;min-width:44px;min-height:44px;width:44px;height:44px;border:0;border-radius:50%;padding:0;background:rgba(20,27,34,.72);color:white;box-shadow:0 3px 12px rgba(0,0,0,.13);cursor:pointer}
[data-photo-frame] .fo-photo-transfer svg{grid-area:1/1;width:24px;height:24px;pointer-events:none}
[data-photo-frame] .fo-photo-spinner{position:absolute;inset:2px;border:2px solid rgba(255,255,255,.3);border-top-color:white;border-radius:50%;animation:fo-photo-spin .85s linear infinite;pointer-events:none}
[data-photo-frame] [data-photo-status]{position:absolute;z-index:1;bottom:12px;left:12px;right:12px;text-align:center;color:white;font-size:12px;line-height:1.4;text-shadow:0 1px 4px rgba(0,0,0,.7);pointer-events:none}
[data-photo-frame][data-photo-state=ready] .fo-photo-transfer,[data-photo-frame][data-photo-state=ready] [data-photo-status]{display:none}
[data-photo-frame] button:focus-visible,.fo-photo-view-transfer:focus-visible{outline:2px solid var(--fo-action-primary,#1675e8);outline-offset:-3px}
.fo-chat-photo-overlay .fo-chat-photo-dialog>header{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.fo-chat-photo-overlay .fo-chat-photo-dialog>header>span{margin-right:auto}
.fo-chat-photo-overlay .fo-chat-photo-dialog [data-photo-download]{flex:0 0 40px;width:40px;min-height:40px;padding:8px}
.fo-chat-photo-overlay [data-photo-download] svg{width:20px;height:20px}
.fo-chat-photo-overlay [role=status]{display:flex;align-items:center;justify-content:center;gap:12px;min-height:32px;margin:8px 0 0;font-size:13px;line-height:1.4}
.fo-chat-photo-overlay [role=status][data-photo-view-state=loading]::before{content:'';width:16px;height:16px;flex:0 0 16px;border:2px solid var(--fo-border-default,#c9d0d6);border-top-color:var(--fo-text-primary,#25303a);border-radius:50%;animation:fo-photo-spin .85s linear infinite}
.fo-chat-photo-overlay .fo-photo-view-transfer{min-height:36px;padding:6px 12px;font:inherit}
@keyframes fo-photo-spin{to{rotate:360deg}}
@media(prefers-reduced-motion:reduce){[data-photo-frame] .fo-photo-open img{transition:none;transform:none}[data-photo-frame] .fo-photo-spinner,.fo-chat-photo-overlay [role=status][data-photo-view-state=loading]::before{animation:none}}

.fo-chat-photo-overlay .fo-photo-view-transfer[hidden]{display:none}

.cm-inline-keyboard .cm-inline-button.cm-inline-choice {
  justify-content: flex-start;
  min-height: 44px;
  padding-inline: 12px;
  gap: 8px;
  text-align: start;
}

.cm-inline-keyboard .cm-inline-choice .cm-choice-emoji {
  flex: 0 0 1.3em;
  font-size: 16px;
  text-align: center;
}

/* Rich support messages and draft sheets. */
.fo-chat-composer .cm-open-rich svg { width:17px; height:17px; }
.cm-compose-editor [data-editor-spoiler] { background:rgb(112 128 145 / .2); border-radius:4px; }
.fo-message-text .cm-rich u { text-underline-offset:.17em; }
.fo-message-text .cm-rich hr { border:0; border-block-start:1px solid currentColor; opacity:.2; margin:10px 0; }
.fo-message-text .cm-rich :is(sup,sub) { font-size:.75em; }
.cm-rich .cm-task-item { list-style:none; }
.cm-rich .cm-task-item input { accent-color:var(--fo-accent,#287acc); vertical-align:middle; margin:0 5px 0 0; }
.cm-rich .cm-rich-quote { margin:7px 0; padding:6px 9px; border-inline-start:2px solid currentColor; border-radius:5px; background:rgb(110 127 149 / .10); }
.cm-rich .cm-rich-quote summary { min-height:26px; cursor:pointer; font-size:.9em; }
.cm-rich .cm-rich-quote blockquote { border:0; margin:4px 0 0; padding:0; background:none; }
.cm-rich-compose,.cm-media-compose { display:grid; gap:12px; min-width:0; }
.cm-rich-tools { display:flex; gap:4px; flex-wrap:wrap; min-width:0; }
.fo-chat-sheet .cm-rich-tools button { min-width:34px; min-height:34px; padding:4px 7px; border:0; border-radius:8px; background:var(--tg-chat-field,var(--fo-bg-surface,#eff2f6)); color:inherit; font:600 13px/1 system-ui; }
.fo-chat-sheet .cm-rich-tools button:is(:hover,:focus-visible) { background:rgb(92 135 196 / .16); }
.fo-chat-sheet .cm-rich-compose textarea,.fo-chat-sheet .cm-media-caption textarea { box-sizing:border-box; width:100%; resize:vertical; font-size:16px; line-height:1.4; }
.fo-chat-sheet .cm-rich-compose textarea { padding:10px; border-radius:10px; border:1px solid var(--tg-chat-line,var(--fo-border-subtle,#dbe2e9)); color:inherit; background:transparent; }
.cm-rich-preview { padding:9px 12px; border-radius:11px; background:rgb(112 128 145 / .09); overflow-wrap:anywhere; min-width:0; }
.cm-rich-preview[hidden] { display:none; }
.cm-rich-preview .cm-preview-empty { margin:0; font-size:13px; opacity:.73; }
.cm-rich-preview .cm-table { overflow:auto; }
.cm-rich-preview table { border-collapse:collapse; }
.cm-rich-preview :is(th,td) { border:1px solid rgb(112 128 145 / .30); padding:5px 7px; }
.cm-rich-preview pre { white-space:pre-wrap; }
.fo-chat-sheet .cm-rich-compose footer { display:flex; justify-content:flex-end; gap:8px; }
.fo-chat-sheet .cm-rich-compose footer button { min-height:40px; padding:7px 12px; border-radius:10px; }
.cm-media-compose .cm-media-preview { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; }
.cm-media-compose .cm-media-preview-item { position:relative; margin:0; min-width:0; overflow:hidden; border-radius:13px; background:rgb(112 128 145 / .10); }
.cm-media-compose .cm-media-preview-item > :is(img,video,canvas) { display:block; width:100%; max-height:min(40dvh,330px); margin-inline:auto; object-fit:contain; }
.cm-media-compose .cm-media-preview-item > canvas { width:auto; max-width:100%; height:auto; touch-action:none; }
.cm-media-compose .cm-edit-photo { position:absolute; right:8px; bottom:8px; display:flex; align-items:center; gap:6px; min-height:36px; padding:5px 9px; border:0; border-radius:10px; background:rgba(20,25,32,.84); color:#fff; font-size:12px; }
.cm-media-compose .cm-edit-photo svg { width:15px; height:15px; }
.cm-media-compose .cm-photo-tools { display:flex; flex-wrap:wrap; gap:4px; padding:6px; }
.cm-media-compose .cm-photo-tools button { min-height:34px; font-size:12px; }
.cm-media-compose .cm-photo-tools button[aria-pressed=true] { box-shadow:inset 0 0 0 1px currentColor; }
.cm-media-compose .cm-edit-cancel { margin:5px; min-height:32px; }
.cm-media-compose [data-rich-preview-toggle] { justify-self:start; min-height:32px; font-size:13px; }
@media (prefers-reduced-motion:no-preference) {
 .cm-rich-quote[open] blockquote,.cm-media-preview-item canvas { animation:cm-rich-reveal 170ms cubic-bezier(.22,1,.36,1); }
 @keyframes cm-rich-reveal { from { opacity:.48; translate:0 3px; } to { opacity:1; translate:0 0; } }
}
.cm-media-compose .cm-rich-tools { flex-wrap:nowrap; overflow-x:auto; padding-block-end:3px; overscroll-behavior-inline:contain; scrollbar-width:thin; }
.cm-media-compose .cm-rich-tools button { flex:none; }
.fo-chat-sheet .cm-edit-form textarea { font-size:16px; }
:is(.fo-chat-message,.native-bubble,.ai-bubble) .cm-rich { min-width:0; overflow-wrap:anywhere; }
:is(.fo-chat-message,.native-bubble,.ai-bubble) .cm-rich > :is(p,ul,ol,blockquote,h4) { margin-block:0; }
:is(.fo-chat-message,.native-bubble,.ai-bubble) .cm-rich > * + * { margin-block-start:.48em; }
:is(.fo-chat-message,.native-bubble,.ai-bubble) .cm-rich li + li { margin-block-start:.22em; }
:is(.fo-chat-message,.native-bubble,.ai-bubble) .cm-rich h4 { font-size:1em; font-weight:650; }
:is(.fo-chat-message,.native-bubble,.ai-bubble) .cm-rich :is(ol,ul) { padding-inline-start:1.3em; }
/* Keep staged media in the composer flow so it can't cover the last message. */
.fo-chat-host form.fo-chat-composer.native-composer:has([data-file-count]:not(:empty)) { flex-wrap:wrap; }
.fo-chat-host form.fo-chat-composer.native-composer [data-file-count]:not(:empty) {
  position:static;
  order:-1;
  box-sizing:border-box;
  flex:0 0 100%;
  min-width:0;
}

.cm-media-compose .cm-media-preview-item > canvas.cm-photo-canvas {
  width:min(100%,var(--cm-canvas-width,100%),calc(min(40dvh,330px) * var(--cm-canvas-ratio,1)));
  max-height:none;
  cursor:crosshair;
}
.cm-crop-hint { margin:0; padding:4px 10px 8px; font-size:12px; line-height:1.4; }
.cm-photo-tools [hidden],.cm-crop-hint[hidden],.cm-button-builder [hidden] { display:none; }
.cm-button-builder { min-width:0; display:grid; gap:6px; justify-items:start; }
.fo-chat-sheet .cm-button-builder button {
  min-height:36px; border:1px solid var(--tg-chat-line,var(--fo-border-subtle,#a4b0bc6b));
  border-radius:9px; background:transparent; color:inherit; padding:5px 10px;
  font:inherit; font-size:13px; cursor:pointer;
}
.fo-chat-sheet .cm-button-builder button:is(:hover,:focus-visible) { background:rgb(112 128 145 / .14); }
.cm-button-fields { width:100%; min-width:0; box-sizing:border-box; display:grid; justify-items:start; gap:8px; padding:10px; border-radius:11px; background:rgb(112 128 145 / .12); }
.cm-button-fields label { width:100%; min-width:0; display:grid; gap:4px; font-size:13px; }
.fo-chat-sheet .cm-button-fields :is(input,select,textarea) {
  display:block; width:100%; min-width:0; min-height:38px; box-sizing:border-box;
  padding:6px 8px; color:inherit; font:inherit; font-size:16px; border-radius:8px;
  border:1px solid var(--tg-chat-line,var(--fo-border-subtle,#a4b0bc6b)); background:transparent;
}
.cm-button-fields option { color:CanvasText; background:Canvas; }
.cm-button-fields textarea { resize:vertical; }
.cm-button-fields p { margin:0; font-size:13px; }
.cm-button-fields p:empty { display:none; }
.cm-button-list { width:100%; padding:0; margin:0; display:grid; gap:4px; list-style:none; }
.cm-button-list li { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px; }
.cm-button-list button:first-child { display:flex; text-align:start; align-items:center; justify-content:space-between; gap:8px; overflow-wrap:anywhere; }
.cm-button-list small { opacity:.76; }
.cm-rich-formula { overflow:auto; padding:5px; }
.cm-rich .cm-rich-reference { padding:0 2px; border:0; background:transparent; color:inherit; text-decoration:underline; cursor:pointer; }
.cm-rich .cm-rich-notes { margin-block-start:8px; padding-block-start:6px; border-block-start:1px solid rgb(112 128 145 / .30); font-size:.9em; }
.cm-rich-notes li:focus { outline:1px solid currentColor; outline-offset:2px; border-radius:3px; }
.cm-rich-map small { display:block; opacity:.78; }
.cm-open-rich[data-rich-button-count]:not([data-rich-button-count=""]) { position:relative; }
.cm-open-rich[data-rich-button-count]:not([data-rich-button-count=""])::after {
  content:attr(data-rich-button-count); position:absolute; inset-block-start:0; inset-inline-end:0;
  min-width:1em; padding:1px 2px; border-radius:9px; background:var(--tg-chat-field,#edf0f4);
  color:var(--tg-chat-ink,#152235); font:700 10px/1.15 system-ui; pointer-events:none;
}

.cm-button-list small { white-space:nowrap; }

.fo-chat-sheet.fo-dialog[data-sheet-kind="attachments"] {
  box-sizing: border-box;
  width: min(356px, 100%);
  max-height: calc(var(--fo-overlay-height, 100dvh) - 24px);
  gap: 0;
  padding: 10px 14px 14px;
  border-radius: 22px;
}
.fo-chat-sheet[data-sheet-kind="attachments"] > .fo-chat-sheet-handle { margin: 0 0 4px; }
.fo-chat-sheet[data-sheet-kind="attachments"] > .fo-dialog-header {
  min-height: 44px;
  margin: 0 0 8px;
  padding: 0 0 0 4px;
}
.fo-chat-sheet[data-sheet-kind="attachments"] h2 {
  font-size: 17px;
  font-weight: 650;
}
.fo-chat-sheet[data-sheet-kind="attachments"] > .fo-dialog-header > .fo-icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  background: transparent;
}
.fo-chat-sheet[data-sheet-kind="attachments"] > .fo-dialog-header > .fo-icon-button:hover {
  background: var(--fo-bg-elevated);
}
.fo-chat-sheet[data-sheet-kind="attachments"] > .fo-chat-sheet-content {
  display: block;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.fo-attachment-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.fo-attachment-option:only-child { grid-column: 1 / -1; }
.fo-chat-sheet .fo-attachment-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  min-height: 84px;
  min-width: 0;
  padding: 12px;
  border: 0;
  border-radius: 13px;
  background: color-mix(in srgb, var(--fo-text-primary) 6%, var(--fo-bg-surface));
  color: var(--fo-text-primary);
  font: 600 14px/1.25 var(--fo-font-family, system-ui);
  text-align: start;
  cursor: pointer;
  transition: background-color 150ms ease, transform 150ms ease;
}
.fo-attachment-option > svg {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--fo-text-primary);
}
.fo-chat-sheet .fo-attachment-option:is(:hover,:focus-visible) {
  background: color-mix(in srgb, var(--fo-text-primary) 10%, var(--fo-bg-surface));
}
.fo-chat-sheet .fo-attachment-option:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -3px;
}
.fo-chat-sheet .fo-attachment-option:active { transform: scale(.98); }
.fo-attachment-limit {
  margin: 10px 4px 0;
  color: var(--fo-text-secondary);
  font-size: 12px;
  line-height: 1.45;
}
@media (prefers-reduced-motion: reduce) {
  .fo-chat-sheet .fo-attachment-option { transition: none; }
  .fo-chat-sheet .fo-attachment-option:active { transform: none; }
}

/* Keep the actions close to the message, including when they wrap. */
.cm-menu-layer .cm-floating-menu.cm-bubble-actions-menu {
  flex-flow: row wrap;
  align-content: flex-start;
  gap: 6px;
  width: max-content;
  min-width: 0;
  max-width: min(460px, calc(100vw - 16px));
  padding: 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cm-menu-layer .cm-floating-menu.cm-bubble-actions-menu > button {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--fo-border-subtle, #e5e7eb);
  border-radius: 999px;
  background: var(--fo-bg-surface, #fff);
  color: var(--fo-text-primary, #18202d);
  opacity: 1;
  touch-action: manipulation;
  box-shadow: 0 3px 9px rgb(0 0 0 / .12);
  text-align: start;
  white-space: normal;
}
.cm-menu-layer .cm-floating-menu.cm-bubble-actions-menu > button:focus-visible {
  outline: 2px solid var(--fo-border-interactive, currentColor);
}
@media (hover: hover) and (pointer: fine) {
  .cm-menu-layer .cm-floating-menu.cm-bubble-actions-menu > button:hover {
    background: color-mix(in srgb, var(--fo-text-primary) 6%, var(--fo-bg-surface));
  }
}
@media (pointer: coarse) {
  .cm-menu-layer .cm-floating-menu.cm-bubble-actions-menu > button { min-height: 44px; }
}
[data-chat-create-quick] [data-chat-photo],
[data-chat-create-quick] .fo-chat-media video { -webkit-touch-callout: none; }
.fo-chat-sheet.fo-dialog[data-sheet-kind="quick-from-message"] {
  width: min(440px, 100%);
  max-height: min(720px, calc(var(--fo-overlay-height, 100dvh) - 24px));
}
.fo-chat-sheet[data-sheet-kind="quick-from-message"] > .fo-chat-sheet-content {
  min-height: 0;
  overflow: hidden;
}
.cm-edit-form.cm-quick-from-message {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  gap: 0;
}
.cm-edit-form.cm-quick-from-message > .cm-quick-fields {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  gap: 9px;
  padding: 2px 4px 10px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scroll-padding-block: 6px;
}
.cm-quick-fields > label { font-size: 13px; font-weight: 600; }
.cm-quick-from-message input[name="title"] {
  display: block;
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  margin-top: 5px;
  border: 1px solid var(--fo-border-subtle);
  border-radius: 10px;
  background: var(--fo-bg-elevated);
  padding: 8px 10px;
  color: inherit;
  font: inherit;
  font-size: 16px;
}
.cm-quick-from-message .cm-quick-source-media {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 4px 8px 7px;
  border: 1px solid var(--fo-border-subtle);
  border-radius: 10px;
}
.cm-quick-source-media label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.cm-quick-submit {
  flex: none;
  padding: 8px 4px 0;
  border-top: 1px solid var(--fo-border-subtle);
  background: var(--fo-bg-surface);
}
.cm-quick-submit .cm-edit-error { margin: 0 0 6px; }
.cm-quick-submit .cm-quick-footer { display: flex; justify-content: flex-end; gap: 8px; }
.cm-quick-submit .cm-quick-footer button { min-height: 44px; }
.cm-quick-from-message .cm-edit-error:empty { display: none; }
.cm-forwarded-label {
  display: block;
  margin-block-end: 4px;
  color: var(--fo-text-secondary);
  font-size: .8em;
}
.cm-quick-fields > .cm-rich-tools {
  display: flex;
  min-height: 38px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}
.cm-quick-fields > .cm-rich-tools > button { flex: none; }
.cm-quick-fields > .cm-button-builder { display: grid; justify-items: start; }

.cm-quick-upload { display: grid; gap: 7px; min-width: 0; justify-items: start; }
.cm-quick-upload > small { color: var(--fo-text-secondary); font-size: 12px; line-height: 1.45; }
.cm-quick-upload > button { display: flex; align-items: center; gap: 6px; min-height: 40px; }
.cm-quick-upload > button svg { width: 17px; height: 17px; }
.cm-quick-upload [data-quick-upload-list] {
  box-sizing: border-box;
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cm-quick-upload [data-quick-upload-list][hidden] { display: none; }
.cm-quick-upload li {
  display: grid;
  grid-template-columns: minmax(64px, 96px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px;
  border-radius: 10px;
  background: var(--fo-bg-elevated);
}
.cm-quick-upload li :is(img,video) {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 6px;
  object-fit: contain;
  background: var(--fo-bg-muted);
}
.cm-quick-upload li span { overflow-wrap: anywhere; font-size: 12px; }
.cm-quick-upload li button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: inherit;
  background: transparent;
}
.cm-quick-upload li button:is(:hover,:focus-visible) { background: rgb(112 128 145 / .16); }
.cm-quick-upload li:has(video) { grid-template-columns: minmax(0, 1fr) auto; }
.cm-quick-upload li video { grid-column: 1 / -1; grid-row: 2; aspect-ratio: 16/9; max-height: 180px; }
.cm-quick-upload li button svg { width: 17px; height: 17px; }

.cm-photo-gallery {
  display: grid;
  min-width: 0;
  width: min(100%, 236px);
  border-radius: inherit;
}
.cm-photo-gallery .cm-photo-track {
  display: flex;
  min-width: 0;
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: inherit;
}
.cm-photo-gallery .cm-photo-track > [data-photo-frame].fo-chat-photo {
  flex: 0 0 100%;
  aspect-ratio: 4 / 3 !important;
  scroll-snap-align: start;
}
.cm-photo-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.cm-photo-navigation > button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.cm-photo-navigation > button svg { width: 16px; height: 16px; }
.cm-photo-navigation > button[aria-disabled="true"] { opacity: .45; cursor: default; }
.cm-photo-navigation > button:not([aria-disabled="true"]):hover { background: rgb(112 128 145 / .13); }
.cm-photo-navigation > button:focus-visible,.cm-photo-track:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
