:root {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #23332d;
    background: #f5f7f3;
    font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button, a.button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #78a98f; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
button, .button {
    border: 0;
    border-radius: 10px;
    background: #315d4a;
    color: #fff;
    font-weight: 650;
    padding: 12px 19px;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}
button:hover, .button:hover { background: #254c3b; }
button:disabled { opacity: .55; cursor: not-allowed; }
.shell { max-width: 1360px; margin: auto; padding: 32px 48px 56px; }
.topbar { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; min-height: 48px; margin-bottom: 30px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: #315d4a; color: #fff; }
.brand-mark svg { width: 25px; height: 25px; }
.topbar h1 { font-size: 17px; line-height: 1.2; letter-spacing: -.4px; }
.brand-subtitle { margin-top: 4px; color: #83918a; font-size: 11px; }
.eyebrow, .section-label { color: #80928a; font-size: 10px; font-weight: 750; letter-spacing: 1.25px; }
button.secondary { background: #fff; color: #53665b; border: 1px solid #e0e8e2; font-size: 13px; padding: 10px 16px; }
button.secondary:hover { background: #edf3ee; }

.chat-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: min(760px, calc(100dvh - 166px)); min-height: 580px; border: 1px solid #e2eae3; border-radius: 18px; background: #fff; box-shadow: 0 16px 48px #2c493b0c; overflow: hidden; }
.sidebar { min-height: 0; overflow-y: auto; background: #fafcf9; border-right: 1px solid #eaf0eb; padding: 24px 16px; }
.account { display: flex; align-items: center; gap: 18px; min-width: 0; }
.identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.identity strong, .conversation strong { display: block; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.identity small, .conversation small { display: block; color: #899a8f; font-size: 11px; font-weight: 400; margin-top: 4px; }
.avatar, .person-avatar, .message-avatar { object-fit: cover; }
.message-avatar { width: 25px; height: 25px; border-radius: 8px; align-self: center; }
.profile-editor { margin-bottom: 20px; padding: 22px; background: #fff; border: 1px solid #e2eae3; border-radius: 16px; }
.profile-editor h2 { font-size: 18px; }
.profile-editor > p { color: #7c8e82; font-size: 13px; margin: 8px 0 16px; }
.profile-editor form { display: grid; gap: 8px; max-width: 430px; }
.profile-editor label { font-size: 13px; font-weight: 700; margin-top: 8px; }
.profile-editor input:not([type=file]) { border: 1px solid #dfe9e0; border-radius: 9px; padding: 10px; }
.profile-editor small { color: #7c8e82; }
.profile-editor .profile-error { color: #a43c36; font-size: 13px; }
.profile-actions { display: flex; gap: 10px; margin-top: 12px; }
.conversation-tabs { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; padding: 5px; background: #edf2ed; border-bottom: 1px solid #e2eae3; }
.conversation-tab { min-width: 0; padding: 9px 5px; background: transparent; color: #6d8073; font-size: 11px; font-weight: 700; white-space: nowrap; }
.conversation-tab:hover { background: #e4ede5; }
.conversation-tab.active, .conversation-tab.active:hover { background: #fff; color: #315d4a; box-shadow: 0 1px 5px #284a3512; }
.avatar, .person-avatar, .conversation-icon { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; background: #dcebe1; color: #416d53; font-weight: 750; }
.person-avatar { background: #f0eee6; color: #83745c; }
.conversation-icon { background: #dcece0; color: #477a59; font-size: 20px; font-weight: 500; }
.section-label { display: flex; justify-content: space-between; align-items: center; margin: 25px 10px 10px; }
.count { display: grid; place-items: center; min-width: 23px; height: 23px; border-radius: 8px; background: #eff4ef; font-size: 10px; letter-spacing: 0; }
.conversation { display: flex; align-items: center; text-align: left; gap: 11px; width: 100%; padding: 10px; background: transparent; color: #43564a; }
.conversation:hover { background: #f0f5f0; }
.conversation.active { background: #eaf3ea; color: #294d39; }
.conversation .online-dot { margin-left: auto; flex-shrink: 0; }
.empty-users { color: #8c9a90; font-size: 12px; line-height: 1.5; padding: 8px 10px; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #70ae80; }
.online-dot.is-offline { background: #b7c1ba; }
.chat-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 23px 32px; border-bottom: 1px solid #eef2ee; }
.chat-heading h2 { font-size: 19px; letter-spacing: -.4px; margin-top: 6px; overflow-wrap: anywhere; }
.live { display: flex; flex-shrink: 0; gap: 7px; align-items: center; color: #568166; background: #eff7ef; border: 1px solid #e4f0e5; border-radius: 20px; padding: 7px 10px; font-size: 11px; font-weight: 700; }
.live.offline { color: #7d827e; background: #f2f3f2; border-color: #e8ebe8; }
.live.offline .online-dot { background: #a7afaa; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 32px; }
.empty-chat { display: grid; place-items: center; align-content: center; height: 100%; min-height: 260px; text-align: center; }
.empty-icon { display: grid; place-items: center; height: 64px; width: 64px; background: #eff6ee; border: 1px solid #e4f0e4; border-radius: 22px; color: #7da88a; font-size: 28px; margin-bottom: 20px; }
.empty-chat h3 { color: #42584a; font-size: 16px; letter-spacing: -.2px; margin-bottom: 8px; }
.empty-chat p { color: #91a096; font-size: 13px; line-height: 1.7; }
.message { margin-bottom: 22px; max-width: 80%; }
.message.own { margin-left: auto; }
.message-meta { display: flex; align-items: baseline; gap: 10px; font-size: 12px; margin-bottom: 7px; }
.message-meta time { color: #9caaa0; font-size: 11px; }
.message p { white-space: pre-wrap; overflow-wrap: anywhere; background: #f3f6f2; border-radius: 4px 14px 14px 14px; padding: 12px 15px; font-size: 14px; line-height: 1.55; }
.message.own p { background: #e8f2e7; border-radius: 14px 4px 14px 14px; }
.composer { display: flex; gap: 10px; margin: 0 32px; padding: 6px; border: 1px solid #dfe9e0; border-radius: 13px; box-shadow: 0 3px 12px #2f513508; }
.composer:focus-within { border-color: #95bca0; box-shadow: 0 0 0 3px #dcece0; }
.composer input { flex: 1; width: 0; border: 0; outline: 0; padding: 7px 10px; color: #293d30; background: transparent; }
.composer input::placeholder { color: #a1aea4; }
.composer button span { margin-left: 6px; }
.chat-footnote { color: #9aa89d; font-size: 11px; line-height: 1.5; padding: 12px 32px 21px; }
.connection-error { color: #a43c36; background: #fff4f1; border: 1px solid #f3d9d4; border-radius: 12px; padding: 13px 16px; font-size: 13px; line-height: 1.5; margin-top: 16px; }
.connection-error button { margin-top: 10px; }

.welcome { position: relative; max-width: 630px; margin: clamp(35px, 7vh, 80px) auto 0; padding: 54px 60px 40px; border: 1px solid #e5ece5; border-radius: 22px; background: #fff; box-shadow: 0 20px 60px #3756410b; }
.welcome-icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 30px; border-radius: 20px; background: #eaf4e9; color: #659978; }
.welcome-icon svg { width: 37px; height: 37px; }
.welcome h2 { color: #253b30; font-size: clamp(30px, 3.2vw, 40px); line-height: 1.18; letter-spacing: -1.5px; margin: 15px 0; }
.welcome-description { max-width: 420px; color: #7c8e82; font-size: 15px; line-height: 1.75; }
.signin-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin: 30px 0; }
.provider-button { display: flex; align-items: center; gap: 12px; width: min(100%, 340px); min-height: 50px; border: 1px solid #dfe9e0; background: #fff; color: #304a3a; font-size: 13px; }
.provider-button:hover { background: #f7faf6; border-color: #bed4c1; }
.provider-icon { display: grid; place-items: center; width: 18px; height: 18px; font-size: 17px; font-weight: 750; color: #496e56; }
.microsoft-icon { display: grid; flex: 0 0 18px; grid-template-columns: repeat(2, 8px); grid-template-rows: repeat(2, 8px); gap: 2px; }
.microsoft-icon i { background: #6b9777; }
.microsoft-icon i:nth-child(2) { background: #9cbda3; }
.microsoft-icon i:nth-child(3) { background: #b6cdb9; }
.microsoft-icon i:nth-child(4) { background: #7cab87; }
.button-arrow { margin-left: auto; color: #8ba596; font-size: 17px; }
.notice { color: #91682f; font-size: 13px; line-height: 1.5; }
.welcome-note { display: flex; gap: 12px; align-items: flex-start; padding-top: 23px; border-top: 1px solid #eef2ed; color: #6b8a73; font-size: 13px; font-weight: 650; line-height: 1.6; }
.welcome-note > span { font-size: 16px; }
.welcome-note p span { color: #9aa99e; font-size: 12px; font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.blazor-error-boundary { background: #b32121; color: white; padding: 1rem; }
.blazor-error-boundary::after { content: "An error has occurred."; }

@media (max-width: 700px) {
    .shell { padding: 22px 16px 30px; }
    .topbar { margin-bottom: 22px; }
    .chat-layout { grid-template-columns: 1fr; grid-template-rows: auto auto auto; height: auto; min-height: 0; }
    .sidebar { max-height: 235px; border-right: 0; border-bottom: 1px solid #e9eee7; padding: 16px; }
    .account { margin-left: auto; gap: 10px; }
    .section-label { margin-top: 16px; }
    .conversation { padding: 7px 10px; }
    .chat-panel { min-height: 480px; }
    .chat-heading, .messages { padding-left: 20px; padding-right: 20px; }
    .messages { min-height: 260px; max-height: 50vh; }
    .composer { margin: 0 20px; }
    .chat-footnote { padding-left: 20px; padding-right: 20px; }
    .welcome { margin-top: 30px; padding: 36px 26px 30px; }
    .welcome-icon { margin-bottom: 24px; }
    .welcome h2 { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
    button, .button { transition: none; }
}

/* Dark chat theme */
:root { color: #f2f1ff; background: #101027; }
body { background: radial-gradient(ellipse at 68% 80%, #252150 0, #151631 42%, #101027 78%); }
button, .button { background: #624ec5; color: #fff; }
button:hover, .button:hover { background: #7763d7; }
button:focus-visible, a:focus-visible, input:focus-visible { outline-color: #b7aaff; }
.shell { max-width: none; min-height: 100dvh; padding: 12px; }
.chat-app { position: relative; min-height: calc(100dvh - 24px); }
.chat-app .topbar { position: absolute; z-index: 2; top: 0; left: 0; right: 0; height: 100px; min-height: 0; margin: 0; padding: 0 24px; flex-wrap: nowrap; pointer-events: none; }
.chat-app .topbar > * { pointer-events: auto; }
.chat-app .brand { width: 240px; flex-shrink: 0; flex-direction: column; justify-content: center; gap: 5px; text-align: center; }
.brand-mark { width: 48px; height: 48px; border-radius: 17px; color: #d3b6ff; background: linear-gradient(140deg, #7255c9, #372966); box-shadow: 0 0 24px #a785e754; }
.brand-mark svg { width: 29px; height: 29px; }
.topbar h1 { font-size: 23px; letter-spacing: -.5px; color: #ded8ff; }
.brand-subtitle { color: #9691bf; font-size: 11px; }
.chat-app .brand-subtitle { display: none; }
.account { justify-content: flex-end; gap: 10px; }
.identity { gap: 9px; }
.identity strong, .conversation strong { color: #f1efff; font-size: 14px; }
.identity small, .conversation small { color: #a4a0c2; }
button.secondary { border-color: #464267; background: #272746; color: #e3dfff; }
button.secondary:hover { background: #3a3566; }
.avatar, .person-avatar, .message-avatar { object-fit: cover; border: 1px solid #c5bfff; border-radius: 50%; background: linear-gradient(135deg, #a274bd, #414983); color: #fff; }
.avatar { width: 38px; height: 38px; flex-basis: 38px; }
.chat-layout { display: grid; grid-template-columns: 276px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: calc(100dvh - 24px); min-height: 570px; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
.conversation-tabs { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; gap: 5px; padding: 142px 14px 0 4px; background: transparent; border: 0; }
.conversation-tab { display: flex; align-items: center; gap: 16px; width: 100%; padding: 12px 18px; border: 1px solid transparent; border-radius: 16px; color: #e4e0fa; background: transparent; font-size: 16px; text-align: left; }
.conversation-tab:hover { background: #29264b; }
.conversation-tab.active, .conversation-tab.active:hover { border-color: #7662df; background: linear-gradient(105deg, #39347b, #5545ae); color: #fff; box-shadow: inset 0 0 20px #9f8bff18; }
.tab-icon { width: 27px; height: 27px; flex: 0 0 27px; color: #b5aaf1; font-size: 31px; font-weight: 500; line-height: 27px; text-align: center; }
.conversation-tab.active .tab-icon { color: #fff; }
.sidebar { grid-column: 1; grid-row: 2; padding: 14px 14px 16px 4px; border: 0; background: transparent; }
.section-label { margin: 12px 14px 10px; color: #a19bd4; font-size: 14px; font-weight: 500; letter-spacing: 0; }
.count { min-width: 25px; height: 25px; color: #c1baf1; background: #302d53; border-radius: 50%; }
.conversation { gap: 12px; padding: 9px 14px; border-radius: 13px; color: #f0efff; }
.conversation:hover, .conversation.active { background: #29284b; color: #fff; }
.conversation-icon { width: 42px; height: 42px; flex-basis: 42px; border-radius: 50%; color: #c9bdff; background: #383165; }
.person-avatar-wrap { position: relative; display: block; flex: 0 0 42px; }
.person-avatar { display: grid; place-items: center; width: 42px; height: 42px; font-weight: 700; }
.online-dot { width: 9px; height: 9px; background: #52d785; }
.person-avatar-wrap .online-dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border: 2px solid #181731; border-radius: 50%; }
.online-dot.is-offline { background: #85849c; }
.empty-users { color: #a4a0c2; }
.chat-panel { grid-column: 2; grid-row: 1 / 3; position: relative; overflow: hidden; min-height: 0; border: 1px solid #343456; border-radius: 22px; background: linear-gradient(180deg, #111a36 0%, #171a3d 56%, #14182f 100%); box-shadow: 0 0 38px #6059bb2b; }
.chat-panel::before { content: ""; position: absolute; inset: 20% 0 0; background: url("/landscape.svg") center bottom / 100% auto no-repeat; pointer-events: none; }
.chat-panel > * { position: relative; }
.chat-heading { min-height: 104px; margin: 0 20px; padding: 20px 340px 20px 20px; gap: 16px; border-bottom: 1px solid #3b3a5b; }
.heading-title { display: flex; align-items: center; gap: 17px; }
.heading-icon { color: #8873e9; font-size: 43px; font-weight: 500; line-height: 1; }
.chat-heading h2 { margin: 0; color: #f5f4ff; font-size: 29px; line-height: 1.15; }
.heading-subtitle { margin-top: 5px; color: #b9b7d3; font-size: 14px; }
.live { color: #c7c4e3; background: #292a4b; border-color: #414064; font-size: 11px; }
.live.offline { color: #c7c4d2; background: #292a3c; border-color: #46445a; }
.messages { padding: 30px 34px; }
.empty-chat { min-height: 200px; }
.empty-icon { color: #c4b8ff; background: #35305e; border-color: #4b437a; }
.empty-chat h3 { color: #efedff; }
.empty-chat p { color: #c0b9dc; }
.message { display: flex; align-items: flex-start; gap: 15px; max-width: 82%; margin-bottom: 23px; }
.message.own { margin-left: auto; flex-direction: row-reverse; }
.message-avatar-wrap { flex: 0 0 48px; }
.message-avatar { display: grid; place-items: center; width: 48px; height: 48px; font-weight: 700; }
.message-content { min-width: 0; }
.message-meta { align-items: baseline; margin: 1px 5px 6px; color: #f7f5ff; font-size: 14px; }
.message.own .message-meta { justify-content: flex-end; }
.message-meta time { color: #aaa7c4; font-size: 12px; }
.message p { display: inline-block; padding: 10px 15px; border: 1px solid #4d4d70; border-radius: 16px; background: #303252e8; color: #f5f4ff; font-size: 15px; }
.message.own p { border-color: #7866df; border-radius: 16px; background: #5746b9eb; }
.composer { flex-shrink: 0; gap: 8px; margin: 0 20px 20px; padding: 6px; border: 1px solid #695bb8; border-radius: 20px; background: #282647ed; box-shadow: 0 4px 20px #0a0c264d; }
.composer:focus-within { border-color: #b0a1ff; box-shadow: 0 0 0 2px #8f7dee4d; }
.composer input { padding: 9px 14px; color: #f7f5ff; }
.composer input::placeholder { color: #aaa7c6; }
.composer button { display: grid; place-items: center; width: 56px; padding: 10px; border-radius: 15px; }
.composer button svg { width: 24px; height: 24px; }
.profile-editor { position: absolute; z-index: 5; top: 90px; right: 24px; width: min(440px, calc(100% - 48px)); max-height: calc(100dvh - 115px); overflow-y: auto; margin: 0; border-color: #55507d; background: #242342; box-shadow: 0 12px 50px #08091bbb; }
.profile-editor h2 { color: #fff; }
.profile-editor > p, .profile-editor small { color: #b9b6d3; }
.profile-editor input:not([type=file]) { border-color: #5a5680; background: #181932; color: #fff; }
.profile-editor .profile-error { color: #ffabae; }
.connection-error { position: relative; z-index: 6; color: #ffd2d4; background: #502b43; border-color: #86526c; }
.notice { color: #c9bffa; }
.chat-app > .notice { padding-top: 120px; }
.chat-app > .initial-error { top: 120px; }

.shell > .topbar { padding: 16px 24px; }
.shell > .topbar .brand { color: #f2f1ff; }
.welcome { border-color: #393659; background: #181a37; box-shadow: 0 20px 60px #08091b66; }
.welcome-icon { color: #c4b4ff; background: #38315e; }
.welcome h2 { color: #f6f4ff; }
.welcome-description, .welcome-note p span { color: #b5b2ce; }
.welcome-note { color: #c7bcfa; border-color: #3e3b5e; }
.provider-button { color: #f0eeff; border-color: #4a466d; background: #292746; }
.provider-button:hover { background: #38335f; border-color: #7568ae; }
.provider-icon, .button-arrow { color: #c9baff; }
.microsoft-icon i { background: #9c8bdf; }
.microsoft-icon i:nth-child(2) { background: #c6b7ef; }
.microsoft-icon i:nth-child(3) { background: #e3a8c9; }
.microsoft-icon i:nth-child(4) { background: #b391dd; }

@media (max-width: 900px) {
    .chat-app .topbar { position: relative; height: auto; min-height: 65px; padding: 8px 10px 18px; flex-wrap: wrap; gap: 12px; }
    .chat-app .brand { width: auto; flex-direction: row; gap: 10px; text-align: left; }
    .brand-mark { width: 40px; height: 40px; border-radius: 14px; }
    .topbar h1 { font-size: 19px; }
    .chat-layout { height: calc(100dvh - 100px); min-height: 500px; grid-template-columns: 220px minmax(0, 1fr); }
    .conversation-tabs { padding-top: 10px; }
    .chat-heading { padding-right: 20px; }
    .profile-editor { top: 70px; }
    .chat-app > .notice { padding-top: 13px; }
    .chat-app > .initial-error { top: 0; }
}
@media (max-width: 700px) {
    .shell { padding: 10px; }
    .chat-app .topbar { margin: 0; }
    .account { margin-left: auto; flex-wrap: wrap; gap: 7px; }
    .account .identity small { display: none; }
    .account button.secondary { padding: 8px 10px; font-size: 12px; }
    .chat-layout { display: flex; flex-direction: column; height: auto; min-height: 0; }
    .conversation-tabs { flex-direction: row; padding: 0 0 8px; }
    .conversation-tab { justify-content: center; padding: 8px; gap: 8px; font-size: 13px; }
    .tab-icon { width: 22px; height: 22px; flex-basis: 22px; font-size: 25px; line-height: 22px; }
    .sidebar { display: flex; flex-wrap: wrap; gap: 4px; max-height: 160px; padding: 0 0 8px; border: 0; }
    .section-label { width: 100%; margin: 6px 6px 2px; }
    .conversation { width: auto; padding: 6px 10px; }
    .conversation small { display: none; }
    .person-avatar-wrap, .person-avatar, .conversation-icon { width: 34px; height: 34px; flex-basis: 34px; }
    .chat-panel { min-height: 480px; height: max(480px, 64dvh); }
    .chat-heading { min-height: 76px; margin: 0 14px; padding: 14px 4px; }
    .chat-heading h2 { font-size: 22px; }
    .heading-icon { font-size: 34px; }
    .heading-subtitle { font-size: 12px; }
    .messages { min-height: 0; max-height: none; padding: 22px 15px; }
    .message { max-width: 93%; gap: 9px; }
    .message-avatar-wrap { flex-basis: 36px; }
    .message-avatar { width: 36px; height: 36px; }
    .composer { margin: 0 12px 12px; }
    .welcome { margin-top: 30px; padding: 36px 26px 30px; }
}
