/* ==========================================================================
   Bedrock Remote Connect - v2 visual layer (loaded after bedrock-ui.css)
   Clear, flat, professional: solid colours, no glows, no gradients,
   pill buttons, filled inputs, short functional motion. Visual only.
   ========================================================================== */
:root {
    --ease: cubic-bezier(0.2, 0, 0, 1);
    --radius-lg: 12px;
    --radius-xl: 14px;

    --text-secondary: #b3c0d4;
    --text-muted: #8796ae;
    --bg-panel: #0f1726;
    --bg-card: #19243a;
    --border-subtle: rgba(159, 176, 201, 0.16);
    --border-strong: rgba(159, 176, 201, 0.30);

    --accent-success: #34d399;
    --accent-warning: #fbbf24;
    --accent-error: #f87171;
    --success-solid: #34d399;
    --warning-solid: #fbbf24;
    --error-solid: #ef4444;
    --neutral-solid: #26324a;
    --on-accent-solid: #06201a;
    --grad-accent: var(--accent-primary);
    --grad-success: var(--success-solid);

    --shadow-card: 0 1px 2px rgba(0, 0, 0, .30);
    --shadow-hover: 0 1px 2px rgba(0, 0, 0, .30);
    --tabbar-h: 64px;
}
[data-theme="light"] {
    --text-secondary: #3b4b61;
    --text-muted: #607089;
    --bg-panel: #ffffff;
    --bg-card: #eef3f9;
    --border-subtle: rgba(19, 32, 51, 0.12);
    --border-strong: rgba(19, 32, 51, 0.22);

    --accent-success: #047857;
    --accent-warning: #b45309;
    --accent-error: #dc2626;
    --success-solid: #059669;
    --warning-solid: #f59e0b;
    --error-solid: #dc2626;
    --neutral-solid: #e3e9f2;
    --on-accent-solid: #ffffff;

    --shadow-card: 0 1px 2px rgba(19, 32, 51, .08);
    --shadow-hover: 0 1px 2px rgba(19, 32, 51, .08);
}

/* ── Surfaces ── */
.card { transition: background-color .2s var(--ease), border-color .2s var(--ease); }

