.v5-page {
    align-items: stretch;
    flex-direction: column;
    height: 100vh;
    justify-content: flex-start;
    min-height: 0;
    overflow: hidden;
    width: 100%;
}

.v5-page .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.v5-page .brand {
    justify-self: start;
}

.v5-page .topbar-right {
    justify-self: end;
}

.app-nav {
    align-self: stretch;
    display: flex;
    justify-content: center;
}

.app-nav-link {
    align-items: center;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    display: inline-flex;
    font-size: 14px;
    font-weight: 650;
    padding: 0 16px;
    text-decoration: none;
}

.app-nav-link:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.app-nav-link.active {
    border-bottom-color: var(--brand);
    color: var(--text);
}

.v5-dashboard {
    display: flex;
    flex: 1;
    flex-direction: column;
    margin: 0;
    max-width: none;
    min-height: 0;
    overflow: hidden;
    padding: 64px 0 0;
    width: 100%;
}

.v5-dashboard-panel {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    width: 100%;
}

#dashboard-sessions-panel {
    display: flex;
}

#dashboard-shared-panel {
    display: flex;
    padding: 0 32px 24px;
}

#page-sessions .agent-list-panel {
    border: 0;
    border-radius: 0;
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#page-sessions .agent-top-list {
    align-content: start;
    flex: 1;
    grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr));
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    width: 100%;
}

#page-sessions #dashboard-monitor-panel {
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 32px 24px;
}

#page-sessions .monitor-toolbar {
    background: var(--bg);
    margin-bottom: 0;
    padding: 12px 0 14px;
    position: sticky;
    top: 0;
    z-index: 2;
}

#page-sessions .monitor-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr));
}

#page-sessions .shared-storage-panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    height: calc(100vh - 190px);
    min-height: 0;
}

.shared-storage-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.shared-storage-browser {
    display: grid;
    flex: 1;
    grid-template-columns: minmax(220px, 26%) minmax(0, 1fr);
    min-height: 0;
    position: relative;
}

.shared-storage-browser.shared-storage-dragging,
.shared-storage-browser.shared-storage-uploading {
    background: var(--brand-soft);
    outline: 2px dashed var(--brand);
    outline-offset: -8px;
}

.shared-storage-browser.shared-storage-dragging::after,
.shared-storage-browser.shared-storage-uploading::after {
    align-items: center;
    background: rgba(232, 243, 246, 0.92);
    border: 1px solid #9bcbd9;
    border-radius: 8px;
    color: var(--brand-strong);
    content: "Drop files or folders on a directory";
    display: flex;
    font-size: 14px;
    font-weight: 700;
    inset: 12px;
    justify-content: center;
    pointer-events: none;
    position: absolute;
    z-index: 4;
}

.shared-storage-browser.shared-storage-uploading::after {
    content: "Uploading...";
}

.shared-storage-tree {
    border-right: 1px solid var(--border);
    min-height: 0;
    overflow: auto;
    padding: 8px;
    white-space: nowrap;
}

.shared-storage-tree .jstree-anchor {
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    min-height: 30px;
    padding: 3px 8px 3px 4px;
    white-space: nowrap;
}

.shared-storage-tree .jstree-anchor:hover,
.shared-storage-tree .jstree-wholerow-hovered {
    background: var(--surface-muted);
}

.shared-storage-tree .jstree-clicked,
.shared-storage-tree .jstree-wholerow-clicked {
    background: var(--surface-muted);
    box-shadow: inset 0 0 0 1px var(--border);
}

.shared-storage-tree .jstree-icon {
    color: var(--text-soft);
}

.shared-storage-preview {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.shared-storage-preview-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 14px;
}

.shared-storage-preview-header h3 {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.shared-storage-preview-content {
    background: var(--surface-muted);
    border: 0;
    color: var(--text);
    flex: 1;
    font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
    min-height: 0;
    overflow: auto;
    padding: 14px;
    white-space: pre-wrap;
}

.shared-storage-preview-note {
    background: var(--brand-soft);
    border-bottom: 1px solid var(--border);
    color: var(--brand-strong);
    font-size: 12px;
    margin: 0;
    padding: 8px 14px;
}

@media (max-width: 760px) {
    #page-sessions .shared-storage-panel {
        height: auto;
        min-height: 560px;
    }

    .shared-storage-browser {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(220px, 42%) minmax(260px, 1fr);
    }

    .shared-storage-tree {
        border-bottom: 1px solid var(--border);
        border-right: 0;
    }
}

.v5-session-page {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

.native-session-shell {
    display: flex;
    flex: 1;
    flex-direction: column;
    height: calc(100vh - 128px);
    margin-top: 64px;
    min-height: 0;
    overflow: hidden;
}

.native-workbench-stage {
    background: #0f141c;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.native-workbench-frame {
    background: #0f141c;
    border: 0;
    display: block;
    height: 100%;
    width: 100%;
}

.native-workbench-frame[hidden],
.native-workbench-state[hidden] {
    display: none;
}

.native-workbench-state {
    align-items: center;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    inset: 0;
    justify-content: center;
    padding: 32px;
    position: absolute;
    text-align: center;
}

.native-workbench-state strong {
    color: #f8fafc;
    font-size: 16px;
}

.native-workbench-state > span {
    color: #94a3b8;
    max-width: 520px;
}

.native-workbench-state .spinner {
    margin-bottom: 4px;
}

@media (max-width: 760px) {
    .v5-page .brand > span {
        display: none;
    }

    .app-nav-link {
        padding: 0 10px;
    }
}

@media (max-width: 520px) {
    .v5-page .user-profile {
        display: none;
    }

    .app-nav-link {
        font-size: 13px;
        padding: 0 8px;
    }
}
