:root {
    --bg: #07111f;
    --panel: #0d1b2b;
    --panel-2: #10243a;
    --text: #edf5ff;
    --muted: #95a8be;
    --border: rgba(255,255,255,.09);
    --accent: #2d8cff;
    --accent-2: #58a7ff;
    --success: #1fc77e;
    --danger: #ff5f6d;
    --shadow: 0 28px 80px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 15% 15%, rgba(45,140,255,.18), transparent 30%),
        radial-gradient(circle at 85% 85%, rgba(49,216,154,.10), transparent 32%),
        var(--bg);
    color: var(--text);
}
.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 36px;
}
.banner-shell {
    width: 100%;
    margin: 0 auto 18px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 24px;
    background: #030a12;
    box-shadow: var(--shadow);
}
.banner-shell picture { display: block; width: 100%; }
.top-banner {
    display: block;
    width: 100%;
    height: auto;
    max-height: 490px;
    object-fit: cover;
    object-position: center;
}
.install-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 18px 0;
    padding: 16px 18px;
    border: 1px solid rgba(45,140,255,.22);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(13,27,43,.96), rgba(10,22,36,.96));
    box-shadow: 0 18px 45px rgba(0,0,0,.20);
}
.install-copy {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}
.install-copy > div:last-child {
    min-width: 0;
    display: grid;
    gap: 3px;
}
.install-copy strong {
    color: var(--text);
    font-size: 15px;
}
.install-copy span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}
.install-icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.07);
}
.install-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.install-button {
    flex: 0 0 auto;
    padding: 11px 16px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), #176fcf);
    color: white;
    font-weight: 800;
    box-shadow: 0 10px 26px rgba(45,140,255,.16);
}
.install-card.installed {
    border-color: rgba(31,199,126,.22);
}
.install-card.installed .install-button {
    background: rgba(31,199,126,.14);
    color: #8cf0bd;
}
.card {
    position: relative; display: flex; gap: 18px; margin: 18px 0; padding: 24px;
    border: 1px solid var(--border); border-radius: 22px;
    background: linear-gradient(180deg, rgba(16,36,58,.94), rgba(13,27,43,.94));
    box-shadow: var(--shadow); backdrop-filter: blur(14px);
}
.step {
    flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%;
    background: rgba(45,140,255,.14); border: 1px solid rgba(88,167,255,.35); color: var(--accent-2); font-weight: 800;
}
.card-content { flex: 1; min-width: 0; }
.card h2 { margin: 2px 0 6px; font-size: 20px; }
.card p { margin: 0 0 18px; color: var(--muted); }
label { display: block; margin: 14px 0; color: #cfe0f3; font-size: 14px; font-weight: 650; }
input, textarea {
    width: 100%; margin-top: 8px; padding: 14px 15px; border: 1px solid var(--border);
    border-radius: 12px; outline: none; background: rgba(3,10,18,.58); color: var(--text); font: inherit;
    transition: border-color .18s ease, box-shadow .18s ease;
}
textarea { resize: vertical; min-height: 108px; }
input:focus, textarea:focus { border-color: rgba(88,167,255,.7); box-shadow: 0 0 0 4px rgba(45,140,255,.10); }
button { border: 0; font: inherit; cursor: pointer; }
button:disabled { opacity: .62; cursor: wait; }
.primary {
    width: 100%; margin-top: 6px; padding: 14px 16px; border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #176fcf); color: white; font-weight: 800;
    box-shadow: 0 12px 30px rgba(45,140,255,.18);
}
.secondary-button {
    padding: 10px 14px; border-radius: 10px; background: rgba(255,255,255,.06); color: #d7e8fb;
    border: 1px solid rgba(255,255,255,.08);
}
.link-button { padding: 8px 10px; background: transparent; color: var(--muted); font-size: 14px; }
.row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.alert { margin: 18px 0; padding: 14px 16px; border-radius: 14px; border: 1px solid transparent; line-height: 1.45; }
.alert.success { background: rgba(31,199,126,.10); border-color: rgba(31,199,126,.28); color: #8cf0bd; }
.alert.error { background: rgba(255,95,109,.10); border-color: rgba(255,95,109,.28); color: #ffb0b8; }
.device-result { margin-top: 18px; padding: 16px; border: 1px solid rgba(31,199,126,.25); border-radius: 15px; background: rgba(31,199,126,.06); }
.status-badge {
    display: inline-flex; margin-bottom: 12px; padding: 5px 9px; border-radius: 999px;
    background: rgba(31,199,126,.15); color: #8cf0bd; font-size: 12px; font-weight: 850; letter-spacing: .08em;
}
dl { margin: 0; display: grid; gap: 9px; }
dl > div { display: flex; justify-content: space-between; gap: 18px; padding-top: 9px; border-top: 1px solid rgba(255,255,255,.06); }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; font-weight: 700; }
.history-head { align-items: center; }
.history-empty {
    padding: 16px; border: 1px dashed rgba(255,255,255,.12); border-radius: 14px; color: var(--muted);
    background: rgba(255,255,255,.02);
}
.table-wrap { overflow-x: auto; border: 1px solid rgba(255,255,255,.08); border-radius: 16px; }
.history-table { width: 100%; border-collapse: collapse; min-width: 860px; }
.history-table th, .history-table td { padding: 13px 14px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.06); }
.history-table th { background: rgba(255,255,255,.04); color: #b9cde4; font-size: 13px; }
.history-table td { color: #eaf3ff; font-size: 14px; }
.pill { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.success-pill { background: rgba(31,199,126,.15); color: #8cf0bd; }
.info-pill { background: rgba(45,140,255,.14); color: #8ec0ff; }
.hidden { display: none !important; }

@media (max-width: 720px) {
    .shell {
        width: min(100% - 20px, 1180px);
        padding-top: 10px;
    }
    .banner-shell {
        margin-bottom: 12px;
        border-radius: 16px;
    }
    .top-banner {
        width: 100%;
        max-height: none;
        object-fit: contain;
    }
    .install-card {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
        padding: 14px;
        border-radius: 15px;
    }
    .install-button {
        width: 100%;
        min-height: 44px;
    }
    .card {
        padding: 16px;
        gap: 10px;
        border-radius: 18px;
    }
    .step { width: 30px; height: 30px; }
    .row-between { gap: 8px; flex-direction: column; }
    .history-head { align-items: flex-start; }
    .table-wrap {
        margin-left: -6px;
        margin-right: -6px;
    }
}

@media (max-width: 480px) {
    .shell { width: calc(100% - 14px); }
    .banner-shell { border-radius: 13px; }
    .card { padding: 14px; }
    .card h2 { font-size: 18px; }
    .install-copy strong { font-size: 14px; }
    .install-copy span { font-size: 12px; }
    .install-icon { width: 42px; height: 42px; }
}


/* Rodapé / instalação */
.site-footer {
    margin-top: 28px;
    padding-bottom: 10px;
}
.footer-install {
    margin: 0 0 16px;
    box-shadow: none;
    background: rgba(10,22,36,.72);
}
.footer-note {
    color: #6f8298;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    padding: 4px 12px 0;
}

/* WhatsApp flutuante */
.whatsapp-float {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 56px;
    padding: 0 17px 0 14px;
    border-radius: 999px;
    background: #25D366;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 14px;
    box-shadow: 0 14px 36px rgba(0,0,0,.34), 0 0 0 1px rgba(255,255,255,.10) inset;
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.whatsapp-float:hover {
    transform: translateY(-2px) scale(1.02);
    filter: brightness(1.04);
    box-shadow: 0 18px 42px rgba(0,0,0,.38), 0 0 0 1px rgba(255,255,255,.14) inset;
}
.whatsapp-float:focus-visible {
    outline: 3px solid rgba(255,255,255,.92);
    outline-offset: 3px;
}
.whatsapp-float svg {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
}
.whatsapp-label {
    white-space: nowrap;
}

@media (max-width: 720px) {
    .footer-install {
        align-items: stretch;
        flex-direction: column;
    }
    .footer-install .install-button {
        width: 100%;
    }
    .whatsapp-float {
        right: 16px;
        bottom: 16px;
        width: 56px;
        height: 56px;
        min-height: 56px;
        padding: 0;
        justify-content: center;
    }
    .whatsapp-label {
        display: none;
    }
}


/* v1.4 - ações do rodapé */
.footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* v1.4 - WhatsApp flutuante com ícone real e texto também no mobile */
.whatsapp-float {
    right: 22px;
    bottom: 22px;
    width: auto;
    height: auto;
    min-width: 164px;
    min-height: 58px;
    padding: 8px 16px 8px 10px;
    justify-content: flex-start;
    gap: 10px;
    border: 0;
    outline: none;
    background: #25D366;
    border-radius: 999px;
}
.whatsapp-float img {
    display: block;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    object-fit: contain;
}
.whatsapp-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.08;
    white-space: nowrap;
}
.whatsapp-copy strong {
    color: #fff;
    font-size: 14px;
    font-weight: 850;
}
.whatsapp-copy small {
    margin-top: 4px;
    color: rgba(255,255,255,.86);
    font-size: 11px;
    font-weight: 650;
}
.whatsapp-float svg,
.whatsapp-label {
    display: none !important;
}

/* Editor da mensagem de suporte */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(1, 7, 14, .78);
    backdrop-filter: blur(8px);
}
.modal-card {
    width: min(720px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 24px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,.10);
    background: #0d1b2b;
    box-shadow: 0 28px 90px rgba(0,0,0,.48);
}
.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}
.modal-head h2 { margin: 0 0 6px; }
.modal-head p { margin: 0; color: var(--muted); }
.modal-close {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,.07);
    color: #fff;
    font-size: 25px;
    line-height: 1;
}
#whatsapp-message-editor {
    min-height: 290px;
    white-space: pre-wrap;
}
.format-help {
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}
.modal-actions .install-button,
.modal-actions .secondary-button {
    width: auto;
}

@media (max-width: 720px) {
    .footer-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .footer-actions .install-button,
    .footer-actions .secondary-button {
        width: 100%;
    }
    .whatsapp-float {
        right: 12px;
        bottom: 12px;
        width: auto;
        height: auto;
        min-width: 148px;
        min-height: 54px;
        padding: 7px 13px 7px 8px;
        justify-content: flex-start;
    }
    .whatsapp-float img {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }
    .whatsapp-copy {
        display: flex;
    }
    .modal-card { padding: 18px; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .install-button,
    .modal-actions .secondary-button { width: 100%; }
}


/* v1.5 - WhatsApp abre editor antes do envio */
body.modal-open {
    overflow: hidden;
}

#whatsapp-support-button {
    font-family: inherit;
}

.whatsapp-send-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 11px 16px;
    border-radius: 11px;
    background: #25D366;
    color: #fff;
    font-weight: 850;
    box-shadow: 0 10px 26px rgba(37, 211, 102, .17);
}

.whatsapp-send-button:hover {
    filter: brightness(1.04);
}

.whatsapp-send-button img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

#whatsapp-message-editor {
    min-height: 320px;
    line-height: 1.5;
}

