* {
    box-sizing: border-box;
}

:root {
    --bg: #07101f;
    --panel: #101b2d;
    --panel2: #152238;
    --border: #253653;
    --text: #f5f8ff;
    --muted: #8998b3;
    --primary: #2d8cff;
    --green: #2bd576;
    --red: #ff5570;
    --yellow: #ffca55;
}

body {
    margin: 0;
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: var(--bg);
    color: var(--text);
}

button,
input {
    font: inherit;
}

.hidden {
    display: none !important;
}


/* LOGIN */

.login-screen {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(circle at 15% 20%, #12396b 0, transparent 35%),
        radial-gradient(circle at 80% 70%, #0b314c 0, transparent 35%),
        #060d19;
}

.login-card {
    width: 420px;
    max-width: calc(100% - 30px);
    padding: 38px;
    background: rgba(15, 26, 44, .96);
    border: 1px solid #263a5a;
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(0,0,0,.45);
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
}

.brand-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg,#2089ff,#20c7ff);
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 26px;
    box-shadow: 0 8px 25px rgba(32,137,255,.35);
}

.brand-icon.small {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 20px;
}

.brand h1 {
    margin: 0;
    font-size: 26px;
}

.brand span {
    color: var(--muted);
    font-size: 13px;
}

.login-title {
    margin: 36px 0 25px;
}

.login-title h2 {
    margin: 0 0 7px;
}

.login-title p {
    margin: 0;
    color: var(--muted);
}

label {
    display: block;
    margin: 16px 0 7px;
    color: #b8c5d9;
    font-size: 13px;
}

input {
    width: 100%;
    border: 1px solid #314461;
    background: #0c1627;
    color: white;
    border-radius: 10px;
    padding: 13px;
    outline: none;
}

input:focus {
    border-color: var(--primary);
}

#loginButton {
    width: 100%;
    margin-top: 22px;
    border: 0;
    border-radius: 10px;
    padding: 13px;
    background: linear-gradient(90deg,#147cff,#2ca8ff);
    color: white;
    cursor: pointer;
    font-weight: 700;
}

.error-message {
    min-height: 20px;
    margin-top: 12px;
    color: var(--red);
    font-size: 13px;
}

.login-footer {
    text-align: center;
    color: #657896;
    font-size: 12px;
    margin-top: 25px;
}


/* APP */

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 245px;
    background: #091321;
    border-right: 1px solid #1c2a40;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 5px 8px 25px;
}

.sidebar-brand strong,
.sidebar-brand span {
    display: block;
}

.sidebar-brand span {
    color: var(--muted);
    font-size: 11px;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    border: 0;
    color: #a6b4ca;
    background: transparent;
    text-align: left;
    padding: 11px 12px;
    border-radius: 9px;
    cursor: pointer;
    display: flex;
    gap: 11px;
}

.nav-item:hover,
.nav-item.active {
    background: #16243a;
    color: white;
}

.nav-item.disabled {
    opacity: .45;
    cursor: default;
}

.sidebar-bottom {
    margin-top: auto;
}

.system-indicator {
    color: #94a4bb;
    font-size: 12px;
    padding: 10px;
}

.status-dot {
    width: 8px;
    height: 8px;
    display: inline-block;
    border-radius: 50%;
    background: var(--green);
    margin-right: 6px;
    box-shadow: 0 0 12px var(--green);
}


.main {
    margin-left: 245px;
    width: calc(100% - 245px);
    min-height: 100vh;
}

.topbar {
    padding: 21px 30px;
    border-bottom: 1px solid #1c2a40;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(7,16,31,.85);
    position: sticky;
    top: 0;
    backdrop-filter: blur(10px);
    z-index: 5;
}

.topbar h2 {
    margin: 0;
    font-size: 20px;
}

.topbar p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 35px;
    height: 35px;
    background: #233a5b;
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.user-data strong,
.user-data span {
    display: block;
}

.user-data span {
    color: var(--muted);
    font-size: 11px;
}

.logout-button {
    margin-left: 10px;
    border: 1px solid #354966;
    background: transparent;
    color: white;
    padding: 7px 11px;
    border-radius: 7px;
    cursor: pointer;
}

.page {
    padding: 28px 30px 50px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card,
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 13px;
}

.metric-card {
    padding: 19px;
}

.metric-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.metric-value {
    display: block;
    font-size: 25px;
    margin: 8px 0 3px;
}

.metric-card small {
    color: #6f819e;
}

.green {
    color: var(--green);
}

.blue {
    color: #49baff;
}

