/* ======== Google Drive Dashboard - Styles ======== */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #1e2230;
    --bg-card-hover: #252a3a;
    --bg-input: #252a3a;
    --bg-modal: #1e2230;
    --border: #2d3348;
    --border-light: #3d4460;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0b0;
    --text-muted: #636b80;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --gradient-1: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-2: linear-gradient(135deg, #ec4899 0%, #f59e0b 100%);
    --gradient-3: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ======== Header ======== */
.header {
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 17, 23, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    width: 100%;
}

.header-bottom {
    display: flex;
    width: 100%;
}

.header-actions-bottom {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
    padding: 8px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* ======== Buttons ======== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.5);
    pointer-events: none;
}

.btn-primary {
    background: var(--gradient-1);
    color: #fff;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 22px rgba(59, 130, 246, 0.5);
    transform: translateY(-2.5px);
    filter: brightness(1.1);
}

#btnSyncAll {
    background: var(--gradient-3) !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    position: relative;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.8);
}

#btnSyncAll:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.last-sync {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
    background: rgba(0, 0, 0, 0.15);
    padding: 2px 8px;
    border-radius: 12px;
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--accent-red);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

.btn-icon {
    padding: 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
    transform: translateY(-1.5px);
}

/* ======== Summary Bar ======== */
.summary-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
}

.summary-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.summary-icon {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.08);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

.summary-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

/* ======== Main Content ======== */
.main-content {
    padding-bottom: 48px;
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 3px;
    backdrop-filter: blur(10px);
}

.view-btn {
    padding: 8px 14px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 9px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.view-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.view-btn.active {
    background: var(--accent-blue);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* ======== Card View ======== */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

.account-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.account-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-pinned {
    border-left: 3px solid var(--accent-amber);
    background: rgba(245, 158, 11, 0.03);
}

.card-header {
    padding: 16px 16px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.card-email-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.email-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}

.card-email-info {
    min-width: 0;
}

.card-email {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-actions-row {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* Storage Section (Card) */
.storage-section {
    padding: 12px 16px;
}

.storage-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.storage-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.storage-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.storage-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    overflow: hidden;
}

.storage-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 2px;
}

/* Files Section (Card) */
.card-files-section {
    padding: 0 16px 16px;
}

.card-files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ======== Badges ======== */
.card-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
    display: inline-block;
    margin-top: 2px;
}

.badge-connected {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.badge-manual {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
}

.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 12px 16px;
    font-size: 0.84rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.account-row {
    transition: var(--transition);
}

.account-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.row-pinned {
    background: rgba(245, 158, 11, 0.04);
    border-left: 3px solid var(--accent-amber);
}

.row-pinned:hover {
    background: rgba(245, 158, 11, 0.07);
}

.pin-active {
    color: var(--accent-amber) !important;
}

.notes-badge {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.col-num {
    width: 40px;
    text-align: center !important;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.col-email {
    min-width: 200px;
}

.col-pass {
    min-width: 120px;
}

.col-phone {
    min-width: 120px;
}

.col-storage {
    min-width: 180px;
}

.col-notes {
    width: 80px;
    text-align: center !important;
}

.col-actions {
    width: 140px;
}

/* Email Cell */
.cell-email {
    display: flex;
    align-items: center;
    gap: 10px;
}

.email-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}

.email-text {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.84rem;
}

/* Secret / Password Cell */
.cell-secret {
    display: flex;
    align-items: center;
    gap: 6px;
}

.secret-text {
    color: var(--text-muted);
    font-size: 0.82rem;
    letter-spacing: 1px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.72rem;
}

/* Storage Cell */
.cell-storage {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.storage-bar-sm-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    overflow: hidden;
}

.storage-bar-sm-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 2px;
}

.storage-info-sm {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Notes Toggle */
.btn-notes-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-family: inherit;
}

.btn-notes-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
}

.chevron {
    transition: transform 0.2s ease;
}

/* Actions Cell */
.cell-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Notes Expanded Row */
.notes-row td {
    padding: 0 !important;
    background: rgba(59, 130, 246, 0.03);
}

.notes-expand {
    padding: 16px 20px;
}

.notes-expand-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.notes-list-inline {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
}

/* ======== Notes Section ======== */
.notes-section {
    padding: 0 20px 20px;
}

/* Note Tags (compact) */
.note-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border-left: 3px solid;
    font-size: 0.8rem;
}

