/* ============================================================
   TOUON — chat interno corporativo
   direção: tech-industrial · grafite esverdeado + verde neon
   família visual: portfolio mrmendes / oficina online
   ============================================================ */

:root {
    --ink: #0a0f0c;
    --ink-2: #10170f;
    --ink-3: #161f16;
    --panel: #121a12;
    --line: rgba(233, 244, 236, 0.1);
    --line-strong: rgba(233, 244, 236, 0.18);
    --cream: #e9f4ec;
    --cream-dim: rgba(233, 244, 236, 0.55);
    --cream-faint: rgba(233, 244, 236, 0.28);
    --neon: #3dff9e;
    --neon-2: #2bd980;
    --neon-dim: rgba(61, 255, 158, 0.14);
    --neon-faint: rgba(61, 255, 158, 0.07);
    --danger: #ff7a68;
    --danger-dim: rgba(255, 122, 104, 0.14);
    --amber: #ffc400;
    --bubble-mine: #12291c;
    --bubble-mine-border: rgba(61, 255, 158, 0.22);
    --bubble-theirs: #161f16;
    --grid-line: rgba(233, 244, 236, 0.025);
    --quote-bg: rgba(10, 15, 12, 0.55);
    --scroll-thumb: rgba(233, 244, 236, 0.16);
    --disp: "Archivo", sans-serif;
    --body: "Albert Sans", sans-serif;
    --mono: "Fragment Mono", monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--ink);
    color: var(--cream);
    font-family: var(--body);
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--neon); color: var(--ink); }

/* scrollbars discretos */
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

.mono {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.09em;
    text-transform: lowercase;
}

/* wordmark texto — "tou" creme + "on" neon */
.brand-word {
    font-family: var(--disp);
    font-weight: 900;
    letter-spacing: -0.02em;
    text-transform: lowercase;
    color: var(--cream);
    margin: 0;
    line-height: 1;
}
.brand-word b { color: var(--neon); font-weight: 900; }

.neon-rule {
    height: 2px;
    border: 0;
    margin: 0;
    background: linear-gradient(90deg, var(--neon), rgba(61,255,158,0) 75%);
}

/* ============ BOOTSTRAP OVERRIDES ============ */

.btn {
    --bs-btn-border-radius: 2px;
    font-family: var(--disp);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-sm { font-size: 0.72rem; }

.btn-primary, .btn-light {
    --bs-btn-bg: var(--neon);
    --bs-btn-border-color: var(--neon);
    --bs-btn-color: var(--ink);
    --bs-btn-hover-bg: var(--neon-2);
    --bs-btn-hover-border-color: var(--neon-2);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-active-bg: var(--neon-2);
    --bs-btn-active-border-color: var(--neon-2);
    --bs-btn-active-color: var(--ink);
    --bs-btn-disabled-bg: #29433a;
    --bs-btn-disabled-border-color: #29433a;
    --bs-btn-disabled-color: rgba(233,244,236,.4);
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45);
}
.btn-primary:hover, .btn-light:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(0,0,0,.5); }
.btn-primary:active, .btn-light:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(0,0,0,.5); }
.btn-primary:disabled, .btn-light:disabled { box-shadow: none; }

.btn-outline-light, .btn-outline-secondary {
    --bs-btn-color: var(--cream-dim);
    --bs-btn-border-color: var(--line-strong);
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: var(--neon);
    --bs-btn-hover-color: var(--neon);
    --bs-btn-active-bg: var(--neon-dim);
    --bs-btn-active-border-color: var(--neon);
    --bs-btn-active-color: var(--neon);
    --bs-btn-disabled-color: rgba(233,244,236,.25);
    --bs-btn-disabled-border-color: var(--line);
}

.btn-outline-primary {
    --bs-btn-color: var(--neon);
    --bs-btn-border-color: rgba(61,255,158,.4);
    --bs-btn-hover-bg: var(--neon);
    --bs-btn-hover-border-color: var(--neon);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-active-bg: var(--neon-2);
    --bs-btn-active-border-color: var(--neon-2);
    --bs-btn-active-color: var(--ink);
}

.form-label {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.09em;
    text-transform: lowercase;
    color: var(--cream-dim);
    margin-bottom: 0.35rem;
}

.form-control, .form-select {
    background-color: var(--ink-2);
    border: 1px solid var(--line-strong);
    border-radius: 2px;
    color: var(--cream);
}
.form-control:focus, .form-select:focus {
    background-color: var(--ink-2);
    border-color: var(--neon);
    color: var(--cream);
    box-shadow: 0 0 0 3px var(--neon-dim);
}
.form-control::placeholder { color: rgba(233,244,236,.35); }
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23e9f4ec' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
}
.form-select option { background: var(--ink-2); color: var(--cream); }

