:root {
    --verde: #00a884;
    --verde-escuro: #008069;
    --cinza-fundo: #f0f2f5;
    --cinza-borda: #d1d7db;
    --texto: #111b21;
    --texto-secundario: #667781;

    --bg-page: #f0f2f5;
    --bg-surface: #ffffff;
    --ativa-bg: #e9edef;
    --divider: #f2f2f2;
    --bubble-in: #ffffff;
    --bubble-out: #d9fdd3;
    --wallpaper-bg: #efeae2;
    --wallpaper-img: url("../img/wallpaper-light.jpg?v=2");
    --wallpaper-overlay: rgba(239, 234, 226, 0.76);
    --tick-lido: #53bdeb;
    --status-off: #999999;
    --icon-hover: rgba(0, 0, 0, 0.05);
    --doc-chip-bg: rgba(0, 0, 0, 0.03);
    --shadow-card: rgba(0, 0, 0, 0.08);
    --shadow-balao: rgba(0, 0, 0, 0.13);
    --danger: #a4262c;
    --danger-bg: #fdecea;
    --danger-borda: #f5c2c7;
    --aguardando: #b26a00;
    --aguardando-bg: rgba(255, 152, 0, 0.14);
}

/* Segue o tema do sistema quando o usuário ainda não escolheu manualmente */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --cinza-fundo: #202c33;
        --cinza-borda: #222d34;
        --texto: #e9edef;
        --texto-secundario: #8696a0;

        --bg-page: #0b141a;
        --bg-surface: #202c33;
        --ativa-bg: #2a3942;
        --divider: #222d34;
        --bubble-in: #202c33;
        --bubble-out: #005c4b;
        --wallpaper-bg: #0b141a;
        --wallpaper-img: url("../img/wallpaper-dark.jpg?v=2");
        --wallpaper-overlay: rgba(11, 20, 26, 0.72);
        --status-off: #5a6a72;
        --icon-hover: rgba(255, 255, 255, 0.08);
        --doc-chip-bg: rgba(255, 255, 255, 0.06);
        --shadow-card: rgba(0, 0, 0, 0.4);
        --shadow-balao: rgba(0, 0, 0, 0.35);
        --danger: #ff6b6b;
        --danger-bg: rgba(255, 107, 107, 0.12);
        --danger-borda: rgba(255, 107, 107, 0.35);
        --aguardando: #ffb84d;
        --aguardando-bg: rgba(255, 152, 0, 0.16);
    }
}

/* Escolha manual do usuário (botão de tema), sempre vence */
:root[data-theme="dark"] {
    --cinza-fundo: #202c33;
    --cinza-borda: #222d34;
    --texto: #e9edef;
    --texto-secundario: #8696a0;

    --bg-page: #0b141a;
    --bg-surface: #202c33;
    --ativa-bg: #2a3942;
    --divider: #222d34;
    --bubble-in: #202c33;
    --bubble-out: #005c4b;
    --wallpaper-bg: #0b141a;
    --wallpaper-img: url("../img/wallpaper-dark.jpg?v=2");
    --wallpaper-overlay: rgba(11, 20, 26, 0.72);
    --status-off: #5a6a72;
    --icon-hover: rgba(255, 255, 255, 0.08);
    --doc-chip-bg: rgba(255, 255, 255, 0.06);
    --shadow-card: rgba(0, 0, 0, 0.4);
    --shadow-balao: rgba(0, 0, 0, 0.35);
    --danger: #ff6b6b;
    --danger-bg: rgba(255, 107, 107, 0.12);
    --danger-borda: rgba(255, 107, 107, 0.35);
    --aguardando: #ffb84d;
    --aguardando-bg: rgba(255, 152, 0, 0.16);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    color: var(--texto);
    background: var(--bg-page);
    display: flex;
    flex-direction: column;
}

.topo-app {
    flex-shrink: 0;
}

a {
    color: var(--verde-escuro);
}