@media (max-width: 720px) {
    .whatsapp-send-button {
        width: 100%;
    }

    #whatsapp-message-editor {
        min-height: 300px;
    }
}


/* v1.7 - Fluxo de suporte em duas etapas */
.support-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-primary {
    width: auto;
    min-width: 150px;
    margin-top: 0;
}

.whatsapp-message-preview {
    width: 100%;
    min-height: 285px;
    max-height: 420px;
    overflow: auto;
    margin-top: 8px;
    padding: 16px;
    border: 1px solid rgba(88,167,255,.38);
    border-radius: 12px;
    background: rgba(3,10,18,.75);
    color: var(--text);
    font: inherit;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    user-select: text;
}

@media (max-width: 720px) {
    .support-fields {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .modal-primary {
        width: 100%;
    }

    .whatsapp-message-preview {
        min-height: 260px;
        max-height: 55vh;
    }
}


/* v1.8 - Toasts temporizados */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    width: min(410px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    --toast-accent: #2d8cff;
    position: relative;
    display: grid;
    grid-template-columns: 34px 1fr 30px;
    align-items: start;
    gap: 10px;
    min-height: 68px;
    padding: 14px 12px 14px 14px;
    border: 1px solid color-mix(in srgb, var(--toast-accent) 42%, transparent);
    border-radius: 15px;
    background: rgba(8, 22, 35, .97);
    color: #edf5ff;
    box-shadow: 0 18px 50px rgba(0,0,0,.35);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    overflow: hidden;
    cursor: pointer;
    pointer-events: auto;

    opacity: 0;
    transform: translate3d(24px, -8px, 0) scale(.98);
    transition:
        opacity .2s ease,
        transform .2s ease,
        border-color .2s ease;
}

.toast.toast-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.toast.toast-leaving {
    opacity: 0;
    transform: translate3d(28px, 0, 0) scale(.98);
}

.toast-success {
    --toast-accent: #1fc77e;
}

.toast-error {
    --toast-accent: #ff5f6d;
}

.toast-warning {
    --toast-accent: #f4b942;
}

.toast-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: color-mix(in srgb, var(--toast-accent) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--toast-accent) 30%, transparent);
    color: var(--toast-accent);
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
}

