/* ═══════════════════════════════════════════════════════════════════════════
   DrivePool — Complete Stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ─────────────────────────────────────────────── */
:root {
    --primary:         #0F6E56;
    --primary-dark:    #0A5242;
    --primary-light:   #E8F5F1;
    --primary-muted:   #5BA090;

    --bg:              #F5F4F0;
    --bg-card:         #FFFFFF;
    --bg-sidebar:      #1A1A2E;
    --bg-navbar:       #FFFFFF;

    --text:            #1A1A1A;
    --text-muted:      #6B7280;
    --text-light:      #9CA3AF;
    --text-sidebar:    #E2E8F0;

    --border:          #E5E7EB;
    --border-light:    #F3F4F6;

    --danger:          #DC2626;
    --danger-light:    #FEF2F2;
    --warning:         #D97706;
    --warning-light:   #FFFBEB;
    --success:         #059669;
    --success-light:   #ECFDF5;
    --info:            #2563EB;
    --info-light:      #EFF6FF;

    --shadow-sm:       0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow:          0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-md:       0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg:       0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl:       0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);

    --radius-sm:       0.25rem;
    --radius:          0.5rem;
    --radius-md:       0.75rem;
    --radius-lg:       1rem;
    --radius-xl:       1.5rem;

    --sidebar-width:   240px;
    --navbar-height:   60px;

    --font:            'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono:       'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

    --transition:      150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-md:   250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    font-size: 1rem; /* 14px — teks utama standar */
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: env(safe-area-inset-bottom);
    /* Pemenggalan kata aman: pecah antar kata, jangan di tengah kata */
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
}

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

a:hover { color: var(--primary-dark); }

code {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    background: var(--border-light);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
}

/* ── Utility ───────────────────────────────────────────────────────────── */
.mb-4 { margin-bottom: 1rem; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
    box-shadow: 0 4px 12px rgba(15,110,86,0.3);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--border-light);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover {
    background: #B91C1C;
    box-shadow: 0 4px 12px rgba(220,38,38,0.3);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-full { width: 100%; justify-content: center; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 1rem; /* min 16px — prevents iOS Safari auto-zoom on focus */
    color: var(--text);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    -webkit-appearance: none;
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15,110,86,0.12);
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%236B7280'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    line-height: 1.5;
    position: relative;
}

