.message-layout.account-layout { display:block; max-width:1320px; margin:16px auto 28px; }
.message-layout > .account-sidebar { padding:8px; border:0; background:transparent; margin-bottom:14px; }
.message-layout > .account-sidebar .account-nav { flex-direction:row; flex-wrap:wrap; gap:4px; }
.message-layout > .account-sidebar .account-nav a { padding:10px 16px; font-size:.9375rem; }
.message-layout > .account-sidebar a[aria-current="page"] { color:#0a66d9; background:#eaf2ff; box-shadow:none; }
.message-workspace { display:grid; grid-template-columns:330px minmax(0,1fr); height:min(820px,calc(100dvh - 200px)); min-height:520px; border:1px solid #e1e7ef; border-radius:22px; background:#fff; overflow:hidden; box-shadow:0 12px 40px #172f4406; }
.message-inbox { display:flex; flex-direction:column; min-height:0; min-width:0; border-right:1px solid #e8edf5; }
.message-inbox-head { padding:24px 20px 16px; flex-shrink:0; }
.message-inbox-title { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.message-workspace .message-inbox-title h1 { font-family:inherit; font-size:24px; font-weight:700; letter-spacing:-.04em; color:#152b45; margin:0; }
.message-inbox-title > span { display:grid; place-items:center; min-width:28px; min-height:28px; border-radius:10px; padding:2px 6px; background:#edf4ff; color:#0a66d9; font-size:.875rem; font-weight:700; }
.message-inbox-head > p { font-size:.875rem; color:#63758a; margin:8px 0 20px; }
.message-inbox #messageSearch { display:block; width:100%; min-width:0; box-sizing:border-box; border:1px solid #e3e9f2; border-radius:12px; background:#f7f9fc; padding:12px 14px; color:#152b45; font:inherit; font-size:.9375rem; min-height:44px; margin:0; }
.message-filters { display:flex; flex-wrap:wrap; gap:6px; margin-top:14px; }
.message-filters button { min-height:44px; border:1px solid transparent; border-radius:999px; padding:7px 14px; background:transparent; color:#465a70; font:600 .9375rem/1.4 'DM Sans',system-ui,sans-serif; cursor:pointer; }
.message-filters button[aria-pressed=true] { border-color:#dbe7fc; background:#edf4ff; color:#0a66d9; }
.message-inbox-scroll { flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:#ccd6e2 transparent; }
.message-inbox-hint { padding:12px 20px; margin:0; font-size:.875rem; color:#697b91; border-top:1px solid #eef2f6; line-height:1.5; }
.message-inbox-error { color:#a51d31; font-size:.875rem; line-height:1.5; margin:0; padding:0 20px; }
.message-inbox-error:not(:empty) { padding-top:12px; padding-bottom:12px; }
.message-workspace > .message-shell { border:0; border-radius:0; height:100%; min-height:0; }
.message-workspace .message-head { min-height:90px; box-sizing:border-box; }
.message-workspace :is(button,input,a,textarea):focus-visible { outline:3px solid #4a9eff; outline-offset:-3px; }
.message-welcome-shell { display:flex; flex-direction:column; }
.message-welcome-shell .message-head[hidden] { display:none; }
.message-welcome-shell #messageContent { flex:1; display:flex; min-height:0; background:linear-gradient(145deg,#fff,#f6f9fd); }
.message-welcome { text-align:center; margin:auto; padding:32px; max-width:420px; color:#6a7c91; }
.message-welcome-icon { display:grid; place-items:center; width:72px; height:72px; margin:0 auto 24px; border:1px solid #dce8f9; border-radius:24px; background:#edf4ff; color:#0a66d9; transform:rotate(-5deg); }
.message-welcome-icon svg { width:32px; height:32px; }
.message-welcome h2 { font-size:25px; line-height:1.35; letter-spacing:-.04em; color:#17324e; margin:0 0 16px; }
.message-welcome p { font-size:1rem; line-height:1.7; margin:0 0 40px; }
.message-welcome > span { font-size:.875rem; }
.message-list-empty { text-align:center; padding:36px 22px; color:#667b92; font-size:.9375rem; line-height:1.6; }
.message-list-empty strong { color:#23435f; }
.message-list-empty p { font-size:.875rem; }
.message-shell { background:#fff; border:1px solid #e1e7ef; border-radius:20px; overflow:hidden; min-width:0; }
.message-head { padding:24px; border-bottom:1px solid #e1e7ef; display:flex; align-items:center; gap:12px; }
.message-head :is(h1,h2) { margin:6px 0; font-size:24px; overflow-wrap:anywhere; }
.message-head p { color:#596779; margin:6px 0; }
.message-heading { min-width:0; flex:1; }
.message-avatar { width:44px; height:44px; flex-shrink:0; display:grid; place-items:center; border-radius:50%; background:#d8eaff; color:#15558f; font-weight:700; }
.message-list { display:grid; }
.message-thread-link { display:flex; align-items:center; gap:12px; padding:16px 20px; text-decoration:none; color:#152b45; border-bottom:1px solid #f1f4f8; transition:background .15s; min-width:0; }
.message-thread-link:hover { background:#f4f8ff; }
.message-thread-link[aria-current=page] { background:#edf4ff; box-shadow:inset 3px 0 #0a66d9; }
.message-list-avatar { display:grid; place-items:center; flex:0 0 42px; width:42px; height:42px; border-radius:15px; background:#edf1f7; color:#476581; font-size:1.125rem; font-weight:600; }
.message-thread-link.is-unread .message-list-avatar { background:#e3edff; color:#0a66d9; }
.message-thread-summary { display:block; min-width:0; flex:1; }
.message-thread-top,.message-thread-bottom { display:flex; justify-content:space-between; align-items:center; gap:8px; min-width:0; }
.message-thread-top strong { font-size:.9375rem; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.message-thread-top time { font-size:.875rem; color:#697b91; white-space:nowrap; flex-shrink:0; }
.message-thread-page { display:block; color:#6c7f95; font-size:.875rem; margin:4px 0 6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.message-thread-preview { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:#677991; font-size:.875rem; line-height:1.5; }
.message-thread-link.is-unread .message-thread-preview { color:#234665; font-weight:600; }
.message-thread-bottom .message-unread { font-size:.875rem; padding:2px 6px; margin:0; flex-shrink:0; }
[data-message-unread]:not([hidden]), .message-unread { display:inline-block; background:#0a66d9; color:white; border-radius:20px; padding:2px 8px; margin-left:8px; font-size:.875rem; }
.message-history { height: min(52vh,520px); min-height:160px; overflow:auto; overscroll-behavior:contain; padding:24px; display:flex; flex-direction:column; gap:16px; background:linear-gradient(160deg,#f8faff,#f3f5f8); scrollbar-width:thin; scrollbar-color:#ccd6e2 transparent; }
.message-bubble { align-self:flex-start; flex-shrink:0; background:#fff; border:1px solid #e6ebf2; border-radius:18px 18px 18px 5px; padding:12px 16px; max-width:85%; box-shadow:0 2px 6px #172f4406; font-size:1rem; line-height:1.55; }
.message-bubble.mine { align-self:flex-end; background:#e9f1ff; border-color:#dbe7fc; border-radius:18px 18px 5px 18px; }
.message-bubble p { margin:0 0 8px; white-space:pre-wrap; overflow-wrap:anywhere; }
.message-bubble small { display:block; font-size:.875rem; color:#60728b; text-align:right; }
.message-compose { padding:16px 20px; border-top:1px solid #edf0f5; background:#fff; }
.message-compose label { display:block; font-weight:600; margin-bottom:8px; }
.message-compose-row { display:flex; align-items:flex-end; gap:10px; }
.message-compose textarea { display:block; flex:1; width:100%; min-width:0; min-height:48px; max-height:120px; box-sizing:border-box; border:1px solid #dce3ed; border-radius:16px; background:#f8fafd; padding:12px 16px; font:inherit; font-size:1rem; line-height:22px; resize:none; margin:0; }
.message-compose .message-send { display:grid; place-items:center; flex:0 0 46px; width:46px; height:46px; min-height:46px; padding:0; border:0; border-radius:50%; font-size:23px; margin:0; background:#0a66d9; color:#fff; }
.message-compose .message-send:hover { background:#0857b8; }
.message-compose .message-send:disabled { opacity:.5; cursor:not-allowed; }
.message-send svg { width:21px; height:21px; }
.message-compose .brand-hint { margin:8px 0 0; font-size:.875rem; line-height:1.4; }
.message-notice { padding:12px 20px; margin:0; color:#526278; font-size:.9375rem; }
.message-error { color:#a51d31; }
.message-retry, .message-more { margin:12px 20px; }
.message-thread-shell { display:flex; flex-direction:column; height:min(800px,calc(100dvh - 150px)); min-height:420px; }
.message-thread-shell .message-head { background:#fff; color:#182f4b; flex-shrink:0; border-bottom:1px solid #edf0f5; }
.message-thread-shell .message-head :is(h1,h2) { font-family:inherit; font-size:18px; font-weight:600; margin:0; color:inherit; }
.message-thread-shell .message-head p { color:#677991; font-size:.875rem; margin:5px 0 0; }
.message-thread-shell .message-head a { color:#0a66d9; font-size:.875rem; display:inline-block; margin-bottom:8px; }
.message-thread-shell #messageContent { flex:1; min-height:0; display:flex; flex-direction:column; }
.message-thread-shell .message-history { height:auto; flex:1; min-height:80px; }
.message-thread-shell :is(.message-compose,.message-notice,.message-more,.message-retry) { flex-shrink:0; }
.message-thread-shell .message-notice { font-size:.875rem; line-height:1.4; padding:7px 16px; }
.message-thread-shell #messageStatus:not(.message-error) { background:#f8fafd; color:#677991; text-align:center; font-size:.875rem; letter-spacing:.02em; }
.message-thread-shell #messageStatus.message-error { background:#fff3f4; }
.message-thread-shell #messageAvailability { color:#65778d; text-align:center; padding-top:10px; padding-bottom:10px; background:#fff; }
.message-empty { margin:auto; padding:24px; max-width:320px; text-align:center; color:#526278; line-height:1.6; font-size:1rem; }
.message-empty strong { display:block; color:#183e53; font-size:18px; }
.message-empty button { margin:6px 4px; min-height:44px; }
.brand-chat-open { overflow:hidden; }
.brand-chat-dialog { position:fixed; inset:auto 28px 28px auto; margin:0; padding:0; border:1px solid #e6ecf5; border-radius:26px; width:440px; max-width:calc(100vw - 32px); max-height:none; color:#152b45; background:#fff; box-shadow:0 32px 100px #0e233b30,0 8px 24px #0e233b18; font-family:'DM Sans',system-ui,sans-serif; }
.brand-chat-dialog::backdrop { background:#11273d40; backdrop-filter:blur(3px); }
.brand-chat-host,.message-embedded { height:100%; min-height:0; }
.brand-chat-dialog .message-shell { border:0; border-radius:0; height:min(700px,calc(100dvh - 48px)); min-height:0; }
.brand-chat-dialog .message-head { padding:18px 64px 18px 18px; }
.brand-chat-dialog :is(button,a,textarea):focus-visible { outline:3px solid #4a9eff; outline-offset:2px; }
.message-close { position:absolute; z-index:1; right:14px; top:18px; width:40px; height:40px; display:grid; place-items:center; border:1px solid #e8edf4; border-radius:50%; background:#f7f9fc; color:#5a6c82; cursor:pointer; font:25px/1 system-ui,sans-serif; }
.message-close:hover { background:#eaf0f8; color:#193c65; }
.message-guest-compose { margin:12px 16px; padding:12px 18px; border:1px solid #dce5ed; border-radius:24px; display:flex; justify-content:space-between; color:#697b8b; background:#f8fafc; font-size:1rem; }
@media(max-width:600px) {
  .message-layout { margin:12px 0; }
  .message-head { padding:18px; }
  .message-history { padding:12px; }
  .message-bubble { max-width:90%; }
  .brand-chat-dialog { inset:0; width:100%; max-width:none; height:100dvh; border:0; border-radius:0; }
  .brand-chat-dialog .message-shell { height:100%; }
  .message-thread-shell { height:calc(100dvh - 120px); min-height:360px; }
  .message-compose { padding-bottom:max(12px,env(safe-area-inset-bottom)); }
}
@media(max-width:900px) {
  .message-workspace { grid-template-columns:280px minmax(0,1fr); }
  .message-inbox-head { padding:20px 16px 14px; }
  .message-thread-link { padding:16px 14px; gap:10px; }
}
@media(max-width:760px) {
  .message-layout.account-layout { margin:0 auto 16px; }
  .message-layout > .account-sidebar { margin-bottom:8px; padding:0; }
  .message-layout > .account-sidebar .account-nav a { padding:10px 12px; }
  .message-workspace { grid-template-columns:minmax(0,1fr); height:calc(100dvh - 175px); min-height:380px; border-radius:16px; }
  .message-workspace:not(.has-thread) > .message-shell { display:none; }
  .message-workspace.has-thread > .message-inbox { display:none; }
  .message-inbox { border-right:0; }
  .message-workspace .message-head { padding:16px; min-height:84px; }
}
.brand-page .brand-page-top { display:flex; justify-content:flex-end; align-items:center; gap:10px; max-width:580px; margin:0 auto 24px; }
.brand-page .brand-message { display:inline-flex; align-items:center; justify-content:center; width:46px; height:46px; min-height:46px; flex-shrink:0; padding:0; border:1px solid var(--brand-line); border-radius:50%; background:var(--brand-card); color:var(--brand-ink); cursor:pointer; box-shadow:0 2px 6px #00000008; }
.brand-message svg { width:20px; height:20px; flex-shrink:0; }
.brand-page .brand-message:hover:not(:disabled) { box-shadow:0 4px 12px #00000014; border-color:currentColor; }
.brand-page .brand-message:disabled { opacity:.65; cursor:default; }
.message-page-filter { margin-top:12px; }
.message-page-filter label { display:block; font-size:.875rem; margin-bottom:5px; }
.message-page-filter select { width:100%; min-width:0; min-height:44px; padding:8px 10px; border:1px solid #d8d5d0; border-radius:12px; background:#fff; color:var(--text); font:inherit; font-size:.9375rem; }
.message-thread-tags { display:flex; flex-wrap:wrap; gap:5px; margin:4px 0 7px; }
.message-thread-tags span { border-radius:6px; padding:2px 6px; font-size:.875rem; line-height:1.4; background:#f0eafa; color:#562194; }
.message-management { flex-shrink:0; padding:12px 20px; border-bottom:1px solid var(--line); background:#fff; max-height:40%; overflow-y:auto; }
.message-management-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.message-management button { min-height:44px; padding:8px 12px; border:1px solid #d8d5d0; border-radius:999px; background:#fff; color:var(--text); font:inherit; font-size:.875rem; cursor:pointer; }
.message-management button[aria-pressed=true] { background:#eee7f6; color:#562194; border-color:#c5abdf; }
.message-management button:disabled { opacity:.6; cursor:wait; }
#messageWorkflow { font-size:.875rem; color:var(--muted); margin-left:auto; }
.message-management details { margin-top:8px; }
.message-management summary { cursor:pointer; font-size:.9375rem; padding:6px 0; }
.message-management summary span { color:var(--muted); font-size:.875rem; margin-left:6px; }
.message-management textarea { display:block; box-sizing:border-box; width:100%; min-height:80px; resize:vertical; border:1px solid #d8d5d0; background:#f5f4f2; color:var(--text); padding:10px; border-radius:12px; font:inherit; font-size:1rem; }
.message-notes-footer { display:flex; align-items:center; gap:8px; margin-top:8px; }
.message-notes-footer span { flex:1; font-size:.875rem; color:var(--muted); }
#messageManagementStatus { margin:6px 0 0; font-size:.875rem; color:var(--muted); }
#messageManagementStatus:empty { display:none; }
#messageManagementStatus.message-error { color:#a51d31; }
.message-inbox [hidden] { display:none !important; }
.message-inbox-head > .message-workflow-hint { margin:10px 0 0; font-size:.875rem; line-height:1.5; color:var(--muted); }
