* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        Arial,
        Helvetica,
        sans-serif;
    background: #f4f7fb;
    color: #172033;
}

.public-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.vpn-card {
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border-radius: 18px;
    padding: 40px;
    box-shadow:
        0 20px 60px
        rgba(23, 32, 51, 0.12);
}

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

.brand h1 {
    margin: 0;
    color: #2496d8;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
}

.brand span {
    font-size: 12px;
    font-weight: 700;
    color: #6c778b;
    letter-spacing: 1px;
}

.vpn-card h2 {
    margin-top: 35px;
    margin-bottom: 10px;
}

.description {
    color: #6c778b;
    line-height: 1.5;
    margin-bottom: 30px;
}

form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

label {
    font-size: 14px;
    font-weight: 600;
}

input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #d7deea;
    border-radius: 9px;
    font-size: 16px;
    outline: none;
}

input:focus {
    border-color: #2496d8;
}

button {
    margin-top: 10px;
    border: 0;
    border-radius: 9px;
    padding: 15px;
    background: #2496d8;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    opacity: 0.92;
}

.message {
    margin: 20px 0;
    padding: 14px;
    border-radius: 8px;
}

.message.error {
    background: #ffe8e8;
    color: #a62828;
}

.admin-body {
    min-height: 100vh;
}

.admin-header {
    min-height: 72px;
    background: #ffffff;
    border-bottom: 1px solid #e2e7ef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-user .role {
    background: #eaf6fd;
    color: #187bb2;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.admin-user a {
    color: #6c778b;
    text-decoration: none;
}

