.order-chat-dialog {
  box-sizing: border-box;
  width: min(100% - 24px, 560px);
  max-height: min(88dvh, 700px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: #242019;
  background: #fffdf8;
  border: 1px solid #ded5bf;
  border-radius: 18px;
  box-shadow: 0 18px 58px #1410094d;
}
.order-chat-dialog[open] { display: flex; flex-direction: column; }
.order-chat-dialog::backdrop { background: #20190eb3; }
.order-chat-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #e9e0cc; }
.order-chat-header h2 { margin: 0; font-size: 1.15rem; line-height: 1.3; overflow-wrap: anywhere; }
.order-chat-header p { margin: 3px 0 0; color: #625b4d; font-size: .88rem; }
.order-chat-close { flex: 0 0 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; font: 1.5rem/1 system-ui; background: #f1ead9; color: #302719; cursor: pointer; }
.order-chat-history { padding: 14px 20px; overflow: auto; overscroll-behavior: contain; min-height: 4rem; }
.order-chat-history > p { margin: 12px 0; text-align: center; color: #625b4d; }
.order-chat-older { margin: 0 auto 12px; display: block; min-height: 44px; padding: 6px 14px; border: 1px solid #b5a47a; border-radius: 10px; color: #543e11; background: #fffdf8; font: inherit; cursor: pointer; }
.order-chat-older[hidden] { display: none; }
.order-chat-messages { display: flex; flex-direction: column; gap: 10px; }
.order-chat-message { align-self: flex-start; max-width: 86%; padding: 10px 12px; background: #f0ece3; border-radius: 12px 12px 12px 3px; }
.order-chat-message[data-sender="own"] { align-self: flex-end; background: #f5e7bc; border-radius: 12px 12px 3px 12px; }
.order-chat-message header { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; font-size: .75rem; color: #55452b; }
.order-chat-message p { margin: 3px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.order-chat-message > img { display: block; width: 144px; max-width: 100%; height: auto; margin-top: 5px; }
.order-chat-message > img[hidden], .order-chat-selected-media img[hidden] { display: none; }
.order-chat-giphy-source { display: inline-block; margin-top: 5px; color: #594019; font-size: .8rem; text-decoration: underline; }
.order-chat-message[data-kind="attention"] { border: 1px solid #c48137; background: #fff0d2; }
.order-chat-message[data-kind="attention"] p { font-weight: 650; }
.order-chat-attachment { display: grid; justify-items: start; gap: 5px; margin-top: 7px; }
.order-chat-attachment img { display: block; max-width: min(100%, 300px); max-height: 240px; object-fit: contain; border-radius: 7px; }
.order-chat-attachment small { overflow-wrap: anywhere; }
.order-chat-attachment small:empty { display: none; }
.order-chat-attachment a { color: #633d16; text-decoration: underline; }
.order-chat-form { padding: 12px 20px 16px; border-top: 1px solid #e9e0cc; }
.order-chat-form label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
.order-chat-tools, .order-chat-picker-grid { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.order-chat-tools { margin-bottom: 8px; }
.order-chat-tools button, .order-chat-picker button, .order-chat-selection button, .order-chat-attachment button {
  min-height: 38px; border: 1px solid #ddd0b3; border-radius: 9px; padding: 4px 9px;
  background: #fffdf8; color: #584019; font: inherit; font-size: .875rem; font-weight: 650; line-height: 1.2; cursor: pointer;
}
.order-chat-tools button[aria-expanded="true"], .order-chat-tools [data-chat-attention] { background: #f8ecd0; border-color: #bb9c5d; }
.order-chat-tools button:disabled, .order-chat-attachment button:disabled { opacity: .65; cursor: wait; }
.order-chat-picker { display: grid; gap: 8px; padding: 7px; margin-bottom: 8px; border: 1px solid #e9e0cc; border-radius: 10px; max-height: min(38dvh,245px); overflow-y: auto; }
.order-chat-picker[hidden], .order-chat-selection[hidden] { display: none; }
.order-chat-picker button { min-width: 39px; font-size: 1.15rem; }
.order-chat-picker button:has(img) { width: clamp(62px,17vw,86px); padding: 3px; }
.order-chat-picker img { display: block; width: 100%; height: auto; }
.order-chat-picker-section h3 { margin: 0 0 4px; font-size: .85rem; color: #594019; }
.order-chat-giphy { display: grid; gap: 6px; padding: 1px 0 8px; border-bottom: 1px solid #e9e0cc; }
.order-chat-giphy-row label { font-size: .82rem; }
.order-chat-giphy-row > div { display: flex; gap: 5px; }
.order-chat-giphy-row :is(input,a,button) { min-height: 38px; border: 1px solid #cdb993; border-radius: 8px; padding: 3px 8px; font: inherit; }
.order-chat-giphy-row input { flex: 1; min-width: 0; color: #242019; background: white; font-size: 1rem; }
.order-chat-giphy-row :is(a,button) { display: inline-flex; align-items: center; white-space: nowrap; color: #4e3815; background: #f7ebce; font-size: .83rem; font-weight: 650; }
.order-chat-giphy-error { margin: 0; font-size: .83rem; color: #a02d29; }
.order-chat-giphy-error:empty { display: none; }
.order-chat-selection { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:4px 8px; margin:0 0 8px; background:#f5ecd6; border-radius:8px; font-size:.875rem; overflow-wrap:anywhere; }
.order-chat-selected-media { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.order-chat-selected-media img { width: 50px; height: 35px; object-fit: contain; flex-shrink: 0; }
.order-chat-selection button { flex-shrink: 0; }
.order-chat-action-status { margin: 0 0 6px; font-size: .875rem; color: #654a19; }
.order-chat-action-status:empty, .order-chat-history [data-chat-load-error]:empty { display: none; }
.order-chat-keyboard { display: block; margin-top: 5px; color: #625b4d; font-size: .8rem; }
.order-chat-compose { display: flex; align-items: end; gap: 9px; }
.order-chat-compose textarea { box-sizing: border-box; flex: 1; min-width: 0; min-height: 48px; max-height: 120px; padding: 8px 10px; resize: vertical; border: 1px solid #b6a889; border-radius: 9px; background: white; color: #242019; font: inherit; font-size: 16px; }
.order-chat-compose button { min-height: 44px; padding: 0 14px; border: 0; border-radius: 9px; background: #654a19; color: white; font: inherit; font-weight: 650; cursor: pointer; }
.order-chat-compose button:disabled { opacity: .65; cursor: wait; }
.order-chat-error { margin: 0 0 7px; color: #a02d29; font-size: .88rem; }
.order-chat-error:empty { margin: 0; }
.order-chat-badge { display: inline-grid; place-items: center; box-sizing: border-box; min-width: 19px; padding: 1px 4px; min-height: 19px; border-radius: 20px; background: #8d2924; color: #fff; font: 700 11px/1 system-ui; }
.ticket-chat-button { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 28px; min-width: 32px; padding: 3px 6px; border: 1px solid #e3d8bf; border-radius: 20px; background: white; color: #694812; cursor: pointer; }
.ticket-chat-button svg { width: 15px; height: 15px; flex: none; }
.ticket-chat-button > * { pointer-events: none; }
.ticket-chat-button:has(.order-chat-badge) { background: #fff2e1; border-color: #d99a79; }
.order-detail-chat-trigger { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; }
.order-detail-chat-trigger svg { width: 16px; height: 16px; }
@media (max-width: 540px) {
  .order-chat-header,.order-chat-history,.order-chat-form { padding-right: 12px; padding-left: 12px; }
  .order-chat-message { max-width: 92%; }
  .ticket-chat-button { min-height: 34px; min-width: 34px; }
}

.order-chat-inbox{margin:0 0 12px;padding:10px 14px;border:1px solid #e6d5aa;border-radius:12px;background:#fffaf0;color:#473412}
.order-chat-inbox[hidden]{display:none}
.order-chat-inbox h2{margin:0;font-size:1rem;line-height:1.4}
.order-chat-inbox p{margin:.45rem 0 0;line-height:1.4}
.manager-tools #manager-chat{position:relative}
.manager-tools #manager-chat[aria-expanded=true]{background:#fbf0d3;border-color:#d6b573}
#manager-chat [data-inbox-total]{position:absolute;top:2px;right:2px}
.chat-inbox-header,.chat-inbox-filters,.chat-inbox-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.chat-inbox-header{justify-content:space-between}
.chat-inbox-filters{margin-top:10px}
.order-chat-inbox [data-inbox-orders]{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,235px),1fr));gap:8px;margin-top:9px}
.order-chat-inbox .chat-inbox-order{display:grid;gap:3px;text-align:left;min-width:0;overflow-wrap:anywhere;padding:9px 11px}
.chat-inbox-order span:first-child{display:flex;align-items:center;justify-content:space-between;gap:8px}
.chat-inbox-order small{color:#675740}
.chat-inbox-actions:not(:has(button:not([hidden]))){display:none}
.chat-inbox-actions{margin-top:8px}
.order-chat-inbox button[aria-pressed=true]{background:#f6ead1;border-color:#a68b54;font-weight:700}
.order-chat-inbox button{padding:6px 10px;border:1px solid #e3d8bf;border-radius:9px;background:white;color:inherit;font:inherit;cursor:pointer;min-height:40px}

.tracking-main .tracking-chat-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 78px;
  gap: 12px;
  margin: 0 0 16px;
  padding: 14px 18px;
  border-radius: 14px;
  text-align: left;
  cursor: pointer;
}
.tracking-main .tracking-chat-trigger:hover { filter: brightness(1.08); }
.tracking-chat-copy { display: grid; gap: 5px; flex: 1; }
.tracking-chat-copy strong { font-size: 1.12rem; line-height: 1.2; }
.tracking-chat-copy small { font-size: .875rem; line-height: 1.3; font-weight: 500; }
.tracking-chat-arrow { font-size: 1.25rem; color: #f4d69b; }
.tracking-chat-unread:empty { display: none; }
.tracking-chat-trigger .order-chat-badge { background: #fff4db; color: #47232d; }
.tracking-chat-attention:not([hidden]) {
  margin: 0 0 8px; padding: 10px 13px; color: #33220a; background: #ffe3a9;
  border: 1px solid #d59135; border-radius: 10px; font-weight: 650;
  animation: tracking-chat-nudge .45s ease-out;
}
@keyframes tracking-chat-nudge {
  20%, 60% { transform: translateX(-3px); }
  40%, 80% { transform: translateX(3px); }
}
@media(prefers-reduced-motion:reduce) { .tracking-chat-attention:not([hidden]) { animation: none; } }

.ticket-card .ticket-card-toolbar{flex-wrap:wrap}
