:root {
  color-scheme: light;
  --ink: #211b2a;
  --muted: #716878;
  --faint: #847a8b;
  --plum: #6546a5;
  --plum-dark: #57358e;
  --violet: #7150b3;
  --line: #ece7ef;
  --paper: #fff;
  --wash: #faf8fb;
  --lilac: #f1eafb;
  --rail: #231b2c;
  --rail-fg: #bdb0cc;
  --good: #38816a;
  --danger: #a63551;
  --radius: 15px;
  --shadow: 0 12px 40px #34204813;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 14px;
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--wash); color: var(--ink); min-width: 320px; }
button, textarea, input, select { font: inherit; }
button { color: inherit; }
button:not(:disabled) { cursor: pointer; }
button:disabled { opacity: .48; cursor: not-allowed; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #9a76d8; outline-offset: 3px; }
button { border: 0; background: none; padding: 0; }
a { color: var(--plum-dark); text-underline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }
::selection { background: #e5d7fa; color: #452d70; }
::placeholder { color: var(--faint); opacity: 1; }
* { scrollbar-width: thin; scrollbar-color: #ddd4e5 transparent; }

.shell {
  --rail-width: 76px;
  --sidebar-width: clamp(262px, 21vw, 324px);
  --details-width: clamp(264px, 20vw, 316px);
  --chat-width: 940px;
  --chat-padding: clamp(18px, 2.1vw, 34px);
  height: 100vh;
  height: var(--app-viewport-height, 100dvh);
  display: grid;
  grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr) var(--details-width);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: var(--paper);
}
.rail {
  position: relative;
  z-index: 5;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
  padding: 23px 0 17px;
  background: linear-gradient(170deg, #2c2037 0%, var(--rail) 58%, #21192a 100%);
  color: var(--rail-fg);
}
.rail-brand {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: 14px;
  background: #e4d4fc;
  color: #4b2f6e;
  box-shadow: 0 5px 17px #1109184f, inset 0 1px 0 #fff8;
}
.rail-brand svg { width: 26px; height: 26px; }
.rail-nav, .rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rail-bottom { margin-top: auto; gap: 13px; }
.rail-btn {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  position: relative;
  transition: background .16s, color .16s, transform .16s;
}
.rail-btn:hover { background: #ffffff11; color: white; }
.rail-btn.is-active, .rail-btn.active, .rail-btn[aria-current="page"], .rail-btn[aria-pressed="true"] {
  background: #49365e;
  color: #e7d7fc;
}
.rail-btn.is-active::before, .rail-btn.active::before, .rail-btn[aria-current="page"]::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 3px;
  left: -15px;
  border-radius: 0 5px 5px 0;
  background: #ccaafa;
}
.rail-btn svg { width: 21px; height: 21px; }
.rail-profile {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f0d6c5;
  color: #744a34;
  font-weight: 700;
  border: 2px solid #554460;
}
.rail .avatar { border-radius: 50%; }
.rail-label { display: none; }

.sidebar {
  grid-column: 2;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fcfafc;
  border-right: 1px solid var(--line);
  padding: 0 16px 13px;
}
.sidebar-header { padding: 22px 5px 12px; }
.sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
}
.sidebar-title h1, .sidebar-title h2 { font-size: 27px; line-height: 1.15; letter-spacing: -.8px; font-weight: 750; }
.sidebar-title > span { color: var(--faint); font-size: 12px; }
.compose-button, .new-chat, .create-chat, .sidebar-title > button {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--plum-dark);
  background: #ede3fa;
  flex-shrink: 0;
}
.sidebar-title > button:hover, .compose-button:hover { background: #e6d7f9; }
.tabs {
  display: flex;
  gap: 4px;
  margin-top: 18px;
  padding: 3px;
  background: #f1edf4;
  border-radius: 10px;
}
.tabs button {
  flex: 1;
  padding: 7px 6px;
  white-space: nowrap;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.tabs button:hover { color: var(--plum-dark); }
.tabs button.active, .tabs button.is-active, .tabs button[aria-selected="true"], .tabs button[aria-pressed="true"] {
  background: #fff;
  color: var(--plum);
  box-shadow: 0 1px 4px #36264316;
}
.sidebar-search, .search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8e7f99;
  border: 1px solid #eee8f1;
  border-radius: 10px;
  background: #fff;
  min-width: 0;
  margin: 3px 5px 12px;
  padding: 0 10px;
  height: 39px;
}
.sidebar-search input, .search-field input {
  min-width: 0;
  width: 100%;
  padding: 7px 0;
  border: 0;
  background: transparent;
  outline: 0;
  color: var(--ink);
  font-size: 13px;
}
.sidebar-search:focus-within, .search-field:focus-within { border-color: #ad8bd7; }
.sidebar-search input:focus-visible, .search-field input:focus-visible { outline: none; }
.conversation-list { overflow-y: auto; min-height: 0; padding: 0 0 5px; flex: 1; }
.conversation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 9px;
  min-height: 67px;
  text-align: left;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 12px;
  margin-bottom: 3px;
}
.conversation-item:hover { background: #f5f0f8; }
.conversation-item.active, .conversation-item.is-active, .conversation-item[aria-current="true"], .conversation-item[aria-selected="true"] { background: #f0e8fa; border-color: #e8dcf6; }
.conversation-avatar, .message-avatar, .avatar, .room-avatar, .agent-icon, .member-avatar {
  --avatar-bg: #ede4f9;
  --avatar-fg: #6e4dae;
  display: inline-grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--avatar-bg);
  color: var(--avatar-fg);
  font-weight: 750;
  line-height: 1;
  vertical-align: middle;
  width: 41px;
  height: 41px;
  border-radius: 12px;
}
.conversation-avatar { width: 43px; height: 43px; border-radius: 13px; }
.avatar img, .conversation-avatar img, .message-avatar img, .room-avatar img { width: 100%; height: 100%; object-fit: cover; }
[data-color="peach"], .peach, .color-peach, .avatar-peach { --avatar-bg: #f7e0d3; --avatar-fg: #a35b43; }
[data-color="pink"], .pink, .color-pink, .avatar-pink, [data-color="rose"] { --avatar-bg: #f7dfea; --avatar-fg: #9a4e75; }
[data-color="mint"], .mint, .color-mint, .avatar-mint, [data-color="green"] { --avatar-bg: #daeee4; --avatar-fg: #3f806d; }
[data-color="blue"], .blue, .color-blue, .avatar-blue { --avatar-bg: #dfe8fb; --avatar-fg: #4e68a5; }
[data-color="yellow"], .yellow, .color-yellow, .avatar-yellow, [data-color="amber"] { --avatar-bg: #f8edcb; --avatar-fg: #917126; }
[data-color="violet"], .violet, .color-violet, .avatar-violet, [data-color="purple"], [data-color="lavender"] { --avatar-bg: #ede2fb; --avatar-fg: #7550b3; }
.conversation-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.conversation-meta strong, .conversation-name, .conversation-item h3 { font-size: 14px; font-weight: 690; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-meta p, .conversation-preview, .conversation-snippet, .conversation-last {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.conversation-side, .conversation-tail { flex-shrink: 0; align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 4px; }
.conversation-item time, .conversation-time { color: var(--faint); font-size: 11px; white-space: nowrap; flex-shrink: 0; }
.unread-badge { display: inline-grid; min-width: 18px; height: 18px; align-items: center; padding: 0 5px; text-align: center; border-radius: 20px; background: #7653b7; color: white; font-size: 10px; font-weight: 700; line-height: 1; }
.sidebar-footer, .sidebar-bottom { margin-top: auto; padding: 10px 5px 0; color: var(--muted); font-size: 12px; }

.workspace {
  grid-column: 3;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  position: relative;
}
.chat-header {
  flex-shrink: 0;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px var(--chat-padding);
  background: #fff;
}
.chat-identity { display: flex; align-items: center; min-width: 0; gap: 12px; }
.chat-identity h1, .chat-identity h2 { font-size: 17px; font-weight: 750; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-identity p, .chat-subtitle { color: var(--muted); font-size: 12px; line-height: 1.55; }
.chat-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.icon-button, .icon-btn, .chat-actions > button, .details-header > button, .composer-toolbar button:not(.send-btn) {
  display: inline-grid;
  place-items: center;
  min-width: 35px;
  min-height: 35px;
  border-radius: 9px;
  color: var(--muted);
}
.icon-button:hover, .icon-btn:hover, .chat-actions > button:hover, .details-header > button:hover, .composer-toolbar button:not(.send-btn):hover { background: #f4eef8; color: var(--plum-dark); }
.icon-button svg, .icon-btn svg, .chat-actions > button svg, .details-header > button svg { width: 18px; height: 18px; }
.mobile-back, .mobile-menu, .drawer-toggle { display: none; }
.chat-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 22px var(--chat-padding) 13px; }
.date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 1px 0 0;
  line-height: 1;
  color: var(--faint);
  font-size: 11px;
  white-space: nowrap;
}
.date-divider::before, .date-divider::after { content: ""; height: 1px; max-width: 125px; flex: 1; background: #efeaf3; }
.message-list { display: flex; flex-direction: column; gap: 17px; max-width: var(--chat-width); margin-inline: auto; }
.message {
  display: flex;
  min-width: 0;
  gap: 10px;
  align-items: flex-start;
  position: relative;
  scroll-margin: 12px;
}
.message-avatar { width: 32px; height: 32px; border-radius: 9px; font-size: 13px; }
.message-avatar svg { width: 17px; height: 17px; }
.message-body { min-width: 0; max-width: min(94%, 680px); }
.message-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-height: 18px; margin: 0 0 4px; }
.message-meta strong, .message-author { font-size: 13px; font-weight: 720; }
.message-author { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.message-meta time { font-size: 11px; color: var(--faint); }
.message-text, .message-content {
  color: #3d3445;
  background: #f7f4f8;
  border-radius: 3px 11px 11px 11px;
  padding: 8px 11px;
  line-height: 1.57;
  font-size: 14px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  width: fit-content;
  max-width: 100%;
}
.message-text a, .message-content a { overflow-wrap: anywhere; }
.agent-message .message-text, .agent-message .message-content, .message.is-agent .message-text, .message.is-agent .message-content {
  background: #f4eefb;
  border: 1px solid #ece1f7;
  border-left: 2px solid #b699db;
  color: #473459;
}
.agent-chip, .badge, .status-pill, .chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
  padding: 2px 6px;
  background: #eee4f9;
  color: #6d4a9f;
  font-size: 10px;
  white-space: nowrap;
  font-weight: 650;
  line-height: 1.45;
}
.message.own-message .message-text { background: #efe7f8; }
.message-tools, .message-actions { display: flex; gap: 4px; align-items: center; opacity: 0; transition: opacity .12s; }
.message:hover .message-tools, .message:focus-within .message-tools, .message:hover .message-actions, .message:focus-within .message-actions { opacity: 1; }
.message-tools button, .message-actions button { color: var(--muted); padding: 3px; border-radius: 4px; }
.message-tools button:hover, .message-actions button:hover { background: #eee7f4; }
.message-reply, .reply-preview { background: #f2edf6; color: var(--muted); border-left: 2px solid #b99bdc; font-size: 12px; border-radius: 4px; padding: 5px 8px; margin-bottom: 4px; overflow-wrap: anywhere; }
.mention-text, .inline-mention { color: #63449c; font-weight: 700; }

.composer-area { flex-shrink: 0; padding: 9px var(--chat-padding) 12px; background: #fff; position: relative; }
.composer {
  position: relative;
  max-width: var(--chat-width);
  margin-inline: auto;
  padding: 9px 9px 7px 12px;
  border: 1px solid #e7ddef;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 9px #4c2c6510;
}
.composer:focus-within { border-color: #ac8bd9; box-shadow: 0 3px 11px #5f3b8e16; }
.composer textarea, .composer-input {
  display: block;
  width: 100%;
  min-height: 28px;
  height: 33px;
  max-height: 124px;
  border: 0;
  resize: none;
  padding: 2px 2px 0;
  background: transparent;
  color: var(--ink);
  line-height: 1.55;
  outline: none;
}
.composer textarea:focus-visible { outline: none; }
.composer-toolbar { display: flex; gap: 7px; align-items: center; }
.composer-toolbar button:not(.send-btn) { min-width: 29px; min-height: 30px; }
.composer-toolbar button svg { width: 17px; height: 17px; }
.composer-hint, .composer-toolbar small { color: var(--faint); font-size: 11px; }
.composer-hint { margin: 6px 0 0; text-align: center; }
.send-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 35px;
  padding: 7px 13px;
  background: #7251ae;
  border-radius: 8px;
  color: #fff;
  font-weight: 670;
  box-shadow: 0 2px 5px #6945a62e;
}
.send-btn:hover, .send-btn:focus-visible { background: var(--plum-dark); }
.send-btn:disabled { opacity: .68; }
.mention-picker, .popover, .dropdown {
  position: absolute;
  z-index: 6;
  left: 21px;
  bottom: calc(100% - 5px);
  width: min(315px, calc(100% - 42px));
  padding: 7px;
  border: 1px solid #e9def2;
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow);
}
.mention-picker button, .popover button, .dropdown button { width: 100%; text-align: left; padding: 9px 10px; border-radius: 7px; }
.mention-picker button:hover, .popover button:hover, .dropdown button:hover { background: #f0e8fa; }

.icon { width: 19px; height: 19px; }
.rail-top { display: flex; flex-direction: column; align-items: center; gap: 26px; }
.sidebar-header { padding: 24px 5px 4px; }
.sidebar-headline { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.sidebar-headline .sidebar-title { display: block; min-height: 0; font-size: 29px; letter-spacing: -.8px; line-height: 1.22; font-weight: 760; }
.workspace-label { color: #775e8c; font-weight: 730; font-size: 11px; letter-spacing: .06em; margin-bottom: 5px; white-space: nowrap; }
.workspace-label span { font-size: 9px; letter-spacing: .17em; color: #897692; padding-left: 5px; }
.sidebar-headline .compose-btn { width: 38px; height: 38px; background: #ece0fa; color: #64429a; border-radius: 11px; }
.sidebar-headline .compose-btn:hover { background: #e5d4fa; }
.sidebar-header .sidebar-search { margin: 12px 0 7px; }
.sidebar-search svg { width: 16px; height: 16px; }
kbd { font-family: inherit; display: inline-block; border: 1px solid #eee8f1; border-radius: 4px; padding: 1px 4px; color: var(--muted); background: #faf7fc; white-space: nowrap; font-size: .92em; }
.sidebar-search kbd { font-size: 10px; }
.conversation-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.conversation-copy + .conversation-meta { flex: 0 0 auto; min-width: fit-content; align-self: stretch; align-items: flex-end; justify-content: space-between; gap: 4px; }
[data-tone="violet"] { --avatar-bg: #e9dcfa; --avatar-fg: #7051a7; }
[data-tone="peach"] { --avatar-bg: #f6dfd4; --avatar-fg: #a05742; }
[data-tone="pink"] { --avatar-bg: #f6dfea; --avatar-fg: #984b74; }
[data-tone="green"], [data-tone="mint"] { --avatar-bg: #dbede5; --avatar-fg: #417b66; }
[data-tone="blue"] { --avatar-bg: #dfe8fa; --avatar-fg: #5166a0; }
[data-tone="gold"], [data-tone="yellow"] { --avatar-bg: #f6edcf; --avatar-fg: #8b6b2b; }
[data-tone="ink"] { --avatar-bg: #e8e1ed; --avatar-fg: #4b3659; }
.conversation-item .avatar { width: 43px; height: 43px; border-radius: 12px; }
.message .avatar { width: 32px; height: 32px; border-radius: 9px; font-size: 13px; }
.rail-profile .avatar { width: 36px; height: 36px; border-radius: 50%; }
.rail-profile > span { color: #71482c; }
.chat-identity .avatar { width: 42px; height: 42px; border-radius: 12px; }
.composer-tools { display: flex; align-items: center; gap: 4px; min-width: 0; }
.composer-hint { display: flex; gap: 11px; justify-content: center; }
.composer-agent-selection { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--plum); }
.composer .mention-menu { position: absolute; z-index: 4; bottom: calc(100% + 7px); left: 0; width: min(320px, 100%); max-height: min(280px, calc(.42 * var(--app-viewport-height, 100dvh))); overflow: auto; padding: 7px; border: 1px solid #e9def2; border-radius: 13px; box-shadow: var(--shadow); background: white; }
.mention-menu button { display: flex; align-items: center; gap: 8px; border-radius: 8px; text-align: left; width: 100%; min-height: 35px; padding: 6px 8px; }
.mention-menu button:hover { background: #f3ecfa; }
.mention-menu .avatar { width: 27px; height: 27px; border-radius: 7px; }
.mention-menu .icon { width: 16px; height: 16px; }
.mention-menu p { padding: 7px 8px; color: var(--muted); line-height: 1.5; font-size: 13px; }
.reply-preview { display: flex; align-items: center; gap: 8px; }
.reply-preview > button { margin-left: auto; color: var(--muted); }

.details {
  grid-column: 4;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fdfbfd;
  border-left: 1px solid var(--line);
}
.details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: 76px;
  padding: 9px 19px;
  border-bottom: 1px solid var(--line);
}
.details-header h2, .details-header h3 { font-weight: 740; font-size: 16px; }
.details-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 17px 17px 21px; }
.room-overview {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 7px;
  background: #f6f0fa;
  border: 1px solid #eee5f5;
  border-radius: 14px;
  padding: 13px;
  margin-bottom: 17px;
}
.room-overview .avatar { width: 38px; height: 38px; border-radius: 10px; background: #eadbf8; color: #7451ad; }
.room-overview strong, .room-overview h3 { font-size: 14px; font-weight: 750; }
.room-overview p { color: #72647e; font-size: 12px; line-height: 1.5; }
.detail-section + .detail-section { border-top: 1px solid var(--line); margin-top: 17px; padding-top: 14px; }
.detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.detail-heading h3, .detail-heading h4 { font-size: 14px; font-weight: 735; }
.detail-heading span { color: var(--faint); font-size: 12px; }
.detail-heading button { color: var(--plum); border-radius: 7px; min-width: 29px; min-height: 27px; display: inline-grid; place-items: center; }
.detail-heading button:hover { background: var(--lilac); }
.detail-heading .icon { width: 16px; height: 16px; }
.agent-card {
  background: white;
  border: 1px solid #eee8f1;
  border-radius: 11px;
  margin: 0 0 7px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.agent-card > .avatar, .agent-icon { width: 34px; height: 34px; border-radius: 9px; }
.agent-card > .avatar .icon, .agent-icon .icon { width: 17px; height: 17px; }
.agent-card-info, .member-info { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.agent-card-info strong, .member-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 720; }
.agent-card-info small, .member-info span, .member-info small { color: var(--muted); font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.agent-mode { flex-shrink: 0; max-width: 85px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: #a49ba9; flex-shrink: 0; vertical-align: 1px; margin-right: 3px; }
.status-dot.online, .status-dot.active, .status-dot[data-online="true"], .status-dot.is-online { background: #4d977c; }
.agent-card select, select.agent-mode { border: 1px solid #eae1ef; border-radius: 6px; background: #f8f3fb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%23716080' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 4px center; appearance: none; color: #654b7d; font-size: 10px; padding: 4px 16px 4px 5px; }
.member-row { display: flex; align-items: center; gap: 8px; padding: 6px 1px; min-width: 0; }
.member-row .avatar { width: 30px; height: 30px; border-radius: 50%; font-size: 11px; }
.member-row .badge, .member-role { color: var(--muted); font-size: 10px; }
.bind-button { color: var(--plum); background: #f6effa; border: 1px dashed #dcc9eb; display: flex; gap: 7px; align-items: center; justify-content: center; width: 100%; padding: 8px 7px; border-radius: 9px; font-size: 12px; font-weight: 650; min-height: 34px; }
.bind-button .icon { width: 15px; height: 15px; }
.bind-button:hover { background: #eee4f9; border-color: #c5a9df; }

.section-view { overflow: auto; flex: 1; min-height: 0; background: #fff; }
.section-header { padding: clamp(22px, 4vw, 44px) clamp(19px, 4vw, 52px) 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 15px; flex-wrap: wrap; }
.section-header h1, .section-header h2 { color: var(--ink); font-size: 27px; letter-spacing: -.5px; }
.section-header p { margin-top: 7px; color: var(--muted); line-height: 1.7; }
.section-content { max-width: 940px; padding: 22px clamp(19px, 4vw, 52px) 35px; margin: 0 auto; }
.section-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.section-card h2, .section-card h3 { font-size: 16px; font-weight: 740; margin-bottom: 5px; }
.section-card p { color: var(--muted); line-height: 1.65; }
.section-card .badge { margin-inline-start: 5px; }
.section-card form { max-width: 420px; }
.section-card .agent-card { margin: 0; }
.section-grid, .provider-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 11px; }
.text-button, .text-btn { color: var(--plum-dark); font-weight: 670; }
.text-button:hover, .text-btn:hover { text-decoration: underline; }
.primary-button, .primary-btn, .button-primary, .secondary-button, .secondary-btn, .button-secondary, .danger-button, .danger-btn, .button {
  display: inline-flex;
  text-decoration: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  min-height: 36px;
  border-radius: 9px;
  font-weight: 650;
  line-height: 1.3;
}
.primary-button, .primary-btn, .button-primary, .button.primary { background: #7251ae; color: #fff; }
.primary-button:hover, .primary-btn:hover, .button-primary:hover, .button.primary:hover { background: #5d3b94; }
.secondary-button, .secondary-btn, .button-secondary, .button.secondary { background: #f3edf8; color: var(--plum-dark); }
.secondary-button:hover, .secondary-btn:hover, .button-secondary:hover, .button.secondary:hover { background: #eae0f4; }
.danger-button, .danger-btn { background: #fbeaf0; color: var(--danger); }
.danger-button:hover, .danger-btn:hover { background: #f8dfe9; }
.room-budget-button { width: 100%; justify-content: flex-start; min-height: 42px; margin-bottom: 14px; text-align: start; }
.room-budget-button .icon { width: 16px; height: 16px; }
.form-stack > .room-budget-button { margin-top: 12px; margin-bottom: 0; }
.budget-usage {
  border: 1px solid #ebdff3;
  border-radius: 12px;
  background: #f8f2fb;
  color: #59416f;
  padding: 12px 14px;
  margin-bottom: 13px;
}
.budget-usage-line { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.budget-usage-count { display: flex; flex-direction: column; gap: 3px; }
.budget-usage-count span, .budget-reset { color: var(--muted); font-size: 12px; }
.budget-usage-count strong { font-size: 21px; font-variant-numeric: tabular-nums; }
.budget-remaining { background: #eee2f7; border-radius: 6px; padding: 4px 8px; font-size: 12px; font-weight: 670; }
.budget-reset { margin-top: 5px; }
.budget-fields { margin: 0; padding: 0; border: 0; min-width: 0; }
.budget-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 0 12px; }
.budget-note { color: var(--muted); font-size: 12px; line-height: 1.65; }
.budget-actions { margin-top: 11px; }
.budget-load-error { margin-bottom: 10px; }
.budget-load-error .text-button { min-height: 30px; }
.budget-editor .form-error { color: var(--danger); }
.section-view .icon, .dialog .icon { width: 17px; height: 17px; }
.dialog {
  border: 1px solid #e7dded;
  border-radius: 19px;
  box-shadow: 0 20px 80px #1f142845;
  width: min(524px, calc(100% - 28px));
  max-width: unset;
  max-height: min(calc(var(--app-viewport-height, 100dvh) - 28px), 750px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0;
  background: #fff;
  color: var(--ink);
}
.dialog::backdrop { background: #271c355e; backdrop-filter: blur(2px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding: 14px 18px; }
.dialog-header h2 { font-size: 17px; font-weight: 740; }
.dialog-body { padding: 16px 18px; }
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 10px 18px 15px; border-top: 1px solid var(--line); }
.dialog form .dialog-footer { margin-top: 14px; }
.dialog p { line-height: 1.65; color: var(--muted); }
.dialog .tabs { margin: 0 0 12px; }
.dialog .search-field { margin: 0 0 10px; }
.field, .form-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; font-weight: 630; color: #42364b; }
.field :is(input:not([type="checkbox"]), textarea, select), .form-field :is(input:not([type="checkbox"]), textarea, select),
.dialog :is(input:not([type="checkbox"]):not([type="radio"]), textarea, select), .section-view :is(input:not([type="checkbox"]), textarea, select) {
  width: 100%;
  border: 1px solid #e6ddec;
  background: #fdfbfd;
  color: var(--ink);
  font-weight: 400;
  border-radius: 9px;
  padding: 8px 10px;
  min-height: 36px;
}
.dialog .search-field input { border: 0; background: none; padding: 0; }
.dialog code, .section-view code, .code-block {
  font: 12px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #fff0ff;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.dialog pre, .section-view pre, pre.code-block {
  overflow: auto;
  background: #2d2238;
  border-radius: 10px;
  padding: 12px;
  max-height: 220px;
}
.field-note, .form-note, .muted-text, .subtle, .helper-text { color: var(--muted); font-size: 12px; line-height: 1.6; }
.form-error, .error-message, .inline-error { color: var(--danger); font-size: 13px; }
.empty-state {
  display: grid;
  justify-items: center;
  align-content: center;
  text-align: center;
  gap: 8px;
  min-height: 150px;
  padding: 16px;
  color: var(--muted);
}
.empty-state > .icon, .empty-icon { width: 36px; height: 36px; border-radius: 11px; padding: 8px; color: var(--plum); background: var(--lilac); }
.empty-state strong, .empty-state h2, .empty-state h3 { color: #4b4054; font-size: 15px; }
.empty-state p { line-height: 1.6; }
.chat-scroll > .empty-state, .message-list > .empty-state { min-height: min(42vh, 340px); }
.sidebar .empty-state { min-height: 130px; }
.toast {
  z-index: 11;
  position: fixed;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 30px);
  border-radius: 10px;
  padding: 9px 14px;
  background: #352841;
  box-shadow: var(--shadow);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
}
.toast.error, .toast[data-variant="error"] { background: #77324c; }
.drawer-backdrop { display: none; }
.conversation-label { display: flex; justify-content: space-between; gap: 9px; color: #796d82; padding: 9px 8px 8px; font-size: 11px; font-weight: 650; }
.muted-icon { width: 13px; height: 13px; color: var(--faint); }
.sidebar-account { display: flex; align-items: center; gap: 7px; }
.sidebar-account .icon { width: 15px; height: 15px; }
.sidebar-account button { margin-left: auto; }
.chat-identity > div { min-width: 0; }
.chat-actions .active { color: var(--plum); background: #f1e9fa; }
.room-overview { display: flex; flex-direction: row; align-items: center; gap: 9px; }
.room-overview p { margin-top: 4px; }
.detail-heading > div { display: flex; align-items: center; gap: 6px; }
.detail-heading h3 > span { display: inline-block; margin-left: 3px; font-weight: 500; }
.detail-heading-icon { color: #865db0 !important; }
.detail-empty { color: var(--muted); font-size: 12px; line-height: 1.55; margin-bottom: 9px; }
.agent-status, .member-self { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.agent-mode { position: relative; }
.agent-mode .icon { display: none; }
.mode-label { color: #6b5083; border-radius: 5px; padding: 3px 4px; background: #f5eef8; font-size: 10px; }
.bind-button .icon:last-child { margin-left: auto; }
.bind-button { justify-content: flex-start; padding-inline: 8px; }
.member-self { padding: 2px 6px; border-radius: 5px; background: #f0e8f6; }
.agent-chip .icon { width: 11px; height: 11px; }
.self-chip { border-radius: 4px; background: #f7eff7; padding: 1px 5px; color: #755984; font-size: 10px; }
.message-quote {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  text-align: left;
  color: #705885;
  background: #f3edf8;
  border-left: 2px solid #c4aedc;
  border-radius: 5px;
  padding: 5px 7px;
  margin: 0 0 4px;
  font-size: 11px;
  line-height: 1.4;
}
.message-quote .icon { width: 14px; height: 14px; }
.message-quote span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-quote strong { white-space: nowrap; }
.message-actions { flex-shrink: 0; gap: 2px; }
.message-actions .icon-btn { min-width: 27px; min-height: 27px; }
.message-actions .icon { width: 13px; height: 13px; }
.message.highlighted .message-text, .message.is-highlighted .message-text { outline: 2px solid #bfa4df; }
.reply-preview > div { display: flex; gap: 6px; min-width: 0; align-items: center; }
.reply-preview > div span { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.reply-preview strong { white-space: nowrap; }
.reply-preview .icon-btn { min-width: 24px; min-height: 24px; }
.reply-preview .icon { width: 14px; height: 14px; }
.menu-title { padding: 5px 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.mention-menu .agent-status { margin-left: auto; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); }
.emoji-grid .emoji-option { text-align: center; justify-content: center; }
.composer-toolbar .selected-agent { display: inline-flex !important; align-items: center; gap: 3px; min-height: 22px !important; padding: 2px 5px; background: #f2e8fa; border-radius: 5px !important; color: var(--plum) !important; }
.composer-toolbar .selected-agent .icon { width: 11px; height: 11px; }
.toast:not([hidden]) { display: flex; align-items: center; gap: 6px; }
.toast .icon, .empty-icon .icon { width: 16px; height: 16px; }
.empty-icon { display: grid; place-items: center; }
.loading-text { color: var(--muted); text-align: center; padding: 18px; }

.section-icon, .dialog-icon {
  display: inline-grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  background: #eee5fa;
  color: var(--plum);
  margin-bottom: 8px;
}
.section-header > div { min-width: 0; }
.section-card-header { margin-bottom: 12px; }
.section-card .agent-card { padding: 10px; }
.agent-management-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.agent-management-row .agent-card { flex: 1; }
.provider-label { font-size: 12px; color: var(--muted); }
.contact-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.contact-row button { margin-left: auto; }
.contact-search { margin-left: 0; margin-right: 0; }
.contact-search input, .dialog .sidebar-search input[type="search"] { border: 0; background: transparent; padding: 0; min-height: 0; }
.profile-identity { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.profile-identity p { color: var(--muted); font-size: 12px; }
.profile-avatar { width: 46px; height: 46px; border-radius: 50%; }
.form-stack input[type="checkbox"], .form-stack input[type="radio"] { accent-color: var(--plum); }
.auth-switch { display: flex; align-items: center; gap: 5px; padding-top: 10px; font-size: 12px; }
.form-submit { width: 100%; margin-top: 4px; }
.form-toggle { display: flex; align-items: center; justify-content: space-between; gap: 7px; font-weight: 650; }
.form-toggle .icon { color: var(--plum); }
.dialog .picker-search { margin: 0; }
.member-picker { max-height: 195px; overflow: auto; }
.picker-person { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 5px 7px; border-radius: 8px; font-weight: 600; }
.picker-person:hover { background: #f8f2fb; cursor: pointer; }
.picker-person .avatar { width: 26px; height: 26px; border-radius: 7px; }
.picker-person input { margin-left: auto; }
.dialog-search { margin-inline: 0; }
.search-results { max-height: 290px; overflow: auto; }
.search-result { display: grid; gap: 4px; width: 100%; border-bottom: 1px solid var(--line); padding: 8px 5px; text-align: left; }
.search-result:hover { background: #f6f0fa; }
.search-result span { font-size: 11px; color: var(--muted); }
.search-result p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.form-field small { color: var(--muted); font-weight: 500; }
.form-toggle input { flex-shrink: 0; width: 17px; height: 17px; }
.auto-join { background: #f5effa; border: 1px solid #eee4f4; border-radius: 9px; padding: 8px 9px; margin-top: 9px; }
.dialog .field-help { font-size: 12px; margin: 7px 0 11px; }
.pairing-status { display: flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 8px; background: #f3edf9; color: #664791; font-size: 13px; margin-bottom: 11px; }
.command-block { padding-top: 5px; }
.command-block > div { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.command-block .text-button { font-size: 12px; }
.command-block pre {
  color: #f2e9fa;
  font: 12px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 8px 0 11px;
}
.command-details { color: var(--plum); font-size: 13px; margin: 8px 0 13px; }
.command-details > summary { cursor: pointer; padding: 4px 0; }
.agent-picker-row { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; padding: 7px; border: 1px solid var(--line); border-radius: 9px; }
.agent-picker-row > div { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.agent-picker-row .member-avatar { width: 34px; height: 34px; border-radius: 9px; }
.history-navigation { align-self: center; }
.history-navigation button { color: var(--plum-dark); font-size: 12px; padding: 6px 8px; border-radius: 6px; }
.history-navigation button:hover { background: #f3ebfa; }
.clipboard-input { position: fixed; opacity: 0; pointer-events: none; top: 0; left: 0; }

.auth-screen {
  display: grid;
  grid-template-columns: minmax(0, .97fr) minmax(0, 1fr);
  min-height: var(--app-viewport-height, 100svh);
  padding: 22px;
  background: #fdfbfd;
}
.auth-art {
  isolation: isolate;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: calc(100svh - 44px);
  padding: clamp(24px, 4.7vw, 75px);
  border: 1px solid #eae0f6;
  border-radius: 24px;
  background: #eee8fc;
}
.auth-art::before {
  position: absolute;
  z-index: -1;
  inset: 43% 0 0;
  content: "";
  background: url("/orbit.jpg") right center / auto 100% no-repeat;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 22%);
  mask-image: linear-gradient(180deg, transparent, #000 22%);
}
.auth-brand, .auth-brand-mobile {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  width: fit-content;
  color: #4b326c;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: .02em;
}
.auth-brand .icon, .auth-brand-mobile .icon {
  width: 42px;
  height: 42px;
  padding: 9px;
  border-radius: 13px;
  background: #e4d4fc;
  box-shadow: inset 0 1px 0 #fffc, 0 3px 11px #54367812;
}
.auth-brand-mobile { display: none; }
.auth-art-copy {
  width: min(100%, 500px);
  margin: clamp(60px, 11vh, 120px) 0 clamp(174px, 35vh, 330px);
}
.auth-art-copy h1 {
  max-width: 9em;
  color: #3e285c;
  font-size: clamp(35px, 4.3vw, 68px);
  line-height: 1.12;
  font-weight: 740;
  letter-spacing: -.04em;
  text-wrap: balance;
}
.auth-art-copy p {
  max-width: 26em;
  margin-top: 16px;
  color: #665277;
  font-size: clamp(14px, 1.3vw, 17px);
  line-height: 1.75;
}
.auth-panel {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: clamp(28px, 6.4vw, 100px);
}
.auth-card { width: min(100%, 380px); min-width: 0; }
.auth-card-header { margin-bottom: 25px; }
.auth-card-header h2, .auth-card-header h1 {
  color: var(--ink);
  font-size: clamp(27px, 2.5vw, 36px);
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -.035em;
}
.auth-card-header p { margin-top: 8px; font-size: 14px; line-height: 1.6; color: var(--muted); }
.auth-form .form-field { gap: 7px; margin-bottom: 15px; line-height: 1.5; }
.auth-form .form-field input {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid #e6ddec;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
}
.auth-form .form-field input:focus-visible { outline: 2px solid #b293d9; outline-offset: 1px; }
.auth-form .form-submit {
  width: 100%;
  min-height: 45px;
  margin-top: 5px;
  font-size: 15px;
  border-radius: 11px;
  box-shadow: 0 4px 10px #6945a626;
}
.auth-form .form-error { margin: 5px 0 9px; line-height: 1.5; }
.auth-card .auth-switch {
  justify-content: center;
  padding-top: 17px;
  color: var(--muted);
  font-size: 14px;
}
.auth-card .auth-switch button { min-height: 30px; }

.shell[data-details="closed"], .shell:not([data-view="chat"]) {
  grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr);
}
.shell[data-view="chat"]:has(> .details[hidden]) {
  grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr);
}
.shell[data-details="closed"] .details, .shell:not([data-view="chat"]) .details { display: none; }
.room-overview > div { min-width: 0; overflow-wrap: anywhere; }
.sidebar-account span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account button { flex-shrink: 0; }
.section-content { width: 100%; }
.contact-row > strong, .agent-management-row .provider-label { min-width: 0; overflow-wrap: anywhere; }

@media (width < 1200px) {
  .shell {
    --rail-width: 64px;
    --sidebar-width: clamp(212px, 25vw, 282px);
    --chat-padding: clamp(16px, 2.15vw, 26px);
    grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr);
  }
  .shell:not([data-view="chat"]) { grid-template-columns: var(--rail-width) minmax(0, 1fr); }
  .shell:not([data-view="chat"]) .sidebar { display: none; }
  .shell:not([data-view="chat"]) .workspace { grid-column: 2; }
  .rail { padding-top: 19px; }
  .rail-btn:is(.active, [aria-current="page"])::before { left: -9px; }
  .sidebar { padding-inline: 11px; }
  .chat-header, .details-header { min-height: 68px; }
  .shell .details {
    display: none;
    position: fixed;
    z-index: 9;
    inset: 0 0 auto auto;
    width: min(352px, calc(100% - 32px));
    height: var(--app-viewport-height, 100dvh);
    box-shadow: -8px 0 36px #26183426;
  }
  .shell[data-view="chat"][data-details="open"] .details { display: flex; }
  .shell[data-view="chat"][data-details="open"] .drawer-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    z-index: 8;
    inset: 0;
    background: #221b2a5e;
  }
  .details-body { padding-inline: 17px; }
  .auth-screen { padding: 15px; }
  .auth-art { min-height: calc(100svh - 30px); padding: clamp(25px, 4vw, 48px); }
  .auth-art-copy h1 { font-size: clamp(31px, 4.2vw, 50px); }
  .auth-panel { padding: clamp(20px, 4vw, 48px); }
}

@media (hover: none), (pointer: coarse) {
  .message-actions { opacity: 1; }
  .chat-actions > button, .details-header > button, .detail-heading > button { min-width: 44px; min-height: 44px; }
  .primary-button, .secondary-button, .danger-button, .bind-button { min-height: 44px; }
  .agent-card select { min-height: 38px; }
  .sidebar-search kbd, .composer-hint { display: none; }
  .auth-form .form-field input, .composer textarea,
  .sidebar-search input, .dialog :is(input, textarea, select), .section-view :is(input, textarea, select) { font-size: 16px; }
}

@media (max-width: 739px) {
  .shell,
  .shell[data-details="closed"],
  .shell:not([data-view="chat"]),
  .shell[data-view="chat"]:has(> .details[hidden]) {
    --chat-padding: max(12px, env(safe-area-inset-left), env(safe-area-inset-right));
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .rail {
    grid-column: 1;
    grid-row: 2;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    gap: 0;
    padding: 5px max(8px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid #e9e0ef;
    background: #fff;
    color: #716179;
    box-shadow: 0 -4px 16px #291c3508;
  }
  .rail-top { flex: 3; min-width: 0; }
  .rail-nav, .rail-bottom { flex-direction: row; align-items: stretch; gap: 0; }
  .rail-nav { width: 100%; }
  .rail-bottom { flex: 1; min-width: 0; margin: 0; }
  .rail-brand, .rail .rail-bottom > .rail-btn { display: none; }
  .rail .rail-btn, .rail-profile {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 52px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #716179;
  }
  .rail .rail-btn:is(:hover, .active, [aria-current="page"]),
  .rail-profile:is(:hover, .active, [aria-current="page"]) { background: #f3ebf9; color: var(--plum-dark); }
  .rail .rail-btn::before { display: none; }
  .rail .rail-btn .icon { width: 22px; height: 22px; }
  .rail-profile .avatar { width: 23px; height: 23px; font-size: 11px; }
  .rail .rail-label { display: inline-block; color: inherit; font-size: 11px; font-weight: 690; line-height: 1.15; white-space: nowrap; }

  .sidebar, .workspace, .shell:not([data-view="chat"]) .workspace { grid-column: 1; grid-row: 1; }
  .shell[data-view="chat"][data-mobile="list"] .workspace,
  .shell[data-view="chat"][data-mobile="chat"] .sidebar,
  .shell[data-view="chat"][data-mobile="list"] .details,
  .shell[data-view="chat"][data-mobile="list"] .drawer-backdrop { display: none; }
  .sidebar { padding: 0 var(--chat-padding) 4px; }
  .sidebar-header { padding: calc(17px + env(safe-area-inset-top)) 2px 3px; }
  .sidebar-headline .sidebar-title { font-size: 28px; }
  .sidebar-headline .compose-btn { width: 44px; height: 44px; }
  .sidebar .tabs { margin-top: 14px; }
  .sidebar .tabs button { min-height: 39px; font-size: 14px; }
  .sidebar-search { height: 44px; }
  .sidebar-search input { font-size: 16px; }
  .sidebar-search kbd, .sidebar-footer { display: none; }
  .conversation-item { min-height: 69px; padding-inline: 7px; }
  .conversation-name { font-size: 15px; }
  .conversation-preview { font-size: 13px; }

  .chat-header { min-height: calc(60px + env(safe-area-inset-top)); padding: calc(5px + env(safe-area-inset-top)) var(--chat-padding) 5px; gap: 4px; }
  .chat-identity { gap: 7px; }
  .chat-identity h1, .chat-identity h2 { font-size: 15px; }
  .chat-subtitle { font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .chat-identity .avatar { width: 32px; height: 32px; border-radius: 9px; }
  .chat-identity .avatar svg { width: 16px; height: 16px; }
  .chat-actions { gap: 0; }
  .chat-header .icon-btn { min-width: 37px; min-height: 44px; }
  .mobile-back { display: inline-grid; margin-inline-start: -6px; }
  .chat-scroll { padding-top: 15px; padding-bottom: 11px; }
  .message { gap: 8px; }
  .message-list { gap: 15px; }
  .message .avatar { width: 28px; height: 28px; border-radius: 8px; }
  .message-body { max-width: calc(100% - 36px); }
  .message-meta { min-height: 25px; padding-inline-end: 76px; gap: 5px; }
  .message-text, .message-content { font-size: 15px; padding: 7px 10px; }
  .message-actions { position: absolute; top: -6px; right: 0; gap: 0; opacity: 1; }
  .message-actions .icon-btn { min-width: 37px; min-height: 36px; }
  .message-actions .icon { width: 15px; height: 15px; }
  .composer-area { padding-block: 6px 8px; }
  .composer { padding: 7px; }
  .composer textarea { height: 34px; font-size: 16px; }
  .composer-toolbar button:not(.send-btn, .selected-agent) { min-width: 44px; min-height: 42px; }
  .send-btn { min-height: 42px; }
  .composer-hint { display: none; }

  .shell .details {
    inset: auto 0 0;
    width: 100%;
    height: auto;
    max-height: min(84dvh, calc(var(--app-viewport-height, 100dvh) - 18px));
    padding-bottom: env(safe-area-inset-bottom);
    border: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
  }
  .details-header { min-height: 57px; }
  .details-header > button, .detail-heading > button { min-width: 44px; min-height: 44px; }
  .bind-button { min-height: 44px; }
  .section-header { padding: calc(21px + env(safe-area-inset-top)) var(--chat-padding) 16px; }
  .section-header h2 { font-size: 23px; }
  .section-content { padding: 15px var(--chat-padding) 24px; }
  .section-card { padding: 13px; }
  .dialog {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    margin: 0;
    border-radius: 20px 20px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .dialog-header { padding: 10px 15px; }
  .dialog-body { padding: 12px 15px; }
  .dialog :is(input, textarea, select), .section-view :is(input, textarea, select) { font-size: 16px; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  :root[data-keyboard="open"] .rail { display: none; }
  :root[data-keyboard="open"] .toast { bottom: calc(12px + max(0px, 100dvh - var(--app-viewport-height, 100dvh))); }
  :root[data-keyboard="open"] .dialog,
  :root[data-keyboard="open"] .shell .details { bottom: max(0px, calc(100dvh - var(--app-viewport-height, 100dvh))); }

  .auth-screen {
    grid-template-columns: minmax(0, 1fr);
    padding: max(12px, env(safe-area-inset-top)) 0 max(12px, env(safe-area-inset-bottom));
    background: radial-gradient(ellipse at 50% 0%, #efe6fa, #fdfbfd 64%);
  }
  .auth-art { display: none; }
  .auth-brand-mobile { display: inline-flex; margin-bottom: clamp(18px, 4vh, 36px); }
  .auth-panel { padding: clamp(12px, 4vw, 27px); }
  .auth-card { width: min(100%, 414px); padding: clamp(18px, 5vw, 27px); border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
  .auth-card-header { margin-bottom: 19px; }
  .auth-form .form-field input { font-size: 16px; }
}

@media (max-width: 360px) {
  .chat-identity .chat-avatar { display: none; }
  .chat-header .icon-btn { min-width: 34px; }
  .section-card .agent-management-row { flex-wrap: wrap; }
}

@media (max-height: 620px) {
  .auth-art-copy { margin-top: 38px; margin-bottom: 135px; }
}
@media (min-width: 740px) and (max-height: 620px) {
  .rail { gap: 12px; overflow-y: auto; }
  .rail-top { gap: 13px; }
  .rail-nav, .rail-bottom { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
