/* ── Design tokens ──────────────────────────────────────────────────────────
   Single source of truth for color / radius / layout. New and restyled
   components reference these; migration of legacy hardcoded values is
   incremental. Introduced 2026-06-16. */
:root {
    /* Brand palette — BMT brand colors (single source of truth).
       black #080808 · ink-black #090d14 · prussian-blue #162131
       brilliant-azure #0088f1 · lime-green #0bcf25 */
    --brand-black: #080808;
    --brand-ink-black: #090d14;
    --brand-prussian-blue: #162131;
    --brand-azure: #0088f1;
    --brand-lime: #0bcf25;

    /* Brand — one blue (retires the old #3c89ff second-blue). */
    --accent: var(--brand-azure);
    --accent-hover: #1a97ff;
    --accent-soft: rgba(0, 136, 241, 0.12);
    --accent-border: rgba(0, 136, 241, 0.35);

    /* Canvas + elevation ladder */
    --bg: var(--brand-black);
    --ink-black: var(--brand-ink-black);
    --prussian-blue: var(--brand-prussian-blue);
    --surface-1: rgba(255, 255, 255, 0.035);
    --surface-2: rgba(255, 255, 255, 0.06);
    --surface-3: rgba(255, 255, 255, 0.09);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);

    /* Text ramp — all chosen to clear WCAG AA on --bg */
    --text: #f2f2f2;
    --text-secondary: #c4c4c4;
    --text-muted: #9aa0a6;
    --text-faint: #767c83;

    /* Semantic — success uses the brand lime green */
    --success: var(--brand-lime);
    --success-soft: rgba(11, 207, 37, 0.12);
    --success-border: rgba(11, 207, 37, 0.30);
    --danger: #ff6b6b;
    --danger-soft: rgba(255, 107, 107, 0.14);
    --danger-border: rgba(255, 107, 107, 0.40);
    --warning: #d6b25a;
    --warning-soft: rgba(214, 178, 90, 0.12);
    --warning-border: rgba(214, 178, 90, 0.28);

    /* Radius + layout */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --content-max: 1180px;
}

/* Shared storage-usage module (usage.js) — Manage-account modal + Recordings header.
   One compact block: eyebrow + used/limit figure · slim bar with inline % · folded caption. */
.usage-mod { max-width: 360px; }
.usage-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}
.usage-eyebrow {
    font-size: 0.66rem;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 700;
}
.usage-figure {
    font-size: 0.9rem;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.usage-figure b { font-weight: 700; }
.usage-figure-limit { color: var(--text-muted); }

.usage-barwrap { display: flex; align-items: center; gap: 10px; }
.usage-bar {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}
.usage-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}
.usage-bar-fill--ok { background: var(--success); }
.usage-bar-fill--warn { background: var(--warning); }
.usage-bar-fill--urgent { background: var(--danger); }
.usage-pct {
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 34px;
    text-align: right;
}
.usage-pct--ok { color: var(--text-secondary); }
.usage-pct--warn { color: var(--warning); }
.usage-pct--urgent { color: var(--danger); }

/* Folded caption: tag · extra · upgrade, wrapping gracefully on narrow widths. */
.usage-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    font-size: 0.76rem;
    color: var(--text-muted);
}
.usage-tag { font-weight: 700; }
.usage-tag--warn { color: var(--warning); }
.usage-tag--urgent { color: var(--danger); }
.usage-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-faint); flex: none; }
/* Upgrade affordance — quiet dashed link by default; intense filled button at ≥80%. */
.usage-upgrade {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px dashed var(--border-strong);
    white-space: nowrap;
}
.usage-upgrade:hover,
.usage-upgrade:focus-visible { color: var(--text-secondary); }
.usage-upgrade--go {
    margin-left: auto; /* push the button to the right edge of the caption row */
    color: #fff;
    background: var(--accent);
    padding: 7px 15px;
    border-radius: var(--r-sm);
    font-weight: 700;
    border: none;
    box-shadow: 0 4px 14px rgba(0, 136, 241, 0.35);
}
.usage-upgrade--go:hover,
.usage-upgrade--go:focus-visible { background: var(--accent-hover); color: #fff; }

.cloud-usage { margin-top: 14px; }
/* Mobile: the header has no side buttons (pull-to-refresh + mobile actions take over), so the
   module spans the column and the caption's urgent button drops to its own full row. */
@media (max-width: 768px) {
    .cloud-usage .usage-mod { max-width: none; }
    .cloud-usage .usage-upgrade--go { margin-left: 0; width: 100%; text-align: center; }
}

* {
    font-family: "Montserrat";
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
div,
button,
ul,
li,
img {
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    padding: 0;
    margin: 0;
    overflow: hidden;
    background-color: #090D14;
    color: #d9d9d9;
    font-size: 16px;
}

button {
    cursor: pointer;
    border: none;
    background-color: red;
    color: #d9d9d9;
}

label,
span {
    color: #d9d9d9;
}

input[type="range"] {
    cursor: pointer;
    background-color: #090D14;
    /* Allow the range to flex and yield space to the label when needed */
    flex: 1 1 140px;
    height: 6px;
    background: #090D14;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 20px;
    background: #d9d9d9;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #333333;
}

input[type="range"]::-moz-range-thumb {
    width: 10px;
    height: 20px;
    background: #d9d9d9;
    border-radius: 5px;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #333333;
}

.hidden {
    display: none !important;
}

.separator-10 {
    height: 10px;
    width: 100%;
}

.app-header {
    position: fixed;
    margin: 0;
    padding: 0;
    width: 100%;
    top: 0;
    background-color: #090D14;
    display: flex;
    align-items: center;
    height: 50px;
}

.header-content {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: 20%;
    padding-left: 20px;
    padding-right: 20px;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.logo {
    width: 40px;
    height: 40px;
}

.title {
    color: #d9d9d9;
    font-size: 1.5rem;
    font-weight: 400;
    display: flex;
    align-items: center;
}

.main-content {
    display: flex;
    width: 100%;
    margin-top: 0;
    padding-top: 0;
    height: 100%;
    overflow: hidden;
}

.left-bar {
    display: flex;
    width: 18vw;
    min-width: 340px; /* floor so the rail (90px) + workspace (device cards) stay usable when the viewport shrinks (zoom) */
    height: 100%;
    left: 0;
    padding-top: 50px;
    border-top-right-radius: 7px;
    overflow: hidden;
}

.left-tools {
    /* Fixed width (not vw) so labels like "Recordings" never clip at 125% zoom, where
       the viewport — and any vw unit — shrinks while the font stays put. */
    width: 90px;
    flex-shrink: 0;
    left: 0;
    display: flex;
    justify-content: flex-start;
    padding-top: 20px;
    flex-direction: column;
    background-color: #080808;
}

.left-ws {
    flex: 1;
    min-width: 0; /* shrink to the rail's allotted width so long device names ellipsize
                     instead of expanding the workspace past .left-bar (card clipped on the right) */
    right: inherit;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 10px 10px 20px;
    background-color: #080808;
    /* border: solid 1px #333333; */
}

.left-ws-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Hide scrollbar for the parent and EVERY nested element within it */
.left-ws-body,
.left-ws-body * {
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.left-ws-body::-webkit-scrollbar,
.left-ws-body *::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.patients-list {
    color: #333333;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    gap: 20px;
    margin-top: 10px;
}

.patient-item {
    position: relative;
    width: 100%;
    /* Set a fixed height or min-height, and prevent shrinking */
    min-height: 80px;
    flex-shrink: 0;
    border-radius: 15px;
    overflow: hidden;
}

.patient-item img {
    transition: filter 0.2s, opacity 0.2s;
}

.patient-item:hover {
    background-color: #232323;
}

.patient-item:hover img {
    filter: brightness(1.5);
    opacity: 1;
}

.patient-item img {
    width: 100%;
    height: 100%;
    display: block;
    margin: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
}

.patient-name {
    position: absolute;
    left: 0;
    bottom: 0;
    font-size: 0.85rem;
    text-align: left;
    padding: 5px 5px 5px 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 0 10px 0 0;
    background-color: #080808;
}

.tool-button {
    font-size: 0.72rem;
    width: calc(100% - 10px);
    padding: 5px 2px;
    margin: 5px;
    border: 1px solid transparent;
    border-radius: 10px;
    transition: background-color 0.15s, border-color 0.15s;
    background-color: transparent;
    color: #d9d9d9;
    cursor: pointer;
    text-align: center;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tool-icon {
    width: 25px;
    height: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tool-button:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.tool-button:active {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

.tool-button.hidden {
    display: none;
}

#fusion-icon {
    width: 40px;
    height: 40px;
}

.left-ws-topbar {
    width: 100%;
    height: 70px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
}

.left-ws-return {
    width: 40px;
    height: 40px;
    margin: 0;
    background-color: transparent;
    border-radius: 10px;
    display: flex;
    text-align: center;
    align-items: center;
    justify-content: center;
}

.left-ws-return-icon {
    width: 25px;
    height: 25px;
}

.left-ws-return:hover {
    background-color: #1a1a1a;
}

.left-ws-title {
    font-size: 1.2rem;
    text-align: center;
    color: #d9d9d9;
}

/* Hide return btn when in zenith (does nothing there) */
body:has(#zenith-tools:not(.hidden)) .left-ws-return {
    display: none;
}

/* Collapse button — always-right in topbar */
.left-ws-collapse-btn {
    width: 30px;
    height: 30px;
    margin-left: auto;
    margin-right: 0px;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.left-ws-collapse-btn:hover {
    background: #1a1a1a;
}

.left-ws-collapse-btn .left-ws-return-icon {
    width: 18px;
    height: 18px;
    opacity: 0.5;
}

.left-ws-collapse-btn:hover .left-ws-return-icon {
    opacity: 0.9;
}

/* Collapsed panel state */
.left-ws--collapsed {
    display: none !important;
}

.upload-controls {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #333333;
    background: #d9d9d9;
    border-radius: 10px;
    backdrop-filter: blur(2px);
    width: 100%;
    height: 80px;
    overflow: hidden;
}

.upload-label {
    padding: 10px;
    font-size: 0.9rem;
    font-weight: 400;
    height: 30px;
}

.upload-buttons {
    display: flex;
    width: 100%;
    height: 70%;
}

.upload-button {
    padding: 10px;
    background: transparent;
    color: #333333;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    height: 100%;
    transition: background 0.2s ease, transform 0.1s ease;
}

.upload-button:hover {
    background: #ffffff;
}

.upload-button:active {
    transform: translateY(1px);
}

.hidden-file-input {
    display: none;
}

.viewer-container {
    z-index: 10;
    width: 80vw;
    height: 100%;
    border-radius: 15px;
    background-color: #000000;
    position: relative;
    border-left: solid 1px #333333;
    display: grid;
    grid-template-columns: 60% 40%;
    grid-template-rows: repeat(3, 1fr);
    grid-template-areas:
        "view3d view1"
        "view3d view2"
        "view3d view3";
    overflow: hidden;
    outline: none;
}

.view1-container canvas,
.view2-container canvas,
.view3-container canvas,
.view4-container canvas,
.view5-container canvas,
.view3d-container canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: auto;
    /* cursor: pointer; */
    outline: none;
    z-index: 30;
}

.view1-container,
.view2-container,
.view3-container,
.view4-container,
.view5-container,
.view3d-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: transparent;
    z-index: 20;
    position: relative;
    border-left: #090D14 2px solid;
    /* cursor: pointer; */
    outline: none;
}

.view1-container.hidden,
.view2-container.hidden,
.view3-container.hidden,
.view4-container.hidden,
.view5-container.hidden,
.view3d-container.hidden {
    display: none;
}

.view3d-container {
    grid-area: view3d;
}

.view1-container {
    grid-area: view1;
}

.view2-container {
    grid-area: view2;
}

.view3-container {
    grid-area: view3;
}

.view4-container {
    grid-area: view4;
}

.view5-container {
    grid-area: view5;
}

.view4-container,
.view5-container {
    display: none;
}

.controls-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: left;
    margin-top: 5px;
    margin-left: 5%;
    pointer-events: none;
    gap: 8px;
    z-index: 1000;
}

.view-button {
    width: 30px;
    height: 30px;
    z-index: 1000;
    border-radius: 6px;
    justify-content: center;
    display: flex;
    align-items: center;
    background-color: transparent;
    pointer-events: auto;
}

.view-button img {
    width: 15px;
    height: 15px;
}

.view-button:hover {
    background-color: #333333;
}

.view-orientation-label {
    z-index: 1000;
    border-radius: 6px;
    padding: 4px 8px;
    color: #d9d9d9;
    font-size: 0.85rem;
    cursor: pointer;
    pointer-events: auto;
    font-weight: 500;
    background: transparent;
    backdrop-filter: blur(4px);
}


.orientation-presets-controls {
    position: absolute;
    left: 20px;
    top: 50px;
    /* transform: translateY(-50%); */
    margin-top: 8px;
    width: 8%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    height: 40%;
    overflow-y: auto;
    /* Enable vertical scrolling if content exceeds max height */
    gap: 0;
}

.preset-button {
    flex: 1 1 0;
    width: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    pointer-events: auto;
    min-height: 0;
}

.preset-button img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    aspect-ratio: 1 / 1;
}

.preset-button:hover {
    background-color: #333333;
}

.iso-slider-container {
    position: absolute;
    bottom: 3%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #333333;
    border-radius: 10px;
    padding: 10px;
    min-width: 260px;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.iso-slider-container.hidden {
    display: none;
}

.iso-slider-container label {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d9d9d9;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    /* prevent label text from wrapping */
    flex: 0 0 auto;
    /* don't let the label shrink below its content width */
}

.iso-slider-container #iso-value {
    color: #d9d9d9;
    font-weight: 600;
    margin-left: 6px;
}

.iso-slider-container input[type="range"] {
    /* Allow the range to flex and yield space to the label when needed */
    flex: 1 1 140px;
    min-width: 120px;
    height: 6px;
    background: #090D14;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.iso-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 25px;
    background: #d9d9d9;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.iso-slider-container input[type="range"]::-webkit-slider-thumb:hover {
    background: #d9d9d9;
}

.iso-slider-container input[type="range"]::-moz-range-thumb {
    width: 10px;
    height: 25px;
    background: var(--accent);
    border-radius: 5px;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

.iso-slider-container input[type="range"]::-moz-range-thumb:hover {
    background: var(--accent);
}

/* 3d controls top */
.render-mode-controls {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 100;
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    background: transparent;
    border-radius: 8px;
    padding: 8px;
    pointer-events: auto;
}

.render-mode-controls.hidden {
    display: none;
}

.focus-mode-button {
    border-left: 1px solid #333333;
    padding-left: 12px;
    z-index: 100;
}


/* Show views dropdown */
/* Custom multiselect for show views */
.custom-multiselect {
    position: relative;
    display: inline-block;
    z-index: 1000;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-left: auto;
}

.cm-toggle {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #333333;
    border-radius: 6px;
    padding: 6px 10px;
    color: #d9d9d9;
    font-size: 0.85rem;
    cursor: pointer;
}

.cm-toggle:hover {
    background-color: #333333;
}

.cm-options {
    position: absolute;
    top: 100%;
    right: 0px;
    height: 310px;
    border: 1px solid #333333;
    border-radius: 8px;
    padding: 5px;
    margin-top: 10px;
    min-width: 200px;
    z-index: 1001;
    display: flex;
    overflow: auto;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cm-list {
    position: absolute;
    top: 10px;
    left: 10px;
    background: transparent;
    padding: 0px;
    min-width: 160px;
    z-index: 1001;
}

.cm-list li {
    list-style: none;
    padding: 6px;
    font-size: 0.8rem;
    pointer-events: auto;
}

.cm-list li:hover {
    background-color: #333333;
    border-radius: 4px;
}

.cm-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #d9d9d9;
}

/* Custom checkbox: change color here. */
.cm-list input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid #333333;
    display: inline-block;
    position: relative;
    background: transparent;
}

.cm-list input[type="checkbox"]:checked {
    background: #0088f1;
    border-color: #0088f1;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
}

/* clip opacity change */
.clip-sliders-container {
    position: relative;
    top: 100%;
    width: 120px;
    background: transparent;
    min-width: 100px;
    z-index: 1001;
    display: flex;

}

.slider-label {
    position: relative;
    color: #d9d9d9;
    left: 0px;
    font-size: 0.85rem;
    align-items: left;
    width: 100%;
    margin-bottom: 5px;
    margin-left: 10px;
}

.clip-sliders {
    position: relative;
    left: 10px;
    width: 100px;
    justify-content: left;
    /* align vertically */
    align-items: center;
    background: #333333;
}

.slider-label-number {
    position: relative;
    color: #d9d9d9;
    font-size: 0.85rem;
    align-items: right;
    justify-content: right;
    width: 40px;
}

.cm-options.hidden {
    display: none;
}

/* ensure hidden input doesn't show */
#clip-planes {
    display: none;
}


/* clip-view-trigger inherits base styles from .view-button; only layout tweaks here */
.clip-view-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: fit-content;
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid #333333;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.clip-view-select {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.clip-view-label {
    padding-left: 10px;
}

/* Arrow indicator: down when closed, up when open */
.clip-view-arrow {
    width: 0;
    height: 0;
    margin-right: 10px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #d9d9d9;
    /* down arrow by default */
}

.clip-view-select[data-open="true"] .clip-view-arrow {
    border-top: none;
    border-bottom: 6px solid #d9d9d9;
    /* up arrow when open */
}

/* Hide the native select but keep it accessible and functional */
#clip-view-select-dropdown {
    position: absolute;
    inset: 0;
    border: none;
    pointer-events: none;
    background: transparent;
    color: transparent;
}

