:root {
    color-scheme: dark;
    --bg: #101113;
    --surface: #18191d;
    --surface-2: #202127;
    --border: #30323a;
    --text: #f3f4f6;
    --muted: #a4a8b3;
    --green: #24c36b;
    --orange: #f0a22e;
    --red: #ef5f5f;
    --blue: #4fa3ff;
    --violet: #9b8cff;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
}

* {
    box-sizing: border-box;
}

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

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

button,
input {
    font: inherit;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 240px;
    padding: 24px;
    background: #141519;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 800;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--green), var(--blue));
    color: #06100b;
    font-weight: 900;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar nav a,
.logout-link {
    padding: 11px 12px;
    border-radius: 8px;
    color: var(--muted);
}

.sidebar nav a.active,
.sidebar nav a:hover,
.logout-link:hover {
    background: var(--surface-2);
    color: var(--text);
}

.logout-link {
    margin-top: auto;
}

.app-shell {
    margin-left: 240px;
    padding: 32px;
}

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

.page-head h1,
.login-card h1 {
    margin: 0;
    font-size: clamp(30px, 5vw, 52px);
    letter-spacing: 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    font-weight: 750;
}

.button:hover {
    border-color: rgba(255, 255, 255, 0.28);
}

.button-primary {
    background: var(--green);
    color: #07130c;
    border-color: transparent;
}

.button-secondary {
    background: #23252b;
}

.button-small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 14px;
}

.button-large {
    min-height: 58px;
    font-size: 17px;
}

.button-full {
    width: 100%;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card,
.panel,
.login-card,
.empty-state,
.notice,
.risk-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.stat-card {
    padding: 18px;
}

.stat-card strong {
    display: block;
    margin-top: 10px;
    font-size: 30px;
}

.stat-wide {
    grid-column: span 2;
}

.stat-label,
.subtle {
    color: var(--muted);
}

.panel {
    padding: 22px;
    margin-bottom: 22px;
}

.panel h2,
.panel h3 {
    margin: 0 0 10px;
}

.panel p {
    margin: 0;
}

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

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 850px;
}

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

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

.path-cell {
    max-width: 360px;
    white-space: normal;
    overflow-wrap: anywhere;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.badge-ok {
    background: rgba(36, 195, 107, 0.15);
    color: #63e99b;
}

.badge-warning {
    background: rgba(240, 162, 46, 0.16);
    color: #ffc266;
}

.badge-error {
    background: rgba(239, 95, 95, 0.15);
    color: #ff8c8c;
}

.badge-info {
    background: rgba(79, 163, 255, 0.15);
    color: #8ec5ff;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.notice {
    padding: 14px 16px;
    margin-bottom: 18px;
}

.notice ul {
    margin: 10px 0 0;
}

.notice-success {
    border-color: rgba(36, 195, 107, 0.5);
}

.notice-warning {
    border-color: rgba(240, 162, 46, 0.55);
}

.notice-error {
    border-color: rgba(239, 95, 95, 0.55);
}

.empty-state {
    padding: 28px;
    text-align: center;
}

.empty-state p {
    color: var(--muted);
}

.split-grid,
.grid-3 {
    display: grid;
    gap: 22px;
}

.split-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
}

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

.detail-list {
    display: grid;
    gap: 12px;
    margin: 0;
}

.detail-list div {
    display: grid;
    gap: 4px;
}

.detail-list dt {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.file-list,
.risk-list {
    margin: 0;
    padding-left: 20px;
}

.file-list li,
.risk-list li {
    margin: 8px 0;
}

.metric {
    font-size: 34px;
    font-weight: 850;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(100%, 430px);
    padding: 30px;
}

.login-copy {
    color: var(--muted);
    line-height: 1.55;
}

.form-stack {
    display: grid;
    gap: 16px;
}

.form-stack label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
}

.form-stack input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #111216;
    color: var(--text);
    padding: 10px 12px;
}

.map-shell {
    position: relative;
    min-height: 660px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        var(--surface);
    background-size: 36px 36px;
    overflow: hidden;
    padding: 34px;
    margin-bottom: 22px;
}

.map-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.map-link {
    stroke: rgba(255, 255, 255, 0.38);
    stroke-width: 2;
}

.map-link-webhook,
.map-link-discord-webhook {
    stroke: var(--orange);
    stroke-dasharray: 7 7;
}

.map-link-ssl {
    stroke: var(--green);
}

.map-tier {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 80px;
}

.map-tier-n1 {
    margin-bottom: 0;
}

.map-node {
    width: 230px;
    min-height: 104px;
    display: grid;
    gap: 6px;
    align-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(24, 25, 29, 0.94);
    padding: 15px;
    box-shadow: var(--shadow);
}

.map-node strong {
    overflow-wrap: anywhere;
}

.map-node small {
    color: var(--muted);
}

.node-level {
    width: max-content;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}

.node-ok {
    border-color: rgba(36, 195, 107, 0.6);
}

.node-warning {
    border-color: rgba(240, 162, 46, 0.62);
}

.node-error {
    border-color: rgba(239, 95, 95, 0.65);
}

.node-info {
    border-color: rgba(79, 163, 255, 0.58);
}

.site-node:hover {
    transform: translateY(-2px);
}

.risk-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 14px;
}

.risk-card {
    padding: 18px;
}

.risk-card h3 {
    margin: 8px 0;
}

.risk-card p {
    margin-bottom: 14px;
    color: var(--muted);
}

.risk-warning {
    border-color: rgba(240, 162, 46, 0.55);
}

.risk-error {
    border-color: rgba(239, 95, 95, 0.55);
}

.risk-level {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: auto;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }

    .sidebar nav {
        display: flex;
    }

    .logout-link {
        margin-top: 0;
        margin-left: auto;
    }

    .app-shell {
        margin-left: 0;
        padding: 20px;
    }

    .page-head,
    .panel-head {
        display: grid;
    }

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

    .stat-wide {
        grid-column: auto;
    }

    .map-shell {
        padding: 20px;
    }

    .map-node {
        width: min(100%, 260px);
    }
}

@media (max-width: 560px) {
    .sidebar {
        padding: 14px;
        display: grid;
    }

    .sidebar nav {
        flex-wrap: wrap;
    }

    .actions {
        width: 100%;
    }

    .actions .button {
        flex: 1 1 170px;
    }
}
