:root {
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --bg: #f8fafd;
    --surface: #ffffff;
    --primary: #1a73e8;
    --primary-hover: #0b57d0;
    --primary-subtle: #e8f0fe;
    --text: #202124;
    --text-muted: #5f6368;
    --border: #e8eaed;
    --danger: #d93025;
    --success: #188038;
    --shadow: 0 1px 2px rgba(60, 64, 67, 0.08), 0 2px 8px rgba(60, 64, 67, 0.08);
    --radius: 16px;
    --radius-sm: 10px;
    color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100vh; }

body {
    font-family: 'Plus Jakarta Sans', 'Google Sans', 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

* { scrollbar-width: thin; scrollbar-color: #8ab4f8 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
    min-height: 48px;
    border: 3px solid transparent;
    border-radius: 999px;
    background: linear-gradient(180deg, #8ab4f8, #1a73e8) border-box;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-6);
    background: var(--bg);
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: var(--space-3); }

.logo {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}

.search-form input {
    padding: 12px var(--space-4);
    border: none;
    border-radius: 24px;
    width: 480px;
    max-width: 40vw;
    background: #eef2f7;
    height: 44px;
}

.main-content { padding: var(--space-6); max-width: 1200px; margin: 0 auto; width: 100%; }
.app-body .main-content {
    max-width: none;
    padding: 20px 28px 40px;
    background: var(--surface);
    border-radius: 24px;
    margin: 0 12px 12px 0;
    min-height: calc(100vh - 88px);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-primary { background: var(--primary); color: #fff; border-radius: 24px; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid transparent; border-radius: 24px; }
.btn-ghost:hover { background: var(--bg); }
.btn-block { width: 100%; justify-content: center; }
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    color: var(--text-muted);
}
.btn-icon:hover { background: var(--bg); }
.btn-icon .drive-icon-ui { width: 18px; height: 18px; }
.btn-icon-label { padding: 6px 8px; }

.upload-btn { cursor: pointer; }

.search-form {
    position: relative;
    display: flex;
    align-items: center;
}
.search-form .drive-icon-ui {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    pointer-events: none;
}
.search-form input { padding-left: 40px; }

.theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: inline-flex; }

.alert {
    padding: var(--space-3) var(--space-6);
    margin: 0;
    text-align: center;
}

.alert-success { background: #e6f4ea; color: var(--success); }
.alert-error { background: #fce8e6; color: var(--danger); }

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #e8f0fe 0%, #f8f9fa 100%);
}

.login-card {
    background: var(--surface);
    padding: var(--space-8);
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 420px;
}

.login-card .alert {
    border-radius: 12px;
    margin-bottom: 16px;
    text-align: left;
    padding: 10px 14px;
    font-size: 14px;
}
.login-card h1 { margin-bottom: 8px; font-weight: 400; }
.subtitle { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--text-muted); }
.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    background: var(--surface);
    color: var(--text);
}

.login-google-off { text-align: center; font-size: 13px; margin-top: 4px; }

.login-hint {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #fff;
    color: #3c4043;
    border: 1px solid var(--border);
    font-weight: 500;
}

.btn-google:hover {
    background: #f8f9fa;
    box-shadow: var(--shadow);
}

.drive-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.breadcrumbs { font-size: 14px; color: var(--text-muted); }
.toolbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.upload-target {
    height: 36px;
    max-width: 220px;
    border: none;
    border-radius: 18px;
    padding: 0 12px;
    background: var(--bg);
    color: inherit;
    font-size: 13px;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: var(--space-8);
    text-align: center;
    color: var(--text-muted);
    margin-bottom: var(--space-6);
    transition: all 0.2s;
}

.drop-zone.dragover {
    border-color: var(--primary);
    background: #e8f0fe;
}

.drop-zone.hidden { display: none; }

.drive-section {
    margin-bottom: 32px;
}

.drive-section-title {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.drive-date-group {
    margin-bottom: 24px;
}

.drive-date-group:last-child {
    margin-bottom: 0;
}

.drive-date-label {
    margin: 0 0 12px;
    padding-bottom: 0;
    border-bottom: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
}

.file-item {
    background: #f1f3f4;
    border: none;
    border-radius: 16px;
    padding: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-align: left;
    transition: background 0.15s ease;
}

.file-item:hover {
    background: #e8eaed;
    box-shadow: none;
}

.file-card-head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 36px 10px 10px;
    min-height: 0;
    order: 2;
}

.file-item > .btn-more {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    border-radius: 50%;
    background: rgba(32, 33, 36, 0.5);
}

.file-type-icon {
    display: inline-flex;
    flex-shrink: 0;
    margin-top: 1px;
}

.file-card-head .file-name,
.file-card-head .file-link {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    width: auto;
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--text);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.file-name-base,
.file-name-ext { display: inline; }

.file-item > .btn-more { opacity: 0.7; }
.file-item:hover > .btn-more,
.file-item.is-selected > .btn-more,
.file-item > .btn-more:focus {
    opacity: 1;
}

.file-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    margin: 8px 8px 0;
    order: 1;
    background: #fff;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
}

.file-preview-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 140px;
    text-decoration: none;
}

.file-thumb {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: var(--bg);
    pointer-events: none;
}

.file-preview:has(.file-thumb) .drive-icon-shell,
.file-preview-link:has(.file-thumb) .drive-icon-shell { display: none; }

.file-card-foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px 6px;
    padding: 6px 10px 8px;
}

.file-col-date,
.file-col-size {
    font-size: 11px;
    font-weight: 400;
    line-height: 1.3;
    color: var(--text-muted);
}

