.popup-janela-fora {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: start;
    max-width: 90vw;
    text-align: center;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.janela {
    min-width: 200px;
    max-width: 90vw;
    overflow: auto;
    max-height: 90vh;
}

.editor-botao {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgb(220, 220, 220);
    border-radius: 3px;
    box-shadow: 0 0 2px #222;
    cursor: pointer;
    width: 30px;
    height: 30px;
}

.editor-toolbar {
    background: #f1f1f1;
    padding: 5px;
    border-bottom: 1px solid #ccc;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.editor-container {
    min-width: 300px;
    max-width: 500px;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 5px;
    overflow: hidden;
    background: #fff;
}

.editor-conteudo {
    min-height: 120px;
    padding: 10px;
    outline: none;
    overflow-y: auto;
    text-align: left;
}

.opcoes {
    max-width: 200px;
    text-align: center;
    background: linear-gradient(45deg, #7f6a5b, #393532);
    padding: 5px 1rem;
    border-radius: 20px;
    margin: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    color: white;
}

.popup {
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.7);
}

.popup-top {
    display: flex;
    align-items: center;
    background-color: #3b444c;
    width: 100%;
    border-bottom: 1px solid #d2d2d2;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    overflow: hidden;
}

.popup-top label {
    flex: 1;
    color: white;
    font-size: 1rem;
    text-align: left;
}

.popup-top span {
    width: 42px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #b12425;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.popup-top span:hover {
    background-color: #ff2a2a;
}

.div-mensagem {
    display: flex;
    align-items: start;
    justify-content: start;
    flex-direction: column;
    gap: 2px;
    font-size: 1rem;
    color: white;
}

.ferramentas {
    display: flex;
    align-items: start;
    justify-content: start;
    flex-direction: column;
    padding: 1rem;
    background-color: #d2d2d2;
    gap: 5px;
}

.ferramentas input {
    background-color: #f0efef;
    display: block;
    padding: 1vw;
    margin: 1vw 0;
    border-radius: 5px;
    border: 1px solid #888;
}

.atalhos {
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: start;
    cursor: pointer;
    gap: 1px;
    background-color: white;
}

.atalhos label {
    padding-right: 0.5rem;
}

.atalhos img,
.atalhos-opcoes img {
    padding: 0.2rem;
    width: 2rem;
}

.atalhos:hover,
.atalhos-opcoes:hover {
    color: white;
    background-color: #323940;
}

.atalhos-opcoes {
    padding: 5px;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: start;
    cursor: pointer;
    gap: 10px;
    background-color: #efefef;
    border-radius: 2px;
    font-size: 0.8rem;
}

.cx-pesquisa {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin: 5px;
    background-color: white;
    border-radius: 10px;
}

.cx-opcoes {
    justify-content: start;
    flex-direction: column;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background-color: #d2d2d2;
    width: 100%;
    max-height: 40vh;
    height: max-content;
    overflow-y: auto;
    overflow-x: hidden;
}

.mensagem {
    min-width: 200px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ebebeb;
    gap: 1rem;
    padding: 1rem 0 1rem 0;
}

.mensagem label {
    padding: 1rem;
}

.mensagem img {
    padding: 1rem;
    width: 2rem;
}

/* Painel */
.painel-padrao {
    background: linear-gradient(45deg, #323639, #5b707f);
    display: flex;
    flex-direction: column;
    max-height: 60vh;
    max-width: 900px;
    width: 100%;
    overflow-y: auto;
    padding: 1rem 0 1rem 0;
}

/* Campos */
.painel-padrao input,
.painel-padrao select,
.painel-padrao textarea {
    border: 1px solid #5b707f;
    background-color: #f9f9f9;
    font-size: 14px;
}

.painel-padrao input[type="file"] {
    border: none;
    background-color: transparent;
}

.painel-padrao input:focus,
.painel-padrao select:focus,
.painel-padrao textarea:focus {
    outline: none;
    border-color: #3e8bff;
    background-color: #fff;
}

.linha-padrao {
    background-color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
    margin: 0 1rem 0 1rem;
    padding: 0.5rem;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 3px 6px #00000015;
}

/* Primeira linha */
.linha-padrao:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

/* Última linha */
.linha-padrao:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Rodapé */
.rodape-padrao {
    overflow: hidden;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    background-color: #757575;
    gap: 1px;
    width: 100%;
    border-top: 1px solid #6a6a6a;
    border-radius: 0 0 10px 10px;
}


/* Botões */
.botoes-rodape {
    flex: 1 1 100px;
    cursor: pointer;
    padding: 0.5rem;
    background-color: #d2d2d2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 5vh;
}

.botoes-rodape img {
    margin-left: 0;
}

.botoes-rodape img {
    width: 2rem;
}

.botoes-rodape:hover {
    transition: ease-in-out 0.1s;
    background-color: #a9a9a9;
}

.aguarde {
    display: flex;
    align-items: start;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.7);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10005;
}

.aguarde img {
    width: 5rem;
}

@media screen and (orientation: portrait) {
    .botoes-rodape {
        justify-content: start;
        flex: 1 1 100%;
    }

    .botoes-rodape img {
        margin-left: 1rem;
    }
}

/* Aparência compartilhada dos modais, sem afetar os formulários da página. */
.popup {
    padding: 20px;
    box-sizing: border-box;
    background: #161a20b3;
    backdrop-filter: blur(4px);
}

.painel-usuarios-online {
    width: 640px;
    max-width: 100%;
    box-sizing: border-box;
    padding: 1rem;
}

.popup .popup-janela-fora {
    max-width: min(960px, 100%);
    max-height: 100%;
    min-width: min(360px, 100%);
    min-height: 0;
    border: 1px solid #ffffff24;
    border-radius: 10px;
    background: #f5f6f7;
    color: #343b42;
    box-shadow: 0 24px 70px #00000045;
    overflow: hidden;
    text-align: left;
}

.popup .popup-top {
    flex-shrink: 0;
    min-height: 58px;
    gap: 12px;
    padding: 10px 14px 10px 4px;
    box-sizing: border-box;
    background: linear-gradient(135deg, #393f45, #2b3035);
    border: 0;
    border-radius: 0;
}

.popup .popup-top label {
    font-size: 0.92rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.popup .popup-top span {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border: 1px solid #ffffff1f;
    border-radius: 8px;
    background: #ffffff08;
    color: #e5e8eb;
    font-size: 22px;
    transition: background-color 150ms ease;
}

.popup .popup-top span:hover {
    background: #ffffff20;
}

.popup .janela,
.popup .painel-padrao {
    min-width: 0;
    max-width: 100%;
    min-height: 0;
    max-height: 70vh;
    max-height: 70dvh;
    overflow: auto;
    box-sizing: border-box;
    overscroll-behavior: contain;
}

.popup .painel-padrao {
    padding: 18px;
    gap: 0;
    background: linear-gradient(45deg, #323639, #5b707f);
}

.popup .linha-padrao {
    margin: 0;
    padding: 12px;
    align-items: flex-start;
    gap: 20px;
    border: 0;
    border-bottom: 1px solid #d9dde1;
    border-radius: 0;
    background: #f4f5f6;
    box-shadow: none;
    min-width: 0;
}

.popup .linha-padrao:first-child {
    padding-top: 12px;
    border-radius: 8px 8px 0 0;
}

.popup .linha-padrao:last-child {
    padding-bottom: 12px;
    border-bottom: 0;
    border-radius: 0 0 8px 8px;
}

.popup .linha-padrao:only-child {
    border-radius: 8px;
}

.popup .linha-padrao > span:first-child {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    overflow-wrap: normal;
    word-break: normal;
}

.popup .linha-padrao > .popup-texto {
    min-width: min-content;
    flex-shrink: 0;
}

.popup .linha-padrao > * {
    min-width: 0;
    max-width: 100%;
}

.popup .linha-padrao.linha-editor {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.popup .linha-padrao.linha-editor > span:first-child {
    flex-basis: auto;
    margin-top: 0 !important;
}

.popup .linha-editor > .editor-container {
    width: 100%;
    max-width: none;
}

.popup .painel-padrao input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]),
.popup .painel-padrao select,
.popup .painel-padrao textarea {
    padding: 10px 12px;
    min-height: 40px;
    box-sizing: border-box;
    border: 1px solid #cdd3d9;
    border-radius: 8px;
    background: #fff;
    color: #30373e;
    font: inherit;
    font-size: 12px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.popup .painel-padrao textarea {
    min-height: 76px;
    resize: vertical;
}

.popup .painel-padrao input:focus,
.popup .painel-padrao select:focus,
.popup .painel-padrao textarea:focus,
.popup .editor-container:focus-within {
    outline: 2px solid #7a8b9c;
    outline-offset: 2px;
    border-color: #7a8b9c;
    box-shadow: 0 0 0 4px #7a8b9c12;
}

.popup .popup-janela-fora input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid #596d7d;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

.popup .popup-janela-fora input[type="radio"]:checked {
    background: radial-gradient(circle, #596d7d 0 4px, #fff 4.5px);
}

.popup .popup-janela-fora input[type="radio"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #7a8b9c;
}

.popup .popup-janela-fora input[type="radio"]:disabled {
    opacity: .5;
    cursor: default;
}

.popup .painel-padrao input:disabled,
.popup .painel-padrao select:disabled,
.popup .painel-padrao textarea:disabled {
    background: #e9edf0;
    color: #78818a;
    cursor: not-allowed;
}

.popup .opcoes {
    margin: 0;
    padding: 10px 14px;
    border: 1px solid #49535d;
    border-radius: 8px;
    background: #49535d;
    font-size: 12px;
}

.popup .opcoes:hover {
    background: #5a6570;
}

.popup .mensagem {
    min-width: 0;
    padding: 24px;
    box-sizing: border-box;
    gap: 16px;
    color: #343b42;
    overflow: auto;
    min-height: 0;
    line-height: 1.7;
    font-size: 0.9rem;
}

.popup .mensagem label {
    padding: 0;
    overflow-wrap: anywhere;
    min-width: 0;
}

.popup .mensagem img {
    width: 42px;
    padding: 0;
    flex-shrink: 0;
}

.popup .rodape-padrao {
    flex-shrink: 0;
    box-sizing: border-box;
    justify-content: flex-end;
    padding: 12px 16px;
    gap: 8px;
    border-top: 1px solid #dce1e6;
    border-radius: 0;
    background: linear-gradient(180deg, #e3e5e7, #d5d8db);
}

.popup .botoes-rodape {
    flex: 0 1 auto;
    min-height: 40px;
    height: auto;
    margin: 0;
    padding: 10px 16px;
    box-sizing: border-box;
    gap: 8px;
    border: 1px solid #cdd3d9;
    border-radius: 8px;
    background: #fff;
    color: #3f4852;
    font-size: 12px;
    font-weight: 600;
    box-shadow: none;
    transform: none;
    transition: background-color 150ms ease;
}

.popup .botoes-rodape:first-child {
    background: #414b55;
    border-color: #414b55;
    color: #fff;
}

.popup .botoes-rodape:hover {
    background: #e4e9ed;
}

.popup .botoes-rodape:first-child:hover {
    background: #55616d;
}

.popup .botoes-rodape img {
    width: 20px;
    margin: 0;
}

.popup .editor-container {
    min-width: 0;
    border-color: #cdd3d9;
    border-radius: 8px;
}

.popup .editor-toolbar {
    padding: 8px;
    gap: 6px;
    background: #eceeef;
    border-bottom-color: #d5d8db;
}

.popup .editor-botao {
    border: 1px solid #cdd1d5;
    border-radius: 5px;
    background: #fff;
    color: #41474d;
    box-shadow: none;
}

.popup .editor-botao:hover {
    background: #dfe3e6;
}

.popup .opcoes {
    background: linear-gradient(135deg, #555d65, #3b4249);
    border-color: #596169;
}

.popup .opcoes:hover {
    background: linear-gradient(135deg, #667079, #4b545d);
}

@media (max-width: 600px) {
    .popup {
        padding: 12px;
    }

    .popup .painel-padrao {
        padding: 16px;
    }

    .popup .linha-padrao {
        flex-direction: column;
        gap: 8px;
    }

    .popup .linha-padrao > input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    .popup .linha-padrao > select,
    .popup .linha-padrao > textarea,
    .popup .linha-padrao > .editor-container {
        width: 100%;
    }

    .popup .mensagem {
        padding: 20px 16px;
    }

    .popup .botoes-rodape {
        flex: 1 1 120px;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .popup * {
        transition: none;
    }
}

/* Aparelhos conectados (sessões do próprio usuário) */
.sessoes-lista { padding: 14px 16px; width: min(520px, 90vw); box-sizing: border-box; }
.sessoes-lista p { margin: 0 0 14px; color: #5a6875; font-size: 13px; line-height: 1.5; }
.sessoes-itens { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.sessao-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid #e3e8ed; border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.sessao-item:hover { border-color: #cfd8e0; box-shadow: 0 2px 8px rgba(20, 35, 50, .06); }
.sessao-item.atual { border-color: #b9e0c9; background: #f4fbf7; }
.sessao-icone { flex: 0 0 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: #eef2f6; color: #4c5761; }
.sessao-item.atual .sessao-icone { background: #dff2e7; color: #1f7a4d; }
.sessao-icone svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sessao-info { flex: 1; min-width: 0; }
.sessao-nome { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: #22303c; }
.sessao-datas { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 4px; font-size: 12px; color: #6b7884; }
.sessao-datas b { font-weight: 600; color: #3c4a56; }
.sessao-atual { padding: 2px 8px; border-radius: 999px; background: #dff2e7; color: #1f7a4d; font-size: 11px; font-weight: 700; }
.sessao-encerrar { flex: 0 0 auto; padding: 7px 14px; border: 1px solid #f0c9c9; border-radius: 8px; background: #fff; color: #b3261e; font-size: 13px; font-weight: 600; cursor: pointer; }
.sessao-encerrar:hover { background: #fdecec; border-color: #e6a7a7; }
.sessoes-vazio { padding: 24px; text-align: center; color: #6b7884; font-size: 13px; border: 1px dashed #d5dde4; border-radius: 12px; }
@media (max-width: 420px) {
    .sessao-item { flex-wrap: wrap; }
    .sessao-encerrar { width: 100%; }
}
