@import url('/theme.css');

/* A quiet workspace, with one consistent reading column. */
.chat-page {
  --bg: #14151b;
  --panel: #1c1d26;
  --line: #ffffff0e;
  --ink: #f1eef8;
  --muted: #b1abbd;
  --quiet: #9590a3;
  --accent: #c9b8f4;
  --content-gutter: clamp(28px, 5.5vw, 88px);
  overflow: hidden;
}
.chat-page ::selection { background: #b69be64d; color: #fff; }
.app-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: 100dvh; }
.sidebar { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 28px 18px 18px; border-right: 1px solid #ffffff0c; background: linear-gradient(180deg, #191920, #17171e); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: 30px; font-weight: 650; letter-spacing: -1.4px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; color: var(--accent); }
.brand-mark svg { width: 42px; height: 42px; }
.brand small { display: block; margin-top: 3px; color: var(--quiet); font-size: 8px; font-weight: 500; letter-spacing: 1.6px; }
.sidebar .brand { padding: 0 10px 26px; }
.workspace-label { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; padding: 13px 12px; border: 1px solid #c9b8f414; border-radius: 12px; background: #ffffff02; font-size: 12px; font-weight: 550; }
.workspace-icon { display: grid; place-items: center; width: 32px; height: 34px; border: 1px solid #c9bafa24; border-radius: 9px; background: linear-gradient(135deg, #c9bafa20, #c9bafa06); color: var(--accent); font-family: Georgia, serif; font-size: 20px; }
.workspace-label small { display: block; margin-top: 4px; color: var(--quiet); font-size: 10px; font-weight: 400; }
.workspace-label > .status-dot { margin-left: auto; }
.sidebar-search { display: flex; align-items: center; gap: 8px; margin: 0 0 24px; padding: 0 11px; min-height: 39px; border: 1px solid #ffffff0e; border-radius: 9px; background: #1011166b; color: var(--quiet); transition: border-color .18s, background .18s; }
.sidebar-search:focus-within { border-color: #c9b8f46b; background: #15151d; }
.sidebar-search svg { width: 15px; height: 15px; }
.sidebar-search input { min-width: 0; height: 37px; padding: 0; border: 0; border-radius: 0; background: transparent; font-size: 11px; }
.sidebar-search input::placeholder { color: var(--quiet); }
.sidebar-search kbd { flex-shrink: 0; padding: 2px 4px; border: 1px solid var(--line); border-radius: 4px; color: var(--quiet); font: inherit; font-size: 9px; }
.conversation-nav { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #44404f transparent; }
.section-heading { display: flex; align-items: center; justify-content: space-between; min-height: 28px; padding: 0 10px 9px; color: var(--quiet); font-size: 9px; font-weight: 650; letter-spacing: 1.5px; }
.section-heading .icon-button { width: 25px; height: 25px; }
.direct-heading { margin-top: 28px; }
.room-list { display: grid; gap: 5px; }
.room-button { position: relative; display: flex; align-items: center; gap: 11px; width: 100%; min-height: 51px; padding: 11px 12px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); text-align: left; font-size: 12px; transition: background .18s, border-color .18s, color .18s; }
.room-button:hover { background: #ffffff05; color: var(--ink); }
.room-button.active { border-color: #c4a4ff25; background: linear-gradient(100deg, #ba9af51b, #ba9af50d); color: #e6dbfd; }
.room-button.active::before { content: ""; position: absolute; top: 16px; bottom: 16px; left: -1px; width: 3px; border-radius: 0 4px 4px 0; background: var(--accent); }
.room-icon { display: grid; place-items: center; flex-shrink: 0; width: 24px; height: 28px; color: #a39ab6; }
.room-icon svg { width: 18px; height: 18px; }
.room-button.active .room-icon, .room-icon.ai { color: var(--accent); }
.room-label { display: block; flex: 1; min-width: 0; overflow: hidden; }
.room-label strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; }
.room-label small, .room-preview { display: block; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--quiet); font-size: 10px; line-height: 1.4; font-weight: 400; }
.room-button.has-unread .room-label strong { color: var(--ink); font-weight: 650; }
.room-button.has-unread .room-preview { color: var(--muted); }
.room-unread { display: grid; place-items: center; flex-shrink: 0; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 6px; background: var(--accent); color: #251b36; font-size: 10px; font-weight: 650; }
.draft-label { color: var(--accent); font-size: 10px; font-weight: 500; }
.mini-label { display: inline-flex; align-items: center; border: 1px solid #c3adff30; border-radius: 5px; padding: 2px 5px; color: var(--accent); font-size: 8px; font-weight: 650; letter-spacing: .5px; line-height: 1.3; }
.room-button .mini-label, .room-count { flex-shrink: 0; margin-left: auto; }
.room-count { color: var(--quiet); font-size: 10px; font-variant-numeric: tabular-nums; }
.mini-avatar { display: grid; place-items: center; flex-shrink: 0; width: 29px; height: 29px; border: 1px solid #bda4dc16; border-radius: 10px; background: #c8c2e811; color: #d0c5e4; font-size: 10px; }
.nav-empty { margin: 7px 12px; color: var(--quiet); font-size: 11px; line-height: 1.8; }
.sidebar-note { display: flex; align-items: center; gap: 10px; padding: 23px 12px; color: var(--quiet); }
.sidebar-note svg { width: 14px; }
.sidebar-note p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.8; }
.sidebar-note p span { color: var(--quiet); font-size: 9px; }
.profile-card { display: flex; align-items: center; gap: 10px; padding: 16px 9px 0; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border: 1px solid #d6c5ff20; border-radius: 12px; background: linear-gradient(140deg, #322b43, #292534); color: #e1d5fa; font-size: 11px; font-weight: 650; }
.avatar.ai { background: linear-gradient(135deg, #3b2d50, #282237); color: #d9c4ff; }
.avatar svg { width: 20px; }
.profile-copy { flex: 1; min-width: 0; }
.profile-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 12px; font-weight: 600; }
.profile-copy small { display: block; margin-top: 4px; color: var(--quiet); font-size: 10px; }
.chat-page .icon-button { color: var(--quiet); transition: background .16s, color .16s; }
.chat-page .icon-button:hover, .chat-page .icon-button[aria-expanded="true"] { background: #c9b8f410; color: var(--accent); }
.chat-page button:disabled { cursor: not-allowed; }

.chat-panel { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; background: radial-gradient(ellipse at 75% 0, #a48ad307, transparent 50%), var(--bg); }
.chat-header { grid-row: 1; display: flex; align-items: center; gap: 13px; min-height: 80px; padding: 0 32px; border-bottom: 1px solid var(--line); background: #17171ed9; }
.header-room-icon { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border: 1px solid #ffffff10; border-radius: 12px; background: #ffffff03; color: #c4bbd2; }
.header-room-icon.ai { border-color: #c9b8f420; background: #c9b8f408; color: var(--accent); }
.header-room-icon svg { width: 19px; height: 19px; }
.header-copy { min-width: 0; }
.header-copy h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; letter-spacing: -.2px; }
.header-copy p { margin: 5px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--quiet); font-size: 10px; }
.header-actions { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.header-actions > .icon-button { width: 34px; height: 34px; }
.connection { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.status-dot { display: inline-block; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px #a6dec30a; }
.status-dot.offline { background: var(--coral); box-shadow: 0 0 0 3px #eea9ae0a; }
.admin-link { padding: 8px 11px !important; font-size: 10px !important; }
.admin-link svg { width: 14px !important; }
.notification-count { display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 3px; border-radius: 5px; background: var(--accent); color: #20172f; font-size: 9px; }
.menu-button, .sidebar-scrim, .admin-link-list { display: none; }
.chat-search { grid-row: 2; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 12px 32px; border-bottom: 1px solid var(--line); background: #1b1b24; color: var(--quiet); }
.chat-search > span:has(svg) { display: flex; }
.chat-search > svg, .chat-search > span > svg { width: 17px; height: 17px; }
.chat-search input { flex: 1; min-width: 60px; padding: 8px 0; border: 0; background: transparent; font-size: 12px; }
.chat-search input::placeholder { color: var(--quiet); }
.search-count { flex-shrink: 0; color: var(--muted); font-size: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.search-actions { display: flex; align-items: center; gap: 3px; }
.search-actions .icon-button { width: 29px; height: 29px; }

.messages { grid-row: 3; position: relative; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 0 var(--content-gutter) 28px; scrollbar-width: thin; scrollbar-color: #44404f transparent; scroll-behavior: auto; overscroll-behavior: contain; }
.messages::-webkit-scrollbar, .conversation-nav::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb, .conversation-nav::-webkit-scrollbar-thumb { border-radius: 6px; background: #44404f; }
.jump-latest { position: fixed; z-index: 5; display: flex; align-items: center; gap: 7px; margin: 0; padding: 10px 14px; border: 1px solid #c6b5ef45; border-radius: 999px; background: #30283f; color: #eee5ff; box-shadow: 0 6px 24px #0006; font-size: 11px; transform: translateX(-50%); }
.jump-latest svg { width: 14px; height: 14px; }
.jump-latest:hover { border-color: #c6b5ef85; background: #3c3150; }
.room-intro { max-width: 690px; padding: 49px 0 30px; }
.intro-emblem { display: grid; place-items: center; width: 55px; height: 55px; margin-bottom: 25px; border: 1px solid #c8c2e828; border-radius: 18px; background: linear-gradient(135deg, #c6acff1b, #a7d6e306); color: var(--accent); box-shadow: inset 0 1px 0 #ffffff06; }
.intro-emblem svg { width: 25px; height: 25px; }
.room-intro .eyebrow { font-size: 8px; letter-spacing: 1.8px; }
.room-intro h2 { margin: 12px 0 10px; font-size: clamp(25px, 3vw, 35px); font-weight: 550; letter-spacing: -1.15px; line-height: 1.2; }
.room-intro p { max-width: 470px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.85; }
.room-intro.compact { padding-top: 34px; padding-bottom: 17px; }
.room-intro.compact .intro-emblem { width: 43px; height: 43px; margin-bottom: 18px; border-radius: 14px; }
.room-intro.compact .intro-emblem svg { width: 21px; height: 21px; }
.room-intro.compact h2 { font-size: clamp(24px, 2.4vw, 29px); }
.date-divider { display: flex; align-items: center; gap: 15px; margin: 22px 0 23px; color: var(--quiet); font-size: 10px; }
.date-divider::before, .date-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.date-divider span { padding: 4px 10px; border: 1px solid #ffffff08; border-radius: 20px; background: #ffffff02; }
.message { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; animation: arrive .2s ease both; }
.message > .avatar { margin-top: 1px; }
.message-content { flex: 1; min-width: 0; }
.message-head { display: flex; align-items: center; gap: 8px; min-height: 20px; margin-bottom: 6px; padding: 0 1px; }
.message-head strong { color: #e5dfed; font-size: 11px; font-weight: 600; }
.message-head time { color: var(--quiet); font-size: 9px; }
.you-label { color: var(--quiet); font-size: 9px; }
.message-text { display: inline-block; max-width: min(100%, 780px); padding: 11px 15px; border: 1px solid #ffffff08; border-radius: 3px 13px 13px; background: #1d1e27; color: #d9d4e1; overflow-wrap: anywhere; font-size: 13px; line-height: 1.8; vertical-align: top; }
.message-text p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-text p + p { margin-top: 10px; }
.message-text > :first-child { margin-top: 0; }
.message-text > :last-child { margin-bottom: 0; }
.message-text a { color: #d0bdfc; text-decoration: underline; text-decoration-color: #c9b8f455; text-underline-offset: 3px; }
.message-text a:hover { color: #eee2ff; text-decoration-color: currentColor; }
.message-text strong { color: #f0eafa; font-weight: 650; }
.message-text code { padding: 2px 5px; border: 1px solid #c6b5ef14; border-radius: 4px; background: #090a1075; color: #dbc9ff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }
.message-text pre { max-width: 100%; margin: 10px 0; padding: 13px; overflow-x: auto; border: 1px solid #ffffff0b; border-radius: 8px; background: #101017; white-space: pre; scrollbar-width: thin; }
.message-text pre code { padding: 0; border: 0; background: none; font-size: 11px; line-height: 1.7; }
.message-text blockquote { margin: 9px 0; padding: 7px 12px; border-left: 2px solid #c9b8f480; border-radius: 0 6px 6px 0; background: #c9b8f409; color: #bdb4cf; font-size: 12px; }
.message-text ul, .message-text ol { padding-left: 22px; }
.message-attachments { display: grid; gap: 7px; margin-top: 9px; min-width: min(240px, 100%); }
.message-text > .message-attachments:first-child { margin-top: 0; }
.attachment-card { display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 9px 11px; border: 1px solid #c9b8f424; border-radius: 9px; background: #14151dc4; color: var(--ink) !important; text-decoration: none !important; transition: border-color .16s, background .16s; }
.attachment-card:hover { border-color: #c9b8f466; background: #191a24; }
.attachment-icon, .attachment-download { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; background: #c9b8f412; color: var(--accent); }
.attachment-download { width: 26px; height: 26px; background: transparent; color: var(--muted); margin-left: auto; }
.attachment-card:hover .attachment-download { color: var(--accent); }
.attachment-meta { display: block; flex: 1; min-width: 0; overflow: hidden; line-height: 1.35; }
.attachment-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f0eafa; font-size: 12px; font-weight: 600; }
.attachment-detail { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--quiet); font-size: 10px; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.attachment-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; min-width: 0; padding: 5px 7px 5px 9px; border: 1px solid #c9b8f42e; border-radius: 9px; background: #161620; color: var(--ink); font-size: 11px; }
.attachment-chip-icon { display: inline-flex; flex-shrink: 0; color: var(--accent); }
.attachment-chip-icon svg { width: 14px; height: 14px; }
.attachment-chip-name { overflow: hidden; max-width: 200px; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.attachment-chip-size { flex-shrink: 0; color: var(--quiet); font-size: 10px; font-variant-numeric: tabular-nums; }
.attachment-remove { width: 22px !important; height: 22px !important; padding: 3px !important; border-radius: 6px !important; }
.attachment-remove svg { width: 13px !important; height: 13px !important; }
.own-message > .avatar { background: linear-gradient(135deg, #554267, #3d304e); border-color: #c9b8f42b; color: #ecddff; }
.own-message .message-text { border-color: #c8a9ff15; background: linear-gradient(110deg, #292335, #262231); color: #e3daef; }
.ai-message > .avatar { margin-top: 1px; }
.ai-message .message-text { display: block; border-color: #c9b8f425; border-radius: 3px 14px 14px; background: linear-gradient(125deg, #c9b8f40d, #a6d5c203); color: #e1d9eb; }
.message.grouped { padding-top: 2px; }
.message.grouped > .avatar { visibility: hidden; }
.message.grouped .message-head { display: none; }
.message.grouped .message-text { border-top-left-radius: 10px; }
.message-tools { position: absolute; z-index: 2; top: -7px; right: 3px; display: flex; gap: 2px; padding: 3px; border: 1px solid #c9b8f420; border-radius: 9px; background: #24222d; box-shadow: 0 4px 12px #0003; opacity: 0; pointer-events: none; transition: opacity .15s; }
.message:hover .message-tools, .message:focus-within .message-tools { opacity: 1; pointer-events: auto; }
.message-tools .icon-button { width: 28px; height: 27px; color: #bdb3cd; }
.message-tools .icon-button svg { width: 14px; height: 14px; }
.message.search-current .message-text { border-color: #c9b8f49c; box-shadow: 0 0 0 3px #c9b8f40a; }
.search-highlight { padding: 1px 2px; border-radius: 3px; background: #c9b8f43b; color: #f6eeff; }
.search-current .search-highlight { background: #d8c2ff; color: #271c36; }
.history-note { margin: 14px 0 6px; text-align: center; color: var(--quiet); font-size: 10px; line-height: 1.7; }
.typing-indicator { display: flex; align-items: center; gap: 6px; padding: 4px 0 0 49px; color: var(--accent); font-size: 11px; }
.thinking-dots { margin-right: 5px; letter-spacing: 3px; animation: pulse 1s infinite; }

.composer-wrap { grid-row: 4; position: relative; min-width: 0; padding: 14px var(--content-gutter) 17px; background: linear-gradient(180deg, #14151b00, var(--bg) 18%); }
.composer { position: relative; padding: 16px 17px 12px; border: 1px solid #b59bd13d; border-radius: 15px; background: linear-gradient(115deg, #23212d, #1e1e28); box-shadow: 0 10px 35px #0002, inset 0 1px 0 #ffffff04; transition: border-color .2s, box-shadow .2s; }
.composer-label { margin-bottom: 8px; color: var(--accent); font-size: 9px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; }
.composer:focus-within { border-color: #c9b8f480; box-shadow: 0 0 0 3px #bfa4ff08, 0 10px 35px #0002; }
.composer textarea { display: block; width: 100%; min-height: 52px; max-height: 180px; resize: none; overflow-y: auto; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 13px; line-height: 1.65; scrollbar-width: thin; }
.composer textarea::placeholder { color: #aaa1b7; }
.composer textarea:disabled { opacity: .65; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; margin-top: 12px; }
.composer-tools { display: flex; align-items: center; gap: 5px; }
.composer-tools .icon-button { width: 29px; height: 29px; }
.composer-hint { flex: 1; color: var(--quiet); font-size: 9px; line-height: 1.5; }
.composer-hint kbd { padding: 2px 4px; border: 1px solid #ffffff15; border-radius: 4px; font: inherit; }
.character-count { flex-shrink: 0; color: var(--quiet); font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.character-count.near-limit { color: #f0c18e; }
.composer-actions .button { min-height: 34px; padding: 8px 13px; border-radius: 8px; font-size: 11px; font-weight: 600; }
.composer-actions .primary { background: #cbb7f5; border-color: #dbc9ff; box-shadow: 0 2px 9px #c9b8f410; }
.composer-actions .primary:hover:not(:disabled) { background: #d9c7ff; }
.composer-actions .primary:disabled { border-color: #bfa9e03b; background: #a18abd; opacity: .48; }
.composer-footer { margin: 10px 0 0; color: var(--quiet); text-align: center; font-size: 9px; letter-spacing: .15px; line-height: 1.6; }
.reply-preview { display: flex; align-items: center; gap: 10px; margin: -2px 0 14px; padding: 9px 11px; border-left: 2px solid var(--accent); border-radius: 0 7px 7px 0; background: #c9b8f40a; }
.reply-preview > div { flex: 1; min-width: 0; }
.reply-preview strong { display: block; color: var(--accent); font-size: 10px; font-weight: 600; }
.reply-preview p { margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; line-height: 1.5; }
.reply-preview .icon-button { flex-shrink: 0; width: 26px; height: 26px; margin-left: auto; }
.emoji-picker { position: absolute; z-index: 10; right: auto; bottom: 55px; left: 14px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; width: 310px; max-width: calc(100% - 28px); padding: 11px; border: 1px solid #c9b8f43b; border-radius: 13px; background: #26222f; box-shadow: 0 12px 35px #0006; }
.emoji-picker button { display: grid; place-items: center; min-width: 0; height: 33px; padding: 3px; border: 0; border-radius: 7px; background: transparent; font-size: 21px; line-height: 1; transition: background .15s, transform .15s; }
.emoji-picker button:hover { background: #c9b8f41c; transform: translateY(-1px); }
.emoji-picker p, .emoji-picker .eyebrow { grid-column: 1 / -1; margin: 0 0 5px; padding: 2px 4px; color: var(--muted); font-size: 9px; }
.ai-allowance { display: flex; align-items: center; flex-shrink: 0; gap: 5px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.ai-allowance svg { width: 12px; color: var(--accent); }
.ai-allowance b { color: var(--accent); font-weight: 500; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.suggestions button { display: flex; align-items: center; gap: 15px; padding: 9px 12px; border: 1px solid #c9b8f41b; border-radius: 8px; background: #c9b8f403; color: #bfb4cf; font-size: 10px; transition: background .18s, border-color .18s; }
.suggestions button:hover { border-color: #bfa4ff55; background: #c9b8f40b; color: var(--accent); }
.suggestions span { color: var(--accent); }
.inline-notice { margin: 0 0 12px; padding: 11px 13px; border: 1px solid #d2ae6630; border-radius: 9px; background: #d2ae6605; color: #e0c99e; font-size: 11px; line-height: 1.7; }

.login-dialog { width: min(860px, calc(100% - 36px)); max-width: 860px; padding: 0; overflow: auto; border: 1px solid #c9b8f433; border-radius: 21px; box-shadow: 0 36px 130px #000b, 0 0 0 1px #ffffff04; }
.login-dialog > form { display: grid; grid-template-columns: .95fr 1.1fr; }
.login-art { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 600px; overflow: hidden; padding: 46px 39px; background: radial-gradient(ellipse at 30% 6%, #b18edb35, transparent 65%), linear-gradient(155deg, #2d253b, #1d1c2b); }
.login-art::after { content: ""; position: absolute; right: -190px; bottom: -30px; width: 350px; height: 350px; border: 1px solid #d9c3ff13; border-radius: 50%; box-shadow: 0 0 0 43px #d9c3ff04, 0 0 0 86px #d9c3ff03, 0 0 0 129px #d9c3ff02; pointer-events: none; }
.login-orbit { margin-bottom: 48px; color: #ddccff; }
.login-orbit svg { width: 88px; height: 88px; }
.login-art .eyebrow { color: #c2b1d9; font-size: 7px; letter-spacing: 1.6px; }
.login-art h1 { margin: 18px 0; color: #f6edff; font-family: Georgia, "Times New Roman", serif; font-size: 46px; font-weight: 400; line-height: 1.13; letter-spacing: -1px; }
.login-art > p { color: #beb0cd; font-size: 12px; line-height: 1.9; }
.login-art-footer { display: flex; align-items: center; gap: 8px; margin-top: 50px; color: #b7a9c6; font-size: 10px; }
.login-content { padding: 44px 40px; background: linear-gradient(155deg, #202029, #1b1b23); }
.login-brand { gap: 8px; margin-bottom: 44px; font-size: 27px; }
.login-brand svg { width: 30px; height: 30px; color: var(--accent); }
.login-content .eyebrow { font-size: 8px; letter-spacing: 1.8px; }
.login-content h2 { margin: 12px 0 8px; font-size: 25px; font-weight: 550; letter-spacing: -.8px; }
.login-content > .muted { margin-bottom: 29px; font-size: 12px; }
.login-content label { margin-top: 19px; color: #c3bacf; font-size: 11px; }
.login-content input { padding: 13px 14px; border-color: #ffffff16; border-radius: 9px; background: #14141c9e; font-size: 12px; transition: border-color .2s, box-shadow .2s; }
.login-content input::placeholder { color: #92889f; }
.login-content input:focus { border-color: #c9b8f483; box-shadow: 0 0 0 3px #c9b8f408; }
.login-submit { justify-content: space-between !important; width: 100%; margin-top: 21px; padding: 13px 15px !important; border-radius: 9px; }
.login-help { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 24px; color: var(--quiet); font-size: 10px; line-height: 1.7; }
.login-help svg { width: 11px; }
.password-field { position: relative; display: flex; align-items: center; }
.password-field input { padding-right: 65px; }
.password-field .text-button { position: absolute; right: 13px; padding: 6px 0; color: var(--muted); font-size: 10px; }
.chat-page .toast { border-radius: 12px; }
@keyframes arrive { from { opacity: 0; transform: translateY(3px); } }
@keyframes pulse { 50% { opacity: .35; } }

@media (min-width: 1550px) {
  .chat-page { --content-gutter: max(88px, calc((100vw - 1280px) / 2)); }
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 250px minmax(0, 1fr); }
  .sidebar { padding: 25px 13px 17px; }
  .chat-page { --content-gutter: 30px; }
  .chat-header, .chat-search { padding-left: 25px; padding-right: 25px; }
  .header-actions { gap: 12px; }
  .header-copy p { max-width: 225px; }
  .connection span { display: none; }
  .composer-hint span { display: none; }
}
@media (max-width: 800px) {
  .app-shell { grid-template-columns: 225px minmax(0, 1fr); }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .chat-page { --content-gutter: 23px; }
  .header-copy p { max-width: 150px; }
  .header-actions { gap: 8px; }
  .header-room-icon { width: 34px; height: 34px; }
  .composer-hint { display: none; }
  .composer-tools { margin-right: auto; }
  .suggestions { gap: 6px; }
  .suggestions button { gap: 8px; padding: 8px 10px; font-size: 9px; }
}
@media (max-width: 700px) {
  /* Phones: the conversation list is the home screen and the chat slides over it. */
  .chat-page { --content-gutter: 14px; --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); --safe-left: env(safe-area-inset-left, 0px); --safe-right: env(safe-area-inset-right, 0px); }
  .app-shell { display: block; height: var(--app-height, 100dvh); }
  .sidebar { position: fixed; z-index: 1; top: var(--viewport-top, 0px); left: 0; width: 100%; height: var(--app-height, 100dvh); padding: calc(18px + var(--safe-top)) calc(14px + var(--safe-right)) calc(14px + var(--safe-bottom)) calc(14px + var(--safe-left)); border-right: 0; }
  .sidebar .brand { padding: 0 6px 18px; font-size: 26px; }
  .brand-mark, .brand-mark svg { width: 34px; height: 34px; }
  .workspace-label { display: none; }
  .sidebar-search { min-height: 46px; margin-bottom: 18px; border-radius: 12px; }
  .sidebar-search input { height: 44px; font-size: 16px; }
  .section-heading { min-height: 44px; padding: 0 4px 4px 8px; font-size: 11px; }
  .section-heading .icon-button { width: 44px; height: 44px; }
  .direct-heading { margin-top: 18px; }
  .room-list { gap: 2px; }
  .room-button { gap: 13px; min-height: 66px; padding: 10px; border-radius: 14px; }
  .room-button.active::before { display: none; }
  .room-icon, .mini-avatar { width: 44px; height: 44px; border-radius: 14px; }
  .room-icon { background: #ffffff06; }
  .mini-avatar { font-size: 13px; }
  .room-label strong { font-size: 16px; }
  .room-label small, .room-preview, .draft-label { margin-top: 3px; font-size: 13px; }
  .room-unread { min-width: 12px; height: 12px; padding: 0; border-radius: 50%; }
  .mini-label, .notification-count { font-size: 11px; }
  .nav-empty { font-size: 13px; }
  .sidebar-note { display: none; }
  .profile-card { padding: 12px 4px 0; }
  .profile-copy strong { font-size: 15px; }
  .profile-copy small { font-size: 12px; }
  .profile-card .icon-button { width: 44px; height: 44px; }
  .admin-link-list { position: relative; display: grid; color: var(--accent) !important; }
  .admin-link-list.has-pending::after { content: ""; position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
  .sidebar-scrim { display: none !important; }

  .chat-panel { position: fixed; z-index: 2; top: var(--viewport-top, 0px); left: 0; width: 100%; height: var(--app-height, 100dvh); box-shadow: -18px 0 60px #0007; transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
  .list-open .chat-panel { transform: translateX(100%); box-shadow: none; }
  .chat-header { gap: 6px; min-height: calc(58px + var(--safe-top)); padding: var(--safe-top) calc(8px + var(--safe-right)) 0 calc(4px + var(--safe-left)); }
  .menu-button { display: grid; }
  .menu-button, .header-actions > .icon-button { width: 44px; height: 44px; color: var(--accent) !important; }
  .menu-button svg { width: 22px; height: 22px; }
  .header-actions > .icon-button { color: var(--muted) !important; }
  .header-room-icon { display: none; }
  .header-copy { flex: 1; }
  .header-copy h1 { font-size: 17px; }
  .header-copy p { display: block; max-width: none; margin-top: 2px; font-size: 12px; }
  .header-actions { gap: 2px; }
  .connection { display: none; }
  .admin-link { min-width: 44px; min-height: 44px; gap: 6px; padding: 8px 10px !important; font-size: 12px !important; }
  .admin-link > span:not(:has(svg)) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .chat-search { flex-wrap: nowrap; gap: 4px; padding: 6px calc(8px + var(--safe-right)) 6px calc(14px + var(--safe-left)); }
  .chat-search input { font-size: 16px; }
  .search-count { max-width: 84px; font-size: 12px; }
  .search-actions { gap: 0; }
  .search-actions .icon-button { width: 44px; height: 44px; }

  .messages { padding: 0 calc(var(--content-gutter) + var(--safe-right)) 14px calc(var(--content-gutter) + var(--safe-left)); }
  .room-intro { padding-top: 30px; padding-bottom: 18px; text-align: center; }
  .room-intro .intro-emblem { margin-left: auto; margin-right: auto; }
  .room-intro p { margin: 0 auto; font-size: 14px; line-height: 1.6; }
  .room-intro .eyebrow { font-size: 11px; }
  .room-intro h2 { font-size: 26px; }
  .room-intro.compact { padding-top: 22px; padding-bottom: 6px; }
  .room-intro.compact h2 { font-size: 22px; }
  .intro-emblem { width: 48px; height: 48px; margin-bottom: 16px; border-radius: 15px; }
  .date-divider { margin: 16px 0 12px; font-size: 12px; }

  /* Chat bubbles: yours on the right, everyone else on the left. */
  .message { gap: 8px; padding: 8px 0; }
  .message > .avatar { width: 32px; height: 32px; margin-top: 22px; border-radius: 11px; font-size: 11px; }
  .message.grouped > .avatar { margin-top: 0; }
  .message-content { max-width: calc(100% - 40px); }
  .message-head { gap: 6px; min-height: 36px; margin-bottom: 3px; padding: 0 84px 0 4px; }
  .message-head strong { font-size: 13px; }
  .message-head time, .you-label { font-size: 11px; }
  .message-text { max-width: 100%; padding: 9px 13px; border-radius: 5px 18px 18px; font-size: 15px; line-height: 1.5; }
  .message.grouped .message-text { border-top-left-radius: 18px; }
  .message-text blockquote { font-size: 14px; }
  .message-text pre code { font-size: 13px; }
  .own-message { flex-direction: row-reverse; }
  .own-message > .avatar { display: none; }
  .own-message .message-content { max-width: 85%; margin-left: auto; text-align: right; }
  .own-message .message-head { justify-content: flex-end; padding: 0 4px 0 84px; }
  .own-message .message-text { border-color: #d9c8ff33; border-radius: 18px 5px 18px 18px; background: linear-gradient(135deg, #4a3c66, #3b3152); color: #f3ecff; text-align: left; }
  .own-message.grouped .message-text { border-top-right-radius: 18px; }
  .ai-message .message-text { display: inline-block; }
  .message-tools { top: 4px; right: 0; gap: 2px; padding: 0; border-color: transparent; background: transparent; box-shadow: none; opacity: 1; pointer-events: auto; }
  .own-message .message-tools { right: auto; left: 0; }
  .message-tools .icon-button { width: 44px; height: 36px; padding: 8px; }
  .message-tools .icon-button svg { width: 15px; height: 15px; }
  /* Grouped messages have no header row: tap the bubble to show reply/copy above it. */
  .message.grouped .message-tools { display: none; }
  .message.grouped.show-tools .message-tools { display: flex; top: -34px; padding: 0 2px; border: 1px solid #c9b8f430; border-radius: 12px; background: #24222d; box-shadow: 0 6px 18px #0006; }
  .message.grouped:focus-within .message-tools { display: flex; top: -34px; background: #24222d; border-radius: 12px; }
  .attachment-name { font-size: 14px; }
  .attachment-detail { font-size: 12px; }
  .attachment-card { min-height: 52px; }
  .typing-indicator { padding-left: 40px; font-size: 13px; }
  .history-note .button { min-height: 44px; font-size: 13px; }
  .jump-latest { min-height: 44px; font-size: 13px; }

  .composer-wrap { padding: 6px calc(10px + var(--safe-right)) max(10px, var(--safe-bottom)) calc(10px + var(--safe-left)); }
  .composer { padding: 10px 10px 8px 14px; border-radius: 20px; }
  .composer-label, .composer-hint, .composer-footer { display: none; }
  .composer textarea { min-height: 44px; max-height: 140px; padding-top: 2px; font-size: 16px; line-height: 1.45; }
  .composer textarea::placeholder { font-size: 16px; }
  .composer-actions { gap: 6px; margin-top: 6px; }
  .composer-tools { margin-right: auto; }
  .composer-tools .icon-button { width: 44px; height: 44px; }
  .composer-tools .icon-button svg { width: 20px; height: 20px; }
  .composer-actions .button { min-height: 44px; padding: 8px 16px; border-radius: 14px; font-size: 14px; }
  .character-count, .ai-allowance { font-size: 12px; }
  .reply-preview { margin: 0 0 10px; }
  .reply-preview strong { font-size: 12px; }
  .reply-preview p { font-size: 13px; }
  .reply-preview .icon-button { width: 44px; height: 44px; }
  .attachment-chip { font-size: 13px; }
  .attachment-chip-size { font-size: 12px; }
  .attachment-remove { width: 44px !important; height: 44px !important; padding: 13px !important; }
  .emoji-picker { bottom: 64px; left: 4px; width: calc(100% - 8px); max-width: 380px; }
  .emoji-picker button { height: 44px; }
  .suggestions { gap: 6px; margin-bottom: 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .suggestions button { flex-shrink: 0; min-height: 44px; padding: 9px 12px; font-size: 13px; }
  .suggestions::-webkit-scrollbar { display: none; }
  .inline-notice { font-size: 13px; }

  .chat-page dialog input, .chat-page dialog select { min-height: 48px; font-size: 16px; }
  .chat-page dialog label { font-size: 13px; }
  .chat-page .dialog-top .icon-button { width: 44px; height: 44px; }
  .chat-page .dialog-actions .button { min-height: 44px; font-size: 14px; }
  .login-dialog { max-width: 430px; }
  .login-dialog > form { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-content { padding: 33px 26px; }
  .login-brand { margin-bottom: 30px; }
  .login-content .eyebrow { font-size: 10px; }
  .login-content > .muted { font-size: 14px; }
  .login-content label { font-size: 13px; }
  .login-content input { min-height: 48px; font-size: 16px; }
  .login-content input::placeholder { font-size: 16px; }
  .password-field .text-button { min-width: 44px; min-height: 44px; padding: 0 6px; font-size: 13px; }
  .login-submit { min-height: 48px; font-size: 14px !important; }
  .login-help { font-size: 12px; }
  .chat-page .toast { top: calc(12px + var(--safe-top)); right: calc(12px + var(--safe-right)); bottom: auto; max-width: calc(100% - 24px); padding: 12px 14px; font-size: 13px; }
}
@media (max-width: 380px) {
  .header-copy p { display: none; }
  .admin-link svg { width: 16px !important; }
  .login-content { padding: 30px 22px; }
  .login-content h2 { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-page *, .chat-page *::before, .chat-page *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