.alert-error   { background: var(--danger-light);  color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: var(--warning-light); color: #92400E; border: 1px solid #FDE68A; }
.alert-success { background: var(--success-light); color: #065F46; border: 1px solid #A7F3D0; }
.alert-info    { background: var(--info-light);    color: #1E40AF; border: 1px solid #BFDBFE; }

.alert-close {
    position: absolute;
    right: 0.5rem;
    top: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.125rem;
    line-height: 1;
    color: inherit;
    opacity: 0.6;
}
.alert-close:hover { opacity: 1; }

/* ── Badge ──────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.6em;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }

/* ══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════════════════════ */
.login-layout {
    background: linear-gradient(135deg, #0F6E56 0%, #1A4A3C 50%, #0A2E25 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    margin-bottom: 0.75rem;
}


.login-logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.login-form .form-input {
    font-size: 1rem;
    padding: 0.75rem 1rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   APP LAYOUT
   ══════════════════════════════════════════════════════════════════════════ */
.app-layout {
    background: var(--bg);
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Navbar ─────────────────────────────────────────────────────────────── */
/* ── Hamburger ──────────────────────────────────────────────────────────── */
.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--border-light); color: var(--text); }

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--navbar-height);
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem 0 1rem;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.navbar-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-user-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trial-navbar-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
    text-decoration: none;
    white-space: nowrap;
}
.trial-navbar-badge:hover { background: #ffedd5; }

.plan-navbar-badge {
    font-size: 0.7857rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    letter-spacing: 0.04em;
}
.plan-pro     { background: rgba(15,110,86,0.1); color: var(--primary); }
.plan-premium { background: rgba(79,70,229,0.1); color: #4f46e5; }
.plan-max     { background: rgba(217,119,6,0.1); color: #b45309; }

/* Versi singkat trial badge — hanya tampil di mobile (lihat media query) */
.nav-badge-short { display: none; }

/* ── Bulk select: checkbox bulat ──────────────────────────────────────────── */
.col-select { width: 44px; }
.col-select-header, .file-select-cell { text-align: center; width: 44px; }
.file-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 50%;                 /* BULAT, bukan persegi */
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
    vertical-align: middle;
}
.file-checkbox:hover { border-color: var(--primary); transform: scale(1.1); }
.file-checkbox.checked {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.file-checkbox svg { display: block; }

/* Checkbox di kartu grid: pojok kiri atas, muncul saat hover atau saat terpilih */
.file-card { position: relative; }
.file-card-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 4;
    opacity: 0;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.file-card:hover .file-card-checkbox,
.file-card-checkbox.checked { opacity: 1; }

/* Baris & kartu terpilih */
.row-selected { background: rgba(15,110,86,0.07) !important; }
.card-selected { border-color: var(--primary) !important; box-shadow: 0 0 0 2px rgba(15,110,86,0.25); }

/* ── Drag & Drop antar folder ─────────────────────────────────────────────── */
.row-dragging { opacity: 0.4; background: rgba(15,110,86,0.04) !important; }
.row-drop-target {
    background: rgba(15,110,86,0.12) !important;
    outline: 2px dashed var(--primary, #0f6e56);
    outline-offset: -2px;
    border-radius: 4px;
}
.row-drop-target td { color: var(--primary, #0f6e56); }

/* List view: checkbox baris muncul saat hover baris atau saat terpilih.
   Di mobile selalu tampil agar bisa di-tap. */
.file-row .file-checkbox, .folder-row .file-checkbox { opacity: 0.35; }
.file-row:hover .file-checkbox,
.folder-row:hover .file-checkbox,
.file-checkbox.checked { opacity: 1; }

/* ── Bulk action bar (mengambang bawah) ──────────────────────────────────── */
.bulk-action-bar {
    position: fixed;
    left: 50%;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 6000;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #1f2937;
    color: #fff;
    padding: 0.625rem 0.875rem 0.625rem 1.125rem;
    border-radius: 999px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    animation: bulkBarIn 0.2s cubic-bezier(0.34,1.56,0.64,1);
    max-width: calc(100vw - 2rem);
    flex-wrap: wrap;
    justify-content: center;
}
@keyframes bulkBarIn {
    from { opacity: 0; transform: translate(-50%, 16px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
.bulk-count { font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.bulk-actions { display: flex; gap: 0.375rem; }
.bulk-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 38px;
    padding: 0 0.875rem;
    border: none;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.bulk-btn:hover { background: rgba(255,255,255,0.22); }
.bulk-btn-danger { background: rgba(220,38,38,0.85); }
.bulk-btn-danger:hover { background: #dc2626; }
.bulk-btn-ghost { background: transparent; opacity: 0.7; }
.bulk-btn-ghost:hover { background: rgba(255,255,255,0.1); opacity: 1; }
@media (max-width: 600px) {
    .bulk-btn { padding: 0 0.625rem; font-size: 0.75rem; }
    .bulk-btn svg { display: none; }
}

/* ── Main Layout ────────────────────────────────────────────────────────── */
.main-layout {
    display: flex;
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    left: 0;
    top: var(--navbar-height);
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
    transition: width 0.25s ease, transform 0.25s ease;
}

/* Mini mode: icon-only sidebar */
.sidebar.mini {
    width: 64px;
}
.sidebar.mini .sidebar-title,
.sidebar.mini .sidebar-add-label,
.sidebar.mini .account-info,
.sidebar.mini .sidebar-footer,
.sidebar.mini .sidebar-add-btn { display: none !important; }
.sidebar.mini .sidebar-add-icon { display: flex !important; }
.sidebar.mini .sidebar-header { justify-content: center; padding: 0.875rem 0; }
.sidebar.mini .sidebar-header-actions { justify-content: center; }
.sidebar.mini .account-item { justify-content: center; padding: 0.45rem 0; }
.sidebar.mini .account-item .account-avatar { width: 26px; height: 26px; font-size: 0.7857rem; }
.sidebar.mini .account-actions { display: none !important; }
.sidebar.mini .account-list { padding: 0.5rem 0.25rem; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 49;
}
.sidebar-overlay.active { display: block; }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem 0.875rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.sidebar-header h3,
.sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    overflow: hidden;
}

/* ── Account List ───────────────────────────────────────────────────────── */
.account-list-wrap {
    flex: 1;
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.account-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.375rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

/* Indikator scroll: panah turun + fade, muncul hanya bila ada akun tersembunyi */
.account-scroll-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 30px;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 3px;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,0.85);
    background: linear-gradient(to top, var(--bg-sidebar, #1A1A2E) 30%, transparent);
    animation: accountHintBounce 1.6s ease-in-out infinite;
}
.account-list-wrap.can-scroll .account-scroll-hint {
    display: flex;
}
@keyframes accountHintBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(2px); }
}

.account-list::-webkit-scrollbar { width: 4px; }
.account-list::-webkit-scrollbar-track { background: transparent; }
.account-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.account-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    margin-bottom: 1px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
    border: 1px solid transparent;
}

.account-item:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.08);
}

.account-item.active {
    background: rgba(15,110,86,0.3);
    border-color: rgba(15,110,86,0.4);
}

/* Akun terkunci (di luar batas paket) — tampil redup, tak bisa diakses */
.account-item.locked {
    opacity: 0.55;
    cursor: not-allowed;
}
.account-item.locked:hover {
    background: rgba(220,38,38,0.08);
    border-color: rgba(220,38,38,0.25);
}
.account-item.locked .account-avatar {
    filter: grayscale(0.8);
}
.account-lock {
    display: inline-flex;
    vertical-align: middle;
    color: #fca5a5;
    margin-left: 2px;
}

.account-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
    background: rgba(15,110,86,0.25);
    border-color: rgba(26,188,156,0.5);
}

.account-item[draggable="true"]:active {
    cursor: grabbing;
}

.account-rename-input {
    background: transparent;
    border: none;
    border-bottom: 1.5px solid #0F6E56;
    outline: none;
    font: inherit;
    font-size: .8125rem;
    font-weight: 500;
    color: inherit;
    padding: 0 0 1px 0;
    margin: 0;
    width: 100%;
    min-width: 0;
    line-height: 1.4;
}
.account-rename-input::placeholder {
    color: #9ca3af;
}

.account-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.7857rem;
    overflow: hidden;
}

.account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.account-name {
    font-size: 0.9286rem; /* ≈13px */
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-sidebar);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-email {
    font-size: 0.7857rem; /* ≈11px */
    line-height: 1.25;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-actions {
    display: none;
    gap: 0.25rem;
}

/* Show delete only on hover in expanded mode — never in mini mode */
.sidebar:not(.mini) .account-item:hover .account-actions {
    display: flex;
}

.account-actions .btn-icon {
    min-width: 26px;
    min-height: 26px;
    width: 26px;
    height: 26px;
}
.account-actions .btn-icon:first-child:hover {
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.9);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-icon:hover {
    background: rgba(220,38,38,0.2);
    color: #FCA5A5;
}

/* ── Sidebar Footer ─────────────────────────────────────────────────────── */
.sidebar-footer {
    padding: 0.875rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.storage-summary {
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    padding: 0.75rem;
}

.summary-label {
    font-size: 0.7857rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.4);
    margin-bottom: 0.3rem;
}

.summary-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
}

/* ── Content Area ───────────────────────────────────────────────────────── */
.content-area {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 1.5rem;
    max-width: 100%;
    overflow-x: hidden;
    transition: margin-left 0.25s ease;
}

body.sidebar-mini .content-area  { margin-left: 64px; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tab-nav {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-card);
    padding: 0.375rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    width: fit-content;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.125rem;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(15,110,86,0.25);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn var(--transition-md) ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Toolbar ────────────────────────────────────────────────────────────── */
.tab-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.tab-toolbar .form-select {
    min-width: 200px;
    max-width: 280px;
}

.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 340px;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

.search-input {
    padding-left: 2.25rem !important;
}

/* ── File Table ─────────────────────────────────────────────────────────── */
.file-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* Fixed column widths — consistent across all accounts */
.file-table .col-name   { width: 55%; }
.file-table .col-size   { width: 12%; }
.file-table .col-date   { width: 28%; }
.file-table .col-action { width: 52px; }

.col-action-header,
.file-menu-cell {
    text-align: center;
    width: 52px;
}

.file-table thead {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.file-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.file-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
    color: var(--text);
    vertical-align: middle;
    overflow: hidden;
}

/* Size and date columns: never wrap */
.file-table td:nth-child(2),
.file-table td:nth-child(3) {
    white-space: nowrap;
    color: var(--text-muted);
}

.file-table tbody tr {
    transition: background var(--transition);
}

.file-table tbody tr:hover {
    background: var(--primary-light);
}

.file-table tbody tr:last-child td {
    border-bottom: none;
}

.file-name-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0; /* allow flex child to shrink inside fixed column */
    overflow: hidden;
}

.file-name-cell .file-name-link,
.file-name-cell .file-name-text,
.file-name-cell .folder-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.file-name-cell img {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.file-name-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.file-size, .file-date {
    color: var(--text-muted);
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════
   GOOGLE DRIVE STYLE TABLE
   Kolom: Name / Owner / Date modified / File size / Action
   ══════════════════════════════════════════════════════════ */
.gdrive-table {
    border: none;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
}
.gdrive-table .col-name   { width: auto; }
.gdrive-table .col-owner  { width: 16%; }
.gdrive-table .col-date   { width: 20%; }
.gdrive-table .col-size   { width: 12%; }
.gdrive-table .col-action { width: 56px; }

/* Header: tidak uppercase, ringan, garis bawah tipis (mirip GDrive) */
.gdrive-table thead {
    background: transparent;
    border-bottom: 1px solid var(--border);
}
.gdrive-table th {
    padding: 0.5rem 1rem;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
}
/* Kolom 1 = checkbox seleksi. Owner=3, Date=4, Size=5 (digeser oleh kolom select).
   Beri gaya muted pada Owner & Date. */
.gdrive-table td:nth-child(3),
.gdrive-table td:nth-child(4) {
    white-space: nowrap;
    color: var(--text-muted);
}
.gdrive-table td {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-light);
}
.gdrive-table tbody tr:hover {
    background: var(--primary-light);
}

/* Tombol sort di header (Name / Date modified / File size) */
.gdrive-table .sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}
.gdrive-table .sort-btn:hover { color: var(--text); }
.gdrive-table .sort-btn.sort-active { color: var(--primary); }
.gdrive-table .sort-arrow {
    font-size: 0.75rem;
    color: var(--primary);
    line-height: 1;
}

/* Tombol toggle dropdown sort (ikon kanan atas) */
.gdrive-sort-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.gdrive-sort-toggle:hover { background: var(--border-light); color: var(--text); }

/* Kolom Owner: avatar bulat + nama */
.owner-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.owner-avatar {
    width: 22px; height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}
.owner-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0F6E56, #16A085);
    color: #fff;
    font-size: 0.7857rem;
    font-weight: 700;
}
.owner-name {
    font-size: 0.8125rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Dropdown menu sort (ala Google Drive) ── */
.gdrive-sort-menu {
    position: fixed;
    z-index: 5000;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.16), 0 2px 8px rgba(0,0,0,.08);
    padding: 0.5rem 0;
    min-width: 240px;
}
.gsm-section-label {
    font-size: 0.7857rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 0.5rem 1rem 0.25rem;
}
.gsm-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}
.gsm-item:hover { background: var(--bg); }
.gsm-check {
    width: 16px; height: 16px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}
.gsm-item.checked .gsm-check::before {
    content: '✓';
    font-size: 0.875rem;
    font-weight: 700;
}
.gsm-divider {
    height: 1px;
    background: var(--border-light);
    margin: 0.375rem 0;
}

/* Responsif: sembunyikan Owner & Date di layar kecil.
   Kolom 1=checkbox, 3=Owner, 4=Date (pakai nth-child sesuai posisi baru). */
@media (max-width: 768px) {
    .gdrive-table th:nth-child(3),
    .gdrive-table td:nth-child(3),
    .gdrive-table th:nth-child(4),
    .gdrive-table td:nth-child(4) { display: none; }
}

/* ── Inbox List ─────────────────────────────────────────────────────────── */
.inbox-list {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.email-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background var(--transition);
}

.email-item:last-child { border-bottom: none; }
.email-item:hover { background: var(--bg); }
.email-item.unread { background: rgba(15,110,86,0.03); }
.email-item.unread .email-subject { font-weight: 600; }

.email-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.email-content { flex: 1; min-width: 0; }

.email-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.2rem;
}

.email-from {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-date {
    font-size: 0.75rem;
    color: var(--text-light);
    white-space: nowrap;
    flex-shrink: 0;
}

.email-subject {
    font-size: 0.875rem;
    color: var(--text);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-snippet {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.btn-xs {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    min-height: 36px;
    gap: 0.3rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.btn-xs:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-light);
}

.unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 0.4rem;
}

/* ── Storage Cards ──────────────────────────────────────────────────────── */
.storage-grid {
    display: grid;
    /* Default fleksibel: kartu min 200px → otomatis sesuai lebar */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
/* Desktop besar: paksa 5 kolom (kartu tetap menampilkan semua info) */
@media (min-width: 1280px) {
    .storage-grid { grid-template-columns: repeat(5, 1fr); }
}
/* Desktop sedang: 4 kolom agar tidak terlalu sempit */
@media (min-width: 1024px) and (max-width: 1279px) {
    .storage-grid { grid-template-columns: repeat(4, 1fr); }
}

.storage-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border-style: solid;
    border-color: var(--border);
    border-width: var(--card-border-w, 1px);
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.4s ease,
                border-width 0.15s ease;
    will-change: transform;
    overflow: hidden;
    position: relative;
}

.storage-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 0 0 transparent;
    transition: box-shadow .2s;
}

.storage-card:hover {
    transform: translateY(-4px) scale(1.03);
    border-color: var(--primary);
    box-shadow: 0 16px 32px rgba(0,0,0,0.14), 0 4px 8px rgba(0,0,0,0.08);
}

.storage-card.danger  .storage-card-track .storage-card-fill { background: var(--danger); }
.storage-card.warning .storage-card-track .storage-card-fill { background: var(--warning); }
.storage-card.ok      .storage-card-track .storage-card-fill { background: var(--success); }

.storage-card-active {
    border-color: var(--primary);
    background: rgba(15,110,86,.05);
}

/* Cincin hijau berdenyut menandakan kartu akun yang aktif.
   Pakai pseudo-element ::before agar tidak menimpa box-shadow (bayangan) kartu. */
.storage-card-active::before {
    box-shadow: 0 0 0 2px var(--primary);
    animation: storageActivePulse 2s ease-in-out infinite;
}

@keyframes storageActivePulse {
    0%, 100% {
        box-shadow: 0 0 0 2px var(--primary), 0 0 0 0 rgba(15,110,86,.45);
    }
    50% {
        box-shadow: 0 0 0 2px var(--primary), 0 0 0 6px rgba(15,110,86,0);
    }
}

.storage-card-error {
    cursor: default;
}

/* Kartu error tidak interaktif — jangan ikut animasi zoom */
.storage-card-error:hover {
    transform: none;
    border-color: var(--border);
    box-shadow: none;
}

/* Tombol edit kartu (muncul saat hover) */
.storage-card-edit {
    position: absolute;
    top: .5rem;
    right: .5rem;
    z-index: 3;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: rgba(0,0,0,0.05);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s, background .15s, color .15s;
}
.storage-card:hover .storage-card-edit { opacity: 1; }
.storage-card-edit:hover { background: var(--primary); color: #fff; }

/* Warna aksen kustom (dari modal edit): seluruh border pakai warna aksen,
   tebal mengikuti slider (--card-border-w sudah diterapkan di rule dasar). */
.storage-card-custom {
    border-color: var(--card-accent) !important;
}
.storage-card-custom .storage-card-fill {
    background: var(--card-accent) !important;
}

/* Kartu akun TERKUNCI (di luar batas paket) — redup, tak bisa diklik */
.storage-card-locked {
    cursor: not-allowed;
    opacity: 0.7;
    border-style: dashed;
    border-color: rgba(220,38,38,0.35);
    background: rgba(220,38,38,0.03);
}
.storage-card-locked:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(220,38,38,0.5);
}
.storage-card-locked .storage-avatar { filter: grayscale(0.85); }
.storage-lock {
    display: inline-flex;
    vertical-align: middle;
    color: #dc2626;
    margin-left: 3px;
}
.storage-card-locked-msg {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1rem 1rem;
    font-size: .75rem;
    line-height: 1.4;
    color: #b91c1c;
}
.storage-card-locked-msg svg { flex-shrink: 0; color: #dc2626; }

.storage-card-head {
    padding: .875rem 1rem 0;
}

.storage-card-row {
    display: flex;
    align-items: center;
    gap: .625rem;
}

.storage-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: 600;
    font-size: .75rem;
    overflow: hidden;
    flex-shrink: 0;
}

.storage-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.storage-card-meta {
    min-width: 0;
    flex: 1;
}

.storage-card-name {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.storage-card-email {
    font-size: 0.7857rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: -.05rem;
}

.storage-card-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity .2s, transform .2s;
}

.storage-card:hover .storage-card-arrow {
    opacity: .5;
}

.storage-card:hover .storage-card-arrow svg {
    transform: translateX(2px);
}

.storage-card-body {
    padding: .75rem 1rem 1rem;
}

.storage-card-used {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--text);
}

.storage-card-unit {
    font-size: .75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.storage-card-sub {
    font-size: 0.7857rem;
    color: var(--text-muted);
    margin: .125rem 0 .5rem;
}

.storage-card-track {
    height: 3px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.storage-card-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .4s ease;
}

.storage-card-errmsg {
    margin: .625rem 1rem 1rem;
    font-size: .75rem;
    color: var(--danger);
    display: flex;
    align-items: flex-start;
    gap: .375rem;
    line-height: 1.45;
}

/* ── Storage Total ─────────────────────────────────────────────────────── */
.storage-total {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.storage-total-main {
    display: flex;
    align-items: baseline;
    gap: .375rem;
    line-height: 1;
}

.storage-total-used {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -.03em;
}

.storage-total-slash {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

.storage-total-cap {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.storage-total-track {
    height: 8px;
    background: var(--bg-sidebar);
    border-radius: 999px;
    overflow: hidden;
    margin: .75rem 0 .625rem;
}

.storage-total-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .5s cubic-bezier(.4,0,.2,1);
}
.storage-total-fill.danger  { background: var(--danger); }
.storage-total-fill.warning { background: var(--warning); }
.storage-total-fill.ok      { background: var(--success); }

.storage-total-sub {
    font-size: .75rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
}

.storage-total-dot {
    color: var(--border);
    margin: 0 .125rem;
}

@media (max-width: 600px) {
    .storage-total { padding: 1rem 1.125rem; }
    .storage-total-used { font-size: 1.625rem; }
    .storage-total-sub { font-size: 0.7857rem; }
}

/* ── Empty State ────────────────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    gap: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border);
}

.empty-state p { font-size: 0.9375rem; }

/* ── Loading State ──────────────────────────────────────────────────────── */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ── Spinner ────────────────────────────────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-sm {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Skeleton ───────────────────────────────────────────────────────────── */
.skeleton-list { padding: 0.5rem; }

.skeleton-item {
    height: 52px;
    background: rgba(255,255,255,0.07);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0%   { opacity: 0.5; }
    50%  { opacity: 0.9; }
    100% { opacity: 0.5; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn var(--transition) ease;
}

.modal {
    background: #fff;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp var(--transition-md) cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--border);
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: calc(var(--navbar-height) + 1rem);
    right: 1rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.875rem 1.125rem;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    min-width: 280px;
    max-width: 380px;
    pointer-events: all;
    animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-left: 4px solid var(--primary);
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error   { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info    { border-left-color: var(--info); }

.toast-out {
    animation: toastOut 0.25s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0) scale(1); max-height: 100px; }
    to   { opacity: 0; transform: translateX(40px) scale(0.95); max-height: 0; padding: 0; margin: 0; }
}

.toast-icon { flex-shrink: 0; margin-top: 0.1rem; }
.toast-success .toast-icon { color: var(--success); }
.toast-error   .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info    .toast-icon { color: var(--info); }

.toast-body { flex: 1; }

.toast-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.125rem;
}

.toast-message {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */
/* ── 900px: sidebar narrower ──────────────────────────────────────────────── */
@media (max-width: 900px) {
    :root { --sidebar-width: 220px; }
}

/* ── 700px: mobile layout ────────────────────────────────────────────────── */
@media (max-width: 700px) {

    /* Sidebar: off-canvas drawer */
    .sidebar {
        transform: translateX(-100%);
        z-index: 150;
        width: var(--sidebar-width) !important;
    }
    .sidebar.open { transform: translateX(0); }

    /* Kunci scroll halaman saat drawer sidebar terbuka */
    body.drawer-open { overflow: hidden; }

    /* Reset mini-mode overrides — on mobile it's always full sidebar */
    .sidebar.mini { width: var(--sidebar-width) !important; }
    .sidebar.mini .sidebar-title,
    .sidebar.mini .sidebar-add-label,
    .sidebar.mini .account-info,
    .sidebar.mini .sidebar-footer,
    .sidebar.mini .sidebar-add-btn { display: flex !important; }
    .sidebar.mini .sidebar-add-icon { display: none !important; }
    .sidebar.mini .account-item { justify-content: flex-start; padding: 0.75rem 0.875rem; }
    .sidebar.mini .account-item .account-avatar { width: 32px; height: 32px; font-size: 0.75rem; }
    .sidebar.mini .account-actions { display: none !important; }
    .sidebar.mini .account-item:hover .account-actions { display: flex !important; }
    .sidebar.mini .account-list { padding: 0.5rem; }
    .sidebar.mini .sidebar-header { justify-content: space-between; padding: 1.25rem 1rem 0.875rem; }

    /* Content: full width */
    .content-area {
        margin-left: 0 !important;
        padding: 0.875rem;
    }

    .navbar { padding: 0 1rem; }
    .logout-label { display: none; }

    /* Top bar mobile: utamakan AKSI, ringkas INFO status agar tidak boros ruang */
    .navbar-actions { gap: 0.375rem; }
    .navbar-user-name { display: none; }                 /* nama user disembunyikan */
    .nav-status-badge.plan-pro,
    .nav-status-badge.plan-premium,
    .nav-status-badge.plan-max { display: none; }        /* badge plan disembunyikan */
    .nav-badge-text { display: none; }                   /* teks panjang ('SUPERADMIN', 'Trial berakhir N hari') disembunyikan */
    .nav-badge-short { display: inline; }                 /* versi singkat 'Trial' muncul */
    /* Badge superadmin: sisakan bintang saja, jadi lingkaran kecil */
    .nav-status-badge { padding: 0.25rem 0.45rem; font-size: 0.875rem; }

    /* Tab nav: scrollable row, full width */
    .tab-nav {
        width: 100%;
        overflow-x: auto;
        }
    .tab-nav::-webkit-scrollbar { display: none; }
    .tab-nav { scrollbar-width: none; }

    /* Toolbar: stack in two rows */
    .tab-toolbar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .tab-toolbar .form-select {
        min-width: 0;
        flex: 1 1 140px;
        max-width: 100%;
    }
    .search-wrapper {
        flex: 1 1 140px;
        max-width: 100%;
    }

    /* FILE TABLE (trash & non-gdrive): hide size+date cols */
    .file-table:not(.gdrive-table) .col-size,
    .file-table:not(.gdrive-table) .col-date { display: none; }

    .file-table:not(.gdrive-table) th:nth-child(2),
    .file-table:not(.gdrive-table) td:nth-child(2),
    .file-table:not(.gdrive-table) th:nth-child(3),
    .file-table:not(.gdrive-table) td:nth-child(3) { display: none; }

    .file-table:not(.gdrive-table) .col-name { width: calc(100% - 52px); }
    .file-table:not(.gdrive-table) .col-action { width: 52px; }

    /* GDRIVE TABLE di mobile: tampilkan Name + File size saja */
    .gdrive-table .col-name { width: calc(100% - 52px - 22%); }
    .gdrive-table .col-size { display: table-column; }
    .gdrive-table th:nth-child(4),
    .gdrive-table td:nth-child(4) { display: table-cell; }

    /* File table wrapper: allow scroll if content overflows */
    #file-list-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* File card grid: 2 cols on most mobiles */
    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.5rem;
    }

    /* File card menu always visible on touch (no hover) */
    .file-card-menu { opacity: 1; }

    /* Storage grid: single column */
    .storage-grid { grid-template-columns: 1fr; }

    /* Gmail bulk bar: wrap */
    .gmail-bulk-bar { flex-wrap: wrap; gap: 0.5rem; }

    /* Footer */
    .app-footer { margin-left: 0 !important; padding: 0.625rem 1rem; }

    /* Prevent iOS input zoom: font-size must be >= 16px on focus */
    input, select, textarea { font-size: 16px !important; }
}

/* ── 480px: small phones ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .content-area { padding: 0.75rem; }

    .login-card { padding: 1.75rem 1.25rem; }

    .modal {
        border-radius: var(--radius-lg);
        max-height: 90vh;
        overflow-y: auto;
    }

    .tab-btn {
        font-size: 0.8125rem;
        padding: 0.4rem 0.625rem;
        gap: 0.25rem;
    }
    /* Hide tab labels, keep icons */
    .tab-btn svg { flex-shrink: 0; }

    /* Toolbar: each row item full width */
    .tab-toolbar .form-select,
    .tab-toolbar .search-wrapper { flex: 1 1 100%; }

    /* Breadcrumb: allow wrapping */
    .breadcrumb { flex-wrap: wrap; }

    /* File table rows: more compact */
    .file-table th,
    .file-table td { padding: 0.625rem 0.75rem; }

    /* File cards: min 2 per row even on 360px */
    .file-grid { grid-template-columns: repeat(2, 1fr); }

    /* Email list items: compress avatar */
    .email-avatar { width: 32px; height: 32px; font-size: 0.75rem; }

    /* Storage summary: compact */
    .storage-total-used { font-size: 1.5rem; }

    /* Compose / modal footer: stack buttons */
    .modal-footer { flex-direction: column; gap: 0.5rem; }
    .modal-footer .btn { width: 100%; justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BREADCRUMB & FOLDER BROWSER
   ═══════════════════════════════════════════════════════════════════════════ */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
    font-size: 0.875rem;
}
.breadcrumb-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    padding: 0.1rem 0.3rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}
.breadcrumb-btn:hover { background: var(--primary-light); }
.breadcrumb-sep { color: var(--text-muted); }
.breadcrumb-current { color: var(--text); font-weight: 500; }

.folder-row { cursor: default; }
.folder-cell { cursor: pointer; }
.folder-name { color: var(--primary); font-weight: 500; }
.folder-cell:hover .folder-name { text-decoration: underline; }

.file-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
    flex-wrap: wrap;
}
.file-row:hover .file-actions,
.folder-row:hover .file-actions { opacity: 1; }
.file-actions-cell { width: 1px; white-space: nowrap; }
.btn-danger-hover:hover { color: var(--danger) !important; border-color: var(--danger) !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   EMAIL DETAIL PANEL
   ═══════════════════════════════════════════════════════════════════════════ */
.email-detail-panel {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}
.email-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.email-detail-actions { display: flex; gap: 0.5rem; }
.email-detail-meta {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.email-detail-subject {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    color: var(--text);
}
.email-detail-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.email-detail-info strong { color: var(--text); }
.email-detail-body { padding: 1.25rem; }
.email-body-text {
    font-family: var(--font);
    font-size: 0.9375rem;
    line-height: 1.7;
    white-space: pre-wrap;
    color: var(--text);
    margin: 0;
}
.email-iframe {
    width: 100%;
    min-height: 400px;
    border: none;
    border-radius: var(--radius-sm);
}

/* ── Word break ─────────────────────────────────────────────────────────── */
.email-body-text, .file-name-text {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ── File list wrapper ──────────────────────────────────────────────────── */
#file-list-wrapper { overflow-x: auto; }


/* ── Confirm Modal ──────────────────────────────────────────────────────── */
.confirm-modal {
    max-width: 380px;
    text-align: center;
    padding: 2rem 1.75rem 1.5rem;
}

.confirm-modal-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.confirm-modal-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.375rem;
}

.confirm-modal-msg {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* RWD+PWA audit complete — 2026-06-16 */

/* ═══════════════════════════════════════════════════════════════════════════
   FILE NAME LINKS
   ═══════════════════════════════════════════════════════════════════════════ */
.file-name-link {
    color: var(--text);
    text-decoration: none;
    font-size: inherit;
}
.file-name-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILE DROPDOWN MENU (3-dot context menu)
   ═══════════════════════════════════════════════════════════════════════════ */
.file-dropdown-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
    animation: fadeIn 0.1s ease;
}
.file-menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text);
    text-decoration: none;
    transition: background var(--transition);
    font-family: var(--font);
    text-align: left;
}
.file-menu-item:hover { background: var(--border-light); }
.file-menu-danger { color: var(--danger) !important; }
.file-menu-danger:hover { background: var(--danger-light) !important; }
.file-menu-divider { height: 1px; background: var(--border); margin: 0.25rem 0; }
.file-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: background var(--transition), color var(--transition);
}
.file-menu-btn:hover { background: var(--border-light); color: var(--text); }

/* ═══════════════════════════════════════════════════════════════════════════
   VIEW TOGGLE (List / Grid)
   ═══════════════════════════════════════════════════════════════════════════ */
/* ── Upload dropdown ──────────────────────────────────────────────────────── */
.upload-dropdown {
    position: relative;
    display: inline-block;
}
.upload-dropdown #upload-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}
.upload-caret {
    transition: transform var(--transition);
}
.upload-dropdown.open .upload-caret {
    transform: rotate(180deg);
}
.upload-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0,0,0,.12);
    padding: 0.375rem;
    z-index: 300;
    display: none;
    flex-direction: column;
    gap: 0.125rem;
}
.upload-dropdown.open .upload-menu {
    display: flex;
    animation: uploadMenuIn .14s ease;
}
@keyframes uploadMenuIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.upload-menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    color: var(--text);
    transition: background var(--transition);
}
.upload-menu-item:hover {
    background: rgba(15,110,86,0.08);
}
.upload-menu-item svg {
    color: var(--primary);
    flex-shrink: 0;
}
.upload-menu-title {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
}
.upload-menu-sub {
    font-size: 0.7857rem;
    color: var(--text-muted);
    margin-top: 1px;
}

