:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --border: #e5e9f0;

    --text: #172033;
    --muted: #758099;

    --nav: #101828;
    --nav-hover: #1d2939;

    --primary: #3959d9;
    --primary-dark: #2946bd;

    --green: #14804a;
    --green-bg: #eaf8f0;

    --red: #c43232;
    --red-bg: #fff0f0;

    --amber: #a96900;
    --amber-bg: #fff6df;

    --radius: 14px;

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

.hidden {
    display: none !important;
}


/* LOGIN */

.login-page {
    min-height: 100vh;

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

    padding: 24px;

    background:
        radial-gradient(
            circle at top right,
            #e8edff 0,
            transparent 35%
        ),
        var(--bg);
}

.login-card {
    width: 100%;
    max-width: 430px;

    padding: 42px;

    background: white;

    border:
        1px solid var(--border);

    border-radius: 20px;

    box-shadow:
        0 18px 45px
        rgba(20, 35, 70, 0.08);
}

.brand-block,
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 46px;
    height: 46px;

    border-radius: 12px;

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

    background: var(--primary);
    color: white;

    font-weight: 800;
    font-size: 25px;
}

.brand-mark.small {
    width: 37px;
    height: 37px;
    font-size: 20px;
}

.brand-name {
    font-size: 21px;
    font-weight: 750;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--muted);
}

.login-card h1 {
    margin:
        38px 0
        8px;

    font-size: 27px;
}

.muted {
    color: var(--muted);
    margin-bottom: 30px;
}

label {
    display: block;

    margin:
        17px 0
        7px;

    font-size: 13px;
    font-weight: 650;
}

input {
    width: 100%;

    border:
        1px solid #d9dfe9;

    border-radius: 9px;

    padding:
        12px 13px;

    font-size: 15px;

    outline: none;
}

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

    box-shadow:
        0 0 0 3px
        rgba(57, 89, 217, 0.09);
}

.primary-button {
    width: 100%;

    margin-top: 25px;

    padding: 13px 18px;

    border: 0;
    border-radius: 9px;

    cursor: pointer;

    background: var(--primary);
    color: white;

    font-size: 14px;
    font-weight: 700;
}

.primary-button:hover {
    background: var(--primary-dark);
}

.primary-button:disabled {
    opacity: .65;
    cursor: wait;
}

.error-message {
    margin-top: 16px;

    padding: 11px;

    border-radius: 8px;

    background: var(--red-bg);
    color: var(--red);

    font-size: 13px;
}


/* APP */

.app-layout {
    min-height: 100vh;
}

.sidebar {
    position: fixed;

    top: 0;
    left: 0;
    bottom: 0;

    width: 235px;

    padding: 22px 16px;

    background: var(--nav);
    color: white;

    display: flex;
    flex-direction: column;

    z-index: 20;
}

.sidebar-brand {
    padding:
        2px 6px
        28px;
}

.sidebar-brand strong {
    display: block;
    font-size: 17px;
}

.sidebar-brand span {
    display: block;

    margin-top: 2px;

    color: #98a2b3;
    font-size: 11px;
}

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

.nav-item {
    width: 100%;

    display: flex;
    align-items: center;
    gap: 11px;

    padding: 11px 12px;

    border: 0;
    border-radius: 8px;

    background: transparent;
    color: #cbd2dc;

    text-align: left;

    cursor: pointer;

    font-size: 14px;
}

