:root {
    color-scheme: dark;
    --bg: #090a0d;
    --surface: #101318;
    --panel: #151a21;
    --panel-2: #1c232d;
    --border: #2a3340;
    --text: #f4f7fb;
    --muted: #aab5c2;
    --subtle: #6f7c8b;
    --accent: #2dd4bf;
    --accent-strong: #14b8a6;
    --accent-soft: rgba(45, 212, 191, .12);
    --amber: #f59e0b;
    --green: #34d399;
    --green-soft: rgba(52, 211, 153, .12);
    --red: #fb7185;
    --red-soft: rgba(251, 113, 133, .13);
    --blue: #60a5fa;
    --font-ui: Inter, "Segoe UI", Arial, sans-serif;
    --font-mono: "Cascadia Mono", Consolas, monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    letter-spacing: 0;
}

body {
    overflow: hidden;
}

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

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

input,
textarea {
    width: 100%;
    min-height: 38px;
    padding: 9px 11px;
    color: var(--text);
    background: #0d1015;
    border: 1px solid var(--border);
    border-radius: 6px;
}

textarea {
    resize: vertical;
}

code {
    font-family: var(--font-mono);
    color: #c7d2fe;
    font-size: 12px;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 26px;
    line-height: 34px;
}

h2 {
    font-size: 16px;
    line-height: 24px;
}

.app-shell {
    display: grid;
    grid-template-columns: 256px minmax(0, 1fr);
    min-height: 100vh;
    background: var(--bg);
}

.side-nav {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 24px 12px;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.brand-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 12px 32px;
}

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

.brand-mark {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: var(--accent);
}

.brand-mark.large {
    width: 38px;
    height: 38px;
}

.brand-name {
    font-size: 20px;
    font-weight: 800;
}

.brand-version,
.muted-text {
    color: var(--muted);
}

.side-links {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
}

.side-link,
.logout-button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 7px;
    text-align: left;
}

.side-link.active {
    color: #dffdf8;
    background: rgba(20, 184, 166, .20);
    font-weight: 700;
}

.side-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.app-main {
    display: flex;
    min-width: 0;
    max-height: 100vh;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 24px;
    background: #0c0f14;
    border-bottom: 1px solid var(--border);
}

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

.avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    color: #021313;
    background: var(--accent);
    border-radius: 999px;
    font-weight: 800;
}

.canvas {
    min-width: 0;
    height: 100%;
    overflow: auto;
    padding: 24px;
}

.page-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.page-header,
.panel-header,
.button-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

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

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.metric-card,
.panel,
.empty-panel,
.login-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.metric-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 92px;
    padding: 16px;
}

.metric-card strong {
    font-size: 28px;
    line-height: 34px;
}

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

.panel {
    padding: 16px;
}

.empty-panel {
    padding: 24px;
    color: var(--muted);
}

.table-wrap {
    overflow: auto;
}

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

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

.data-table th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.strong {
    font-weight: 750;
}

.split-view {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.list-stack,
.edit-form,
.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.create-form .form-grid:first-of-type {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.application-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px;
    color: var(--text);
    background: #0f141b;
    border: 1px solid var(--border);
    border-radius: 7px;
    text-align: left;
}

.application-row.selected {
    border-color: rgba(45, 212, 191, .55);
    background: var(--accent-soft);
}

.row-main {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.detail-panel {
    min-height: 420px;
}

.edit-form label,
.login-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.validation-message,
.validation-errors {
    color: var(--red);
}

.validation-message {
    font-size: 12px;
    font-weight: 700;
}

.validation-errors {
    margin: 0;
    padding-left: 18px;
}

.checkbox-row {
    flex-direction: row !important;
    align-items: center;
}

.checkbox-row input {
    width: 18px;
    min-height: 18px;
}

.primary-button,
.secondary-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 9px 14px;
    border-radius: 6px;
    font-weight: 700;
}

.primary-button {
    color: #031514;
    background: var(--accent);
    border: 0;
}

.secondary-button {
    color: var(--text);
    background: transparent;
    border: 1px solid var(--border);
}

.danger-button {
    color: var(--red);
    background: var(--red-soft);
    border: 1px solid rgba(251, 113, 133, .34);
}

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

.status-pill.success {
    color: var(--green);
    background: var(--green-soft);
}

.status-pill.danger {
    color: var(--red);
    background: var(--red-soft);
}

.status-pill.neutral {
    color: var(--muted);
    background: var(--panel-2);
}

.property-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.property-grid div,
.secret-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: #0f141b;
    border: 1px solid var(--border);
    border-radius: 7px;
}

.property-grid span {
    color: var(--muted);
    font-size: 12px;
}

.secret-box {
    margin-top: 14px;
}

.secret-box code {
    overflow-wrap: anywhere;
}

.alert {
    padding: 12px;
    border-radius: 7px;
    font-weight: 700;
}

.alert.success {
    color: var(--green);
    background: var(--green-soft);
}

.alert.danger {
    color: var(--red);
    background: var(--red-soft);
}

.confirmation-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top left, rgba(45, 212, 191, .14), transparent 34%), var(--bg);
}

.login-panel {
    width: min(440px, 100%);
    padding: 24px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#blazor-error-ui {
    display: none;
}

@media (max-width: 900px) {
    body {
        overflow: auto;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .side-nav {
        min-height: auto;
    }

    .app-main {
        max-height: none;
    }

    .metric-grid,
    .split-view,
    .property-grid,
    .form-grid,
    .create-form .form-grid:first-of-type {
        grid-template-columns: 1fr;
    }
}