.panel {
    padding: 20px;
    margin-bottom: 20px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

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

.panel-header p {
    color: var(--muted);
    font-size: 12px;
    margin: 4px 0 0;
}

.central-grid {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 14px;
}

.central-card {
    background: var(--panel2);
    border: 1px solid #2a3d5b;
    padding: 18px;
    border-radius: 11px;
}

.central-card-top {
    display: flex;
    justify-content: space-between;
}

.central-card h4 {
    margin: 0 0 5px;
}

.central-card p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.badge {
    border-radius: 50px;
    padding: 5px 9px;
    font-size: 10px;
    text-transform: uppercase;
}

.badge.active {
    color: var(--green);
    background: rgba(43,213,118,.10);
}

.badge.development {
    color: var(--yellow);
    background: rgba(255,202,85,.10);
}

.central-info {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    color: #8293ac;
    font-size: 11px;
}

.empty-monitor {
    min-height: 170px;
    border: 1px dashed #2b3e5b;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--muted);
}

.empty-monitor strong {
    color: white;
    margin: 12px 0 4px;
}

.pulse {
    width: 14px;
    height: 14px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 25px var(--green);
}

.primary-button {
    border: 0;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    padding: 9px 13px;
}

.primary-button:disabled {
    opacity: .45;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #22324a;
    font-size: 12px;
}

.data-table th {
    color: #8395b0;
    font-weight: 600;
}

.data-table td {
    color: #dce5f5;
}


@media(max-width: 900px) {

    .sidebar {
        width: 70px;
    }

    .sidebar-brand div:not(.brand-icon),
    .nav-item {
        font-size: 0;
    }

    .nav-item span {
        font-size: 18px;
    }

    .main {
        margin-left: 70px;
        width: calc(100% - 70px);
    }

    .cards {
        grid-template-columns: repeat(2,1fr);
    }

    .central-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================
   DETALHES DAS CENTRAIS
   ========================================= */

.central-card {
    cursor: pointer;
    transition:
        transform .18s ease,
        border-color .18s ease,
        box-shadow .18s ease;
}

.central-card:hover {
    transform: translateY(-2px);
    border-color: #3d75b7;
    box-shadow: 0 12px 30px rgba(0,0,0,.20);
}

.central-detail-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.central-detail-header h2 {
    margin: 0;
    font-size: 23px;
}

.central-detail-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.central-detail-header .badge {
    margin-left: auto;
}

.back-button {
    border: 1px solid #344b6c;
    background: #111e31;
    color: #dce7f8;
    padding: 9px 13px;
    border-radius: 8px;
    cursor: pointer;
}

.back-button:hover {
    border-color: var(--primary);
}

.central-name-button {
    border: 0;
    background: transparent;
    color: #dce7f8;
    padding: 0;
    cursor: pointer;
    font-weight: 700;
}

.central-name-button:hover {
    color: #55b8ff;
}

.extension-number {
    font-weight: 800;
    color: #56b8ff;
}

.protocol-badge {
    display: inline-block;
    min-width: 42px;
    text-align: center;
    padding: 4px 7px;
    border-radius: 6px;
    background: rgba(45,140,255,.12);
    color: #65baff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.type-badge {
    display: inline-block;
    padding: 4px 7px;
    border-radius: 6px;
    background: #1a2a42;
    color: #a9bad3;
    font-size: 10px;
}

.queue-box {
    background: #132137;
    border: 1px solid #283d5d;
    border-radius: 11px;
    padding: 17px;
    margin-bottom: 12px;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.queue-number {
    font-size: 21px;
    font-weight: 900;
    color: #55b8ff;
}

.queue-members {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
}

.queue-member {
    background: #0c1828;
    border: 1px solid #263b59;
    border-radius: 7px;
    padding: 6px 9px;
    color: #c5d2e5;
    font-size: 11px;
}

.loading-box {
    padding: 35px;
    text-align: center;
    color: var(--muted);
}

.status-active {
    color: var(--green);
}

.status-inactive {
    color: var(--red);
}

@media(max-width: 700px) {

    .central-detail-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .central-detail-header .badge {
        margin-left: 0;
    }

    .data-table {
        min-width: 650px;
    }

    #centralClientsTable,
    #centralExtensionsTable {
        overflow-x: auto;
    }
}


/* =========================================
   DETALHES DAS CENTRAIS
   ========================================= */

.central-card {
    cursor: pointer;
    transition:
        transform .18s ease,
        border-color .18s ease,
        box-shadow .18s ease;
}

.central-card:hover {
    transform: translateY(-2px);
    border-color: #3d75b7;
    box-shadow: 0 12px 30px rgba(0,0,0,.20);
}

.central-detail-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.central-detail-header h2 {
    margin: 0;
    font-size: 23px;
}

.central-detail-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.central-detail-header .badge {
    margin-left: auto;
}

.back-button {
    border: 1px solid #344b6c;
    background: #111e31;
    color: #dce7f8;
    padding: 9px 13px;
    border-radius: 8px;
    cursor: pointer;
}

.back-button:hover {
    border-color: var(--primary);
}

.central-name-button {
    border: 0;
    background: transparent;
    color: #dce7f8;
    padding: 0;
    cursor: pointer;
    font-weight: 700;
}

.central-name-button:hover {
    color: #55b8ff;
}

.extension-number {
    font-weight: 800;
    color: #56b8ff;
}

.protocol-badge {
    display: inline-block;
    min-width: 42px;
    text-align: center;
    padding: 4px 7px;
    border-radius: 6px;
    background: rgba(45,140,255,.12);
    color: #65baff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.type-badge {
    display: inline-block;
    padding: 4px 7px;
    border-radius: 6px;
    background: #1a2a42;
    color: #a9bad3;
    font-size: 10px;
}

.queue-box {
    background: #132137;
    border: 1px solid #283d5d;
    border-radius: 11px;
    padding: 17px;
    margin-bottom: 12px;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.queue-number {
    font-size: 21px;
    font-weight: 900;
    color: #55b8ff;
}

.queue-members {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
}

.queue-member {
    background: #0c1828;
    border: 1px solid #263b59;
    border-radius: 7px;
    padding: 6px 9px;
    color: #c5d2e5;
    font-size: 11px;
}

.loading-box {
    padding: 35px;
    text-align: center;
    color: var(--muted);
}

.status-active {
    color: var(--green);
}

.status-inactive {
    color: var(--red);
}

@media(max-width: 700px) {

    .central-detail-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .central-detail-header .badge {
        margin-left: 0;
    }

    .data-table {
        min-width: 650px;
    }

    #centralClientsTable,
    #centralExtensionsTable {
        overflow-x: auto;
    }
}

/* Logo GoVoIP */
.brand-icon {
    overflow: hidden;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 12px;
}

/* Logo GoVoIP */
.brand-icon {
    overflow: hidden;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 12px;
}

/* =========================================
   CORRECAO DEFINITIVA MODAL GOVOIP
========================================= */

#clientModal.modal-overlay {
    position: fixed !important;
    inset: 0 !important;

    width: 100vw !important;
    height: 100vh !important;

    z-index: 999999 !important;

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

    padding: 20px;

    overflow-y: auto;

    background: rgba(2, 8, 18, 0.82);
    backdrop-filter: blur(8px);
}

#clientModal.hidden {
    display: none !important;
}