#clip-view-select-dropdown option {
    background: #090D14;
    color: #d9d9d9;
}

#clip-view-select-dropdown option:hover {
    background: #333333;
    outline: none;
}

#clip-view-select-dropdown option:checked {
    background: #333333;
    color: #d9d9d9;
}

#clip-view-select-dropdown::picker-indicator {
    display: none;
}


/* 3D renderer actors visibility */

.visibility-controls-3d {
    position: absolute;
    z-index: 1000;
    min-width: 100px;
    height: auto;
    bottom: 3%;
    height: fit-content;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: right;
    gap: 8px;
    background: transparent;
    padding: 10px;
    pointer-events: auto;
    border: 1px solid #333333;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.visibility-controls-title {
    color: #d9d9d9;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 5px;
    left: 10px;
    text-align: left;
}

.item-visibility-3d {
    height: 30px;
    margin-top: 5px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

#item-visibility-3d-toggle {
    position: relative;
    height: 100%;
    aspect-ratio: 1 / 1;
    left: 0px;
    align-items: right;
    justify-content: space-between;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

#item-visibility-3d-toggle .item-visibility-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    pointer-events: none;
    background: transparent;
}

#item-visibility-3d-toggle:hover {
    background: #333333;
}

.item-visibility-more {
    margin-left: 6px;
    padding: 5px 8px;
    height: 80%;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #333333;
    color: #d9d9d9;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.item-visibility-more:hover {
    background: #4f5368;
}

.item-visibility-options {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 6px;
    padding: 10px;
    border: 1px solid #333333;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
}

.item-visibility-options.hidden {
    display: none;
}

#item-visibility-3d-transparency-slider {
    width: 120px;
    height: 6px;
}

.item-visibility-colors {
    display: grid;
    grid-template-columns: repeat(5, 24px);
    gap: 6px;
}

.item-visibility-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid #333333;
    cursor: pointer;
    padding: 0;
}

.item-visibility-color:focus-visible,
.item-visibility-color.selected {
    outline: 2px solid #2f6fed;
}

#item-visibility-3d-label {
    position: relative;
    width: max-content;
    color: #d9d9d9;
    font-size: 0.9rem;
    text-align: left;
    left: 0px;
    min-width: 70px;
    margin-right: auto;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-visibility-3d-transparency-slider.hidden {
    display: none;
}

/* slice view */

.slice-view {
    width: 100%;
    height: 100%;
}

/* Slice offset controls (axial/coronal/sagittal) */


.slice-offset-group {
    position: absolute;
    width: 20px;
    height: 80%;
    z-index: 60;
    background: transparent;
    border-radius: 8px;
    padding: 8px 10px;
    pointer-events: auto;
    min-width: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
}

.slice-offset-group input[type="range"] {
    -webkit-appearance: none !important;
    appearance: none;
    width: 20px;
    height: 80%;
    background: transparent;
    border-radius: 3px;
    outline: none;
    writing-mode: vertical-rl;
    direction: rtl;
}

/* Custom track using background layers: base track + repeating ticks */
.slice-offset-group input[type="range"] {
    background-image:
        repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.4) 1px, transparent 5px 20%),
        repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.2) 1px, transparent 3px 10%);
    background-repeat: repeat;
    background-position: center center;
    background-size: 8px 100%;
    border-radius: 3px;
}

.slice-offset-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 50px;
    height: 3px;
    background: #aaaaaa;
    border-radius: 3px;
    cursor: pointer;
    border: none;
}

.slice-offset-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #d5d5d5;
}

.slice-offset-group input[type="range"]::-moz-range-thumb {
    width: 40px;
    height: 5px;
    background: #aaaaaa;
    border-radius: 3px;
    cursor: pointer;
    border: none;
}

.slice-offset-group input[type="range"]::-moz-range-thumb:hover {
    background: #d5d5d5;
}

.wl-controls-container {
    position: fixed;
    bottom: 3%;
    right: 3%;
    z-index: 100;
    pointer-events: auto;
}

.wl-toggle-button {
    background: #090D14;
    color: #d9d9d9;
    border: 1px solid #546175;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease;
    font-weight: 500;
}

.wl-toggle-button:hover {
    background: #333333;
}

.wl-sliders {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #545454;
    border-radius: 8px;
    padding: 16px;
    min-width: 280px;
    backdrop-filter: blur(4px);
}

.wl-sliders.hidden {
    display: none;
}

.wl-slider-group {
    margin-bottom: 16px;
}

.wl-slider-group:last-child {
    margin-bottom: 0;
}

.wl-slider-group label {
    display: block;
    color: #d5dce6;
    font-size: 0.85rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.wl-slider-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: #333333;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.wl-slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.wl-slider-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #5a9eff;
}

.wl-slider-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

.wl-slider-group input[type="range"]::-moz-range-thumb:hover {
    background: #5a9eff;
}

/* progress popup */
.progress-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #545454;
    border-radius: 10px;
    padding: 20px 30px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    gap: 15px;
}

.progress-popup.hidden {
    display: none;
}

/* Rotating spinner animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.progress-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(217, 217, 217, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

#progress-message {
    color: #d9d9d9;
    font-size: 0.95rem;
    text-align: center;
}

/* ── Section switcher ─────────────────────────────────────────────────────── */

