/* ===== Google Drive UI ===== */
:root {
    --gd-bg: #f8f9fa;
    --gd-surface: #ffffff;
    --gd-sidebar: #f0f4f9;
    --gd-text: #1f1f1f;
    --gd-text-2: #444746;
    --gd-text-3: #5f6368;
    --gd-blue: #0b57d0;
    --gd-blue-light: #c2e7ff;
    --gd-blue-surface: #d3e3fd;
    --gd-border: #e0e3e7;
    --gd-search: #e9eef6;
    --gd-hover: rgba(68, 71, 70, 0.08);
    --gd-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    --gd-shadow-lg: 0 4px 8px 3px rgba(60, 64, 67, 0.15), 0 1px 3px rgba(60, 64, 67, 0.3);
    --gd-radius: 12px;
    --gd-radius-pill: 24px;
    --sidebar-w: 256px;
    --header-h: 64px;
    --font: 'Google Sans', 'Roboto', Arial, sans-serif;
}

[data-theme="dark"] {
    --gd-bg: #131314;
    --gd-surface: #1e1f20;
    --gd-sidebar: #1e1f20;
    --gd-text: #e3e3e3;
    --gd-text-2: #c4c7c5;
    --gd-text-3: #9aa0a6;
    --gd-blue: #8ab4f8;
    --gd-blue-light: #394457;
    --gd-blue-surface: #394457;
    --gd-border: #3c4043;
    --gd-search: #303134;
    --gd-hover: rgba(255, 255, 255, 0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font);
    font-size: 14px;
    color: var(--gd-text);
    background: var(--gd-bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* Mobile nav (hidden on desktop) */
.mobile-menu-btn { display: none; }
.sidebar-backdrop { display: none; }
.mobile-fab { display: none; }

.material-icons-round {
    font-family: 'Material Icons Round';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

/* ===== App shell ===== */
.drive-app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--gd-sidebar);
    display: flex;
    flex-direction: column;
    padding: 8px 12px 24px;
    overflow: hidden;
}

.brand {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 8px 20px 12px;
    text-decoration: none;
    color: var(--gd-text-2);
}
.brand-text {
    font-family: var(--font);
    font-size: 22px;
    font-weight: 400;
    color: var(--gd-text-2);
    letter-spacing: -0.5px;
}

.new-wrap { position: relative; margin-bottom: 8px; }

.btn-new {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 26px 0 16px;
    height: 48px;
    border: none;
    border-radius: var(--gd-radius-pill);
    background: var(--gd-surface);
    color: var(--gd-text-2);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--gd-shadow);
    transition: box-shadow 0.2s, background 0.2s;
}
.btn-new:hover { box-shadow: var(--gd-shadow-lg); }
.btn-new .material-icons-round { font-size: 22px; color: var(--gd-text-2); }

.new-menu {
    position: absolute;
    top: 52px;
    left: 0;
    z-index: 200;
    min-width: 300px;
    background: var(--gd-surface);
    border-radius: 4px;
    box-shadow: var(--gd-shadow-lg);
    padding: 8px 0;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 10px 24px;
    border: none;
    background: none;
    font-family: var(--font);
    font-size: 14px;
    color: var(--gd-text);
    cursor: pointer;
    text-align: left;
}
.menu-item:hover { background: var(--gd-hover); }
.new-menu hr { border: none; border-top: 1px solid var(--gd-border); margin: 6px 0; }
.mi-folder { color: #5f6368 !important; }
[data-theme="dark"] .mi-folder { color: #9aa0a6 !important; }
.mi-doc { color: #4285f4 !important; }
.mi-sheet { color: #0f9d58 !important; }
.mi-slide { color: #f4b400 !important; }
.mi-form { color: #673ab7 !important; }

.sidebar-nav { flex: 1; overflow-y: auto; padding-top: 4px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 8px 24px;
    margin: 2px 0;
    border-radius: var(--gd-radius-pill);
    text-decoration: none;
    color: var(--gd-text);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
}
.nav-item .material-icons-round { font-size: 22px; color: var(--gd-text-3); }
.nav-item:hover { background: var(--gd-hover); }
.nav-item.active {
    background: var(--gd-blue-surface);
    color: #001d35;
}
[data-theme="dark"] .nav-item.active { color: var(--gd-blue); }
.nav-item.active .material-icons-round { color: inherit; }

.sidebar-bottom { margin-top: auto; }
.storage-indicator { padding: 12px 16px; font-size: 12px; color: var(--gd-text-3); }
.storage-bar { height: 4px; background: var(--gd-border); border-radius: 4px; margin-bottom: 8px; overflow: hidden; }
.storage-fill { height: 100%; background: var(--gd-blue); border-radius: 4px; transition: width 0.4s ease; }
.sidebar-tools { display: flex; gap: 4px; padding: 0 8px; }

/* ===== Main area ===== */
.main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--gd-bg);
}

.top-header {
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--header-h);
    padding: 8px 24px 8px 8px;
    flex-shrink: 0;
}

.search-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    max-width: 720px;
    height: 48px;
    background: var(--gd-search);
    border-radius: var(--gd-radius-pill);
    padding: 0 8px 0 16px;
    transition: background 0.2s, box-shadow 0.2s;
}
.search-wrap:focus-within {
    background: var(--gd-surface);
    box-shadow: var(--gd-shadow);
}
.search-icon { color: var(--gd-text-3); font-size: 22px !important; margin-right: 8px; }
#searchInput {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font);
    font-size: 16px;
    color: var(--gd-text);
    outline: none;
    min-width: 0;
}
.search-filter-btn { flex-shrink: 0; }

.header-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: default;
    margin-left: 4px;
    overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ===== Content ===== */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 48px;
}