.note-cat-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.note-tag-title {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
}

.note-tag-del {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s, visibility 0.15s, background 0.2s, color 0.2s, transform 0.2s;
    flex-shrink: 0;
}

body.is-edit-mode .note-tag-del {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.note-tag-del:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--accent-red) !important;
}

.note-tag-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
}

/* Category Picker */
.category-picker {
    display: flex;
    gap: 8px;
}

.category-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    transition: var(--transition);
}

.category-btn:hover {
    border-color: var(--border-light);
}

.cat-drive.active {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.cat-photo.active {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.cat-other.active {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

/* Select2 Dark Theme */
.select2-container--default .select2-selection--single {
    background: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    height: 42px !important;
    display: flex !important;
    align-items: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-primary) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.88rem !important;
    padding-left: 12px !important;
    line-height: 42px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 42px !important;
    right: 8px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--text-muted) transparent transparent transparent !important;
}

.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15) !important;
}

.select2-dropdown {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-lg) !important;
    overflow: hidden;
}

.select2-results__option {
    color: var(--text-primary) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.85rem !important;
    padding: 8px 12px !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: rgba(59, 130, 246, 0.15) !important;
    color: var(--accent-blue) !important;
}

.select2-container--default .select2-results__option--selected {
    background: rgba(59, 130, 246, 0.08) !important;
    color: var(--accent-blue) !important;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
    background: rgba(59, 130, 246, 0.1) !important;
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .select2-container {
    flex: 1;
}

.notes-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.notes-count {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    font-size: 0.65rem;
    padding: 1px 7px;
    border-radius: 20px;
    font-weight: 600;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
}

.notes-list::-webkit-scrollbar {
    width: 4px;
}

.notes-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.note-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid var(--accent-blue);
    position: relative;
}

.note-item:hover {
    background: var(--bg-card-hover);
}

.note-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.note-item-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-item-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: var(--transition);
    flex-shrink: 0;
}

body.is-edit-mode .note-item-actions {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.note-item-actions .btn-icon:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--accent-red) !important;
    transform: scale(1.1);
}

.note-item-content {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: pre-wrap;
    word-break: break-word;
}

.note-item-date {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 6px;
    opacity: 0.7;
}

.notes-empty {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ======== Modals ======== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.3s ease-out;
}

.modal-sm {
    max-width: 380px;
}

.modal-lg {
    max-width: 800px;
}

.drive-file-link {
    color: var(--accent-blue);
    text-decoration: none;
    transition: var(--transition);
}

.drive-file-link:hover {
    color: var(--accent-cyan);
    text-decoration: underline;
}

.drive-files-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

/* ======== Drive TreeView ======== */
.drive-tree {
    padding: 8px 12px;
}

.tree-node {
    margin-bottom: 2px;
}

.tree-folder {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    user-select: none;
}

.tree-folder:hover {
    background: rgba(59, 130, 246, 0.08);
}

.tree-arrow {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

.tree-arrow-open {
    transform: rotate(90deg);
}

.tree-folder-icon {
    font-size: 1rem;
}

.tree-folder-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--accent-blue);
    flex: 1;
}

.tree-folder-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.tree-children {
    border-left: 1px solid var(--border);
    margin-left: 18px;
    padding-left: 4px;
}

.tree-hidden {
    display: none;
}

.tree-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 24px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.tree-file:hover {
    background: rgba(255, 255, 255, 0.03);
}

.tree-file-icon {
    flex-shrink: 0;
}

.tree-file-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-file-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 70px;
    text-align: right;
    flex-shrink: 0;
}

.tree-file-shared {
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.tree-file-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 100px;
    text-align: right;
    flex-shrink: 0;
}