.toast-content {
    padding: 3px 0 4px;
    color: #edf5ff;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.toast-close {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    color: #9db1c8;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.toast-close:hover,
.toast-close:focus-visible {
    background: rgba(255,255,255,.08);
    color: #fff;
    outline: none;
}

.toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: var(--toast-accent);
    transform-origin: left center;
    animation: toast-countdown var(--toast-duration, 10000ms) linear forwards;
}

@keyframes toast-countdown {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (max-width: 720px) {
    .toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
    }

    .toast {
        grid-template-columns: 32px 1fr 30px;
        min-height: 64px;
        padding: 12px 10px 12px 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast,
    .toast-progress {
        animation: none !important;
        transition: none !important;
    }
}


/* v1.9 - Estados e ativação de Device Key */
.device-result-success {
    border-color: rgba(31,199,126,.28);
    background: rgba(31,199,126,.06);
}

.device-result-warning {
    border-color: rgba(244,185,66,.32);
    background: rgba(244,185,66,.055);
}

.device-result-danger {
    border-color: rgba(255,95,109,.30);
    background: rgba(255,95,109,.055);
}

.warning-badge {
    background: rgba(244,185,66,.14);
    color: #ffd781;
}

.danger-badge {
    background: rgba(255,95,109,.14);
    color: #ffb0b8;
}

.activation-confirm {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid rgba(244,185,66,.22);
    border-radius: 14px;
    background: rgba(3,10,18,.34);
}

.activation-confirm > div:first-child {
    display: grid;
    gap: 5px;
}

.activation-confirm strong {
    color: #fff1cc;
}

.activation-confirm span {
    color: var(--muted);
    font-size: 14px;
}

.activation-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

.activation-button {
    padding: 10px 16px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f5b72e, #e58f13);
    color: #1b1202;
    font-weight: 900;
    box-shadow: 0 10px 26px rgba(229,143,19,.16);
}

.device-note {
    margin-top: 15px;
    padding: 12px 13px;
    border-radius: 12px;
    background: rgba(255,255,255,.035);
    color: #d7e3f0;
    font-size: 14px;
    line-height: 1.5;
}

.danger-note {
    background: rgba(255,95,109,.07);
    color: #ffc1c7;
}

@media (max-width: 600px) {
    .activation-actions {
        flex-direction: column-reverse;
    }

    .activation-actions button {
        width: 100%;
        min-height: 44px;
    }
}


/* v1.9.1 - Modal de confirmação de ativação */
.activation-device-summary {
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid rgba(244,185,66,.20);
    border-radius: 16px;
    background: rgba(3,10,18,.34);
}

.activation-remark-label {
    display: block;
    margin-top: 6px;
}

.activation-remark-label textarea {
    margin-top: 10px;
    min-height: 108px;
}

.remark-counter {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}

.activation-modal-question {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255,255,255,.04);
    color: #dfe9f5;
    font-weight: 700;
}