.dashboard {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.stats-grid {
    display: grid;
    grid-template-columns:
        repeat(4, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.stat-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 25px;
    box-shadow:
        0 8px 30px
        rgba(23, 32, 51, 0.06);
}

.stat-card span {
    display: block;
    color: #6c778b;
    margin-bottom: 15px;
}

.stat-card strong {
    font-size: 34px;
    color: #2496d8;
}

.panel {
    background: #ffffff;
    border-radius: 14px;
    padding: 25px;
    box-shadow:
        0 8px 30px
        rgba(23, 32, 51, 0.06);
}

.message.success {
    background: #e7f8ee;
    color: #1d7a3a;
}

.inline-form {
    display: inline-block;
    margin-right: 8px;
}

.inline-form button {
    margin: 0;
    padding: 8px 12px;
    font-size: 13px;
}

button.danger {
    background: #d94b4b;
}

.download-button {
    display: block;
    text-align: center;
    text-decoration: none;
    margin-top: 20px;
    border-radius: 9px;
    padding: 15px;
    background: #2496d8;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th,
td {
    text-align: left;
    padding: 14px;
    border-bottom: 1px solid #e2e7ef;
}

th {
    color: #6c778b;
    font-size: 13px;
}

.empty-state {
    color: #6c778b;
}

@media (
    max-width: 900px
) {

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

}

@media (
    max-width: 600px
) {

    .admin-header {
        padding: 0 20px;
    }

    .dashboard {
        padding: 20px;
    }

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

    .vpn-card {
        padding: 28px;
    }

}

select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #d7deea;
    border-radius: 9px;
    font-size: 16px;
    outline: none;
    background: #ffffff;
}

select:focus {
    border-color: #2496d8;
}

.generated-code {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #2496d8;
    background: #eef8ff;
    padding: 18px;
    border-radius: 10px;
}

.user-picker {
    position: relative;
}

.user-dropdown {
    display: none;
    position: absolute;
    z-index: 1000;
    width: 100%;
    max-height: 260px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #d7deea;
    border-radius: 9px;
    box-shadow: 0 12px 30px rgba(23, 32, 51, 0.12);
    margin-top: 6px;
}

.user-option {
    padding: 12px 15px;
    cursor: pointer;
}

.user-option:hover {
    background: #eef8ff;
}

.create-user-option {
    border-top: 1px solid #e2e7ef;
    color: #2496d8;
    font-weight: 700;
}

.status-pill {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-pill.online {
    background: #e7f8ee;
    color: #1d7a3a;
}

.status-pill.offline {
    background: #f1f2f5;
    color: #6c778b;
}

.panel + .panel {
    margin-top: 25px;
}

.device-filters {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.table-search-row {
    grid-template-columns: minmax(0, 520px);
    margin: 14px 0 16px;
}

.table-search-row input[type="search"] {
    width: min(100%, 520px);
}

.pagination {
    margin-top: 18px;
    display: flex;
    gap: 8px;
}

.pagination button {
    width: auto;
    margin: 0;
    padding: 8px 12px;
    font-size: 13px;
}

.pagination button.active-page {
    background: #172033;
}

@media (max-width: 1000px) {
    .device-filters {
        grid-template-columns: 1fr;
    }
}

body.admin-body,
body {
    background:
        radial-gradient(circle at 15% 10%, rgba(0, 170, 255, 0.13), transparent 28%),
        radial-gradient(circle at 90% 20%, rgba(0, 120, 255, 0.10), transparent 30%),
        linear-gradient(180deg, #f8fbff 0%, #eef6ff 45%, #dff1ff 100%);
    min-height: 100vh;
}

body.admin-body::before,
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            165deg,
            rgba(255,255,255,0.28) 0px,
            rgba(255,255,255,0.28) 1px,
            transparent 1px,
            transparent 18px
        );
    opacity: 0.45;
}

.admin-header {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(30, 150, 220, 0.12);
    box-shadow: 0 8px 25px rgba(30, 100, 170, 0.08);
}

.header-logo {
    height: 58px;
    width: auto;
    display: block;
}

.public-logo {
    width: 100%;
    max-width: 360px;
    display: block;
    margin: 0 auto 25px auto;
}

.dashboard {
    max-width: 1500px;
}

.stat-card,
.panel,
.vpn-card {
    background: rgba(255,255,255,0.88);
    border: 1px solid rgba(30, 150, 220, 0.10);
    box-shadow: 0 18px 45px rgba(30, 100, 170, 0.11);
    backdrop-filter: blur(10px);
}

.stat-card strong {
    color: #168fe0;
}

button,
.download-button {
    background: linear-gradient(135deg, #0ca6f2, #096fdc);
    box-shadow: 0 8px 18px rgba(0, 125, 220, 0.24);
}

input,
select {
    background: rgba(255,255,255,0.95);
}

table thead {
    background: linear-gradient(180deg, #f7fbff, #edf6ff);
}

.status-pill.online {
    background: #e7f9f0;
    color: #15944d;
}

.status-pill.offline {
    background: #e9edf3;
    color: #667085;
}

body {
    background:
        radial-gradient(circle at 10% 15%, rgba(0, 180, 255, 0.18), transparent 30%),
        radial-gradient(circle at 85% 20%, rgba(0, 120, 255, 0.13), transparent 32%),
        linear-gradient(180deg, #ffffff 0%, #eef8ff 45%, #d9efff 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    bottom: -80px;
    height: 45vh;
    pointer-events: none;
    background:
        repeating-radial-gradient(
            ellipse at 50% 100%,
            rgba(255,255,255,0.55) 0px,
            rgba(255,255,255,0.55) 1px,
            transparent 2px,
            transparent 18px
        ),
        linear-gradient(135deg, rgba(0, 170, 255, 0.16), rgba(255,255,255,0));
    mask-image: radial-gradient(ellipse at bottom, black 0%, transparent 72%);
    opacity: 0.9;
    z-index: -1;
}

.header-logo {
    height: 70px;
    width: auto;
    display: block;
}

.public-logo {
    width: 100%;
    max-width: 420px;
    display: block;
    margin: 0 auto 28px auto;
}

.admin-header {
    min-height: 86px;
    align-items: center;
}

/* Logo sizing fixes */

.header-logo {
    height: 82px;
    width: auto;
    display: block;
    object-fit: contain;
}

.admin-header .brand {
    display: flex;
    align-items: center;
    min-width: 260px;
}

.public-logo {
    width: 100%;
    max-width: 520px;
    height: auto;
    display: block;
    margin: -20px auto 30px auto;
    object-fit: contain;
}

.vpn-card .brand {
    margin-bottom: 20px;
}

.vpn-card {
    max-width: 520px;
}

@media (max-width: 700px) {
    .header-logo {
        height: 58px;
    }

    .public-logo {
        max-width: 360px;
        margin-top: -10px;
    }
}

/* Final logo tuning */

.admin-header {
    min-height: 95px;
    padding: 0 42px;
}

.header-logo {
    height: 92px !important;
    max-width: 360px;
    width: auto;
    object-fit: contain;
}

.public-logo {
    width: 430px !important;
    max-width: 100%;
    height: auto;
    display: block;
    margin: -35px auto 18px auto;
    object-fit: contain;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.vpn-card .brand {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.vpn-card {
    max-width: 560px;
    padding-top: 35px;
}

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

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: rgba(255,255,255,0.92);
    border-right: 1px solid rgba(30, 150, 220, 0.12);
    box-shadow: 10px 0 35px rgba(30, 100, 170, 0.08);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 10;
}

.sidebar-logo {
    padding: 22px 22px 18px 22px;
}

.sidebar-logo img {
    width: 190px;
    height: auto;
    display: block;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 6px;
}

.sidebar-nav a {
    text-decoration: none;
    color: #172033;
    padding: 13px 16px;
    border-radius: 12px;
    font-weight: 700;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: linear-gradient(135deg, #0ca6f2, #096fdc);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(0, 125, 220, 0.22);
}

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

.topbar {
    height: 82px;
    background: rgba(255,255,255,0.92);
    border-bottom: 1px solid rgba(30, 150, 220, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 38px;
    box-shadow: 0 8px 25px rgba(30, 100, 170, 0.08);
}

@media (max-width: 1000px) {
    .sidebar {
        position: static;
        width: 100%;
        min-height: auto;
    }

    .admin-layout {
        display: block;
    }

    .main-shell {
        margin-left: 0;
        width: 100%;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
    }
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
}

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(10, 25, 50, 0.35);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal {
    width: 100%;
    max-width: 540px;
    background: rgba(255,255,255,0.96);
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(20, 70, 130, 0.25);
    border: 1px solid rgba(30, 150, 220, 0.15);
    padding: 26px;
}

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

.modal-header h3 {
    margin: 0;
}

.modal-header button {
    width: auto;
    padding: 7px 13px;
    font-size: 20px;
    line-height: 1;
    background: #eef4fb;
    color: #172033;
    box-shadow: none;
}

textarea {
    width: 100%;
    min-height: 110px;
    padding: 14px 16px;
    border: 1px solid #d7deea;
    border-radius: 9px;
    font-size: 16px;
    outline: none;
    resize: vertical;
    background: rgba(255,255,255,0.95);
}

textarea:focus {
    border-color: #2496d8;
}

.inline-form {
    display: inline-block;
    margin-left: 6px;
}

.inline-form button,
td > button {
    width: auto;
    padding: 8px 12px;
    font-size: 13px;
}

.small-button {
    display: inline-block;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0ca6f2, #096fdc);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(0, 125, 220, 0.18);
}

.device-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.device-title {
    display: block;
    font-size: 30px;
    font-weight: 800;
    color: #172033;
    margin-bottom: 6px;
}

.tabs {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid #dce5f0;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tab-button {
    width: auto;
    padding: 11px 16px;
    border-radius: 10px 10px 0 0;
    background: transparent;
    color: #53627a;
    box-shadow: none;
    border: none;
    font-weight: 800;
    cursor: pointer;
}

.tab-button:hover {
    background: #eef7ff;
    color: #0a82dc;
}

.tab-button.active {
    background: linear-gradient(135deg, #0ca6f2, #096fdc);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(0, 125, 220, 0.18);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.details-table th {
    width: 260px;
    color: #667085;
    font-weight: 800;
}

.details-table td {
    color: #172033;
}

.mono {
    font-family: monospace;
    font-size: 13px;
    word-break: break-all;
}

.group-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 90px;
    padding: 8px 14px;
    
    white-space: nowrap;
    box-sizing: border-box;

    border: 1px solid rgba(14, 165, 233, 0.28);
    border-radius: 8px;

    background: linear-gradient(
        135deg,
        rgba(14, 165, 233, 0.08),
        rgba(37, 99, 235, 0.12)
    );

    color: #0786d8;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;

    text-decoration: none;

    box-shadow:
        0 3px 8px rgba(14, 165, 233, 0.08);

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.group-link:hover {
    color: #ffffff;

    border-color: transparent;

    background: linear-gradient(
        135deg,
        #0ea5e9,
        #1479df
    );

    box-shadow:
        0 6px 14px rgba(14, 165, 233, 0.28);

    transform: translateY(-1px);

    text-decoration: none;
}

.group-link:active {
    transform: translateY(0);

    box-shadow:
        0 3px 8px rgba(14, 165, 233, 0.20);
}

.group-link:visited {
    color: #0786d8;
}

.group-link:visited:hover {
    color: #ffffff;
}

.show-disabled-form {
    margin: 0;
}

.show-disabled-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.08);
    color: #53627a;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.show-disabled-toggle input {
    width: auto;
    margin: 0;
}

.sidebar {
    display: flex;
    flex-direction: column;
}

.sidebar-nav {
    flex: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px 12px 22px;
    border-top: 1px solid rgba(15, 120, 200, 0.12);
}

.sidebar-footer .show-disabled-form {
    margin: 0 0 14px 0;
}

.sidebar-footer .show-disabled-toggle {
    width: 100%;
    justify-content: flex-start;
    box-sizing: border-box;
}

.sidebar-admin {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0;
    color: #172033;
    font-size: 14px;
    font-weight: 700;
}

.sidebar-admin .role {
    display: inline-flex;
    width: fit-content;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.10);
    color: #0786d8;
    font-size: 12px;
}

.sidebar-logout {
    display: block;
    padding: 11px 14px;
    border-radius: 10px;
    background: rgba(220, 38, 38, 0.08);
    color: #dc2626;
    font-weight: 800;
    text-decoration: none;
}

.sidebar-logout:hover {
    background: #dc2626;
    color: #ffffff;
}

.sidebar-admin {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 14px 0;
    color: #172033;
    font-size: 14px;
    font-weight: 800;
}

.sidebar-admin .role {
    display: inline-flex;
    width: auto;
    white-space: nowrap;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.10);
    color: #0786d8;
    font-size: 11px;
    font-weight: 800;
}

.sidebar-footer .show-disabled-form {
    margin: 0 0 12px 0;
}

.sidebar-logout {
    margin-top: 0;
}

.admin-main {
    min-height: 100vh;
}

.admin-content {
    padding-top: 54px;
}

.totp-setup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.totp-setup-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.secondary-button {
    background: #eef7ff;
    color: #0785d8;
    box-shadow: none;
}

.totp-secret-box {
    margin-top: 20px;
    padding: 16px 18px;
    background: #f4f9fd;
    border: 1px solid #d8e9f7;
    border-radius: 10px;
}

.totp-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    inset: 0;
    background: rgba(15, 30, 45, 0.55);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.totp-modal.visible {
    display: flex;
}

.totp-modal-content {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 18px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
}

.totp-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #607080;
    box-shadow: none;
    font-size: 28px;
    line-height: 36px;
    cursor: pointer;
}

.totp-modal-close:hover {
    background: #eef7ff;
    color: #0785d8;
}

.totp-qr-image {
    display: block;
    width: 100%;
    max-width: 300px;
    height: auto;
    margin: 24px auto 0;
    border-radius: 8px;
}

@media (max-width: 760px) {
    .totp-setup-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .totp-setup-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .totp-modal-content {
        padding: 26px 20px;
    }
}

    .admin-table-action select,
    .admin-password-action input {
        width: 100%;
        min-width: 0;
    }
}

.admin-table-action {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 240px;
    margin: 0;
}

.admin-table-action select,
.admin-table-action input {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.admin-table-action button {
    width: auto !important;
    min-width: 76px;
    height: 38px;
    margin: 0;
    padding: 8px 14px;
    white-space: nowrap;
}

.admin-password-action {
    min-width: 300px;
}

.totp-setup-actions button {
    width: auto !important;
    min-width: 130px;
    margin: 0;
    padding: 9px 16px;
    white-space: nowrap;
}

.totp-modal[hidden] {
    display: none !important;
}

.totp-modal.visible {
    display: flex !important;
}

@media (max-width: 1200px) {
    .admin-table-action {
        grid-template-columns: 1fr;
        min-width: 180px;
    }

    .admin-table-action button {
        justify-self: start;
    }
}

.role-admin,
.admin-role-badge.role-admin {
    color: #0789dc;
    background: #e7f5ff;
}

.role-superadmin,
.admin-role-badge.role-superadmin {
    color: #9a6a00;
    background: #fff2c7;
}

.admin-role-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.sidebar-admin .role.role-superadmin {
    color: #9a6a00;
    background: #fff2c7;
}

.sidebar-admin .role.role-admin {
    color: #0789dc;
    background: #e7f5ff;
}

.role-select-superadmin {
    color: #9a6a00;
    background: #fffaf0;
    border-color: #e4c35a;
    font-weight: 600;
}

.admin-role-fixed {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 8px;
    font-weight: 600;
}

.audit-details {
    white-space: normal;
    overflow-wrap: anywhere;
}

.audit-description {
    margin-top: 6px;
    color: #6b778c;
    font-size: 13px;
    line-height: 1.4;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(
        2,
        minmax(0, 1fr)
    );
    gap: 24px;
}

.settings-card {
    min-width: 0;
}

.settings-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.settings-card-header h2 {
    margin-top: 0;
    margin-bottom: 6px;
}

.settings-list {
    display: flex;
    flex-direction: column;
}

.settings-row {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    min-height: 48px;
    padding: 10px 0;
    border-bottom: 1px solid #edf2f6;
}

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

.settings-label {
    color: #6b778c;
    font-size: 13px;
    font-weight: 600;
}

.settings-value {
    min-width: 0;
    color: #26384a;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.settings-monospace {
    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        monospace;
    font-size: 13px;
}

.settings-error {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #fff0f0;
    color: #c0392b;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.status-online {
    color: #16803d;
    background: #e8f8ee;
}

.status-offline {
    color: #c0392b;
    background: #fff0f0;
}

@media (max-width: 1100px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .settings-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .settings-card-header {
        flex-direction: column;
    }
}

.settings-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-section-title {
    display: flex;
    justify-content: space-between;
    margin-bottom: 22px;
}

.settings-card-soft {
    padding: 22px;
    border: 1px solid #edf4fa;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
}

.settings-card-soft h3 {
    margin: 0;
}

.settings-grid-single {
    grid-template-columns: minmax(0, 1fr);
}

.sidebar-logout-form {
    margin: 0;
}

.sidebar-logout-form .sidebar-logout {
    width: 100%;
    border: 0;
    text-align: left;
    cursor: pointer;
}

.firewall-policy-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.firewall-policy-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.firewall-policy-header h3 {
    margin: 0 0 5px 0;
}

.firewall-policy-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.firewall-policy-block {
    padding: 20px;
    border: 1px solid #e6eff6;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.68);
}

.firewall-policy-block h4,
.firewall-rules h4 {
    margin-top: 0;
}

.firewall-member {
    padding: 13px 0;
    border-bottom: 1px solid #edf2f6;
}

.firewall-member:last-child {
    border-bottom: 0;
}

.firewall-member-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 9px;
}

.firewall-device-row,
.firewall-network-row {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(130px, auto)
        auto;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
}

.firewall-network-row {
    border-bottom: 1px solid #edf2f6;
}

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

.firewall-warning-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.firewall-warning {
    padding: 10px 13px;
    border: 1px solid #f2d89b;
    border-radius: 9px;
    background: #fff9e9;
    color: #87651c;
    font-size: 13px;
}

.firewall-rule-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 25px;
    min-height: 25px;
    margin-left: 7px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e7f5ff;
    color: #0789dc;
    font-size: 12px;
}

@media (max-width: 1050px) {
    .firewall-policy-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .firewall-device-row,
    .firewall-network-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .firewall-member-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

.user-access-modal {
    max-width: 820px;
    max-height: 88vh;
    overflow-y: auto;
}

.user-access-subtitle {
    margin-top: 4px;
    color: #6a788d;
    font-size: 14px;
}

.user-access-section {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #e6edf5;
}

.user-access-section h4 {
    margin: 0 0 14px;
    color: #172033;
    font-size: 15px;
}

.access-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.access-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.10);
    border: 1px solid rgba(14, 165, 233, 0.20);
    color: #0786d8;
    font-size: 13px;
    font-weight: 700;
}

.access-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.access-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 14px;
    background: #f7fafc;
    border: 1px solid #e4ebf3;
    border-radius: 10px;
}

.access-row strong {
    display: block;
    margin-bottom: 4px;
    color: #172033;
}

.access-source {
    color: #64748b;
    font-size: 13px;
    text-align: right;
}

.user-access-add {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.user-access-add select {
    flex: 1;
    margin: 0;
}

.user-access-add button {
    width: auto;
    margin: 0;
    white-space: nowrap;
}

.effective-access-section {
    margin-bottom: 4px;
}

.effective-access-section .access-row {
    background: rgba(14, 165, 233, 0.05);
    border-color: rgba(14, 165, 233, 0.18);
}

@media (max-width: 760px) {
    .access-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .access-source {
        text-align: left;
    }

    .user-access-add {
        align-items: stretch;
        flex-direction: column;
    }

    .user-access-add button {
        width: 100%;
    }
}

.settings-cleanup-form {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #edf2f6;
}

.settings-cleanup-form label {
    display: block;
    margin-bottom: 9px;
    color: #6b778c;
    font-size: 13px;
    font-weight: 700;
}

.settings-action-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-action-row select {
    flex: 1;
    margin: 0;
}

.settings-action-row button {
    width: auto;
    margin: 0;
    white-space: nowrap;
}

.settings-log-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 66px;
    padding: 13px 0;
    border-bottom: 1px solid #edf2f6;
}

.settings-log-item:last-child {
    border-bottom: 0;
}

.settings-log-meta {
    margin-top: 5px;
    color: #6b778c;
    font-size: 12px;
    line-height: 1.5;
}

.settings-log-item .inline-form {
    flex: 0 0 auto;
}

.settings-log-item button {
    margin: 0;
}

@media (max-width: 700px) {
    .settings-action-row {
        align-items: stretch;
        flex-direction: column;
    }

    .settings-action-row button {
        width: 100%;
    }

    .settings-log-item {
        align-items: flex-start;
        flex-direction: column;
    }
}

body.modal-open {
    overflow: hidden;
}

.site-confirm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(8, 18, 32, 0.62);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.18s ease,
        visibility 0.18s ease;
}

