:root {
    color-scheme: dark;
    --blue: #303ce0;
    --ink: #f6f6ff;
    --muted: #afb2ca;
    --line: #ffffff20;
    font: 15px/1.45 system-ui, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #08090d; color: var(--ink); }
a { color: #b7caff; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
:focus-visible { outline: 2px solid #aab3ff; outline-offset: 3px; }
.layout { display: grid; grid-template-columns: 20% 60% 20%; height: 100dvh; }
.chat-screen { display: contents; }
.brand, .archive { background: #08090d; min-width: 0; padding: clamp(14px, 2vw, 34px); }
.brand { display: flex; flex-direction: column; gap: clamp(40px, 9vh, 100px); border-right: 1px solid var(--line); overflow: auto; }
.brand-link { display: block; width: fit-content; max-width: 100%; }
.logo { display: block; width: 105px; max-width: 100%; height: auto; }
.portrait {
    width: clamp(62px, 8vw, 110px); aspect-ratio: 1; display: grid; place-items: center;
    border-radius: 50%; border: 1px solid #818aff77; object-fit: cover; margin-bottom: 24px;
}
.placeholder { background: radial-gradient(circle at 33% 24%, #343f9e, #101225 76%); color: #e0e3ff; font-weight: 800; letter-spacing: .12em; }
.eyebrow { margin: 0 0 8px; color: #b3b8ef; font-size: .68rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; line-height: 1.1; }
h1 { font-size: clamp(12px, 1.8vw, 38px); letter-spacing: -.06em; }
.brand-footer { display: grid; gap: 14px; margin-top: auto; }
.brand-contact { display: flex; align-items: center; gap: 10px; }
.mobile-contact { display: none; }
.communications {
    position: relative; display: grid; grid-template-rows: minmax(0, 1fr);
    height: clamp(165px, 41dvh, 438px); min-height: 145px; min-width: 0;
    padding: 16px 14px; border: 3px solid #050a0a; border-radius: 16px;
    color: #00df83; background: radial-gradient(ellipse at 32% 24%, #202d2b, #111e1d 78%);
    box-shadow: inset 0 0 18px #0006; text-shadow: 0 0 5px #00df8360;
    font: 700 .85rem/1.24 "Courier New", monospace;
}
.communications-mobile { display: none; }
.communications-screen { overflow: auto; scrollbar-width: thin; scrollbar-color: #356755 transparent; }
.communications-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.communications-text a { color: inherit; text-underline-offset: 2px; }
.contact-details { min-width: 0; display: grid; gap: 3px; overflow-wrap: anywhere; }
.contact-name { color: #00c778; font-size: .79rem; letter-spacing: .045em; }
.email { color: #00c778; font-size: .79rem; text-decoration: none; }
.profile { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 0 0 16px; padding: 10px; background: #111324; border: 1px solid var(--line); border-radius: 10px; overflow-wrap: anywhere; }
.profile-details { display: grid; gap: 3px; }
.profile .eyebrow { margin: 0; }
.profile button { padding: 5px 8px; }
.room {
    min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
    background: radial-gradient(ellipse at 23% 34%, #303ce09c, transparent 53%),
                radial-gradient(ellipse at 81% 72%, #292ba89c, transparent 56%), #090b16;
    background-size: 145% 155%, 135% 140%, auto;
    animation: aurora 20s ease-in-out infinite alternate;
}
@keyframes aurora { from { background-position: 0% 0%, 95% 90%, 0 0; } to { background-position: 95% 80%, 0% 10%, 0 0; } }
.room-header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px clamp(14px, 3vw, 42px);
    border-bottom: 1px solid var(--line); background: #080a16b3;
}
.room-header .eyebrow { margin: 0; }
.month-select {
    min-width: 0; max-width: 100%; border: 1px solid #a5aaff49; border-radius: 12px;
    padding: 7px 10px; background: #171b34; color: var(--ink); font: inherit;
    font-size: .78rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase;
}
.month-select:enabled { cursor: pointer; }
.room-header h2, .archive h2 { font-size: clamp(1.15rem, 2vw, 1.6rem); letter-spacing: -.04em; }
.badge { display: flex; align-items: center; gap: 7px; color: #e1e3ff; padding: 6px 10px; border-radius: 50px; border: 1px solid var(--line); font-size: .73rem; white-space: nowrap; }
.badge span { width: 7px; height: 7px; border-radius: 50%; background: #a5acff; }
.active .badge span { background: #60efba; }
.gate { overflow: auto; display: grid; place-items: safe center; padding: clamp(18px, 4vw, 54px); }
.gate-card { width: min(100%, 440px); padding: clamp(20px, 3vw, 37px); background: #0b0d1ce8; border: 1px solid #a5aaff40; border-radius: 22px; box-shadow: 0 18px 55px #0006; }
.gate-card h3 { font-size: clamp(1.6rem, 3.2vw, 2.55rem); letter-spacing: -.055em; }
.gate-card p:not(.eyebrow) { color: var(--muted); }
.gate-card .error { color: #ffadbc !important; }
.gate-form { display: grid; gap: 15px; margin-top: 22px; }
.gate-form label { display: grid; gap: 6px; font-size: .86rem; }
.gate-form input, textarea { min-width: 0; width: 100%; background: #080a14; color: var(--ink); border: 1px solid #a5aaff49; border-radius: 10px; padding: 11px 12px; }
.primary, .secondary {
    color: var(--ink); border-radius: 10px; padding: 8px 12px; text-decoration: none; font-weight: 650;
}
.primary { background: var(--blue); border: 1px solid #a5aaff70; }
.primary:hover { background: #424deb; }
.secondary { background: #ffffff0b; border: 1px solid var(--line); }
.secondary:hover { background: #ffffff19; }
.gate-form button { display: flex; justify-content: space-between; padding: 11px 14px; }
.history { overflow: auto; padding: 18px clamp(12px, 3vw, 42px); min-height: 0; }
#messages { display: flex; flex-direction: column; align-items: flex-start; gap: 13px; }
.older { display: block; margin: 0 auto 18px; }
.empty { min-height: 100%; display: grid; align-content: center; justify-items: center; text-align: center; }
.empty-icon { color: #aab2ff; font-size: 2.3rem; }
.empty p, .archive p:not(.eyebrow) { color: var(--muted); }
.bubble {
    width: fit-content; max-width: min(90%, 580px); min-width: min(205px, 90%);
    background: #0d1328; border: 1px solid #afb7ff25; border-radius: 4px 15px 15px;
    padding: 9px 12px; box-shadow: 0 3px 10px #0002;
}
.mine { align-self: flex-end; background: #1e2567; border-radius: 15px 4px 15px 15px; }
.meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .76rem; overflow-wrap: anywhere; }
.meta time { color: #c3c7dd; white-space: nowrap; font-size: .64rem; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 5px 0 1px; }
.color-0 { color: #b3bdff; }.color-1 { color: #72ebc1; }.color-2 { color: #ffc580; }
.color-3 { color: #ff9fce; }.color-4 { color: #97e2ff; }.color-5 { color: #d9afff; }
.color-6 { color: #f8eb90; }.color-7 { color: #ffa9a9; }.color-8 { color: #b2ef8b; }
.color-9 { color: #f7aaf5; }.color-10 { color: #c4e2dd; }.color-11 { color: #ffbaae; }
.composer { background: #080a16f5; border-top: 1px solid var(--line); padding: 12px clamp(12px, 3vw, 42px); }
.composer-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) 44px; align-items: center; gap: 8px; }
textarea { resize: vertical; max-height: 110px; min-height: 46px; padding: 9px 11px; }
.attach, .send { position: relative; height: 42px; display: grid; place-items: center; padding: 0; }
.attach { cursor: pointer; font-size: 1.3rem; }
.attach:focus-within { outline: 2px solid #aab3ff; }
.attach input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.send img { width: 17px; filter: brightness(0) invert(1); transform: rotate(90deg); }
.composer-details { color: var(--muted); font-size: .73rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; overflow-wrap: anywhere; }
.composer-details button { padding: 2px 6px; }
#status { color: #ffc8d6; }
.archive { overflow: auto; border-left: 1px solid var(--line); padding-bottom: 90px; }
.archive h2 { display: flex; align-items: center; gap: 8px; }
#count { display: inline-grid; min-width: 24px; height: 24px; padding: 0 5px; place-items: center; background: #1d2355; border-radius: 20px; font-size: .75rem; }
#attachments { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.file-card, .message-file {
    display: flex; align-items: center; gap: 9px; min-width: 0; margin-top: 5px; color: var(--ink); text-decoration: none;
}
.file-card { padding: 7px; margin: 0; background: #111324; border: 1px solid var(--line); border-radius: 10px; }
.file-card:hover, .message-file:hover { color: #b7caff; }
.file-label { min-width: 0; font-size: .78rem; overflow-wrap: anywhere; }
.file-label small { display: block; color: var(--muted); }
.thumb, .file-icon { width: 37px; height: 37px; flex: none; border-radius: 7px; object-fit: cover; }
.file-icon { display: grid; place-items: center; background: #2b3376; font-size: .62rem; font-weight: 800; }
.file-icon.video-icon, .file-icon.pdf-icon { background: #c91e36; color: #fff; }
.file-icon.audio-icon { background: var(--blue); color: #fff; }
.file-icon.zip-icon { background: #ff9b45; color: #211307; }
.message-image { display: block; width: min(100%, 340px); height: auto; background: #080a14; border-radius: 9px; }
.message-attachments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; width: min(100%, 340px); margin-top: 6px; }
.message-attachments .message-file { margin: 0; background: #080a145c; border-radius: 9px; overflow: hidden; }
.message-attachments .message-image { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.message-attachments .file-icon { width: 26px; height: 30px; margin-left: 3px; }
.media-action { display: block; font-size: .65rem; color: #b3b8ef; }
.whatsapp {
    display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%; background: #00c778;
    box-shadow: 0 5px 25px #0008;
}
.whatsapp img { width: 30px; height: 30px; filter: brightness(0) invert(1); }
dialog { max-width: min(94vw, 1050px); padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #090b16; text-align: center; }
dialog::backdrop { background: #000c; }
dialog form { text-align: right; }
dialog img { display: block; max-width: 100%; max-height: 74dvh; margin: 10px auto; }
dialog.video-viewer { width: fit-content; max-height: 94dvh; }
dialog video { display: block; width: auto; height: auto; max-width: min(86vw, 880px); max-height: min(68dvh, calc(94dvh - 130px)); margin: 10px auto; }
.video-viewer #viewer-name { width: 0; min-width: 100%; }
dialog audio { width: min(78vw, 480px); margin: 10px auto; }
#viewer-name { max-width: min(78vw, 880px); overflow-wrap: anywhere; margin: 10px auto; }
#viewer-error { color: var(--muted); }
.download-note, #download-status { color: var(--muted); max-width: 320px; margin: 10px auto; }
dialog.image-viewer { width: fit-content; max-width: 96vw; max-height: 94dvh; padding: 0; border: 0; background: transparent; }
.image-viewer #viewer-name { display: none; }
.image-viewer #viewer-content img {
    width: auto; height: auto; max-width: 96vw; max-height: 94dvh;
    margin: 0 auto; border-radius: 16px;
}
.image-viewer form button, .image-viewer #download-media, .image-viewer #save-media, .image-viewer #download-status {
    color: #fff; border: 1px solid #ffffff65; border-radius: 12px;
    background: linear-gradient(155deg, #ffffff38, #ffffff08 58%), #101429ba;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: inset 0 1px #ffffff45, 0 3px 12px #0005;
}
.image-viewer:not(.compact-image-viewer) form { position: absolute; top: 10px; right: 10px; }
.image-viewer:not(.compact-image-viewer) :is(#download-media, #save-media) { position: absolute; bottom: 10px; right: 10px; }
.image-viewer:not(.compact-image-viewer) #download-status { position: absolute; right: 10px; bottom: 54px; margin: 0; padding: 6px 9px; max-width: min(320px, calc(100% - 20px)); }
.compact-image-viewer form { text-align: center; margin-bottom: 6px; }
.compact-image-viewer :is(#download-media, #save-media) { margin-top: 6px; }
dialog a { display: inline-block; }
.install-chat { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.install-chat .primary { width: 100%; font-size: 1.15rem; padding-block: 10px; }
.install-chat p { margin: 10px 0 0; font-size: 1rem; }
dialog.install-guide {
    width: min(92vw, 480px); background: #08090d; border: 2px solid #5363e8;
    border-radius: 18px; padding: 16px 20px; text-align: left;
}
.install-guide h2 { margin: 12px 0 0; font-size: 1.2rem; }
.install-links { display: flex; flex-wrap: wrap; gap: 8px 16px; }
@media (max-width: 760px) {
    html, body { overflow-x: clip; overscroll-behavior-x: none; }
    .layout { height: auto; grid-template-columns: minmax(0, 1fr); }
    .chat-screen-active {
        display: grid; grid-template-rows: auto minmax(0, 1fr);
        min-width: 0; height: var(--chat-viewport-height, 100dvh);
    }
    html.chat-composing, html.chat-composing body { overflow: hidden; }
    .chat-composing .chat-screen-active {
        position: fixed; top: var(--chat-viewport-top, 0px); inset-inline: 0;
        z-index: 2; background: #08090d;
    }
    .chat-composing .archive { visibility: hidden; }
    .history { overscroll-behavior-x: none; }
    .gate-form input, .composer textarea { font-size: 16px; }
    .brand { padding: 14px 16px; border: 0; align-items: center; text-align: center; }
    .brand-footer, .brand-info .portrait, .communications-desktop { display: none; }
    .communications-mobile { display: grid; height: 450px; margin-bottom: 20px; }
    .mobile-contact {
        --contact-height: 2.2rem;
        display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr) minmax(38px, 1fr);
        align-items: center; gap: 8px; margin-bottom: 16px; padding: 10px;
        background: #1b2443; border: 1px solid var(--line); border-radius: 10px; text-align: center;
    }
    .mobile-contact .brand-link { width: 100%; }
    .mobile-contact .logo { width: 100%; height: var(--contact-height); object-fit: contain; object-position: left center; }
    .mobile-contact .contact-details { min-height: var(--contact-height); align-content: center; line-height: 1.2; }
    .mobile-contact .whatsapp { justify-self: end; }
    h1 { font-size: 1.25rem; }
    .locked { height: auto; min-height: 460px; }
    .archive { border: 0; min-height: 180px; }
    .whatsapp { width: 38px; height: 38px; }
    .whatsapp img { width: 23px; height: 23px; }
}
@media (prefers-reduced-motion: reduce) { .room { animation: none; } }