.modal {
    --bs-modal-bg: var(--panel);
    --bs-modal-color: var(--cream);
    --bs-modal-border-color: var(--line-strong);
    --bs-modal-border-radius: 4px;
    --bs-modal-header-border-color: var(--line);
    --bs-modal-footer-border-color: var(--line);
}
.modal-title {
    font-family: var(--disp);
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.btn-close { filter: invert(1) grayscale(1) brightness(1.6); }
.modal hr { border-color: var(--line-strong); opacity: 1; }

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--cream);
    --bs-table-border-color: var(--line);
    --bs-table-striped-color: var(--cream);
    --bs-table-hover-color: var(--cream);
    --bs-table-hover-bg: var(--neon-faint);
}
.table thead th {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.09em;
    text-transform: lowercase;
    color: var(--cream-dim);
    border-bottom: 1px solid var(--line-strong);
}
.table td { font-size: 0.9rem; }

.text-danger { color: var(--danger) !important; }
.text-success { color: var(--neon) !important; }

.input-group .btn { z-index: 0; }

/* ============ LOGIN ============ */

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    position: relative;
    overflow-x: hidden;
    background:
        radial-gradient(ellipse 70% 55% at 78% 12%, rgba(61, 255, 158, 0.06), transparent 60%),
        radial-gradient(ellipse 55% 45% at 12% 92%, rgba(61, 255, 158, 0.04), transparent 60%),
        var(--ink);
}

.login-panel {
    width: min(940px, calc(100vw - 32px));
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: clamp(32px, 6vw, 72px);
    align-items: center;
    padding: 32px 0;
}

.brand-block { display: grid; gap: 20px; justify-items: start; }
.brand-mark { width: 62px; height: 62px; display: block; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-block .brand-word { font-size: clamp(3rem, 7vw, 4.6rem); }
.brand-block h2 {
    margin: 0;
    font-family: var(--disp);
    font-weight: 800;
    font-size: clamp(1.15rem, 2.2vw, 1.5rem);
    letter-spacing: 0.01em;
    color: var(--cream);
    max-width: 380px;
    line-height: 1.25;
}
.brand-block h2 em { font-style: normal; color: var(--neon); }
.brand-tagline { color: var(--cream-dim); }
.brand-features {
    margin: 0;
    padding: 14px 0 0;
    border-top: 1px solid var(--line);
    list-style: none;
    display: grid;
    gap: 8px;
    color: var(--cream-dim);
}
.brand-features li::before { content: "// "; color: var(--neon); }

.login-card {
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    padding: 30px 28px 26px;
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.35);
}
.login-card .neon-rule { margin: -30px -28px 26px; height: 3px; }
.login-card-label { display: block; color: var(--cream-dim); margin-bottom: 18px; }
.login-footer {
    position: absolute;
    bottom: 18px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(233, 244, 236, 0.32);
}

/* ============ APP SHELL ============ */

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 330px 1fr;
    background: var(--ink);
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    background: var(--ink-2);
    border-right: 1px solid var(--line);
    color: var(--cream);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}
.sidebar-brand .brand-mark { width: 36px; height: 36px; }
.sidebar-brand .brand-word { font-size: 1.6rem; }
.sidebar-brand .mono { margin-left: auto; color: var(--cream-dim); }

.profile-strip { display: flex; align-items: center; gap: 12px; }
.profile-strip strong { font-family: var(--disp); font-weight: 700; font-size: 0.95rem; }
.profile-strip span {
    display: block;
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.09em;
    text-transform: lowercase;
    color: var(--cream-dim);
    margin-top: 2px;
}

/* --conv-color: cor de destaque da conversa (grupos); padrao neon */
.avatar {
    position: relative;
    overflow: hidden;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--conv-color, var(--neon)) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--conv-color, var(--neon)) 34%, transparent);
    color: var(--conv-color, var(--neon));
    font-family: var(--disp);
    font-weight: 800;
}
/* img absoluta cobre todo o container e é recortada pelo overflow — assim o
   object-fit trabalha na área completa do avatar mesmo com o container em
   display:grid (onde 100%/100% não expandem sozinhos até as bordas). */
.avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.avatar-lg { width: 72px; height: 72px; border-radius: 16px; font-size: 1.6rem; }
.muted-avatar {
    background: var(--ink-3);
    border-color: var(--line-strong);
    color: var(--cream-dim);
}

.profile-avatar-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
}
.profile-avatar-actions {
    display: grid;
    gap: 6px;
    justify-items: start;
}
.profile-avatar-actions .mono { color: var(--cream-dim); }

.search-control {
    background-color: var(--ink);
    border-color: var(--line-strong);
    color: var(--cream);
}

/* ============ AÇÕES DA SIDEBAR (botão + flutuante) ============ */

.sidebar-fab {
    position: absolute;
    right: 16px;
    bottom: 16px;
    z-index: 55;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border: 0;
    border-radius: 14px;
    background: var(--neon);
    color: var(--ink);
    font-size: 30px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s;
}
.sidebar-fab:hover { background: var(--neon-2); transform: translate(-1px, -1px); box-shadow: 5px 5px 0 rgba(0,0,0,.5); }
.sidebar-fab[aria-expanded="true"] { background: var(--neon-2); transform: translate(1px, 1px); box-shadow: 2px 2px 0 rgba(0,0,0,.5); }

