/* Zenivo shell chrome: layout around the shared topbar, tab bar / rail and Menu sheet (markup generated by scripts/sync_nav.py).
 * Components themselves live in ds-components.css; this file only places them. */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.app-shell > .app-main { flex: 1; min-height: 0; height: auto; }
@media (max-width: 1023.98px) { .app-main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); } }
@media (min-width: 1024px) { .app-main { padding-left: var(--rail-w); } }
/* Full-width strips that live outside .app-main (focus banner under the topbar, page footer) follow the sidebar width too;
 * the footer also clears the chat FAB (bottom-right on desktop) and the phone tab bar. */
@media (min-width: 1024px) {
    .ds-topbar ~ .focus-banner { margin-left: calc(var(--rail-w) + var(--s-4)); }
    .app-shell ~ .footer { padding-left: calc(var(--rail-w) + 1.5rem); padding-right: 84px; }
}
@media (max-width: 1023.98px) { .app-shell ~ .footer { padding-bottom: calc(var(--tabbar-h) + 0.75rem + env(safe-area-inset-bottom, 0px)); padding-right: 84px; } }

/* brand */
.zt-brand { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; flex: 0 0 auto; }
.brand-mark { flex: 0 0 28px; display: block; }
.brand-mark .bm-ring, .brand-mark .bm-tick { stroke: var(--accent); }
.brand-mark .bm-inner { stroke: var(--text-primary); }
.brand-mark .bm-star { fill: var(--text-primary); }
.zt-brand .brand-name { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
@media (max-width: 640px) { .zt-brand .brand-name { display: none; } }

/* topbar right cluster: status dot, clock (local main, UTC secondary), night button. One size per tier, text >= 12px, details in tooltips. */
.pulse-indicator { flex: 0 0 auto; }
.pulse-indicator.off { background-color: var(--text-muted); box-shadow: none; animation: none; }
.zt-meta, .ds-topbar__clock { display: none; }
.zt-cam { display: none; margin-left: var(--s-2); font-size: var(--fs-12); color: var(--c-text-2); white-space: nowrap; }
@media (min-width: 900px) { .zt-cam { display: inline; } }
.zt-cluster { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); flex: 0 0 auto; }
.zt-chip { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 32px; padding: 0 var(--s-3); border-radius: var(--r-pill, 999px); border: 1px solid var(--c-border); background: var(--c-surface); font-size: var(--fs-12); font-weight: 600; color: var(--c-text); white-space: nowrap; }
.zt-fps { font-weight: 500; color: var(--c-text-2); font-variant-numeric: tabular-nums; }
.zt-mdot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-accent); flex: 0 0 auto; }
.zt-mode { letter-spacing: .04em; }
.zt-mode.is-manual { color: var(--c-warn); border-color: transparent; background: var(--c-warn-bg); }
.zt-mode.is-manual .zt-mdot { background: var(--c-warn); }
.zt-div { width: 1px; height: 24px; background: var(--c-divider); flex: 0 0 auto; }
.zt-clock { display: inline-flex; align-items: baseline; gap: var(--s-2); white-space: nowrap; }
.zt-cl { font-size: var(--fs-12); color: var(--c-text-2); }
.zt-clock b { font: 600 var(--fs-16) / 1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--c-text); }
.zt-rv { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; min-width: 44px; justify-content: center; padding: 0 var(--s-2); border: 0; background: none; color: var(--c-text-2); font: 500 var(--fs-12) / 1 var(--font-ui); cursor: pointer; border-radius: var(--r-md); }
.zt-rv .ds-icon { flex: 0 0 auto; }
.zt-rv-l, .zt-rv-track { display: none; }
.zt-rv-track { width: 34px; height: 20px; border-radius: 999px; background: var(--c-surface-2); border: 1px solid var(--c-border); position: relative; flex: 0 0 auto; }
.zt-rv-knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--c-text-2); transition: transform .15s; }
.zt-rv[aria-checked="true"] { color: var(--c-danger, var(--danger)); }
.zt-rv[aria-checked="true"] .zt-rv-track { background: var(--c-danger-bg); border-color: var(--c-danger, var(--danger)); }
.zt-rv[aria-checked="true"] .zt-rv-knob { transform: translateX(14px); background: var(--c-danger, var(--danger)); }
@media (min-width: 900px) { .zt-rv .ds-icon { display: none; } .zt-rv-l, .zt-rv-track { display: inline-block; } }
@media (max-width: 1100px) { .zt-fps, .zt-clock--utc, .zt-clock--utc + .zt-div { display: none; } }
@media (max-width: 899.98px) { .zt-mode, .zt-clock--utc, .zt-clock--utc + .zt-div, .zt-fps, .zt-cluster .zt-div { display: none; } .zt-cluster { gap: var(--s-2); } .zt-cl { display: none; } }

