:root {
    color-scheme: dark;
    --bg: #090a0c;
    --bg-raised: #0f1013;
    --panel: #18191d;
    --panel-raised: #1d1f24;
    --panel-hover: #22242a;
    --ink: #f4f5f7;
    --muted: #9a9da3;
    --muted-strong: #b9bcc1;
    --line: #303238;
    --line-soft: #24262b;
    --orange: #ff9d00;
    --orange-bright: #ffad24;
    --orange-dark: #d97900;
    --orange-wash: #ff9d0014;
    --green: #6fd6a3;
    --green-bg: #153329;
    --warn: #ffc261;
    --warn-bg: #382914;
    --danger: #ff8b82;
    --danger-bg: #3a1e1e;
    --shadow: 0 22px 60px #00000059;
    --font-ui: "Segoe UI", Arial, sans-serif;
    --font-heading: "Bahnschrift SemiCondensed", "Bahnschrift", "Arial Narrow", sans-serif;
    --font-technical: Consolas, "Courier New", monospace;
    font-family: var(--font-ui);
    color: var(--ink);
    background: var(--bg);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
}

.technical {
    font-family: var(--font-technical);
    font-variant-numeric: tabular-nums;
}

body::selection {
    background: #ff9d0047;
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    background:
        linear-gradient(#0a0a0af5, #0a0a0af5),
        url("../images/icon-access-circuit-background.svg") repeat,
        var(--bg);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 28px 20px 22px;
    border-right: 1px solid #ff9d001f;
    color: #fff;
    background:
        linear-gradient(#0a0a0af2, #0a0a0af2),
        url("../images/icon-access-circuit-background.svg") repeat,
        #0a0a0a;
}

.brand {
    display: block;
    padding: 2px 8px 26px;
    border-bottom: 1px solid var(--line-soft);
    color: #fff;
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: min(198px, 100%);
    height: auto;
}

.sidebar nav {
    display: grid;
    gap: 6px;
    padding-top: 24px;
}

.sidebar nav a {
    position: relative;
    padding: 12px 14px 12px 16px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #b7bac0;
    text-decoration: none;
    font-size: .91rem;
    font-weight: 600;
    letter-spacing: .01em;
    transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.brand,
.sidebar nav a {
    font-family: var(--font-heading);
}

.sidebar nav a::before {
    position: absolute;
    top: 50%;
    left: 0;
    width: 2px;
    height: 0;
    border-radius: 2px;
    background: var(--orange);
    content: "";
    transform: translateY(-50%);
    transition: height .15s ease;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    border-color: #ff9d0026;
    background: var(--orange-wash);
    color: #fff;
}

.sidebar nav a:hover::before,
.sidebar nav a.active::before {
    height: 22px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px 10px 0;
    border-top: 1px solid var(--line-soft);
    color: #8c8f95;
    font-size: .78rem;
    overflow-wrap: anywhere;
}

.sidebar-footer form {
    margin-top: 8px;
}

.main-content {
    min-width: 0;
    padding: 42px clamp(24px, 4vw, 68px) 64px;
}

.public-shell {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 56px 24px;
    overflow: hidden;
    background:
        #0a0a0a;
}

.public-shell::before {
    position: absolute;
    inset: 0;
    background: url("../images/icon-access-circuit-background.svg") repeat;
    background-size: 120px 120px;
    content: "";
    pointer-events: none;
}

.public-shell::after {
    content: none;
}

.login-card {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    padding: 38px 40px 40px;
    border: 1px solid #ff9d002c;
    border-radius: 12px;
    background: #18191deb;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.login-logo {
    display: block;
    width: min(265px, 82%);
    height: auto;
}

.login-card h1 {
    margin: 0 0 9px;
    font-size: 1.65rem;
    font-weight: 650;
    letter-spacing: -.025em;
}

.login-card .muted {
    margin: 0 0 26px;
}

.page-header {
    margin-bottom: 28px;
}

.page-header.split,
.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.page-header h1 {
    margin: 6px 0 7px;
    color: #fff;
    font-size: clamp(1.8rem, 3vw, 2.45rem);
    font-weight: 650;
    letter-spacing: -.04em;
}

.page-header p,
.panel-heading p {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    display: block;
    color: var(--orange);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.back-link {
    display: inline-block;
    margin-bottom: 17px;
    color: var(--muted);
    text-decoration: none;
    font-size: .87rem;
}

.back-link:hover {
    color: var(--orange-bright);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat {
    position: relative;
    overflow: hidden;
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: linear-gradient(145deg, var(--panel-raised), var(--panel));
    box-shadow: 0 12px 28px #00000020;
}

.stat::after {
    position: absolute;
    top: 0;
    right: 0;
    width: 52px;
    height: 2px;
    background: var(--orange);
    content: "";
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.stat strong {
    display: block;
    margin-top: 8px;
    color: #fff;
    font-size: 2rem;
    font-weight: 650;
    font-family: var(--font-technical);
    font-variant-numeric: tabular-nums;
}

.panel {
    margin-bottom: 22px;
    padding: 25px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: linear-gradient(145deg, var(--panel-raised), var(--panel));
    box-shadow: 0 12px 30px #0000001f;
}

.panel-heading {
    margin-bottom: 19px;
}

.panel-heading h2 {
    margin: 0 0 5px;
    color: #fff;
    font-size: 1.12rem;
    font-weight: 650;
}

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

.site-card {
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #121317;
    text-decoration: none;
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.site-card:hover {
    border-color: #ff9d0070;
    background: var(--panel-hover);
    transform: translateY(-2px);
}

.site-card h3 {
    margin: 14px 0 4px;
    color: #fff;
}

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

.site-card small {
    color: var(--muted);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

th {
    padding: 11px 12px;
    border-bottom: 1px solid #ff9d0030;
    color: var(--muted);
    text-align: left;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

td {
    padding: 15px 12px;
    border-bottom: 1px solid var(--line-soft);
    color: #d7d9dc;
    vertical-align: middle;
}

tbody tr {
    transition: background .12s ease;
}

tbody tr:hover {
    background: #ffffff05;
}

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

td strong {
    color: #fff;
}

.actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 13px;
    white-space: nowrap;
}

.actions a,
.link-button {
    color: var(--orange-bright);
    font: inherit;
    font-size: .83rem;
    font-weight: 650;
    text-decoration: none;
}

.actions a:hover,
.link-button:hover {
    color: #ffd08a;
}

.actions form {
    display: inline;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.link-button.danger {
    color: var(--danger);
}

.badge {
    display: inline-flex;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 750;
    white-space: nowrap;
}

.badge.good {
    border-color: #6fd6a32e;
    background: var(--green-bg);
    color: var(--green);
}

.badge.warn {
    border-color: #ffc2612b;
    background: var(--warn-bg);
    color: var(--warn);
}

.badge.neutral {
    border-color: #ffffff12;
    background: #292b31;
    color: #b7bac0;
}

.block {
    display: block;
    margin-top: 5px;
    color: var(--muted);
}

.empty {
    padding: 30px 12px;
    color: var(--muted);
    text-align: center;
}

.form-panel {
    max-width: 680px;
}

form > label:not(.check-row) {
    display: block;
    margin: 18px 0 7px;
    color: var(--muted-strong);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

input:not([type=checkbox]),
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #3a3c43;
    border-radius: 6px;
    background: #111216;
    color: var(--ink);
    font: inherit;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input::placeholder {
    color: #686b72;
}

input:hover,
select:hover {
    border-color: #4a4d55;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--orange);
    background: #15161a;
    box-shadow: 0 0 0 3px #ff9d001c;
}

input:disabled {
    border-color: #2c2e33;
    background: #202126;
    color: #7f8288;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 20px 0;
    color: var(--muted-strong);
    font-size: .9rem;
}

.check-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--orange);
}

.validation {
    display: block;
    margin-top: 6px;
    color: var(--danger);
    font-size: .8rem;
}

.validation:empty {
    display: none;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 27px;
}

.button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    font: inherit;
    font-size: .86rem;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition: color .15s ease, background .15s ease, border-color .15s ease, transform .15s ease;
}

.button.primary {
    border-color: var(--orange);
    background: var(--orange);
    color: #111;
}

.button.primary:hover {
    border-color: var(--orange-bright);
    background: var(--orange-bright);
    transform: translateY(-1px);
}

.button.secondary {
    border-color: #41434a;
    background: #202126;
    color: #e4e5e7;
}

.button.secondary:hover {
    border-color: #5b5e66;
    background: #292b31;
}

.button.full {
    width: 100%;
    margin-top: 8px;
}

.callout {
    margin-top: 18px;
    padding: 13px 15px;
    border-left: 3px solid #666a72;
    background: #111216;
    color: #aeb1b6;
    font-size: .86rem;
    line-height: 1.5;
}

.callout.important {
    margin: 0 0 22px;
    border: 1px solid #ff9d0038;
    border-left: 3px solid var(--orange);
    background: #ff9d000b;
    color: #d9c19b;
}

.alert {
    margin-bottom: 18px;
    padding: 12px 15px;
    border: 1px solid transparent;
    border-radius: 7px;
}

.alert.success {
    border-color: #6fd6a329;
    background: var(--green-bg);
    color: var(--green);
}

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

@media (max-width: 820px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 18px;
    }

    .brand {
        padding: 0 4px 17px;
    }

    .brand-logo {
        width: 170px;
    }

    .sidebar nav {
        grid-template-columns: repeat(2, 1fr);
        padding-top: 16px;
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        padding: 28px 18px 48px;
    }

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

    .page-header.split,
    .panel-heading {
        display: block;
    }

    .page-header.split .button,
    .panel-heading > .button {
        margin-top: 16px;
    }

    .actions {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 520px) {
    .public-shell {
        padding: 24px 16px;
    }

    .login-card {
        padding: 30px 24px 32px;
    }

    .sidebar nav {
        grid-template-columns: 1fr;
    }

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