.action-menu {
    position: absolute;
    right: 16px;
    bottom: 82px;
    z-index: 60;
    min-width: 200px;
    padding: 6px;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4);
}
.action-menu[hidden] { display: none; }
.action-menu button {
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 2px;
    padding: 10px;
    text-align: left;
    color: var(--cream);
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.07em;
    text-transform: lowercase;
    display: block;
    cursor: pointer;
}
.action-menu button::before { content: "// "; color: var(--neon); }
.action-menu button:hover { background: var(--neon-dim); color: var(--neon); }
.action-menu .action-menu-danger { border-top: 1px solid var(--line); margin-top: 4px; }
.action-menu .action-menu-danger::before { color: var(--danger); }
.action-menu .action-menu-danger:hover { background: var(--danger-dim); color: var(--danger); }

/* ============ SELETOR DE COR DO GRUPO ============ */

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.color-swatch { margin: 0; cursor: pointer; }
.color-swatch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.color-swatch .swatch {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--sw) 22%, transparent);
    border: 1px solid color-mix(in srgb, var(--sw) 55%, transparent);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.color-swatch .swatch::after {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background: var(--sw);
}
.color-swatch .swatch-none { background: transparent; border: 1px dashed var(--line-strong); }
.color-swatch .swatch-none::after {
    background: transparent;
    width: 16px;
    height: 1px;
    border-radius: 0;
    border-top: 2px solid var(--cream-faint);
    transform: rotate(-45deg);
}
.color-swatch:hover .swatch { transform: translateY(-1px); }
.color-swatch input:checked + .swatch {
    box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--sw, var(--cream-dim));
}
.color-swatch input:focus-visible + .swatch {
    box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--neon);
}
.color-swatch input:disabled + .swatch { opacity: 0.4; cursor: not-allowed; }

/* ============ OPÇÃO DE TEMA (configurações) ============ */

.theme-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.theme-option { margin: 0; cursor: pointer; }
.theme-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.theme-option > span {
    display: grid;
    gap: 3px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    padding: 12px;
    transition: border-color 0.2s, background 0.2s;
}
.theme-option b {
    font-family: var(--disp);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.theme-option small {
    color: var(--cream-dim);
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
}
.theme-chip {
    display: block;
    height: 22px;
    border-radius: 3px;
    margin-bottom: 6px;
    border: 1px solid var(--line-strong);
}
.theme-chip-dark {
    background: linear-gradient(90deg, #0a0f0c 0 62%, #3dff9e 62% 76%, #10170f 76%);
}
.theme-chip-clean {
    background: linear-gradient(90deg, #f7f9f7 0 62%, #0dbd6e 62% 76%, #ffffff 76%);
}
.theme-option:hover > span { border-color: var(--cream-faint); }
.theme-option input:checked + span {
    border-color: var(--neon);
    background: var(--neon-dim);
}
.theme-option input:focus-visible + span { box-shadow: 0 0 0 3px var(--neon-dim); }

.conversation-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.conversation-filters button {
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--cream-dim);
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.07em;
    text-transform: lowercase;
    padding: 5px 12px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.conversation-filters button:hover { color: var(--cream); border-color: var(--cream-faint); }
.conversation-filters button.active {
    background: var(--neon-dim);
    border-color: rgba(61, 255, 158, 0.45);
    color: var(--neon);
}

.empty-conversations { color: var(--cream-dim); border-top: 1px solid var(--line); padding-top: 18px; }
.empty-conversations p { font-size: 14px; margin-top: 6px; }

.conversation-list { display: grid; gap: 4px; overflow: auto; min-height: 220px; align-content: start; padding-bottom: 80px; }
.conversation-item {
    width: 100%;
    min-height: 66px;
    border: 1px solid transparent;
    border-left: 3px solid var(--conv-color, transparent);
    border-radius: 4px;
    background: transparent;
    color: var(--cream);
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 8px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.conversation-item:hover { background: var(--ink-3); }
.conversation-item.active {
    background: var(--neon-faint);
    border-color: rgba(61, 255, 158, 0.28);
    border-left-color: var(--conv-color, rgba(61, 255, 158, 0.28));
}
.conversation-copy { min-width: 0; }
.conversation-copy strong,
.conversation-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-copy strong { font-size: 0.92rem; }
.conversation-copy small, .conversation-meta small { color: var(--cream-dim); font-size: 0.78rem; }
.conversation-meta { display: grid; gap: 5px; justify-items: end; }
.conversation-meta small { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.04em; }
.conversation-meta b {
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 6px;
    background: var(--conv-color, var(--neon));
    color: var(--ink);
    display: grid;
    place-items: center;
    font-family: var(--disp);
    font-size: 11px;
    font-weight: 800;
}

/* ============ WORKSPACE / CHAT ============ */

.workspace { padding: 24px; overflow: auto; }
.workspace-chat-only { display: grid; grid-template-rows: minmax(0, 1fr); }
.workspace-chat-only .chat-panel {
    height: calc(100vh - 48px);
    min-height: 0;
    margin-bottom: 0;
}

.chat-panel {
    height: min(72vh, 720px);
    min-height: 520px;
    display: flex;
    flex-direction: column;
    background: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 22px;
}
.chat-panel > .chat-header,
.chat-panel > .message-search-results,
.chat-panel > .composer { flex: 0 0 auto; }
.chat-panel > .message-history { flex: 1 1 auto; min-height: 0; }

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--ink-2);
    border-bottom: 1px solid var(--line);
}
.chat-peer { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-peer h1 {
    margin: 0;
    font-family: var(--disp);
    font-weight: 800;
    font-size: 1.05rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-peer p {
    margin: 2px 0 0;
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.07em;
    text-transform: lowercase;
    color: var(--cream-dim);
}
.chat-peer p.is-typing { color: var(--neon); }
.chat-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.chat-actions .form-control { width: 190px; }

.message-history {
    padding: 18px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, var(--neon-faint), transparent 70%),
        repeating-linear-gradient(0deg, var(--grid-line) 0 1px, transparent 1px 28px),
        repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px 28px),
        var(--ink);
}

.message-search-results {
    max-height: 180px;
    overflow: auto;
    background: var(--ink-2);
    border-bottom: 1px solid var(--line);
    padding: 8px 12px;
    display: grid;
    gap: 6px;
}
.message-search-results[hidden] { display: none; }
.message-search-item {
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--ink-3);
    color: var(--cream);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    text-align: left;
    cursor: pointer;
}
.message-search-item:hover { border-color: rgba(61,255,158,.35); }
.message-search-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-search-item small { color: var(--cream-dim); font-family: var(--mono); font-size: 0.62rem; }

.empty-state { color: var(--cream-dim); text-align: center; padding: 18px; }

.message-bubble {
    position: relative;
    width: fit-content;
    max-width: min(680px, 78%);
    padding: 9px 11px 6px;
    border-radius: 8px;
    border: 1px solid var(--line);
}
.message-bubble.mine {
    align-self: flex-end;
    background: var(--bubble-mine);
    border-color: var(--bubble-mine-border);
    border-radius: 8px 8px 2px 8px;
}
.message-bubble.theirs {
    align-self: flex-start;
    background: var(--bubble-theirs);
    border-radius: 8px 8px 8px 2px;
}
.message-bubble.is-highlighted, .system-message.is-highlighted {
    outline: 2px solid rgba(61, 255, 158, 0.55);
    outline-offset: 2px;
}
.message-bubble p {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 0.95rem;
}
.message-bubble time {
    display: block;
    margin-top: 4px;
    color: var(--cream-dim);
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.05em;
    text-align: right;
}
.message-check { color: var(--cream-faint); letter-spacing: -0.08em; }
.message-check.is-read { color: var(--neon); }

.date-separator { align-self: center; padding: 4px 0; }
.date-separator span {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    background: var(--ink-3);
    border: 1px solid var(--line);
    color: var(--cream-dim);
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.09em;
    text-transform: lowercase;
}

.unread-divider { align-self: center; padding: 4px 0; }
.unread-divider span {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    background: var(--neon-dim);
    border: 1px solid rgba(61, 255, 158, 0.35);
    color: var(--neon);
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.09em;
    text-transform: lowercase;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    padding: clamp(16px, 4vw, 48px);
    background: rgba(4, 7, 5, 0.92);
    cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.4);
}