/* Navigation: ONE list (markup from scripts/sync_nav.py). >=1024px it is the fixed sidebar below the topbar (expanded icon+label, or the
 * collapsed icon rail, html.zs-collapsed); below that the same element is the Menu sheet opened from the tab bar. */
/* --rail-w is a typed property so ONE transition drives the sidebar width, the main padding and the toasts in sync */
@property --rail-w { syntax: "<length>"; inherits: true; initial-value: 232px; }
:root { --rail-w: 232px; --zs-ease: cubic-bezier(.2, .8, .2, 1); --zs-dur: 240ms; }
html.zs-collapsed { --rail-w: 64px; }
@media (min-width: 1024px) { :root { transition: --rail-w var(--zs-dur) var(--zs-ease); } }
.zs__panel { display: flex; flex-direction: column; background: var(--c-surface-1); color: var(--c-text); }
.zs__head { display: flex; align-items: center; gap: var(--s-3); min-height: var(--tap); padding: var(--s-2) var(--s-3) var(--s-2) var(--s-4); }
.zs__nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--s-2); }
.zs__group { display: grid; grid-template-columns: 1fr 1fr; gap: 2px var(--s-2); padding: var(--s-2) 0; }
.zs__group + .zs__group { border-top: 1px solid var(--c-divider); }
.zs__title { grid-column: 1 / -1; margin: var(--s-2) 0 var(--s-1) var(--s-3); font: 600 var(--fs-12) / 1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--c-text-3); }
.zs__item { position: relative; display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: var(--tap); padding: 0 var(--s-3); border: 0; border-radius: var(--r-md); background: none; color: var(--c-text-2); font: 500 var(--fs-14) / 1.2 var(--font-ui); text-align: left; text-decoration: none; cursor: pointer; }
.zs__item:hover { background: var(--c-surface-2); color: var(--c-text); }
.zs__item:focus-visible, .zs__toggle:focus-visible { outline: 2px solid var(--c-focus); outline-offset: -2px; }
.zs__item[aria-current="page"] { background: var(--c-accent-bg); color: var(--c-accent); }
.zs__item[aria-current="page"] .ds-icon { stroke-width: 2.4; }
.zs__item .ds-icon { flex: 0 0 auto; }
.zs__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zt-badge { margin-left: auto; padding: 2px 6px; border-radius: var(--r-pill); background: var(--c-danger, var(--danger)); color: var(--c-on-accent, var(--c-bg)); font-size: var(--fs-12); line-height: 1; }
.zt-badge[hidden] { display: none; }
.zs__foot { flex: 0 0 auto; padding: var(--s-2); border-top: 1px solid var(--c-divider); }
.zs__utils { display: flex; gap: 2px; }
.zs__utils .zs__item { flex: 1; justify-content: center; padding: 0; }
.zs__utils .zs__label { display: none; }
.zs__meta { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding-left: 0; }
.zs__ver { display: flex; align-items: center; gap: var(--s-2); min-width: 0; min-height: 32px; padding: 0 var(--s-3); border-radius: var(--r-md); font-size: var(--fs-12); color: var(--c-text-3); text-decoration: none; }
.zs__ver:hover { background: var(--c-surface-2); color: var(--c-text); }
.zs__ver:focus-visible { outline: 2px solid var(--c-focus); outline-offset: -2px; }
.zs__ver > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zs__ver .ds-icon { flex: 0 0 auto; width: 14px; height: 14px; }
.zs__top, .zs__edge { display: none; }
.zs__toggle { display: none; flex: 0 0 auto; width: var(--tap); height: var(--tap); align-items: center; justify-content: center; border: 0; border-radius: var(--r-md); background: none; color: var(--c-text-2); cursor: pointer; }
.zs__toggle:hover { background: var(--c-surface-2); color: var(--c-text); }
.zs__toggle .ds-icon { transition: transform var(--dur) var(--ease); }

