:root {
    color-scheme: light;
    font-family: Inter, "Segoe UI", sans-serif;
    color: #14242a;
    background: #edf3f2;
}

* {
    box-sizing: border-box;
}

html,
body,
main {
    min-height: 100%;
    margin: 0;
}

body {
    min-height: 100vh;
}

.admin-shell {
    display: grid;
    grid-template-columns: minmax(320px, 1.05fr) minmax(420px, .95fr);
    min-height: 100vh;
}

.brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(3rem, 7vw, 8rem);
    color: #f7fffd;
    background:
        radial-gradient(circle at 100% 20%, rgba(114, 230, 206, .22), transparent 34%),
        linear-gradient(140deg, #082f35, #0a625d);
}

.brand-mark {
    display: grid;
    width: 58px;
    height: 58px;
    margin-bottom: .75rem;
    place-items: center;
    border-radius: 17px;
    color: #073c43;
    background: #82e1cf;
    font-size: 1.65rem;
    font-weight: 900;
}

.eyebrow {
    margin: 0;
    letter-spacing: .13em;
    font-size: .78rem;
    font-weight: 800;
}

.eyebrow.accent {
    color: #087f72;
}

h1 {
    max-width: 680px;
    margin: 2rem 0 1rem;
    font-size: clamp(3rem, 7vw, 6.2rem);
    line-height: .98;
    letter-spacing: -.055em;
}

.brand-copy {
    max-width: 620px;
    font-size: 1.12rem;
    line-height: 1.7;
    color: #cce9e4;
}

.boundary-list {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
    margin: 2rem 0 0;
    padding: 0;
    list-style: none;
}

.boundary-list li {
    padding: .65rem .9rem;
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 999px;
    font-size: .84rem;
}

.login-panel,
.message-shell {
    display: grid;
    place-items: center;
    padding: clamp(1.5rem, 5vw, 5rem);
}

.message-shell {
    min-height: 100vh;
}

.login-card {
    width: min(100%, 560px);
    padding: clamp(2rem, 4vw, 3.3rem);
    border: 1px solid #d6e2df;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 52, 55, .12);
}

.login-card h2,
.message-shell h1 {
    margin: .7rem 0 .5rem;
    color: #15363b;
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -.035em;
}

.message-shell h1 {
    max-width: none;
    line-height: 1.1;
}

.intro,
.support-copy {
    color: #5b6c70;
    line-height: 1.6;
}

.notice {
    margin: 1.6rem 0;
    padding: 1rem 1.1rem;
    border-left: 4px solid #e2a62a;
    border-radius: 8px;
    color: #654c12;
    background: #fff7df;
    line-height: 1.55;
}

.notice-ready {
    border-left-color: #087f72;
    color: #175d56;
    background: #e9f7f4;
}

.field-group {
    display: grid;
    gap: .55rem;
}

label {
    margin-top: .45rem;
    color: #354c51;
    font-size: .9rem;
    font-weight: 650;
}

input,
button {
    width: 100%;
    min-height: 48px;
    border-radius: 9px;
    font: inherit;
}

input {
    border: 1px solid #cbd8d6;
    padding: .7rem .8rem;
    background: #f4f7f6;
}

input:not(:disabled):focus {
    outline: 3px solid rgba(8, 127, 114, .16);
    border-color: #087f72;
    background: #fff;
}

button {
    margin-top: .9rem;
    border: 0;
    color: #eef5f3;
    background: #7d908d;
    font-weight: 800;
}

button:not(:disabled),
.primary-link {
    cursor: pointer;
    color: #fff;
    background: #087f72;
}

button:not(:disabled):hover,
.primary-link:hover {
    background: #06675e;
}

input:disabled,
button:disabled {
    cursor: not-allowed;
    opacity: .72;
}

.support-copy {
    margin: 1.4rem 0 0;
    font-size: .82rem;
}

.validation-summary,
.field-validation {
    color: #a52a2a;
    font-size: .82rem;
}

.validation-summary:empty,
.field-validation:empty {
    display: none;
}

.validation-summary ul {
    margin: 0;
    padding-left: 1.1rem;
}

.success-message {
    padding: .8rem 1rem;
    border-radius: 8px;
    color: #175d56;
    background: #e9f7f4;
}

.setup-card,
.dashboard-card {
    width: min(100%, 720px);
}

.setup-secret {
    display: grid;
    gap: .5rem;
    margin: 1.5rem 0;
    padding: 1rem;
    border: 1px solid #cbd8d6;
    border-radius: 10px;
    background: #f4f7f6;
}

.setup-secret span {
    color: #5b6c70;
    font-size: .82rem;
    font-weight: 700;
}

.setup-qr {
    display: grid;
    justify-items: center;
    gap: .85rem;
    margin: 1.5rem 0;
    padding: 1.25rem;
    border: 1px solid #cbd8d6;
    border-radius: 10px;
    color: #5b6c70;
    text-align: center;
    background: #f4f7f6;
    font-size: .9rem;
    font-weight: 700;
}

