:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1f2937;
    background: #f3f4f6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

button,
input,
textarea {
    font: inherit;
}

button {
    border: 0;
    border-radius: 0.35rem;
    padding: 0.55rem 0.9rem;
    color: white;
    background: #2563eb;
    cursor: pointer;
}

button.secondary {
    color: #1f2937;
    background: #e5e7eb;
}

button.danger {
    background: #b91c1c;
}

.link-button {
    padding: 0;
    color: #2563eb;
    background: transparent;
    text-align: left;
}

.shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    z-index: 100;
    top: 0;
    bottom: 0;
    left: 0;
    width: 15rem;
    overflow-y: auto;
    padding: 1.5rem;
    color: white;
    background: #111827;
    transition: left 180ms ease;
}

.sidebar-toggle {
    position: fixed;
    z-index: 110;
    top: 20px;
    left: calc(15rem - 1.8rem);
    width: 1.8rem;
    height: 2.8rem;
    padding: 0;
    border-radius: 0.4rem 0 0 0.4rem;
    font-size: 1.6rem;
    line-height: 1;
    box-shadow: 0 0.2rem 0.5rem rgb(0 0 0 / 20%);
    transition: left 180ms ease;
}

.sidebar-collapsed .sidebar {
    left: -15rem;
}

.sidebar-collapsed .sidebar-toggle {
    left: 0;
    border-radius: 0 0.4rem 0.4rem 0;
}

.brand {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.sidebar nav {
    display: grid;
    gap: 0.4rem;
    margin-bottom: 2rem;
}

.sidebar a {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    padding: 0.55rem 0.7rem;
    color: #d1d5db;
    border-radius: 0.35rem;
    text-decoration: none;
}

.nav-icon {
    width: 1.80em;
    height: 1.80em;
    flex: 0 0 auto;
    fill: currentColor;
}

.sidebar a.active,
.sidebar a:hover {
    color: white;
    background: #374151;
}

.sidebar .link-button {
    color: #d1d5db;
}

.content {
    min-width: 0;
    margin-left: 15rem;
    padding: 20px 2rem 2rem;
    transition: margin-left 180ms ease;
}

.sidebar-collapsed .content {
    margin-left: 0;
}

.content h1:first-child,
.log-page > h1:first-child {
    margin-top: 0;
}

.page-heading {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.page-heading h1 {
    margin-top: 0;
}

.page-heading p {
    margin-bottom: 0;
}

.grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(18rem, 0.7fr) minmax(30rem, 1.5fr);
}

.panel,
.login-card {
    padding: 1.25rem;
    border: 1px solid #d1d5db;
    border-radius: 0.6rem;
    background: white;
}

.login-card {
    width: min(28rem, calc(100% - 2rem));
    margin: 8vh auto;
}

form {
    display: grid;
    gap: 0.65rem;
}

input,
textarea {
    width: 100%;
    padding: 0.55rem;
    border: 1px solid #9ca3af;
    border-radius: 0.35rem;
}

.checkbox {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.checkbox input {
    width: auto;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.modal-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    overflow-y: auto;
    padding: 20px;
    background: rgb(17 24 39 / 65%);
}

.task-dialog {
    width: min(36rem, 100%);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    padding: 1.25rem;
    border-radius: 0.6rem;
    background: white;
    box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 35%);
}

.dialog-heading {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.dialog-heading h2 {
    margin: 0;
}

.dialog-close {
    padding: 0.25rem 0.65rem;
    font-size: 1.5rem;
    line-height: 1;
}

.dialog-actions {
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    margin: 1rem 0;
    padding: 0.65rem 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 0.4rem;
    background: white;
}

.breadcrumb-path {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    min-width: 0;
}

.breadcrumb-link {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.breadcrumb-current {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 600;
}

.breadcrumb-separator {
    color: #6b7280;
}

.refresh-control {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin-left: auto;
    white-space: nowrap;
}

.refresh-control input {
    width: 5rem;
    padding: 0.35rem 0.45rem;
}

.alert {
    margin: 1rem 0;
    padding: 0.8rem 1rem;
    border-radius: 0.4rem;
}

.alert.warning {
    color: #78350f;
    background: #fef3c7;
}

.alert.error {
    color: #7f1d1d;
    background: #fee2e2;
}

.alert.success {
    color: #14532d;
    background: #dcfce7;
}

.metrics {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
}

.metrics div {
    min-width: 10rem;
    padding: 1rem;
    border-radius: 0.5rem;
    background: white;
}

.metrics strong,
.metrics span {
    display: block;
}

.metrics strong {
    font-size: 1.5rem;
}

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

th,
td {
    padding: 0.7rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    background: #eff6ff;
}

.runtime-warning td {
    background: #fef3c7;
}

.runtime-danger td {
    background: #fee2e2;
}

.detail-list {
    display: grid;
    gap: 0.85rem;
    margin: 0;
}

.detail-list > div {
    display: grid;
    gap: 0.3rem;
}

.detail-list dt {
    font-weight: 600;
}

.detail-list dd {
    min-height: 2.4rem;
    margin: 0;
    padding: 0.55rem;
    border: 1px solid #d1d5db;
    border-radius: 0.35rem;
    background: #f9fafb;
    white-space: pre-wrap;
    word-break: break-word;
}

.break-word {
    word-break: break-word;
}

.log-page {
    height: calc(100dvh - 40px);
}

.log-page-viewing {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.log-view {
    min-height: 0;
    flex: 1;
    overflow: auto;
    padding: 1rem;
    color: #e5e7eb;
    background: #111827;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    word-break: break-word;
}

.log-view:focus {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.log-line {
    min-height: 1.25rem;
    white-space: pre-wrap;
}

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

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

    .sidebar {
        position: static;
        left: auto;
        width: auto;
        height: auto;
        min-height: auto;
        overflow-y: visible;
    }

    .sidebar-collapsed .sidebar {
        left: auto;
    }

    .content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: none;
    }

    .breadcrumb {
        align-items: flex-start;
    }

    .refresh-control {
        width: 100%;
        margin-left: 0;
    }
}