@media (max-width: 720px) {
    .activation-device-summary {
        padding: 14px;
    }
}


/* =====================================================================
   v2.0.0 - Conta XCloud, sincronização e gerenciamento de dispositivos
   ===================================================================== */

.sync-profile-status {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.sync-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.sync-ok {
    background: rgba(31,199,126,.14);
    color: #66efad;
    border: 1px solid rgba(31,199,126,.26);
}

.sync-error {
    background: rgba(255,95,109,.12);
    color: #ffadb5;
    border: 1px solid rgba(255,95,109,.28);
}

.sync-profile-detail {
    color: var(--muted);
    font-size: 12px;
}

.sync-confirm-line {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.account-devices-table td,
.account-devices-table th {
    white-space: nowrap;
}

.compact-button {
    padding: 7px 10px;
    min-height: 34px;
    font-size: 12px;
}

.danger-pill {
    background: rgba(255,95,109,.14);
    color: #ffadb5;
}

.warning-pill {
    background: rgba(244,185,66,.14);
    color: #ffd781;
}

.modal-card-wide {
    width: min(760px, calc(100vw - 28px));
}

.manage-primary-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 14px;
    flex-wrap: wrap;
}

.device-manage-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.warning-action-button,
.danger-action-button {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
}

.warning-action-button {
    background: rgba(244,185,66,.13);
    color: #ffd781;
    border: 1px solid rgba(244,185,66,.28);
}

.danger-action-button {
    background: rgba(255,95,109,.12);
    color: #ffadb5;
    border: 1px solid rgba(255,95,109,.28);
}

.device-info-extra {
    display: grid;
    gap: 4px;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255,255,255,.035);
    color: var(--muted);
    font-size: 13px;
}