.nav-item:hover {
    background: var(--nav-hover);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-icon {
    width: 18px;
    text-align: center;
}

.sidebar-bottom {
    margin-top: auto;

    border-top:
        1px solid
        rgba(255,255,255,.08);

    padding:
        18px 7px
        2px;
}

#sidebar-user {
    color: #cbd2dc;
    font-size: 12px;

    margin-bottom: 10px;

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

.logout-button {
    border: 0;
    background: transparent;

    color: #98a2b3;

    padding: 0;

    cursor: pointer;

    font-size: 12px;
}

.logout-button:hover {
    color: white;
}


.main-content {
    margin-left: 235px;

    min-height: 100vh;

    padding:
        0 30px
        40px;
}

.topbar {
    height: 93px;

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

    border-bottom:
        1px solid var(--border);

    margin-bottom: 27px;
}

.topbar h1 {
    margin: 0;

    font-size: 24px;
}

.topbar p {
    margin:
        5px 0
        0;

    color: var(--muted);
    font-size: 13px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 17px;
}

.environment-badge {
    padding:
        6px 9px;

    border-radius: 7px;

    background: #eef1f7;
    color: #68738b;

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

    letter-spacing: .04em;
}

.current-user {
    font-size: 13px;
    font-weight: 650;
}


.page {
    display: none;
}

.page.active {
    display: block;
}


.cards-grid {
    display: grid;

    grid-template-columns:
        repeat(
            6,
            minmax(140px, 1fr)
        );

    gap: 14px;

    margin-bottom: 22px;
}

.metric-card {
    background: white;

    border:
        1px solid var(--border);

    border-radius: var(--radius);

    padding: 18px;
}

.metric-label {
    color: var(--muted);

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

.metric-value {
    margin:
        10px 0
        7px;

    font-size: 28px;
    font-weight: 750;

    letter-spacing: -.03em;
}

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

.metric-foot {
    color: #98a2b3;
    font-size: 10px;
}


.content-grid {
    display: grid;

    grid-template-columns:
        minmax(280px, .8fr)
        minmax(500px, 2fr);

    gap: 18px;
}

.panel {
    background: white;

    border:
        1px solid var(--border);

    border-radius: var(--radius);

    overflow: hidden;
}

.panel-header {
    padding:
        18px 20px;

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

    border-bottom:
        1px solid var(--border);
}

.panel-header h2 {
    margin: 0;

    font-size: 16px;
}

.panel-header p {
    margin:
        4px 0
        0;

    color: var(--muted);
    font-size: 11px;
}


.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;

    border-collapse: collapse;

    font-size: 12px;
}

th {
    padding:
        11px 15px;

    text-align: left;

    background: #fafbfc;
    color: #7a8498;

    border-bottom:
        1px solid var(--border);

    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

td {
    padding:
        13px 15px;

    border-bottom:
        1px solid #eef1f5;

    vertical-align: middle;
}

tr:last-child td {
    border-bottom: 0;
}


.status {
    display: inline-flex;

    align-items: center;

    padding:
        4px 7px;

    border-radius: 6px;

    font-size: 10px;
    font-weight: 750;
}

.status.online,
.status.ok {
    background: var(--green-bg);
    color: var(--green);
}

.status.offline,
.status.erro,
.status.abandonado {
    background: var(--red-bg);
    color: var(--red);
}

.status.processando {
    background: var(--amber-bg);
    color: var(--amber);
}


.agent-list {
    padding: 4px 19px;
}

.agent-row {
    display: flex;

    align-items: center;
    justify-content: space-between;

    padding:
        15px 0;

    border-bottom:
        1px solid #eef1f5;
}

.agent-row:last-child {
    border-bottom: 0;
}

.agent-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.agent-main strong {
    font-size: 13px;
}

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


.secondary-button {
    padding:
        8px 12px;

    border:
        1px solid var(--border);

    border-radius: 7px;

    background: white;
    color: var(--text);

    cursor: pointer;

    font-size: 11px;
    font-weight: 650;
}

.secondary-button:hover {
    background: #f7f8fa;
}


.empty-state {
    padding: 30px;

    text-align: center;
    color: var(--muted);

    font-size: 12px;
}


@media (
    max-width: 1250px
) {
    .cards-grid {
        grid-template-columns:
            repeat(3, 1fr);
    }
}


@media (
    max-width: 900px
) {
    .sidebar {
        width: 72px;
    }

    .sidebar-brand div:not(.brand-mark),
    .nav-item:not(.active) .nav-label,
    .sidebar-bottom {
        display: none;
    }

    .nav-item {
        justify-content: center;
    }

    .main-content {
        margin-left: 72px;
        padding:
            0 18px
            30px;
    }

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

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