#clientModal .modal-card {
    position: relative;

    width: 520px;
    max-width: 100%;

    margin: auto;

    background: #101d31;

    border: 1px solid #2c4161;
    border-radius: 16px;

    padding: 24px;

    box-shadow:
        0 35px 100px rgba(0,0,0,.65);
}

#clientModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    margin-bottom: 20px;
}

#clientModal label {
    margin-top: 15px;
}

#clientModal textarea {
    min-height: 95px;
}

#clientModal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;

    margin-top: 22px;
}

/* Modal de Ramais GoVoIP */
#extensionModal.modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;

    width: 100vw !important;
    height: 100vh !important;

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

    padding: 20px;
    overflow-y: auto;

    background: rgba(2, 8, 18, .84);
    backdrop-filter: blur(8px);
}

#extensionModal.hidden {
    display: none !important;
}

#extensionModal .modal-card {
    width: 540px;
    max-width: 100%;

    margin: auto;
    padding: 24px;

    background: #101d31;
    border: 1px solid #2c4161;
    border-radius: 16px;

    box-shadow: 0 35px 100px rgba(0,0,0,.65);
}

.checkbox-row {
    margin-top: 17px;
}

.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 9px;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
}

.queue-destination-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 7px;
    background: rgba(45,140,255,.14);
    color: #69baff;
    border: 1px solid rgba(69,153,255,.24);
    font-size: 10px;
    font-weight: 700;
}

.queue-actions {
    display: flex;
    justify-content: flex-end;
    margin: 12px 0;
}

.queue-operator-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 12px 0;

    border-bottom:
        1px solid rgba(255,255,255,.07);
}