.filter-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0 16px;
}
.chip {
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--gd-border);
    background: var(--gd-surface);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    color: var(--gd-text-2);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.chip:hover { background: var(--gd-hover); }
.chip.active {
    background: var(--gd-blue-surface);
    border-color: transparent;
    color: #001d35;
}
[data-theme="dark"] .chip.active { color: var(--gd-blue); }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--gd-text-3);
    padding-bottom: 12px;
    flex-wrap: wrap;
}
.breadcrumb a { color: var(--gd-blue); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.content-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    margin-bottom: 16px;
    position: relative;
    min-height: 48px;
}
.content-toolbar h1 {
    font-size: 24px;
    font-weight: 400;
    color: var(--gd-text);
    letter-spacing: -0.3px;
    flex: 1;
    min-width: 0;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.content-toolbar.has-selection h1 {
    visibility: hidden;
}
.toolbar-right {
    display: flex;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

.selection-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    padding: 6px 12px;
    background: var(--gd-blue-surface);
    border-radius: 24px;
    position: absolute;
    left: 0;
    right: 52px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    max-width: calc(100% - 52px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    animation: selectionBarIn 0.15s ease;
}
[data-theme="dark"] .selection-bar {
    background: rgba(138, 180, 248, 0.15);
}
@keyframes selectionBarIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.selection-count {
    font-size: 14px;
    font-weight: 500;
    color: var(--gd-text);
    white-space: nowrap;
}
.selection-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-selection {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: none;
    border-radius: 20px;
    background: var(--gd-surface);
    color: var(--gd-text);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    transition: background 0.15s, box-shadow 0.15s;
}
.btn-selection:hover { box-shadow: var(--gd-shadow); }
.btn-selection .material-icons-round { font-size: 18px; }
.btn-selection-danger { color: #d93025; }
.btn-selection-danger:hover { background: #fce8e6; }
[data-theme="dark"] .btn-selection-danger:hover { background: rgba(217, 48, 37, 0.2); }
.btn-selection:disabled { opacity: 0.6; cursor: wait; }

.section-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--gd-text-3);
    margin-bottom: 12px;
    letter-spacing: 0.2px;
}
.suggested-section { margin-bottom: 28px; }

/* Marquee (drag) selection — Windows Explorer style */
.selection-marquee {
    position: fixed;
    z-index: 500;
    border: 1px solid var(--gd-blue);
    background: rgba(11, 87, 208, 0.15);
    border-radius: 2px;
    pointer-events: none;
    display: none;
    box-sizing: border-box;
}
.selection-marquee.visible { display: block; }
[data-theme="dark"] .selection-marquee {
    background: rgba(138, 180, 248, 0.2);
    border-color: #8ab4f8;
}

body.marquee-selecting {
    cursor: crosshair;
    user-select: none !important;
    -webkit-user-select: none !important;
}
body.marquee-selecting * {
    user-select: none !important;
    -webkit-user-select: none !important;
}
body.marquee-selecting input,
body.marquee-selecting textarea {
    user-select: text !important;
    -webkit-user-select: text !important;
}

#filesSection,
#homeDashboard {
    touch-action: pan-y;
}
body.marquee-selecting #filesSection,
body.marquee-selecting #homeDashboard {
    touch-action: none;
}

.files-section,
.home-dashboard,
.files-container,
.file-card,
.file-name,
.file-meta,
.list-name-cell {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}
.file-card {
    -webkit-user-drag: none;
    user-drag: none;
}

/* ===== File grid (Google Drive cards) ===== */
.files-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(152px, 176px));
    justify-content: start;
    align-content: start;
    gap: 10px;
    width: 100%;
}
.files-container.list-view { display: block; }