.site-confirm-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.site-confirm-dialog {
    width: min(100%, 500px);
    padding: 28px;
    background: #ffffff;
    border: 1px solid rgba(14, 165, 233, 0.18);
    border-radius: 18px;
    box-shadow:
        0 24px 70px rgba(8, 18, 32, 0.28);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.18s ease;
}

.site-confirm-backdrop.active .site-confirm-dialog {
    transform: translateY(0) scale(1);
}

.site-confirm-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin-bottom: 18px;
    border-radius: 14px;
    background: rgba(239, 68, 68, 0.11);
    color: #dc2626;
    font-size: 24px;
    font-weight: 800;
}

.site-confirm-content h3 {
    margin: 0 0 10px;
    color: #172033;
    font-size: 20px;
}

.site-confirm-content p {
    margin: 0;
    color: #5f6d80;
    line-height: 1.6;
}

.site-confirm-details {
    margin-top: 16px;
    padding: 13px 15px;
    border: 1px solid #e4ebf3;
    border-radius: 10px;
    background: #f7fafc;
    color: #526174;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-line;
}

.site-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.site-confirm-actions button {
    width: auto;
    min-width: 108px;
    margin: 0;
}

.secondary-button {
    background: #eef3f8;
    color: #354155;
    border: 1px solid #dce5ee;
}

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