/* ─── Upload Panel ──────────────────────────────────────────────────────── */
.upload-panel {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    width: 360px;
    max-width: calc(100vw - 2rem);
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 1rem;
    box-shadow: 0 16px 48px rgba(0,0,0,.16), 0 4px 12px rgba(0,0,0,.08);
    z-index: 5000;
    overflow: hidden;
    animation: uploadPanelIn .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes uploadPanelIn {
    from { opacity: 0; transform: translateY(12px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.upload-panel.up-collapsed .up-list { display: none; }
.upload-panel.up-collapsed .up-header button:first-of-type svg { transform: rotate(180deg); }
.up-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: #fff;
}
.up-title {
    font-size: .875rem;
    font-weight: 700;
    color: #fff;
}
.up-list {
    max-height: 300px;
    overflow-y: auto;
    padding: .375rem .5rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
.up-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .5rem;
    border-radius: .5rem;
    background: #F9FAFB;
}
.up-row:hover { background: #F3F4F6; }
.up-row-icon { flex-shrink: 0; display: flex; align-items: center; }
.up-row-body { flex: 1; min-width: 0; }
.up-row-name {
    font-size: .8125rem;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.up-row-size {
    font-size: .7rem;
    color: #6B7280;
    margin-top: .1rem;
}
.up-row-bar-wrap {
    height: 4px;
    background: #E5E7EB;
    border-radius: 99px;
    overflow: hidden;
    margin-top: .35rem;
}
.up-row-bar {
    height: 100%;
    border-radius: 99px;
    transition: width .25s ease;
}
.up-row-actions {
    flex-shrink: 0;
    display: flex;
    gap: .25rem;
    align-items: center;
}
.upbtn {
    background: rgba(255,255,255,.25);
    border: 1px solid rgba(255,255,255,.35);
    border-radius: .375rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .25rem .375rem;
    color: #fff;
    transition: background .15s;
}
.upbtn:hover { background: rgba(255,255,255,.4); }
.up-row-actions .upbtn {
    background: #F3F4F6;
    border-color: #E5E7EB;
    color: #374151;
}
.up-row-actions .upbtn:hover { background: #E5E7EB; }
.upbtn-pause  { }
.upbtn-resume { }
.upbtn-cancel { color: #dc2626 !important; }
.upbtn-cancel:hover { background: #FEF2F2 !important; border-color: #FCA5A5 !important; }

.view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.view-toggle-btn {
    background: none;
    border: none;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: background var(--transition), color var(--transition);
}
.view-toggle-btn.active { background: var(--primary); color: #fff; }
.view-toggle-btn:hover:not(.active) { background: var(--border-light); color: var(--text); }

/* ═══════════════════════════════════════════════════════════════════════════
   SORT BUTTON
   ═══════════════════════════════════════════════════════════════════════════ */
.sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
    font-weight: 600;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
    font-family: var(--font);
    white-space: nowrap;
}
.sort-btn:hover { color: var(--text); }

/* ═══════════════════════════════════════════════════════════════════════════
   GRID VIEW
   ═══════════════════════════════════════════════════════════════════════════ */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    padding: 0.5rem 0;
}
.file-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 0.75rem 0.75rem;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.4s ease;
    will-change: transform;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.file-card:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 16px 32px rgba(0,0,0,0.14), 0 4px 8px rgba(0,0,0,0.08);
    border-color: var(--primary);
}
.file-card-icon { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; }

/* Kartu dengan preview thumbnail: gambar mengisi lebar penuh kartu */
.file-card-icon.has-thumb {
    width: 100%;
    height: 96px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--border-light);
}
.file-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.file-card-name {
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: center;
    color: var(--text);
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}
.file-card-meta { font-size: 0.7857rem; color: var(--text-muted); text-align: center; }
.file-card-menu {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}
.file-card:hover .file-card-menu { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   GMAIL BULK BAR
   ═══════════════════════════════════════════════════════════════════════════ */
.gmail-bulk-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    background: var(--primary-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.gmail-select-all-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}
.email-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILE PREVIEW MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.preview-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,12,16,0.92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1.5rem;
}
.preview-modal-overlay[style*="flex"] { display: flex !important; }

.preview-modal {
    background: transparent;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 1100px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: visible;
    animation: previewIn 0.22s cubic-bezier(0.25,0.46,0.45,0.94);
    position: relative;
}
@keyframes previewIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}

/* Tombol navigasi galeri gambar (prev/next) */
.preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.45);
    color: #fff;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
}
.preview-nav:hover { background: rgba(0,0,0,0.7); }
.preview-nav-prev { left: 14px; }
.preview-nav-next { right: 14px; }
.preview-nav:active { transform: translateY(-50%) scale(0.92); }
@media (max-width: 600px) {
    .preview-nav { width: 38px; height: 38px; }
    .preview-nav-prev { left: 6px; }
    .preview-nav-next { right: 6px; }
}

.preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 0.875rem;
    flex-shrink: 0;
    gap: 1rem;
}

.preview-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255,255,255,0.6);
    min-width: 0;
}

