:root {
    --bg: #0f1420;
    --bg-card: #161d2e;
    --bg-card-hover: #1e2740;
    --accent: #6c5ce7;
    --accent2: #00cec9;
    --text: #e6e9f0;
    --text-dim: #8892a6;
    --border: #262f45;
    --danger: #e74c3c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(160deg, #0f1420 0%, #141a2b 100%);
    color: var(--text);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
}

.brand {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-tagline {
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 2px;
    margin-top: 2px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-dim);
}

.user-chip .logout {
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
}

.user-chip .logout:hover { background: var(--danger); color: #fff; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.hero {
    text-align: center;
    margin-bottom: 40px;
}

.hero h1 {
    font-size: 36px;
    margin: 0 0 8px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 2px;
}

.hero p {
    color: var(--text-dim);
    margin: 0;
    letter-spacing: 1px;
    font-size: 14px;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

@media (max-width: 800px) {
    .tile-grid { grid-template-columns: repeat(2, 1fr); }
}

.tile {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 16px;
    text-align: center;
    transition: all 0.15s ease;
    cursor: pointer;
    position: relative;
}

.tile:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.tile .icon { font-size: 28px; display: block; margin-bottom: 10px; }
.tile .label { font-size: 14px; font-weight: 500; }
.tile .soon {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 9px;
    background: var(--accent);
    color: #fff;
    padding: 2px 6px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.panel h2 {
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin: 0 0 16px;
}

.storage-bar-track {
    background: #0b0f1a;
    border-radius: 8px;
    height: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.storage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.storage-label { font-size: 13px; color: var(--text-dim); }

.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-dim);
}
.activity-list li:last-child { border-bottom: none; }
.activity-list li .time { float: right; font-size: 12px; color: #565f75; }

.auth-wrap {
    max-width: 380px;
    margin: 80px auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 36px;
}

.auth-wrap h1 { text-align: center; font-size: 24px; margin-bottom: 4px; }
.auth-wrap .sub { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #0b0f1a;
    color: var(--text);
    font-size: 14px;
}
.field input:focus { outline: none; border-color: var(--accent); }

.btn {
    width: 100%;
    padding: 11px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn:hover { opacity: 0.9; }

.alert {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid var(--danger);
    color: #ff8a80;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert.success {
    background: rgba(0, 206, 201, 0.12);
    border-color: var(--accent2);
    color: var(--accent2);
}

.breadcrumb { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }
.breadcrumb a:hover { color: var(--accent2); }

.file-table { width: 100%; border-collapse: collapse; }
.file-table th, .file-table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.file-table th { color: var(--text-dim); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.file-table tr:hover td { background: var(--bg-card-hover); }
.file-actions a { margin-right: 12px; font-size: 13px; color: var(--text-dim); }
.file-actions a:hover { color: var(--accent2); }
.file-actions a.delete:hover { color: var(--danger); }

.upload-row { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.upload-row input[type=file] { color: var(--text-dim); font-size: 13px; }
.upload-row .btn, .upload-row button { width: auto; padding: 9px 18px; }

.soon-page {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-dim);
}
.soon-page .icon { font-size: 48px; display: block; margin-bottom: 16px; }
.soon-page h1 { color: var(--text); margin-bottom: 8px; }

.doc-title-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 22px;
    font-weight: 600;
    padding: 6px 0;
    margin-bottom: 4px;
}
.doc-title-input:focus { outline: none; border-bottom: 1px solid var(--accent); }

.doc-status { font-size: 12px; color: var(--text-dim); margin-bottom: 14px; }
.doc-status.saved { color: var(--accent2); }

.doc-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    background: #0b0f1a;
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    padding: 8px;
}
.doc-toolbar button {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text);
    border-radius: 6px;
    width: 34px;
    height: 34px;
    font-size: 14px;
    cursor: pointer;
}
.doc-toolbar button:hover { background: var(--bg-card-hover); border-color: var(--border); }
.doc-toolbar select {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    padding: 0 6px;
}

.doc-editor {
    min-height: 500px;
    background: #ffffff;
    color: #1a1a1a;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 32px 40px;
    font-size: 15px;
    line-height: 1.6;
}
.doc-editor:focus { outline: none; }
.doc-editor ul, .doc-editor ol { padding-left: 24px; }

/* ---------- Drive v2 ---------- */

.drive-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.drive-toolbar .spacer { flex: 1; }

.drive-search {
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #0b0f1a;
    color: var(--text);
    font-size: 13px;
    min-width: 200px;
}

.drive-select {
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #0b0f1a;
    color: var(--text);
    font-size: 13px;
}

.btn-sm {
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card-hover);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.btn-sm:hover { border-color: var(--accent); }
.btn-sm.primary {
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border: none;
    color: #fff;
}

.drive-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.drive-tabs a {
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-dim);
    border: 1px solid var(--border);
}
.drive-tabs a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.dropzone-active::after {
    content: 'Drop files to upload';
    position: fixed;
    inset: 0;
    background: rgba(108, 92, 231, 0.15);
    border: 3px dashed var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--accent2);
    z-index: 999;
    pointer-events: none;
}