/* phone / tablet: bottom sheet (centred dialog from 768px) */
@media (max-width: 1023.98px) {
    .zs__panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: min(86dvh, calc(100dvh - var(--s-6))); padding-bottom: env(safe-area-inset-bottom, 0px); border: 1px solid var(--c-border); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-2); animation: ds-sheet-up var(--dur) var(--ease); }
    .zs__utils { padding-bottom: var(--s-1); }
}
@media (min-width: 768px) and (max-width: 1023.98px) {
    .zs__panel { left: 50%; right: auto; bottom: auto; top: 50%; width: min(520px, calc(100vw - 48px)); transform: translate(-50%, -50%); border-radius: var(--r-xl); animation: ds-sheet-fade var(--dur) var(--ease); }
}

/* desktop: fixed sidebar under the topbar */
@media (min-width: 1024px) {
    .zs { display: block; inset: var(--topbar-h) auto 0 0; width: var(--rail-w); z-index: var(--z-nav); }
    .zs .ds-sheet__scrim, .zs__head { display: none; }
    .zs__panel { height: 100%; border-right: 1px solid var(--c-border); }
    .zs__group { grid-template-columns: 1fr; gap: 2px; }
    .zs__toggle { display: inline-flex; }
    .zs__top { display: flex; flex: 0 0 auto; align-items: center; padding: var(--s-1) var(--s-2); border-bottom: 1px solid var(--c-divider); }
    .zs__toggle { width: 44px; height: 44px; }
    .zs__edge { display: flex; position: absolute; top: 50%; right: -12px; width: 24px; height: 48px; margin-top: -24px; align-items: center; justify-content: center; border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface-2); color: var(--c-text-2); cursor: pointer; opacity: 0; transition: opacity var(--dur) var(--ease); z-index: 1; }
    .zs__edge::before { content: ""; position: absolute; top: -40vh; bottom: -40vh; left: -6px; width: 14px; }
    .zs:hover .zs__edge, .zs__edge:hover { opacity: 1; }
    .zs__edge .ds-icon { width: 16px; height: 16px; }
    html.zs-collapsed .zs__edge .ds-icon { transform: rotate(180deg); }
    .zs__utils .zs__item { min-width: 0; }
    /* collapsed icon rail: labels live in aria-label + title, sections become hairlines */
    /* collapsed rail: labels fade + slide (delayed on expand, immediate on collapse) instead of popping; icons keep one fixed x */
    .zs__panel { overflow: hidden; }
    .zs__item { padding: 0 var(--s-3) 0 14px; overflow: hidden; white-space: nowrap; }
    .zs__label, .zs__title, .zs__ver > span, .zs__ver .ds-icon:last-child { white-space: nowrap; transition: opacity 150ms var(--zs-ease) 90ms, transform 150ms var(--zs-ease) 90ms, visibility 0s 0s; }
    .zs__title { overflow: hidden; max-height: 20px; transition: opacity 150ms var(--zs-ease) 90ms, max-height var(--zs-dur) var(--zs-ease), margin var(--zs-dur) var(--zs-ease); }
    html.zs-collapsed .zs__label, html.zs-collapsed .zs__ver > span, html.zs-collapsed .zs__ver .ds-icon:last-child { opacity: 0; visibility: hidden; transform: translateX(-8px); transition: opacity 90ms linear, transform 90ms linear, visibility 0s 90ms; }
    html.zs-collapsed .zs__title { opacity: 0; max-height: 0; margin-top: 0; margin-bottom: 0; transition: opacity 90ms linear, max-height var(--zs-dur) var(--zs-ease), margin var(--zs-dur) var(--zs-ease); }
    .zs__utils .zs__item { padding: 0; }
    .zs__ver { padding: 0 var(--s-3) 0 17px; }
    .zs__edge .ds-icon, .zs__toggle .ds-icon { transition: transform var(--zs-dur) var(--zs-ease); }
    html.zs-collapsed .zs__toggle .ds-icon { transform: scaleX(-1); }
    html.zs-collapsed .zs__nav { padding: 0 var(--s-2); scrollbar-width: none; }
    html.zs-collapsed .zs__utils { flex-direction: column; }
    html.zs-collapsed .zt-badge { position: absolute; top: 4px; right: 4px; margin: 0; padding: 2px 4px; }
}