.preview-modal-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-modal-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Tombol download di header lightbox */
.preview-modal-actions .btn-ghost {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.1);
    border: none;
}
.preview-modal-actions .btn-ghost:hover { background: rgba(255,255,255,0.2); color: #fff; }

.preview-close-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 50%;
    color: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    transition: background var(--transition), color var(--transition);
}
.preview-close-btn:hover { background: rgba(255,255,255,0.22); color: #fff; }

.preview-modal-body {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    border-radius: var(--radius-lg);
    background: rgba(0,0,0,0.25);
}

.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    padding: 3rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem;
}
.preview-loading .spinner {
    border-color: rgba(255,255,255,0.25);
    border-top-color: #fff;
}

/* Image — lightbox style */
.preview-image-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0.5rem;
}
.preview-image {
    max-width: 100%;
    max-height: calc(92vh - 70px);
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}
/* Thumbnail sementara: sedikit blur, lalu gambar penuh fade-in menggantikan */
.preview-image-blur {
    filter: blur(8px);
    transform: scale(1.02);
}
.preview-image-loaded {
    animation: previewImgFade 0.3s ease;
}
@keyframes previewImgFade {
    from { opacity: 0.3; }
    to   { opacity: 1; }
}
/* Spinner kecil di atas thumbnail saat memuat gambar penuh */
.preview-mini-spinner {
    position: absolute;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* PDF / iframe */
.preview-iframe {
    width: 100%;
    height: calc(92vh - 70px);
    border: none;
    display: block;
    border-radius: var(--radius);
    background: #fff;
}

/* Video */
.preview-video-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: #000;
}
.preview-video {
    max-width: 100%;
    max-height: calc(90vh - 120px);
}

