.teams-brand-icon { width: 23px; height: 23px; flex: 0 0 23px; vertical-align: middle; }
.reply-tabs { flex-wrap: wrap; }
.reply-tabs button[data-reply-mode="teams"] { display: inline-flex; align-items: center; gap: 7px; }
.reply-tabs button[data-reply-mode="teams"].is-active { color: #dedbff; background: rgba(123, 131, 235, .20); box-shadow: inset 0 0 0 1px rgba(123, 131, 235, .38); }
.reply-panel.is-teams-chat { border-color: rgba(123, 131, 235, .35); }
.reply-panel [hidden], .teams-chat [hidden] { display: none !important; }
.teams-chat { display: grid; gap: 14px; min-width: 0; }
.teams-chat__heading, .teams-chat__brand { display: flex; align-items: center; gap: 9px; }
.teams-chat__heading { justify-content: space-between; flex-wrap: wrap; }
.teams-chat__brand strong { font-size: 15px; }
.teams-chat__archive-badge { padding: 3px 9px; border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 700; }
.teams-chat__notice { padding: 12px 14px; border: 1px solid rgba(123, 131, 235, .24); border-radius: 12px; margin: 0; color: var(--muted); background: rgba(123, 131, 235, .07); font-size: 12px; line-height: 1.65; }
.teams-chat__connect { justify-self: start; }
.teams-chat__controls { display: grid; grid-template-columns: minmax(145px, .8fr) minmax(180px, 1.2fr); gap: 12px; }
.teams-chat__controls .field { min-width: 0; margin: 0; }
.teams-chat__controls .field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.teams-chat__controls select { width: 100%; min-width: 0; font-size: 13px; }
.teams-chat__presence { display: flex; flex-wrap: wrap; gap: 8px; }
.teams-presence { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 30px; background: var(--surface); color: var(--muted); font-size: 11px; max-width: 100%; }
.teams-presence > span:last-child { overflow-wrap: anywhere; }
.teams-presence__dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #94a3b8; }
.teams-presence__dot.is-online { background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .10); }
.teams-chat__history { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 17px; min-height: 125px; max-height: 460px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--stroke); background: rgba(3, 8, 18, .12); border-radius: 14px; scrollbar-width: thin; }
.teams-chat__history:focus-visible { outline: 2px solid #969ef3; outline-offset: 3px; }
.teams-chat__empty { align-self: center; text-align: center; color: var(--muted); font-size: 13px; margin: 24px 0; }
.teams-message { max-width: 92%; min-width: 130px; background: var(--surface); border: 1px solid var(--stroke); border-radius: 13px 13px 13px 4px; padding: 11px 13px; scroll-margin: 80px; }
.teams-message.is-own { align-self: flex-end; border-radius: 13px 13px 4px 13px; background: rgba(123, 131, 235, .14); border-color: rgba(123, 131, 235, .25); }
.teams-message.is-linked { outline: 2px solid #a5b4fc; outline-offset: 3px; }
.teams-message.is-deleted { border-style: dashed; }
.teams-message__top { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 5px 15px; }
.teams-message__top strong { font-size: 12px; overflow-wrap: anywhere; }
.teams-message time { color: var(--soft); font-size: 10px; white-space: nowrap; }
.teams-message__body { font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 0; }
.teams-message__revision { display: block; color: var(--muted); font-size: 10px; margin-top: 6px; }
.teams-message__revisions { margin-top: 8px; font-size: 11px; color: var(--muted); }
.teams-message__revisions summary { cursor: pointer; }
.teams-message__revision-entry { margin-top: 8px; border-top: 1px solid var(--stroke); padding-top: 7px; }
.teams-message__revision-entry p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 5px 0; }
.teams-chat__sync:empty { display: none; }
.teams-chat__sync, .teams-chat__help { color: var(--muted); font-size: 11px; margin: 0; line-height: 1.6; }
.teams-chat__editor-label { font-size: 12px; font-weight: 650; margin-bottom: -7px; }
.teams-chat__editor { resize: vertical; width: 100%; min-height: 95px; max-height: 320px; padding: 13px 14px; background: var(--surface-strong); border: 1px solid var(--stroke-strong); border-radius: 12px; color: var(--text); font-size: 14px; line-height: 1.6; }
.teams-chat__editor:focus { outline: 2px solid #7b83eb; outline-offset: 2px; }
.teams-chat__editor:disabled { opacity: .55; cursor: not-allowed; }
.teams-chat__footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.teams-chat__footer > span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.teams-chat__enter-toggle { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; color: var(--muted); font-size: 11px; cursor: pointer; }
.teams-chat__enter-toggle input { appearance: none; position: relative; width: 30px; height: 18px; margin: 0; border: 1px solid var(--stroke-strong); border-radius: 20px; background: var(--surface); cursor: pointer; }
.teams-chat__enter-toggle input::before { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #e9ecff; transition: transform .15s ease; }
.teams-chat__enter-toggle input:checked { background: #6264a7; border-color: #9698dc; }
.teams-chat__enter-toggle input:checked::before { transform: translateX(12px); }
.teams-chat__enter-toggle input:focus-visible { outline: 2px solid #a5b4fc; outline-offset: 3px; }
.teams-chat__send { background: linear-gradient(135deg, #676fc7, #535bb4); color: white; flex-shrink: 0; }
.teams-chat__send:hover { background: #6264a7; }
.teams-chat__send:disabled { opacity: .5; }
.teams-chat__older { justify-self: center; font-size: 12px; }
.teams-toast { border-color: rgba(123, 131, 235, .4); border-left-color: #8b90ed; }
.teams-toast .live-note-toast__badge { color: #c4c7ff; background: rgba(123, 131, 235, .19); }
html[data-theme="light"] .reply-tabs button[data-reply-mode="teams"].is-active { color: #464c9a; background: rgba(123, 131, 235, .15); }
html[data-theme="light"] .teams-chat__history { background: rgba(123, 131, 235, .035); }
@media (max-width: 600px) {
  .teams-chat__controls { grid-template-columns: 1fr; gap: 10px; }
  .teams-chat__footer { align-items: stretch; flex-direction: column; }
  .teams-chat__send { justify-content: center; }
  .teams-chat__history { max-height: 390px; padding: 12px; }
  .teams-message { max-width: 96%; }
  .teams-chat__editor { font-size: 16px; }
}
/* Adding a third tab must not widen the ticket's grid column on phones. */
.detail-main:has([data-teams-chat]) { min-width: 0; }
.reply-panel:has([data-teams-chat]) .reply-tabs { width: fit-content; max-width: 100%; }
[data-ticket-timeline-items] { display: grid; gap: 18px; min-width: 0; }
.timeline-history-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.timeline-history-controls:has([data-timeline-older][hidden]):has([data-timeline-page-hint][hidden]):has([data-timeline-status]:empty) { display: none; }
.timeline-history-controls [hidden] { display: none; }
.timeline-history-controls p { margin: 0; }
.teams-timeline-item .timeline-content { border-color: rgba(116, 89, 175, .54); background: rgba(73, 48, 118, .20); }
.teams-timeline-item .timeline-head strong { border-left: 3px solid var(--timeline-person-color); padding-left: 8px; }
.teams-timeline-label { display: inline-flex; align-items: center; gap: 6px; margin: 1px 0 8px; color: #c2b3e7; font-size: .72rem; font-weight: 700; }
.teams-timeline-label .teams-brand-icon { width: 17px; height: 17px; flex-basis: 17px; }
.teams-timeline-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; font-size: .85rem; }
.teams-timeline-item.is-linked .timeline-content { outline: 2px solid #a89cda; outline-offset: 3px; }
.teams-timeline-item { scroll-margin: 90px; outline: none; }
.teams-timeline-item.is-deleted .timeline-content { border-style: dashed; }
.teams-timeline-item.is-deleted .teams-timeline-body { color: var(--muted); }
.teams-timeline-attachments { display: grid; gap: 7px; padding: 0; margin: 12px 0 0; list-style: none; }
.teams-timeline-attachments li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; overflow-wrap: anywhere; font-size: .75rem; }
.teams-timeline-attachments svg { width: 15px; height: 15px; }
.teams-timeline-attachments span { color: var(--muted); font-size: .7rem; }
html[data-theme="light"] .teams-timeline-item .timeline-content { border-color: rgba(86, 59, 132, .32); background: rgba(86, 59, 132, .065); }
html[data-theme="light"] .teams-timeline-label { color: #57417f; }
@media (max-width: 960px) { .teams-chat__footer { flex-wrap: wrap; } .teams-chat__footer > span { flex-basis: 100%; } }
@media (max-width: 600px) {
  .teams-chat__footer { display: grid; grid-template-columns: minmax(0, 1fr); }
  .teams-chat__enter-toggle { justify-self: start; }
  .teams-chat__send { width: 100%; }
}
.ticket-status-overview { display: grid; justify-items: end; gap: 7px; flex-shrink: 0; }
.ticket-entry-count { color: var(--muted); font-size: .72rem; font-variant-numeric: tabular-nums; }
.timeline-author { display: flex; align-items: center; min-width: 0; gap: 8px; }
.timeline-author strong { overflow-wrap: anywhere; }
.timeline-entry-number { flex-shrink: 0; display: inline-grid; min-width: 23px; height: 21px; padding: 0 5px; place-items: center; border: 1px solid var(--stroke); border-radius: 6px; background: rgba(255,255,255,.035); color: var(--muted); font-size: .66rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.ticket-summary { padding: 20px 22px; border-color: rgba(132, 116, 188, .34); background: linear-gradient(130deg, rgba(86,66,125,.18), rgba(255,255,255,.035)); }
.ticket-summary[hidden], .ticket-devices[hidden] { display: none; }
.ticket-summary-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.ticket-summary-heading h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .98rem; }
.ticket-summary-heading h2 svg { width: 18px; height: 18px; color: #c2b3e7; }
.ticket-summary-updated { font-size: .65rem; color: var(--soft); }
.ticket-summary-sections { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px 22px; }
.ticket-summary-section h3 { margin: 0 0 7px; color: var(--text); font-size: .75rem; font-weight: 750; }
.ticket-summary-section ul { display: grid; gap: 7px; padding: 0; margin: 0; list-style: none; }
.ticket-summary-section p { margin: 0; color: var(--soft); font-size: .74rem; }
.ticket-summary-point { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 7px; padding: 5px 7px; margin-left: -7px; color: var(--muted); font-size: .78rem; line-height: 1.55; border-radius: 6px; overflow-wrap: anywhere; }
.ticket-summary-point.is-new { background: rgba(61,174,126,.095); box-shadow: inset 2px 0 #529c7c; }
.ticket-summary-point.is-updated { background: rgba(115,128,202,.13); box-shadow: inset 2px 0 #7f88c8; }
.ticket-summary-change { border-radius: 4px; padding: 1px 5px; font-size: .6rem; font-weight: 750; line-height: 1.5; color: #b3dfc7; background: rgba(70,160,119,.15); }
.is-updated .ticket-summary-change { color: #c8cdf3; background: rgba(115,128,202,.18); }
.ticket-devices { display: flex; flex-wrap: wrap; gap: 15px 25px; padding: 15px 20px; }
.ticket-device { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ticket-device-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: rgba(96,165,250,.10); color: var(--primary); }
.ticket-device-icon svg { width: 17px; height: 17px; }
.ticket-device > div { display: grid; gap: 3px; min-width: 0; }
.ticket-device > div > span { color: var(--soft); font-size: .65rem; }
.ticket-device strong { font-size: .78rem; overflow-wrap: anywhere; }
.ticket-device-address { color: var(--muted); font-size: .69rem; font-variant-numeric: tabular-nums; }
.ticket-devices > p { flex-basis: 100%; margin: 0; }
.ticket-ai-reply { justify-self: start; }
@media (max-width: 600px) {
  .ticket-summary { padding: 18px; }
  .ticket-summary-sections { grid-template-columns: minmax(0,1fr); gap: 16px; }
  .ticket-status-overview { justify-items: start; }
  .timeline-author { gap: 6px; }
}
