/* Responsive presentation blocks mechanically extracted from styles.css. */

@media (max-width: 1050px) {

    .camera-editor-layout { grid-template-columns: 1fr; }
    .camera-preview-panel { position: relative; top: auto; grid-template-columns: minmax(240px, 1fr) minmax(180px, .6fr); align-items: start; }
    .camera-preview-stage { grid-row: 1 / span 4; }
    .camera-preview-panel > .hint { margin: 0; }

}

@media (min-width: 901px) {

    body:not(.auth-page) .status-strip {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        justify-content: stretch;
        gap: 8px;
        width: 100%;
    }

    body:not(.auth-page) .status-group {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        align-items: stretch;
        gap: 6px;
        min-width: 0;
        padding: 8px 9px 9px;
        background:
            linear-gradient(145deg, oklch(29% .025 250 / .72), oklch(19% .018 250 / .84)),
            oklch(18% .015 250);
        border: 1px solid oklch(45% .035 250 / .55);
        border-left-color: oklch(67% .095 235 / .72);
        border-radius: 10px;
        box-shadow: inset 0 1px 0 oklch(100% 0 0 / .045), 0 7px 22px oklch(4% .012 250 / .2);
    }

    body:not(.auth-page) .status-group-label {
        color: oklch(76% .025 250);
        font-size: 10px;
        letter-spacing: .1em;
    }

    body:not(.auth-page) .status-group-items {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        justify-content: stretch;
        gap: 5px;
        min-width: 0;
    }

    body:not(.auth-page) .status-group[data-status-group="host"] .status-group-items {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body:not(.auth-page) .status-group[data-status-group="storage"] .status-group-items {
        grid-template-columns: minmax(0, 1fr);
    }

    body:not(.auth-page) .status-chip {
        display: grid;
        align-content: center;
        gap: 2px;
        min-width: 0;
        min-height: 39px;
        padding: 5px 7px;
        overflow: hidden;
        background: oklch(14% .014 250 / .72);
        border-color: oklch(42% .03 250 / .62);
        border-radius: 7px;
        font-size: 13px;
        line-height: 1.12;
        text-overflow: ellipsis;
    }

    body:not(.auth-page) .status-chip strong,
body:not(.auth-page) .status-chip > span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body:not(.auth-page) .status-chip strong {
        font-size: 9px;
        letter-spacing: .09em;
    }

}

@media (min-width: 1200px) {

    body:not(.auth-page) .status-strip {
        grid-template-columns: .9fr 1.65fr 1.15fr .9fr;
    }
    body:not(.auth-page) .status-group[data-status-group="delivery"] .status-group-items {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

}

@media (min-width: 901px) {

    .top nav a {
        min-height: 27px;
        padding: 3px 10px;
        color: #8f9daf;
        background: transparent;
        border: 1px solid transparent;
        border-radius: 6px;
        font-size: 10px;
        font-weight: 650;
        letter-spacing: .018em;
        transition:
            color 130ms ease-out,
            background-color 130ms ease-out,
            border-color 130ms ease-out,
            box-shadow 130ms ease-out,
            transform 85ms ease-out;
    }
    .top nav a::before { display: none; }
    .top nav a:hover,
.top nav a:focus-visible {
        color: #e8f5ff;
        background: linear-gradient(180deg, rgba(61, 95, 126, .34), rgba(24, 43, 61, .34));
        border-color: rgba(132, 196, 239, .26);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, .08),
            0 0 14px rgba(16, 167, 255, .09);
        outline: none;
    }
    .top nav a:active { transform: translateY(1px) scale(.985); }
    .top nav a[aria-current="page"] {
        color: #f7fcff;
        background:
            linear-gradient(145deg, rgba(16, 167, 255, .72), rgba(27, 99, 164, .62)),
            #105d98;
        border-color: rgba(143, 220, 255, .52);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, .22),
            inset 0 -1px 0 rgba(0, 23, 42, .42),
            0 4px 14px rgba(16, 167, 255, .22);
        text-shadow: 0 1px 2px rgba(0, 20, 38, .72);
    }

    .health-drawer > summary {
        gap: 7px;
        min-height: 24px;
        padding: 1px 2px;
    }
    .health-drawer > summary strong {
        font-size: 11px;
        letter-spacing: .09em;
    }
    .health-drawer-summary { font-size: 11px; }
    .health-drawer-panel { padding: 5px 0 3px; }

}

/*
 * Desktop presentation shell.
 *
 * This file is linked only for viewports at or above 901px. Keep desktop-only
 * chrome and content geometry here so it cannot participate in phone layout.
 */

html[data-ui-shell="desktop"] {
    --command-handle-height: 24px;
    --command-handle-width: 154px;
    --command-handle-font-size: 10px;
    --command-alert-size: 16px;
}