.queue-operator-row label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.queue-operator-row input[type="checkbox"] {
    width: auto;
}

.queue-penalty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.queue-penalty span {
    font-size: 11px;
    opacity: .65;
}

.queue-penalty input {
    width: 70px;
}

/* =========================================================
   MODAL - OPERADORES DA FILA
========================================================= */

#queueMembersModal.modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;

    width: 100vw !important;
    height: 100vh !important;

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

    padding: 24px !important;

    overflow: hidden !important;

    background: rgba(2, 8, 18, .86) !important;
    backdrop-filter: blur(8px);
}

#queueMembersModal.hidden {
    display: none !important;
}

#queueMembersModal .modal-card {
    position: relative !important;

    width: 650px !important;
    max-width: calc(100vw - 40px) !important;
    max-height: calc(100vh - 60px) !important;

    display: flex !important;
    flex-direction: column !important;

    margin: 0 !important;
    padding: 24px !important;

    background: #101d31 !important;

    border: 1px solid #2c4161 !important;
    border-radius: 16px !important;

    box-shadow:
        0 35px 100px rgba(0,0,0,.65) !important;

    overflow: hidden !important;
}

#queueMembersModal .modal-header {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;

    gap: 20px !important;

    flex-shrink: 0 !important;

    margin-bottom: 18px !important;
}

#queueMembersModal .modal-header h3 {
    margin: 0 0 5px 0 !important;
}

#queueMembersModal .modal-header p {
    margin: 0 !important;
    opacity: .7;
}

#queueMembersModal .modal-close {
    flex: 0 0 auto !important;
}


/* LISTA DOS OPERADORES */

#queueMembersList {
    width: 100% !important;

    display: flex !important;
    flex-direction: column !important;

    overflow-y: auto !important;
    overflow-x: hidden !important;

    max-height: 470px !important;

    padding-right: 5px !important;

    border-top:
        1px solid rgba(255,255,255,.07) !important;

    border-bottom:
        1px solid rgba(255,255,255,.07) !important;
}


#queueMembersModal .queue-operator-row {
    width: 100% !important;
    min-height: 58px !important;

    display: grid !important;

    grid-template-columns:
        minmax(0, 1fr)
        150px !important;

    align-items: center !important;

    gap: 20px !important;

    padding: 10px 4px !important;

    margin: 0 !important;

    border-bottom:
        1px solid rgba(255,255,255,.07) !important;
}

#queueMembersModal .queue-operator-row:last-child {
    border-bottom: 0 !important;
}


/* OPERADOR */

#queueMembersModal .queue-operator-row > label {
    min-width: 0 !important;

    display: grid !important;

    grid-template-columns:
        20px
        55px
        minmax(0,1fr) !important;

    align-items: center !important;

    gap: 10px !important;

    margin: 0 !important;

    cursor: pointer;
}

#queueMembersModal
.queue-operator-row
input[type="checkbox"] {
    width: 17px !important;
    height: 17px !important;
    margin: 0 !important;
}

#queueMembersModal .queue-operator-row strong {
    font-size: 13px !important;
}

#queueMembersModal .queue-operator-row label span {
    min-width: 0 !important;

    font-size: 13px !important;

    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}


/* PRIORIDADE */

#queueMembersModal .queue-penalty {
    display: grid !important;

    grid-template-columns:
        65px
        70px !important;

    align-items: center !important;

    justify-content: end !important;

    gap: 8px !important;

    margin: 0 !important;
}

#queueMembersModal .queue-penalty span {
    font-size: 11px !important;

    text-align: right !important;

    opacity: .65 !important;
}

#queueMembersModal .queue-penalty input {
    width: 70px !important;
    height: 36px !important;

    margin: 0 !important;

    text-align: center !important;
}


/* ERRO */

#queueMembersModal #queueMembersError {
    flex-shrink: 0 !important;

    margin-top: 10px !important;
}


/* BOTÕES */

#queueMembersModal .modal-actions {
    display: flex !important;

    justify-content: flex-end !important;
    align-items: center !important;

    gap: 10px !important;

    flex-shrink: 0 !important;

    margin-top: 18px !important;
}


/* TELAS MENORES */

@media (max-width: 650px) {

    #queueMembersModal.modal-overlay {
        padding: 12px !important;
    }

    #queueMembersModal .modal-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 18px !important;
    }

    #queueMembersModal .queue-operator-row {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    #queueMembersModal .queue-penalty {
        justify-content: start !important;

        grid-template-columns:
            65px
            70px !important;

        padding-left: 30px !important;
    }
}