.setup-qr img {
    display: block;
    width: min(100%, 256px);
    height: auto;
    padding: .75rem;
    border: 1px solid #d6e2df;
    border-radius: 8px;
    background: #fff;
}

.setup-secret code,
.otp-uri,
.recovery-codes code {
    overflow-wrap: anywhere;
    font-size: .92rem;
}

details {
    margin: 1rem 0;
    color: #5b6c70;
}

summary {
    cursor: pointer;
    font-weight: 700;
}

.otp-uri {
    display: block;
    margin-top: .65rem;
    padding: .8rem;
    border-radius: 8px;
    background: #f4f7f6;
}

.setup-form {
    margin-top: 1.5rem;
}

.setup-rotation {
    display: grid;
    gap: .2rem;
    margin-top: 1.2rem;
}

.setup-rotation button {
    margin-top: 0;
}

.setup-rotation p {
    margin: .35rem 0 0;
    color: #5b6c70;
    font-size: .82rem;
    line-height: 1.45;
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
    margin: 1.5rem 0;
    padding: 0;
    list-style: none;
}

.recovery-codes li {
    padding: .75rem;
    border: 1px solid #cbd8d6;
    border-radius: 8px;
    text-align: center;
    background: #f4f7f6;
}

.primary-link {
    display: block;
    margin-top: 1.25rem;
    padding: .85rem 1rem;
    border-radius: 9px;
    text-align: center;
    text-decoration: none;
    font-weight: 800;
}

.secondary-button {
    color: #0b5f58;
    border: 1px solid #87bdb6;
    background: #fff;
}

.secondary-button:hover {
    color: #fff;
}

.back-link {
    display: inline-block;
    margin-top: 1rem;
    color: #087f72;
    font-weight: 750;
}

.tenant-connections-card {
    width: min(100%, 860px);
}

.tenant-inventory-card {
    width: min(100%, 1240px);
}

.inventory-filters {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(150px, 1fr)) auto auto;
    align-items: end;
    gap: .8rem;
    margin: 1.5rem 0 1rem;
}

.inventory-filters label {
    display: grid;
    gap: .45rem;
    margin: 0;
}

.inventory-filters select {
    min-height: 48px;
    border: 1px solid #cbd8d6;
    border-radius: 9px;
    padding: .7rem .8rem;
    color: #14242a;
    background: #f4f7f6;
    font: inherit;
}

.inventory-filters button {
    width: auto;
    margin: 0;
    padding: .7rem 1rem;
}

.filter-reset {
    padding: .75rem .2rem;
    color: #087f72;
    font-size: .84rem;
    font-weight: 750;
    text-align: center;
}

.inventory-count {
    margin: 1rem 0 .6rem;
    color: #5b6c70;
    font-size: .88rem;
}

.inventory-table-wrap {
    overflow-x: auto;
    border: 1px solid #d6e2df;
    border-radius: 10px;
}

.inventory-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    font-size: .88rem;
}

.inventory-table th,
.inventory-table td {
    padding: .85rem .9rem;
    border-bottom: 1px solid #e4ecea;
    text-align: left;
    vertical-align: middle;
}

.inventory-table th {
    color: #36555a;
    background: #f4f7f6;
    font-size: .78rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.inventory-table tbody tr:last-child td {
    border-bottom: 0;
}

.inventory-table code {
    overflow-wrap: anywhere;
    color: #31555a;
}

.status-badge {
    display: inline-block;
    padding: .3rem .5rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 750;
    white-space: nowrap;
}

.status-online {
    color: #175d56;
    background: #e2f5f0;
}

.status-offline {
    color: #8f2c2c;
    background: #fbe9e9;
}

.status-warning {
    color: #6b4e0d;
    background: #fff2cb;
}

.status-muted {
    color: #596b70;
    background: #edf1f0;
}

.section-title {
    margin: 2rem 0 .8rem;
    color: #15363b;
    font-size: 1.25rem;
}

.grant-list {
    display: grid;
    gap: .7rem;
}

.grant-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #d6e2df;
    border-radius: 10px;
    background: #f8fbfa;
}

.grant-row strong,
.grant-row span {
    display: block;
}

.grant-row span {
    margin-top: .3rem;
    color: #5b6c70;
    font-size: .85rem;
}

.grant-row form,
.grant-row button {
    width: auto;
    margin: 0;
}

@media (max-width: 880px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .brand-panel {
        min-height: 46vh;
        padding: 3rem 1.5rem;
    }

    h1 {
        margin-top: 1.2rem;
    }

    .inventory-filters {
        grid-template-columns: 1fr 1fr;
    }

    .inventory-filters label:first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 520px) {
    .recovery-codes {
        grid-template-columns: 1fr;
    }
}

.legacy-firewall-card {
    width: min(1440px, calc(100% - 48px));
    margin: 32px auto;
    padding: clamp(20px, 3vw, 40px);
    border: 1px solid #d6e2df;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 16px 48px #15363b0d;
}

.legacy-firewall-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: end;
    margin: 1.5rem 0;
    padding: 24px;
    background: #f4f8f7;
    border: 1px solid #d6e2df;
    border-radius: 12px;
}