.upload-progress {
    margin-bottom: 16px;
}
.upload-progress-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    font-size: 13px;
}
.upload-progress-item .name { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--text-dim); }
.upload-progress-track { background: #0b0f1a; border-radius: 6px; height: 6px; overflow: hidden; }
.upload-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); width: 0%; transition: width 0.2s; }
.upload-progress-item.done .upload-progress-fill { background: var(--accent2); }
.upload-progress-item.error .name { color: var(--danger); }

/* Grid view */
.drive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.grid-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
}
.grid-item:hover { border-color: var(--accent); background: var(--bg-card-hover); }
.grid-item.drag-over { border-color: var(--accent2); background: rgba(0,206,201,0.1); }
.grid-item .thumb {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin-bottom: 8px;
    overflow: hidden;
    border-radius: 6px;
    background: #0b0f1a;
}
.grid-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.grid-item .gname {
    font-size: 12px;
    color: var(--text);
    word-break: break-word;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
}
.grid-item .star-badge { position: absolute; top: 6px; left: 6px; font-size: 12px; }
.grid-item .kebab {
    position: absolute;
    top: 4px;
    right: 4px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.grid-item .kebab:hover { background: var(--bg); color: var(--text); }

/* List view row kebab + drag target */
.file-table tr.drag-over td { background: rgba(0,206,201,0.12) !important; outline: 1px dashed var(--accent2); }
.row-kebab {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 8px;
}
.row-kebab:hover { color: var(--text); }

/* Dropdown menu */
.dropdown-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px;
    min-width: 170px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    z-index: 500;
}
.dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}
.dropdown-menu button:hover { background: var(--bg-card-hover); }
.dropdown-menu button.danger { color: #ff8a80; }
.dropdown-menu hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 800;
}
.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 440px;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-box h3 { margin: 0 0 16px; font-size: 16px; }
.modal-folder-list { list-style: none; padding: 0; margin: 0 0 16px; max-height: 280px; overflow-y: auto; }
.modal-folder-list li a {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
}
.modal-folder-list li a:hover, .modal-folder-list li a.selected { background: var(--bg-card-hover); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

.preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
}
.preview-box {
    max-width: 90vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.preview-box img, .preview-box video { max-width: 90vw; max-height: 75vh; border-radius: 8px; }
.preview-box iframe { width: 80vw; height: 75vh; border: none; border-radius: 8px; background: #fff; }
.preview-box pre { width: 80vw; height: 75vh; overflow: auto; background: #fff; color: #111; padding: 20px; border-radius: 8px; white-space: pre-wrap; }
.preview-title { color: #fff; margin-top: 14px; font-size: 14px; }
.preview-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
}

/* ---------- Photos ---------- */

.photo-month-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dim);
    margin: 24px 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.photo-month-header:first-child { margin-top: 0; }

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
}
.photo-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #0b0f1a;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb:hover img { opacity: 0.85; }
.photo-thumb .album-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-img-wrap { max-width: 88vw; max-height: 78vh; display: flex; align-items: center; justify-content: center; }
.lightbox-img-wrap img { max-width: 88vw; max-height: 78vh; border-radius: 6px; }
.lightbox-nav {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 15%;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    opacity: 0.6;
}
.lightbox-nav:hover { opacity: 1; }
.lightbox-nav.prev { left: 0; }
.lightbox-nav.next { right: 0; }
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 24px;
    color: #fff;
    font-size: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
}
.lightbox-actions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: rgba(20,26,43,0.9);
    padding: 8px;
    border-radius: 10px;
}
.lightbox-actions button {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 16px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}
.lightbox-actions button:hover { background: rgba(255,255,255,0.1); }
.lightbox-caption {
    position: absolute;
    top: 16px;
    left: 24px;
    color: #fff;
    font-size: 13px;
    opacity: 0.8;
}

.album-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
}
.album-card .album-cover { aspect-ratio: 4/3; background: #0b0f1a; display: flex; align-items: center; justify-content: center; font-size: 32px; overflow: hidden; }
.album-card .album-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-card .album-name { padding: 10px 12px; font-size: 14px; }
.album-card .album-count { padding: 0 12px 10px; font-size: 12px; color: var(--text-dim); }