/* mensagens consecutivas do mesmo remetente ficam agrupadas */
.message-bubble.is-continuation { margin-top: -5px; }
.message-bubble.is-continuation .sender-name { display: none; }
.message-bubble.mine.is-continuation { border-top-right-radius: 3px; }
.message-bubble.theirs.is-continuation { border-top-left-radius: 3px; }
.sender-name {
    display: block;
    color: var(--neon);
    font-family: var(--mono);
    font-size: 0.64rem;
    letter-spacing: 0.07em;
    text-transform: lowercase;
    margin-bottom: 3px;
}

.message-tools {
    display: none;
    gap: 6px;
    justify-content: flex-end;
    margin-bottom: 4px;
}
.message-bubble:hover .message-tools,
.message-bubble.show-tools .message-tools { display: flex; }
.message-tools button {
    border: 1px solid rgba(61, 255, 158, 0.3);
    border-radius: 3px;
    background: var(--quote-bg);
    color: var(--neon);
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.05em;
    text-transform: lowercase;
    padding: 3px 7px;
    cursor: pointer;
}
.message-tools button:hover { background: var(--neon); color: var(--ink); }

.reply-quote {
    display: grid;
    gap: 2px;
    border-left: 3px solid var(--neon);
    background: var(--quote-bg);
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    max-width: 320px;
}
.reply-quote strong {
    font-family: var(--mono);
    font-weight: 400;
    font-size: 0.64rem;
    letter-spacing: 0.07em;
    text-transform: lowercase;
    color: var(--neon);
}
.reply-quote span {
    color: var(--cream-dim);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.system-message {
    align-self: center;
    max-width: min(520px, 90%);
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--ink-3);
    border: 1px solid var(--line);
    color: var(--cream-dim);
    font-family: var(--mono);
    font-size: 0.64rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    text-align: center;
}