.device-info-extra strong {
    color: var(--text);
}

@media (max-width: 720px) {
    .manage-primary-actions,
    .device-manage-actions {
        flex-direction: column;
    }

    .manage-primary-actions button,
    .device-manage-actions button {
        width: 100%;
    }
}


/* v2.0.0-HF1 - hotfix visual da M3U e logout no PWA/mobile */
.toast-content {
    display: grid;
    gap: 5px;
}

.toast-message {
    display: block;
}

.toast-strong {
    display: block;
    color: #ffffff;
    font-weight: 900;
    line-height: 1.35;
}

.mobile-logout-button {
    display: none;
}

@media (max-width: 720px) {
    .mobile-logout-button:not(.hidden) {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 44px;
    }
}


/* =====================================================================
   HF2 - busca/paginação/cópia e modo DNS na ativação
   ===================================================================== */
.devices-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
}

.devices-search-label {
    flex: 1 1 520px;
    max-width: 720px;
}

.devices-search-label input {
    margin-top: 7px;
}

.devices-count {
    color: var(--muted);
    font-size: 13px;
    padding-bottom: 13px;
    white-space: nowrap;
}

.devices-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
}

.devices-pagination span {
    color: var(--muted);
    font-size: 13px;
    min-width: 100px;
    text-align: center;
}

.copy-value-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.copy-icon-button {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.055);
    color: #d9e8f7;
    cursor: pointer;
    font-weight: 900;
}

.copy-icon-button:hover {
    background: rgba(47,142,247,.14);
    border-color: rgba(47,142,247,.35);
}

.playlist-copy-cell {
    max-width: 260px;
}

.playlist-preview {
    display: block;
    max-width: 215px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #d8e8f8;
}

.muted-value {
    color: var(--muted);
    font-style: italic;
}

.activation-source-card {
    margin: 16px 0;
    padding: 16px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 16px;
    background: rgba(3,10,18,.28);
}

.own-playlist-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    cursor: pointer;
}

.own-playlist-copy {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.own-playlist-copy strong {
    color: var(--text);
    font-size: 14px;
}

.own-playlist-copy small,
.dns-help {
    color: var(--muted);
    font-weight: 500;
    line-height: 1.45;
}

.switch-control {
    position: relative;
    flex: 0 0 50px;
    width: 50px;
    height: 28px;
}

.switch-control input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #31445a;
    border: 1px solid rgba(255,255,255,.12);
    transition: .18s ease;
}

.switch-slider::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #fff;
    transition: .18s ease;
}

.switch-control input:checked + .switch-slider {
    background: #2385e8;
}

.switch-control input:checked + .switch-slider::after {
    transform: translateX(22px);
}