.tela-centralizada {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cartao {
    background: var(--bg-surface);
    border-radius: 12px;
    box-shadow: 0 2px 12px var(--shadow-card);
    padding: 40px;
    width: 100%;
    max-width: 380px;
}

.cartao h1 {
    font-size: 22px;
    margin: 0 0 4px;
    text-align: center;
}
.cartao h1.marca-zaptalks { display:flex; align-items:center; justify-content:center; gap:10px; }
.marca-zaptalks img { width:48px; height:48px; object-fit:contain; }

.cartao .subtitulo {
    text-align: center;
    color: var(--texto-secundario);
    font-size: 14px;
    margin: 0 0 24px;
}

.auth-link-secundario {
    text-align: center;
    font-size: 13.5px;
    color: var(--texto-secundario);
    margin: 20px 0 0;
}

.auth-link-secundario a {
    color: var(--verde-escuro);
    font-weight: 600;
    text-decoration: none;
}

.auth-link-secundario a:hover {
    text-decoration: underline;
}

.auth-acoes-ajuda { display:flex; align-items:center; justify-content:center; gap:8px; margin:16px 0 4px; font-size:12px; color:var(--texto-secundario); }
.auth-acoes-ajuda a, .auth-voltar { color:var(--verde-escuro); text-decoration:none; }.auth-acoes-ajuda a:hover, .auth-voltar:hover { text-decoration:underline; }
.auth-recuperacao-card { max-width:440px; text-align:center; }.auth-recuperacao-card form { text-align:left; }.auth-recuperacao-icone { width:56px; height:56px; display:grid; place-items:center; margin:0 auto 13px; border-radius:16px; background:rgba(0,168,132,.12); font-size:25px; }.auth-voltar { display:inline-block; margin-top:18px; font-size:12px; }.auth-botao-link { display:block; text-decoration:none; }
.download-windows { display:flex; align-items:center; gap:11px; margin:18px 0 4px; padding:12px 13px; border:1px solid var(--cinza-borda); border-radius:11px; background:var(--bg-page); color:var(--texto); text-align:left; text-decoration:none; transition:border-color .16s ease, transform .16s ease, background .16s ease; }.download-windows:hover { border-color:var(--verde); background:rgba(0,168,132,.07); transform:translateY(-1px); }.download-windows-icone { width:35px; height:35px; display:grid; place-items:center; flex-shrink:0; border-radius:9px; background:#087cd5; color:#fff; }.download-windows-icone svg { width:20px; height:20px; fill:currentColor; }.download-windows > span:nth-child(2) { display:flex; flex:1; flex-direction:column; gap:2px; }.download-windows strong { font-size:12px; }.download-windows small { color:var(--texto-secundario); font-size:10px; }.download-windows-seta { color:var(--verde-escuro); font-size:20px; font-weight:700; }
.app-desktop .somente-web { display:none !important; }

.campo {
    margin-bottom: 16px;
}

.campo label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.campo input,
.campo select,
.campo textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--cinza-borda);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-surface);
    color: var(--texto);
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
    outline: none;
    border-color: var(--verde);
}

/* Sem isso, textarea cai no estilo cru do navegador (fonte monoespaçada,
   canto reto) — destoando de tudo em volta que já segue o mesmo visual. */
.campo textarea {
    font-family: inherit;
    line-height: 1.4;
    resize: vertical;
    min-height: 70px;
}

.botao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    background: var(--verde);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.botao:hover {
    background: var(--verde-escuro);
}

.botao.secundario {
    background: var(--bg-surface);
    color: var(--texto);
    border: 1px solid var(--cinza-borda);
}

.botao.secundario:hover {
    background: var(--cinza-fundo);
}