.media-preview {
    display: block;
    max-width: min(420px, 100%);
    margin-bottom: 6px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.media-preview img, video.media-preview {
    width: 100%;
    max-height: 340px;
    object-fit: contain;
    display: block;
    background: #050807;
}
.audio-preview { width: min(360px, 100%); display: block; }
.audio-message {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}
.audio-duration {
    color: var(--cream-dim);
    font-family: var(--mono);
    font-size: 0.64rem;
    letter-spacing: 0.05em;
}
.document-preview {
    width: min(360px, 100%);
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid var(--line-strong);
    border-left: 3px solid var(--neon);
    background: var(--quote-bg);
    color: var(--cream);
    text-decoration: none;
    margin-bottom: 6px;
}
.document-preview:hover { border-color: var(--neon); color: var(--cream); }
.document-preview span { color: var(--cream-dim); font-family: var(--mono); font-size: 0.62rem; }

/* ============ COMPOSER ============ */

.composer {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 46px;
    gap: 10px;
    padding: 12px;
    background: var(--ink-2);
    border-top: 1px solid var(--line);
}

/* um só botão de ação: mic quando vazio, enviar quando há conteúdo */
.composer .send-button {
    display: none;
    place-items: center;
    width: 46px;
    height: 42px;
    padding: 0;
}
.composer .send-button svg { width: 18px; height: 18px; }
.composer.composing .send-button { display: grid; }
.composer.composing .audio-record-button { display: none; }
.composer textarea {
    resize: none;
    min-height: 42px;
    max-height: 110px;
    border: 1px solid var(--line-strong);
    border-radius: 2px;
    background: var(--ink);
    color: var(--cream);
    padding: 10px 12px;
    outline: none;
    font-family: var(--body);
}
.composer textarea::placeholder { color: rgba(233,244,236,.35); }
.composer textarea:focus { border-color: var(--neon); box-shadow: 0 0 0 3px var(--neon-dim); }
.composer textarea:disabled { opacity: 0.5; }

.reply-preview {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--neon);
    background: var(--ink-3);
    border-radius: 4px;
    padding: 8px 10px;
}
.reply-preview[hidden] { display: none; }
.reply-preview span { display: grid; gap: 2px; min-width: 0; }
.reply-preview strong {
    font-family: var(--mono);
    font-weight: 400;
    font-size: 0.64rem;
    letter-spacing: 0.07em;
    text-transform: lowercase;
    color: var(--neon);
}
.reply-preview em {
    color: var(--cream-dim);
    font-style: normal;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reply-preview button {
    border: 0;
    background: transparent;
    color: var(--danger);
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    cursor: pointer;
}

.attach-menu { position: relative; }
.attach-button {
    width: 42px;
    height: 42px;
    border-radius: 2px;
    border: 1px solid var(--line-strong);
    display: grid;
    place-items: center;
    font-size: 24px;
    line-height: 1;
    color: var(--neon);
    cursor: pointer;
    margin: 0;
    background: transparent;
    transition: border-color 0.2s, background 0.2s;
}
.attach-button:hover { background: var(--neon-dim); border-color: var(--neon); }
.attach-options {
    position: absolute;
    left: 0;
    bottom: 50px;
    z-index: 20;
    min-width: 160px;
    padding: 6px;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4);
}
.attach-options[hidden] { display: none; }
.attach-options button,
.attach-options label {
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 2px;
    padding: 9px 10px;
    text-align: left;
    color: var(--cream);
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.07em;
    text-transform: lowercase;
    display: block;
    cursor: pointer;
    margin: 0;
}
.attach-options button:hover,
.attach-options label:hover { background: var(--neon-dim); color: var(--neon); }
.attach-options label::before { content: "// "; color: var(--neon); }

.file-input-hidden {
    position: fixed;
    left: -1000px;
    top: -1000px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.audio-record-button {
    width: 46px;
    height: 42px;
    border-radius: 2px;
    border: 1px solid var(--line-strong);
    background: transparent;
    color: var(--neon);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.audio-record-button svg { width: 18px; height: 18px; }
.audio-record-button:hover { background: var(--neon-dim); border-color: var(--neon); }
.audio-record-button:disabled { opacity: 0.4; }
.audio-record-button.is-recording {
    background: var(--danger-dim);
    border-color: var(--danger);
    color: var(--danger);
}

.attachment-preview {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    color: var(--cream-dim);
    font-size: 13px;
}
.attachment-preview:empty { display: none; }
.attachment-preview button {
    border: 0;
    background: transparent;
    color: var(--danger);
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    cursor: pointer;
}
.attachment-thumb {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 10px;
    align-items: center;
    min-width: 0;
}
.attachment-thumb img {
    grid-row: 1 / 3;
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--line-strong);
}
.attachment-thumb strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--cream);
}
.attachment-thumb small { color: var(--cream-dim); font-family: var(--mono); font-size: 0.62rem; }
.attachment-sending { margin-left: auto; color: var(--neon); font-family: var(--mono); font-size: 0.66rem; }

.recording-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto auto minmax(140px, 1fr) auto auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid rgba(255, 122, 104, 0.4);
    border-radius: 4px;
    background: var(--danger-dim);
}
.recording-panel[hidden] { display: none; }
.recording-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--danger);
    animation: recordPulse 1.2s infinite;
}
.recording-panel strong { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.05em; }
.recording-panel span#recordingStatus {
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.07em;
    text-transform: lowercase;
    color: var(--cream-dim);
}
.recording-panel button {
    border: 1px solid var(--line-strong);
    border-radius: 2px;
    background: transparent;
    padding: 7px 10px;
    color: var(--cream);
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    cursor: pointer;
}
.recording-panel button:hover { border-color: var(--neon); color: var(--neon); }
.recording-panel button:disabled { opacity: 0.5; cursor: not-allowed; }
.recording-panel audio { grid-column: 1 / -1; width: 100%; }
@keyframes recordPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 122, 104, 0.55); }
    70% { box-shadow: 0 0 0 8px rgba(255, 122, 104, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 122, 104, 0); }
}