.section-switcher {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 5px;
}

.section-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 100%;
    position: relative;
    padding: 8px 5px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #c8c8c8;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.section-btn .tool-icon {
    width: 22px;
    height: 22px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.section-btn svg.tool-icon {
    stroke: currentColor;
}

.section-btn:hover {
    background: #1a1a1a;
    color: #d9d9d9;
}

.section-btn:hover .tool-icon {
    opacity: 0.85;
}

.section-btn.active {
    background: rgba(0, 136, 241, 0.1);
    border-color: rgba(0, 136, 241, 0.3);
    color: #0088f1;
}

.section-btn.active .tool-icon {
    opacity: 1;
}

.section-btn--disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.section-divider {
    height: 1px;
    background: #1f1f1f;
    margin: 4px 8px;
}

/* ── Zenith tool active state ─────────────────────────────────────────────── */

#zenith-tools .tool-button.active {
    background: rgba(0, 136, 241, 0.1);
    border: 1px solid rgba(0, 136, 241, 0.3);
    color: #0088f1;
}

#zenith-tools .tool-button.active .tool-icon {
    opacity: 1;
}

.bottom-tool {
    margin-top: 0 !important;
}

#zenith-tools+.bottom-tool,
#imaging-tools+.bottom-tool {
    margin-top: auto !important;
}

/* ── Zenith left workspace ────────────────────────────────────────────────── */

.zenith-info-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
}

.info-label {
    color: #555;
    font-weight: 500;
}

.info-value {
    color: #d9d9d9;
    font-weight: 600;
}

.session-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
}

.session-date-header {
    font-size: 0.72rem;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 16px 6px;
}

.session-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    border-radius: 8px;
    margin: 2px 6px;
    border: 1px solid transparent;
    transition: background 0.15s;
}

.session-item:hover {
    background: #1a1a1a;
}

.session-item.active {
    background: rgba(0, 136, 241, 0.08);
    border-color: rgba(0, 136, 241, 0.2);
}

.session-play-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #1f1f1f;
    color: #d9d9d9;
    flex-shrink: 0;
    transition: background 0.15s;
}

.session-item:hover .session-play-icon,
.session-item.active .session-play-icon {
    background: #0088f1;
    color: #fff;
}

.session-play-icon svg {
    width: 14px;
    height: 14px;
}

.session-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.session-time {
    font-size: 0.88rem;
    font-weight: 600;
    color: #d9d9d9;
}

.session-filename {
    font-size: 0.7rem;
    color: #444;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.sessions-state {
    padding: 24px 16px;
    font-size: 0.82rem;
    color: #555;
    text-align: center;
    line-height: 1.6;
}

.sessions-error {
    color: #933;
}

/* ── Device Cards (Gallery sidebar) ──────────────────────────────────────── */

#zenith-device-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
}

.device-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: background 0.15s, border-color 0.2s, box-shadow 0.2s;
    min-width: 0; /* shrink to the container instead of overflowing (long names → clipped card) */
}

.device-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0; /* let the name column ellipsize rather than widen the card */
}

.device-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.device-card--active {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.07);
}

.device-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.device-card-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-card-code {
    font-size: 0.8rem;
    color: var(--text-faint);
    font-family: monospace;
    letter-spacing: 0.08em;
}

.device-card-label {
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0; /* status stays fully visible; the name column shrinks instead */
}

/* Status dot */
.device-card-status {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.device-card-status--checking {
    background: #555;
    animation: pulse-check 1.2s ease-in-out infinite;
}

.device-card-status--online {
    background: var(--success);
    box-shadow: 0 0 0 0 rgba(11, 207, 37, 0.6);
    animation: pulse-online 2s ease-in-out infinite;
}

.device-card-status--offline {
    background: #444;
}

.device-card--online {
    border-color: rgba(11, 207, 37, 0.25);
    box-shadow: 0 0 12px rgba(11, 207, 37, 0.08);
}

.device-card--online:hover,
.device-card--online.device-card--active {
    border-color: rgba(11, 207, 37, 0.45);
    box-shadow: 0 0 18px rgba(11, 207, 37, 0.15);
}

.device-card-label--online {
    color: var(--success);
}

.device-card-label--offline {
    color: #555;
}

.device-card-label--checking {
    color: #555;
}

@keyframes pulse-online {
    0% {
        box-shadow: 0 0 0 0 rgba(11, 207, 37, 0.5);
    }

    70% {
        box-shadow: 0 0 0 5px rgba(11, 207, 37, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(11, 207, 37, 0);
    }
}

@keyframes pulse-check {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ── Device card action buttons ─────────────────────────────────────────────*/

.device-card-actions {
    display: flex;
    gap: 6px;
}

.device-card-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 8px;
    border-radius: 7px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    min-height: 30px;
    border: 1px solid;
}

.device-card-btn svg {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
}

.device-card-btn--stream {
    background: rgba(0, 136, 241, 0.1);
    border-color: rgba(0, 136, 241, 0.3);
    color: #0088f1;
}

.device-card-btn--stream:hover {
    background: rgba(0, 136, 241, 0.22);
}

.device-card-btn--gallery {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-secondary);
}

.device-card-btn--gallery:hover {
    background: var(--surface-3);
    color: var(--text);
}

/* ── Cloud claim affordance on a device card ────────────────────────────── */
.device-card-claim,
.device-card-claim-btn {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.76rem;
    border-radius: 8px;
    padding: 7px 10px;
    line-height: 1;
}

.device-card-claim svg,
.device-card-claim-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Status (owned/taken/pending) is passive info, not an action — render it as a small
   left-aligned pill so it doesn't outshout the Stream/Gallery buttons. The unclaimed
   CTA (.device-card-claim-btn) stays full-width below. */
.device-card-claim {
    align-self: flex-start;
    width: auto;
    margin-top: 2px;
    padding: 4px 9px;
    font-size: 0.72rem;
    border-radius: 999px;
}

/* Owned: quiet green confirmation, not a button */
.device-card-claim--owned {
    color: var(--success);
    background: var(--success-soft);
    border: 1px solid var(--success-border);
}

/* Owned by someone else: no fill, muted, name truncated so long names don't blow out the card */
.device-card-claim--taken {
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    padding-left: 0;
}

.device-card-claim--taken .device-card-owner-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Pending: waiting for the operator to confirm on the device */
.device-card-claim--pending {
    color: #d6b25a;
    background: rgba(214, 178, 90, 0.1);
    border: 1px solid rgba(214, 178, 90, 0.25);
}

.device-card-claim-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(214, 178, 90, 0.35);
    border-top-color: #d6b25a;
    border-radius: 50%;
    flex-shrink: 0;
    animation: device-claim-spin 0.8s linear infinite;
}

@keyframes device-claim-spin {
    to { transform: rotate(360deg); }
}

/* Unclaimed: actionable button */
.device-card-claim-btn {
    width: 100%;
    cursor: pointer;
    color: #cdd6e4;
    background: rgba(108, 142, 255, 0.12);
    border: 1px solid rgba(108, 142, 255, 0.3);
    transition: background 0.15s, color 0.15s;
}

.device-card-claim-btn:hover {
    background: rgba(108, 142, 255, 0.22);
    color: #fff;
}

.device-card-claim-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ── Toast (claim feedback) ─────────────────────────────────────────────── */
.zenith-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(12px);
    max-width: min(90vw, 420px);
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.86rem;
    color: #fff;
    background: #2a2d35;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 4000;
}

.zenith-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.zenith-toast--ok {
    border-color: rgba(76, 175, 126, 0.5);
}

.zenith-toast--error {
    border-color: rgba(229, 115, 115, 0.6);
}

/* Disabled tool button (cloud gallery placeholder) */
.tool-button--disabled {
    opacity: 0.4;
}

.coming-soon-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #1a2a3a;
    color: #4a9edd;
    border: 1px solid #1e4a6e;
    border-radius: 4px;
    padding: 1px 4px;
    line-height: 1.4;
    pointer-events: none;
}

/* ── Zenith home view ────────────────────────────────────────────────────────*/

/* Home view: hide device panel, collapse left bar to icon column only */
.left-ws.home-view {
    display: none !important;
}

/* Collapsed: left-bar shrinks to the left-tools rail width, title hides. Must override
   the expanded min-width and match the fixed rail (90px) so the bar neither leaves an
   empty workspace strip nor clips the rail labels. */
.left-bar.home-view,
.left-bar.panel-collapsed {
    width: 90px;
    min-width: 90px;
}

body:has(.left-bar.home-view) .header-content,
body:has(.left-bar.panel-collapsed) .header-content {
    width: 90px;
    padding-left: 0;
    padding-right: 0;
    justify-content: center;
}

body:has(.left-bar.home-view) .title,
body:has(.left-bar.panel-collapsed) .title {
    display: none;
}

.zenith-home-inner {
    flex: 1;
    overflow-y: auto;
    /* Anchor content near the top instead of floating it mid-canvas, so the
       screen doesn't look hollow with one or two devices. */
    padding: 7vh 24px 32px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

.zenith-home-title {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 22px;
    text-align: center;
}

#zenith-home-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    /* max 4 cards × 260px + 3 gaps × 14px */
    max-width: calc(4 * 260px + 3 * 14px);
    width: 100%;
}

#zenith-home-cards .device-card {
    width: 260px;
    flex-shrink: 0;
    padding: 16px;
    cursor: default;
}

#zenith-home-cards .device-card-btn {
    padding: 9px 10px;
    font-size: 0.78rem;
    min-height: 36px;
}

#zenith-home-cards .device-card-btn svg {
    width: 13px;
    height: 13px;
}

.zenith-home-add-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 24px;
    padding: 9px 18px;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.zenith-home-add-btn:hover {
    border-color: var(--text-faint);
    color: var(--text);
}

/* ── Zenith main container ────────────────────────────────────────────────── */

.zenith-container {
    flex: 1;
    display: flex;
    background: #000;
    overflow: hidden;
    position: relative;
}

.zenith-view {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
}

/* Stream view */

.stream-topbar {
    position: absolute;
    top: 16px;
    left: 5%;
    z-index: 10;
}

.stream-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #333;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    opacity: 0.4;
    transition: opacity 0.3s;
}

.stream-badge.live {
    opacity: 1;
    border-color: rgba(11, 207, 37, 0.4);
}

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #444;
    transition: background 0.3s;
}

.stream-badge.live .badge-dot {
    background: #0bcf25;
    box-shadow: 0 0 6px #0bcf25;
    animation: pulse-dot 2s ease infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.badge-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #d9d9d9;
}

#zenith-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.stream-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.overlay-msg {
    font-size: 0.88rem;
    color: #555;
    text-align: center;
    white-space: pre-line;
}

.connecting-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(217, 217, 217, 0.1);
    border-top-color: #0088f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.stream-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 10px;
    background: #0088f1;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
}

.stream-open-btn:active { background: #0072cc; }

/* Sessions player view */

.player-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #2a2a2a;
}

.player-empty-state svg {
    width: 48px;
    height: 48px;
    stroke: #2a2a2a;
}

.player-empty-state span {
    font-size: 0.85rem;
}

#zenith-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Quality toggle */

.stream-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
}


.stream-share-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #ccc;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 4px 10px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.15s, border-color 0.15s;
}

.stream-share-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.stream-share-btn svg {
    width: 13px;
    height: 13px;
}