.botao:disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.alerta {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-borda);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alerta.sucesso {
    background: var(--success-bg, #e8f7ee);
    color: var(--verde-escuro);
    border-color: var(--success-border, #9dd8b2);
}

.topo-app {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--cinza-borda);
}

.topo-app .marca {
    font-weight: 700;
    color: var(--verde-escuro);
}

.botao-tema {
    border: 1px solid var(--cinza-borda);
    background: var(--bg-surface);
    color: var(--texto);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.botao-tema:hover {
    background: var(--icon-hover);
}

/* =====================================================
   SIDEBAR ESTILO WHATSAPP WEB
===================================================== */

.sidebar-app {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;

    width: 64px;
    height: 100vh;

    background: var(--cinza-fundo);
    border-right: 1px solid var(--cinza-borda);

    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;

    padding: 8px 0;

    z-index: 1000;

    overflow: hidden;
}

/* Grupos */

.sidebar-top,
.sidebar-bottom {
    width: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 8px;
}


/* Item */

.sidebar-item {
    position: relative;

    width: 44px;
    height: 44px;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    text-decoration: none;

    color: #54656f;

    transition:
        background .15s ease,
        color .15s ease;
}


.sidebar-item:hover {
    background: #e1e4e6;
    color: #111b21;
}


/* item selecionado */

.sidebar-item.ativo {
    background: #d9dbdf;
    color: #111b21;
}


/* SVG */

.sidebar-item svg {
    width: 23px;
    height: 23px;

    fill: none;

    stroke: currentColor;
    stroke-width: 1.8;

    stroke-linecap: round;
    stroke-linejoin: round;
}


/* Badge verde */

.sidebar-badge {
    position: absolute;

    right: 0;
    top: -2px;

    min-width: 18px;
    height: 18px;

    padding: 0 5px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #25d366;
    color: #fff;

    border-radius: 10px;

    font-size: 10px;
    font-weight: 700;

    border: 2px solid #f0f2f5;
}


/* botão tema */

.sidebar-button {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}


/* Perfil */

.sidebar-avatar {
    width: 40px;
    height: 40px;

    border-radius: 50%;

    overflow: hidden;

    display: flex;
    align-items: center;
    justify-content: center;

    text-decoration: none;

    background: #dfe3e5;
    color: #111b21;

    font-size: 16px;
    font-weight: 600;

    border: 1px solid #d1d7db;
}


.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* =====================================================
   CONTEÚDO DA APLICAÇÃO
===================================================== */

/*
 * Como a sidebar ocupa 64px,
 * o conteúdo precisa começar depois dela.
 */

body {
    margin: 0;
}


/* =====================================================
   ESPAÇO PARA A BARRA LATERAL
===================================================== */

body.com-sidebar {
    padding-left: 64px;
}

/*
 * A sidebar continua presa na esquerda da tela
 * e não participa do espaço do body.
 */
body.com-sidebar .sidebar-app {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;

    width: 64px;
    z-index: 1000;
}
/* =====================================================
   DARK MODE
===================================================== */

html[data-theme="dark"] .sidebar-app {
    background: #202c33;
    border-right-color: #374248;
}


html[data-theme="dark"] .sidebar-item {
    color: #aebac1;
}


html[data-theme="dark"] .sidebar-item:hover,
html[data-theme="dark"] .sidebar-item.ativo {
    background: #374248;
    color: #e9edef;
}


html[data-theme="dark"] .sidebar-badge {
    border-color: #202c33;
}


html[data-theme="dark"] .sidebar-avatar {
    background: #374248;
    color: #e9edef;
    border-color: #4a565c;
}


/* =====================================================
   TELA DE BLOQUEIO (?url=bloqueio)
===================================================== */

.bloqueio-cartao {
    text-align: center;
}


.bloqueio-avatar {
    width: 72px;
    height: 72px;

    margin: 0 auto 16px;

    border-radius: 50%;

    background: var(--verde);
    color: #fff;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 30px;
    font-weight: 600;
}


.bloqueio-titulo {
    font-size: 20px;
    margin: 0 0 2px;
}


.bloqueio-nome {
    margin: 0 0 14px;

    font-size: 14.5px;
    font-weight: 600;

    color: var(--texto);
}


.bloqueio-cartao .subtitulo {
    margin-bottom: 20px;
}


.bloqueio-cartao .campo {
    text-align: left;
}


.bloqueio-sair {
    margin: 16px 0 0;
}


.bloqueio-sair button {
    padding: 0;

    border: 0;
    background: none;

    color: var(--texto-secundario);

    font-family: inherit;
    font-size: 13px;

    text-decoration: underline;
    cursor: pointer;
}


.bloqueio-sair button:hover {
    color: var(--texto);
}


/* ===================== BLOCO DE NOTAS PESSOAL (Alt+N) ===================== */

.notas-painel {
    position: fixed;
    left: 72px;
    bottom: 16px;
    z-index: 3000;
    width: min(360px, calc(100vw - 88px));
    height: min(440px, calc(100vh - 32px));
    display: flex;
    flex-direction: column;
    background: #fff8d6;
    color: #3d3510;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

.notas-painel[hidden] {
    display: none;
}

.notas-topo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.06);
    font-size: 14px;
}

.notas-topo strong {
    flex: 1;
}

.notas-estado {
    font-size: 11px;
    opacity: 0.7;
}

.notas-botao {
    border: none;
    background: transparent;
    color: inherit;
    font-size: 15px;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
}

.notas-botao:hover {
    background: rgba(0, 0, 0, 0.1);
}

.notas-texto {
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 14px;
    line-height: 1.5;
}

.notas-rodape {
    flex: 0 0 auto;
    padding: 6px 12px;
    font-size: 11px;
    opacity: 0.65;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .notas-painel {
        background: #3a3414;
        color: #f2e9b9;
    }
}

:root[data-theme="dark"] .notas-painel {
    background: #3a3414;
    color: #f2e9b9;
}

@media (max-width: 700px) {
    .notas-painel {
        left: 8px;
        width: calc(100vw - 16px);
        bottom: 8px;
    }
}


.notas-topo {
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.notas-painel.arrastando {
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.38);
    opacity: 0.95;
}

.notas-painel.arrastando .notas-topo {
    cursor: grabbing;
}

.notas-painel.arrastando .notas-texto {
    pointer-events: none;
}

.notas-botao {
    cursor: pointer;
}


/* ===================== BARRA DE ROLAGEM ===================== */

/* Fina, arredondada e discreta: só aparece com força ao passar o mouse.
   Cores seguem o tema (claro/escuro). */
:root {
    --rolagem-polegar: rgba(84, 101, 111, 0.35);
    --rolagem-polegar-hover: rgba(84, 101, 111, 0.6);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --rolagem-polegar: rgba(174, 186, 193, 0.22);
        --rolagem-polegar-hover: rgba(174, 186, 193, 0.45);
    }
}

:root[data-theme="dark"] {
    --rolagem-polegar: rgba(174, 186, 193, 0.22);
    --rolagem-polegar-hover: rgba(174, 186, 193, 0.45);
}

/* Chrome, Edge e o app desktop (Electron) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--rolagem-polegar);
    border-radius: 10px;
    /* a borda transparente deixa o polegar mais fino que a calha */
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--rolagem-polegar-hover);
}

::-webkit-scrollbar-thumb:active {
    background-color: var(--verde);
}

/* Firefox */
@supports (-moz-appearance: none) {
    * {
        scrollbar-width: thin;
        scrollbar-color: var(--rolagem-polegar) transparent;
    }
}