/* ============ ADMIN ============ */

.admin-area {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid var(--line-strong);
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.admin-tag { display: block; color: var(--neon); margin-bottom: 8px; }
.admin-header h1 {
    margin: 0;
    font-family: var(--disp);
    font-weight: 900;
    font-size: 1.6rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1;
}
.admin-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metrics-grid article {
    position: relative;
    background:
        radial-gradient(ellipse 90% 90% at 100% 0%, var(--neon-faint), transparent 55%),
        var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    padding: 18px;
    overflow: hidden;
    transition: transform 0.15s ease, border-color 0.2s;
}
.metrics-grid article::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 34px;
    height: 3px;
    background: var(--neon);
}
.metrics-grid article:hover { transform: translateY(-2px); border-color: rgba(61, 255, 158, 0.35); }
.metrics-grid span {
    display: block;
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: var(--cream-dim);
    margin-bottom: 10px;
}
.metrics-grid strong { font-family: var(--disp); font-weight: 900; font-size: 2.2rem; line-height: 1; }

.admin-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; }
.admin-panel {
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    padding: 18px;
}
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading h2, .admin-panel h2 {
    margin: 0;
    font-family: var(--disp);
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.panel-search { max-width: 300px; }

.user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar-sm { width: 34px; height: 34px; border-radius: 8px; font-size: 0.85rem; }
.user-cell-copy { display: grid; min-width: 0; }
.user-cell-copy strong,
.user-cell-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-cell-copy strong { font-size: 0.9rem; }
.user-cell-copy small { color: var(--cream-dim); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.04em; }

.role-tag {
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.07em;
    text-transform: lowercase;
    color: var(--cream-dim);
}
.role-tag.admin { color: var(--amber); }
.role-tag::before { content: "// "; }

.status-pill {
    border-radius: 3px;
    padding: 3px 8px;
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.07em;
    text-transform: lowercase;
}
.status-pill.active { background: var(--neon-dim); color: var(--neon); border: 1px solid rgba(61,255,158,.3); }
.status-pill.blocked { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(255,122,104,.3); }
.status-pill.inactive { background: rgba(233,244,236,.07); color: var(--cream-dim); border: 1px solid var(--line); }

.log-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.log-list li { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.log-list strong { font-family: var(--mono); font-weight: 400; font-size: 0.72rem; letter-spacing: 0.05em; color: var(--neon); }
.log-list span { display: block; color: var(--cream-dim); font-size: 13px; margin-top: 2px; }
.mini-metrics { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 14px; }
.mini-metrics span {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 8px 10px;
    color: var(--cream-dim);
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
}
.mini-metrics strong { color: var(--cream); font-family: var(--disp); }

/* ============ LISTAS / MODAIS ============ */

.contact-list { display: grid; gap: 8px; }
.contact-item {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    background: var(--ink-2);
    color: var(--cream);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.contact-item:hover { border-color: rgba(61,255,158,.4); background: var(--neon-faint); }
.contact-item span:last-child { display: grid; }
.contact-item small { color: var(--cream-dim); }
.selectable-list { max-height: 320px; overflow: auto; }
.selectable-contact { cursor: pointer; }
.selectable-contact input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    accent-color: var(--neon);
}

.group-member-list { display: grid; gap: 8px; max-height: 420px; overflow: auto; }
.group-member {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    padding: 10px;
    background: var(--ink-2);
}
.group-member-copy { min-width: 0; display: grid; }
.group-member-copy strong,
.group-member-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-member-copy small { color: var(--cream-dim); }
.group-member-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.group-member-actions button {
    border: 1px solid rgba(61,255,158,.35);
    border-radius: 3px;
    background: transparent;
    padding: 5px 8px;
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.05em;
    text-transform: lowercase;
    color: var(--neon);
    cursor: pointer;
}
.group-member-actions button:hover { background: var(--neon); color: var(--ink); }

.modal .modal-body h6 {
    font-family: var(--mono);
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: var(--cream-dim);
}

/* elementos mobile ficam ocultos no desktop */
.mobile-home-header,
.conversation-filters-mobile-only,
.mobile-bottom-nav,
.mobile-back-button {
    display: none;
}

/* ============ RESPONSIVO — TABLET ============ */

@media (max-width: 920px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; min-height: auto; max-height: none; align-self: auto; }
    .admin-grid, .login-panel { grid-template-columns: 1fr; }
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .brand-block { justify-items: center; text-align: center; }
    .brand-features { justify-items: start; }
    .workspace { padding: 14px; }
    .chat-panel { height: 70vh; min-height: 480px; }
    .chat-header { align-items: flex-start; flex-direction: column; }
    .chat-actions { justify-content: stretch; width: 100%; }
    .chat-actions .form-control { width: 100%; }
    .message-bubble { max-width: 92%; }
    .recording-panel { grid-template-columns: auto auto minmax(0, 1fr); }
    .group-member { grid-template-columns: 44px minmax(0, 1fr); }
    .group-member-actions { grid-column: 1 / -1; justify-content: stretch; }
}

/* ============ RESPONSIVO — MOBILE ============ */

@media (max-width: 720px) {
    html, body { min-height: 100%; }
    body.app-shell {
        min-height: 100dvh;
        display: block;
        background: var(--ink);
        overflow: hidden;
    }

    .sidebar {
        min-height: 100dvh;
        height: 100dvh;
        padding: 16px 14px 84px;
        background: var(--ink);
        border-right: 0;
        gap: 12px;
        overflow: hidden;
        position: relative;
    }

    body.chat-open .sidebar { display: none; }

    .sidebar-brand { display: none; }

    .workspace {
        display: none;
        padding: 0;
        height: 100dvh;
        overflow: hidden;
        background: var(--ink);
    }
    body.chat-open .workspace { display: block; }

    .mobile-home-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 2px 0 6px;
    }
    .mobile-home-header .brand-word { font-size: 2rem; }
    .mobile-home-actions { display: flex; align-items: center; gap: 8px; }
    .mobile-icon-button {
        width: 42px;
        height: 42px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--cream);
        font-size: 28px;
        line-height: 1;
    }

    .profile-strip { display: none; }

    .sidebar-fab {
        position: fixed;
        right: 20px;
        bottom: 88px;
        width: 60px;
        height: 60px;
        font-size: 32px;
        z-index: 30;
    }
    .action-menu {
        position: fixed;
        top: auto;
        right: 20px;
        bottom: 160px;
        left: auto;
        z-index: 40;
        min-width: 210px;
    }
    .action-menu button { padding: 13px 12px; font-size: 0.78rem; }

    .search-control {
        height: 50px;
        border-radius: 4px;
        font-size: 16px;
        padding: 0 16px;
    }

    .conversation-filters { flex-wrap: nowrap; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
    .conversation-filters::-webkit-scrollbar { display: none; }
    .conversation-filters button { flex: 0 0 auto; min-height: 36px; font-size: 0.72rem; padding: 6px 14px; }

    #unreadFilterCount:not(:empty)::before { content: " "; }

    .conversation-list {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
        display: block;
        padding: 6px 0 0;
    }
    .conversation-item {
        min-height: 76px;
        border-radius: 0;
        border: 0;
        border-bottom: 1px solid var(--line);
        grid-template-columns: 54px minmax(0, 1fr) auto;
        gap: 12px;
        padding: 10px 4px;
    }
    .conversation-item.active { background: transparent; }
    .conversation-item:hover { background: var(--ink-2); }
    .conversation-item .avatar { width: 54px; height: 54px; font-size: 20px; border-radius: 12px; }
    .conversation-copy strong { font-size: 1.02rem; line-height: 1.2; }
    .conversation-copy small { margin-top: 4px; font-size: 0.85rem; }

    .empty-conversations { border: 0; padding: 40px 20px; text-align: center; }

    .mobile-bottom-nav {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 66px;
        background: var(--ink-2);
        border-top: 1px solid var(--line-strong);
        z-index: 25;
    }
    .mobile-bottom-nav button {
        border: 0;
        background: transparent;
        color: var(--cream-dim);
        font-family: var(--mono);
        font-size: 0.62rem;
        letter-spacing: 0.05em;
        text-transform: lowercase;
        padding: 8px 2px;
    }
    .mobile-bottom-nav button.active {
        color: var(--neon);
        box-shadow: inset 0 2px 0 var(--neon);
    }
    .mobile-bottom-nav button:disabled { opacity: 0.45; }

    .chat-panel,
    .workspace-chat-only .chat-panel {
        height: 100dvh;
        min-height: 0;
        border: 0;
        border-radius: 0;
        margin: 0;
    }

    .chat-header {
        min-height: 62px;
        padding: 8px 10px;
        flex-direction: row;
        align-items: center;
    }
    .chat-peer { flex: 1 1 auto; gap: 8px; }

    .mobile-back-button {
        display: grid;
        place-items: center;
        width: 34px;
        height: 42px;
        border: 0;
        background: transparent;
        color: var(--cream);
        font-size: 38px;
        line-height: 1;
        padding: 0;
    }

    .chat-peer .avatar { width: 42px; height: 42px; }
    .chat-peer h1 { font-size: 1rem; max-width: 170px; }

    .chat-actions { flex: 0 0 auto; width: auto; gap: 4px; justify-content: flex-end; }
    .chat-actions .form-control,
    #muteConversation,
    #loadOlderMessages { display: none; }

    #archiveConversation,
    #groupInfoButton {
        border: 0;
        background: transparent;
        color: var(--cream-dim);
        font-size: 0.62rem;
        padding: 6px;
    }
    #groupInfoButton:disabled { display: none; }

    .message-history { padding: 12px 10px; gap: 6px; }
    .message-bubble { max-width: 86%; padding: 8px 10px 5px; }

    .composer {
        grid-template-columns: 38px minmax(0, 1fr) 42px;
        gap: 7px;
        padding: 8px;
    }
    .composer textarea { min-height: 42px; border-radius: 4px; padding: 10px 14px; }
    .attach-button, .audio-record-button { width: 38px; height: 42px; border: 0; background: transparent; }
    .composer .send-button { width: 42px; height: 42px; border-radius: 10px; box-shadow: none; }
    .composer .send-button:hover { transform: none; box-shadow: none; }

    .attachment-preview {
        background: var(--ink-2);
        border: 1px solid var(--line);
        border-radius: 4px;
        padding: 8px;
    }

    .login-footer { position: static; margin-top: 24px; }
    .login-card { box-shadow: 5px 5px 0 rgba(0,0,0,.35); }
}