button[disabled] {
    cursor: not-allowed;
    opacity: 0.55;
}

@media (max-width: 600px) {
    .site-confirm-dialog {
        padding: 22px;
    }

    .site-confirm-actions {
        flex-direction: column-reverse;
    }

    .site-confirm-actions button {
        width: 100%;
    }
}

.details-action-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.details-action-row form {
    margin: 0;
}

.details-action-row button {
    width: auto;
    margin: 0;
}

.infrastructure-protected {
    color: #9a6700;
    background: #fff2c7;
    border: 1px solid #f1d372;
}

.settings-card-soft .infrastructure-protected {
    font-weight: 700;
}

.policy-engine-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.policy-engine-summary {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.policy-engine-metric {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    padding: 16px;
    border: 1px solid #e7f0f7;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.7);
}

.policy-engine-label {
    color: #738094;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.policy-engine-hash {
    overflow-wrap: anywhere;
    font-family: monospace;
}

.policy-engine-checks {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.policy-engine-checks > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid #e7f0f7;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.58);
}

.policy-engine-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.policy-engine-actions form {
    margin: 0;
}

.policy-apply-disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.policy-engine-error {
    padding: 13px 15px;
    border: 1px solid #f2b8b5;
    border-radius: 10px;
    background: #fff0f0;
    color: #b42318;
    overflow-wrap: anywhere;
}

.policy-preview-details {
    border: 1px solid #e5eef5;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.64);
}

.policy-preview-details summary {
    padding: 15px 17px;
    cursor: pointer;
    font-weight: 700;
}

.policy-preview-details pre {
    max-height: 480px;
    margin: 0;
    padding: 18px;
    overflow: auto;
    border-top: 1px solid #e5eef5;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre;
}

@media (max-width: 1000px) {
    .policy-engine-summary,
    .policy-engine-checks {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .policy-engine-summary,
    .policy-engine-checks {
        grid-template-columns: 1fr;
    }

    .policy-engine-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .policy-engine-actions form,
    .policy-engine-actions button {
        width: 100%;
    }
}

.policy-engine-notice {
    padding: 13px 15px;
    border: 1px solid #f1d372;
    border-radius: 10px;
    background: #fff9df;
    color: #7a5b00;
    line-height: 1.5;
}

.platform-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 135px;
}

.table-secondary {
    color: #748094;
    font-size: 12px;
    line-height: 1.35;
}

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

.setup-card {
    max-width: 680px;
}

.setup-device-summary {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 20px 0;
    padding: 16px;
    border: 1px solid #dceaf5;
    border-radius: 12px;
    background: #f7fbff;
}

.mobile-setup-section,
.manual-platform-section {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid #e2eaf2;
}

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

.mobile-qr-card {
    padding: 14px;
    border: 1px solid #dce7f0;
    border-radius: 12px;
    background: #ffffff;
    text-align: center;
}

.mobile-qr-card summary {
    cursor: pointer;
    font-weight: 700;
}

.setup-qr {
    display: block;
    width: 100%;
    max-width: 260px;
    height: auto;
    margin: 16px auto;
}

.platform-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.platform-buttons form {
    margin: 0;
}

@media (max-width: 650px) {
    .mobile-qr-grid {
        grid-template-columns: 1fr;
    }

    .platform-buttons {
        flex-direction: column;
    }

    .platform-buttons form,
    .platform-buttons button {
        width: 100%;
    }
}

.history-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.history-result-count {
    color: #667085;
    font-size: 14px;
}

.history-page-size-form {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.history-page-size-form label {
    white-space: nowrap;
}

.history-page-size-form select {
    width: auto;
    min-width: 82px;
    padding: 9px 12px;
}

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

.pagination-pages {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.pagination-button,
.pagination-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid #dbe7f1;
    border-radius: 9px;
    background: #ffffff;
    color: #176da8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

.pagination-number {
    min-width: 38px;
    padding-left: 9px;
    padding-right: 9px;
}

.pagination-number.active {
    border-color: #168fe0;
    background: linear-gradient(
        135deg,
        #0ca6f2,
        #096fdc
    );
    color: #ffffff;
}

.pagination-button:hover,
.pagination-number:hover {
    border-color: #168fe0;
}

.pagination-button.disabled {
    pointer-events: none;
    opacity: 0.45;
}

.pagination-ellipsis {
    padding: 0 4px;
    color: #667085;
}

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

    .history-page-size-form {
        justify-content: space-between;
    }

    .history-pagination {
        flex-wrap: wrap;
    }
}

.desktop-setup-steps {
    margin-top: 22px;
}

.setup-steps {
    margin: 18px 0 24px 22px;
    padding: 0;
    color: #5d697c;
    line-height: 1.65;
}

.setup-steps li {
    margin-bottom: 9px;
}

.secondary-download {
    margin-top: 12px;
    background: linear-gradient(
        135deg,
        #536679,
        #34475b
    );
}

.copy-value-box {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 22px;
    padding: 14px;
    border: 1px solid #d8e7f2;
    border-radius: 12px;
    background: #f7fbff;
}

.copy-value-box code {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    color: #174c70;
    font-size: 14px;
    line-height: 1.5;
    user-select: all;
}

.copy-value-button {
    flex-shrink: 0;
}

.auth-key-box {
    border-color: #f0ce78;
    background: #fff9e6;
}

.setup-security-note {
    margin-top: 18px;
    padding: 13px 15px;
    border: 1px solid #dce7f0;
    border-radius: 10px;
    background: #f8fafc;
    color: #667085;
    font-size: 13px;
    line-height: 1.5;
}

.setup-back-link {
    display: block;
    margin-top: 26px;
    text-align: center;
    color: #176da8;
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 600px) {
    .copy-value-box {
        align-items: stretch;
        flex-direction: column;
    }

    .copy-value-button {
        width: 100%;
    }
}

/* Devices actions */

.device-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.device-actions .inline-form {
    display: inline-flex;
    margin: 0;
}

.device-actions .inline-form button {
    width: auto;
    min-height: 34px;
    margin: 0;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
}

.device-actions .inline-form button.danger {
    background: #d94b4b;
    box-shadow:
        0 8px 18px
        rgba(217, 75, 75, 0.20);
}
