html { scrollbar-gutter: stable; }
.case-layout.has-sidebar {
  grid-template-columns: minmax(0, 1fr) 16px var(--chat-width, clamp(360px, 29vw, 420px));
  column-gap: 0;
}
.chat-splitter {
  position: sticky;
  top: 92px;
  height: calc(100dvh - 116px);
  min-height: 200px;
  cursor: col-resize;
  touch-action: none;
  display: grid;
  place-items: center;
  outline-offset: -2px;
}
.chat-splitter::before {
  content: '';
  width: 4px;
  height: 48px;
  border-radius: 4px;
  background: var(--border);
  transition: background-color 120ms ease;
}
.chat-splitter:hover::before,
.chat-splitter:focus-visible::before,
.chat-resizing .chat-splitter::before { background: var(--accent); }
.chat-resizing, .chat-resizing * { cursor: col-resize !important; user-select: none !important; }
.chat-focus-ready .case-main { opacity: 0.3; }
.chat-focus-ready .chronicle-chat { outline: 2px solid var(--accent); outline-offset: -2px; }
.chronicle-chat-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-focus-toggle {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-main);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.chat-focus-toggle:hover { background: var(--accent-soft); }
.chat-focus-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chat-focus-toggle::before {
  content: '';
  width: 18px;
  height: 18px;
  background: currentColor;
  mask: url('assets/chat-expand.svg') center / contain no-repeat;
  -webkit-mask: url('assets/chat-expand.svg') center / contain no-repeat;
}
.chat-focus-toggle[aria-pressed='true']::before {
  mask-image: url('assets/chat-restore.svg');
  -webkit-mask-image: url('assets/chat-restore.svg');
}
.chat-focused .case-main,
.chat-focused .case-mode-row,
.chat-focused .chat-splitter { visibility: hidden; }
.chat-focus-dialog {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  border: 0;
  background: var(--card);
  color: var(--text-main);
  overflow: hidden;
  contain: layout paint;
}
.chat-focus-dialog::backdrop {
  background: var(--bg);
  opacity: 0;
  transition: opacity 400ms cubic-bezier(0.22, 0.8, 0.24, 1);
}
.chat-focus-dialog.is-expanded::backdrop { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .chat-focus-dialog::backdrop { transition: none; }
}
.chat-focus-dialog .case-sidebar { position: static; height: 100%; min-height: 0; }
.chat-focus-dialog .chronicle-chat {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.chat-focus-dialog .chronicle-chat-head { padding: 12px max(20px, calc((100% - 880px) / 2)); }
.chat-focus-dialog .chronicle-chat-body { padding: 24px max(20px, calc((100% - 880px) / 2)); overscroll-behavior: contain; }
.chat-focus-dialog .chronicle-chat-compose {
  padding: 12px max(20px, calc((100% - 880px) / 2)) max(12px, env(safe-area-inset-bottom));
}
.chat-focus-dialog textarea { max-height: 22dvh; min-height: 64px; }
.chat-focus-dialog .chronicle-chat-bubble { overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 1100px) {
  .case-layout.has-sidebar { grid-template-columns: minmax(0, 1fr); }
  .chat-splitter { display: none; }
}
@media (max-height: 650px) {
  .chat-focus-dialog .chronicle-chat-head > span:not(#chronicleQaQuota) { display: none; }
  .chat-focus-dialog .chronicle-chat-head { gap: 4px; }
  .chat-focus-dialog .chronicle-chat-head strong { font-size: 18px; }
}