/* Audio */
.preview-audio-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 3rem 2rem;
    gap: 1rem;
}
.preview-audio-name {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    color: var(--text);
}
.preview-audio { width: 100%; max-width: 480px; }

/* Text */
.preview-text-wrap {
    width: 100%;
    height: 100%;
    padding: 1.5rem;
    overflow: auto;
    background: #fff;
    border-radius: var(--radius);
}
.preview-text {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: #1f2937;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

/* Unsupported */
.preview-unsupported {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    padding: 3rem 2rem;
    color: rgba(255,255,255,0.75);
    text-align: center;
}
.preview-unsupported p { font-size: 0.9375rem; margin: 0; }

@keyframes scaleIn {
    from { transform: scale(0.96); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

@media (max-width: 700px) {
    .preview-modal { max-height: 100vh; border-radius: 0; }
    .preview-modal-overlay { padding: 0; }
    .preview-iframe { height: calc(100vh - 60px); }
}

/* ── App Footer ─────────────────────────────────────────────────────────── */
.app-footer {
    margin-left: var(--sidebar-width);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    transition: margin-left 0.25s ease;
}

body.sidebar-mini .app-footer { margin-left: 64px; }

.app-footer-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}
.app-footer-link:hover { text-decoration: underline; }

@media (max-width: 700px) {
    .app-footer { margin-left: 0 !important; padding: 0.625rem 1rem; }
}