.legacy-firewall-form select {
    width: 100%;
    min-height: 48px;
    padding: 0.7rem 0.8rem;
    border: 1px solid #aac5bd;
    border-radius: 8px;
    background: #fff;
    color: #153f4c;
    font: inherit;
}

.legacy-action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.legacy-action-buttons .primary-link,
.legacy-action-buttons .danger-button {
    margin: 0;
    border: 0;
    cursor: pointer;
    text-decoration: none;
}

.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.75rem 1.1rem;
    border-radius: 8px;
    background: #9a3030;
    color: #fff;
    font-weight: 700;
}

.danger-button:hover,
.danger-button:focus-visible {
    background: #772424;
}

.legacy-status-heading h2 {
    margin-bottom: 0.35rem;
}

.legacy-page-header, .legacy-pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.legacy-page-header h1 { max-width: none; margin: 16px 0; font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.15; letter-spacing: -.035em; }
.legacy-firewall-card .portal-copy, .legacy-firewall-card .portal-note { color: #48636c; line-height: 1.65; }
.legacy-firewall-card .portal-note { background: #eaf6f3; border-left: 3px solid #087f72; padding: 16px; border-radius: 8px; }
.legacy-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 24px 0 32px; }
.legacy-metrics > div { border: 1px solid #d6e2df; border-radius: 12px; padding: 18px; }
.legacy-metrics span { display: block; color: #48636c; font-size: .85rem; }
.legacy-metrics strong { display: block; margin-top: 8px; font-size: 1.8rem; color: #086e64; }
.legacy-firewall-form .form-field { min-width: 0; }
.legacy-firewall-form .checkbox-field input { width: 18px; min-height: 18px; height: 18px; margin: 0 8px 0 0; accent-color: #087f72; }
.legacy-firewall-form .checkbox-field label { display: flex; align-items: center; }
.legacy-firewall-form small { display: block; margin-top: 8px; color: #48636c; line-height: 1.5; }
.legacy-firewall-form .legacy-action-buttons, .legacy-firewall-form .validation-summary { grid-column: 1 / -1; }
.legacy-firewall-card .legacy-quiet-button { width: auto; min-height: 38px; padding: 8px 12px; background: #fff; color: #126c62; border: 1px solid #aac5bd; border-radius: 8px; cursor: pointer; font: inherit; font-size: .88rem; font-weight: 600; }
.legacy-firewall-card button:disabled { opacity: .45; cursor: default; }
.legacy-firewall-card :focus-visible { outline: 3px solid #319d91; outline-offset: 3px; }
.legacy-filters { display: grid; grid-template-columns: minmax(220px, 1fr) 180px 160px; gap: 16px; margin: 20px 0; }
.legacy-filters label { color: #48636c; font-size: .85rem; font-weight: 600; }
.legacy-filters input, .legacy-filters select { display: block; width: 100%; min-height: 44px; margin-top: 8px; border: 1px solid #aac5bd; border-radius: 8px; padding: 10px; background: #fff; color: #153f4c; font: inherit; }
.legacy-firewall-table { width: 100%; }
.legacy-firewall-table th { white-space: nowrap; background: #f2f7f5; }
.legacy-firewall-table td { vertical-align: top; overflow-wrap: anywhere; }
.legacy-firewall-table tbody tr:hover { background: #f7faf9; }
.legacy-firewall-table .status-muted { display: inline-block; padding: .25rem .55rem; border-radius: 999px; font-size: .85rem; font-weight: 700; }
.legacy-pagination { margin: 16px 0 32px; font-size: .9rem; color: #48636c; }
.legacy-firewall-card [hidden] { display: none !important; }
.legacy-firewall-card .portal-success, .legacy-firewall-card .portal-error, .legacy-firewall-card .portal-warning { padding: 16px; margin: 16px 0; border-radius: 8px; line-height: 1.5; }
.legacy-firewall-card .portal-success { background: #d8f2e9; color: #12664c; }
.legacy-firewall-card .portal-error, .legacy-firewall-card .portal-warning { background: #fae0e0; color: #8b2424; }
@media (max-width: 800px) {
    .legacy-metrics { grid-template-columns: repeat(2, 1fr); }
    .legacy-filters { grid-template-columns: 1fr; }
    .legacy-firewall-card { width: calc(100% - 24px); margin: 12px auto; }
    .legacy-firewall-form { padding: 16px; }
}

.legacy-status-heading p {
    margin-top: 0;
    color: #48636c;
}

.legacy-result-list,
.scope-list {
    margin: 0.6rem 0 0;
    padding-left: 1.2rem;
}

.scope-list {
    margin: 0;
    max-height: 14rem;
    overflow: auto;
}

.scope-list li + li,
.legacy-result-list li + li {
    margin-top: 0.3rem;
}

.status-online,
.status-offline {
    display: inline-block;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.status-online {
    background: #d8f2e9;
    color: #12664c;
}

.status-offline {
    background: #fae0e0;
    color: #8b2424;
}

@media (max-width: 800px) {
    .legacy-firewall-form {
        grid-template-columns: 1fr;
    }
}
