:root {
    --dark: #101f31;
    --dark-2: #15283c;
    --ink: #162738;
    --muted: #778597;
    --mint: #b5eed9;
    --mint-strong: #68cfab;
    --light: #f5f7f9;
    --line: #e7ecf0;
    --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; font-size: 15px; line-height: 27px; -webkit-font-smoothing: antialiased; color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: #308a76; text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #6fcead; outline-offset: 3px; }

/* Authentication */
.auth-page { background: #eef2f4; }
.auth-container { min-height: 100vh; display: flex; }
.auth-aside { position: relative; width: 53%; padding: 48px 6%; background: var(--dark); color: white; overflow: hidden; display: flex; flex-direction: column; }
.auth-aside::before { content: ""; position: absolute; width: 640px; height: 640px; border-radius: 50%; background: radial-gradient(circle, rgba(56,145,139,0.3), rgba(16,31,49,0) 68%); right: -250px; bottom: -240px; pointer-events: none; }
.auth-aside::after { content: ""; position: absolute; width: 400px; height: 400px; border-radius: 50%; border: 1px solid rgba(193,255,230,0.11); right: -180px; bottom: -150px; pointer-events: none; }
.auth-brand, .side-brand, .mobile-brand { display: flex; align-items: center; gap: 11px; font-size: 20px; line-height: 32px; font-weight: 700; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; height: 37px; width: 37px; border-radius: 10px; background: var(--mint); color: #142c30; font-size: 26px; line-height: 27px; font-weight: 700; flex-shrink: 0; }
.auth-copy { position: relative; margin-top: auto; margin-bottom: 35px; max-width: 560px; }
.eyebrow { color: #549f8c; font-size: 12px; line-height: 24px; font-weight: 700; }
.auth-aside .eyebrow { color: var(--mint); }
.auth-copy h1 { font-size: 55px; line-height: 67px; font-weight: 600; margin: 20px 0 22px; }
.auth-copy p { color: #acbecb; font-size: 17px; line-height: 29px; max-width: 420px; margin: 0; }
.auth-decoration { margin-bottom: auto; min-height: 220px; position: relative; }
.demo-message { max-width: 305px; border: 1px solid rgba(255,255,255,0.1); padding: 18px 22px; border-radius: 18px; font-size: 15px; line-height: 27px; backdrop-filter: blur(15px); position: absolute; box-shadow: 0 18px 45px rgba(0,0,0,0.13); }
.demo-message span { display: block; font-size: 11px; line-height: 19px; opacity: 0.58; text-align: right; }
.demo-message-first { top: 25px; left: 2%; background: #294054; color: #f3fff8; border-bottom-left-radius: 4px; }
.demo-message-second { top: 115px; right: 2%; background: #c8f4e3; color: #12322f; border-bottom-right-radius: 4px; }
.auth-panel { background: white; width: 47%; display: flex; align-items: center; justify-content: center; padding: 55px 45px; }
.auth-panel-inner { max-width: 440px; width: 100%; }
.mobile-brand { display: none; }
.auth-panel h2 { margin: 12px 0 7px; font-size: 35px; line-height: 47px; font-weight: 650; }
.auth-subtitle { color: #738295; margin: 0 0 38px; }
.auth-subtitle a { font-weight: 650; }
.auth-form { display: flex; flex-direction: column; }
.auth-form label { font-weight: 650; font-size: 14px; line-height: 26px; margin-bottom: 8px; }
.auth-form input { width: 100%; border: 1px solid #e0e6eb; background: #f9fafb; padding: 15px 17px; height: 56px; border-radius: var(--radius); color: var(--ink); outline: none; margin-bottom: 22px; transition: border-color 0.15s, background 0.15s; }
.auth-form input:focus { border-color: #55bd9f; background: white; }
.auth-form input::placeholder { color: #9ba7b2; }
.primary-button { border: none; background: var(--dark); color: white; width: 100%; display: flex; align-items: center; justify-content: space-between; border-radius: var(--radius); padding: 15px 19px; font-weight: 650; margin-top: 6px; min-height: 57px; }
.primary-button:hover { background: #20394f; }
.primary-button span { font-size: 21px; }
.form-footnote { margin-top: 30px; font-size: 12px; line-height: 24px; color: #9aa6b1; text-align: center; }
.form-alert { border-radius: 8px; background: #fff2ed; border: 1px solid #f6cabc; color: #a24529; padding: 12px 15px; margin-bottom: 22px; font-size: 14px; line-height: 26px; }

/* Chat layout */
.chat-page { background: var(--dark); }
.chat-app { display: flex; height: 100vh; height: 100dvh; min-height: 460px; width: 100%; }
.chat-sidebar { width: 374px; min-width: 310px; max-width: 410px; flex: 0 0 30%; background: var(--dark); color: #f4f8fc; display: flex; flex-direction: column; }
.sidebar-top { padding: 30px 22px 24px; }
.side-brand { font-size: 19px; line-height: 31px; }
.side-brand .brand-mark { height: 34px; width: 34px; border-radius: 9px; font-size: 23px; }
.brand-dot { height: 5px; width: 5px; border-radius: 50%; margin-left: -6px; margin-top: -13px; background: var(--mint-strong); }
.section-header { margin-top: 43px; margin-bottom: 27px; display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; }
.small-overline { color: #8ca6b2; font-size: 10px; line-height: 22px; font-weight: 650; }
.section-header h1 { margin: 3px 0 0; font-size: 30px; line-height: 42px; font-weight: 650; }
.title-dot { color: var(--mint-strong); }
.chat-icon { border: 1px solid #3d5260; border-radius: 50%; height: 37px; width: 37px; color: var(--mint); display: inline-flex; align-items: center; justify-content: center; font-size: 23px; }
.search-box { display: flex; height: 47px; border: 1px solid #34495c; background: #192e41; border-radius: var(--radius); align-items: center; gap: 12px; color: #87a0ae; padding: 0 14px; }
.search-box:focus-within { border-color: #7bc9ad; }
.search-box input { min-width: 0; flex: 1; width: 100%; color: white; background: transparent; border: 0; padding: 12px 0; outline: none; font-size: 13px; line-height: 25px; }
.search-box input::placeholder { color: #849aaa; }
.search-box input::-webkit-search-cancel-button { filter: invert(1); }
.search-shortcut { color: #698496; font-size: 22px; }
.sidebar-scroll { overflow-y: auto; min-height: 0; flex: 1; padding-bottom: 14px; scrollbar-color: #354c5b transparent; scrollbar-width: thin; }
.list-section { margin-top: 3px; }
.list-title { display: flex; align-items: center; justify-content: space-between; color: #8ea1b2; font-size: 11px; line-height: 23px; font-weight: 700; padding: 7px 26px 13px; }
.count-label { color: #9db5b9; border: 1px solid #314b55; border-radius: 6px; min-width: 24px; padding: 0 5px; text-align: center; }
.live-indicator { width: 7px; height: 7px; background: #7cd9b6; border-radius: 50%; }
.people-section { margin-top: 28px; }
.people-list { display: flex; flex-direction: column; gap: 3px; padding: 0 12px; }
.person-item { display: flex; align-items: center; width: 100%; border: 1px solid transparent; background: transparent; text-align: left; color: white; border-radius: var(--radius); padding: 12px 12px; gap: 12px; min-height: 71px; }
.person-item:hover { background: #1e3549; }
.person-item.selected { background: #294155; border-color: #35576a; }
.avatar { flex-shrink: 0; display: inline-flex; justify-content: center; align-items: center; border-radius: 50%; font-weight: 650; }
.avatar-list { width: 43px; height: 43px; font-size: 16px; line-height: 28px; background: #375d65; color: #e3fef0; }
.person-item:nth-child(3n+2) .avatar-list { background: #565278; color: #fff0ff; }
.person-item:nth-child(3n+3) .avatar-list { background: #785c55; color: #fff0ea; }
.person-copy { display: flex; flex-direction: column; overflow: hidden; min-width: 0; flex: 1; }
.person-name { font-weight: 650; font-size: 14px; line-height: 25px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.person-preview { font-size: 12px; line-height: 23px; color: #91a5b6; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.person-meta { display: flex; align-items: flex-end; align-self: stretch; flex-direction: column; justify-content: center; gap: 4px; }
.last-time { font-size: 10px; line-height: 20px; color: #97a8b6; white-space: nowrap; }
.unread-badge { display: flex; align-items: center; justify-content: center; background: var(--mint); color: #164236; font-weight: 700; font-size: 10px; min-width: 20px; height: 20px; border-radius: 12px; padding: 0 5px; }
.person-arrow { color: #7799a4; font-size: 16px; padding: 0 5px; }
.list-loading, .empty-list { font-size: 12px; line-height: 24px; color: #889daf; padding: 8px 14px; }
.sidebar-profile { margin-top: auto; background: #14293b; border-top: 1px solid #263f50; display: flex; gap: 12px; align-items: center; padding: 17px 23px; }
.avatar-me { width: 40px; height: 40px; font-size: 16px; line-height: 28px; color: #214535; background: var(--mint); }
.profile-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.profile-copy strong { font-weight: 650; font-size: 13px; line-height: 24px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.profile-copy span { color: #9aafbe; font-size: 11px; line-height: 20px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.logout-btn { border: 1px solid #344a5b; background: #1b3447; color: #b6c7d0; border-radius: var(--radius); width: 37px; height: 37px; display: flex; align-items: center; justify-content: center; }
.logout-btn:hover { color: white; background: #29485d; }

/* Chat detail */
.chat-main { min-width: 0; flex: 1; background: #f6f8f8; display: flex; flex-direction: column; position: relative; }
.empty-chat { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 35px; position: relative; overflow: hidden; }
.empty-illustration { position: relative; height: 175px; width: 225px; margin-bottom: 32px; }
.empty-bubble { display: block; position: absolute; border-radius: 24px; box-shadow: 0 20px 50px rgba(19,59,60,0.06); }
.empty-bubble-one { background: #d9f4e8; height: 116px; width: 155px; transform: rotate(-13deg); top: 20px; left: 9px; }
.empty-bubble-two { background: #223c4a; height: 100px; width: 137px; top: 55px; right: 3px; border-radius: 25px 25px 5px 25px; font-size: 45px; line-height: 100px; color: #bbf6df; transform: rotate(11deg); }
.empty-bubble-three { background: #a6e5cb; width: 35px; height: 35px; top: 5px; right: 11px; border-radius: 50%; }
.empty-chat h2 { font-size: 37px; line-height: 49px; font-weight: 650; margin: 17px 0 16px; }
.empty-chat h2 em { font-style: normal; color: #3eae8e; }
.empty-chat p { font-size: 15px; line-height: 27px; color: #7d8996; max-width: 370px; margin: 0; }
.empty-bottom { position: absolute; bottom: 32px; color: #a3afb3; font-size: 10px; line-height: 22px; font-weight: 650; }
.empty-bottom span { color: #3da987; margin: 0 10px; }
.active-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-header { min-height: 91px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--line); padding: 19px 34px; background: #fff; }
.avatar-header { height: 49px; width: 49px; color: #29574d; background: #c8eee0; font-size: 19px; line-height: 31px; }
.chat-person { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.chat-person strong { font-size: 17px; line-height: 29px; font-weight: 650; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-person span { font-size: 12px; line-height: 23px; color: #8693a0; }
.chat-header-tag { background: #edf8f3; border: 1px solid #d9f1e6; border-radius: 20px; color: #519f83; font-size: 11px; line-height: 22px; font-weight: 650; padding: 6px 12px; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.status-spark { width: 6px; height: 6px; background: #68c99c; border-radius: 50%; }
.mobile-back { display: none; }
.messages-viewport { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; scrollbar-color: #c4cecc transparent; scrollbar-width: thin; }
.messages-content { margin-top: auto; padding: 30px 45px 35px; min-height: min-content; width: 100%; }
.message-list { width: 100%; display: flex; flex-direction: column; gap: 17px; }
.message-row { display: flex; max-width: 100%; }
.message-row.mine { justify-content: flex-end; }
.message-row.theirs { justify-content: flex-start; }
.message-bubble { display: flex; flex-direction: column; gap: 7px; max-width: 73%; min-width: 85px; padding: 14px 17px 10px; border-radius: 16px 16px 16px 4px; background: #fff; border: 1px solid #e9eeee; box-shadow: 0 5px 17px rgba(18,51,61,0.03); }
.mine .message-bubble { background: #d8f3e6; border-color: #d8f3e6; border-radius: 16px 16px 4px 16px; }
.bubble-text { color: #233947; font-size: 14px; line-height: 26px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-time { align-self: flex-end; color: #879697; font-size: 10px; line-height: 18px; }
.mine .bubble-time { color: #5d9b86; }
.load-more { display: block; border: 1px solid #dce9e4; background: white; color: #448a73; font-size: 12px; font-weight: 650; border-radius: 8px; padding: 9px 15px; margin: 0 auto 30px; }
.load-more:hover { background: #edf9f3; }
.no-messages { color: #8b9a9e; display: flex; align-items: center; justify-content: center; flex-direction: column; min-height: 300px; gap: 6px; text-align: center; font-size: 13px; line-height: 25px; }
.no-messages strong { color: #526d70; font-size: 18px; line-height: 30px; }
.first-message-icon { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; background: #dff7ed; color: #57b18f; border-radius: 50%; font-size: 29px; margin-bottom: 12px; }
.composer-wrap { border-top: 1px solid #e7edef; background: #fff; padding: 19px 37px 17px; }
.composer-field { border: 1px solid #e2e9e9; background: #f8fafa; border-radius: 12px; padding: 9px 10px 9px 19px; display: flex; align-items: flex-end; gap: 10px; }
.composer-field:focus-within { border-color: #8bd7b9; }
.composer-field textarea { border: 0; background: transparent; outline: none; resize: none; flex: 1; min-height: 27px; max-height: 140px; padding: 9px 0; color: #263d46; font-size: 14px; line-height: 26px; }
.composer-field textarea::placeholder { color: #96a3aa; }
.send-button { background: #1a3a3c; border: 0; height: 43px; width: 43px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: #d0f5e6; flex-shrink: 0; }
.send-button:hover { background: #285f57; }
.send-button:disabled { opacity: 0.5; cursor: wait; }
.composer-hint { padding-top: 9px; display: flex; justify-content: space-between; gap: 20px; font-size: 10px; line-height: 20px; color: #9eabad; }
.composer-hint b { font-weight: 650; color: #647c80; }
.toast { position: fixed; z-index: 30; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: 90%; background: #182f41; color: white; padding: 13px 20px; box-shadow: 0 15px 45px rgba(0,0,0,0.2); border-radius: 8px; font-size: 13px; line-height: 25px; }

@media (max-width: 1240px) {
    .auth-copy h1 { font-size: 47px; line-height: 59px; }
    .chat-sidebar { flex: 0 0 342px; width: 342px; }
    .messages-content { padding-left: 34px; padding-right: 34px; }
}
@media (max-width: 992px) {
    .auth-aside { padding: 40px; }
    .auth-panel { padding: 35px; }
    .auth-copy h1 { font-size: 39px; line-height: 51px; }
    .chat-sidebar { min-width: 305px; width: 305px; flex-basis: 305px; }
    .sidebar-top { padding-left: 18px; padding-right: 18px; }
    .chat-header { padding-left: 23px; padding-right: 23px; }
    .messages-content { padding-left: 24px; padding-right: 24px; }
    .composer-wrap { padding-left: 22px; padding-right: 22px; }
    .chat-header-tag { display: none; }
}
@media (max-width: 767px) {
    body { font-size: 15px; line-height: 25px; }
    .auth-container { flex-direction: column; }
    .auth-aside { display: none; }
    .auth-panel { width: 100%; min-height: 100vh; padding: 35px 22px; }
    .mobile-brand { display: flex; margin-bottom: 65px; }
    .auth-panel h2 { font-size: 28px; line-height: 38px; }
    .auth-subtitle { margin-bottom: 30px; }
    .chat-sidebar { flex: 1; width: 100%; max-width: none; min-width: 0; }
    .chat-main { display: none; }
    .chat-app.chat-open .chat-sidebar { display: none; }
    .chat-app.chat-open .chat-main { display: flex; }
    .chat-header { min-height: 77px; padding: 12px 17px; gap: 9px; }
    .mobile-back { display: inline-flex; height: 42px; width: 33px; align-items: center; justify-content: flex-start; flex-shrink: 0; background: transparent; border: 0; color: #28434a; }
    .avatar-header { height: 43px; width: 43px; font-size: 17px; }
    .chat-person strong { font-size: 15px; line-height: 25px; }
    .chat-person span { font-size: 11px; line-height: 21px; }
    .messages-content { padding: 19px 15px 25px; }
    .message-list { gap: 13px; }
    .message-bubble { max-width: 86%; padding: 10px 13px 8px; }
    .bubble-text { font-size: 14px; line-height: 24px; }
    .composer-wrap { padding: 11px 13px 9px; }
    .composer-field { padding-left: 12px; }
    .composer-hint { justify-content: center; }
    .composer-hint span:nth-child(2) { display: none; }
    .sidebar-top { padding-top: 24px; }
    .section-header { margin-top: 34px; }
}
@media (max-width: 567px) {
    .auth-panel { padding: 25px 20px; align-items: flex-start; }
    .auth-panel-inner { padding-top: 5px; }
    .mobile-brand { margin-bottom: 58px; }
    .sidebar-profile { padding: 15px 18px; }
    .empty-bottom { display: none; }
}