/* ============================================================
   TEMA CLEAN — claro e minimalista (opção em configurações)
   mesma família visual: mono labels, cantos retos, acento verde
   ============================================================ */

html[data-theme="clean"] {
    --ink: #eef1ee;
    --ink-2: #f7f9f7;
    --ink-3: #e5ebe6;
    --panel: #ffffff;
    --line: rgba(15, 26, 19, 0.08);
    --line-strong: rgba(15, 26, 19, 0.17);
    --cream: #17231b;
    --cream-dim: rgba(23, 35, 27, 0.58);
    --cream-faint: rgba(23, 35, 27, 0.32);
    --neon: #0dbd6e;
    --neon-2: #0aa35f;
    --neon-dim: rgba(13, 189, 110, 0.12);
    --neon-faint: rgba(13, 189, 110, 0.055);
    --danger: #d84a35;
    --danger-dim: rgba(216, 74, 53, 0.1);
    --amber: #a87e00;
    --bubble-mine: #d9f3e6;
    --bubble-mine-border: rgba(13, 189, 110, 0.35);
    --bubble-theirs: #ffffff;
    --grid-line: rgba(15, 26, 19, 0.04);
    --quote-bg: rgba(15, 26, 19, 0.05);
    --scroll-thumb: rgba(15, 26, 19, 0.25);
}