html[data-ui-shell="desktop"] body:not(.auth-page) > .top,
html[data-ui-shell="desktop"] body.live-page:is(.dense-grid, .has-expanded) > .top {
    --chrome-inline-pad: clamp(14px, 1.5vw, 22px);
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 3px 10px;
    padding: 6px var(--chrome-inline-pad) 7px;
}

html[data-ui-shell="desktop"] body:not(.auth-page) > .top .top-brand {
    grid-column: 1;
    grid-row: 1;
}

html[data-ui-shell="desktop"] body:not(.auth-page) > .top nav {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: start;
    width: max-content;
    max-width: 100%;
    gap: 2px;
    margin: 0;
    padding: 2px;
    overflow: visible;
    background: linear-gradient(180deg, rgba(28, 39, 53, .82), rgba(10, 17, 25, .74)), rgba(8, 14, 21, .72);
    border: 1px solid rgba(132, 172, 210, .18);
    border-radius: 8px;
}

html[data-ui-shell="desktop"] body:not(.auth-page) > .top .header-session-actions {
    grid-column: 3;
    grid-row: 1;
}

html[data-ui-shell="desktop"] body:not(.auth-page) > .top .top-right {
    grid-column: 1 / -1;
    grid-row: 2;
}

html[data-ui-shell="desktop"] body:not(.auth-page) > .top .global-action-progress {
    grid-row: 3;
}

/* Reading and operations pages clear the attached Controls tab. */
html[data-ui-shell="desktop"] body:is(.settings-page, .status-page) > main {
    padding-top: 20px;
}

html[data-ui-shell="desktop"] body.live-page:not(.toolbar-pinned) > .top,
html[data-ui-shell="desktop"] body.live-page:is(.dense-grid, .has-expanded):not(.toolbar-pinned) > .top,
html[data-ui-shell="desktop"] body.header-collapsed:not(.live-page) > .top {
    padding-bottom: 0;
}

/* Desktop fullscreen keeps listen volume beside mute and talkback. Phone owns
   a separate compact media surface and never inherits this slider geometry. */
html[data-ui-shell="desktop"] .tile.has-audio .desktop-audio-volume {
    display: grid;
    grid-template-columns: minmax(84px, 1fr) auto;
    align-items: center;
    gap: 3px 8px;
    min-width: 172px;
    padding: 5px 8px 6px;
    color: var(--muted);
    background: rgba(0, 0, 0, .54);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 9px;
    font: 800 9px/1 system-ui, sans-serif;
    letter-spacing: .08em;
}

html[data-ui-shell="desktop"] .desktop-audio-volume > span { grid-column: 1; }
html[data-ui-shell="desktop"] .desktop-audio-volume > output {
    grid-column: 2;
    grid-row: 1;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}
html[data-ui-shell="desktop"] .desktop-audio-volume > input {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 20px;
    margin: 0;
    accent-color: var(--live);
    cursor: pointer;
}

/* Camera controls share the right side of the caption with status/codec.
   The shelf opens above its launcher without covering either caption row. */
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .hud {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto auto;
    align-items:end;
    gap:4px 12px;
}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) :is(.hud-row,.hud-meta-row) {display:contents;}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .live-camera-name {grid-column:1;grid-row:1;}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .hud-state-cluster {grid-column:3;grid-row:1;}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .hud-meta {grid-column:1;grid-row:2;min-width:0;overflow-wrap:anywhere;}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .stream-choice {grid-column:3;grid-row:2;justify-self:end;}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-control-dock {
    position:relative;
    grid-column:2;
    grid-row:1 / span 2;
    top:auto;
    right: auto;
    bottom:auto;
    left:auto;
    width:auto;
    max-height: calc(100dvh - 28px - env(safe-area-inset-bottom));
    align-items:flex-end;
    flex-direction: column-reverse;
    gap: 4px;
    transform:none;
}

html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-control-launchers {
    gap: 4px;
    padding: 3px;
    background: rgba(6, 10, 15, .68);
    border: 1px solid rgba(202, 230, 255, .2);
    border-radius: 24px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, .48);
    backdrop-filter: blur(18px) saturate(1.2);
}

html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-control-launchers button {
    min-height: 36px;
    box-shadow: none;
}

html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-controls-toggle {
    display: inline-flex;
    min-width: 168px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 20px;
}

html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-controls-toggle svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-controls-chevron {
    font-size: 15px;
    transition: transform 160ms ease-out;
}

html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-controls-toggle.is-open
    .expanded-controls-chevron { transform: rotate(180deg); }