/* ── Buttons: pill, flat, clear states ── */
.btn, .btn-connect-device { border-radius: 8px; }
.btn { height: 40px; padding: 0 18px; font-weight: 600; }
.btn-sm { height: 34px; padding: 0 14px; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; }
.btn, .btn-connect-device, .segmented button, .icon-btn, .theme-toggle, .nav-item, .tab, .bottom-btn {
    transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease);
}
.btn:active:not(:disabled), .btn-connect-device:active:not(:disabled), .icon-btn:active, .tab:active, .bottom-btn:active { transform: scale(0.97); }
.btn-primary { box-shadow: none; }
.btn-primary:hover:not(:disabled), .btn.primary:hover:not(:disabled) { filter: none; background: var(--accent-secondary); box-shadow: none; }
[data-theme="light"] .btn-primary:hover:not(:disabled) { background: #0369a1; }
.btn-secondary:hover:not(:disabled),
.btn:not(.btn-primary):not(.btn-danger):not(.primary):not(.danger):hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-danger:hover:not(:disabled), .btn.danger:hover:not(:disabled) { background: var(--error-solid); color: #fff; border-color: transparent; }
.btn-connect-device { font-weight: 600; }
.btn-connect-device:hover { background: var(--accent-primary); color: var(--accent-ink); border-color: transparent; }

/* ── Status: solid, readable, no glow ── */
.status-badge, .status { font-weight: 600; height: 26px; }
.status-badge.online, .status.online { background: var(--success-solid); color: var(--on-accent-solid); }
.status-badge.active, .status-badge.waiting, .status.waiting { background: var(--warning-solid); color: #2b1a00; }
.status-badge.offline, .status.offline { background: var(--neutral-solid); color: var(--text-secondary); }
.status-badge.active .dot, .status.waiting::before { animation: pulse 1.6s ease-in-out infinite; }
.device-state-pill { font-weight: 600; }
.status-pill .connected { box-shadow: none; }

/* Solid chips (no gradients, no shadows) */
.avatar { background: var(--accent-primary); color: var(--accent-ink); }
.qr-ico, .step-icon, .step-num, .feature-ico, .dev-tile, .device-icon { box-shadow: none !important; }
.device-row:hover .device-icon, .qr-cta:hover .qr-ico, .feature:hover .feature-ico, .step:hover .step-num { transform: none !important; }
.feature:hover { transform: none !important; box-shadow: var(--shadow-card) !important; }

/* ── Navigation ── */
.nav-item { border-radius: 8px; }
.nav-item.active { background: var(--accent-primary); color: var(--accent-ink); }
.nav-item:hover:not(.active) { background: var(--bg-hover); }

.segmented button.active { background: var(--accent-primary); color: var(--accent-ink); box-shadow: none; }
.segmented button.active .count { color: inherit; opacity: .75; }

/* ── Material 3 filled text fields ── */
.form-group input, .field {
    height: 50px;
    padding: 0 14px;
    background: var(--bg-card);
    border: 0;
    border-bottom: 2px solid var(--border-strong);
    border-radius: 8px 8px 0 0;
    transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.field { height: 44px; }
.form-group input:focus, .field:focus { border-bottom-color: var(--accent-primary); box-shadow: none; background: var(--bg-hover); }

/* ── Messages ── */
.message.error, .msg.err, .message.success, .msg.ok, .message.info {
    border-width: 0 0 0 4px;
    border-style: solid;
    border-radius: 8px;
    color: var(--text-primary);
}
.message.error, .msg.err { background: color-mix(in srgb, var(--error-solid) 16%, var(--bg-panel)); border-color: var(--error-solid); }
.message.success, .msg.ok { background: color-mix(in srgb, var(--success-solid) 16%, var(--bg-panel)); border-color: var(--success-solid); }
.message.info { background: color-mix(in srgb, var(--accent-primary) 14%, var(--bg-panel)); border-color: var(--accent-primary); }

/* ── Device switcher items ── */
.connect-device-item { border-radius: 10px; }
.connect-device-item:has(.device-state-pill.connected) { border: 1.5px solid var(--accent-primary); background: var(--bg-card); }

/* ==========================================================================
   One bottom bar on every page (phones): Devices · Display · Files · Account
   ========================================================================== */
.tabbar, .mobile-bottom-bar {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0));
    background: var(--bg-panel);
    border-top: 1px solid var(--border-subtle);
}
.tabbar { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; }
@media (max-width: 899.98px) {
    .tabbar { display: flex; }
    body.app .app-scroll { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0)); }
}
.tab, .bottom-btn {
    flex: 1;
    min-width: 0;
    height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
}
.tab svg, .bottom-btn svg { width: 22px; height: 22px; }
.bottom-btn span, .tab span { font-size: 11.5px; font-weight: 600; text-transform: none; }
.tab:hover, .bottom-btn:hover { color: var(--text-primary); background: transparent; }
/* active tab: icon sits in a solid pill (Material 3 navigation bar) */
.tab svg, .bottom-btn svg { box-sizing: content-box; padding: 3px 18px; border-radius: 8px; transition: background-color .15s var(--ease), color .15s var(--ease); }
.tab.active, .bottom-btn.active, .bottom-btn.current { color: var(--text-primary); background: transparent; }
.tab.active svg, .bottom-btn.active svg, .bottom-btn.current svg { background: var(--accent-primary); color: var(--accent-ink); }
.mobile-bottom-bar:has(.bottom-btn.active) .bottom-btn.current { color: var(--text-secondary); }
.mobile-bottom-bar:has(.bottom-btn.active) .bottom-btn.current svg { background: transparent; color: inherit; }

.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head a { font-size: 13px; font-weight: 600; }

/* Toast (bottom bar feedback) */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom, 0));
    transform: translateX(-50%);
    max-width: min(92vw, 420px);
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--text-primary);
    color: var(--bg-deep);
    font-size: 13.5px;
    font-weight: 500;
    z-index: 200;
    animation: toast-in .25s var(--ease) both;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── Motion: short, functional ── */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.page > *, .plain-main > * { animation: rise .3s var(--ease) both; }
