.detail-chat-layout {
  display: grid;
  grid-template-columns: var(--detail-case-nav-width, clamp(182px,17vw,256px)) 12px minmax(0, 1fr);
  gap: 0;
  height: 100%;
  min-height: 0;
  color: var(--ink, #17243d);
}

.detail-case-nav,
.detail-room {
  min-width: 0;
  overflow: hidden;
  border: 0;
  background: #fff;
}

.detail-case-nav { display: flex; flex-direction: column; background:#fcfafc; }
.detail-case-resizer {
  position: relative;
  z-index: 3;
  width: 12px;
  margin: 0 -1px;
  cursor: col-resize;
  touch-action: none;
}
.detail-case-resizer::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: var(--line, #dce2ed);
  content: "";
  transition: width .12s, background .12s;
}
.detail-case-resizer:hover::after,
.detail-case-resizer:focus-visible::after,
.detail-chat-layout.is-resizing .detail-case-resizer::after { width: 3px; background: #9f7ba6; }
.detail-case-resizer:focus-visible { outline: 2px solid #9f7ba6; outline-offset: -2px; }
.detail-chat-layout.is-resizing,
body.detail-case-resizing,
body.detail-case-resizing * { cursor: col-resize !important; user-select: none !important; }
.detail-case-nav > header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line, #dce2ed);
  padding: 13px 15px;
}
.detail-case-nav small { color: var(--muted, #6c7890); font-size: 11px; }
.detail-case-nav h2 { overflow: hidden; margin-top: 3px; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.detail-new-discussion {
  display: grid;
  width: 34px;
  height: 34px;
  flex: none;
  place-items: center;
  border: 1px solid #d9e3ff;
  border-radius: 9px;
  background: #f2f5ff;
  color: #315edf;
}
.detail-new-discussion:hover { background: #e6edff; }
.detail-case-list { flex: 1; overflow: auto; padding: 7px; }
.detail-case-row {
  position: relative;
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin-bottom: 3px;
  border-radius: 9px;
  padding: 0;
  color: var(--ink, #17243d);
  text-align: left;
}
.detail-case-row.has-pin { grid-template-columns: minmax(0, 1fr) 32px; }
.detail-case-row.selected { background:#eee4f1; box-shadow:inset 3px 0 #805388; }
.detail-case-open { position:relative; display:grid; width:100%; min-width:0; grid-template-columns:auto minmax(0,1fr); gap:3px 8px; border-radius:9px; padding:10px 9px; color:var(--ink,#17243d); text-align:left; }
.detail-case-open:hover { background:#f5f7fc; }
.detail-case-row.has-pin .detail-case-open,
.detail-case-row.has-unread .detail-case-open { padding-right:36px; }
.detail-case-open[aria-current="page"] { background:#eee4f1; box-shadow:inset 3px 0 #805388; }
.detail-case-kind { align-self: start; border-radius: 5px; padding: 2px 5px; background: #f1f4f9; color: #68758c; font-size: 10px; }
.detail-case-open strong { overflow: hidden; font-size: 14px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.detail-case-open small { grid-column: 2; overflow: hidden; color: var(--muted, #6c7890); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.detail-case-row.has-pin .detail-case-unread { right: 6px; }
.detail-case-row > .case-pin { display:grid; width:28px; height:28px; align-self:center; justify-self:center; place-items:center; border-radius:7px; color:var(--muted,#6c7890); }
.detail-case-row > .case-pin:hover { background:#eee4f1; color:var(--ink,#27222a); }
.detail-empty-list { padding: 22px 10px; color: var(--muted, #6c7890); font-size: 12px; text-align: center; }
.detail-case-unread { position:absolute; top:50%; right:9px; min-width:19px; height:19px; transform:translateY(-50%); border-radius:10px; padding:1px 5px; background:#315edf; color:#fff; font-size:11px; font-weight:650; line-height:17px; text-align:center; }

.detail-room { display: flex; min-height: 0; flex-direction: column; position: relative; }
.detail-room-header {
  z-index: 2;
  display: flex;
  min-height: 77px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line, #dce2ed);
  padding: 13px 20px;
  background: #fff;
}
.detail-room-title { min-width: 0; }
.detail-title-line { display:flex; align-items:center; gap:6px; min-width:0; }
.detail-title-edit { display:grid; place-items:center; flex:none; padding:4px; color:#776b81; border-radius:5px; cursor:pointer; }
.detail-title-edit:hover,.detail-title-edit:focus-visible { color:#684271; background:#f1eaf4; }
.detail-title-line input { width: min(570px, 100%); min-width:0; border:1px solid #9b81aa; border-radius:5px; padding:3px 6px; color:inherit; font:inherit; font-weight:650; }
.detail-room-project { overflow: hidden; margin-bottom: 2px; color: var(--muted, #6c7890); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.detail-room-title h1 { overflow: hidden; font-size: 17px; font-weight: 650; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.detail-room-title h1::before { content:"#"; margin-right:6px; color:#87648d; font-weight:550; }
.detail-room-subtitle { overflow: hidden; margin-top: 3px; color: var(--muted, #6c7890); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.detail-room-tools { position: relative; display: flex; align-items: center; gap: 7px; flex: none; }
.detail-status-button,
.detail-people-button {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line, #dce2ed);
  border-radius: 8px;
  padding: 4px 9px;
  background: #fff;
  color: var(--ink, #17243d);
  cursor: pointer;
  font-size: 12px;
}
.detail-status-button:hover,
.detail-people-button:hover { background: #f7f9fc; }
.detail-people-button { color: #51617b; }
.detail-status-pop {
  position: absolute;
  z-index: 7;
  top: calc(100% + 8px);
  right: 0;
  width: min(290px, calc(100vw - 24px));
  border: 1px solid var(--line, #dce2ed);
  border-radius: 11px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 14px 38px #14244426;
  font-size: 13px;
}
.detail-status-pop p { margin: 0 0 11px; color: var(--muted, #6c7890); }
.detail-status-pop > button { width: 100%; margin-top: 12px; border: 1px solid var(--line, #dce2ed); border-radius: 7px; padding: 8px; background: #fff; color: #315edf; cursor: pointer; }
.detail-tracker-list { display: grid; gap: 7px; }
.detail-tracker-list b { font-size: 12px; }
.detail-participants-list { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-participant { border: 1px solid #e2e8f2; border-radius: 15px; padding: 4px 8px; background: #f6f8fc; color: #315edf; font-size: 12px; }
.detail-status-member { color: #315edf; }

.detail-message-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px clamp(13px, 2.5vw, 34px) 24px;
  background-color: #fff;
  scrollbar-width: thin;
}
.detail-load-older { align-self: center; order: 1; border: 1px solid #dce3ed; border-radius: 16px; padding: 6px 13px; background: #fff; color: #53627a; cursor: pointer; font-size: 11px; }
.detail-target-scroll-spacer { order: 3; flex: none; }
.detail-load-older:hover { border-color: #b8c8ef; color: #315edf; }
.detail-message-list > .detail-unread-divider { order: 2; }
.detail-message-list > .detail-opening-unread-divider { order: -1; }
.detail-unread-divider { display:flex; align-items:center; gap:10px; color:#315edf; font-size:12px; font-weight:600; }
.detail-unread-divider::before,
.detail-unread-divider::after { height:1px; flex:1; background:#c8d5f5; content:""; }
.detail-thread > .detail-unread-divider { grid-column:1 / -1; margin:2px 0; }
.detail-message-list > .detail-message:first-of-type { order: 0; }
.detail-message-list > .detail-message:not(:first-of-type) { order: 2; }
.detail-message { display: flex; max-width: min(850px, 88%); align-items: flex-start; gap: 8px; }
.detail-message.is-mine { align-self: flex-end; flex-direction: row-reverse; }
.detail-message-avatar { padding-top: 22px; }
.detail-avatar { display: inline-grid; width: 31px; min-width: 31px; height: 31px; place-items: center; border: 0; border-radius: 50%; padding: 0; background: #e4eafa; color: #4d6290; cursor: pointer; font-size: 12px; font-weight: 650; }
.detail-avatar > img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.detail-message.is-mine .detail-avatar { background: #cbd9ff; color: #2449aa; }
.detail-message-stack { min-width: 0; }
.detail-message.is-mine .detail-message-stack { display: flex; flex-direction: column; align-items: flex-end; }
.detail-message-author { display: flex; flex-wrap:wrap; align-items: center; gap: 7px; margin: 0 3px 5px; color: var(--muted, #6c7890); font-size: 12px; }
.detail-message-author time { color: #8994a6; font-size: 12px; }
.detail-message-kind { border-radius: 8px; padding: 1px 6px; background: #e9edf4; color: #60708a; font-size: 12px; }
.detail-message.is-mine .detail-message-kind { background: #dce6ff; color: #4262b0; }
.detail-track-actions { display: inline-flex; flex-wrap:wrap; align-items: center; gap: 8px; margin-left: 3px; }
.detail-track-action { padding: 0; color: #6d7a91; cursor: pointer; font: inherit; font-size: 12px; }
.detail-copy-card { color:#315edf; }
.detail-track-action:hover { color: #315edf; text-decoration: underline; }
.detail-track-action.danger:hover { color: #c43b4b; }
.detail-track-closed { border-radius: 9px; padding: 1px 7px; background: #edf0f4; color: #77839a; font-size: 11px; }
.detail-track-reply-closed { margin-top: 8px; color: #8792a6; font-size: 12px; }
.case-lifecycle-primary,
.case-lifecycle-secondary,
.case-lifecycle-approve {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid #cdd8f3;
  border-radius: 8px;
  padding: 6px 10px;
  background: #315edf;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 620;
  cursor: pointer;
}
.case-lifecycle-primary:hover:not(:disabled),
.case-lifecycle-approve:hover:not(:disabled) { background: #244cc3; }
.case-lifecycle-secondary { border-color: var(--line, #dce2ed); background: #fff; color: #39465f; }
.case-lifecycle-secondary:hover:not(:disabled) { background: #f5f7fb; }
.case-lifecycle-primary:disabled,
.case-lifecycle-secondary:disabled,
.case-lifecycle-approve:disabled { opacity: .56; cursor: not-allowed; }
.case-lifecycle-review { margin-top: 12px; border-top: 1px solid #e6ebf5; padding-top: 11px; }
.case-lifecycle-review p,
.case-lifecycle-pending { margin: 0; color: #55637d; font-size: 12px; line-height: 1.6; }
.case-lifecycle-review-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.detail-status-pop .case-lifecycle-primary { width: 100%; margin-top: 12px; }
.case-lifecycle-pending { margin-top: 10px; border-radius: 7px; padding: 8px 9px; background: #f4f6fb; }
.case-lifecycle-dialog { width: min(470px, calc(100vw - 28px)); max-width: calc(100vw - 28px); max-height: calc(100dvh - 28px); overflow: auto; margin: auto; border: 1px solid #dce3ef; border-radius: 14px; padding: 0; color: var(--ink, #17243d); background: #fff; box-shadow: 0 22px 70px #10204045; }
.case-lifecycle-dialog::backdrop { background: #111a2bb0; backdrop-filter: blur(2px); }
.case-lifecycle-dialog-card { padding: 22px; }
.case-lifecycle-dialog-card h2 { margin: 0 0 7px; font-size: 18px; }
.case-lifecycle-dialog-description { margin: 0 0 17px; color: #63718b; font-size: 13px; line-height: 1.55; }
.case-lifecycle-reason-label { display: grid; gap: 6px; color: #3b4963; font-size: 13px; font-weight: 600; }
.case-lifecycle-reason-label textarea { width: 100%; min-height: 108px; resize: vertical; border: 1px solid #dce3ef; border-radius: 8px; padding: 9px 10px; color: var(--ink, #17243d); background: #fff; font: inherit; font-size: 14px; line-height: 1.5; }
.case-lifecycle-reason-label textarea:focus { outline: 2px solid #a9bdf0; outline-offset: 1px; border-color: #7e9ae7; }
.case-lifecycle-error { margin: 9px 0 0; color: #b32942; font-size: 12px; line-height: 1.5; }
.case-lifecycle-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.case-lifecycle-system { align-self: flex-start; }
.case-lifecycle-system-avatar { display: grid; place-items: center; background: #eaf0ff; color: #315edf; cursor: default; }
.case-lifecycle-system .detail-message-author { align-items: center; }
.case-lifecycle-system-kind { display: inline-flex; align-items: center; gap: 4px; color: #3f578d; font-weight: 650; }
.case-lifecycle-system-actor { color: #596883; }
.case-lifecycle-system .detail-message-content { width: auto; border-color: #dce5f8; border-radius: 10px; padding: 9px 12px; background: #f3f6fc; color: #394963; }
.case-lifecycle-system .detail-message-text { line-height: 1.55; }
.case-lifecycle-system .detail-copy-card { font-size: 12px; }
.case-lifecycle-system .detail-message-avatar { padding-top: 0; }
.detail-message-content {
  position: relative;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #e4e9f1;
  border-radius: 4px 14px 14px 14px;
  padding: 12px 14px;
  background: #fff;
  box-shadow: 0 2px 5px #1d315008;
  font-size: 16px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.detail-message.is-mine .detail-message-content { border-color:#e7d6eb; border-radius:12px 3px 12px 12px; background:#f6eff8; }
.detail-message-content.expanded { overflow: visible; padding-bottom: 34px; }
.detail-message-text { white-space: normal; }
.detail-message-text:empty { min-height: 1px; }
.detail-card-link { color: #3159a1; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.detail-attachments { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; }
.detail-attachments:empty { display: none; }
.detail-media-open { display: block; width: min(260px, 65vw); border: 0; padding: 0; background: transparent; color: #52627a; cursor: zoom-in; font: inherit; font-size: 12px; line-height: 1.4; text-align: left; }
.detail-media-open > img { display: block; width: 100%; max-height: 210px; margin-bottom: 4px; border: 1px solid #dbe2ed; border-radius: 8px; background: #101827; object-fit: contain; }
.detail-media-open:hover > img { border-color: #9bb2ef; }
.detail-video-open { cursor: pointer; }
.detail-video-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid #dbe2ed; border-radius: 8px; background: linear-gradient(145deg, #18233a, #34415c); }
.detail-video-play { position: absolute; top: 50%; left: 50%; display: grid; width: 44px; height: 44px; place-items: center; transform: translate(-50%, -50%); border: 1px solid #ffffffa8; border-radius: 50%; background: #0e1629a8; }
.detail-video-play::after { width: 0; height: 0; margin-left: 4px; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 12px solid #fff; content: ''; }
.detail-video-thumb > span:last-child { position: absolute; right: 8px; bottom: 6px; left: 8px; overflow: hidden; color: #fff; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.detail-video-open:hover .detail-video-play { background: #315edee0; }
.detail-file { display: flex; align-items: center; gap: 7px; border: 1px solid #dce3ed; border-radius: 8px; padding: 8px 10px; background: #fff; color: #315edf; font-size: 12px; text-decoration: none; }
.detail-thread { display: grid; gap: 9px; margin-top: 12px; border-top: 1px solid #e9edf4; padding-top: 9px; }
.detail-thread-heading { display: flex; align-items: center; gap: 5px; color: #748198; font-size: 12px; }
.detail-thread-heading span { color: #9aa5b5; }
.detail-reply { display: flex; align-items: flex-start; gap: 7px; }
.detail-reply .detail-avatar { width: 23px; min-width: 23px; height: 23px; font-size: 10px; }
.detail-reply-bubble { min-width: 0; border-radius: 7px; padding: 5px 8px; background: #f4f6fa; font-size: 14px; line-height: 1.5; }
.detail-message.is-mine .detail-reply-bubble { background:#eee1f1; }
.detail-reply-byline { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.detail-reply-byline time { margin-left: auto; }
.detail-reply-bubble p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-reply-bubble .detail-attachments { gap: 6px; margin-top: 7px; }
.detail-reply-bubble .detail-media-open { width: min(190px, 52vw); }
.detail-reply-bubble .detail-media-open > img { max-height: 130px; }
.detail-reply-open { display: flex; align-items: center; gap: 5px; margin-top: 8px; padding: 2px 1px; color: #75829a; cursor: pointer; font-size: 12px; }
.detail-reply-open:hover { color: #315edf; }
.detail-reply-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; }
.detail-reply-form textarea { min-width: 150px; max-width: min(460px, 65vw); min-height: 35px; max-height: 120px; flex: 1; resize: vertical; border: 1px solid #dce3ed; border-radius: 9px; padding: 7px 10px; background: #fff; color: var(--ink, #17243d); font: inherit; font-size: 16px; line-height: 1.45; }
.detail-reply-upload { display: grid; width: 30px; height: 30px; flex: none; place-items: center; border-radius: 8px; color: #6c7a91; cursor: pointer; }
.detail-reply-upload:hover { background: #f2f5fa; color: #315edf; }
.detail-reply-form .detail-upload-list { order: 3; flex-basis: 100%; }
.detail-reply-form .detail-reply-send { order: 2; }
.detail-reply-send { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: #315edf; color: #fff; }
.detail-expand { position: absolute; z-index: 3; right: 7px; bottom: 6px; border: 1px solid #dfe5ef; border-radius: 14px; padding: 3px 9px; background: #fffffff0; color: #315edf; cursor: pointer; font-size: 12px; line-height: 1.5; box-shadow: 0 0 0 4px #ffffffe0; }
.detail-expand:hover { background: #fff; }

.detail-delete-dialog,
.detail-media-viewer { margin: auto; border: 0; padding: 0; color: var(--ink, #17243d); box-shadow: 0 20px 70px #07142a4d; }
.detail-delete-dialog::backdrop,
.detail-media-viewer::backdrop { background: #0c1426a8; backdrop-filter: blur(2px); }
.detail-dialog-card { width: min(440px, calc(100vw - 28px)); border: 1px solid var(--line, #dce2ed); border-radius: 14px; padding: 22px; background: #fff; }
.detail-dialog-card h2 { margin-bottom: 9px; font-size: 18px; }
.detail-dialog-card p { color: #65728a; font-size: 13px; line-height: 1.6; }
.detail-dialog-card p strong { color: #273653; }
.detail-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.detail-dialog-actions button { border: 1px solid var(--line, #dce2ed); border-radius: 8px; padding: 8px 12px; background: #fff; cursor: pointer; font-size: 13px; }
.detail-dialog-danger { border-color: #c63e4e !important; background: #c63e4e !important; color: #fff; }
.detail-dialog-danger:hover { background: #aa2f3f !important; }
.detail-media-viewer { width: min(1200px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); overflow: hidden; border-radius: 12px; background: #101827; color: #fff; }
.detail-media-viewer-frame { display: flex; max-height: calc(100dvh - 28px); flex-direction: column; }
.detail-media-viewer header { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 12px 7px 16px; }
.detail-media-viewer header strong { overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.detail-media-viewer header button { display: grid; width: 34px; height: 34px; flex: none; place-items: center; border-radius: 8px; color: #fff; }
.detail-media-viewer header button:hover { background: #ffffff20; }
.detail-media-viewer-stage { position:relative; display: grid; min-height: 0; flex: 1; place-items: center; overflow:hidden; padding: 0 10px 10px; }
.detail-media-viewer-stage img,
.detail-media-viewer-stage video { display: block; max-width: 100%; max-height: calc(100dvh - 90px); border-radius: 5px; object-fit: contain; }
.detail-media-viewer-stage img { cursor:zoom-in; touch-action:none; user-select:none; }
.detail-media-viewer-stage img.is-zoomed { cursor:grab; }
.detail-media-viewer-stage img.is-panning { cursor:grabbing; }
.detail-media-viewer-stage img[hidden],
.detail-media-viewer-stage video[hidden] { display: none; }
.detail-media-viewer-stage video { width: 100%; }
.detail-image-reset { position:absolute; top:10px; right:12px; z-index:2; border:1px solid #ffffff55; border-radius:17px; padding:5px 10px; background:#101827cc; color:#fff; cursor:pointer; font-size:12px; }
.detail-image-reset:hover { background:#25334b; }

.detail-chat-welcome { display: flex; min-height: 0; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 28px; background: #f5f7fb; color: var(--muted, #6c7890); text-align: center; }
.detail-chat-welcome h2 { color: var(--ink, #17243d); font-size: 18px; }
.detail-chat-welcome p { max-width: 380px; font-size: 13px; }
.detail-welcome-icon { display: grid; width: 56px; height: 56px; place-items: center; margin-bottom: 4px; border-radius: 17px; background: #eaf0ff; color: #315edf; }
.detail-retry { border: 1px solid var(--line, #dce2ed); border-radius: 7px; padding: 7px 12px; background: #fff; color: #315edf; cursor: pointer; }

.detail-composer { z-index: 2; flex: none; border-top: 1px solid var(--line, #dce2ed); padding: 10px clamp(12px, 2.5vw, 28px) 13px; background: #fff; }
.detail-kind-picker { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; color: #748198; font-size: 11px; }
.detail-kind-picker select { border: 1px solid #dce3ed; border-radius: 6px; padding: 3px 7px; background: #fff; color: #53627a; font-size: 11px; }
.detail-compose-box { border: 1px solid #dce3ed; border-radius: 12px; padding: 8px 9px 6px 13px; background: #fff; box-shadow: 0 2px 8px #1b2b4808; }
.detail-compose-box:focus-within { border-color: #9bb2ef; box-shadow: 0 0 0 3px #315edf12; }
.detail-compose-box > textarea { display: block; width: 100%; height: 110px; min-height: 27px; max-height: min(280px, 35dvh); resize: vertical; border: 0; outline: 0; padding: 2px 0; background: transparent; color: var(--ink, #17243d); font: inherit; font-size: 16px; line-height: 1.6; }
.detail-compose-box > textarea:focus { outline: none; }
.detail-compose-tools { display: flex; min-height: 34px; align-items: center; gap: 9px; }
.detail-upload-button { display: grid; width: 31px; height: 31px; flex: none; place-items: center; border-radius: 8px; color: #6c7a91; cursor: pointer; }
.detail-upload-button:hover { background: #f2f5fa; color: #315edf; }
.detail-file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.detail-upload-button:focus-within { outline: 2px solid #769bf4; outline-offset: 2px; }
.detail-upload-list { display: flex; min-width: 0; flex-wrap: wrap; gap: 5px; }
.detail-upload-item { display: inline-flex; max-width: min(240px, 60vw); min-height: 30px; align-items: center; gap: 6px; border: 1px solid #dce5fa; border-radius: 7px; padding: 3px 5px; background: #f5f7ff; color: #405578; font-size: 11px; }
.detail-upload-item > img { width: 38px; height: 28px; flex: none; border-radius: 4px; background: #e5eaf2; object-fit: cover; }
.detail-upload-item > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-upload-item > button { width: 20px; height: 20px; flex: none; border-radius: 50%; color: #71809a; font-size: 15px; line-height: 1; }
.detail-upload-item > button:hover { background: #e5eaff; color: #315edf; }
.detail-compose-hint { overflow: hidden; margin-left: auto; color: #9aa5b5; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.detail-send-button { display: grid; width: 34px; height: 31px; flex: none; place-items: center; border-radius: 7px; background: #226b55; color: #fff; }
.detail-send-button:disabled { background: #a6b8e8; }
.detail-closed-note { flex: none; padding: 8px 16px; background: #f7f8fb; color: var(--muted, #6c7890); font-size: 11px; text-align: center; }
.detail-composer.is-closed { opacity: .72; }

@media (max-width: 760px) {
  .detail-chat-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 0; height: 100%; }
  .detail-case-resizer { display:none; }
  .detail-case-nav { max-height: 120px; border-right:0; border-bottom:1px solid var(--line); }
  .detail-case-nav > header { min-height: 40px; padding: 4px 9px; }
  .detail-case-nav > header small { display: none; }
  .detail-case-nav h2 { margin: 0; font-size: 12px; }
  .detail-new-discussion { width: 29px; height: 29px; }
  .detail-case-list { display: flex; flex: none; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 7px; }
  .detail-case-row { min-width: 190px; max-width: 235px; flex: none; border: 1px solid #e5eaf2; }
  .detail-room-header { min-height: 68px; gap: 8px; padding: 10px 12px; }
  .detail-room-title h1 { font-size: 15px; }
  .detail-room-subtitle { max-width: 55vw; }
  .detail-status-button { min-height: 32px; gap: 4px; padding: 3px 6px; font-size: 10px; }
  .detail-people-button { min-height: 32px; padding: 3px 7px; }
  .detail-message-list { gap: 13px; padding: 14px 9px 18px; }
  .detail-message { max-width: 96%; gap: 5px; }
  .detail-message-avatar { padding-top: 20px; }
  .detail-message-avatar .detail-avatar { width: 26px; min-width: 26px; height: 26px; }
  .detail-message-content { padding: 10px 11px; font-size: 16px; }
  .detail-media-open { width: min(220px, 62vw); }
  .detail-media-viewer { width: 100vw; max-width: 100vw; max-height: 100dvh; border-radius: 0; }
  .detail-media-viewer-frame { max-height: 100dvh; }
  .detail-media-viewer-stage img,
  .detail-media-viewer-stage video { max-height: calc(100dvh - 64px); }
  .detail-composer { padding: 8px 9px max(9px, env(safe-area-inset-bottom)); }
  .detail-compose-box { padding: 7px 7px 5px 10px; }
  .detail-compose-box > textarea { height: 108px; }
  .detail-compose-hint { max-width: 170px; }
  .detail-reply-form textarea { min-width: 100px; }
}

@media (max-width: 520px) {
  .case-lifecycle-dialog-card { padding: 18px; }
  .case-lifecycle-review-actions > button { flex: 1; }
  .case-lifecycle-system .detail-message-author { gap: 5px; }
  .case-lifecycle-system .detail-track-actions { margin-left: 0; }
}