/* station chat button sits above the tab bar on phones, clear of the topbar on desktop */
.zcw-launch { z-index: var(--z-fab); }
@media (max-width: 1023.98px) { .zcw-launch { bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom, 0px)); } }
html.embed .ds-topbar, html.embed .ds-tabbar, html.embed .ds-sheet, html.embed .zs, html.embed .zcw-launch { display: none !important; }
html.embed .app-main { padding: 0; }
html.embed { --rail-w: 0px; }

/* Desktop: location already shows in the brand; the dot alone is the status. Phones: brand hidden, name shows. */
@media (min-width: 641px) { .ds-topbar__title .zt-name { display: none; } .ds-topbar__title { flex: 1; } }
/* Phones: chat launcher lives in the Menu sheet, not over the cards. */
@media (max-width: 640px) { .zcw-launch { display: none; } }

/* screen-reader-only text must work on every page that has the topbar (ds-base is scoped) */
.ds-topbar .ds-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* group heading inside the settings sheet */
.zt-gtitle { margin: 14px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }

/* admin-only nav items (pages that do not load pages.css) */
:root:not(.is-admin) .zs [data-admin] { display: none !important; }

/* desktop: 40px rows; short windows (<=860px tall) drop section headers (dividers remain) and tighten rows,
   the list scrolls while utilities, account and version stay pinned in the footer */
@media (min-width: 1024px) {
    .zs__item { min-height: 40px; }
    .zs__group { padding: var(--s-1) 0; }
    .zs__foot { padding: var(--s-1) var(--s-2); }
}
@media (min-width: 1024px) and (max-height: 860px) {
    .zs__title { display: none; }
    .zs__item { min-height: 36px; }
    html.zs-collapsed .zs__utils { flex-direction: row; flex-wrap: wrap; }
    html.zs-collapsed .zs__utils .zs__item { flex: 1 0 100%; }
}

.zs-tip { position: fixed; z-index: calc(var(--z-nav) + 5); padding: 4px 10px; border-radius: var(--r-md); background: var(--c-surface-2); color: var(--c-text); border: 1px solid var(--c-border); font: 500 var(--fs-12, 12px) / 1.3 var(--font-ui); white-space: nowrap; pointer-events: none; box-shadow: 0 4px 14px rgb(0 0 0 / .35); }
.zs-tip[hidden] { display: none; }


@media (prefers-reduced-motion: reduce) {
    :root { transition: none !important; }
    .zs__label, .zs__title, .zs__ver > span, .zs__ver .ds-icon, .zs__toggle .ds-icon, .zs__edge .ds-icon { transition: none !important; }
}

/* full-width pages: more gutter on desktop instead of a capped column */
@media (min-width: 1024px) {
    .lg, .oh, .cm { padding: var(--s-5) var(--s-6); }
}