html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-control-panel {
    position:absolute;
    right:0;
    bottom:calc(100% + 8px);
    display: flex;
    align-items: center;
    width:max-content;
    max-width:min(1040px,calc(100vw - 36px));
    height: 52px;
    max-height: 52px;
    gap: 6px;
    padding: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    background:
        linear-gradient(145deg, rgba(27, 39, 54, .72), rgba(7, 12, 18, .78)),
        rgba(7, 9, 12, .76);
    border-color: rgba(202, 230, 255, .24);
    border-radius: 14px;
    box-shadow: 0 18px 52px rgba(0, 0, 0, .58);
    animation: desktop-fullscreen-shelf-in 160ms ease-out;
}

html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-control-panel[hidden] { display: none; }
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-control-section {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    min-height: 40px;
    padding: 0 0 0 6px;
    background: transparent;
    border: 0;
    border-left: 1px solid rgba(202, 230, 255, .18);
    border-radius: 0;
}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen)
    .expanded-control-panel .live-ptz:not(.is-ready),
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen)
    .expanded-control-panel .live-light:not(.is-ready) {
    display: none;
}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen)
    .expanded-control-section[data-control-section="media"] { flex-basis: auto; padding-left: 0; border-left: 0; }
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen)
    .expanded-control-section[data-control-section="view"] { flex-basis: auto; }
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen)
    .expanded-control-section[data-control-section="ptz"] { flex-basis: auto; }
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen)
    .expanded-control-section[data-control-section="lights"] { flex-basis: auto; }
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .live-ptz-panel,
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .ptz-direction-pad {
    display: flex;
    width: auto;
    flex-flow: row nowrap;
    align-items: center;
    gap: 5px;
    padding: 0;
}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .ptz-direction-pad > span {
    display: none;
}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen)
    .ptz-direction-pad [data-live-ptz-action="left"] { order: 1; }
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen)
    .ptz-direction-pad [data-live-ptz-action="up"] { order: 2; }
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .ptz-direction-pad .ptz-stop { order: 3; }
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen)
    .ptz-direction-pad [data-live-ptz-action="down"] { order: 4; }
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen)
    .ptz-direction-pad [data-live-ptz-action="right"] { order: 5; }
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .ptz-journey-status:empty {
    display: none;
}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-control-section > h3 {
    display: none;
}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-control-panel .expanded-media-actions {
    flex-flow: row nowrap;
    align-items: center;
}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .desktop-audio-volume {
    flex: 0 0 160px;
    min-height: 38px;
}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen)
    .expanded-control-panel :is(button, a.snap) {
    min-height: 38px;
    height: 38px;
}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .live-light-actions {
    flex-wrap: nowrap;
    align-content: flex-start;
    align-items: flex-start;
}
html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .live-light button {
    flex: 0 0 auto;
    min-height: 38px;
    height: 38px;
}

@keyframes desktop-fullscreen-shelf-in {
    from { opacity: 0; transform: translateY(10px) scale(.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {

    html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-control-panel { animation: none; }
    html[data-ui-shell="desktop"] .tile:is(.expanded, :fullscreen) .expanded-controls-chevron { transition: none; }

}

html[data-ui-shell="desktop"] .status-cam {
    grid-template-columns: auto clamp(210px, 24vw, 300px) minmax(0, 1fr);
    gap: 12px;
}

html[data-ui-shell="desktop"] .system-health-groups { grid-template-columns: 1.35fr 1fr 1fr; }

html[data-ui-shell="desktop"] .status-camera-still { width: 100%; }
html[data-ui-shell="desktop"] .status-camera-select { min-height: 118px; }

/* Recording capacity is the first, full-width System health section. */
@media (min-width: 901px) {
    html[data-ui-shell="desktop"] .system-health-group:first-child { grid-column: 1 / -1; }
    html[data-ui-shell="desktop"] .system-health-group:first-child dl { grid-template-columns: 1fr 1fr; gap: 12px 24px; }
    html[data-ui-shell="desktop"] .system-health-group:first-child dl > div:last-child { grid-column: 1 / -1; }
}

@media(min-width:901px) {.status-group-label, .status-chip, .top nav a {font-size:15px;line-height:1.45;}}

@media(min-width:901px) {.hint, .compact-message, .cam-meta, .collaboration-person span, .collaboration-event p, .collaboration-event small, .collaboration-panel > header span, .hover-tip, .context-menu-heading {font-size:15px;line-height:1.45;}}

@media(min-width:901px) {body {font-size:16px;} .compact-btn,.tool-btn,button,select,input,.inventory-heading h2 {font-size:16px;} .hint,.compact-message {font-size:15px;}}

/* Desktop menus keep labels readable; component sheets own page geometry. */
.ui-desktop :is(.account-summary,.account-action,.collaboration-count,.compact-btn,.tool-btn,.filter-chip) {font-size:16px;}
.ui-desktop .account-action {min-height:44px;}