.activation-dns-fields {
    display: grid;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.activation-dns-fields select {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #061322;
    color: var(--text);
    padding: 14px;
    font: inherit;
    outline: none;
}

.activation-dns-fields select:focus {
    border-color: #2f8ef7;
    box-shadow: 0 0 0 3px rgba(47,142,247,.12);
}

.dns-credentials {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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

    .devices-count {
        padding-bottom: 0;
    }

    .dns-credentials {
        grid-template-columns: 1fr;
    }

    .own-playlist-toggle {
        align-items: flex-start;
    }
}


/* =====================================================================
   v2.0.0-HF3 - PWA/mobile e responsividade
   ===================================================================== */

html {
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    width: 100%;
    overflow-x: hidden;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

img,
svg {
    max-width: 100%;
}

input,
textarea,
select,
button {
    max-width: 100%;
}

#playlist-card {
    scroll-margin-top: 12px;
}

.modal-card {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

@supports (height: 100dvh) {
    .modal-card {
        max-height: calc(100dvh - 40px);
    }
}

.device-result dd,
.activation-device-summary dd,
#device-manage-summary dd {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.copy-icon-button,
.compact-button,
.modal-close {
    touch-action: manipulation;
}

@media (max-width: 760px) {
    .shell {
        width: calc(100% - 16px);
        padding-top: max(8px, env(safe-area-inset-top, 0px));
        padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    }

    .banner-shell {
        width: 100%;
        margin-bottom: 12px;
    }

    .top-banner {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }

    .card {
        width: 100%;
        min-width: 0;
        padding: 15px;
        gap: 10px;
        margin: 12px 0;
    }

    .card-content {
        min-width: 0;
        width: 100%;
    }

    .card h2 {
        font-size: 18px;
        line-height: 1.25;
    }

    .row-between {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    #logout-button {
        align-self: flex-end;
        min-width: 72px;
        min-height: 42px;
    }

    input,
    textarea,
    select {
        font-size: 16px;
        min-width: 0;
    }

    textarea {
        min-height: 120px;
    }

    .primary,
    .secondary-button,
    .activation-button,
    .warning-action-button,
    .danger-action-button {
        min-height: 44px;
        touch-action: manipulation;
    }

    .devices-toolbar {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .devices-search-label {
        width: 100%;
        max-width: none;
        flex: 1 1 auto;
    }

    .devices-count {
        width: 100%;
        padding: 0;
        white-space: normal;
    }

    .table-wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
        margin-left: 0;
        margin-right: 0;
    }

    .account-devices-table {
        min-width: 0 !important;
        width: 100%;
    }

    .account-devices-table thead {
        display: none;
    }

    .account-devices-table tbody {
        display: grid;
        gap: 12px;
        width: 100%;
    }

    .account-devices-table tbody tr {
        display: block;
        width: 100%;
        padding: 8px 12px;
        border: 1px solid rgba(255,255,255,.09);
        border-radius: 15px;
        background: rgba(3,10,18,.32);
    }

    .account-devices-table tbody td {
        display: grid;
        grid-template-columns: minmax(92px, 36%) minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        width: 100%;
        min-width: 0;
        padding: 10px 0;
        white-space: normal;
        border-bottom: 1px solid rgba(255,255,255,.06);
    }

    .account-devices-table tbody td:last-child {
        border-bottom: 0;
    }

    .account-devices-table tbody td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 750;
        line-height: 1.3;
    }

    .account-devices-table .copy-value-cell {
        min-width: 0;
        width: 100%;
        justify-content: flex-end;
    }

    .account-devices-table .playlist-copy-cell {
        max-width: 100%;
    }

    .account-devices-table .playlist-preview {
        min-width: 0;
        max-width: 100%;
        flex: 1 1 auto;
    }

    .account-devices-table .copy-icon-button {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
    }

    .account-devices-table .manage-device-button {
        width: 100%;
        min-height: 42px;
    }

    .devices-pagination {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        gap: 8px;
    }

    .devices-pagination button {
        width: 100%;
        min-width: 0;
        min-height: 42px;
    }

    .devices-pagination span {
        min-width: 0;
        white-space: nowrap;
    }

    .modal-backdrop {
        place-items: start center;
        overflow-y: auto;
        padding:
            max(10px, env(safe-area-inset-top, 0px))
            10px
            max(10px, env(safe-area-inset-bottom, 0px));
    }

    .modal-card,
    .modal-card-wide {
        width: 100%;
        max-width: 100%;
        max-height: calc(100vh - 20px);
        padding: 16px;
        margin: 0;
        border-radius: 16px;
    }

    @supports (height: 100dvh) {
        .modal-card,
        .modal-card-wide {
            max-height: calc(100dvh - 20px);
        }
    }

    .modal-head {
        position: sticky;
        top: -16px;
        z-index: 5;
        margin: -16px -16px 14px;
        padding: 16px;
        background: #0d1b2b;
        border-bottom: 1px solid rgba(255,255,255,.07);
        border-radius: 16px 16px 0 0;
    }

    .modal-head > div {
        min-width: 0;
    }

    .modal-head h2 {
        font-size: 18px;
        overflow-wrap: anywhere;
    }

    .modal-head p {
        font-size: 13px;
        line-height: 1.4;
    }

    .modal-close {
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
    }

    .manage-primary-actions,
    .device-manage-actions,
    .modal-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .manage-primary-actions button,
    .device-manage-actions button,
    .modal-actions button,
    #manage-add-playlist,
    #save-device-remark {
        width: 100%;
        min-height: 46px;
    }

    .activation-device-summary {
        padding: 12px;
    }

    dl > div {
        display: grid;
        grid-template-columns: minmax(90px, 38%) minmax(0, 1fr);
        align-items: start;
        gap: 10px;
    }

    dd {
        max-width: none;
        text-align: right;
        overflow-wrap: anywhere;
    }

    .dns-credentials {
        grid-template-columns: 1fr;
    }

    .own-playlist-toggle {
        align-items: flex-start;
        gap: 12px;
    }

    .install-card {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .install-copy {
        min-width: 0;
        align-items: flex-start;
    }

    .footer-actions,
    .footer-actions button {
        width: 100%;
    }

    .footer-actions button {
        min-height: 46px;
    }

    .whatsapp-float {
        right: calc(10px + env(safe-area-inset-right, 0px));
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .toast-container {
        top: calc(10px + env(safe-area-inset-top, 0px));
        right: calc(10px + env(safe-area-inset-right, 0px));
        left: calc(10px + env(safe-area-inset-left, 0px));
    }
}

@media (max-width: 420px) {
    .shell {
        width: calc(100% - 12px);
    }

    .card {
        padding: 13px;
    }

    .step {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }

    .account-devices-table tbody td {
        grid-template-columns: 82px minmax(0, 1fr);
        gap: 8px;
    }

    .devices-pagination {
        grid-template-columns: 1fr 1fr;
    }

    .devices-pagination span {
        grid-column: 1 / -1;
        grid-row: 1;
        text-align: center;
    }

    .devices-pagination button:first-of-type {
        grid-column: 1;
        grid-row: 2;
    }

    .devices-pagination button:last-of-type {
        grid-column: 2;
        grid-row: 2;
    }

    .whatsapp-copy small {
        display: none;
    }
}


/* =====================================================================
   v3.0.0 - Controle local de marcas XCloud
   ===================================================================== */
.brand-access-heading {
    align-items: center;
}

.brand-current-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid rgba(85, 214, 158, .35);
    background: rgba(85, 214, 158, .10);
    color: #8ef0c6;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .05em;
}

.brand-master-badge {
    border-color: rgba(245, 194, 79, .40);
    background: rgba(245, 194, 79, .12);
    color: #ffd877;
}

.brand-security-note {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    padding: 11px 13px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(3, 10, 18, .26);
    color: var(--muted);
    font-size: 13px;
}

.brand-security-note strong,
.brand-security-note #current-brand-name {
    color: var(--text);
}

