:root {
    color-scheme: light;
    --ink: #17212b;
    --muted: #5f6f7d;
    --line: #d8e0e7;
    --surface: #ffffff;
    --wash: #f3f7f8;
    --brand: #0c6b62;
    --brand-dark: #084b46;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-bui-theme="light"] {
    --colorBrandBackground: #0c6b62;
    --colorBrandBackgroundHover: #095b54;
    --colorBrandBackgroundPressed: #084b46;
    --colorBrandBackgroundSelected: #084b46;
    --colorBrandForeground1: #0c6b62;
    --colorCompoundBrandBackground: #0c6b62;
    --colorCompoundBrandBackgroundHover: #095b54;
    --colorCompoundBrandBackgroundPressed: #084b46;
    --colorCompoundBrandForeground1: #0c6b62;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--wash);
    color: var(--ink);
}

a {
    color: var(--brand-dark);
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.topbar,
main,
footer {
    width: min(72rem, calc(100% - 2rem));
    margin-inline: auto;
}

.topbar {
    min-height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--ink);
    font-size: 1.3rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.phase,
.eyebrow {
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.account-nav a {
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

main {
    padding-block: clamp(3rem, 8vw, 7rem);
}

.hero {
    max-width: 52rem;
}

h1 {
    max-width: 18ch;
    margin: 0.3rem 0 1.25rem;
    font-size: clamp(2.6rem, 7vw, 5.4rem);
    line-height: 0.98;
    letter-spacing: -0.055em;
}

.lede {
    max-width: 50rem;
    color: var(--muted);
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    line-height: 1.65;
}

.principles {
    margin-top: clamp(4rem, 9vw, 8rem);
}

.principles h2 {
    font-size: 1rem;
}

.principle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    overflow: hidden;
    margin-top: 1rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: var(--line);
}

.principle-grid > .bui-card {
    min-height: 11rem;
    padding: 1.5rem;
    background: var(--surface);
}

.principle-grid h3 {
    margin-top: 0;
}

.principle-grid p,
footer {
    color: var(--muted);
    line-height: 1.55;
}

footer {
    display: flex;
    justify-content: space-between;
    padding-block: 1.5rem;
    border-top: 1px solid var(--line);
    font-size: 0.85rem;
}

@media (max-width: 44rem) {
    .phase {
        display: none;
    }

    .principle-grid {
        grid-template-columns: 1fr;
    }

    footer {
        gap: 1rem;
        flex-direction: column;
    }
}

.auth-shell {
    width: min(42rem, calc(100% - 2rem));
    margin-inline: auto;
    padding-block: clamp(2rem, 7vw, 6rem);
}

.auth-card {
    padding: clamp(1.5rem, 5vw, 3rem);
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: var(--surface);
    box-shadow: 0 1.5rem 4rem rgb(23 33 43 / 8%);
}

.auth-card h1 {
    max-width: 14ch;
    font-size: clamp(2rem, 6vw, 3.8rem);
}

.auth-card form {
    display: grid;
    gap: 0.65rem;
    margin-top: 2rem;
}

.auth-card label {
    margin-top: 0.7rem;
    font-weight: 700;
}

.auth-card input {
    width: 100%;
    min-height: 3rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid #a9b7c2;
    border-radius: 0.45rem;
    color: var(--ink);
    background: #fff;
    font: inherit;
}

.auth-card input:focus {
    outline: 3px solid rgb(12 107 98 / 22%);
    border-color: var(--brand);
}

.auth-card button {
    min-height: 3rem;
    margin-top: 1rem;
    padding-inline: 1rem;
    border: 0;
    border-radius: 0.45rem;
    color: #fff;
    background: var(--brand-dark);
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.error-message {
    margin-block: 1.25rem;
    padding: 0.9rem 1rem;
    border-left: 0.3rem solid #9d2626;
    background: #fff1f1;
}

.success-message {
    margin-block: 1.25rem;
    padding: 0.9rem 1rem;
    border-left: 0.3rem solid var(--brand);
    background: #edf9f6;
}

.credential {
    display: grid;
    gap: 0.35rem;
    padding: 1rem;
    border-radius: 0.5rem;
    background: var(--wash);
}

.credential dt {
    margin-top: 0.5rem;
    font-weight: 700;
}

.credential dd {
    margin: 0;
}

.break-all {
    overflow-wrap: anywhere;
}

.remote-session-viewer {
    display: grid;
    gap: 1rem;
    max-width: 100%;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: #111;
    color: #fff;
}

.remote-session-viewer video {
    width: 100%;
    max-height: 75vh;
    background: #000;
    object-fit: contain;
}


.remote-session-toolbar {
    display: flex;
    justify-content: flex-end;
}

.remote-session-fullscreen-button {
    min-height: 2.55rem;
    padding: 0.55rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.remote-session-fullscreen-button:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.48);
}

.remote-session-fullscreen-button:active {
    transform: translateY(1px);
}

.remote-session-viewer:fullscreen {
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
    padding: 0.75rem;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.remote-session-viewer:fullscreen video {
    width: 100%;
    height: 100%;
    max-height: none;
}

.remote-session-viewer p {
    margin: 0;
}

.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
}

.admin-header h1 {
    font-size: clamp(2.5rem, 6vw, 4.6rem);
}

.admin-panel {
    margin-top: 3rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: var(--surface);
}

.admin-panel h2 {
    margin: 0.2rem 0;
}

.panel-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 2rem;
}

.catalog-search {
    display: grid;
    grid-template-columns: minmax(12rem, 20rem) auto;
    gap: 0.45rem;
}

.catalog-search label {
    grid-column: 1 / -1;
    font-weight: 700;
}

.admin-panel input,
.admin-panel textarea,
.admin-panel select {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid #a9b7c2;
    border-radius: 0.45rem;
    color: var(--ink);
    background: #fff;
    font: inherit;
}

.admin-panel button {
    min-height: 2.7rem;
    padding-inline: 0.9rem;
    border: 0;
    border-radius: 0.4rem;
    color: #fff;
    background: var(--brand-dark);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.admin-panel button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.table-scroll {
    overflow-x: auto;
    margin-top: 1.5rem;
}

.device-table {
    width: 100%;
    border-collapse: collapse;
}

.device-table th,
.device-table td {
    padding: 0.9rem 0.75rem;
    border-top: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.device-table th {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.device-table small {
    display: block;
    margin-top: 0.25rem;
    color: var(--muted);
}

.request-panel {
    max-width: 48rem;
}

.request-panel label {
    display: block;
    margin: 1.25rem 0 0.5rem;
    font-weight: 700;
}
.request-panel .capability-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0.85rem 0;
}

.request-panel .capability-option input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    min-height: 0;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border-radius: 0.2rem;
}

.request-panel .capability-option span {
    min-width: 0;
}


.button-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.admin-panel .secondary-button {
    border: 1px solid var(--line);
    color: var(--ink);
    background: var(--surface);
}

.admin-panel .danger-button {
    background: #9f1d1d;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

@media (max-width: 44rem) {
    .admin-header,
    .panel-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .catalog-search {
        grid-template-columns: 1fr;
    }

    .catalog-search label {
        grid-column: auto;
    }
}