/* Floating fullscreen button — bottom-right of stream */
.stream-fullscreen-fab {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 10;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.15s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

#zenith-stream-view:hover .stream-fullscreen-fab,
.stream-fullscreen-fab:focus {
    opacity: 1;
}

/* Always visible on touch devices */
@media (hover: none) {
    .stream-fullscreen-fab {
        opacity: 0.75;
    }
}

.stream-fullscreen-fab:hover {
    background: rgba(0, 0, 0, 0.75);
}

.stream-fullscreen-fab:active {
    transform: scale(0.9);
}

.stream-fullscreen-fab svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.viewer-download-btn {
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #ddd;
    font-size: 0.82rem;
    padding: 6px 12px;
    cursor: pointer;
    text-decoration: none;
    backdrop-filter: blur(6px);
    transition: background 0.15s;
    flex-shrink: 0;
}

.viewer-download-btn:hover {
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
}

.viewer-download-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.player-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    font-size: 0.78rem;
    color: #555;
}

/* ── Device bar ──────────────────────────────────────────────────────────────*/

.sidebar-devices-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 8px;
    flex-shrink: 0;
}

.sidebar-devices-title {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #d9d9d9;
}

.device-add-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 136, 241, 0.12);
    border: 1px solid rgba(0, 136, 241, 0.25);
    border-radius: 7px;
    cursor: pointer;
    color: #0088f1;
    flex-shrink: 0;
    transition: background 0.15s;
}

.device-add-btn:hover {
    background: rgba(0, 136, 241, 0.22);
}

.device-add-btn svg {
    width: 12px;
    height: 12px;
}

/* ── Add Device modal ────────────────────────────────────────────────────────*/

.add-device-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-device-card {
    background: #0d1219;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 32px;
    width: 340px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.add-device-title {
    font-size: 1rem;
    font-weight: 600;
    color: #d9d9d9;
    margin: 0;
}

.add-device-hint {
    font-size: 0.8rem;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

.add-device-example {
    font-size: 0.78rem;
    color: #444;
    margin: 0;
}

.device-code-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 12px;
    color: #d9d9d9;
    font-size: 1.6rem;
    font-family: monospace;
    letter-spacing: 0.2em;
    text-align: center;
    text-transform: uppercase;
    width: 100%;
    margin-top: 8px;
    transition: border-color 0.15s;
}

.device-code-input:focus {
    outline: none;
    border-color: #0088f1;
}

.device-code-input.input-error {
    border-color: #e05555;
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-6px);
    }

    60% {
        transform: translateX(6px);
    }
}

.device-name-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px 12px;
    color: #d9d9d9;
    font-size: 0.85rem;
    width: 100%;
    transition: border-color 0.15s;
}

.device-name-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.2);
}

.device-name-input::placeholder,
.device-code-input::placeholder {
    color: #333;
}

.add-device-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.add-device-cancel {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #888;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s;
}

.add-device-cancel:hover {
    background: rgba(255, 255, 255, 0.09);
}

.add-device-save {
    flex: 2;
    padding: 10px;
    background: #0088f1;
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.15s;
}

.add-device-save:hover {
    background: #0077d6;
}

/* ── Settings modal ──────────────────────────────────────────────────────────*/

.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-card {
    background: #0d1219;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 28px;
    width: 340px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-title {
    font-size: 1rem;
    font-weight: 600;
    color: #d9d9d9;
    margin: 0;
}

.settings-close {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.settings-close:hover {
    color: #d9d9d9;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-section-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #555;
    margin: 0;
}

.settings-language-select {
    margin-top: 10px;
    width: 100%;
    padding: 10px 12px;
    background: #12161d;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #d9d9d9;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns=%27http://www.w3.org/2000/svg%27 width=%2716%27 height=%2716%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%238a8f98%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27><polyline points=%276 9 12 15 18 9%27/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.settings-language-select:focus {
    outline: none;
    border-color: #0088f1;
}

.settings-danger-btn {
    background: rgba(224, 85, 85, 0.08);
    border: 1px solid rgba(224, 85, 85, 0.25);
    border-radius: 8px;
    color: #e05555;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 10px 14px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}

.settings-danger-btn:hover {
    background: rgba(224, 85, 85, 0.15);
    border-color: rgba(224, 85, 85, 0.45);
}

.settings-danger-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.settings-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
}

.settings-section-hint {
    font-size: 0.78rem;
    color: #888;
    margin: -2px 0 8px;
}

/* ── Settings: claimed devices list ──────────────────────────────────────── */
.settings-claimed-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-claimed-empty {
    font-size: 0.82rem;
    color: #777;
    padding: 6px 2px;
}

.settings-claimed-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.settings-claimed-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.settings-claimed-name {
    font-size: 0.88rem;
    color: #e8e8e8;
}

.settings-claimed-code {
    font-size: 0.72rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.settings-claimed-menu {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #999;
    cursor: pointer;
}

.settings-claimed-menu:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ddd;
}

.settings-claimed-menu svg {
    width: 16px;
    height: 16px;
}

.settings-claimed-pop {
    position: absolute;
    top: 38px;
    right: 8px;
    z-index: 5;
    background: #26282f;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.settings-claimed-remove {
    display: block;
    width: 100%;
    padding: 9px 16px;
    border: none;
    background: transparent;
    color: #e57373;
    font-size: 0.84rem;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.settings-claimed-remove:hover {
    background: rgba(229, 115, 115, 0.12);
}

/* ── Generic confirmation modal ──────────────────────────────────────────── */
.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 20px;
}

.confirm-card {
    width: min(92vw, 400px);
    background: #1c1d22;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.confirm-title {
    margin: 0 0 10px;
    font-size: 1.05rem;
    color: #fff;
}

.confirm-msg {
    margin: 0 0 20px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #b8b8b8;
}

.confirm-bullets {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.confirm-bullets li {
    padding-left: 4px;
}

.confirm-bullets strong {
    color: #e0e0e0;
    font-weight: 600;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.confirm-cancel,
.confirm-ok {
    padding: 9px 18px;
    border-radius: 9px;
    font-size: 0.86rem;
    cursor: pointer;
    border: 1px solid transparent;
}

.confirm-cancel {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #ddd;
}

.confirm-cancel:hover {
    background: rgba(255, 255, 255, 0.12);
}

.confirm-ok {
    background: #c0392b;
    color: #fff;
}

.confirm-ok:hover {
    background: #e74c3c;
}

.confirm-ok:disabled {
    opacity: 0.6;
    cursor: default;
}

.settings-about {
    align-items: center;
    gap: 6px;
    padding: 8px 0 4px;
}

.settings-about-logo {
    width: 40px;
    height: 40px;
    opacity: 0.8;
    margin-bottom: 4px;
}

.settings-about-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #d9d9d9;
    margin: 0;
}

.settings-about-sub {
    font-size: 0.8rem;
    color: #555;
    margin: 0;
}

.settings-about-version {
    font-size: 0.75rem;
    color: #3a3a3a;
    margin: 0;
    margin-top: 4px;
}

/* ── Media Filter Bar ──────────────────────────────────────────────────────── */

.media-filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 6px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: #777;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.filter-chip svg { width: 14px; height: 14px; flex: 0 0 auto; }

.filter-chip:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.07);
    color: #bbb;
}

.filter-chip.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    color: #eee;
}

.filter-chip--disabled {
    opacity: 0.3;
    cursor: not-allowed;
    font-style: italic;
}

/* Trash chip is pushed to the right end of the filter bar. */
.filter-group--end { margin-left: auto; }
.filter-chip--trash.active {
    background: var(--danger-soft, rgba(214, 90, 90, 0.16));
    border-color: var(--danger-border, rgba(214, 90, 90, 0.5));
    color: var(--danger, #e06a6a);
}

/* ── Month Picker Dropdown ─────────────────────────────────────────────────── */

.month-picker-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 100;
    background: #1c1c1c;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 12px;
    width: 220px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.month-picker-year-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.month-picker-year {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ddd;
}

.month-picker-arrow {
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.month-picker-arrow:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #eee;
}

.month-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-bottom: 10px;
}

.month-cell {
    padding: 7px 4px;
    border-radius: 7px;
    border: 1px solid transparent;
    background: none;
    color: #555;
    font-size: 0.78rem;
    cursor: pointer;
    text-align: center;
    transition: background 0.12s, color 0.12s;
}

.month-cell:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #bbb;
}

.month-cell--has-media {
    color: #ccc;
}

.month-cell--active {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-weight: 600;
}

.month-picker-clear {
    width: 100%;
    padding: 6px;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    color: #666;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.month-picker-clear:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #aaa;
}

/* ── Media Explorer ────────────────────────────────────────────────────────── */

.media-explorer {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #2a2a2a transparent;
}

.media-explorer::-webkit-scrollbar {
    width: 4px;
}

.media-explorer::-webkit-scrollbar-track {
    background: transparent;
}

.media-explorer::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 4px;
}

.media-explorer::-webkit-scrollbar-thumb:hover {
    background: #3a3a3a;
}

.media-day-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 10px;
    color: #555;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.media-day-header:first-child {
    margin-top: 4px;
}

.media-day-header::before,
.media-day-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
}

/* Both galleries (local + cloud) center on the same max-width so they read as one
   design instead of "fills edge-to-edge" vs "centered with margins". */
.media-grid {
    max-width: var(--content-max);
    margin: 0 auto;
    width: 100%;
}

.media-grid-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(204px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}

.explorer-empty {
    color: #555;
    font-size: 0.9rem;
    text-align: center;
    padding: 48px 0;
    grid-column: 1 / -1;
}

.media-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    display: flex;
    flex-direction: column;
}

.media-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.media-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    background: #111;
    overflow: hidden;
    position: relative;
}

.media-card-thumb--video {
    position: relative;
}

.media-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Loaded thumbnail overlays the placeholder icon; tag/overlay/delete sit above it. */
.media-card-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.media-card-thumb .media-card-tag,
.media-card-thumb .media-card-play-overlay,
.media-card-thumb .cloud-card-menu {
    z-index: 2;
}

.media-card-thumb--video {
    background: #0d0d0d;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    color: rgba(255, 255, 255, 0.25);
}

.media-card-thumb--has-img {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.media-card-thumb--has-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-card-tag {
    position: absolute;
    bottom: 5px;
    right: 6px;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.65);
    color: rgba(255, 255, 255, 0.75);
    padding: 0 6px;
    height: 16px;
    line-height: 16px;
    border-radius: 4px;
    border: 1px solid transparent;
    backdrop-filter: blur(4px);
    pointer-events: none;
    display: inline-flex;
    align-items: center;
}

.media-card-tag--video {
    border-color: rgba(0, 136, 241, 0.5);
    color: rgba(100, 180, 255, 0.9);
}

.media-card-tag--image {
    border-color: rgba(11, 207, 37, 0.5);
    color: rgba(100, 220, 150, 0.9);
}

.media-card-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.15s;
    color: #fff;
}

.media-card:hover .media-card-play-overlay {
    opacity: 1;
}

.media-card-play-overlay svg {
    width: 40px;
    height: 40px;
}