.file-col-date { order: 1; }
.file-col-size { order: 2; }
.file-col-owner { order: 3; flex: 1 1 100%; margin-left: 0; margin-top: 2px; }
.file-grid:not(.is-list) .file-card-foot,
.file-grid:not(.is-list) .btn-star-file { display: none; }

.file-link { color: inherit; text-decoration: none; }

.file-icon-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: var(--space-3);
    min-height: 72px;
    width: 100%;
}

.drive-icon-folder,
.drive-icon-shell,
.drive-icon-ui,
.drive-icon-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.drive-icon-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.drive-icon-lg.drive-icon-folder,
.drive-icon-lg.drive-icon-shell { width: 56px; height: 56px; }
.drive-icon-lg .drive-icon-img { width: 100%; height: 100%; }

.drive-icon-md.drive-icon-folder,
.drive-icon-md.drive-icon-shell,
.drive-icon-md.drive-icon-ui { width: 40px; height: 40px; }

.drive-icon-sm.drive-icon-folder,
.drive-icon-sm.drive-icon-shell,
.drive-icon-sm.drive-icon-ui { width: 20px; height: 20px; flex-shrink: 0; }

.drive-icon-xs.drive-icon-folder,
.drive-icon-xs.drive-icon-shell { width: 18px; height: 18px; flex-shrink: 0; }

.drive-icon-action { width: 18px; height: 18px; }
.drive-icon-lg.drive-icon-ui { width: 56px; height: 56px; }
.drive-icon-nav { width: 20px; height: 20px; }

.file-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

.file-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-col-date + .file-col-size:not(.is-empty)::before { content: " · "; }
.file-grid:not(.is-list) .file-col-size.is-empty,
.file-grid:not(.is-list) .file-col-owner.is-empty { display: none; }