.page > :nth-child(2) { animation-delay: .03s; }
.page > :nth-child(3) { animation-delay: .06s; }
.page > :nth-child(4) { animation-delay: .09s; }
.user-menu.open .user-dropdown { animation: pop .16s var(--ease) both; }
.mobile-panel-content.active { animation: sheet-up .25s var(--ease) both; }
.qr-box { animation: pop .2s var(--ease) both; }
.highlight-row { animation: flash 1.4s var(--ease); }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--accent-primary) 18%, transparent); } 100% { background: transparent; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ── 5-tab bar ── */
.tab svg, .bottom-btn svg { padding: 3px 14px; }
.tab span, .bottom-btn span { font-size: 11px; }
@media (max-width: 360px) { .tab svg, .bottom-btn svg { padding: 3px 9px; } }

/* ── Device picker sheet (Devices tab) ── */
.picker { position: fixed; inset: 0; z-index: 120; display: none; }
.picker.open { display: block; }
.picker-scrim { position: absolute; inset: 0; background: rgba(2, 6, 12, .55); animation: fade .2s var(--ease) both; }
.picker-sheet {
    position: absolute; left: 0; right: 0; bottom: 0;
    max-height: 78vh; overflow-y: auto;
    background: var(--bg-panel);
    border-radius: 12px 12px 0 0;
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0));
    animation: sheet-up .25s var(--ease) both;
}
.picker-sheet::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: 0 auto 14px; }
@media (min-width: 900px) {
    .picker-sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 480px; transform: translate(-50%, -50%); border-radius: var(--radius-xl); animation: pop .2s var(--ease) both; }
    .picker-sheet::before { display: none; }
}
.picker-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.picker-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; background: var(--bg-card); border: 1px solid var(--border-subtle); }
.picker-item.is-last { border-color: var(--accent-primary); }
.picker-icon { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; background: var(--bg-panel); color: var(--text-secondary); }
.picker-icon.online { background: var(--success-solid); color: var(--on-accent-solid); }
.picker-icon .dev-glyph { width: 26px; height: 26px; }
.picker-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.picker-main a { color: var(--text-primary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-main small { color: var(--text-secondary); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.picker-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.picker-dot.online { background: var(--success-solid); }
.picker-dot.waiting { background: var(--warning-solid); }
.picker-actions { display: flex; gap: 6px; flex-shrink: 0; }
.picker-actions .btn { height: 38px; }
@media (max-width: 380px) { .picker-item { flex-wrap: wrap; } .picker-actions { width: 100%; } .picker-actions .btn { flex: 1; } }

/* ── Title + device switcher (Display, Files) ── */
.ws-name { font-family: "Conthrax", var(--font-sans); font-weight: 600; font-size: 15px; flex-shrink: 0; }
.dev-switch { position: relative; min-width: 0; }
.dev-switch-btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 36px; max-width: 260px; padding: 0 10px 0 14px;
    border-radius: 8px; border: 1px solid var(--border-strong);
    background: var(--bg-card); color: var(--text-primary);
    font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.dev-switch-btn:hover, .dev-switch.open .dev-switch-btn { border-color: var(--accent-primary); }
.dev-switch-btn svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.dev-switch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dev-switch-menu {
    display: none; position: absolute; top: calc(100% + 8px); left: 0;
    width: 300px; max-width: calc(100vw - 24px); max-height: 60vh; overflow-y: auto;
    background: var(--bg-panel); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 90;
}
.dev-switch.open .dev-switch-menu { display: block; animation: pop .16s var(--ease) both; }
.dev-switch-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 8px;
    background: transparent; color: var(--text-primary); text-align: left; cursor: pointer;
}
.dev-switch-item:hover { background: var(--bg-hover); }
.dev-switch-item.current { background: var(--bg-card); }
.dsi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dsi-main strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsi-main small { color: var(--text-muted); font-size: 12px; font-family: var(--font-mono); }
.dsi-check { color: var(--accent-primary); font-weight: 700; }
.dev-switch-all { display: block; padding: 10px; margin-top: 4px; border-top: 1px solid var(--border-subtle); font-size: 13px; font-weight: 600; }
@media (max-width: 899.98px) {
    .ws-name { font-size: 14px; }
    .ws-title { gap: 10px; }
    .dev-switch-btn { max-width: 46vw; height: 34px; padding: 0 8px 0 12px; font-size: 13px; }
}
@media (max-width: 899.98px) {
    /* Files: keep the connection pill as a compact dot so title + device fit */
    .ws-bar .status-pill { padding: 0; width: 28px; justify-content: center; }
    .ws-bar .status-pill span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* ── Phones: bottom bar replaces the menu button ── */
@media (max-width: 899.98px) {
    .topbar [data-nav-toggle], .ws-bar .nav-toggle { display: none !important; }
    .topbar { padding-left: 16px; }
    .ws-bar { padding-left: 12px; }
}

/* ── Settings sheet ── */
.settings .picker-sheet { padding-top: 12px; }
.set-account {
    display: flex; align-items: center; gap: 14px;
    padding: 14px; border-radius: 10px;
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    color: var(--text-primary); text-decoration: none !important;
}
.set-account .avatar { width: 44px; height: 44px; font-size: 16px; }
.set-account .avatar svg { width: 24px; height: 24px; }
.set-account .set-text { font-size: 16px; font-weight: 600; }
.set-group-label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin: 18px 4px 8px; }
.set-group { border-radius: 10px; background: var(--bg-card); border: 1px solid var(--border-subtle); overflow: hidden; }
.set-row {
    display: flex; align-items: center; gap: 14px; width: 100%;
    min-height: 56px; padding: 10px 14px;
    border: 0; border-bottom: 1px solid var(--border-subtle);
    background: transparent; color: var(--text-primary); text-align: left;
    text-decoration: none !important; cursor: pointer; font-size: 15px;
}
.set-row:last-child { border-bottom: 0; }
.set-row:hover { background: var(--bg-hover); }
.set-ico { width: 34px; height: 34px; border-radius: 6px; display: grid; place-items: center; background: var(--bg-panel); color: var(--text-secondary); flex-shrink: 0; }
.set-ico svg { width: 18px; height: 18px; }
.set-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 500; }
.set-text small { font-size: 12.5px; color: var(--text-muted); font-weight: 400; margin-top: 1px; }
.set-row > svg:last-child, .set-account > svg:last-child { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.switch { position: relative; width: 50px; height: 30px; border-radius: 15px; background: var(--border-strong); flex-shrink: 0; transition: background-color .2s var(--ease); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .2s var(--ease); }
[aria-checked="true"] .switch { background: var(--accent-primary); }
[aria-checked="true"] .switch::after { transform: translateX(20px); }
.set-signout {
    width: 100%; height: 50px; margin-top: 18px;
    border-radius: 8px; border: 1px solid color-mix(in srgb, var(--error-solid) 45%, transparent);
    background: transparent; color: var(--accent-error); font-weight: 600; font-size: 15px; cursor: pointer;
}
@media (hover: hover) { .set-signout:hover { background: var(--error-solid); color: #fff; } }

/* ── Theme switch: every surface changes colour together, same duration and easing ── */
html.theme-changing *, html.theme-changing *::before, html.theme-changing *::after {
    transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease),
                fill .3s var(--ease), stroke .3s var(--ease), box-shadow .3s var(--ease) !important;
    transition-delay: 0s !important;
}
html.theme-changing body { transition: background-color .3s var(--ease), color .3s var(--ease) !important; }

/* ── Dark: dark gray base, slightly lighter surfaces (light theme unaffected) ── */
:root:not([data-theme="light"]) {
    --bg-deep: #0e1116;
    --grid-overlay: rgba(14, 17, 22, 0.93);       /* grid kept, as faint lines on the base */
    --bg-sidebar: #0b0e12;
    --bg-panel: #151920;
    --bg-card: #1c212a;
    --bg-input: #1c212a;
    --bg-hover: rgba(255, 255, 255, 0.06);
    --header-bg: rgba(11, 14, 18, 0.94);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --neutral-solid: #1f242d;
    --text-primary: #f2f5f9;
    --text-secondary: #aeb8c7;
    --text-muted: #7d8899;
    --shadow-card: none;
    --shadow-pop: 0 16px 40px -12px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, 0.10);
    --on-bg-muted: rgba(242, 245, 249, 0.72);
}
[data-theme="light"] { --bg-sidebar: rgba(255, 255, 255, 0.96); --bg-input: #ffffff; --header-bg: rgba(255, 255, 255, 0.95); }
:root:not([data-theme="light"]) .display-area { background: #12161c; }
:root:not([data-theme="light"]) .picker-scrim, :root:not([data-theme="light"]) .scrim { background: rgba(0, 0, 0, .7); }
/* Light: original grid tile, a bit less washed out */
[data-theme="light"] { --grid-overlay: rgba(255, 255, 255, 0.4); }
/* Dark: same 26px grid as grid.png, drawn as faint lines on the dark base (the PNG is a light tile) */
:root:not([data-theme="light"]) body {
    background-color: #0e1116;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 26px 26px;
}

/* Dark mode: slightly deeper accents so solid fills don't jump out on black */
:root:not([data-theme="light"]) {
    --accent-primary: #1ab4cc;
    --accent-secondary: #1597ac;
    --accent-success: #3cc995;
    --accent-warning: #e9ae2a;
    --success-solid: #2db383;
    --warning-solid: #e3a523;
    --error-solid: #d64545;
    --accent-ink: #031a20;
    --on-accent-solid: #04150f;
}

/* ── Compact rail (Display / Files): five destinations + help under the divider ── */
.rail-nav button.nav-item { border: 0; background: transparent; cursor: pointer; font: inherit; color: var(--text-secondary); }
.rail-nav button.nav-item.active { background: var(--accent-primary); color: var(--accent-ink); }
.rail-nav button.nav-item:hover:not(.active) { background: var(--bg-hover); color: var(--text-primary); }
.rail-hidden { display: none !important; }
body.rail .sidebar-footer.rail-help { flex-direction: column; align-items: center; gap: 2px; }
.sidebar-footer.rail-help .nav-item { color: var(--text-muted); }
.sidebar-footer.rail-help .nav-item:hover { color: var(--text-primary); }
@media (min-width: 900px) { body.rail .sidebar.rail-nav .nav { gap: 4px; } }

/* ── Device panels: off devices get "Turn on" instead of "Open" ── */
.connect-device-item.is-off .btn-connect-device:not(.turn-on) { display: none; }
.btn-connect-device.turn-on { background: var(--accent-primary); color: var(--accent-ink); border-color: transparent; min-width: 76px; display: inline-flex; align-items: center; justify-content: center; }
.btn-connect-device.turn-on:hover { background: var(--accent-secondary); }
.device-state-pill.waiting { color: var(--accent-warning); }
.device-state-pill.offline { color: var(--text-muted); }
.off-devices { margin-top: 16px; }
.off-title { font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin: 0 2px 8px; }
.off-devices .connect-device-item { background: transparent; }

/* Desktop: centre picker/settings dialogs with flexbox (the open animation owns `transform`) */
@media (min-width: 900px) {
    .picker.open { display: flex; align-items: center; justify-content: center; padding: 24px; }
    .picker-sheet {
        position: relative; left: auto; right: auto; top: auto; bottom: auto;
        transform: none; width: 480px; max-width: 100%; max-height: calc(100vh - 48px);
        padding: 20px; border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
    }
}

/* ── Unified sidebar (all pages) ── */
.sidebar button.nav-item { width: 100%; border: 0; background: transparent; cursor: pointer; font: inherit; font-weight: 500; color: var(--text-secondary); text-align: left; }
.sidebar button.nav-item.active { background: var(--accent-primary); color: var(--accent-ink); }
.sidebar button.nav-item:hover:not(.active) { background: var(--bg-hover); color: var(--text-primary); }
.sidebar .help-nav { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.sidebar .help-nav .nav-label { padding-top: 0; }
.sidebar .help-nav .nav-item:not(.active) { color: var(--text-muted); }
.sidebar .sidebar-footer { margin-top: 8px; }
.theme-holder { display: none; }
@media (min-width: 900px) {
    body.rail .sidebar .help-nav .nav-label { display: none; }
    body.rail .sidebar .help-nav { align-items: center; width: 100%; }
    body.rail .sidebar button.nav-item { width: 44px; }
}

/* Fixed grid slots: elements injected into <body> (browser extensions, widgets)
   must not take the sidebar's or the content's place */
body.app { grid-template-rows: minmax(0, 1fr); grid-auto-rows: 0; grid-auto-columns: 0; }
body.app > .sidebar { grid-column: 1; grid-row: 1; }
body.app > .app-main { grid-column: 2; grid-row: 1; }
@media (max-width: 899.98px) { body.app > .app-main { grid-column: 1; } }

/* ── Brand: full Bedrock wordmark; speaker mark in the icon rail ── */
.brand { display: block; padding: 2px 8px 18px; }
.brand-full { display: flex; flex-direction: column; gap: 4px; }
.brand .brand-logo, .brand-row .brand-logo { width: 168px; max-width: 100%; height: auto; object-fit: contain; }
.brand-full .brand-sub, .brand-row .brand-sub { font-size: 11.5px; font-weight: 500; letter-spacing: .04em; color: var(--text-muted); padding-left: 2px; border: 0; margin: 0; }
.brand-icon { display: none; }
.brand .brand-icon img { width: 30px; height: 30px; object-fit: contain; margin: 0 auto; }
@media (min-width: 900px) {
    body.rail .brand-full { display: none; }
    body.rail .brand-icon { display: block; }
    body.rail .brand { padding: 4px 0 18px; }
}
.brand-row { flex-direction: column; align-items: flex-start; gap: 2px; }
.brand-row .brand-logo { width: 150px; }
.brand-row { display: flex; }

/* ── Scale the interface up on large screens (steps). The display canvas is never
      inside a zoomed element, so its pointer/touch mapping is unaffected. ── */
:root { --ui-zoom: 1; }
@media (min-width: 1700px) and (min-height: 820px)  { :root { --ui-zoom: 1.1; } }
@media (min-width: 1900px) and (min-height: 900px)  { :root { --ui-zoom: 1.2; } }
@media (min-width: 2200px) and (min-height: 1000px) { :root { --ui-zoom: 1.3; } }
@media (min-width: 2500px) and (min-height: 1100px) { :root { --ui-zoom: 1.4; } }
@media (min-width: 3000px) and (min-height: 1400px) { :root { --ui-zoom: 1.6; } }
@media (min-width: 900px) {
    body.app { grid-template-columns: calc(var(--sidebar-w) * var(--ui-zoom)) minmax(0, 1fr); }
    body.app.rail { grid-template-columns: calc(var(--rail-w) * var(--ui-zoom)) minmax(0, 1fr); }
    .sidebar, .page, .ws-bar, .side-panel > *, .desktop-side-panel > *, .files-main > *,
    .picker-sheet, .qr-box, .toast, .plain-top, .plain-main > *, .plain-foot { zoom: var(--ui-zoom); }
}

/* Phone top bar: grow with the status-bar inset instead of squeezing the content
   (fixed 56px + padding-top pushed the title and Scan QR below the border) */
.topbar { height: auto; min-height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); }

/* "Remote Connect" under the logo: same face as the Bedrock wordmark */
.brand-full .brand-sub, .brand-row .brand-sub {
    font-family: "Conthrax", var(--font-sans);
    font-weight: 600;
    font-size: 10.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* Centred under the logo, coloured like the wordmark (BED navy, ROCK maroon; white logo in dark) */
.brand-full { align-items: center; }
.brand-row { align-items: center; }
.brand-full .brand-sub, .brand-row .brand-sub { text-align: center; padding-left: 0; }
.brand-sub .bs-a { background: linear-gradient(90deg, #242165, #0c0b40); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub .bs-b { color: #581430; }
:root:not([data-theme="light"]) .brand-sub .bs-a { background: none; color: #fcfcfc; }
:root:not([data-theme="light"]) .brand-sub .bs-b { color: #fcfcfc; }

/* ── Phone headers: one compact style on every page (dashboard top bar = Display/Files bar) ── */
.ws-logo { display: none; }
@media (max-width: 899.98px) {
    .topbar, .ws-bar {
        height: auto;
        min-height: calc(48px + env(safe-area-inset-top, 0px));
        padding: env(safe-area-inset-top, 0px) 12px 0;
        gap: 8px;
    }
    .topbar-title { gap: 8px; }
    .topbar-title span, .ws-name { font-family: "Conthrax", var(--font-sans); font-size: 15px; font-weight: 600; }
    .topbar-title img, .ws-logo img { width: 22px; height: 22px; object-fit: contain; }
    .ws-logo { display: flex; align-items: center; flex-shrink: 0; }
    .ws-title { gap: 8px; }
    .topbar .btn, .ws-actions .btn { height: 34px; }
    .ws-actions #fullscreenBtn { width: 34px !important; }
    .dev-switch-btn { height: 32px; max-width: 44vw; }
}

/* ── Bedrock Android app (WebView): the app already keeps the page below the
      status bar, but the WebView still reports a top inset - ignore only that.
      The bottom inset is real (page runs behind the navigation bar), keep it. ── */
html.in-app .sidebar { padding-top: 18px !important; }
html.in-app .topbar, html.in-app .ws-bar { padding-top: 0 !important; min-height: 48px !important; }
html.in-app .plain-top { padding-top: 12px !important; }