/* Skeleton sits outside grid flow */
.skeleton-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(152px, 176px));
    justify-content: start;
    gap: 10px;
    width: 100%;
}
.skeleton-grid.is-loading {
    display: grid;
}

.file-card {
    position: relative;
    width: 100%;
    max-width: 176px;
    background: var(--gd-surface);
    border: 1px solid var(--gd-border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
    animation: cardIn 0.25s ease;
}
.file-card:hover {
    box-shadow: var(--gd-shadow);
    border-color: transparent;
}
.file-card.selected {
    outline: 2px solid var(--gd-blue);
    outline-offset: -2px;
    background: var(--gd-blue-surface);
    border-color: transparent;
}
[data-theme="dark"] .file-card.selected {
    background: rgba(138, 180, 248, 0.12);
}
.grid-view .file-card.selected {
    box-shadow: 0 0 0 2px var(--gd-blue);
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.file-preview {
    height: 112px;
    min-height: 112px;
    max-height: 112px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f3f4;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
[data-theme="dark"] .file-preview { background: #2d2e30; }
.file-preview .material-icons-round { font-size: 40px; }

/* Photo / video thumbnails — always fit inside card, never full size */
.file-preview.has-thumb {
    background: #e8eaed;
    padding: 0;
}
[data-theme="dark"] .file-preview.has-thumb { background: #3c4043; }
.file-preview.has-thumb > .material-icons-round { display: none; }
.file-preview.has-thumb .thumb-fallback {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.file-preview.has-thumb .thumb-fallback .material-icons-round { display: flex; font-size: 40px; }
.file-preview.has-thumb:not(:has(.file-thumb:not([style*="display: none"]))) .thumb-fallback,
.file-preview.has-thumb.thumb-failed .thumb-fallback {
    display: flex;
}
.file-preview.has-thumb .file-thumb,
.file-preview.has-thumb video.file-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: block;
    pointer-events: none;
    object-fit: cover;
}
.file-preview.image.has-thumb .file-thumb {
    object-fit: contain;
    background: #1a1a1a;
}
[data-theme="dark"] .file-preview.image.has-thumb .file-thumb {
    background: #131314;
}
.file-preview.has-thumb video.file-thumb {
    object-fit: cover;
    background: #000;
}
.thumb-play-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
}
.thumb-play-badge .material-icons-round { font-size: 20px; display: flex; }

.list-file-thumb {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e8eaed;
}
.list-video-thumb {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
}
.list-video-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}
.list-video-thumb > .material-icons-round {
    position: absolute;
    inset: 0;
    margin: auto;
    font-size: 18px;
    color: #fff;
    width: 18px;
    height: 18px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    pointer-events: none;
}
.file-preview.folder .material-icons-round { color: #5f6368; }
.file-preview.doc .material-icons-round { color: #4285f4; }
.file-preview.sheet .material-icons-round { color: #0f9d58; }
.file-preview.slide .material-icons-round { color: #f4b400; }
.file-preview.pdf .material-icons-round { color: #ea4335; }
.file-preview.image .material-icons-round { color: #9334e6; }
.file-preview.video .material-icons-round { color: #ea4335; }
.file-preview.music .material-icons-round { color: #1a73e8; }
.file-preview.rar .material-icons-round { color: #e8710a; }
.file-preview.file .material-icons-round { color: #5f6368; }

.file-card-body { padding: 8px 10px 10px; }
.file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--gd-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.file-meta { font-size: 11px; color: var(--gd-text-3); margin-top: 2px; }

.star-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.file-card:hover .star-btn, .file-card.starred .star-btn { opacity: 1; }
.star-btn .material-icons-round { font-size: 18px; color: var(--gd-text-3); }
.star-btn.starred .material-icons-round { color: #f4b400; }

/* List view — Google Drive table */
.files-section {
    position: relative;
    min-height: 200px;
}
.files-container.list-view {
    padding: 0 8px 24px;
}
.list-header {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(120px, 180px) minmax(120px, 180px) 40px;
    align-items: center;
    gap: 16px;
    padding: 10px 20px 10px 56px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gd-text-3);
    border-bottom: 1px solid var(--gd-border);
    margin-bottom: 2px;
    user-select: none;
}
.list-view .file-card {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(120px, 180px) minmax(120px, 180px) 40px;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: none;
    background: transparent;
    border: none;
    border-radius: 24px;
    padding: 0 12px 0 8px;
    min-height: 48px;
    margin: 0;
    animation: none;
    transition: background 0.15s;
}
.list-view .file-card:hover { box-shadow: none; background: var(--gd-hover); }
.list-view .file-card.selected {
    box-shadow: none;
    background: var(--gd-blue-surface);
    outline: none;
}
[data-theme="dark"] .list-view .file-card.selected {
    background: rgba(138, 180, 248, 0.15);
}
.list-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 8px 0;
}
.list-file-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.list-file-icon .material-icons-round { font-size: 20px; }
.list-file-icon.folder .material-icons-round { color: #5f6368; }
.list-file-icon.doc .material-icons-round { color: #4285f4; }
.list-file-icon.sheet .material-icons-round { color: #0f9d58; }
.list-file-icon.slide .material-icons-round { color: #f4b400; }
.list-file-icon.pdf .material-icons-round { color: #ea4335; }
.list-file-icon.image .material-icons-round { color: #9334e6; }
.list-file-icon.video .material-icons-round { color: #ea4335; }
.list-file-icon.music .material-icons-round { color: #1a73e8; }
.list-file-icon.rar .material-icons-round { color: #e8710a; }
.list-file-icon.file .material-icons-round { color: #5f6368; }
[data-theme="dark"] .list-file-icon.folder .material-icons-round,
[data-theme="dark"] .list-file-icon.file .material-icons-round { color: #9aa0a6; }

.list-view .file-name {
    padding: 0;
    font-size: 13px;
    font-weight: 400;
}
.list-view .file-meta {
    margin: 0;
    font-size: 13px;
    color: var(--gd-text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-view .star-btn {
    position: static;
    justify-self: end;
    opacity: 0;
    background: none;
    box-shadow: none;
    width: 36px;
    height: 36px;
}
.list-view .file-card:hover .star-btn,
.list-view .file-card.starred .star-btn,
.list-view .file-card.selected .star-btn {
    opacity: 1;
}

/* Skeleton cards */
.skeleton-card {
    background: var(--gd-surface);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--gd-border);
}
.skeleton-preview {
    height: 112px;
    background: linear-gradient(90deg, #e8eaed 25%, #f1f3f4 50%, #e8eaed 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
.skeleton-line {
    height: 12px;
    margin: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e8eaed 25%, #f1f3f4 50%, #e8eaed 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
.skeleton-line.short { width: 55%; margin-top: 8px; }
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--gd-text-3);
}
.empty-state img { margin-bottom: 16px; opacity: 0.7; }
.empty-state p { font-size: 16px; margin-bottom: 24px; color: var(--gd-text-2); }

/* Info panel */
.main-wrap { position: relative; }
.info-panel {
    position: absolute;
    top: var(--header-h);
    right: 0;
    bottom: 0;
    width: 320px;
    background: var(--gd-surface);
    border-left: 1px solid var(--gd-border);
    padding: 20px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: -2px 0 8px rgba(0,0,0,0.06);
    transition: transform 0.25s ease;
}
.info-panel.hidden { transform: translateX(100%); pointer-events: none; }
.info-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.info-header h3 { font-size: 16px; font-weight: 500; }
.muted { color: var(--gd-text-3); font-size: 13px; }
.activity-item { padding: 12px 0; border-bottom: 1px solid var(--gd-border); font-size: 13px; }
.activity-time { color: var(--gd-text-3); font-size: 12px; margin-top: 4px; }

/* Buttons */
.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--gd-text-3);
    transition: background 0.15s;
}
.icon-btn:hover { background: var(--gd-hover); }
.view-toggle.active { background: var(--gd-blue-surface); color: var(--gd-blue); }

.btn-primary {
    background: var(--gd-blue);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 20px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-text {
    background: none;
    border: none;
    padding: 10px 16px;
    color: var(--gd-blue);
    font-family: var(--font);
    font-size: 14px;
    cursor: pointer;
}

/* Ripple */
.ripple { position: relative; overflow: hidden; }

/* Drop overlay */
.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(32, 33, 36, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    outline: 3px dashed #8ab4f8;
    outline-offset: -12px;
}
.drop-content { text-align: center; color: #fff; animation: springUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
.drop-content .material-icons-round { font-size: 72px; margin-bottom: 12px; color: #8ab4f8; }
.drop-content p { font-size: 22px; font-weight: 400; }
@keyframes springUp { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Upload widget — Google Drive style */
.upload-widget {
    position: fixed;
    bottom: 0;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    background: var(--gd-surface);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 4px 16px rgba(0,0,0,.2), 0 8px 24px rgba(0,0,0,.12);
    z-index: 300;
    overflow: hidden;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s;
}
.upload-widget.upload-visible { transform: translateY(0); opacity: 1; visibility: visible; }
.upload-widget.minimized .upload-list { display: none; }
.upload-widget.minimized #minimizeUpload .material-icons-round { transform: rotate(180deg); }

.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 8px 12px 16px;
    border-bottom: 1px solid var(--gd-border);
    min-height: 56px;
}
.upload-header-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
#uploadStatus { font-size: 14px; font-weight: 500; color: var(--gd-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-header-actions { display: flex; flex-shrink: 0; }

.upload-list { max-height: 320px; overflow-y: auto; }

.upload-compact-panel {
    padding: 16px;
    border-bottom: 1px solid var(--gd-border);
}
.upload-batch-bar {
    height: 6px;
    background: var(--gd-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}
.upload-batch-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--gd-blue);
    border-radius: 3px;
    transition: width 0.2s ease;
}
.upload-batch-stats {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 6px;
    color: var(--gd-text);
}
.upload-batch-hint {
    font-size: 12px;
    margin: 0;
    line-height: 1.4;
}

.upload-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    animation: uploadItemIn 0.3s ease backwards;
    border-bottom: 1px solid var(--gd-border);
}
.upload-item:last-child { border-bottom: none; }
@keyframes uploadItemIn {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: translateX(0); }
}

.upload-ring-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}
.upload-ring-wrap svg {
    width: 40px;
    height: 40px;
    transform: rotate(-90deg);
}
.upload-ring-wrap .ring-bg {
    fill: none;
    stroke: var(--gd-border);
    stroke-width: 3;
}
.upload-ring-wrap .ring-fill {
    fill: none;
    stroke: var(--gd-blue);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 0.15s ease, stroke 0.3s;
}
.upload-item.is-done .ring-fill { stroke: #1e8e3e; stroke-dashoffset: 0; }
.upload-item.is-error .ring-fill { stroke: #d93025; }

.upload-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--gd-text-2);
    pointer-events: none;
}
.upload-item.is-done .upload-pct,
.upload-item.is-done .ring-fill { opacity: 0; }

.upload-check {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e8e3e;
    border-radius: 50%;
    color: #fff;
    animation: checkPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.upload-check .material-icons-round { font-size: 22px; }
.upload-check.hidden { display: none !important; }
@keyframes checkPop {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.upload-error-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fce8e6;
    border-radius: 50%;
    color: #d93025;
}
.upload-error-icon .material-icons-round { font-size: 20px; }

.upload-meta { flex: 1; min-width: 0; }
.upload-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--gd-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upload-size { font-size: 12px; color: var(--gd-text-3); margin-top: 2px; }

/* Header overall ring */
.upload-overall-ring {
    position: relative;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}
.upload-overall-ring svg {
    width: 36px;
    height: 36px;
    transform: rotate(-90deg);
}
.upload-overall-ring .ring-bg { fill: none; stroke: var(--gd-border); stroke-width: 3; }
.upload-overall-ring .ring-fill {
    fill: none;
    stroke: var(--gd-blue);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 0.2s ease;
}
.upload-widget.all-done .upload-overall-ring .ring-fill { stroke: #1e8e3e; stroke-dashoffset: 0; }
.upload-overall-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: var(--gd-text-2);
}
.upload-overall-check {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e8e3e;
    border-radius: 50%;
    color: #fff;
    animation: checkPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.upload-overall-check .material-icons-round { font-size: 20px; }
.upload-widget.all-done .upload-overall-pct { display: none; }

/* File preview — Google Drive style */
.preview-modal {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: flex;
    flex-direction: column;
}
.preview-modal.hidden { display: none !important; }
.preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
}
.preview-shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}
.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 8px 16px;
    min-height: 56px;
    color: #fff;
    flex-shrink: 0;
}
.preview-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.preview-type-icon { color: #e8eaed; font-size: 22px; }
.preview-title {
    font-size: 16px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.preview-header-actions { display: flex; gap: 4px; flex-shrink: 0; }
.preview-header .icon-btn { color: #e8eaed; }
.preview-header .icon-btn:hover { background: rgba(255, 255, 255, 0.12); }

.preview-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 16px 24px 32px;
    position: relative;
}
.preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.preview-loading.hidden { display: none !important; }
.preview-loading .spin {
    font-size: 48px;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}
.preview-video {
    max-width: 100%;
    max-height: 100%;
    max-height: calc(100vh - 120px);
    border-radius: 4px;
    background: #000;
    outline: none;
}
.preview-pdf {
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 120px);
    max-width: 960px;
    border: none;
    border-radius: 4px;
    background: #fff;
}
.preview-error {
    color: #f28b82;
    font-size: 15px;
    text-align: center;
}
body.preview-open { overflow: hidden; }

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.modal-content {
    position: relative;
    background: var(--gd-surface);
    padding: 24px;
    border-radius: 8px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--gd-shadow-lg);
}
.modal-content h3 { font-size: 18px; font-weight: 500; margin-bottom: 20px; }
.modal-content input, .modal-content select {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--gd-border);
    border-radius: 4px;
    font-family: var(--font);
    font-size: 14px;
    background: var(--gd-surface);
    color: var(--gd-text);
}
.field-label { display: block; font-size: 12px; color: var(--gd-text-3); margin-bottom: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.share-link { margin-top: 16px; padding: 12px; background: var(--gd-bg); border-radius: 8px; font-size: 13px; word-break: break-all; }
.share-link-box { margin-top: 12px; }
.share-link-box input { width: 100%; margin-top: 4px; }
.share-modal-content select { width: 100%; padding: 10px; margin-bottom: 12px; border: 1px solid var(--gd-border); border-radius: 4px; background: var(--gd-surface); color: var(--gd-text); }

/* Move to folder modal */
.move-modal-content { max-width: 420px; width: calc(100% - 32px); }
.move-modal-sub { font-size: 13px; margin: -8px 0 16px; }
.move-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 13px;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--gd-border);
}
.move-bc-item {
    border: none;
    background: none;
    color: var(--gd-blue);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}
.move-bc-item:hover { background: var(--gd-hover); }
.move-folder-list {
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 16px;
    border: 1px solid var(--gd-border);
    border-radius: 8px;
    background: var(--gd-bg);
}
.move-folder-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-bottom: 1px solid var(--gd-border);
    background: var(--gd-surface);
    font-family: var(--font);
    font-size: 14px;
    color: var(--gd-text);
    cursor: pointer;
    text-align: left;
}
.move-folder-row:last-child { border-bottom: none; }
.move-folder-row:hover { background: var(--gd-hover); }
.move-folder-row .material-icons-round:first-child { color: #5f6368; font-size: 22px; }
.move-folder-chevron { margin-left: auto; color: var(--gd-text-3); font-size: 20px; }
.move-empty { padding: 24px; text-align: center; font-size: 13px; }
#moveConfirm { display: inline-flex; align-items: center; gap: 6px; }
#moveConfirm .material-icons-round { font-size: 18px; }

/* Context menu */
.context-menu {
    position: fixed;
    background: var(--gd-surface);
    border-radius: 4px;
    box-shadow: var(--gd-shadow-lg);
    padding: 8px 0;
    z-index: 400;
    min-width: 200px;
}
.context-menu button {
    display: block;
    width: 100%;
    padding: 10px 24px;
    border: none;
    background: none;
    text-align: left;
    font-family: var(--font);
    font-size: 14px;
    color: var(--gd-text);
    cursor: pointer;
}
.context-menu button:hover { background: var(--gd-hover); }

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gd-bg);
}
.login-card {
    background: var(--gd-surface);
    padding: 48px 40px 36px;
    border-radius: 8px;
    box-shadow: var(--gd-shadow);
    width: 100%;
    max-width: 448px;
    border: 1px solid var(--gd-border);
}
.login-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 22px;
    color: var(--gd-text-2);
}
.login-card h1 { font-size: 24px; font-weight: 400; margin-bottom: 8px; }
.login-sub { color: var(--gd-text-3); margin-bottom: 32px; font-size: 16px; }
.input-group { position: relative; margin-bottom: 20px; }
.input-group input {
    width: 100%;
    padding: 14px 12px 6px;
    border: 1px solid var(--gd-border);
    border-radius: 4px;
    font-size: 16px;
    font-family: var(--font);
    outline: none;
    background: var(--gd-surface);
    color: var(--gd-text);
}
.input-group input:focus { border-color: var(--gd-blue); border-width: 2px; padding: 13px 11px 5px; }
.input-group label {
    position: absolute;
    left: 12px;
    top: 14px;
    color: var(--gd-text-3);
    font-size: 16px;
    pointer-events: none;
    transition: all 0.15s;
}
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: 4px;
    font-size: 11px;
    color: var(--gd-blue);
}
.login-hint { font-size: 12px; color: var(--gd-text-3); margin-bottom: 20px; }
.login-footer { margin-top: 32px; font-size: 14px; }
.login-footer a { color: var(--gd-blue); text-decoration: none; font-weight: 500; }

.hidden { display: none !important; }
.upload-widget.hidden {
    display: block !important;
    pointer-events: none;
    transform: translateY(100%);
    opacity: 0;
    visibility: hidden;
}

/* Brand logo from settings */
.brand-logo-img { height: 36px; width: auto; max-width: 120px; object-fit: contain; }

/* Nav sections */
.nav-section-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gd-text-3);
    padding: 16px 24px 6px;
    margin: 0;
}
.settings-nav-btn {
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font);
    margin-top: 4px;
}

/* Home dashboard — categories not folders */
.home-dashboard { padding-bottom: 24px; }

/* Home: 2 rows of recent uploads */
.home-recent-section { margin-bottom: 24px; }
.home-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.home-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.home-section-title h2 {
    font-size: 16px;
    font-weight: 500;
    color: var(--gd-text);
}
.home-section-title .material-icons-round {
    font-size: 22px;
    color: var(--gd-blue);
}
.home-recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(152px, 176px));
    justify-content: start;
    gap: 10px;
    width: 100%;
}
.home-recent-grid .file-card {
    max-width: 176px;
}
.home-empty-msg {
    grid-column: 1 / -1;
    padding: 48px 24px;
    text-align: center;
}

.home-category-block { margin-bottom: 32px; }
.home-category-block .files-container.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(152px, 176px));
    justify-content: start;
}
.home-category-block .file-card { max-width: 176px; }
.home-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.home-category-title { display: flex; align-items: center; gap: 10px; }
.home-category-title h2 {
    font-size: 16px;
    font-weight: 500;
    color: var(--gd-text);
}
.cat-icon { color: var(--gd-blue); font-size: 24px !important; }
.cat-count {
    font-size: 13px;
    font-weight: 400;
    color: var(--gd-text-3);
}
.see-all-btn {
    border: none;
    background: none;
    color: var(--gd-blue);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
}
.see-all-btn:hover { background: var(--gd-hover); }
.cat-empty { padding: 24px; font-size: 14px; }
.home-loading { padding: 48px; color: var(--gd-text-3); text-align: center; }

/* File preview types */
.file-preview.video .material-icons-round { color: #ea4335; }
.file-preview.music .material-icons-round { color: #9334e6; }
.file-preview.rar .material-icons-round { color: #f4b400; }

/* Empty state */
.empty-state .empty-icon { font-size: 72px; opacity: 0.4; display: block; margin-bottom: 16px; }

/* Settings panel */
.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    max-width: 100%;
    height: 100vh;
    background: var(--gd-surface);
    z-index: 600;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    padding: 24px;
    overflow-y: auto;
    transition: transform 0.25s ease;
}
.settings-panel.hidden { transform: translateX(100%); pointer-events: none; display: block !important; }
.settings-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 599;
}
.settings-backdrop.hidden { display: none !important; }
.settings-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.settings-panel-header h2 { font-size: 20px; font-weight: 500; }
.settings-field { margin-bottom: 20px; }
.settings-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--gd-text-3);
    margin-bottom: 8px;
}
.settings-field input[type="text"],
.settings-field input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--gd-border);
    border-radius: 4px;
    font-family: var(--font);
    background: var(--gd-bg);
    color: var(--gd-text);
}
.settings-preview {
    min-height: 60px;
    padding: 12px;
    background: var(--gd-bg);
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.settings-preview img { max-height: 48px; max-width: 100%; }
.settings-preview.small img { max-height: 32px; }
.settings-note { font-size: 12px; color: var(--gd-text-3); line-height: 1.5; }

.admin-form-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.4;
}
.admin-form-status.hidden { display: none !important; }
.admin-form-status.is-processing {
    background: #e8f0fe;
    color: #1967d2;
    border: 1px solid #d2e3fc;
}
.admin-form-status.is-success {
    background: #e6f4ea;
    color: #137333;
    border: 1px solid #ceead6;
}
.admin-form-status.is-error {
    background: #fce8e6;
    color: #c5221f;
    border: 1px solid #f5c6c2;
}
.admin-form-status .material-icons-round { font-size: 22px; flex-shrink: 0; }
[data-theme="dark"] .admin-form-status.is-processing {
    background: rgba(138, 180, 248, 0.15);
    color: #8ab4f8;
    border-color: rgba(138, 180, 248, 0.3);
}
[data-theme="dark"] .admin-form-status.is-success {
    background: rgba(129, 201, 149, 0.15);
    color: #81c995;
    border-color: rgba(129, 201, 149, 0.3);
}
[data-theme="dark"] .admin-form-status.is-error {
    background: rgba(242, 139, 130, 0.15);
    color: #f28b82;
    border-color: rgba(242, 139, 130, 0.3);
}
#settingsSubmitBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
#settingsSubmitBtn .material-icons-round { font-size: 20px; }
#settingsSubmitBtn.is-loading { opacity: 0.75; cursor: wait; }
#settingsSubmitBtn:disabled { opacity: 0.65; cursor: not-allowed; }

/* ===== Responsive / Mobile ===== */
@media (max-width: 900px) {
    :root {
        --header-h: 56px;
        --sidebar-w: min(288px, 88vw);
    }

    .mobile-menu-btn {
        display: inline-flex;
        flex-shrink: 0;
        width: 44px;
        height: 44px;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 350;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .drive-app.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
    body.sidebar-open { overflow: hidden; }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 400;
        width: var(--sidebar-w);
        min-width: unset;
        max-width: 88vw;
        transform: translateX(-105%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--gd-shadow-lg);
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    .drive-app.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .top-header {
        gap: 8px;
        padding: 4px 12px 4px 4px;
        height: var(--header-h);
    }
    .search-wrap {
        height: 44px;
        max-width: none;
        flex: 1;
        min-width: 0;
    }
    #searchInput { font-size: 16px; }
    .header-actions .icon-btn {
        width: 44px;
        height: 44px;
    }

    .content-area {
        padding: 0 12px max(24px, env(safe-area-inset-bottom));
    }
    .content-toolbar {
        min-height: 44px;
        margin-bottom: 12px;
    }
    .content-toolbar h1 {
        font-size: 20px;
    }
    .selection-bar {
        left: 0;
        right: 48px;
        max-width: calc(100% - 48px);
        border-radius: 12px;
    }
    .selection-actions { flex-wrap: nowrap; }

    .files-container.grid-view,
    .skeleton-grid,
    .home-recent-grid,
    .home-category-block .files-container.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }
    .file-card,
    .home-recent-grid .file-card,
    .home-category-block .file-card {
        max-width: none;
    }
    .file-preview {
        height: 100px;
        min-height: 100px;
        max-height: 100px;
    }
    .home-recent-grid { max-height: none; grid-template-rows: none; }

    .filter-chips {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
    }
    .chip { flex-shrink: 0; min-height: 36px; }

    .info-panel {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        z-index: 450;
        padding: max(16px, env(safe-area-inset-top)) 16px 16px;
        transform: translateX(100%);
    }
    .info-panel:not(.hidden) { transform: translateX(0); pointer-events: auto; }
    .info-panel.hidden { transform: translateX(100%); }

    .upload-widget {
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 12px 12px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .modal-content {
        width: calc(100% - 24px);
        max-width: 100%;
        margin: 12px;
        max-height: calc(100vh - 24px);
        overflow-y: auto;
    }
    .modal {
        align-items: flex-end;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .context-menu {
        max-width: min(280px, calc(100vw - 24px));
    }
    .context-menu button {
        min-height: 44px;
        padding: 12px 20px;
    }

    .preview-header {
        padding-top: max(8px, env(safe-area-inset-top));
    }
    .preview-body {
        padding: 8px 8px max(16px, env(safe-area-inset-bottom));
    }
    .preview-title { font-size: 14px; max-width: 50vw; }

    .settings-panel {
        width: 100%;
        padding-top: max(24px, env(safe-area-inset-top));
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }

    .mobile-fab {
        display: flex;
        position: fixed;
        right: 16px;
        bottom: max(20px, calc(16px + env(safe-area-inset-bottom)));
        z-index: 280;
        width: 56px;
        height: 56px;
        border: none;
        border-radius: 16px;
        background: var(--gd-blue);
        color: #fff;
        align-items: center;
        justify-content: center;
        box-shadow: var(--gd-shadow-lg);
        cursor: pointer;
    }
    .mobile-fab .material-icons-round { font-size: 28px; }
    body.preview-open .mobile-fab,
    body.upload-panel-open .mobile-fab { display: none; }

    .new-menu {
        left: auto;
        right: 0;
        min-width: min(300px, calc(100vw - 24px));
    }
    .menu-item { min-height: 48px; }

    .nav-item { min-height: 44px; }
    .btn-new { min-height: 48px; }
    .icon-btn { min-width: 44px; min-height: 44px; }

    /* List view: name + star only */
    .list-header span:nth-child(2),
    .list-header span:nth-child(3),
    .list-view .list-col-owner,
    .list-view .list-col-date { display: none; }
    .list-header,
    .list-view .file-card {
        grid-template-columns: 1fr 44px;
        padding-left: 12px;
        padding-right: 8px;
        gap: 8px;
    }
    .list-header { padding-left: 48px; }
}

@media (max-width: 480px) {
    .header-actions #btnInfo { display: none; }
    .content-toolbar h1 { font-size: 18px; }
    .empty-state { padding: 48px 16px; }
    .empty-state .empty-icon { font-size: 56px; }
    .login-card {
        margin: 16px;
        padding: 32px 24px 28px;
        border-radius: 12px;
        max-width: none;
    }
    .btn-selection span:not(.material-icons-round) {
        display: none;
    }
    .btn-selection { padding: 10px 12px; min-width: 44px; justify-content: center; }
}

@media (max-width: 900px) and (orientation: landscape) {
    .sidebar { width: min(260px, 50vw); }
    .file-preview { height: 100px; }
}