.storage-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    max-width: 88px;
    padding: 1px 7px 1px 4px;
    border-radius: 999px;
    background: #eef2f7;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 600;
}
.storage-chip svg { flex-shrink: 0; }
.storage-chip.storage-s3 { background: #e8f0fe; color: #1a73e8; }
.storage-chip.storage-local { background: #fef7e0; color: #e37400; }
html[data-theme="dark"] .storage-chip { background: rgba(255, 255, 255, 0.08); }
.file-actions {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.file-item.is-simple {
    padding: 16px;
    align-items: center;
    text-align: center;
}
.file-item.is-simple .file-name { margin-bottom: 4px; }
.file-item.is-simple .file-actions {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    overflow: visible;
    opacity: 1;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.empty-state {
    text-align: center;
    padding: var(--space-8);
    color: var(--text-muted);
}

.empty-state .drive-icon-folder { margin: 0 auto var(--space-3); }

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal.hidden { display: none; }

.modal-content {
    background: var(--surface);
    padding: var(--space-6);
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
}

.modal-content h3 { margin-bottom: var(--space-4); }
.modal-content input,
.modal-content select {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

.app-dialog { max-width: 400px; }
.app-dialog h3 { margin-bottom: 8px; font-size: 18px; font-weight: 500; }
.app-dialog-text { margin: 0 0 4px; font-size: 14px; line-height: 1.45; color: var(--text-muted); }
.app-dialog-text.hidden,
.app-dialog-field.hidden { display: none; }
.app-dialog-field { display: block; margin-top: 8px; }
.app-dialog-field .form-label { margin-top: 0; }
.app-dialog-field input { margin-bottom: 0; }
.app-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.app-dialog-actions .btn { min-width: 88px; }
.btn-danger-fill { background: #d93025; color: #fff; border-radius: 24px; }
.btn-danger-fill:hover { background: #b3261e; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: #f1f3f4;
    border: none;
    border-radius: 16px;
    padding: 14px 12px;
    text-align: center;
}

.stat-value { display: block; font-size: 1.35rem; font-weight: 600; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-muted); }

.admin-section { margin-bottom: 32px; }
.admin-section h3 { margin-bottom: 12px; }

.admin-grid { align-items: start; }
.admin-side { display: flex; flex-direction: column; gap: 12px; }

.admin-user-list { list-style: none; }
.admin-user-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 6px;
    border-radius: 12px;
}
.admin-user-list li:hover { background: rgba(255, 255, 255, 0.55); }

.admin-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e8f0fe;
    color: #1967d2;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.admin-user-meta { min-width: 0; flex: 1; }
.admin-user-meta strong { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.admin-user-meta .text-muted { display: block; font-size: 12px; }

.admin-user-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.badge-role-admin { background: #e8f0fe; color: #1967d2; }
.badge-role-user { background: #e8eaed; color: #5f6368; }

.settings-tile.is-form { padding: 0; }
.settings-tile.is-form button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    padding: 14px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.settings-tile.is-form strong { font-size: 14px; }
.settings-tile.is-form span { font-size: 12px; color: var(--text-muted); }

.admin-user-form .form-label { margin-top: 8px; }
.admin-user-form input,
.admin-user-form select { margin-bottom: 4px; }
.admin-password-hint { margin: 0 0 8px; font-size: 12px; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}

.data-table th, .data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.data-table th { background: var(--bg); font-weight: 500; }

.file-name-lg { font-size: 1.1rem; margin: 16px 0 8px; word-break: break-all; }

.user-name { font-size: 14px; color: var(--text-muted); }

.system-status { display: flex; gap: 8px; margin-bottom: 12px; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg);
    color: var(--text-muted);
    text-transform: uppercase;
}

.badge-uploaded { background: #fef7e0; color: #e37400; }
.badge-syncing { background: #e8f0fe; color: #1a73e8; }
.badge-synced { background: #e6f4ea; color: #188038; }
.badge-failed { background: #fce8e6; color: #d93025; }
.badge-archived { background: #f1f3f4; color: #5f6368; }
.badge-completed { background: #e6f4ea; color: #188038; }
.badge-retrying { background: #fef7e0; color: #e37400; }
.badge-running { background: #e8f0fe; color: #1a73e8; }
.badge-pending { background: #f1f3f4; color: #5f6368; }

.nav-link { font-size: 14px; color: var(--text-muted); text-decoration: none; }
.nav-link:hover { color: var(--primary); text-decoration: none; }

/* ── Landing Page ── */
.landing-body { background: var(--bg); color: var(--text); }

.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-8);
    border-bottom: 1px solid var(--border);
}

.landing-nav .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.logo-icon { display: inline-flex; }

.landing-nav-actions { display: flex; gap: 12px; }

.landing-footer {
    text-align: center;
    padding: 24px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Home Dashboard ── */
.home-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.home-welcome h1 { font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; }
.home-welcome .subtitle { margin: 6px 0 0; font-size: 14px; }

.home-quick-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.home-banner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 16px;
    background: #fce8e6;
    color: #c5221f;
    font-size: 14px;
    line-height: 1.45;
}
.home-banner p { margin: 0; }
.home-banner a { font-weight: 600; }

.home-stats { margin-bottom: 20px; }

.home-shortcuts-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.home-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 12px;
}

.home-panel {
    background: #f1f3f4;
    border: none;
    border-radius: 16px;
    padding: 14px 16px 10px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.panel-header h3 { font-size: 14px; font-weight: 600; }
.panel-header a { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.guide-list .drive-icon-ui { vertical-align: middle; display: inline-flex; }
.setup-step-num .drive-icon-ui { width: 14px; height: 14px; }
.login-page a { display: inline-flex; align-items: center; gap: 6px; }

.home-file-list, .home-activity-list {
    list-style: none;
}

.home-file-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 10px;
    border-bottom: none;
}

.home-file-list li:hover { background: rgba(255, 255, 255, 0.55); }

.file-icon-sm { display: inline-flex; align-items: center; }

.file-info { flex: 1; min-width: 0; }

.file-info .file-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-activity-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 6px;
    border-radius: 10px;
    border-bottom: none;
    font-size: 13px;
}

.home-activity-list li:hover { background: rgba(255, 255, 255, 0.55); }

.activity-action { text-transform: capitalize; }
.activity-time { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }

.shortcuts-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

.shortcut-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px;
    border: none;
    border-radius: 16px;
    background: #f1f3f4;
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s;
}

.shortcut-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.shortcut-card small { font-size: 13px; color: var(--text-muted); }

.shortcut-card:hover { background: #e8eaed; text-decoration: none; }

.empty-state.small { padding: 16px 8px; font-size: 13px; }

.page-header { margin-bottom: var(--space-6); }
.page-header h1 { font-size: 1.5rem; margin-bottom: var(--space-1); }
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-danger { color: #d93025; font-size: 12px; }

.settings-page {
    display: grid;
    grid-template-columns: 188px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    max-width: 960px;
}

.settings-nav {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.settings-nav a:hover { background: var(--bg); text-decoration: none; }

.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    scroll-margin-top: 80px;
}

.settings-section h2 { font-size: 1rem; margin-bottom: 0; }
.settings-section-head p { margin-top: 4px; }

.settings-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.settings-fields input,
.settings-fields select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
}

.settings-fields.is-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
}

.settings-fields .is-full { grid-column: 1 / -1; }

.settings-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
}

.settings-check input { width: auto; }

.settings-test { margin-top: 10px; }

.settings-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 10px;
}

.settings-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    background: var(--bg);
}

.settings-tile:hover { border-color: #d2e3fc; text-decoration: none; }
.settings-tile strong { font-size: 14px; }
.settings-tile span { font-size: 12px; color: var(--text-muted); }

.settings-subhead { font-size: 14px; margin: 24px 0 8px; }

.provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.provider-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
}

.provider-card.is-wide { grid-column: 1 / -1; }
.provider-card .btn { align-self: flex-start; }

.provider-form { display: flex; flex-direction: column; gap: 8px; }
.provider-form.is-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.provider-form input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

.settings-next {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.settings-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.setup-steps {
    list-style: none;
    margin: 0 0 var(--space-5);
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-3);
}

.setup-step {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
}

.setup-step p { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }

.setup-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    background: var(--bg);
    color: var(--text-muted);
}

.setup-step.is-current { border-color: var(--primary); }
.setup-step.is-current .setup-step-num,
.setup-step.is-done .setup-step-num {
    background: var(--primary);
    color: #fff;
}

.setup-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #e8f0fe;
    border: none;
    border-radius: 16px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.setup-banner p { margin: 4px 0 0; }
.setup-banner .btn { margin-left: auto; flex-shrink: 0; }

.account-list { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }

.account-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

.account-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.account-controls { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }

.account-card.is-expired { border-color: #e94235; background: rgba(233, 66, 53, 0.06); }

.priority-form { display: flex; align-items: center; gap: var(--space-2); }
.priority-form .form-label { margin: 0; white-space: nowrap; }
.priority-form input { width: 72px; }

.credentials-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 560px;
}

.credentials-form input { margin-bottom: var(--space-3); }
.credentials-form button { align-self: flex-start; }

.routing-note {
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    background: var(--primary-subtle);
    font-size: 13px;
}

.quota-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }

.quota-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.metric-card.metric-wide { grid-column: 1 / -1; }
.metric-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.metric-value { font-size: 1.25rem; font-weight: 600; }

.quota-bar {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin: 6px 0;
}

.quota-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1a73e8, #34a853);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.upload-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 320px;
    max-height: 360px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 1000;
    padding: 12px;
}

.upload-panel.hidden { display: none; }

.upload-panel h4 { font-size: 13px; margin-bottom: 8px; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.upload-panel-cancel-all {
    border: 0;
    background: none;
    color: #d93025;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.upload-item-top { display: flex; align-items: center; gap: 8px; }

.upload-item-cancel {
    border: 0;
    background: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.upload-item-cancel:hover { color: #d93025; }

.upload-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.upload-item:last-child { border-bottom: none; }

.upload-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0; flex: 1; }

.upload-item-bar {
    height: 4px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.upload-item-bar-fill {
    height: 100%;
    background: #1a73e8;
    transition: width 0.2s ease;
}

.upload-item-bar-fill.is-busy {
    width: 40% !important;
    animation: upload-indeterminate 1.1s ease-in-out infinite;
}

.upload-item-bar-fill.is-wait {
    animation: upload-pulse 1.1s ease-in-out infinite;
}

@keyframes upload-pulse {
    50% { opacity: 0.5; }
}

@keyframes upload-indeterminate {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(280%); }
}

.upload-item-status { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.upload-item-status.error { color: #d93025; }
.upload-item-status.done { color: #34a853; }

/* Guide / Tutorial page */
.guide-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px 64px;
}

.guide-hero {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.guide-hero h1 { font-size: 2rem; margin-bottom: 8px; }

.guide-toc {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 40px;
}

.guide-toc h2 { font-size: 1rem; margin-bottom: 12px; color: var(--text-muted); }
.guide-toc ol { margin: 0; padding-left: 20px; }
.guide-toc li { margin: 6px 0; }
.guide-toc a { color: var(--primary); text-decoration: none; }
.guide-toc a:hover { text-decoration: underline; }

.guide-section {
    margin-bottom: 48px;
    scroll-margin-top: 80px;
}

.guide-section h2 {
    font-size: 1.35rem;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}

.guide-section h3 { font-size: 1rem; margin: 20px 0 10px; }

.guide-steps { display: flex; flex-direction: column; gap: 20px; }

.guide-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.step-num {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.guide-list { margin: 12px 0; padding-left: 24px; line-height: 1.7; }
.guide-list li { margin: 6px 0; }

.guide-section pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    margin: 12px 0;
}

.guide-section code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.9em;
}

.guide-section p code,
.guide-section li code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.guide-callout {
    background: #e8f0fe;
    border-left: 4px solid var(--primary);
    padding: 14px 16px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 16px 0;
    font-size: 14px;
}

.guide-callout-info { background: #e6f4ea; border-color: #34a853; }
.guide-callout-warn { background: #fef7e0; border-color: #f9ab00; }

.guide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin: 16px 0;
}

.guide-table th,
.guide-table td {
    border: 1px solid var(--border);
    padding: 10px 12px;
    text-align: left;
}

.guide-table th { background: var(--bg); font-weight: 600; }
.guide-table code { font-size: 12px; }

.guide-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.guide-footer p { color: var(--text-muted); margin-bottom: 16px; }

.landing-body .guide-page { padding-top: 32px; }

html[data-theme="dark"] {
    --bg: #131314;
    --surface: #1e1f20;
    --elevated: #28292a;
    --hover: #333438;
    --selected: #004a77;
    --selected-fg: #c2e7ff;
    --primary: #a8c7fa;
    --primary-hover: #c2e7ff;
    --primary-subtle: #004a77;
    --text: #e3e3e3;
    --text-muted: #c4c7c5;
    --border: rgba(227, 227, 227, 0.08);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.32);
    color-scheme: dark;
}

html[data-theme="dark"] * { scrollbar-color: #444746 transparent; }
html[data-theme="dark"] *::-webkit-scrollbar-thumb {
    background: #444746 border-box;
}

html[data-theme="dark"] .login-page {
    background: #131314;
}
html[data-theme="dark"] .login-card {
    background: #1e1f20;
    box-shadow: var(--shadow);
}
html[data-theme="dark"] .btn-google {
    background: #28292a;
    color: #e3e3e3;
    border-color: rgba(227, 227, 227, 0.12);
}
html[data-theme="dark"] .btn-google:hover { background: #333438; }

html[data-theme="dark"] .btn-primary {
    background: #a8c7fa;
    color: #062e4f;
}
html[data-theme="dark"] .btn-primary:hover { background: #c2e7ff; }
html[data-theme="dark"] .btn-primary .drive-icon-img {
    filter: brightness(0) saturate(100%);
    opacity: 0.75;
}
html[data-theme="dark"] .btn-ghost:hover { background: #3c4043; }

html[data-theme="dark"] .modal-content input,
html[data-theme="dark"] .modal-content select,
html[data-theme="dark"] .form-group input,
html[data-theme="dark"] .settings-fields input,
html[data-theme="dark"] .settings-fields select,
html[data-theme="dark"] .admin-form input,
html[data-theme="dark"] .admin-form select,
html[data-theme="dark"] .app-dialog input {
    background: #28292a;
    color: #e3e3e3;
    border-color: rgba(227, 227, 227, 0.12);
}
html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus {
    -webkit-text-fill-color: #e3e3e3;
    box-shadow: 0 0 0 1000px #28292a inset;
    transition: background-color 9999s ease-out;
}

html[data-theme="dark"] .settings-section,
html[data-theme="dark"] .account-card { background: #1e1f20; }
html[data-theme="dark"] .settings-tile {
    background: #333438;
    border-color: transparent;
}
html[data-theme="dark"] .settings-tile:hover { border-color: #004a77; }
html[data-theme="dark"] .badge { background: #3c4043; color: #c4c7c5; }
html[data-theme="dark"] .data-table { background: #1e1f20; }
html[data-theme="dark"] .data-table th { background: #28292a; }
html[data-theme="dark"] #btn-new {
    background: #28292a;
    color: #e3e3e3;
}
html[data-theme="dark"] #btn-new:hover { background: #3c4043; }

html[data-theme="dark"] .search-form input {
    background: #28292a;
    color: #e3e3e3;
}
html[data-theme="dark"] .guide-callout { background: #28292a; }
html[data-theme="dark"] .alert-success { background: #1a3a24; }
html[data-theme="dark"] .alert-error { background: #3d1f1d; }

html[data-theme="dark"] .app-body { background: #131314; }
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .app-body .topbar {
    background: #131314;
}

.app-body {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

.sidebar {
    width: 232px;
    flex-shrink: 0;
    background: var(--bg);
    border-right: none;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 120;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 14px 6px;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    text-decoration: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 2px 10px 4px;
}

.sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 2px 0;
}

.sidebar-group + .sidebar-group {
    margin-top: 2px;
    padding-top: 6px;
    border-top: none;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
}

.sidebar-link:hover { background: var(--bg); text-decoration: none; }
.sidebar-link.is-active { background: var(--primary-subtle); color: var(--primary); font-weight: 600; }
html[data-theme="dark"] .sidebar-link:hover { background: #28292a; }
html[data-theme="dark"] .sidebar-link.is-active {
    background: #004a77;
    color: #c2e7ff;
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-top: auto;
    padding: 8px 10px 10px;
    border-top: none;
}

.sidebar-user .user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-storage {
    border: none;
    border-radius: 16px;
    padding: 10px 12px 12px;
    background: #e8eaed;
}

.sidebar-storage-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    line-height: 1.2;
    padding: 3px 0;
    color: var(--text);
}

.sidebar-storage-row span:nth-child(2) { flex: 1; min-width: 0; }
.sidebar-storage-row span:last-child {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sidebar-storage-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.sidebar-storage-dot.is-photo { background: #34a853; }
.sidebar-storage-dot.is-video { background: #fbbc04; }
.sidebar-storage-dot.is-document { background: #8ab4f8; }
.sidebar-storage-dot.is-free { background: #e37400; }

.sidebar-storage-foot {
    margin-top: 6px;
    padding-top: 10px;
    border-top: none;
}

.sidebar-storage-foot p {
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-storage-foot strong { color: var(--text); font-weight: 700; }

.sidebar-storage .quota-bar { height: 6px; margin: 8px 0 0; }

.sidebar-storage .quota-bar-fill { background: var(--primary); }

.sidebar-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px 2px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.sidebar-logout:hover { color: var(--text); text-decoration: none; }

.app-shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-body .topbar {
    position: sticky;
    gap: var(--space-3);
}

.app-body .search-form { flex: 1; }
.app-body .search-form input { width: 100%; max-width: 640px; }

.sidebar-toggle { display: none; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn.is-active { border-color: var(--primary); color: var(--primary); }

.view-toggle, .sort-menu { display: flex; align-items: center; gap: 4px; }
.view-toggle .btn,
#btn-theme {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
}
.view-toggle .btn.is-active { background: var(--primary-subtle); color: var(--primary); }

.bulk-bar {
    position: sticky;
    top: 64px;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: var(--space-4);
    padding: 6px 8px 6px 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow);
    width: fit-content;
}

.bulk-bar.hidden { display: none; }
.bulk-bar #bulk-count { font-size: 13px; font-weight: 600; padding: 0 8px; }
.bulk-bar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

.file-check {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    display: flex;
    padding: 3px;
    border-radius: 6px;
    background: var(--surface);
    box-shadow: 0 0 0 1px var(--border);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.file-check input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.file-item:hover .file-check,
.file-item.is-selected .file-check,
.file-check:focus-within { opacity: 1; }

.file-item.is-selected {
    background: #d3e3fd;
    box-shadow: none;
}

.file-item.is-selected .file-preview,
.file-item.is-selected .file-preview-link { background: #fff; }

.file-list-head {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: relative;
    padding: 0 4px 8px;
}

.file-list-head > span { display: none; }

.drive-explorer.is-list {
    --list-owner: 120px;
    --list-date: 72px;
    --list-size: 76px;
    --list-more: 32px;
    --list-gap: 16px;
}

.drive-explorer.is-list .file-list-head {
    justify-content: flex-start;
    gap: var(--list-gap);
    padding: 2px 8px;
    border-bottom: 1px solid var(--border);
    color: #5f6368;
    font-size: 12px;
    font-weight: 500;
}

.drive-explorer.is-list .file-list-name { display: block; flex: 1; min-width: 0; }
.drive-explorer.is-list .file-list-head > span:nth-child(2) { display: block; flex: 0 0 var(--list-owner); }
.drive-explorer.is-list .file-list-head > span:nth-child(3) { display: block; flex: 0 0 var(--list-date); }
.drive-explorer.is-list .file-list-head > span:nth-child(4) { display: block; flex: 0 0 var(--list-size); }

.file-list-sort { position: relative; flex: 0 0 var(--list-more, 32px); }
.sort-menu-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border-radius: 50%;
    background: #f1f3f4;
    flex-shrink: 0;
}
.sort-menu-btn:hover,
#sort-menu.is-open .sort-menu-btn { background: #e8eaed; }
.sort-menu-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 220px;
    padding: 6px 0;
    background: #fff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.16), 0 8px 24px rgba(60, 64, 67, 0.2);
    z-index: 50;
}
.sort-menu-pop[hidden] { display: none; }
.sort-menu-label {
    margin: 6px 12px 2px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}
.sort-menu-pop a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    color: #202124;
    text-decoration: none;
    font-size: 13px;
}
.sort-menu-pop a:hover { background: #f1f3f4; }
.sort-menu-pop a.is-active { background: #d3e3fd; color: #202124; font-weight: 500; }
.sort-menu-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #1a73e8;
}
.sort-menu-check svg { display: none; }
.sort-menu-pop a.is-active .sort-menu-check svg { display: block; }
html[data-theme="dark"] .sort-menu-btn { background: #28292a; }
html[data-theme="dark"] .upload-target { background: #28292a; }
html[data-theme="dark"] .sidebar-storage { background: #28292a; }
html[data-theme="dark"] .sidebar-group + .sidebar-group,
html[data-theme="dark"] .sidebar-user,
html[data-theme="dark"] .sidebar-storage-foot,
html[data-theme="dark"] .drive-date-label { border-color: rgba(227, 227, 227, 0.06); }
html[data-theme="dark"] .sort-menu-pop { background: #2d2e30; }
html[data-theme="dark"] .sort-menu-pop a { color: #e3e3e3; }
html[data-theme="dark"] .sort-menu-pop a:hover { background: #3c4043; }
html[data-theme="dark"] .sort-menu-pop a.is-active { background: #004a77; color: #c2e7ff; }

.drive-explorer.is-list .drive-section { margin-bottom: 0; }
.drive-explorer.is-list .drive-section-title,
.drive-explorer.is-list .drive-date-label { display: none; }
.drive-explorer.is-list .drive-date-group { margin-bottom: 0; }

.drive-explorer.is-list .file-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.drive-explorer.is-list .file-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    padding: 0 8px;
    gap: var(--list-gap);
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
}

.drive-explorer.is-list .file-item:hover {
    transform: none;
    background: #f8f9fa;
    border-color: var(--border);
    box-shadow: none;
}

.drive-explorer.is-list .file-item.is-selected {
    background: #d3e3fd;
    border-color: #0b57d0;
    box-shadow: none;
    border-color: var(--border);
}

.drive-explorer.is-list .file-check,
.drive-explorer.is-list .file-preview,
.drive-explorer.is-list .file-actions,
.drive-explorer.is-list .btn-star-file { display: none; }

.drive-explorer.is-list .file-card-head {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    gap: 10px;
    order: 0;
}

.drive-explorer.is-list .file-preview { order: 0; }

.drive-explorer.is-list .file-type-icon { display: inline-flex; margin-top: 0; }
.drive-explorer.is-list .file-name,
.drive-explorer.is-list .file-card-head .file-name {
    display: flex;
    align-items: baseline;
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 36px;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    -webkit-box-orient: unset;
    white-space: nowrap;
    overflow: hidden;
}

.drive-explorer.is-list .file-name-base {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.drive-explorer.is-list .file-name-ext {
    flex-shrink: 0;
    white-space: nowrap;
}

.drive-explorer.is-list .file-card-foot {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--list-gap);
    width: calc(var(--list-owner) + var(--list-date) + var(--list-size) + var(--list-gap) * 2);
    padding: 0;
}

.drive-explorer.is-list .file-col-owner,
.drive-explorer.is-list .file-col-date,
.drive-explorer.is-list .file-col-size {
    order: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 400;
    line-height: 36px;
    color: #5f6368;
}

.drive-explorer.is-list .file-col-owner {
    flex: 0 0 var(--list-owner);
    max-width: none;
    padding: 0;
    background: none;
}

.drive-explorer.is-list .file-col-date { flex: 0 0 var(--list-date); }
.drive-explorer.is-list .file-col-size { flex: 0 0 var(--list-size); }
.drive-explorer.is-list .file-col-owner.is-empty,
.drive-explorer.is-list .file-col-size.is-empty { color: var(--text-muted); }
.drive-explorer.is-list .file-col-date + .file-col-size::before { content: none; }

.drive-explorer.is-list .file-item > .btn-more {
    position: static;
    flex: 0 0 var(--list-more);
    opacity: 0.65;
    background: transparent;
}

html[data-theme="dark"] .drive-explorer.is-list .file-item { background: transparent; }
html[data-theme="dark"] .drive-explorer.is-list .file-item:hover { background: #28292a; }
html[data-theme="dark"] .drive-explorer.is-list .file-item.is-selected { background: #004a77; }
html[data-theme="dark"] .drive-explorer.is-list .file-col-owner,
html[data-theme="dark"] .drive-explorer.is-list .file-col-date,
html[data-theme="dark"] .drive-explorer.is-list .file-col-size { color: #c4c7c5; }
html[data-theme="dark"] .file-item { background: #28292a; }
html[data-theme="dark"] .file-item > .btn-more { background: rgba(0, 0, 0, 0.45); }
html[data-theme="dark"] .drive-explorer.is-list .file-item > .btn-more { background: transparent; }
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .home-panel,
html[data-theme="dark"] .shortcut-card { background: #28292a; }
html[data-theme="dark"] .shortcut-card:hover,
html[data-theme="dark"] .home-file-list li:hover,
html[data-theme="dark"] .home-activity-list li:hover,
html[data-theme="dark"] .admin-user-list li:hover { background: #333438; }
html[data-theme="dark"] .admin-avatar { background: #004a77; color: #a8c7fa; }
html[data-theme="dark"] .badge-role-admin { background: #004a77; color: #a8c7fa; }
html[data-theme="dark"] .badge-role-user { background: #3c4043; color: #c4c7c5; }
html[data-theme="dark"] .setup-banner { background: #004a77; }
html[data-theme="dark"] .home-banner { background: #3d1f1d; color: #f28b82; }
html[data-theme="dark"] .home-banner a { color: #a8c7fa; }
html[data-theme="dark"] .file-item:hover { background: #333438; }
html[data-theme="dark"] .file-item.is-selected { background: #004a77; border-color: transparent; }
html[data-theme="dark"] .file-preview,
html[data-theme="dark"] .file-item.is-selected .file-preview,
html[data-theme="dark"] .file-item.is-selected .file-preview-link { background: #1e1f20; }
html[data-theme="dark"] .context-menu,
html[data-theme="dark"] .context-submenu { background: #2d2e30; }
html[data-theme="dark"] .context-menu button { color: #e3e3e3; }
html[data-theme="dark"] .context-menu button:hover,
html[data-theme="dark"] .context-menu button.is-submenu-open { background: #3c4043; }
html[data-theme="dark"] .context-menu-sep { background: #444746; }
html[data-theme="dark"] .context-menu-hint,
html[data-theme="dark"] .context-menu-chevron { color: #c4c7c5; border-color: #c4c7c5; }
html[data-theme="dark"] .context-menu button .drive-icon-ui svg { stroke: #c4c7c5; }
html[data-theme="dark"] .new-menu-pop,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .file-info-drawer,
html[data-theme="dark"] .bulk-bar { background: #2d2e30; }

@media (max-width: 960px) {
    .settings-page { grid-template-columns: 1fr; }
    .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
    .settings-fields.is-grid { grid-template-columns: 1fr; }
    .account-card { flex-direction: column; align-items: stretch; }
    .drive-explorer.is-list { --list-owner: 0px; }
    .drive-explorer.is-list .file-list-head span:nth-child(2),
    .drive-explorer.is-list .file-col-owner { display: none; }
    .drive-explorer.is-list .file-card-foot {
        width: calc(var(--list-date) + var(--list-size) + var(--list-gap));
    }
}

@media (max-width: 640px) {
    .drive-explorer.is-list .file-list-head { justify-content: flex-end; border-bottom: none; }
    .drive-explorer.is-list .file-list-head > span { display: none; }
    .drive-explorer.is-list { --list-date: 0px; --list-gap: 8px; }
    .drive-explorer.is-list .file-col-date { display: none; }
    .drive-explorer.is-list .file-card-foot { width: var(--list-size); }
}

.select-rect {
    position: fixed;
    z-index: 250;
    border: 1px solid var(--primary);
    background: rgba(26, 115, 232, 0.14);
    pointer-events: none;
    border-radius: 2px;
}
.select-rect.hidden { display: none; }
.main-content.is-marquee { user-select: none; cursor: crosshair; }

.drop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 115, 232, 0.12);
    border: 3px dashed var(--primary);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--primary);
    pointer-events: none;
}

.drop-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

.drop-overlay.hidden { display: none; }

.new-menu { position: relative; }
.new-menu-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 40;
    display: flex;
    flex-direction: column;
}
.new-menu-pop[hidden] { display: none; }
.new-menu-pop button,
.new-menu-pop .upload-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    text-align: left;
}
.new-menu-pop button:hover,
.new-menu-pop .upload-btn:hover { background: var(--bg); }

.file-item.is-drop-target { outline: 2px dashed var(--primary); background: var(--primary-subtle); }
.file-item.is-dragging { opacity: 0.45; }

.toast-host {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 400;
    pointer-events: none;
    max-width: min(440px, calc(100vw - 32px));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #202124;
    color: #fff;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
    padding: 14px 12px 14px 16px;
    font-size: 14px;
    line-height: 1.4;
    min-width: 280px;
    max-width: 100%;
    pointer-events: auto;
}

.toast span { flex: 1; min-width: 0; }
.toast-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    border-radius: 50%;
}
.toast-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.12); }

.toast-error { background: #3d1f1d; color: #f28b82; }
.toast-success { background: #1a3a24; color: #81c995; }
.toast-info { background: #202124; color: #fff; }

html[data-theme="dark"] .toast-info { background: #3c4043; }

.context-menu {
    position: fixed;
    z-index: 500;
    background: #fff;
    border: none;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15), 0 8px 24px rgba(60, 64, 67, 0.18);
    min-width: 256px;
    padding: 6px 0;
}

.context-menu.hidden, .context-menu[hidden] { display: none; }

.context-menu-sep {
    height: 1px;
    background: #e8eaed;
    margin: 6px 12px;
}

.context-menu button {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 14px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 8px 16px;
    border-radius: 0;
    cursor: pointer;
    color: #3c4043;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.25;
}

.context-menu button .drive-icon-ui,
.context-menu button .drive-icon-action {
    width: 20px;
    height: 20px;
}

.context-menu button .drive-icon-ui svg {
    display: block;
    width: 20px;
    height: 20px;
}

.context-menu-label { min-width: 0; }
.context-menu-end {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 28px;
}
.context-menu-hint {
    color: #80868b;
    font-size: 13px;
    font-weight: 400;
}
.context-menu button:hover,
.context-menu button.is-submenu-open { background: #f1f3f4; }

.context-submenu {
    position: absolute;
    z-index: 501;
    min-width: 240px;
    margin: 0 4px;
    padding: 6px 0;
    background: #fff;
    border: none;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15), 0 8px 24px rgba(60, 64, 67, 0.18);
}

.form-label { display: block; font-size: 12px; color: var(--text-muted); margin: 8px 0 4px; }

.quota-bar-fill.is-warn { background: linear-gradient(90deg, #f9ab00, #e37400); }
.quota-bar-fill.is-crit { background: linear-gradient(90deg, #ea4335, #d93025); }

.share-preview {
    display: block;
    max-width: 100%;
    max-height: 360px;
    margin: 0 auto 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.share-preview-pdf { width: 100%; height: 360px; background: var(--bg); }
.share-preview-video { width: 100%; max-height: 360px; background: #000; }
.share-card { max-width: 560px; }
.trash-hint { margin: 0 0 var(--space-4); }

.file-info-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 92vw;
    background: var(--surface);
    border-left: 1px solid var(--border);
    z-index: 180;
    padding: 20px;
    overflow: auto;
    box-shadow: -8px 0 24px rgba(60, 64, 67, 0.12);
}
.file-info-drawer.hidden, .file-info-drawer[hidden] { display: none; }
.file-info-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.file-info-head h3 { font-size: 16px; word-break: break-word; }
.file-info-list { display: grid; gap: 14px; }
.file-info-list dt { font-size: 12px; color: var(--text-muted); }
.file-info-list dd { font-size: 14px; margin-top: 2px; word-break: break-word; }

.preview-modal {
    background: rgba(32, 33, 36, 0.88);
    align-items: stretch;
    padding: 0;
}
.preview-frame {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}
.preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    color: #fff;
    flex-shrink: 0;
}
#preview-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#preview-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 8px 16px 24px;
}
#preview-body video,
#preview-body img { max-width: 100%; max-height: calc(100vh - 72px); background: #000; }
#preview-body iframe { width: 90vw; height: calc(100vh - 80px); border: 0; background: #fff; }

.zip-preview {
    width: min(720px, 92vw);
    max-height: calc(100vh - 96px);
    overflow: auto;
    background: var(--surface);
    color: var(--text);
    border-radius: 12px;
    padding: 16px 18px;
}
.zip-preview-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.zip-list { list-style: none; font-size: 13px; }
.zip-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    word-break: break-all;
}
.zip-list li.is-dir { color: var(--text-muted); }
.zip-size { color: var(--text-muted); flex-shrink: 0; }

@media (max-width: 768px) {
    .search-form input { width: 200px; }
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .landing-nav { padding: 16px 24px; }
    .home-grid { grid-template-columns: 1fr; }
    .home-shortcuts-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .shortcuts-grid { grid-template-columns: repeat(2, 1fr); }
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }
    .sidebar.is-open { transform: none; }
    .sidebar-toggle { display: inline-flex; }
    .app-body .search-form input { max-width: none; }
    .drive-toolbar { flex-direction: column; align-items: flex-start; gap: 12px; }
    .toolbar-actions { flex-wrap: wrap; }
    .file-actions { opacity: 1; }
    .setup-banner { flex-wrap: wrap; }
    .setup-banner .btn { margin-left: 0; }
}

/* ---------- API keys & developer docs ---------- */
.api-key-form {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 16px 0 20px;
    flex-wrap: wrap;
}

.api-key-form input {
    flex: 1 1 320px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.api-key-reveal {
    background: #e8f0fe;
    border: 1px solid #aecbfa;
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: 16px;
}

.api-key-reveal-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.api-key-reveal code {
    flex: 1 1 auto;
    background: #fff;
    border: 1px solid #aecbfa;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    word-break: break-all;
}

.data-table tr.is-revoked td { opacity: 0.55; }
.data-table .text-right { text-align: right; }

.badge-muted {
    background: var(--bg);
    color: var(--text-muted);
}

.btn-danger { color: #d93025; }
.btn-danger:hover { background: #fce8e6; }

.api-doc-block {
    background: #202124;
    color: #e8eaed;
    border-radius: 10px;
    padding: 16px 18px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
}

.api-doc-block code { white-space: pre; }

.api-endpoint {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
}

.api-method {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    background: #e8f0fe;
    color: #1967d2;
}

.api-method-post { background: #e6f4ea; color: #137333; }
.api-method-delete { background: #fce8e6; color: #c5221f; }

.pager {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 8px;
}

.catalog-filters { margin: 0 0 12px; max-width: 420px; }
.catalog-filters input { width: 100%; max-width: 420px; }
.catalog-cats { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.catalog-subs { margin-top: -8px; }
.catalog-subs .btn { font-size: 12px; }
.catalog-sort { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-size: 13px; }
.catalog-sort select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}
.catalog-form { display: grid; gap: 12px; margin-top: 4px; }
#catalog-modal .modal-content { max-width: 440px; }
.catalog-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.catalog-form input[type="text"],
.catalog-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 400;
}
.catalog-form input[type="file"] { font-weight: 400; }
.catalog-form-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.catalog-hint { font-weight: 400; font-size: 12px; }
.catalog-shop { max-width: 1100px; margin: 0 auto; padding: 24px 20px 64px; }
.file-grid .catalog-item .file-card-head { padding-right: 10px; }
.file-grid .catalog-item .file-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px 12px;
    order: 3;
}
.catalog-item-actions { display: flex; gap: 4px; align-items: center; }
.catalog-item-actions form { margin: 0; }
.catalog-lite-open {
    cursor: pointer;
    border: 0;
    background: none;
    padding: 0;
    text-align: left;
    font: inherit;
    color: inherit;
    width: 100%;
    appearance: none;
}
.catalog-lite-frame {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 56px 72px 80px;
    box-sizing: border-box;
}
#catalog-lite-img {
    max-width: min(960px, 92vw);
    max-height: calc(100vh - 140px);
    object-fit: contain;
    border-radius: 8px;
    background: #111;
}
.catalog-lite-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    color: #fff;
}
.catalog-lite-close {
    position: absolute;
    top: 12px;
    right: 16px;
    color: #fff;
    background: rgba(32, 33, 36, 0.5);
    width: 36px;
    height: 36px;
}
.catalog-lite-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    color: #fff;
    background: rgba(32, 33, 36, 0.5);
    font-size: 28px;
    line-height: 1;
}
#catalog-lite-prev { left: 16px; }
#catalog-lite-next { right: 16px; }