.media-card-meta {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.media-card-time {
    font-size: 0.82rem;
    font-weight: 600;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-card-date {
    font-size: 0.72rem;
    color: #555;
}

/* ── Unified "Recordings" — source banner, per-card badges, locked state ─────── */

/* Source banner: names which sources currently feed the timeline. Rendered as a flat
   STATUS line (not pill buttons) so it's not mistaken for the All/Videos/Photos filter. */
.rec-sources { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; cursor: default; }
.rec-sources-label {
    font: 600 0.68rem 'Montserrat'; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-faint);
}
.src-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 0; border: none; background: none;
    font: 500 0.78rem 'Montserrat'; color: var(--text-secondary);
}
.src-chip svg { width: 14px; height: 14px; opacity: 0.85; }
.src-chip--off { color: var(--text-muted); }
.src-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.src-dot--on { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.src-dot--off { background: var(--text-faint); }

.rec-banner {
    display: flex; align-items: center; gap: 10px; margin: 14px 0 22px; padding: 9px 14px;
    border-radius: var(--r-md); font-size: 0.8rem; background: var(--surface-1); border: 1px solid var(--border); color: var(--text-secondary);
}
.rec-banner svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--text-muted); }
.rec-banner--warn { background: var(--warning-soft); border-color: var(--warning-border); color: var(--warning); }
.rec-banner--warn svg { color: var(--warning); }

/* Per-card source/durability badges (bottom-left; selection checkbox owns top-left). */
.rec-badges { position: absolute; bottom: 6px; left: 6px; z-index: 3; display: flex; gap: 4px; }
.rec-badge {
    position: relative;
    display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px;
    border-radius: 6px; font: 700 0.6rem/1 'Montserrat'; letter-spacing: 0.04em;
    backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); border: 1px solid transparent;
}
.rec-badge svg { width: 12px; height: 12px; }
/* Informational badges are neutral; only "not backed up" carries (restrained) color. */
.rec-badge--cloud,
.rec-badge--offline { background: rgba(0, 0, 0, 0.8); color: #ededed; border-color: rgba(255, 255, 255, 0.2); }
.rec-badge--device  { background: rgba(0, 0, 0, 0.8); color: var(--warning); border-color: rgba(214, 178, 90, 0.5); }

/* Badge hover tooltip. Rendered at the BODY level and positioned by JS (cloud.js) so the
   card's overflow:hidden can't clip it (a CSS ::after on the badge gets cut at the card). */
.rec-tip {
    position: fixed; z-index: 1000; max-width: 230px; padding: 8px 10px; border-radius: 8px;
    background: #16191e; color: var(--text-secondary); border: 1px solid var(--border-strong);
    font: 500 0.7rem/1.4 'Montserrat'; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
    pointer-events: none;
}

/* Loading spinner shown in the viewer between click and the media being ready. */
.cloud-viewer-loading {
    position: absolute; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.45);
}
.cloud-viewer-loading::after {
    content: ''; width: 38px; height: 38px; border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2); border-top-color: var(--accent);
    animation: device-claim-spin 0.8s linear infinite;
}