.tree-loading,
.tree-empty {
    padding: 8px 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ======== Connect Button ======== */
.btn-connect {
    background: linear-gradient(135deg, #10b981, #06b6d4);
    color: #fff;
    border: none;
    gap: 5px;
}

.btn-connect:hover {
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

/* ======== Batch Import ======== */
.batch-format-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.hint-tag {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.hint-sep {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.batch-textarea {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82rem;
    line-height: 1.8;
    min-height: 180px;
    tab-size: 20;
    -moz-tab-size: 20;
    white-space: pre;
}

.batch-preview {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.batch-preview-header {
    padding: 8px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(59, 130, 246, 0.06);
    border-bottom: 1px solid var(--border);
}

.batch-preview-table table {
    width: 100%;
    border-collapse: collapse;
}

.batch-preview-table th,
.batch-preview-table td {
    padding: 8px 14px;
    text-align: left;
    font-size: 0.78rem;
    border-bottom: 1px solid var(--border);
}

.batch-preview-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.batch-preview-table td {
    color: var(--text-primary);
}

.batch-preview-table tr:last-child td {
    border-bottom: none;
}

.batch-count {
    font-size: 0.8rem;
    color: var(--accent-blue);
    font-weight: 600;
    margin-right: auto;
    display: flex;
    align-items: center;
}

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

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    line-height: 1;
}

.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    padding: 16px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border);
}

/* ======== Form Elements ======== */
.form-group {
    margin-bottom: 16px;
}

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

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    transition: var(--transition);
    outline: none;
}

.input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input::placeholder {
    color: var(--text-muted);
}

.textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

/* ======== Color Picker ======== */
.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* ======== Toast ======== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toastSlide 0.3s ease-out;
    max-width: 360px;
}

.toast-success {
    background: rgba(16, 185, 129, 0.95);
    color: #fff;
}

.toast-error {
    background: rgba(239, 68, 68, 0.95);
    color: #fff;
}

.toast-info {
    background: rgba(59, 130, 246, 0.95);
    /* Blue color matching the Google Drive blue */
    color: #fff;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ======== Empty State ======== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    opacity: 0.3;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

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

/* ======== Responsive ======== */
@media (max-width: 768px) {
    .hide768 {
        display: none;
    }

    .app {
        padding: 0 16px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .accounts-grid {
        grid-template-columns: 1fr;
    }

    .summary-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .summary-bar {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ======== Loading Spinner ======== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.6s linear infinite;
}

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

/* ======== Scrollbar ======== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ======== Visibility Management ======== */
body:not(.is-logged-in) .header-bottom,
body:not(.is-logged-in) .admin-only,
body:not(.is-logged-in) #summaryBar,
body:not(.is-logged-in) #tableWrapper,
body:not(.is-logged-in) #cardGrid {
    display: none !important;
}

/* Edit Mode OFF: Hide management but keep Sync, Toggles, Copy, and Browse */
body.is-logged-in:not(.is-edit-mode) .admin-only:not(.edit-mode-toggle):not(.view-toggle):not(#btnSyncAll):not([onclick*="syncAccount"]):not([onclick*="copyText"]):not([onclick*="browseDriveFiles"]) {
    display: none !important;
}

body:not(.is-logged-in) .notes-badge {
    pointer-events: none;
}

body:not(.is-edit-mode) .notes-badge {
    cursor: default;
}

/* ======== Edit Mode Switch ======== */
.edit-mode-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.edit-mode-toggle span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

input:checked+.slider:before {
    transform: translateX(20px);
    background-color: #fff;
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

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

.sync-spin {
    animation: spin 1s linear infinite;
}

/* ======== Login Required State ======== */
#loginRequiredState {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-top: 40px;
}

#loginRequiredState svg {
    margin-bottom: 20px;
    color: var(--accent-blue);
    opacity: 0.8;
}

#loginRequiredState h3 {
    margin-bottom: 10px;
}

#loginRequiredState p {
    color: var(--text-muted);
}

/* ======== Passkey Styles ======== */
#btnRegisterPasskey {
    background: var(--gradient-2) !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

#btnRegisterPasskey:hover {
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
    transform: translateY(-2px);
    filter: brightness(1.05);
}

#btnLoginPasskey {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    gap: 10px;
}

#btnLoginPasskey:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}