.brand-dot { opacity: .45; }

.brand-panel {
    margin-top: 15px;
    padding: 15px;
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(3, 10, 18, .26);
}

.brand-panel-head,
.brand-management-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.brand-panel h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.brand-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.brand-inline-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
}

.brands-list {
    display: grid;
    gap: 10px;
}

.brand-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    padding: 13px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 13px;
    background: rgba(255,255,255,.025);
}

.brand-item-title-row {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.brand-item-title-row > strong {
    font-size: 15px;
}

.brand-status {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.brand-status-active {
    color: #8ef0c6;
    background: rgba(85,214,158,.10);
    border: 1px solid rgba(85,214,158,.25);
}

.brand-status-blocked {
    color: #ff9d9d;
    background: rgba(255,91,91,.09);
    border: 1px solid rgba(255,91,91,.22);
}

.brand-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 12px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
}

.brand-item-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
}

.brand-form {
    display: grid;
    gap: 13px;
}

.brand-form label > small,
.brand-check-row small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.brand-check-row {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 11px 12px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    background: rgba(255,255,255,.025);
    cursor: pointer;
}

.brand-check-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.brand-delegation-fields {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 13px;
    border: 1px solid rgba(75,147,255,.18);
    background: rgba(75,147,255,.04);
}

@media (max-width: 760px) {
    .brand-access-heading,
    .brand-panel-head,
    .brand-management-head {
        flex-direction: column;
        align-items: stretch;
    }

    .brand-current-badge {
        align-self: flex-start;
    }

    .brand-inline-form {
        grid-template-columns: 1fr;
    }

    .brand-inline-form button,
    .brand-management-head button {
        width: 100%;
        min-height: 46px;
    }

    .brand-item {
        grid-template-columns: 1fr;
    }

    .brand-item-actions {
        justify-content: stretch;
        display: grid;
        grid-template-columns: 1fr;
    }

    .brand-item-actions button {
        width: 100%;
        min-height: 44px;
    }

    .brand-security-note {
        align-items: flex-start;
    }

    .brand-dot {
        display: none;
    }
}
