:root {
    --bg: #f3f5f7;
    --white: #ffffff;
    --soft: #f7f8fa;
    --line: #e4e8ec;
    --text: #20242a;
    --muted: #858c95;
    --green: #19b394;
    --green-soft: #e8f7f3;
    --blue: #3c82ef;
    --red: #ef5266;
    --rail: 66px;
    --list: 365px;
}
* { box-sizing: border-box; }
html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
}
body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Avatars */
.user-avatar {
    width: 43px;
    height: 43px;
    flex: 0 0 auto;
    border-radius: 50%;
    overflow: hidden;
    background: #e8ebef;
    color: #555d66;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
}
.user-avatar.small { width: 36px; height: 36px; font-size: 10px; }
.user-avatar.large { width: 50px; height: 50px; }
.user-avatar.profile-large {
    width: 88px;
    height: 88px;
    font-size: 24px;
    box-shadow: 0 0 0 5px white;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Auth */
.auth-page {
    min-height: 100vh;
    padding: 30px 18px;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 80% 5%, #e8faf5, transparent 25%), #f4f6f8;
}
.auth-box { width: min(430px, 100%); text-align: center; }
.pulse-logo, .logo-button, .placeholder-logo, .created-check {
    background: linear-gradient(145deg, #3aa5fa, #19b394);
    color: white;
}
.pulse-logo {
    width: 62px; height: 62px; margin: 0 auto 15px; border-radius: 18px;
    display: grid; place-items: center; font-size: 24px; font-weight: 900;
    box-shadow: 0 12px 32px rgba(40,130,140,.15);
}
.auth-box h1 { margin: 0; font-size: 28px; letter-spacing: -.6px; }
.auth-box > p { color: var(--muted); font-size: 11px; margin: 6px 0 23px; }
.auth-card {
    background: white; border: 1px solid var(--line); border-radius: 17px;
    padding: 18px; box-shadow: 0 18px 50px rgba(30,45,60,.06);
}
.auth-tabs {
    display: grid; grid-template-columns: 1fr 1fr; padding: 4px; gap: 4px;
    border-radius: 10px; background: #f2f4f6; margin-bottom: 14px;
}
.auth-tab {
    border: 0; background: transparent; color: #8b929a; padding: 10px;
    border-radius: 8px; font-weight: 700;
}
.auth-tab.active {
    color: #2a2e33; background: white; box-shadow: 0 2px 9px rgba(0,0,0,.05);
}
.auth-form { display: none; }
.auth-form.active { display: grid; gap: 10px; }
.auth-form input, .auth-form select,
.support-form input, .support-form textarea, .ticket-reply input {
    width: 100%; border: 1px solid var(--line); background: white; color: var(--text);
    border-radius: 10px; padding: 12px 13px; outline: none;
}
.auth-form input:focus, .auth-form select:focus,
.support-form input:focus, .support-form textarea:focus { border-color: #aeb6be; }
.auth-form > button, .primary-wide, .support-form button, .ticket-reply button {
    border: 0; border-radius: 10px; padding: 12px 14px; color: white;
    background: var(--green); font-weight: 750;
}
.phone-field { display: grid; grid-template-columns: 1.08fr 1fr; gap: 7px; }
.form-note {
    color: var(--muted); text-align: left; line-height: 1.5;
    font-size: 9px; margin: 1px 2px 3px;
}
.forgot-link {
    color: var(--green); text-align: center; font-size: 9px;
    font-weight: 700; padding-top: 3px;
}
.alert, .inline-error {
    color: #d44356; border: 1px solid #ffd4da; background: #fff1f3;
}
.success-alert {
    color: #187d69; border: 1px solid #c9ebe3; background: #eaf8f4;
}
.alert, .success-alert {
    padding: 10px; border-radius: 9px; font-size: 10px; margin: 0 0 11px;
}
.inline-error { border-radius: 10px; padding: 10px 12px; font-size: 10px; margin: 12px 0; }

/* Account created */
.account-created-page {
    min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #f4f6f8;
}
.created-card {
    width: min(520px, 100%); background: white; border: 1px solid var(--line);
    border-radius: 20px; padding: 31px; text-align: center;
    box-shadow: 0 20px 55px rgba(25,40,55,.07);
}
.created-check {
    width: 55px; height: 55px; border-radius: 17px; display: grid;
    place-items: center; margin: auto; font-size: 24px; font-weight: 800;
}
.created-card > span {
    display: block; color: var(--green); letter-spacing: 1.3px;
    font-size: 8px; font-weight: 800; margin-top: 17px;
}
.created-card h1 { margin: 5px 0 8px; font-size: 25px; }
.created-card > p { color: var(--muted); font-size: 10px; line-height: 1.6; }
.pulse-id-card, .pulse-id-row {
    display: flex; align-items: center; justify-content: space-between; gap: 15px;
    border: 1px solid #cfece5; background: var(--green-soft); border-radius: 12px;
}
.pulse-id-card { padding: 14px; margin: 22px 0 10px; }
.pulse-id-card strong, .pulse-id-row strong { color: #167b68; letter-spacing: 1.2px; }
.pulse-id-card button, .pulse-id-row button {
    border: 0; background: white; color: #247967; border-radius: 8px;
    padding: 8px 10px; font-size: 8px; font-weight: 700;
}
.created-note { color: #7d858d; font-size: 9px; line-height: 1.55; margin: 11px 0 21px; }
.primary-wide { display: block; }

/* Shell */
.app-body { overflow: hidden; }
.app-shell { height: 100vh; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); }
.app-rail {
    background: white; border-right: 1px solid var(--line); display: flex;
    flex-direction: column; align-items: center; padding: 13px 0;
}
.logo-button {
    width: 40px; height: 40px; margin-bottom: 25px; display: grid;
    place-items: center; border-radius: 12px; font-weight: 900;
}
.app-rail nav { display: grid; gap: 9px; }
.app-rail nav a {
    width: 43px; height: 43px; display: grid; place-items: center;
    border-radius: 12px; color: #a0a6ad; position: relative;
}
.app-rail nav a:hover { background: #f5f7f8; color: #636a72; }
.app-rail nav a.active { color: var(--green); background: var(--green-soft); }
.app-rail nav a b {
    position: absolute; right: -3px; top: -2px; min-width: 17px; height: 17px;
    border-radius: 99px; display: grid; place-items: center; background: var(--red);
    color: white; font-size: 7px; border: 2px solid white;
}
.workspace { min-width: 0; min-height: 0; }
.mobile-nav { display: none; }

/* Messenger */
.messenger { height: 100vh; display: grid; grid-template-columns: var(--list) minmax(0, 1fr); }
.chat-list-panel {
    min-width: 0; min-height: 0; background: white; border-right: 1px solid var(--line);
    display: flex; flex-direction: column;
}
.chat-list-header { padding: 12px 13px 11px; }
.server-switch {
    display: grid; grid-template-columns: 35px 1fr 17px; gap: 9px; align-items: center;
    min-height: 48px; padding: 5px 6px; border-radius: 10px;
}
.server-switch:hover { background: #f7f8f9; }
.server-switch > div {
    width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px;
    color: var(--green); background: var(--green-soft); font-weight: 800;
}
.server-switch strong, .server-switch small { display: block; }
.server-switch strong { font-size: 10px; }
.server-switch small { color: var(--muted); font-size: 8px; margin-top: 2px; }
.server-switch svg { width: 15px; color: #9da3aa; }
.messages-title {
    display: flex; align-items: center; justify-content: space-between; padding: 12px 5px 9px;
}
.messages-title h1 { margin: 0; font-size: 23px; letter-spacing: -.6px; }
.messages-title a {
    width: 30px; height: 30px; display: grid; place-items: center;
    border: 1px solid var(--line); border-radius: 50%; color: #656c74; font-size: 20px;
}
.search {
    height: 37px; padding: 0 10px; display: flex; align-items: center;
    border-radius: 9px; background: #f1f3f5;
}
.search svg { width: 15px; color: #9ca2a9; }
.search input {
    flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
    padding: 0 8px; color: var(--text); font-size: 11px;
}
.conversation-list {
    flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin;
    scrollbar-color: #dde1e5 transparent;
}
.conversation-row {
    min-height: 63px; padding: 8px 12px; display: grid;
    grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center;
    border-bottom: 1px solid #f1f2f4;
}
.conversation-row:hover { background: #fafbfc; }
.conversation-row.active { background: #eff8f5; }
.conversation-avatar-wrap { width: 43px; height: 43px; position: relative; }
.bot-mini {
    position: absolute; right: -5px; bottom: -3px; color: var(--green);
    background: var(--green-soft); border: 1px solid #caebe3; border-radius: 5px;
    padding: 2px 3px; font-size: 6px; font-weight: 900;
}
.channel-avatar {
    width: 43px; height: 43px; display: grid; place-items: center; border-radius: 12px;
    color: var(--green); background: var(--green-soft); font-size: 18px; font-weight: 800;
}
.channel-avatar.small { width: 36px; height: 36px; font-size: 15px; }
.conversation-copy { min-width: 0; }
.conversation-top, .conversation-bottom {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.conversation-top strong {
    min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px;
}
.conversation-top strong em, .person-copy strong em, .header-person strong em {
    color: var(--green); background: var(--green-soft); border-radius: 4px;
    padding: 2px 4px; margin-left: 3px; font-size: 6px; font-style: normal;
}
.conversation-top time { color: #a0a5ab; font-size: 8px; }
.conversation-bottom { margin-top: 4px; }
.conversation-bottom > span {
    min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    color: var(--muted); font-size: 9px;
}
.conversation-bottom b {
    min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center;
    border-radius: 99px; color: white; background: var(--red); font-size: 8px;
}
.empty-conversations { padding: 60px 25px; text-align: center; }
.empty-conversations strong, .empty-conversations span { display: block; }
.empty-conversations strong { font-size: 11px; }
.empty-conversations span { color: var(--muted); font-size: 9px; margin-top: 5px; line-height: 1.5; }

/* Chat */
.conversation-view {
    min-width: 0;
    min-height: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f5f7f9;
}
.conversation-header {
    flex: 0 0 58px;
    background: white; border-bottom: 1px solid var(--line); display: flex;
    align-items: center; padding: 0 14px;
}
.mobile-back { display: none; }
.header-person { display: flex; align-items: center; gap: 10px; }
.header-person > span > strong, .header-person > span > small { display: block; }
.header-person > span > strong { font-size: 11px; }
.header-person > span > small { color: var(--muted); font-size: 8px; margin-top: 2px; }
.bot-disclosure, .channel-disclosure, .closed-chat-banner {
    padding: 8px 14px; border-bottom: 1px solid var(--line); display: flex;
    align-items: center; gap: 8px;
}
.bot-disclosure { background: #eef9f6; }
.channel-disclosure { background: #fbfcfd; }
.closed-chat-banner { background: #fff3f4; color: #9a3e4b; }
.bot-disclosure strong, .channel-disclosure strong, .closed-chat-banner strong {
    font-size: 8px; text-transform: uppercase; letter-spacing: .5px;
}
.bot-disclosure span, .channel-disclosure span, .closed-chat-banner span {
    font-size: 8px; color: #758089;
}
.messages-area {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px clamp(14px, 4vw, 50px);
    scrollbar-width: thin;
    scrollbar-color: #d9dde1 transparent;
}
.loading { text-align: center; color: var(--muted); font-size: 9px; }
.message-row { display: flex; margin: 5px 0; }
.message-row.own { justify-content: flex-end; }
.message-stack {
    max-width: min(620px, 74%); display: flex; flex-direction: column; align-items: flex-start;
}
.message-row.own .message-stack { align-items: flex-end; }
.message-bubble {
    background: white; border: 1px solid #e1e5e8; box-shadow: 0 2px 5px rgba(25,40,55,.04);
    border-radius: 7px 14px 14px 14px; padding: 9px 11px; color: #2b3036;
    font-size: 11px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.message-row.own .message-bubble {
    background: #dbf5ed; border-color: #c8ebe1; border-radius: 14px 7px 14px 14px;
}
.message-meta { color: #9ba1a8; font-size: 7px; margin-top: 3px; }
.message-actions { display: flex; gap: 2px; margin: 0 5px; align-self: center; opacity: 0; }
.message-row:hover .message-actions { opacity: 1; }
.message-action {
    width: 27px; height: 27px; border: 1px solid var(--line);
    background: white; color: #8d939a; border-radius: 7px;
}
.reply-preview { border-left: 2px solid var(--green); padding-left: 7px; margin-bottom: 6px; }
.reply-preview strong, .reply-preview span { display: block; }
.reply-preview strong { color: #278c76; font-size: 8px; }
.reply-preview span { color: #7f868e; font-size: 8px; }
.typing-indicator {
    padding: 0 18px 7px; color: #7e858d; font-size: 8px;
    display: flex; align-items: center; gap: 6px;
}
.typing-indicator[hidden] { display: none; }
.typing-dots { display: inline-flex; gap: 2px; }
.typing-dots i {
    width: 4px; height: 4px; border-radius: 50%; background: #63baa7;
    animation: typingPulse 1s infinite ease-in-out;
}
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typingPulse {
    0%, 70%, 100% { opacity: .25; transform: translateY(0); }
    35% { opacity: 1; transform: translateY(-2px); }
}
.composer-dock {
    flex: 0 0 auto;
    min-width: 0;
    background: white;
    border-top: 1px solid var(--line);
    box-shadow: 0 -5px 18px rgba(35, 48, 62, .035);
}
.reply-bar {
    margin: 0;
    min-height: 45px;
    background: #f8faf9;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-left: 3px solid var(--green);
    border-radius: 0;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.reply-bar[hidden] { display: none; }
.reply-bar-copy { min-width: 0; flex: 1; }
.reply-bar strong, .reply-bar span { display: block; }
.reply-bar strong { color: #16876f; font-size: 9px; line-height: 1.2; }
.reply-bar span {
    max-width: 100%;
    margin-top: 3px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--muted);
    font-size: 8px;
}
.reply-bar button {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: #edf1f0;
    color: #768079;
    font-size: 18px;
    display: grid;
    place-items: center;
}
.composer {
    padding: 8px 11px 10px;
    border-top: 0;
    background: white;
    display: flex;
    align-items: flex-end;
    gap: 5px;
}
.attach-btn, .send-btn {
    width: 36px; height: 36px; border: 0; display: grid; place-items: center;
    flex: 0 0 36px;
}
.attach-btn { background: transparent; color: #8f969d; }
.composer textarea {
    flex: 1;
    min-width: 0;
    min-height: 36px;
    max-height: 120px;
    resize: none;
    border: 1px solid var(--line);
    background: #f6f7f8;
    color: var(--text);
    border-radius: 18px;
    padding: 9px 12px;
    outline: 0;
    font-size: 11px;
    line-height: 1.45;
}
.send-btn { border-radius: 50%; color: white; background: var(--green); }
.send-btn:disabled { opacity: .55; cursor: default; }
.send-btn svg { width: 16px; height: 16px; }
.closed-composer {
    background: #fff;
    color: #9b626b;
    padding: 15px;
    text-align: center;
    font-size: 9px;
}
.conversation-placeholder {
    display: grid; place-items: center; align-content: center; background: #f5f7f9; text-align: center;
}
.placeholder-logo {
    width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; font-weight: 900;
}
.conversation-placeholder h2 { margin: 14px 0 4px; font-size: 14px; }
.conversation-placeholder p { margin: 0; color: var(--muted); font-size: 9px; }

/* Pages */
.page { height: 100vh; overflow-y: auto; background: #f5f7f9; }
.page-header {
    min-height: 67px; padding: 0 20px; display: flex; align-items: center;
    gap: 11px; background: white; border-bottom: 1px solid var(--line);
}
.back-link {
    width: 34px; height: 34px; display: grid; place-items: center; color: #8e949a;
}
.page-header span, .section-title > span, .contact-id-search > div > span,
.support-heading > span, .identity-heading > span {
    color: var(--green); font-size: 8px; font-weight: 800; letter-spacing: 1.1px;
}
.page-header h1 { margin: 3px 0 0; font-size: 19px; }
.page-content {
    width: min(900px, calc(100% - 30px)); margin: auto; padding: 24px 0 90px;
}

/* Contacts */
.contact-id-search {
    display: grid; grid-template-columns: 1fr minmax(300px, .75fr); gap: 20px;
    align-items: end; padding: 21px; background: white; border: 1px solid var(--line);
    border-radius: 14px;
}
.contact-id-search h2 { margin: 4px 0 5px; font-size: 16px; }
.contact-id-search p {
    max-width: 480px; margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55;
}
.contact-id-search form { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.contact-id-search input {
    min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 11px;
    text-transform: uppercase; letter-spacing: .8px; outline: 0;
}
.contact-id-search button {
    border: 0; border-radius: 9px; padding: 0 14px; color: white;
    background: var(--green); font-size: 9px; font-weight: 700;
}
.found-contact {
    margin-top: 12px; padding: 12px; display: grid; grid-template-columns: 50px 1fr auto;
    gap: 11px; align-items: center; background: white; border: 1px solid var(--line); border-radius: 12px;
}
.section { margin-top: 24px; }
.section-title {
    margin: 0 5px 8px; display: flex; align-items: center; justify-content: space-between;
}
.section-title small { color: var(--muted); font-size: 8px; }
.people-list {
    overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: white;
}
.person-row {
    min-height: 62px; padding: 8px 11px; display: grid; grid-template-columns: 43px 1fr auto;
    gap: 10px; align-items: center; border-bottom: 1px solid var(--line);
}
.person-row:last-child { border-bottom: 0; }
.person-copy { min-width: 0; }
.person-copy strong, .person-copy small { display: block; }
.person-copy strong { font-size: 10px; }
.person-copy small {
    color: var(--muted); font-size: 8px; margin-top: 3px;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.row-actions { display: flex; gap: 5px; }
.action-btn {
    border: 0; border-radius: 999px; padding: 7px 10px; color: #666d74;
    background: #eef1f3; font-size: 8px; font-weight: 700;
}
.action-btn.primary { color: white; background: var(--green); }
.pending-label { color: #a27c20; font-size: 8px; }
.empty-list { padding: 25px; text-align: center; color: var(--muted); font-size: 9px; }

/* Me */
.profile-content { max-width: 720px; }
.me-card, .support-section {
    background: white; border: 1px solid var(--line); border-radius: 15px; padding: 24px;
}
.me-card { text-align: center; }
.profile-photo-area { display: grid; justify-content: center; }
.avatar-form { margin-top: 11px; }
.avatar-form label { color: var(--green); font-size: 9px; font-weight: 700; cursor: pointer; }
.avatar-form input { display: none; }
.me-card h2 { margin: 12px 0 3px; font-size: 18px; }
.me-subtitle { margin: 0; color: var(--muted); font-size: 9px; }
.identity-card {
    margin-top: 23px; text-align: left; border: 1px solid #ccebe3;
    background: #f1fbf8; border-radius: 12px; padding: 13px;
}
.identity-heading { display: flex; justify-content: space-between; gap: 15px; }
.identity-heading small { color: #798b87; font-size: 8px; }
.pulse-id-row { margin-top: 10px; padding: 10px; }
.profile-info {
    margin-top: 15px; border: 1px solid var(--line); border-radius: 11px;
    overflow: hidden; text-align: left;
}
.profile-info > div {
    padding: 12px; display: flex; justify-content: space-between; gap: 25px;
    border-bottom: 1px solid var(--line);
}
.profile-info > div:last-child { border-bottom: 0; }
.profile-info span { color: var(--muted); font-size: 9px; }
.profile-info strong { font-size: 9px; text-align: right; }
.support-section { margin-top: 14px; }
.support-heading h2 { margin: 4px 0 5px; font-size: 15px; }
.support-heading p { color: var(--muted); font-size: 9px; line-height: 1.5; margin: 0; }
.support-form { margin-top: 15px; display: grid; gap: 8px; }
.support-form textarea { resize: vertical; }
.ticket-list { display: grid; gap: 10px; margin-top: 18px; }
.ticket-card { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.ticket-card > header {
    padding: 10px 11px; display: flex; justify-content: space-between; gap: 15px;
    align-items: center; background: #f8f9fa; border-bottom: 1px solid var(--line);
}
.ticket-card header strong, .ticket-card header span { display: block; }
.ticket-card header strong { font-size: 9px; }
.ticket-card header span { color: var(--muted); font-size: 7px; margin-top: 2px; }
.ticket-card header em {
    font-style: normal; font-size: 7px; text-transform: uppercase; color: #1f9078;
    background: var(--green-soft); border-radius: 99px; padding: 5px 7px;
}
.ticket-card header em.closed { color: #7d858d; background: #eceff1; }
.ticket-messages { padding: 10px; display: grid; gap: 7px; }
.ticket-message {
    max-width: 83%; padding: 8px 9px; border-radius: 10px; background: #f1f3f5;
}
.ticket-message.user { margin-left: auto; background: var(--green-soft); }
.ticket-message strong { font-size: 7px; }
.ticket-message p { margin: 3px 0; font-size: 9px; line-height: 1.45; }
.ticket-message time { color: var(--muted); font-size: 6px; }
.ticket-reply {
    padding: 9px; border-top: 1px solid var(--line); display: grid;
    grid-template-columns: 1fr auto; gap: 6px;
}
.logout-link {
    display: block; margin-top: 14px; border-radius: 11px; padding: 12px;
    text-align: center; color: #d64c5e; background: #fff0f2;
    font-size: 9px; font-weight: 700;
}

/* Server gate compatibility */
.server-gate {
    height: 100vh; overflow-y: auto; padding: 48px clamp(24px, 6vw, 80px); background: #f5f7f9;
}
.server-gate-header, .server-gate-grid, .admin-link {
    max-width: 1100px; margin-left: auto; margin-right: auto;
}
.server-gate-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px;
}
.server-gate-header > div:first-child > span, .section-heading span, .pending-box > span {
    color: var(--green); font-size: 8px; letter-spacing: 1.1px; font-weight: 800;
}
.server-gate-header h1 { font-size: 32px; margin: 5px 0; }
.server-gate-header p { color: var(--muted); font-size: 10px; }
.server-user { display: flex; align-items: center; gap: 8px; }
.server-user > div {
    width: 35px; height: 35px; display: grid; place-items: center;
    border-radius: 50%; background: #e8ebef;
}
.server-user span { font-size: 10px; }
.server-gate-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 15px; }
.join-card, .available-card {
    background: white; border: 1px solid var(--line); border-radius: 16px; padding: 23px;
}
.card-icon {
    width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px;
    background: var(--green-soft); color: var(--green); font-size: 22px;
}
.join-card h2, .section-heading h2 { margin: 13px 0 5px; font-size: 15px; }
.join-card > p { color: var(--muted); font-size: 9px; line-height: 1.5; }
.join-card form { display: grid; gap: 8px; margin-top: 15px; }
.join-card input {
    border: 1px solid var(--line); border-radius: 9px; padding: 11px; outline: 0; text-transform: uppercase;
}
.join-card button {
    border: 0; border-radius: 9px; padding: 11px; color: white; background: var(--green); font-weight: 700;
}
.section-heading { display: flex; justify-content: space-between; align-items: end; }
.section-heading b {
    width: 23px; height: 23px; display: grid; place-items: center;
    border-radius: 50%; background: #eef1f3; font-size: 8px;
}
.server-list {
    margin-top: 12px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden;
}
.server-row {
    padding: 11px; display: grid; grid-template-columns: 42px 1fr auto 16px;
    gap: 10px; align-items: center; border-bottom: 1px solid var(--line);
}
.server-row:last-child { border-bottom: 0; }
.server-avatar {
    width: 42px; height: 42px; display: grid; place-items: center;
    border-radius: 11px; color: var(--green); background: var(--green-soft); font-weight: 800;
}
.server-row strong, .server-row span { display: block; }
.server-row strong { font-size: 10px; }
.server-row span { color: var(--muted); font-size: 8px; margin-top: 2px; }
.server-row em { color: var(--muted); font-size: 7px; font-style: normal; text-transform: uppercase; }
.server-row svg { width: 14px; color: #a3a9af; }
.empty-state {
    padding: 30px; text-align: center; color: var(--muted); font-size: 9px;
    border: 1px dashed var(--line); border-radius: 11px;
}
.pending-box { margin-top: 15px; }
.pending-box > div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.pending-box strong { font-size: 9px; }
.pending-box em { color: #9a7928; font-size: 8px; font-style: normal; }
.success-note, .error-note { margin-top: 10px; padding: 9px; border-radius: 8px; font-size: 8px; }
.success-note { color: #177e69; background: var(--green-soft); }
.error-note { color: #cf4557; background: #fff0f2; }

/* Mobile */
@media (max-width: 760px) {
    html, body { overscroll-behavior: none; }
    .app-body { overflow: auto; }
    .app-shell {
        display: block; height: auto; min-height: 100dvh;
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }
    .app-rail { display: none; }
    .workspace { min-height: calc(100dvh - 64px); }
    .mobile-nav {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
        height: calc(62px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        display: grid; grid-template-columns: repeat(3, 1fr);
        background: rgba(255,255,255,.97); border-top: 1px solid var(--line);
        backdrop-filter: blur(18px);
    }
    .mobile-nav a {
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 3px; color: #989fa7; font-size: 8px;
    }
    .mobile-nav a.active { color: var(--green); }
    .mobile-nav svg { width: 21px; height: 21px; }

    .messenger {
        display: block; height: calc(100dvh - 62px - env(safe-area-inset-bottom));
    }
    .chat-list-panel { height: 100%; border-right: 0; }
    .conversation-open .chat-list-panel { display: none; }
    .conversation-view {
        height: calc(100dvh - 62px - env(safe-area-inset-bottom));
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .conversation-header {
        flex-basis: 53px;
    }
    .conversation-header {
        position: relative; justify-content: center; padding: 0 48px;
    }
    .mobile-back {
        position: absolute; left: 7px; width: 36px; height: 36px;
        display: grid; place-items: center; color: #8d949b;
    }
    .messages-area { padding: 16px 10px 22px; }
    .message-stack { max-width: 84%; }
    .message-actions { display: none; }
    .composer { padding-bottom: max(9px, env(safe-area-inset-bottom)); }

    .page { min-height: calc(100dvh - 62px); height: auto; }
    .page-header {
        min-height: 54px; padding: 0 9px; position: sticky; top: 0; z-index: 20;
    }
    .mobile-centered-header {
        display: grid; grid-template-columns: 38px 1fr 38px; text-align: center;
    }
    .mobile-centered-header > div { grid-column: 2; }
    .page-content { width: calc(100% - 20px); padding: 14px 0 88px; }
    .contact-id-search { grid-template-columns: 1fr; gap: 15px; padding: 17px; }
    .contact-id-search form { grid-template-columns: 1fr auto; }
    .person-row { grid-template-columns: 43px minmax(0,1fr) auto; }
    .profile-content { max-width: none; }
    .me-card, .support-section { padding: 18px; }
    .identity-heading { display: block; }
    .identity-heading small { display: block; margin-top: 4px; }
    .server-gate { min-height: 100dvh; height: auto; padding: 25px 14px 85px; }
    .server-gate-header { align-items: flex-start; }
    .server-user span { display: none; }
    .server-gate-grid { grid-template-columns: 1fr; }
    .phone-field { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
    .auth-page { align-items: start; padding-top: 38px; }
    .auth-card { padding: 15px; }
    .created-card { padding: 23px 17px; }
    .found-contact { grid-template-columns: 50px 1fr; }
    .found-contact > form, .found-contact > .pending-label { grid-column: 2; }
    .row-actions { flex-direction: column; }
    .ticket-reply { grid-template-columns: 1fr; }
    .profile-info > div { align-items: flex-start; flex-direction: column; gap: 4px; }
    .profile-info strong { text-align: left; }
}


/* ===== PULSE V2 brand mark ===== */
.pulse-mark {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
}

.pulse-mark svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    stroke: none;
}

.pulse-mark svg rect {
    fill: url(#none);
    fill: #1ab598;
}

.pulse-mark .pulse-mark-line {
    fill: none;
    stroke: white;
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rail-logo {
    width: 40px;
    height: 40px;
}

.logo-button {
    background: transparent !important;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    margin-bottom: 5px;
}

.auth-logo {
    width: 52px;
    height: 52px;
}

.auth-brand h1 {
    margin: 0;
    letter-spacing: -.8px;
}

/* ===== Server access page V2 ===== */
.server-gate-header-v2 {
    max-width: 1180px;
    margin-bottom: 54px;
}

.server-brand,
.server-account,
.server-account-actions {
    display: flex;
    align-items: center;
}

.server-brand {
    gap: 10px;
}

.server-logo {
    width: 44px;
    height: 44px;
}

.server-brand strong,
.server-brand small,
.server-account strong,
.server-account small {
    display: block;
}

.server-brand strong {
    font-size: 14px;
    letter-spacing: .3px;
}

.server-brand small,
.server-account small {
    color: var(--muted);
    font-size: 8px;
    margin-top: 2px;
}

.server-account-actions {
    gap: 12px;
}

.server-account {
    gap: 8px;
    padding: 6px 9px 6px 6px;
    border-radius: 11px;
}

.server-account:hover {
    background: white;
}

.server-account-avatar {
    width: 37px;
    height: 37px;
}

.server-account strong {
    font-size: 9px;
}

.server-logout {
    border: 1px solid var(--line);
    background: white;
    color: #6f767e;
    border-radius: 9px;
    padding: 10px 13px;
    font-size: 9px;
    font-weight: 700;
}

.server-logout:hover {
    color: #d34a5d;
    border-color: #f2cbd1;
    background: #fff6f7;
}

.server-gate-intro {
    max-width: 1180px;
    margin: 0 auto 21px;
}

.server-gate-intro > span,
.server-card-heading > div:last-child > span {
    color: var(--green);
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 1.2px;
}

.server-gate-intro h1 {
    margin: 5px 0 6px;
    font-size: 34px;
    letter-spacing: -1px;
}

.server-gate-intro p {
    margin: 0;
    max-width: 650px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.55;
}

.server-gate-grid-v2 {
    max-width: 1180px;
    grid-template-columns: .88fr 1.12fr;
}

.join-card-v2,
.available-card-v2 {
    box-shadow: 0 16px 45px rgba(35,55,70,.04);
}

.server-card-heading {
    display: flex;
    align-items: center;
    gap: 11px;
}

.server-card-heading .card-icon {
    flex: 0 0 auto;
}

.server-card-heading .card-icon svg {
    width: 19px;
    height: 19px;
}

.server-card-heading h2 {
    margin: 3px 0 0;
}

.join-card-v2 > p b {
    color: #4b535b;
}

.server-search-input {
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    background: #fbfcfd;
}

.server-search-input:focus-within {
    border-color: #9acfc4;
    box-shadow: 0 0 0 3px rgba(25,179,148,.08);
}

.server-search-input svg {
    width: 17px;
    color: #9ca3aa;
}

.server-search-input input {
    padding: 0;
    border: 0;
    background: transparent;
    text-transform: none;
    letter-spacing: 0;
    width: 100%;
}

.server-empty-state {
    display: grid;
    place-items: center;
    gap: 5px;
}

.empty-server-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #f0f3f5;
    color: #8b929a;
    font-size: 17px;
}

.server-empty-state strong {
    margin-top: 4px;
    color: #42484f;
    font-size: 10px;
}

.server-empty-state span {
    color: var(--muted);
    font-size: 8px;
}

.pending-box-v2 > div {
    display: grid;
    grid-template-columns: 8px 1fr auto;
    gap: 8px;
    align-items: center;
}

.pending-server-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e7b94c;
}

@media (max-width: 760px) {
    .server-gate-header-v2 {
        margin-bottom: 34px;
    }

    .server-brand span,
    .server-account span {
        display: none;
    }

    .server-account-actions {
        gap: 6px;
    }

    .server-logout {
        padding: 9px 11px;
    }

    .server-gate-intro h1 {
        font-size: 28px;
    }

    .server-gate-grid-v2 {
        grid-template-columns: 1fr;
    }
}


/* Chat V4 stability fixes */
.bot-disclosure,
.channel-disclosure,
.closed-chat-banner,
.typing-indicator {
    flex: 0 0 auto;
}
.avatar-form label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--green-soft);
}


/* V6 — Become an Owner pricing */

.owner-upsell {
    max-width: 1180px;
    margin: 16px auto 0;
    padding: 14px 16px;
    background:
        linear-gradient(135deg, rgba(25,179,148,.055), rgba(58,165,250,.035)),
        #fff;
    border: 1px solid #dfe8e5;
    border-radius: 14px;
    box-shadow: 0 12px 34px rgba(35,55,70,.035);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.owner-upsell-copy {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.owner-upsell-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--green);
    background: var(--green-soft);
}

.owner-upsell-icon svg {
    width: 20px;
    height: 20px;
}

.owner-upsell-copy span {
    color: var(--green);
    font-size: 7px;
    font-weight: 850;
    letter-spacing: 1px;
}

.owner-upsell-copy h3 {
    margin: 2px 0 3px;
    font-size: 12px;
}

.owner-upsell-copy p {
    max-width: 680px;
    margin: 0;
    color: var(--muted);
    font-size: 8px;
    line-height: 1.45;
}

.owner-upsell-button {
    flex: 0 0 auto;
    border: 1px solid #cde9e2;
    background: #f0faf7;
    color: #16866f;
    border-radius: 9px;
    padding: 9px 11px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 8px;
    font-weight: 800;
}

.owner-upsell-button:hover {
    background: #e7f7f2;
}

.owner-upsell-button svg {
    width: 13px;
    height: 13px;
}

.owner-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.owner-modal.open {
    display: flex;
}

.owner-modal-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(18,25,31,.42);
    backdrop-filter: blur(5px);
}

.owner-modal-panel {
    position: relative;
    z-index: 1;
    width: min(1000px, 100%);
    max-height: min(760px, calc(100dvh - 36px));
    overflow-y: auto;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 19px;
    box-shadow: 0 30px 100px rgba(18,30,40,.2);
    padding: 24px;
}

.owner-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.owner-modal-header span {
    color: var(--green);
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 1.2px;
}

.owner-modal-header h2 {
    margin: 4px 0 5px;
    font-size: 24px;
    letter-spacing: -.5px;
}

.owner-modal-header p {
    margin: 0;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.5;
}

.owner-modal-close {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: white;
    color: #818991;
    font-size: 20px;
    line-height: 1;
}

.owner-plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 11px;
}

.owner-plan-card {
    position: relative;
    min-width: 0;
    border: 1px solid var(--line);
    background: #fbfcfd;
    border-radius: 14px;
    padding: 17px;
    display: flex;
    flex-direction: column;
}

.owner-plan-card.featured {
    border-color: #9ed8cc;
    background:
        linear-gradient(180deg, #f0fbf8, #fff 48%);
    box-shadow: 0 10px 32px rgba(25,179,148,.08);
}

.owner-plan-card.absurd {
    background:
        linear-gradient(180deg, #faf8ff, #fff 52%);
    border-color: #e5ddf2;
}

.owner-plan-badge {
    position: absolute;
    top: -9px;
    right: 12px;
    padding: 4px 7px;
    border-radius: 999px;
    color: white;
    background: var(--green);
    font-size: 6px;
    font-weight: 900;
    letter-spacing: .55px;
}

.owner-plan-name > span {
    color: var(--green);
    font-size: 7px;
    font-weight: 850;
    letter-spacing: 1px;
}

.owner-plan-name h3 {
    margin: 4px 0;
    font-size: 16px;
}

.owner-plan-name p {
    min-height: 36px;
    margin: 0;
    color: var(--muted);
    font-size: 8px;
    line-height: 1.45;
}

.owner-plan-price {
    margin: 16px 0 13px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--line);
}

.owner-plan-price strong {
    display: block;
    font-size: 25px;
    letter-spacing: -.8px;
}

.owner-plan-price span {
    display: block;
    margin-top: 1px;
    color: #68717a;
    font-size: 8px;
}

.owner-plan-price small {
    display: block;
    margin-top: 5px;
    color: var(--green);
    font-size: 8px;
    font-weight: 700;
}

.owner-plan-card ul {
    flex: 1;
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    display: grid;
    gap: 8px;
}

.owner-plan-card li {
    position: relative;
    padding-left: 16px;
    color: #606870;
    font-size: 8px;
    line-height: 1.35;
}

.owner-plan-card li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--green);
    font-weight: 900;
}

.owner-plan-select {
    width: 100%;
    border: 0;
    border-radius: 9px;
    padding: 10px;
    color: white;
    background: #222b31;
    font-size: 8px;
    font-weight: 800;
}

.owner-plan-card.featured .owner-plan-select {
    background: var(--green);
}

.owner-plan-card.absurd .owner-plan-select {
    background: #61536e;
}

.owner-modal-footer {
    margin-top: 13px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.owner-modal-footer span,
.owner-modal-footer strong {
    color: var(--muted);
    font-size: 7px;
}

.owner-modal-footer strong {
    color: #666f78;
}

.owner-request-success {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: rgba(255,255,255,.97);
    border-radius: inherit;
    display: grid;
    place-items: center;
    align-content: center;
    padding: 30px;
    text-align: center;
}

.owner-request-success[hidden] {
    display: none;
}

.owner-request-success > div {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: white;
    background: var(--green);
    font-size: 24px;
    font-weight: 900;
}

.owner-request-success strong {
    margin-top: 14px;
    font-size: 16px;
}

.owner-request-success span {
    margin-top: 5px;
    color: var(--green);
    font-size: 10px;
    font-weight: 800;
}

.owner-request-success p {
    max-width: 420px;
    margin: 8px 0 16px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.5;
}

.owner-request-success button {
    border: 0;
    border-radius: 9px;
    padding: 10px 18px;
    color: white;
    background: var(--green);
    font-size: 8px;
    font-weight: 800;
}

body.owner-modal-open {
    overflow: hidden;
}

@media (max-width: 760px) {
    .owner-upsell {
        align-items: stretch;
        flex-direction: column;
    }

    .owner-upsell-button {
        width: 100%;
        justify-content: center;
    }

    .owner-modal {
        padding: 8px;
        align-items: flex-end;
    }

    .owner-modal-panel {
        width: 100%;
        max-height: calc(100dvh - 16px);
        border-radius: 18px 18px 14px 14px;
        padding: 18px 14px;
    }

    .owner-modal-header h2 {
        font-size: 21px;
    }

    .owner-plan-grid {
        grid-template-columns: 1fr;
    }

    .owner-plan-name p {
        min-height: 0;
    }

    .owner-modal-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }
}


/* V7 — server entitlement badge */

.server-plan-line {
    margin-top: 4px !important;
    color: #16866f !important;
    font-size: 7px !important;
    font-weight: 650;
}

.server-plan-line b {
    color: #12836d;
    font-size: 7px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.server-plan-line.expired {
    color: #aa6f78 !important;
}


/* V8 — installable PWA + security wording */

.install-app-card {
    margin-top: 14px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.install-app-copy {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.install-app-icon {
    width: 50px;
    height: 50px;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(25,179,148,.12);
}

.install-app-icon img {
    width: 100%;
    height: 100%;
    display: block;
}

.install-app-copy span {
    color: var(--green);
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 1px;
}

.install-app-copy h2 {
    margin: 3px 0 4px;
    font-size: 14px;
}

.install-app-copy p {
    max-width: 470px;
    margin: 0;
    color: var(--muted);
    font-size: 8px;
    line-height: 1.5;
}

.install-app-card > button {
    flex: 0 0 auto;
    border: 0;
    border-radius: 9px;
    padding: 10px 13px;
    background: var(--green);
    color: white;
    font-size: 8px;
    font-weight: 800;
}

.install-app-card > button:disabled {
    background: #dce3e1;
    color: #7c8582;
    cursor: default;
}

.install-app-card.installed {
    background: #f6fbf9;
    border-color: #d8eee8;
}

.conversation-security-line {
    flex: 0 0 auto;
    min-height: 27px;
    padding: 5px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--line);
    color: #9aa1a8;
    font-size: 7px;
    text-align: center;
}

.security-lock {
    color: #8c949b;
    font-size: 10px;
    line-height: 1;
}

@media (max-width: 760px) {
    .install-app-card {
        align-items: stretch;
        flex-direction: column;
    }

    .install-app-card > button {
        width: 100%;
    }

    .conversation-security-line {
        padding-left: 8px;
        padding-right: 8px;
        font-size: 6.5px;
    }
}
