:root {
    --ink: #102033;
    --navy: #071929;
    --navy-2: #0d263b;
    --line: #dbe4ee;
    --muted: #64748b;
    --panel: #ffffff;
    --page: #f5f7fb;
    --purple: #7c4dff;
    --blue: #1298e8;
    --green: #38c768;
    --red: #d83b57;
    --warning: #b7791f;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--page);
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    margin-top: 7px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 11px 12px;
    background: #fff;
    color: var(--ink);
}

textarea {
    resize: vertical;
    min-height: 150px;
}

label {
    display: block;
    font-weight: 700;
    color: #233247;
}

.field-help {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

fieldset {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

legend {
    padding: 0 8px;
    font-weight: 800;
}

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

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

code {
    color: #1c4270;
    background: #eef4fb;
    padding: 2px 5px;
    border-radius: 5px;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    background: var(--navy);
    color: #eaf2fb;
    padding: 26px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
}

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

.brand {
    margin-bottom: 28px;
}

.brand strong,
.guest-brand strong {
    display: block;
    font-size: 22px;
    letter-spacing: 0;
}

.brand small,
.guest-brand small {
    display: block;
    margin-top: 4px;
    color: #9fb4c9;
    font-size: 11px;
    text-transform: uppercase;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border: 2px solid rgba(255, 255, 255, .82);
    border-right-color: transparent;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 900;
    color: #fff;
    position: relative;
    flex: 0 0 46px;
}

.brand-mark span,
.brand-mark::before,
.brand-mark::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    right: 0;
}

.brand-mark span {
    bottom: 4px;
    background: var(--purple);
}

.brand-mark::before {
    bottom: 17px;
    background: var(--blue);
}

.brand-mark::after {
    bottom: 30px;
    background: var(--green);
}

.nav {
    display: grid;
    gap: 7px;
}

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

.nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #c7d4e2;
}

.nav a.active,
.nav a:hover {
    background: var(--navy-2);
    color: #fff;
}

.nav a.active {
    box-shadow: inset 4px 0 0 var(--purple);
}

.subnav {
    display: grid;
    gap: 3px;
    margin-left: 37px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, .15);
}

.subnav a {
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 14px;
    color: #aebed0;
}

.subnav a.active,
.subnav a:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
    box-shadow: none;
}

.nav-icon {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 7px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    background: rgba(255, 255, 255, .08);
    flex: 0 0 25px;
}

.main {
    padding: 28px;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.menu-toggle-input,
.menu-button,
.menu-backdrop {
    display: none;
}

.menu-button {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-direction: column;
    cursor: pointer;
    flex: 0 0 42px;
}

.menu-button span {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--ink);
}

.topbar h1,
.guest-card h1 {
    margin: 0;
    font-size: 28px;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 800;
}

.user-menu,
.actions,
.row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.row-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.grid {
    display: grid;
    gap: 18px;
}

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

.dashboard-grid {
    grid-template-columns: minmax(260px, 1fr) repeat(3, minmax(130px, 190px));
    margin-bottom: 18px;
}

.panel,
.guest-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    box-shadow: 0 12px 28px rgba(12, 27, 43, .07);
}

.hero-panel {
    background: var(--navy);
    color: #fff;
}

.hero-panel .muted {
    color: #c4d2e1;
}

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

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.stack {
    display: grid;
    gap: 18px;
}

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

.stat-panel {
    display: grid;
    align-content: center;
    gap: 5px;
}

.stat-number {
    display: block;
    font-size: 34px;
    font-weight: 900;
}

.stat-panel.warning .stat-number {
    color: var(--warning);
}

.stat-panel.error .stat-number {
    color: var(--red);
}

.button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 9px 13px;
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
}

.button.primary {
    background: var(--purple);
    color: #fff;
}

.button.ghost {
    background: #eef4fb;
    color: #1f3349;
}

.button.danger {
    background: #fff1f3;
    color: var(--red);
    border-color: #ffd4dc;
}

.alert {
    border-radius: 8px;
    padding: 13px 15px;
    margin-bottom: 16px;
    border: 1px solid;
}

.alert.success {
    background: #effbf3;
    border-color: #c5efd1;
    color: #176b36;
}

.alert.error {
    background: #fff1f3;
    border-color: #ffd4dc;
    color: #9d1730;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 900;
    background: #eef4fb;
    color: #285070;
}

.badge.ok {
    background: #e9f9ee;
    color: #176b36;
}

.badge.warning {
    background: #fff8e8;
    color: var(--warning);
}

.badge.error {
    background: #fff1f3;
    color: var(--red);
}

.muted-badge {
    background: #eef1f5;
    color: #697789;
}

.module-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.module-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfdff;
}

.module-list .nav-icon {
    background: var(--navy);
}

.status-lines {
    display: grid;
    gap: 12px;
}

.status-lines div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
}

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

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 600;
}

.check-row input {
    width: auto;
    margin-top: 3px;
}

.iframe-wrap {
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.empty-state {
    min-height: 260px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 14px;
    text-align: center;
}

.guest-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #eef3f8;
}

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

.guest-brand {
    margin-bottom: 24px;
}

.guest-brand .brand-mark {
    background: var(--navy);
}

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

    .sidebar {
        position: fixed;
        z-index: 20;
        inset: 0 auto 0 0;
        width: min(300px, 86vw);
        height: 100vh;
        overflow-y: auto;
        transform: translateX(-105%);
        transition: transform .18s ease;
        box-shadow: 20px 0 45px rgba(7, 25, 41, .22);
    }

    .menu-button {
        display: inline-flex;
    }

    .menu-backdrop {
        position: fixed;
        z-index: 15;
        inset: 0;
        background: rgba(7, 25, 41, .42);
    }

    .menu-toggle-input:checked ~ .sidebar {
        transform: translateX(0);
    }

    .menu-toggle-input:checked ~ .menu-backdrop {
        display: block;
    }

    .dashboard-grid,
    .grid.two {
        grid-template-columns: 1fr;
    }

    .topbar,
    .user-menu {
        align-items: flex-start;
    }

    .topbar {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: start;
    }

    .topbar .user-menu {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .main,
    .sidebar {
        padding: 18px;
    }

    .panel,
    .guest-card {
        padding: 17px;
    }

    .row-actions {
        justify-content: flex-start;
    }

    th,
    td {
        padding: 11px 9px;
    }
}