/* texto claro sobre o verde do tema clean */
html[data-theme="clean"] ::selection { color: #ffffff; }
html[data-theme="clean"] .btn-primary,
html[data-theme="clean"] .btn-light {
    --bs-btn-color: #ffffff;
    --bs-btn-hover-color: #ffffff;
    --bs-btn-active-color: #ffffff;
    --bs-btn-disabled-bg: #bcd6c8;
    --bs-btn-disabled-border-color: #bcd6c8;
    --bs-btn-disabled-color: rgba(23, 35, 27, 0.4);
}
html[data-theme="clean"] .btn-outline-primary {
    --bs-btn-border-color: rgba(13, 189, 110, 0.5);
    --bs-btn-hover-color: #ffffff;
    --bs-btn-active-color: #ffffff;
}
html[data-theme="clean"] .sidebar-fab { color: #ffffff; }
html[data-theme="clean"] .conversation-meta b { color: #ffffff; }
html[data-theme="clean"] .message-tools button { background: rgba(255, 255, 255, 0.75); }

/* controles nativos */
html[data-theme="clean"] .btn-close { filter: none; }
html[data-theme="clean"] .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2317231b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
}
html[data-theme="clean"] .form-control::placeholder { color: rgba(23, 35, 27, 0.4); }

/* sombras duras mais suaves no claro */
html[data-theme="clean"] .btn-primary,
html[data-theme="clean"] .btn-light { box-shadow: 3px 3px 0 rgba(15, 26, 19, 0.18); }
html[data-theme="clean"] .btn-primary:hover,
html[data-theme="clean"] .btn-light:hover { box-shadow: 4px 4px 0 rgba(15, 26, 19, 0.2); }
html[data-theme="clean"] .btn-primary:active,
html[data-theme="clean"] .btn-light:active { box-shadow: 1px 1px 0 rgba(15, 26, 19, 0.2); }
html[data-theme="clean"] .sidebar-fab { box-shadow: 4px 4px 0 rgba(15, 26, 19, 0.18); }
html[data-theme="clean"] .sidebar-fab:hover { box-shadow: 5px 5px 0 rgba(15, 26, 19, 0.2); }
html[data-theme="clean"] .login-card { box-shadow: 8px 8px 0 rgba(15, 26, 19, 0.1); }
html[data-theme="clean"] .action-menu,
html[data-theme="clean"] .attach-options { box-shadow: 6px 6px 0 rgba(15, 26, 19, 0.12); }

/* cores de grupo mais escuras para contraste no claro */
html[data-theme="clean"] .avatar {
    color: color-mix(in srgb, var(--conv-color, var(--neon)) 62%, #10231a);
    background: color-mix(in srgb, var(--conv-color, var(--neon)) 16%, transparent);
    border-color: color-mix(in srgb, var(--conv-color, var(--neon)) 45%, transparent);
}
html[data-theme="clean"] .muted-avatar {
    color: var(--cream-dim);
    background: var(--ink-3);
    border-color: var(--line-strong);
}
html[data-theme="clean"] .conversation-meta b {
    background: color-mix(in srgb, var(--conv-color, var(--neon)) 78%, #10231a);
}
