:root {
    --gh-bg: #0f1419;
    --gh-panel: #1a2332;
    --gh-border: #2d3a4d;
    --gh-text: #e7ecf3;
    --gh-muted: #8b9bb4;
    --gh-accent: #3d8bfd;
    --gh-danger: #ff5c5c;
}

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

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

.gh-sidebar {
    border-right: 1px solid var(--gh-border);
    padding: 1rem;
    background: #121922;
    min-width: 0;
    overflow-x: hidden;
}

.gh-brand {
    font-weight: 600;
    margin-bottom: 1rem;
}

.gh-main {
    padding: 1.5rem;
}

.gh-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.gh-nav-link {
    color: var(--gh-text);
    text-decoration: none;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
}

.gh-nav-link:hover {
    background: rgba(61, 139, 253, 0.12);
}

.gh-btn-link {
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.gh-panel {
    background: var(--gh-panel);
    border: 1px solid var(--gh-border);
    border-radius: 12px;
    padding: 1.25rem;
}

.gh-narrow {
    max-width: 520px;
    margin: 2rem auto;
}

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

.gh-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
}

.gh-input, .gh-textarea {
    background: #0f1419;
    border: 1px solid var(--gh-border);
    color: var(--gh-text);
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
}

.gh-button {
    background: var(--gh-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

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

.gh-button.gh-secondary {
    background: #2a3546;
    color: var(--gh-text);
}

.gh-button.gh-danger {
    background: var(--gh-danger);
}

.gh-link {
    color: var(--gh-accent);
}

.gh-page-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gh-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.85rem;
}

.gh-callout {
    border-left: 3px solid var(--gh-accent);
    background: #131b28;
    padding: 0.7rem 0.85rem;
    border-radius: 0 8px 8px 0;
}

.gh-source-list {
    margin: 0.25rem 0 0;
    padding-left: 1.1rem;
}

.gh-cell-input {
    min-width: 110px;
    width: 100%;
}

.gh-pinout-figure {
    border: 1px solid var(--gh-border);
    border-radius: 12px;
    background: #131b28;
    padding: 0.75rem;
}

.gh-pinout-image {
    margin-top: 0.5rem;
    width: 100%;
    max-width: 1100px;
    border-radius: 8px;
    border: 1px solid var(--gh-border);
    display: block;
}

.gh-pinout-image-clickable {
    cursor: zoom-in;
}

.gh-pinout-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.gh-pinout-loupe-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    z-index: 2;
    filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.45));
}

.gh-pinout-modal {
    width: min(1200px, calc(100vw - 2rem));
}

.gh-pinout-image-large {
    max-width: 100%;
    max-height: calc(100vh - 10rem);
    object-fit: contain;
}

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

.gh-sidebar .gh-ble-strip {
    margin-top: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.gh-ble-strip {
    background: var(--gh-panel);
    border: 1px solid var(--gh-border);
    border-radius: 12px;
    padding: 0.65rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.88rem;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.45rem 0.85rem;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.gh-ble-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gh-muted);
    font-weight: 600;
    width: 100%;
}

.gh-ble-line {
    width: 100%;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.35;
}

.gh-ble-hint {
    flex-basis: 100%;
    width: 100%;
    min-width: 0;
    font-size: 0.8rem;
}

.gh-ble-pill {
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--gh-border);
}

.gh-ble-ok {
    color: #7ee787;
    border-color: rgba(126, 231, 135, 0.35);
    background: rgba(52, 199, 89, 0.12);
}

.gh-ble-bad {
    color: #ffb4b4;
    border-color: rgba(255, 92, 92, 0.35);
    background: rgba(255, 92, 92, 0.1);
}

.gh-ble-warn {
    color: #f5a623;
    font-size: 0.8rem;
}

.gh-ble-error {
    color: #ffb4b4;
}

.gh-ble-conn-list {
    flex-basis: 100%;
    margin: 0.25rem 0 0;
    padding-left: 1.1rem;
    color: var(--gh-text);
    font-size: 0.82rem;
}

.gh-ble-conn-list code {
    font-size: 0.78rem;
}

.gh-error {
    color: #ffb4b4;
}

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

.gh-table-wrap {
    overflow: auto;
    border: 1px solid var(--gh-border);
    border-radius: 12px;
}

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

.gh-table th, .gh-table td {
    border-bottom: 1px solid var(--gh-border);
    padding: 0.65rem 0.75rem;
    text-align: left;
}

.gh-table th {
    color: var(--gh-muted);
    font-weight: 600;
    font-size: 0.85rem;
}

.gh-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
}

.gh-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(640px, calc(100vw - 2rem));
    background: var(--gh-panel);
    border: 1px solid var(--gh-border);
    border-radius: 12px;
    padding: 1rem;
    z-index: 1001;
}

.gh-timer {
    margin-top: 0.25rem;
}

.gh-qr-wrap {
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: #fff;
    border-radius: 8px;
    display: inline-flex;
}

.gh-qr-image {
    width: 220px;
    height: 220px;
    display: block;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1M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NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.gh-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.gh-tab {
    border: 1px solid var(--gh-border);
    background: transparent;
    color: var(--gh-muted);
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
}

.gh-tab-active {
    color: var(--gh-text);
    border-color: var(--gh-accent);
    background: rgba(61, 139, 253, 0.12);
}

.gh-btn-sm {
    padding: 0.3rem 0.55rem;
    font-size: 0.85rem;
}

.gh-actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.gh-field-inline {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.gh-modal-wide {
    max-width: 720px;
}

.gh-camera-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.gh-page-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Guard desk */
.gh-guard-desk {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gh-banner {
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.gh-banner-warn {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.45);
    color: #ffc107;
}

.gh-guard-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.gh-guard-main {
    min-width: 8rem;
    font-size: 1.05rem;
    padding: 0.65rem 1.25rem;
}

.gh-guard-video {
    display: grid;
    gap: 0.35rem;
    min-height: 120px;
    max-height: 42vh;
}

.gh-layout-1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.gh-layout-2 {
    grid-template-columns: 1fr 1fr;
}

.gh-layout-3 {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.gh-layout-3 .gh-guard-video-cell:first-child {
    grid-row: span 2;
}

.gh-layout-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.gh-guard-video-cell {
    position: relative;
    background: #0a0e14;
    border: 1px solid var(--gh-border);
    border-radius: 8px;
    overflow: hidden;
    min-height: 100px;
}

.gh-guard-video-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 100px;
    color: var(--gh-muted);
    font-size: 0.85rem;
    padding: 0.5rem;
    text-align: center;
}

.gh-player-wrap {
    position: relative;
    width: 100%;
    height: 100%;
}

.gh-video-player {
    width: 100%;
    height: 100%;
    max-height: 20vh;
    object-fit: contain;
    background: #000;
    display: block;
}

.gh-video-label {
    position: absolute;
    left: 0.35rem;
    bottom: 0.35rem;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.75rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.gh-idle-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gh-tab-flash {
    animation: gh-tab-pulse 1s ease-in-out infinite;
}

@keyframes gh-tab-pulse {
    50% { box-shadow: 0 0 0 2px var(--gh-accent); }
}