:root {
    color-scheme: dark;
    font-family: system-ui, sans-serif;
    background: #111613;
    color: #eef3ef;
    --line: #303c35;
    --surface: #1b231e;
    --muted: #aabbb0;
    --accent: #c9ec9e;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 78px;
    padding: 12px max(22px, calc((100% - 1320px) / 2));
    border-bottom: 1px solid var(--line);
    background: #171e19;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
}
.brand small { display: block; color: var(--muted); font-size: .85rem; font-weight: 400; }
.brand-icon, .camera-icon {
    display: inline-block;
    position: relative;
    width: 24px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid currentColor;
    border-radius: 4px;
    color: var(--accent);
}
.brand-icon::after, .camera-icon::after {
    position: absolute;
    top: 2px;
    right: -9px;
    width: 7px;
    height: 8px;
    border: 2px solid currentColor;
    border-left: 0;
    border-radius: 0 3px 3px 0;
    content: '';
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
.primary, .quiet {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
    font-weight: 650;
}
.primary { background: var(--accent); color: #15220f; border-color: transparent; }
.primary:hover { background: #daf8b7; }
.quiet { background: #222c25; color: inherit; }
.quiet:hover { background: #2b3e30; }
.login, .viewer, .cameras { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.login { max-width: 460px; margin: 10vh auto; padding: 28px; }
.login h1 { margin: 0 0 24px; font-size: 1.6rem; }
.login form, .login label { display: grid; gap: 8px; }
.login form { gap: 18px; }
.login input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #141b16; color: inherit; }
.error { color: #ffc4ba; }
.workspace {
    max-width: 1360px;
    margin: auto;
    padding: 28px 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    align-items: start;
    gap: 18px;
}
.viewer { min-width: 0; overflow: hidden; }
.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px;
}
.viewer-header h1 { margin: 0; font-size: clamp(1.25rem, 2vw, 1.7rem); }
.viewer-header p { margin: 6px 0 0; color: var(--muted); font-size: .9rem; }
video, .placeholder { width: 100%; aspect-ratio: 16 / 9; background: #0a0e0b; }
video { display: block; }
.placeholder { display: grid; place-items: center; }
.camera-icon { opacity: .45; transform: scale(2); }
.cameras { padding: 14px; }
.cameras h2 { display: flex; justify-content: space-between; margin: 2px 4px 12px; font-size: 1rem; }
.cameras h2 span { color: var(--muted); font-weight: 400; }
.camera {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    margin: 2px 0;
    color: #dce7de;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
}
.camera:hover { background: #28352c; }
.camera[aria-pressed="true"] { background: #2b3e27; border-color: #496344; color: #d5efb9; }
@media (max-width: 760px) {
    .workspace { grid-template-columns: 1fr; padding: 16px; }
    .login { margin: 7vh 16px; }
    .cameras { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 8px; }
    .cameras h2 { grid-column: 1 / -1; }
}