/* Download progress bar — pinned to the bottom of the viewer while a large file saves. */
.cloud-dl-progress {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 26; height: 26px;
    background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(6px);
    display: flex; align-items: center;
}
.cloud-dl-progress-fill {
    position: absolute; left: 0; top: 0; bottom: 0; width: 0;
    background: var(--accent); opacity: 0.35; transition: width 0.15s linear;
}
.cloud-dl-progress-label {
    position: relative; z-index: 1; padding: 0 12px; font-size: 0.74rem;
    color: var(--text-primary, #eee); font-weight: 600;
}

/* Device-only clip while the device is unreachable: dimmed + "connect to view" overlay. */
.media-card--locked { opacity: 0.6; cursor: not-allowed; }
.media-card--locked:hover { transform: none; }
.media-card--locked .media-card-thumb { filter: grayscale(0.6); }
.rec-lock {
    position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 8px;
    background: rgba(0, 0, 0, 0.55); color: var(--text-secondary); font: 600 0.7rem 'Montserrat';
}
.rec-lock svg { width: 22px; height: 22px; color: var(--text-muted); }
.rec-lock small { color: var(--text-muted); font-weight: 500; }

/* Trash header bar: space recoverable + empty-trash action. */
.rec-trash-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: 14px 0 18px; padding: 10px 14px;
    border-radius: var(--r-md, 10px); font-size: 0.8rem;
    background: var(--surface-1, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    color: var(--text-secondary, #b8b8b8);
}
.rec-trash-bar-text strong { color: var(--text-primary, #eee); }
.rec-trash-empty {
    flex: 0 0 auto; padding: 6px 12px; border-radius: 8px; cursor: pointer;
    font: 600 0.78rem 'Montserrat';
    background: var(--danger-soft, rgba(255, 107, 107, 0.14));
    border: 1px solid var(--danger-border, rgba(255, 107, 107, 0.4));
    color: var(--danger, #ff6b6b);
}
.rec-trash-empty:hover { background: rgba(255, 107, 107, 0.22); }

/* Trash card: countdown pill + dimmed thumb (it's pending permanent deletion). */
.media-card--trash .media-card-thumb { filter: grayscale(0.35) brightness(0.92); }
.rec-trash-left {
    position: absolute; left: 8px; top: 8px; z-index: 4;
    padding: 2px 8px; border-radius: 999px;
    background: var(--danger-soft, rgba(214, 90, 90, 0.16));
    color: var(--danger, #e06a6a); border: 1px solid var(--danger-border, rgba(214, 90, 90, 0.5));
    font: 600 0.66rem 'Montserrat'; white-space: nowrap;
}

/* Undo / status toast, bottom-center, above everything. */
.rec-toast {
    position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px);
    z-index: 1000; display: flex; align-items: center; gap: 14px;
    padding: 11px 16px; border-radius: 10px;
    background: rgba(26, 27, 32, 0.94); color: var(--text-primary, #eee);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
    font-size: 0.82rem; opacity: 0; pointer-events: none;
    transition: opacity 0.18s, transform 0.18s;
}
.rec-toast--show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.rec-toast-action {
    background: none; border: none; cursor: pointer; padding: 2px 4px;
    color: var(--accent, #5b9dff); font-weight: 700; font-size: 0.82rem;
}
.rec-toast-action:hover { text-decoration: underline; }

/* Selection checkbox (top-left). Hidden until card hover or while selecting. */
.rec-select {
    position: absolute; top: 6px; left: 6px; z-index: 5;
    width: 22px; height: 22px; padding: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    background: rgba(0, 0, 0, 0.5); border: 2px solid rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    opacity: 0; transition: opacity 0.12s, background 0.12s, transform 0.12s;
}
.rec-select svg { width: 13px; height: 13px; color: #fff; opacity: 0; }
.media-card:hover .rec-select,
#cloud-grid.selecting .media-card .rec-select { opacity: 1; }
.media-card.selected .rec-select { background: var(--accent, #0088f1); border-color: var(--accent, #0088f1); opacity: 1; }
.media-card.selected .rec-select svg { opacity: 1; }
/* Selected card: accent ring + slight inset so the selection reads clearly. */
.media-card.selected { outline: 3px solid var(--accent, #0088f1); outline-offset: -3px; }
.media-card.selected .media-card-thumb { filter: brightness(0.82); }
#cloud-grid.selecting .media-card { cursor: pointer; }

/* "Last synced" line in the sources row + inline refresh button. */
/* "Synced …" sits inline after the source chips (no margin-left:auto float-right).
   The manual-refresh control is the header Sync button. */
.rec-sync {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.72rem; color: var(--text-muted, #888);
}

/* Batch-selection bar, pinned bottom-center of the panel. */
.rec-selbar {
    position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px);
    z-index: 1001; display: flex; align-items: center; gap: 16px;
    padding: 9px 12px 9px 14px; border-radius: 12px;
    background: rgba(26, 27, 32, 0.96); color: var(--text-primary, #eee);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
    opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s;
}
.rec-selbar--show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.rec-selbar-count { font-size: 0.85rem; font-weight: 600; }
.rec-selbar-close {
    background: none; border: none; cursor: pointer; color: var(--text-secondary, #aaa);
    font-size: 1rem; line-height: 1; padding: 4px 6px; border-radius: 6px;
}
.rec-selbar-close:hover { background: var(--surface-2, rgba(255, 255, 255, 0.08)); color: #fff; }
.rec-selbar-delete {
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    padding: 7px 14px; border-radius: 8px; font: 600 0.82rem 'Montserrat';
    background: var(--danger-soft, rgba(255, 107, 107, 0.16)); color: var(--danger, #ff6b6b);
    border: 1px solid var(--danger-border, rgba(255, 107, 107, 0.4));
}
.rec-selbar-delete svg { width: 15px; height: 15px; }
.rec-selbar-delete:hover { background: rgba(255, 107, 107, 0.26); }

/* ── Media Viewer ──────────────────────────────────────────────────────────── */

.media-viewer {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #000;
}

.viewer-topbar {
    position: absolute;
    top: 12px;
    left: 5%;
    right: 5%;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.viewer-back-btn {
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #ddd;
    font-size: 0.82rem;
    padding: 6px 12px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: background 0.15s;
    flex-shrink: 0;
}

.viewer-back-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.viewer-back-btn:hover {
    background: rgba(0, 0, 0, 0.75);
}

.viewer-title {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    padding: 6px 10px;
    border-radius: 6px;
    pointer-events: none;
}

#zenith-player,
#zenith-image {
    flex: 1;
    width: 100%;
    min-height: 0;
    object-fit: contain;
    background: #000;
    display: block;
}

/* ── Mobile bottom tab bar ─────────────────────────────────────────────────── */

.mobile-tab-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #080808;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    align-items: center;
    justify-content: space-around;
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-tab {
    /* Equal thirds so the middle tab (Stream) is always screen-centered. With
       space-around + unequal-width labels ("Recordings" > "Profile") the middle
       drifts off-center; flex:1 with a 0 basis makes every tab the same width. */
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 8px;
    background: transparent;
    border: none;
    color: #555;
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 44px;
    transition: color 0.15s;
}

.mobile-tab.active {
    color: #0088f1;
}

.mobile-tab-icon {
    width: 22px;
    height: 22px;
    stroke: currentColor;
}

/* Profile tab shows the user's avatar (or the guest icon) instead of a stroked glyph. */
.mobile-tab-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.05);
}

.mobile-tab.active .mobile-tab-avatar {
    border-color: #0088f1;
}

/* ── Mobile profile bottom sheet ───────────────────────────────────────────────
   The desktop popup #profile-menu becomes a full-width sheet above the tab bar. */

.profile-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    z-index: 1990;
}

.profile-menu--sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom, 0));
    min-width: 0;
    border-radius: 16px 16px 0 0;
    padding: 8px 8px 12px;
    border-left: none;
    border-right: none;
    border-bottom: none;
    animation: sheet-up 0.22s ease;
}

@keyframes sheet-up {
    from {
        transform: translateY(24px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.profile-menu--sheet .profile-menu-item {
    padding: 13px 14px;
    font-size: 0.95rem;
}

/* ── Mobile breakpoint (≤ 768px) ───────────────────────────────────────────── */

@media (max-width: 768px) {

    /* Hide desktop left bar */
    .left-bar {
        display: none !important;
    }

    /* Zenith container fills full width */
    .zenith-container {
        width: 100% !important;
    }

    /* Show mobile tab bar when visible class is set */
    .mobile-tab-bar.visible {
        display: flex;
    }

    /* Zenith views: leave room for header (50px) and tab bar (64px) */
    .zenith-view {
        top: 50px;
        bottom: 64px;
        left: 0;
        right: 0;
    }

    /* Stream: bigger touch targets */
    .stream-share-btn {
        padding: 10px 16px;
        font-size: 0.84rem;
    }

    .stream-share-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Viewer: bigger back/download buttons */
    .viewer-back-btn,
    .viewer-download-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .viewer-back-btn svg,
    .viewer-download-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Filter bar: compact on mobile, and single-line — the Trash chip stays on the
       same row as All/Videos/Photos (flex-wrap would drop it to a second line). */
    .media-filter-bar {
        padding: 5px 10px;
        gap: 6px;
        flex-wrap: nowrap;
    }

    .filter-group {
        gap: 4px;
    }

    /* The trash group keeps its right-alignment but must not be squeezed off-row. */
    .filter-group--end {
        flex-shrink: 0;
    }

    .filter-chip {
        padding: 5px 10px;
        font-size: 0.74rem;
    }

    /* Home cards: full-width on phone */
    #zenith-home-cards .device-card {
        width: 100%;
    }

    .zenith-home-inner {
        padding: 16px;
        justify-content: flex-start;
    }

    /* Device add button: bigger */
    .device-add-btn {
        width: 36px;
        height: 36px;
    }

    .device-add-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Media grid: 2 columns on phone */
    .media-grid-row {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }

    /* Add device modal: safe width */
    .add-device-card {
        width: min(90vw, 340px);
        padding: 24px 20px;
    }

    /* Month picker: don't clip on small screens */
    .month-picker-dropdown {
        width: min(85vw, 220px);
    }

    /* Header: slightly tighter */
    .app-header {
        height: 44px;
    }

    .logo {
        width: 32px;
        height: 32px;
    }

    .title {
        font-size: 1.2rem;
    }

    /* Adjust zenith view top for smaller header */
    .zenith-view {
        top: 44px;
    }
}

/* ── Mobile landscape (stream fullscreen) ──────────────────────────────────── */

@media (hover: none) and (pointer: coarse) and (orientation: landscape) {

    /* Hide header — maximize screen */
    .app-header {
        display: none;
    }

    /* Hide desktop left sidebar on phones in landscape */
    .left-bar,
    .left-ws {
        display: none !important;
    }

    /* Tab bar: move to left side, vertical */
    .mobile-tab-bar.visible {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        align-items: center;
        bottom: 0;
        top: 0;
        left: 0;
        right: auto;
        width: 64px;
        height: 100%;
        border-top: none;
        border-right: 1px solid rgba(255, 255, 255, 0.08);
        padding-bottom: 0;
        padding-right: env(safe-area-inset-right, 0);
    }

    /* Stream/zenith fills full screen, offset for left tab bar */
    .zenith-view {
        top: 0;
        bottom: 0;
        left: 64px;
        right: 0;
    }

    /* Zenith container full height */
    .zenith-container {
        height: 100vh;
    }

    .main-content {
        padding-top: 0;
    }
}

/* ── Profile button (left tool bar) + menu ──────────────────────────────────
   Kept in style.css (loaded synchronously via <link>) so the static #profile-button
   in index.html is correctly sized at first paint — no flash. */

.profile-button {
    width: 40px;
    height: 40px;
    margin: 8px auto 12px;
    padding: 0;
    border: 1px solid #333333;
    border-radius: 50%;
    background: transparent;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s ease;
}

.profile-button:hover {
    border-color: #555;
}

.profile-button .profile-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Logged-out: the generic user icon needs padding so it isn't edge-to-edge. */
.profile-button--guest {
    background: rgba(255, 255, 255, 0.05);
}

.profile-button--guest .profile-avatar {
    width: 22px;
    height: 22px;
    margin: 8px auto;
    opacity: 0.7;
    border-radius: 0;
}

.profile-menu {
    position: fixed;
    min-width: 220px;
    background: #0d0d0d;
    border: 1px solid #333333;
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
    z-index: 2000;
    font-family: 'Montserrat', sans-serif;
    color: #d9d9d9;
}

.profile-menu.hidden {
    display: none;
}

.profile-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 12px;
    border-bottom: 1px solid #1a1a1a;
    margin-bottom: 6px;
}

.profile-menu-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #333333;
    flex-shrink: 0;
}

.profile-menu-id {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.profile-menu-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-menu-email {
    font-size: 0.72rem;
    font-weight: 400;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #d9d9d9;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.15s ease;
}

.profile-menu-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.85;
}

.profile-menu-item:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.06);
}

.profile-menu-item:disabled {
    opacity: 0.4;
    cursor: default;
}
/* Auth widget — shared by home (home.css) and platform (style.css).
   Tokens mirror the existing .login-button in home.css so it looks native on both,
   including the platform where .login-button isn't otherwise defined. */

.guide-auth {
  margin-left: auto;            /* push to the right of the flex header on both pages */
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;                 /* allow the group (and the name inside) to shrink */
  position: relative;           /* anchor for the signed-in dropdown (.gu-menu) */
}

/* Reuse the home.css login button design exactly (kept here so the platform has it too). */
.guide-auth .login-button {
  background: transparent;
  border: 1px solid #333333;
  border-radius: 8px;
  color: #d9d9d9;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 20px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  letter-spacing: 0.03em;
}

.guide-auth .login-button:hover {
  background: #1a1a1a;
  border-color: #555;
}

/* Signed-in trigger: avatar + first name + caret (opens the dropdown).
   flex:none so the pill sizes to its content and never collapses smaller than the
   avatar. The name shows in full or not at all — auth.js adds .gu-trigger--compact
   (avatar only) when the full name wouldn't fit, rather than truncating it. */
.guide-auth .gu-trigger {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 5px;
  border: 1px solid #333333;
  border-radius: 999px;
  background: transparent;
  color: #d9d9d9;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.guide-auth .gu-trigger:hover { background: #1a1a1a; border-color: #555; }

/* Compact: avatar only. Symmetric padding keeps a round pill that always fits the icon. */
.guide-auth .gu-trigger--compact { padding: 4px; gap: 0; }
.guide-auth .gu-trigger--compact .gu-name,
.guide-auth .gu-trigger--compact .gu-caret { display: none; }

.guide-auth .gu-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #333333;
  flex: none;                   /* never shrink the avatar */
}
.guide-auth .gu-avatar--fallback { background: #2a3646; border-color: #3a4658; }

.guide-auth .gu-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #d9d9d9;
  letter-spacing: 0.03em;
  white-space: nowrap;          /* shown in full; collapsed to avatar-only when it won't fit */
}

.guide-auth .gu-caret { width: 14px; height: 14px; flex: none; color: #8a8f98; }

/* Dropdown menu anchored under the trigger */
.guide-auth .gu-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 264px;
  max-width: calc(100vw - 24px);
  background: #0f141d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  z-index: 300;
  font-family: 'Montserrat', sans-serif;
}
.guide-auth .gu-menu.hidden { display: none; }

.guide-auth .gu-menu-header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.guide-auth .gu-menu-header .gu-avatar { width: 40px; height: 40px; }
.guide-auth .gu-menu-id { display: flex; flex-direction: column; min-width: 0; }
.guide-auth .gu-menu-name {
  font-size: 0.9rem; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.guide-auth .gu-menu-email {
  font-size: 0.78rem; color: #8a8f98;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.guide-auth .gu-menu-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.guide-auth .gu-menu-plan-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.guide-auth .gu-menu-plan-label {
  font-size: 0.7rem; color: #8a8f98; text-transform: uppercase; letter-spacing: 0.5px;
}
.guide-auth .gu-menu-plan-name { font-size: 0.9rem; font-weight: 600; color: #fff; }
.guide-auth .gu-menu-upgrade {
  flex: none;
  white-space: nowrap;
  background: #0088f1; color: #fff; text-decoration: none;
  padding: 7px 14px; border-radius: 6px;
  font-size: 0.8rem; font-weight: 600;
  transition: background 0.2s ease;
}
.guide-auth .gu-menu-upgrade:hover { background: #0072cc; }

.guide-auth .gu-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  color: #d9d9d9;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}
.guide-auth .gu-menu-item:hover { background: rgba(255, 255, 255, 0.05); }
.guide-auth .gu-menu-icon { width: 18px; height: 18px; flex: none; color: #9aa0a6; }

.guide-auth .gu-loading {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  color: #555;
  letter-spacing: 0.03em;
}

/* NOTE: profile-button / profile-menu styles live in style.css (loaded synchronously
   via <link>), NOT here. The profile button is static markup in index.html, so its
   styles must apply at first paint — auth.css is injected by JS (style-loader) and
   would cause a flash of an unsized (huge) avatar before it loads. */

/* ── Login overlay (split card: providers left, brand gradient right) ────────
   Injected by auth.js (openLoginModal). Literal colors (not :root tokens) so it
   renders identically on home.html and the platform. */
.gu-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 4, 4, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: gu-login-fade 0.18s ease;
}
.gu-login-overlay.hidden { display: none; }

@keyframes gu-login-fade { from { opacity: 0; } to { opacity: 1; } }

.gu-login-card {
  position: relative;
  display: flex;
  width: 70vw;                 /* ~15% inset each side */
  max-width: 960px;
  min-height: 480px;
  max-height: 86vh;
  border-radius: 16px;
  overflow: hidden;
  background: #101012;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  font-family: 'Montserrat', sans-serif;
}

.gu-login-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #d9d9d9;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}
.gu-login-close:hover { background: rgba(255, 255, 255, 0.14); }

/* Left: branding + providers */
.gu-login-left {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 48px 44px;
}
.gu-login-logo { height: 34px; width: auto; align-self: flex-start; margin-bottom: 6px; }
.gu-login-title { margin: 0; font-size: 1.6rem; font-weight: 700; color: #f2f2f2; letter-spacing: 0.01em; }
.gu-login-sub { margin: 0 0 10px; font-size: 0.9rem; color: #9aa0a6; line-height: 1.5; }

.gu-login-providers { display: flex; flex-direction: column; gap: 10px; }

.gu-provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #f2f2f2;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}
.gu-provider-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.28); }
.gu-provider-btn.is-loading { opacity: 0.6; pointer-events: none; }
.gu-provider-icon { width: 18px; height: 18px; flex: none; }

.gu-login-legal { margin: 8px 0 0; font-size: 0.75rem; color: #767c83; line-height: 1.5; }
.gu-login-legal a { color: #0088f1; text-decoration: none; }
.gu-login-legal a:hover { text-decoration: underline; }

/* Right: brand gradient placeholder (swap for real art later) */
.gu-login-right {
  flex: 1 1 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(120% 120% at 75% 20%, rgba(26, 151, 255, 0.55) 0%, rgba(0, 136, 241, 0) 55%),
    linear-gradient(150deg, #0088f1 0%, #0a4a85 45%, #08111c 100%);
}
.gu-login-watermark { width: 58%; max-width: 320px; opacity: 0.16; filter: brightness(0) invert(1); }

/* Stack to a single column on narrow screens — a 70vw split breaks on phones. */
@media (max-width: 760px) {
  .gu-login-card { width: 92vw; min-height: 0; }
  .gu-login-right { display: none; }
  .gu-login-left { padding: 44px 28px; }
}

/* Manage-account modal. Uses the app design tokens (style.css :root). */
.gu-acct-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.gu-acct-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--ink-black, #090d14);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--r-lg, 16px);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  color: var(--text, #f2f2f2);
}

.gu-acct-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted, #9aa0a6);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}
.gu-acct-close:hover { color: var(--text, #f2f2f2); }

.gu-acct-title {
  margin: 0 0 20px;
  font-size: 1.2rem;
  font-weight: 700;
}

.gu-acct-section {
  padding: 16px 0;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}

.gu-acct-plan-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.gu-acct-plan-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #9aa0a6);
}
.gu-acct-plan-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent, #0088f1);
}

.gu-acct-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2, rgba(255, 255, 255, 0.06));
  overflow: hidden;
}
.gu-acct-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}
.gu-acct-bar-fill--ok { background: var(--success, #0bcf25); }
.gu-acct-bar-fill--warn { background: var(--warning, #d6b25a); }
.gu-acct-bar-fill--urgent { background: var(--danger, #ff6b6b); }

.gu-acct-usage-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary, #c4c4c4);
}
.gu-acct-usage-pct { font-weight: 600; }
.gu-acct-usage-pct--warn { color: var(--warning, #d6b25a); }
.gu-acct-usage-pct--urgent { color: var(--danger, #ff6b6b); }

.gu-acct-warn {
  margin: 10px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
}
.gu-acct-warn--warn { color: var(--warning, #d6b25a); }
.gu-acct-warn--urgent { color: var(--danger, #ff6b6b); }

.gu-acct-upgrade {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.gu-acct-up-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gu-acct-up-title { font-size: 0.92rem; font-weight: 600; }
.gu-acct-up-feature { font-size: 0.8rem; color: var(--text-muted, #9aa0a6); }
.gu-acct-up-btn {
  flex: none;
  background: var(--accent, #0088f1);
  color: #fff;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--r-sm, 8px);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.gu-acct-up-btn:hover { background: var(--accent-hover, #1a97ff); }

.gu-acct-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}

.gu-acct-cancel {
  width: 100%;
  background: none;
  border: 1px solid var(--danger-border, rgba(255, 107, 107, 0.4));
  color: var(--danger, #ff6b6b);
  padding: 10px;
  border-radius: var(--r-sm, 8px);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.gu-acct-cancel:hover { background: var(--danger-soft, rgba(255, 107, 107, 0.14)); }

.gu-acct-confirm-body {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--text-secondary, #c4c4c4);
  line-height: 1.5;
}
.gu-acct-confirm-actions { display: flex; gap: 10px; }
.gu-acct-keep,
.gu-acct-cancel-yes {
  flex: 1;
  padding: 10px;
  border-radius: var(--r-sm, 8px);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.gu-acct-keep {
  background: var(--surface-2, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  color: var(--text, #f2f2f2);
}
.gu-acct-keep:hover { background: var(--surface-3, rgba(255, 255, 255, 0.09)); }
.gu-acct-cancel-yes {
  background: var(--danger, #ff6b6b);
  border: 1px solid var(--danger, #ff6b6b);
  color: #fff;
}
.gu-acct-cancel-yes:disabled { opacity: 0.6; cursor: default; }

.gu-acct-canceled {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted, #9aa0a6);
  text-align: center;
}

/* Cancellation retention flow. */
.cf-overlay {
  position: fixed;
  inset: 0;
  z-index: 1150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.64);
  backdrop-filter: blur(2px);
}
.cf-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--ink-black, #090d14);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--r-lg, 16px);
  padding: 26px 26px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  color: var(--text, #f2f2f2);
}
.cf-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: var(--text-muted, #9aa0a6);
  font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 4px;
}
.cf-close:hover { color: var(--text, #f2f2f2); }

.cf-title { margin: 0 0 6px; font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; }
.cf-sub { margin: 0 0 18px; font-size: 0.88rem; color: var(--text-muted, #9aa0a6); }

.cf-reasons { display: flex; flex-direction: column; gap: 2px; }
.cf-reason {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--r-sm, 8px);
  cursor: pointer;
  transition: background 0.12s ease;
}
.cf-reason:hover { background: var(--surface-1, rgba(255, 255, 255, 0.035)); }
.cf-reason input { position: absolute; opacity: 0; width: 0; height: 0; }
.cf-radio {
  flex: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-strong, rgba(255, 255, 255, 0.16));
  transition: border-color 0.12s ease;
}
.cf-reason input:checked + .cf-radio {
  border-color: var(--accent, #0088f1);
  box-shadow: inset 0 0 0 4px var(--accent, #0088f1);
}
.cf-reason input:focus-visible + .cf-radio { outline: 2px solid var(--accent, #0088f1); outline-offset: 2px; }
.cf-reason-label { font-size: 0.92rem; }

.cf-detail {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-1, rgba(255, 255, 255, 0.035));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--r-sm, 8px);
  color: var(--text, #f2f2f2);
  font: inherit;
  font-size: 0.9rem;
  resize: vertical;
}
.cf-detail:focus { outline: none; border-color: var(--accent, #0088f1); }

/* Save offer (cost → cheaper plan; problems → support) */
.cf-offer {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--accent-soft, rgba(0, 136, 241, 0.12));
  border: 1px solid var(--accent-border, rgba(0, 136, 241, 0.35));
  border-radius: var(--r-md, 12px);
}
.cf-offer-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cf-offer-title { font-size: 0.9rem; font-weight: 700; }
.cf-offer-sub { font-size: 0.78rem; color: var(--text-secondary, #c4c4c4); }
.cf-offer-btn {
  flex: none;
  margin-left: auto;
  padding: 9px 15px;
  border: none;
  border-radius: var(--r-sm, 8px);
  background: var(--accent, #0088f1);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.cf-offer-btn:hover { background: var(--accent-hover, #1a97ff); }

.cf-actions { display: flex; gap: 10px; margin-top: 22px; }
/* Keep is the encouraged choice (filled); Continue stays clearly available (never hidden). */
.cf-keep {
  flex: 1;
  padding: 11px 14px;
  border: none;
  border-radius: var(--r-sm, 8px);
  background: var(--accent, #0088f1);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}
.cf-keep:hover { background: var(--accent-hover, #1a97ff); }
.cf-continue {
  flex: none;
  padding: 11px 16px;
  border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.16));
  border-radius: var(--r-sm, 8px);
  background: none;
  color: var(--text-muted, #9aa0a6);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.cf-continue:hover:not(:disabled) { color: var(--danger, #ff6b6b); border-color: var(--danger-border, rgba(255, 107, 107, 0.4)); }
.cf-continue:disabled { opacity: 0.45; cursor: default; }

/* Styled confirm dialog + toast (dialog.js). Uses the app design tokens. */
.gu-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  animation: gu-dialog-fade 0.15s ease;
}
@keyframes gu-dialog-fade { from { opacity: 0; } }

.gu-dialog {
  width: 100%;
  max-width: 400px;
  background: var(--ink-black, #090d14);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--r-lg, 16px);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  color: var(--text, #f2f2f2);
  animation: gu-dialog-rise 0.18s ease;
}
@keyframes gu-dialog-rise { from { transform: translateY(8px); opacity: 0; } }

.gu-dialog-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.gu-dialog-body {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary, #c4c4c4);
}
.gu-dialog-body b { color: var(--text, #f2f2f2); font-weight: 700; }

.gu-dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}
.gu-dialog-btn {
  flex: 1;
  padding: 11px 14px;
  border-radius: var(--r-sm, 8px);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.gu-dialog-btn--ghost {
  background: var(--surface-2, rgba(255, 255, 255, 0.06));
  border-color: var(--border, rgba(255, 255, 255, 0.08));
  color: var(--text, #f2f2f2);
}
.gu-dialog-btn--ghost:hover { background: var(--surface-3, rgba(255, 255, 255, 0.09)); }
.gu-dialog-btn--primary {
  background: var(--accent, #0088f1);
  color: #fff;
}
.gu-dialog-btn--primary:hover { background: var(--accent-hover, #1a97ff); }
.gu-dialog-btn--danger {
  background: var(--danger, #ff6b6b);
  color: #fff;
}
.gu-dialog-btn--danger:hover { filter: brightness(1.05); }
.gu-dialog-btn:focus-visible { outline: 2px solid var(--accent, #0088f1); outline-offset: 2px; }

/* Toast */
.gu-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 1200;
  transform: translate(-50%, 16px);
  opacity: 0;
  max-width: min(90vw, 440px);
  padding: 12px 18px;
  border-radius: var(--r-sm, 8px);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text, #f2f2f2);
  background: var(--ink-black, #090d14);
  border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.16));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.gu-toast--in { transform: translate(-50%, 0); opacity: 1; }
.gu-toast--success { border-color: var(--success-border, rgba(11, 207, 37, 0.3)); }
.gu-toast--success::before { content: "✓ "; color: var(--success, #0bcf25); }
.gu-toast--error { border-color: var(--danger-border, rgba(255, 107, 107, 0.4)); }

@media (prefers-reduced-motion: reduce) {
  .gu-dialog-overlay, .gu-dialog, .gu-toast { animation: none; transition: none; }
  .gu-toast { opacity: 1; transform: translate(-50%, 0); }
}

/* Two-column celebration/farewell dialog. Left: copy. Right: tier-themed cosmic panel. */
.pc-overlay {
  position: fixed;
  inset: 0;
  z-index: 1150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(3px);
  animation: pc-fade 0.18s ease;
}
@keyframes pc-fade { from { opacity: 0; } }

.pc-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  width: 100%;
  max-width: 760px;
  min-height: 420px;
  background: var(--ink-black, #090d14);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  color: var(--text, #f2f2f2);
  animation: pc-rise 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes pc-rise { from { transform: translateY(12px) scale(0.99); opacity: 0; } }

.pc-close {
  position: absolute;
  top: 12px; right: 14px;
  z-index: 2;
  background: none; border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.7rem; line-height: 1; cursor: pointer; padding: 4px;
}
.pc-close:hover { color: #fff; }

.pc-text {
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.pc-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent, #0088f1);
}
.pc-title {
  margin: 12px 0 14px;
  font-size: 1.7rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.pc-lead { margin: 0 0 10px; font-size: 1rem; color: var(--text, #f2f2f2); font-weight: 600; }
.pc-body { margin: 0; font-size: 0.95rem; line-height: 1.6; color: var(--text-secondary, #c4c4c4); }
.pc-body b, .pc-lead b { color: var(--text, #f2f2f2); font-weight: 700; }

.pc-perks { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pc-perks li {
  position: relative;
  padding-left: 24px;
  font-size: 0.86rem;
  color: var(--text-secondary, #c4c4c4);
}
.pc-perks li::before {
  content: "";
  position: absolute; left: 0; top: 6px;
  width: 12px; height: 7px;
  border-left: 2px solid var(--success, #0bcf25);
  border-bottom: 2px solid var(--success, #0bcf25);
  transform: rotate(-45deg);
}

.pc-cta {
  margin-top: 26px;
  padding: 12px 26px;
  border: none;
  border-radius: var(--r-sm, 8px);
  background: var(--accent, #0088f1);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.pc-cta:hover { background: var(--accent-hover, #1a97ff); }
.pc-cta:active { transform: translateY(1px); }
.pc-cta:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ── Cosmic hero (right) ── */
.pc-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 28px;
}
.pc-hero-label {
  position: relative;
  z-index: 2;
  font-size: 0.72rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
}
/* starfield: layered pin-point radial gradients */
.pc-stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.9), transparent),
    radial-gradient(1px 1px at 65% 20%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 40% 70%, rgba(255,255,255,0.85), transparent),
    radial-gradient(1px 1px at 80% 60%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 30% 85%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 88% 38%, rgba(255,255,255,0.75), transparent),
    radial-gradient(1px 1px at 12% 62%, rgba(255,255,255,0.6), transparent);
}
/* glowing celestial body, sized/coloured per tier */
.pc-orb {
  position: absolute;
  top: 46%; left: 50%;
  width: 130px; height: 130px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

/* Planet — steady blue world */
.pc-hero--planet { background: radial-gradient(120% 100% at 70% 20%, #0a2a4a 0%, #071626 55%, #050b14 100%); }
.pc-hero--planet .pc-orb {
  background: radial-gradient(circle at 35% 30%, #4db4ff, #0088f1 45%, #054a80 100%);
  box-shadow: 0 0 60px rgba(0, 136, 241, 0.55);
}
/* Galaxy — violet swirl */
.pc-hero--galaxy { background: radial-gradient(120% 100% at 65% 25%, #3a1160 0%, #1a0b34 55%, #0a0618 100%); }
.pc-hero--galaxy .pc-orb {
  width: 160px; height: 160px;
  background: radial-gradient(circle at 40% 35%, #d08bff, #8a2be2 40%, #3a0e6b 75%, transparent 78%);
  box-shadow: 0 0 70px rgba(138, 43, 226, 0.5);
}
/* Universe — bright multi-hue */
.pc-hero--universe { background: radial-gradient(120% 100% at 60% 20%, #052a44 0%, #10123a 45%, #0a0618 100%); }
.pc-hero--universe .pc-orb {
  width: 150px; height: 150px;
  background: radial-gradient(circle at 38% 32%, #7ff0e0, #00c6ff 38%, #6a3cff 78%, #2a1466 100%);
  box-shadow: 0 0 80px rgba(0, 198, 255, 0.5);
}
/* Moon — muted farewell */
.pc-hero--moon { background: radial-gradient(120% 100% at 65% 25%, #26303f 0%, #141a24 55%, #0a0e14 100%); }
.pc-hero--moon .pc-orb {
  background: radial-gradient(circle at 36% 30%, #e8ecf2, #aab4c2 45%, #5b6472 100%);
  box-shadow: 0 0 40px rgba(200, 210, 225, 0.3);
}

/* Mobile: stack, hero becomes a short banner on top */
@media (max-width: 640px) {
  .pc-card { grid-template-columns: 1fr; max-width: 420px; min-height: 0; }
  .pc-hero { grid-row: 1; min-height: 150px; align-items: center; padding: 20px 0; }
  .pc-hero .pc-orb { position: relative; top: 0; left: 0; transform: none; width: 84px; height: 84px; }
  .pc-hero--galaxy .pc-orb, .pc-hero--universe .pc-orb { width: 92px; height: 92px; }
  .pc-hero-label { position: absolute; bottom: 10px; }
  .pc-text { padding: 28px 24px; }
  .pc-title { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pc-overlay, .pc-card { animation: none; }
}

/* Cloud gallery — upload / list / preview / download. Reuses the Zenith
   .media-card and .media-viewer design so it matches the device section. */

.cloud-container {
  flex: 1;
  height: 100%;
  background: #080808;
  position: relative;
  overflow: hidden;        /* the inner .cloud-scroll scrolls; the viewer covers this box */
  display: flex;
  flex-direction: column;
}

.cloud-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a transparent;
}

/* Pull-to-refresh "Syncing" row: lives in the scroll flow between the filter bar and
   the media grid, so it pushes the grid down instead of overlapping the header. Height
   tracks the pull (JS); it fades/collapses on release, or holds while syncing. */
.cloud-sync-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 0;
  opacity: 0;
  overflow: hidden;
  color: #8a93a0;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: height 0.22s ease, opacity 0.22s ease;
}

.cloud-sync-row--dragging { transition: none; }   /* follow the finger without lag */
.cloud-sync-row--armed { color: #cfd6df; }

.cloud-ptr-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #0088f1;
  flex-shrink: 0;
}

.cloud-sync-row--busy .cloud-ptr-spinner { animation: spin 0.8s linear infinite; }

/* Media-area loading state on first entry (and trash) — centered spinner + label. */
.cloud-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 56px 0;
  color: #8a93a0;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.cloud-loading .cloud-ptr-spinner { animation: spin 0.8s linear infinite; }

.cloud-scroll::-webkit-scrollbar { width: 4px; }
.cloud-scroll::-webkit-scrollbar-track { background: transparent; }
.cloud-scroll::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 4px; }
.cloud-scroll::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* Cards fill the full panel width (like the dropzone above) instead of leaving a gap. */
.cloud-grid .media-grid-row {
  grid-template-columns: repeat(auto-fill, minmax(204px, 1fr));
}

.cloud-panel {
  max-width: var(--content-max); /* matches the local gallery (style.css :root) */
  margin: 0 auto;
  padding: 32px 32px 60px;
}

.cloud-header {
  display: flex;
  /* Top-align: the heading now carries a storage module below the title, so the Sync/Upload
     actions must pin to the title row rather than float in the taller block's vertical center. */
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 24px;
}

.cloud-heading {
  flex: 1;
  min-width: 0;
}

/* Actions keep their intrinsic size and stay pinned to the title row. */
.cloud-sync-btn,
.cloud-upload-btn { flex: none; }

/* Secondary/ghost button (distinct from the blue Upload). Icon spins while syncing. */
.cloud-sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #cfd6df;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cloud-sync-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.cloud-sync-btn--busy { cursor: default; color: #8a93a0; }
.cloud-sync-btn--busy svg { animation: spin 0.8s linear infinite; }

/* Mobile uses pull-to-refresh instead — keep the header uncluttered. */
@media (max-width: 768px) {
  .cloud-sync-btn { display: none !important; }
}

.cloud-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.04em;
}

.cloud-subtitle {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.78rem;
  color: #888;
  margin-top: 4px;
  letter-spacing: 0.02em;
}

.cloud-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #fff;
  background: #0088f1;
  border: 1px solid #0088f1;
  border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.cloud-upload-btn:hover {
  filter: brightness(1.1);
}

/* Dropzone */
.cloud-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px;
  border: 1.5px dashed #333;
  border-radius: 14px;
  color: #777;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  margin-bottom: 20px;
}

.cloud-dropzone:hover,
.cloud-dropzone--active {
  border-color: #0088f1;
  background: rgba(0, 136, 241, 0.06);
  color: #aaa;
}

.cloud-dropzone-text {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.cloud-dropzone-link {
  color: #0088f1;
  font-weight: 600;
}

/* Mobile upload actions — hidden on desktop; swapped in for the dropzone ≤768px. */
.cloud-mobile-actions {
  display: none;
  gap: 10px;
  margin-bottom: 20px;
}

.cloud-mobile-action {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 10px;
  border: 1.5px solid #333;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  color: #cfcfcf;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cloud-mobile-action:active {
  border-color: #0088f1;
  background: rgba(0, 136, 241, 0.08);
}

@media (max-width: 768px) {
  /* Drag & drop and the header Upload button make no sense on touch — replace both
     with the big Camera / Upload action buttons. */
  .cloud-dropzone { display: none !important; }
  .cloud-upload-btn { display: none !important; }
  .cloud-mobile-actions:not(.hidden) { display: flex; }
}

/* Upload progress rows */
.cloud-uploads {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.cloud-upload-row {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #1f1f1f;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'Montserrat', sans-serif;
}

.cloud-upload-row-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #d9d9d9;
  margin-bottom: 6px;
  gap: 12px;
}

.cloud-upload-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-upload-row-status {
  color: #888;
  flex-shrink: 0;
}

.cloud-upload-row-status.error {
  color: #ff6b6b;
}

.cloud-upload-bar {
  height: 4px;
  background: #1f1f1f;
  border-radius: 2px;
  overflow: hidden;
}

.cloud-upload-bar-fill {
  height: 100%;
  width: 0;
  background: #0088f1;
  transition: width 0.15s ease;
}

/* Asset grid — same metrics as the Zenith media grid */
/* Container for day sections (.media-day-header + .media-grid-row); the rows do the grid. */
.cloud-grid {
  display: block;
}

/* Filename line added on top of the reused .media-card-meta */
.cloud-card-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Kebab "more options" button (top-right). Appears on card hover; opens a popup
   menu that holds Delete (and future actions). */
.cloud-card-menu {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #ccc;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
  backdrop-filter: blur(4px);
  z-index: 4;
}

.media-card:hover .cloud-card-menu,
.media-card-thumb:has(.cloud-card-menu-pop:not(.hidden)) .cloud-card-menu {
  opacity: 1;
}

.cloud-card-menu:hover {
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.cloud-card-menu svg {
  width: 16px;
  height: 16px;
}

/* Popup menu anchored under the kebab. */
.cloud-card-menu-pop {
  position: absolute;
  top: 36px;
  right: 6px;
  z-index: 5;
  min-width: 132px;
  padding: 4px;
  background: rgba(20, 20, 22, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

.cloud-card-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #dcdcdc;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.cloud-card-menu-item svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.cloud-card-menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.cloud-card-menu-item--danger:hover {
  background: rgba(255, 107, 107, 0.14);
  color: #ff6b6b;
}

/* "Available offline" badge — a small diagonal green corner ribbon (top-left)
   with a check icon. Hover reveals a "Downloaded" tooltip. */
.cloud-dl-corner {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  z-index: 3;
  cursor: default;
}

.cloud-dl-corner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.97), rgba(22, 163, 74, 0.97));
  clip-path: polygon(0 0, 100% 0, 0 100%);
  border-top-left-radius: 8px;
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
}

.cloud-dl-corner svg {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  color: #fff;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.cloud-dl-corner-text {
  position: absolute;
  top: 4px;
  left: 32px;
  padding: 3px 8px;
  background: rgba(22, 163, 74, 0.96);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateX(-4px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.cloud-dl-corner:hover .cloud-dl-corner-text {
  opacity: 1;
  transform: translateX(0);
}

/* In-app preview overlay (covers the panel; reuses .media-viewer look) */
.cloud-viewer {
  position: absolute;
  inset: 0;
  z-index: 20;
}

#cloud-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

#cloud-image {
  flex: 1;
  width: 100%;
  min-height: 0;
  object-fit: contain;
  background: #000;
  display: block;
}

/* Empty / sign-in states */
.cloud-empty,
.cloud-signin {
  text-align: center;
  color: #777;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9rem;
  padding: 60px 20px;
}

.cloud-signin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* The platform's style.css has no .login-button — define it for the cloud sign-in. */
.cloud-signin .login-button {
  background: transparent;
  border: 1px solid #333333;
  border-radius: 8px;
  color: #d9d9d9;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 22px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  letter-spacing: 0.03em;
}

.cloud-signin .login-button:hover {
  background: #1a1a1a;
  border-color: #555;
}

/* Beta waitlist screen — shown in place of the cloud gallery for non-approved users. */
.cloud-waitlist {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 2rem;
}
.cloud-waitlist.hidden { display: none; }
.cloud-waitlist-card {
  max-width: 460px;
  text-align: center;
  background: var(--gallery, #111);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: var(--r-lg, 16px);
  padding: 2.5rem 2rem;
}
.cloud-waitlist-logo { height: 48px; opacity: 0.9; margin-bottom: 1.25rem; }
.cloud-waitlist-card h2 { color: var(--text, #fff); margin: 0 0 0.75rem; font-size: 1.3rem; }
.cloud-waitlist-card p { color: var(--text-secondary, #bbb); line-height: 1.5; margin: 0 0 0.75rem; }
.cloud-waitlist-card strong { color: var(--text, #fff); }
.cloud-waitlist-hint { color: var(--text-faint, #888); font-size: 0.9rem; }

