/* Approved Midnight Studio presentation. Loaded last to isolate legacy glass rules. */
.midnight .chat-pane .msg-body blockquote,
.midnight .chat-pane .msg-row.mine .msg-body blockquote { color:var(--chat-ink); border-left-color:#8b9bb0; }
.midnight .msg-body .message-note-card { display:block; margin-top:6px; padding:5px 9px; border:0; border-left:2px solid #c88910; border-radius:4px; background:#fff7e3; color:#49360e; white-space:normal; font-size:12px; line-height:1.45; }
.midnight .message-note-label { display:inline; font-size:12px; margin:0 5px 0 0; color:inherit; }
.midnight .message-note-text { display:inline; color:inherit; font-size:12px; line-height:1.45; white-space:pre-wrap; overflow-wrap:anywhere; }
[data-theme="dark"] .midnight .msg-body .message-note-card { background:#2a2416; color:#f5e4b5; border-color:#655129; border-left-color:#e0ae43; }
.message-note-quote { padding:12px; border-left:3px solid var(--primary); background:var(--bg-soft); color:var(--text); border-radius:8px; white-space:pre-wrap; overflow-wrap:anywhere; font-size:13px; max-height:140px; overflow:auto; }
.app-shell.midnight .navrail,
.app-shell.midnight.navigation-expanded .navrail { width:60px !important; min-width:60px !important; cursor:default; }
.app-shell.midnight .navrail > .navrail-group > .navrail-btn::after,
.app-shell.midnight .workspace-more summary::after { display:none !important; content:none !important; }
.app-shell.midnight .navrail > .navrail-group > .navrail-btn { min-height:48px; justify-content:center; }
.message-note-section { margin-bottom:10px; color:var(--text-muted); font-size:13px; }
.message-note-section summary { cursor:pointer; padding:8px 0; min-height:36px; }
.message-note-section label { display:block; margin:4px 0 8px; }
.message-note-section textarea { width:100%; padding:12px; max-height:160px; background:var(--bg-soft); color:var(--text); border:1px solid var(--border); border-radius:10px; resize:vertical; font:inherit; }
.midnight .midnight-mark { background:transparent; }
.midnight-mark img { width:100%; height:100%; object-fit:contain; }
.around29-brand { display:block; width:190px; max-width:100%; height:auto; background:transparent; padding:0; border-radius:0; }
.around29-welcome-brand { display:block; width:330px; max-width:100%; height:auto; margin:0 auto 26px; background:transparent; padding:0; border-radius:0; }
.brand-on-dark { display:none; }
[data-theme="dark"] .brand-on-light { display:none; }
[data-theme="dark"] .around29-brand.brand-on-dark { display:block; }
[data-theme="dark"] .around29-welcome-brand.brand-on-dark { display:block; }
.app-shell.midnight { background:#031329; background-image:none; padding:18px 18px 18px 10px; gap:16px; height:100dvh; overflow:hidden; align-items:stretch; font-family:Inter,system-ui,-apple-system,'Segoe UI',sans-serif; }
.midnight .navrail,.midnight .sidebar { --text:#f2f5fc; --text-muted:#a8b7d1; --bg-elev:#102440; --bg-soft:#102440; --bg-hover:#16335a; --border:#243956; color:var(--text); background:transparent; backdrop-filter:none; box-shadow:none; }
.app-shell.midnight .navrail { width:76px; min-width:76px; padding:14px 4px; border:0; border-radius:0; gap:0; justify-content:flex-start; }
.app-shell.midnight .navrail > .navrail-group:first-of-type { gap:6px; }
.app-shell.midnight .navrail > .navrail-group:last-child { margin-top:auto; gap:8px; }
.midnight-mark { display:grid; place-items:center; width:48px; height:48px; margin:0 auto 16px; border-radius:14px; background:#ff8613; color:white; text-decoration:none; flex-shrink:0; }
.app-shell.midnight .navrail > .navrail-group > .navrail-btn { flex-direction:column; justify-content:center; gap:6px; padding:10px 3px; width:100%; min-height:58px; color:#aab9d3; }
.app-shell.midnight .navrail > .navrail-group > .navrail-btn::after { display:block; content:attr(title); font-size:11px; font-weight:500; }
.midnight .navrail .navrail-btn.active,.midnight .navrail .navrail-btn:hover { color:white; background:#10294b; border-radius:12px; }
.midnight .navrail svg { width:22px; height:22px; }
.midnight .theme-icon-sun { display:none; }
[data-theme="dark"] .midnight .theme-icon-moon { display:none; }
[data-theme="dark"] .midnight .theme-icon-sun { display:block; }
.app-shell.midnight .sidebar { display:flex; width:300px; min-width:260px; margin:0; padding:14px 0; border:1px solid #20334e; border-right:0; border-radius:20px 0 0 20px; overflow:visible; }
.midnight .sidebar-head { padding:12px 20px 20px; border:0; background:transparent; }
.app-shell.midnight .sidebar-head .brand { justify-content:flex-start; }
.midnight-wordmark { color:#f5f7ff; font-size:20px; font-weight:700; letter-spacing:-.5px; white-space:nowrap; }
.midnight-wordmark > span { color:#a6b5d0; font-weight:400; }
.midnight .sidebar-actions { padding:8px 16px 14px; background:transparent; border:0; }
.midnight .chats-panel-title { display:none; }
.midnight .user-search-wrap::before {
 content:'';
 position:absolute;
 left:14px;
 top:50%;
 width:16px;
 height:16px;
 z-index:1;
 pointer-events:none;
 transform:translateY(-50%);
 background:currentColor;
 color:#74839a;
 -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") center/contain no-repeat;
 mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") center/contain no-repeat;
}
.midnight #userSearch { background:#10233d; border:1px solid #344865; color:white; border-radius:10px; min-height:42px; }
.midnight #userSearch { padding-left:40px; }
.midnight #userSearch::placeholder { color:#a8b7d1; }
.midnight .conv-list { padding:4px 10px; min-height:0; overflow-y:auto; }
.midnight-filters { display:flex; gap:8px; padding-top:14px; }
.midnight-filters button { background:transparent; color:#adbed7; border:0; padding:8px 14px; min-height:40px; border-radius:9px; font:inherit; font-size:13px; cursor:pointer; }
.midnight-filters button[aria-pressed="true"] { background:#124b9c; color:white; }
.midnight .conv-list.unread-only .conv-item:not(.has-unread):not(:has(.conv-badge:not([hidden]))) { display:none; }
.midnight .conv-list.unread-only:not(:has(.has-unread)):not(:has(.conv-badge:not([hidden])))::after { content:'You’re all caught up.'; display:block; padding:24px 12px; color:#adbed7; font-size:13px; }
.midnight .conv-list.groups-only .conv-item:not([data-conv-type="group"]) { display:none; }
.midnight .conv-list.groups-only:not(:has(.conv-item[data-conv-type="group"]))::after { content:'No group chats yet.'; display:block; padding:24px 12px; color:#adbed7; font-size:13px; }
.midnight-filters button { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; }
.midnight-filters .filter-count { display:inline-grid; place-items:center; min-width:18px; height:18px; padding:0 5px; border-radius:999px; background:#2563eb; color:#fff; font-size:11px; font-weight:700; line-height:1; }
.midnight-filters button[aria-pressed="true"] .filter-count { background:#fff; color:#124b9c; }
.midnight .chat-pane .msg-meta { font-size:12px; margin-bottom:8px; }
.midnight .chat-pane .msg-row.mine .msg-ticks.sent { color:#74859e; }
.midnight .conv-item { padding:16px 12px; margin:0 0 4px; gap:12px; border:0; border-radius:12px; background:transparent; color:#f1f5ff; min-height:78px; }
.midnight .conv-item.active { background:#153563; }
.midnight .conv-item:hover { background:#102b4c; }
.midnight .conv-title { color:#f4f7ff; font-size:14px; }
.midnight .conv-preview { color:#acbcd6; font-size:13px; line-height:1.5; }
.midnight .conv-avatar,.midnight .avatar,.midnight .msg-avatar { border-radius:50%; object-fit:cover; }
.midnight .conv-avatar { width:42px; height:42px; }
.midnight .conv-menu-btn { color:#a8bad6; }
.midnight .chat-panel-close,.midnight .workspace-companion { display:none; }
.app-shell.midnight .chat-pane { margin:0; border:1px solid #e2e7ef; border-radius:18px; overflow:hidden; height:100%; background:var(--chat-surface); box-shadow:none; min-width:0; }
.midnight .chat-pane { --chat-surface:#fff; --chat-incoming:#fff; --chat-ink:#101f3b; --chat-muted:#65738b; --chat-line:#e5eaf2; --bg:#fff; --bg-elev:#fff; --bg-soft:#f5f7fb; --text:#101f3b; --text-muted:#65738b; --border:#e0e6ef; color:var(--text); }
.midnight .chat-pane .chat-head { padding:22px 28px; min-height:88px; }
.midnight .chat-head-title { font-size:20px; letter-spacing:-.4px; }
.midnight .chat-head-avatar { border-radius:50%; }
.midnight .chat-pane .chat-messages { padding:26px 28px; gap:24px; min-height:0; }
.midnight .chat-pane .msg-row,.midnight .chat-pane .msg-row.mine { align-self:stretch; flex-direction:row; max-width:100%; gap:14px; }
.midnight .chat-pane .msg-bubble,.midnight .chat-pane .msg-row.mine .msg-bubble { border:0; border-radius:0; padding:0; background:transparent; color:var(--chat-ink); box-shadow:none; }
.midnight .chat-pane .msg-row.mine .msg-bubble-wrap { flex-direction:row; }
.midnight .chat-pane .msg-row.mine .msg-meta { text-align:left; }
.midnight .msg-avatar { width:38px; height:38px; }
.midnight .chat-pane .msg-body { font-size:14px; line-height:1.65; }
.midnight .chat-pane .msg-row.mine .msg-body a { color:#2563eb; }
.midnight .chat-pane .msg-row.mine .msg-quote,.midnight .chat-pane .msg-quote { background:var(--bg-soft); color:var(--text); border-left:3px solid #7894bf; }
.midnight .chat-pane .msg-row.mine .msg-quote-name { color:var(--text); }
.midnight .chat-pane .chat-composer { padding:12px 24px 24px; }
.midnight .chat-pane .composer-row { border-radius:12px; background:var(--bg-elev); box-shadow:none; padding:8px; }
.midnight .chat-pane .welcome-dashboard { padding:32px; display:flex; align-items:center; justify-content:center; text-align:center; background:var(--chat-surface); }
.midnight-welcome { max-width:420px; }
.midnight-welcome h1 { font-size:26px; letter-spacing:-1px; color:var(--text); }
.midnight-welcome p { color:var(--text-muted); margin:12px 0 24px; }
.midnight-welcome button { margin:4px; min-height:44px; }
.midnight .profile-shell { height:100%; display:flex; flex-direction:column; min-height:0; }
.midnight .profile-body { overflow:auto; min-height:0; padding:24px; }
.midnight .profile-pic-preview img { width:88px; height:88px; object-fit:cover; border-radius:50%; }
.midnight .profile-pic-actions [role=status] { font-size:13px; color:var(--text); }
[data-theme="dark"] .midnight .chat-pane { --chat-surface:#101e32; --chat-incoming:#101e32; --chat-ink:#edf2fc; --chat-muted:#acbad0; --chat-line:#2b3c54; --bg:#101e32; --bg-elev:#15253d; --bg-soft:#1b2e49; --text:#edf2fc; --text-muted:#acbad0; --border:#2b3c54; }
@media(min-width:860px){ .app-shell.midnight.navigation-expanded .navrail { width:120px; min-width:120px; } }
@media(max-width:1100px) and (min-width:860px){ .app-shell.midnight { gap:8px; padding:10px; } .app-shell.midnight .sidebar { width:260px; min-width:260px; } .midnight .chat-pane .chat-head { padding:16px; } .midnight .chat-pane .chat-messages { padding:20px 16px; } }
@media(max-width:859px){
 .app-shell.midnight { padding:0; gap:0; }
 .app-shell.midnight .navrail { width:60px; min-width:60px; padding:12px 4px; }
 .midnight-mark { width:38px; height:38px; font-size:25px; }
 .app-shell.midnight .sidebar { position:static; z-index:auto; width:calc(100% - 60px); min-width:0; border:0; border-radius:0; }
 .app-shell.midnight .chat-pane { display:none; border:0; border-radius:0; }
 .app-shell.midnight.show-chat .sidebar,.app-shell.midnight.show-chat .navrail { display:none; }
 .app-shell.midnight.show-chat .chat-pane { display:flex; width:100%; }
 .midnight .chat-pane .chat-head { min-height:70px; padding:12px; gap:8px; }
 .midnight .chat-head-title { font-size:16px; }
 .midnight .chat-pane .chat-messages { padding:18px 12px; }
 .midnight .chat-pane .chat-composer { padding:8px 10px max(12px,env(safe-area-inset-bottom)); }
 .midnight .chat-pane .msg-body { font-size:15px; }
}

.auth-card .brand-image { background:#fff; padding:10px; border-radius:10px; }

.shared-dialog { width:min(760px,calc(100vw - 24px)); max-height:85dvh; padding:24px; border:1px solid var(--border); border-radius:18px; background:var(--bg-elev); color:var(--text); overflow-y:auto; }
.shared-dialog::backdrop { background:#031329aa; }
.conversation-notes-panel { width:min(420px,calc(100vw - 24px)); max-height:90dvh; padding:22px; border:1px solid var(--border); border-radius:18px; background:var(--bg-elev); color:var(--text); overflow:auto; }
.conversation-notes-panel::backdrop { background:#031329aa; }
.conversation-notes-panel header { display:flex; align-items:center; justify-content:space-between; }
.conversation-notes-panel h2 { font-size:20px; margin:0; }
.conversation-notes-panel h3 { font-size:14px; }
.conversation-notes-panel .notes-close { border:0; background:transparent; color:inherit; font-size:25px; width:44px; height:44px; cursor:pointer; }
.notes-context { font-weight:600; margin:12px 0 4px; overflow-wrap:anywhere; }
.conversation-notes-panel textarea { display:block; width:100%; min-height:240px; resize:vertical; border:1px solid var(--border); border-radius:10px; padding:12px; background:var(--bg-soft); color:var(--text); font:inherit; font-size:14px; line-height:1.6; }
.conversation-notes-panel footer { display:flex; gap:8px; flex-wrap:wrap; }
.conversation-notes-panel [role=status] { font-size:13px; min-height:20px; margin:12px 0; }
.conversation-notes-panel section { margin-top:26px; padding-top:20px; border-top:1px solid var(--border); }
@media(min-width:860px){
 .app-shell.midnight > .conversation-notes-panel:not(:modal)[open] { position:static; flex:0 0 280px; width:280px; height:100%; max-height:100%; margin:0; padding:20px; }
 .app-shell.midnight:has(.conversation-notes-panel[open]) .sidebar { width:260px; min-width:240px; }
 .app-shell.midnight:has(.conversation-notes-panel[open]) .chat-head { flex-wrap:wrap; padding:16px; }
 .app-shell.midnight:has(.conversation-notes-panel[open]) .chat-head-info { flex:1; }
}
@media(min-width:860px) and (max-width:1199px){
 .app-shell.midnight > .conversation-notes-panel:not(:modal)[open] { flex-basis:250px; width:250px; padding:16px; }
 .app-shell.midnight:has(.conversation-notes-panel[open]) .sidebar { width:200px; min-width:200px; }
 .app-shell.midnight:has(.conversation-notes-panel[open]) .navrail { width:60px; min-width:60px; }
 .app-shell.midnight:has(.conversation-notes-panel[open]) .sidebar-head { padding:10px; }
}
@media(max-width:859px){
 .conversation-notes-panel[open] { position:fixed; inset:0 0 0 auto; margin:0; width:min(360px,100vw); height:100dvh; max-height:100dvh; border-radius:18px 0 0 18px; }
}
.shared-dialog header { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.shared-dialog h2 { font-size:20px; margin:0; }
.shared-dialog button { min-height:44px; border:0; border-radius:9px; padding:8px 14px; background:var(--bg-soft); color:var(--text); cursor:pointer; }
.shared-dialog header button { font-size:24px; }
.shared-dialog nav { display:flex; flex-wrap:wrap; gap:8px; margin:20px 0 10px; }
.shared-dialog nav button[aria-pressed="true"] { background:#2563eb; color:white; }
.shared-status { font-size:13px; color:var(--text-muted); }
.shared-item { display:flex; gap:12px; padding:14px; border:1px solid var(--border); border-radius:10px; margin:8px 0; color:var(--text); text-decoration:none; }
.shared-item:hover { background:var(--bg-soft); }
.shared-item div { min-width:0; }
.shared-item strong { display:block; font-size:14px; overflow-wrap:anywhere; }
.shared-item small { display:block; color:var(--text-muted); margin-top:6px; }
.shared-images { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:12px; }
.shared-images .shared-item { flex-direction:column; }
.shared-item img { width:100%; height:150px; object-fit:cover; border-radius:6px; }
@media(max-width:600px){ .midnight .chat-pane .chat-head { flex-wrap:wrap; } .midnight .chat-head-info { flex:1; } .shared-dialog { padding:16px; } }

/* Shared spacing rhythm across every workspace column. */
.midnight .chat-pane .msg-actions {
 position:static; inset:auto; transform:none; flex-wrap:wrap; max-width:100%;
 opacity:0; pointer-events:none; box-shadow:none; background:transparent;
 transition:opacity .12s ease;
}
.midnight .chat-pane .msg-row:hover .msg-actions,
.midnight .chat-pane .msg-row:focus-within .msg-actions,
.midnight .chat-pane .actions-open .msg-actions { opacity:1; pointer-events:auto; transform:none; }
.midnight .chat-pane .msg-action-toggle { display:none; }
@media(hover:none),(pointer:coarse){
 .midnight .chat-pane .msg-action-toggle { display:inline-flex; min-width:44px; min-height:44px; }
 .midnight .chat-pane .msg-actions { display:none; }
 .midnight .chat-pane .actions-open .msg-actions { display:flex; width:100%; opacity:1; pointer-events:auto; }
 .midnight .chat-pane .msg-action { min-width:44px; min-height:44px; }
}
@media(prefers-reduced-motion:reduce){ .midnight .chat-pane .msg-actions { transition:none; } }
.edit-message-dialog { width:min(520px,calc(100vw - 32px)); border:1px solid var(--border); border-radius:18px; padding:22px; background:var(--bg-elev); color:var(--text); box-shadow:0 24px 70px rgba(5,18,42,.28); }
.edit-message-dialog::backdrop { background:rgba(2,8,23,.48); backdrop-filter:blur(4px); }
.edit-message-dialog h3 { margin:0 0 14px; }
.edit-message-dialog textarea { box-sizing:border-box; width:100%; resize:vertical; min-height:120px; padding:12px 14px; border:1px solid var(--border); border-radius:12px; background:var(--bg); color:var(--text); font:inherit; }
.edit-message-dialog .dialog-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:16px; }
.confirm-dialog { width:min(420px,calc(100vw - 32px)); }
.notif-panel { min-width:250px; max-width:320px; }
.notif-panel-head { padding:8px 12px 4px; font-size:12px; font-weight:600; letter-spacing:.2px; color:var(--text-muted); text-transform:uppercase; }
.notif-item { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; }
.notif-item > span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.notif-count { flex:0 0 auto; min-width:20px; padding:1px 7px; border-radius:999px; background:#2563eb; color:#fff; font-size:11px; font-weight:700; text-align:center; }
.notif-empty { padding:10px 12px 12px; font-size:13px; color:var(--text-muted); }
.confirm-dialog p { margin:0; font-size:15px; line-height:1.5; }
.confirm-dialog .btn-danger { background:#dc2626; }
.confirm-dialog .btn-danger:hover { background:#b91c1c; }
.message-reactions { display:flex; flex-wrap:wrap; gap:5px; margin-top:6px; }
.message-reactions:empty { display:none; }
.reaction-chip { border:1px solid var(--border); border-radius:999px; background:var(--bg); color:var(--text); padding:3px 8px; font:inherit; font-size:12px; cursor:pointer; }
.reaction-chip.mine { border-color:#7aa7ff; background:rgba(45,105,235,.1); }
.reaction-picker { position:fixed; z-index:10020; display:flex; gap:3px; padding:6px; border:1px solid var(--border); border-radius:14px; background:var(--bg-elev); box-shadow:0 12px 36px rgba(2,8,23,.24); }
.reaction-picker button { width:38px; height:38px; border:0; border-radius:10px; background:transparent; font-size:19px; cursor:pointer; }
.reaction-picker button:hover,.reaction-picker button:focus-visible { background:var(--surface-hover); transform:scale(1.08); }
.load-older-btn { align-self:center; margin:8px auto 18px; padding:8px 14px; border:1px solid var(--border); border-radius:999px; background:var(--bg-elev); color:var(--text-muted); font:inherit; font-size:12px; cursor:pointer; }
.load-older-btn:hover,.load-older-btn:focus-visible { color:var(--text); border-color:#7aa7ff; }
.app-shell.midnight { --workspace-gap:16px; --panel-inset:20px; gap:var(--workspace-gap); padding:16px; }
.app-shell.midnight .sidebar { border:1px solid #20334e; border-radius:18px; padding:0; min-height:0; }
.midnight .sidebar-head { min-height:88px; padding:20px 16px; gap:12px; }
.midnight .sidebar-head .head-actions { margin-left:0; }
.midnight .sidebar-head .around29-brand { width:100%; max-width:190px; }
.midnight #userMenuBtn { box-sizing:border-box; width:34px; height:34px; min-width:34px; flex:0 0 34px; padding:0; border-radius:50%; overflow:hidden; display:grid; place-items:center; }
.midnight #userMenuBtn > .avatar { box-sizing:border-box; display:grid; place-items:center; width:100%; height:100%; min-width:100%; aspect-ratio:1; border-radius:50%; object-fit:cover; object-position:center; }
.midnight .nav-account { position:relative; display:grid; place-items:center; width:100%; }
.midnight #userMenuBtn.nav-account-btn { width:48px; height:48px; min-width:48px; overflow:visible; }
.midnight #userMenuBtn.nav-account-btn > .avatar { width:34px; height:34px; min-width:34px; box-shadow:0 0 0 2px var(--bg-elev),0 0 0 3px rgba(111,137,176,.42); }
.mobile-account-btn > .avatar,.mobile-account-avatar { display:grid; place-items:center; width:24px; height:24px; border-radius:50%; object-fit:cover; font-size:10px; color:#fff; }
.midnight .sidebar-actions { padding:0 16px 16px; }
.midnight .conv-list { padding:0 8px 8px; scrollbar-gutter:stable; }
.midnight .conv-item { min-height:72px; padding:12px; gap:10px; }
.midnight .conv-avatar-wrap { flex:0 0 40px; }
.midnight .conv-avatar { width:40px; height:40px; }
.midnight .conv-meta { min-width:0; }
.midnight .chat-pane .chat-head { padding:16px var(--panel-inset); gap:12px; min-height:88px; flex-wrap:nowrap; }
.midnight .chat-head-info { flex:1; min-width:80px; }
.midnight .chat-head-actions { display:flex; align-items:center; justify-content:flex-end; gap:8px; flex-wrap:nowrap; margin-left:auto; }
.midnight .chat-head-actions > button { min-height:40px; margin:0; padding:8px 12px; font-size:13px; border-radius:10px; }
.midnight .chat-head-actions .close-chat-btn { font-size:22px; width:40px; min-width:40px; padding:0; }
.midnight .chat-head-actions .chat-head-menu { width:40px; padding:8px; }
.midnight .members-bar { padding:8px var(--panel-inset); gap:12px; min-height:32px; }
.midnight .chat-pane .chat-messages { padding:24px var(--panel-inset); gap:20px; scrollbar-gutter:stable; }
.midnight .msg-col { min-width:0; flex:1; }
.midnight .msg-bubble-wrap { min-width:0; max-width:100%; flex-wrap:wrap; gap:8px; }
.midnight .msg-bubble { min-width:0; }
.midnight .msg-body > p:last-child { margin-bottom:0; }
.midnight .msg-body > p:first-child { margin-top:0; }
.midnight .chat-pane .chat-composer { padding:12px var(--panel-inset) var(--panel-inset); }
.midnight .composer-row { gap:8px; }
.midnight .composer-row > [contenteditable] { min-width:0; }

/* Conversation ownership is spatial: incoming stays left, the current user stays right. */
.midnight .chat-pane .msg-row {
 align-self:flex-start;
 width:auto;
 max-width:min(78%,720px);
 flex-direction:row;
}
.midnight .chat-pane .msg-row.mine {
 align-self:flex-end;
 flex-direction:row-reverse;
}
.midnight .chat-pane .msg-col {
 flex:0 1 auto;
 max-width:100%;
}
.midnight .chat-pane .msg-row.mine .msg-bubble-wrap { flex-direction:row-reverse; }
.midnight .chat-pane .msg-row.mine .msg-meta { text-align:right; }
@media(max-width:720px){
 .midnight .chat-pane .msg-row,
 .midnight .chat-pane .msg-row.mine { max-width:92%; }
}
.app-shell.midnight > .conversation-notes-panel[open] { padding:var(--panel-inset); border-radius:18px; }
.conversation-notes-panel header { min-height:44px; gap:12px; margin-bottom:16px; }
.conversation-notes-panel h2 { font-size:18px; line-height:1.3; }
.conversation-notes-panel header button { flex:0 0 40px; width:40px; height:40px; min-height:40px; padding:0; }
.conversation-notes-panel .notes-context { margin:0 0 8px; }
.conversation-notes-panel textarea { min-height:220px; max-height:45dvh; }
.conversation-notes-panel [role=status]:empty { display:none; }
.conversation-notes-panel footer { margin-top:16px; gap:8px; }
.conversation-notes-panel footer button { min-height:44px; }
.conversation-notes-panel section { margin-top:24px; padding-top:20px; }
.shared-dialog nav { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:0 0 16px; }
.shared-dialog nav button { padding:8px; font-size:13px; }
.shared-item { margin:0 0 12px; padding:12px; }
.shared-images { grid-template-columns:1fr; }
@media(min-width:860px) and (max-width:1199px){
 .app-shell.midnight { --workspace-gap:12px; --panel-inset:16px; padding:12px; }
 .midnight .sidebar-head { padding:16px 12px; }
 .midnight .sidebar-actions { padding:0 12px 12px; }
 .midnight:has(.conversation-notes-panel[open]) .chat-head-actions { width:auto; }
}
@media(max-width:859px){
 .app-shell.midnight { --panel-inset:12px; padding:0; gap:0; }
 .app-shell.midnight .sidebar { border:0; border-radius:0; }
 .app-shell.midnight .chat-pane { border-radius:0; }
 .midnight .chat-head-actions { gap:6px; }
 .midnight .chat-head-actions > button { min-height:44px; }
 .app-shell.midnight > .conversation-notes-panel[open] { border-radius:18px 0 0 18px; }
 .midnight-mark { pointer-events:none; }
}
@media(prefers-reduced-motion:reduce){ .midnight-mark { transition:none; } }
/* Unified neutral dark mode across the entire application. */
[data-theme="dark"] {
 color-scheme:dark;
 --bg:#080808; --bg-elev:#121212; --bg-soft:#1a1a1a; --bg-hover:#252525;
 --border:#303030; --border-strong:#484848; --text:#f3f3f3; --text-muted:#aaa; --text-soft:#ccc;
 --primary-soft:#252525; --bubble-other-bg:#171717; --bubble-other-border:#303030;
}
[data-theme="dark"] .app-shell.midnight { background:#050505 !important; }
[data-theme="dark"] .midnight .sidebar,
[data-theme="dark"] .midnight .navrail,
[data-theme="dark"] .midnight .chat-pane {
 --bg:#080808; --bg-elev:#121212; --bg-soft:#1a1a1a; --bg-hover:#252525;
 --border:#303030; --text:#f3f3f3; --text-muted:#aaa; --text-soft:#ccc;
 --chat-surface:#121212; --chat-incoming:#121212; --chat-outgoing:#202020;
 --chat-ink:#f3f3f3; --chat-muted:#aaa; --chat-line:#303030;
}
[data-theme="dark"] .app-shell.midnight .sidebar,
[data-theme="dark"] .app-shell.midnight .chat-pane,
[data-theme="dark"] .conversation-notes-panel { background:#121212; border-color:#303030; }
[data-theme="dark"] .midnight .navrail { background:#050505; }
[data-theme="dark"] .midnight .sidebar-actions { padding-top:16px; }
[data-theme="dark"] .midnight .user-search-wrap { color:#9ba8ba; }
[data-theme="dark"] .midnight #userSearch {
 min-height:46px;
 border-color:#383838;
 border-radius:12px;
 background:#1a1a1a;
 color:#f3f3f3;
 box-shadow:inset 0 1px 0 rgba(255,255,255,.035),0 1px 2px rgba(0,0,0,.2);
 transition:border-color 160ms ease,box-shadow 180ms ease,background-color 160ms ease;
}
[data-theme="dark"] .midnight #userSearch::placeholder { color:#aaa; opacity:1; }
[data-theme="dark"] .midnight #userSearch:hover { border-color:#505050; background:#1e1e1e; }
[data-theme="dark"] .midnight #userSearch:focus {
 border-color:#668cc4;
 background:#1e1e1e;
 box-shadow:0 0 0 3px rgba(74,128,207,.16),0 4px 14px rgba(0,0,0,.24);
}
[data-theme="dark"] .midnight .conv-item.active,
[data-theme="dark"] .midnight .conv-item:hover,
[data-theme="dark"] .midnight .navrail .navrail-btn.active,
[data-theme="dark"] .midnight .navrail .navrail-btn:hover,
[data-theme="dark"] .midnight-filters button[aria-pressed="true"],
[data-theme="dark"] .shared-dialog nav button[aria-pressed="true"] { background:#2b2b2b; color:#fff; }
[data-theme="dark"] .midnight-filters .filter-count,
[data-theme="dark"] .midnight-filters button[aria-pressed="true"] .filter-count { background:#2563eb; color:#fff; }
[data-theme="dark"] .midnight .conv-title { color:#f3f3f3; }
[data-theme="dark"] .midnight .conv-preview,
[data-theme="dark"] .midnight .conv-menu-btn,
[data-theme="dark"] .app-shell.midnight .navrail > .navrail-group > .navrail-btn,
[data-theme="dark"] .midnight-filters button { color:#b8b8b8; }
[data-theme="dark"] .midnight .members-bar,
[data-theme="dark"] .midnight .reply-preview,
[data-theme="dark"] .midnight .reply-bar { background:#191919; color:#ccc; border-color:#303030; }
[data-theme="dark"] .midnight .chat-pane .composer-row { background:#1a1a1a; border-color:#383838; }
/* Consistent soft-white light mode; no dark navigation columns. */
[data-theme="light"] .app-shell.midnight { background:#f1f3f6 !important; }
[data-theme="light"] .midnight .sidebar,
[data-theme="light"] .midnight .navrail {
 --text:#202735; --text-muted:#687386; --bg-elev:#fff; --bg-soft:#f4f5f7; --bg-hover:#e9edf3; --border:#e0e4eb;
 color:var(--text); background:#fff;
}
[data-theme="light"] .app-shell.midnight .sidebar { border-color:#e0e4eb; }
[data-theme="light"] .app-shell.midnight .navrail { background:transparent; }
[data-theme="light"] .app-shell.midnight .navrail > .navrail-group > .navrail-btn { color:#606d80; }
[data-theme="light"] .midnight .navrail .navrail-btn.active,
[data-theme="light"] .midnight .navrail .navrail-btn:hover,
[data-theme="light"] .midnight .conv-item.active,
[data-theme="light"] .midnight .conv-item:hover { background:#e8eef8; color:#204b8f; }
[data-theme="light"] .midnight .conv-title { color:#202735; }
[data-theme="light"] .midnight .conv-preview,
[data-theme="light"] .midnight .conv-menu-btn,
[data-theme="light"] .midnight-filters button { color:#687386; }
[data-theme="light"] .midnight-filters button[aria-pressed="true"] { background:#e8eef8; color:#204b8f; }
[data-theme="light"] .midnight-filters .filter-count,
[data-theme="light"] .midnight-filters button[aria-pressed="true"] .filter-count { background:#204b8f; color:#fff; }
[data-theme="light"] .midnight #userSearch { background:#f4f5f7; border-color:#e0e4eb; color:#202735; }
[data-theme="light"] .midnight .sidebar-actions { padding-top:16px; }
[data-theme="light"] .midnight .user-search-wrap { color:#66758b; }
[data-theme="light"] .midnight #userSearch {
 min-height:46px;
 border-color:#d9e0e9;
 border-radius:12px;
 background:#fbfcfe;
 box-shadow:inset 0 1px 0 #fff,0 1px 2px rgba(24,39,64,.04);
 transition:border-color 160ms ease,box-shadow 180ms ease,background-color 160ms ease;
}
[data-theme="light"] .midnight #userSearch::placeholder { color:#718096; opacity:1; }
[data-theme="light"] .midnight #userSearch:hover { border-color:#c8d2df; background:#fff; }
[data-theme="light"] .midnight #userSearch:focus {
 border-color:#7398ce;
 background:#fff;
 box-shadow:0 0 0 3px rgba(54,108,187,.12),0 4px 14px rgba(24,54,96,.08);
}
[data-theme="light"] .midnight .conv-list.unread-only::after,
[data-theme="light"] .midnight .conv-list.groups-only::after { color:#687386; }
