:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #e5e9f0;

    --text: #152033;
    --muted: #697386;

    --primary: #2157f2;
    --primary-dark: #1744ca;

    --sidebar: #101827;
    --sidebar-soft: #192235;

    --success: #15803d;
    --success-bg: #ecfdf3;

    --danger: #b42318;
    --danger-bg: #fff2f0;

    --warning: #b54708;
    --warning-bg: #fff7ed;

    --shadow:
        0 8px 30px rgba(15, 23, 42, 0.08);

    --radius: 14px;
}


* {
    box-sizing: border-box;
}


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


button,
input {
    font: inherit;
}


.hidden {
    display: none !important;
}


/* LOGIN */

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 30px;
    background:
        radial-gradient(
            circle at top right,
            #dfe8ff,
            transparent 38%
        ),
        radial-gradient(
            circle at bottom left,
            #e8eeff,
            transparent 35%
        ),
        #f4f7fb;
}


.login-card,
.tenant-card {
    width: 100%;
    max-width: 450px;
    padding: 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}


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


.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;

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

    border-radius: 12px;

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


.brand-mark.small {
    width: 38px;
    height: 38px;
    font-size: 18px;
}


.brand-name {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.08em;
}


.brand-subtitle {
    margin-top: 2px;

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


.login-header {
    margin: 34px 0 26px;
}


.login-header h1 {
    margin: 0 0 8px;
    font-size: 26px;
}


.login-header p {
    margin: 0;

    color: var(--muted);
    line-height: 1.6;
}


label {
    display: block;

    margin: 18px 0 8px;

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


input {
    width: 100%;

    padding: 13px 14px;

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

    border: 1px solid #d8dee9;
    border-radius: 10px;

    outline: none;
}


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

    box-shadow:
        0 0 0 3px
        rgba(33, 87, 242, 0.10);
}


.btn {
    border: 0;
    border-radius: 10px;

    padding: 13px 16px;

    cursor: pointer;

    font-weight: 700;
}


.btn-primary {
    width: 100%;
    margin-top: 24px;

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


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


.btn-secondary {
    color: var(--text);
    background: white;

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


.btn-secondary.compact {
    padding: 10px 14px;
}


.login-footer {
    margin-top: 28px;

    color: #98a1b2;

    font-size: 12px;
    text-align: center;
}


.login-footer span {
    margin: 0 6px;
}


.alert {
    margin-top: 16px;
    padding: 12px 14px;

    border-radius: 10px;

    font-size: 13px;
}


.alert-error {
    color: var(--danger);
    background: var(--danger-bg);
    border: 1px solid #ffd8d2;
}


/* TENANT */

.tenant-list {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}


.tenant-option {
    width: 100%;

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

    padding: 15px;

    color: var(--text);
    background: var(--surface-soft);

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

    cursor: pointer;

    text-align: left;
}


.tenant-option:hover {
    border-color: var(--primary);
    background: #f3f6ff;
}


.tenant-option strong {
    display: block;
}


.tenant-option span {
    display: block;

    margin-top: 4px;

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


/* DASHBOARD */

.dashboard {
    min-height: 100vh;

    display: grid;

    grid-template-columns:
        250px minmax(0, 1fr);
}


.sidebar {
    min-height: 100vh;

    display: flex;
    flex-direction: column;

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

    padding: 22px 16px;

    position: sticky;
    top: 0;
    height: 100vh;
}


.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 0 8px 24px;
}


.sidebar .brand-subtitle {
    color: #8f9aae;
}


.nav-menu {
    display: grid;
    gap: 5px;
}


.nav-item {
    width: 100%;

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

    padding: 11px 12px;

    color: #b7c0cf;
    background: transparent;

    border: 0;
    border-radius: 9px;

    cursor: pointer;

    text-align: left;
}


.nav-item:hover,
.nav-item.active {
    color: white;
    background: var(--sidebar-soft);
}


.sidebar-bottom {
    margin-top: auto;

    padding-top: 18px;

    border-top:
        1px solid rgba(255,255,255,0.08);
}


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

    margin-bottom: 14px;
}


.avatar {
    width: 36px;
    height: 36px;

    display: grid;
    place-items: center;

    flex: 0 0 auto;

    color: white;
    background: #334155;

    border-radius: 50%;

    font-weight: 700;
}


.user-info {
    min-width: 0;
}


.user-info strong,
.user-info span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.user-info strong {
    font-size: 13px;
}


.user-info span {
    margin-top: 2px;

    color: #8f9aae;
    font-size: 11px;
}


.logout-button {
    width: 100%;

    padding: 9px;

    color: #b7c0cf;
    background: transparent;

    border:
        1px solid rgba(255,255,255,0.10);
    border-radius: 8px;

    cursor: pointer;
}


.main-content {
    min-width: 0;
}


.topbar {
    min-height: 78px;

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

    padding: 14px 30px;

    background: white;

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


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


.eyebrow {
    color: var(--muted);

    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
}


.role-badge {
    display: inline-flex;

    padding: 7px 10px;

    color: #1744ca;
    background: #edf2ff;

    border-radius: 999px;

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


.content {
    padding: 30px;
}


.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 24px;
}


.page-heading h1 {
    margin: 0;
    font-size: 27px;
}


.page-heading p {
    margin: 6px 0 0;

    color: var(--muted);
}


.cards-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 16px;

    margin-bottom: 24px;
}


.metric-card {
    padding: 20px;

    background: white;

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

    box-shadow:
        0 2px 8px
        rgba(15,23,42,0.025);
}


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

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


.metric-value {
    margin-top: 10px;

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


.metric-text {
    margin-top: 12px;

    min-height: 36px;

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

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


.metric-footer {
    margin-top: 5px;

    color: #9aa4b5;
    font-size: 11px;
}


.panel {
    background: white;

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

    overflow: hidden;
}


.panel-header {
    padding: 20px;

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


.panel-header h3 {
    margin: 0;
}


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

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


.empty-state {
    padding: 65px 20px;

    text-align: center;
}


.empty-icon {
    margin-bottom: 12px;

    color: #8da3e8;

    font-size: 42px;
}


.empty-state h3 {
    margin: 0;
}


.empty-state p {
    max-width: 420px;

    margin: 8px auto 0;

    color: var(--muted);

    line-height: 1.6;
}


.table-wrapper {
    overflow-x: auto;
}


table {
    width: 100%;

    border-collapse: collapse;
}


th,
td {
    padding: 14px 18px;

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

    text-align: left;
}


th {
    color: var(--muted);
    background: #fbfcfe;

    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
}


td {
    font-size: 13px;
}


.status-badge {
    display: inline-flex;

    padding: 5px 8px;

    border-radius: 999px;

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


.status-online {
    color: var(--success);
    background: var(--success-bg);
}


.status-other {
    color: var(--warning);
    background: var(--warning-bg);
}


@media (max-width: 1100px) {

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

}


@media (max-width: 760px) {

    .dashboard {
        display: block;
    }

    .sidebar {
        min-height: auto;
        height: auto;
        position: relative;
    }

    .nav-menu {
        display: none;
    }

    .sidebar-bottom {
        display: none;
    }

    .content {
        padding: 20px;
    }

    .topbar {
        padding: 14px 20px;
    }

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

}


/* ADMINISTRATION */

.admin-grid {
    display: grid;
    grid-template-columns:
        minmax(300px, 420px)
        minmax(500px, 1fr);
    gap: 20px;
}

.admin-form {
    padding: 20px;
}

.alert-success {
    color: var(--success);
    background: var(--success-bg);
    border: 1px solid #bbf7d0;
}

@media (max-width: 1050px) {

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

}

.company-admin-grid {
    grid-template-columns:
        minmax(420px, 520px)
        minmax(600px, 1fr);
}

.company-form select {
    width: 100%;
    padding: 13px 14px;
    background: white;
    color: var(--text);
    border: 1px solid #d8dee9;
    border-radius: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-section-title {
    margin: 26px 0 2px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.form-actions {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    margin-top: 24px;
}

.form-actions .btn-primary {
    margin-top: 0;
}

@media (max-width: 1200px) {

    .company-admin-grid {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 700px) {

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

}

.table-actions {
    display: flex;
    gap: 7px;
}

.activation-result {
    margin-top: 16px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.activation-result p {
    color: var(--muted);
    font-size: 12px;
}

.activation-result textarea {
    width: 100%;
    min-height: 90px;
    padding: 10px;
    margin: 8px 0 10px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.activation-login {
    margin-top: 20px;
}

.activation-link {
    display: block;
    text-align: center;
    text-decoration: none;
}

.admin-form select {
    width: 100%;
    padding: 13px 14px;
    background: white;
    border: 1px solid #d8dee9;
    border-radius: 10px;
}
