/* ============================================================
   VARIABLES & RESET
   ============================================================ */
:root {
    --bg: #08080f;
    --surface: #0f0f1a;
    --surface2: #14141f;
    --surface3: #1a1a2a;
    --border: #1e1e30;
    --border2: #252538;
    --accent: #6c63ff;
    --accent-glow: rgba(108,99,255,0.25);
    --accent2: #ff6584;
    --accent3: #43e97b;
    --text: #e8e8f2;
    --muted: #6b6b8a;
    --muted2: #4a4a68;
    --danger: #ff4d6d;
    --warning: #ffd166;
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-w: 240px;
    --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    background: var(--bg);
}

.login-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.login-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 8s ease-in-out infinite;
}
.orb1 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #6c63ff55, transparent);
    top: -100px; left: -100px;
    animation-delay: 0s;
}
.orb2 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, #ff658444, transparent);
    bottom: -50px; right: 100px;
    animation-delay: -3s;
}
.orb3 {
    width: 200px; height: 200px;
    background: radial-gradient(circle, #43e97b33, transparent);
    top: 50%; right: -50px;
    animation-delay: -6s;
}

@keyframes float {
    0%,100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
}

.login-card {
    position: relative;
    z-index: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 40px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(108,99,255,0.1);
    animation: slideUp 0.5s cubic-bezier(0.4,0,0.2,1);
}

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

.login-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.logo-vault { font-size: 2rem; }
.logo-name {
    font-family: 'DM Serif Display', serif;
    font-size: 1.8rem;
    background: linear-gradient(135deg, #6c63ff, #ff6584);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-tagline {
    color: var(--muted);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.field-group {
    margin-bottom: 1.25rem;
}

.field-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
}

.field-group input,
.field-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.field-group input:focus,
.field-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b8a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    cursor: pointer;
}

.pwd-wrap {
    position: relative;
}
.pwd-wrap input { padding-right: 3rem; }
.toggle-pwd {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.5;
    transition: opacity var(--transition);
}
.toggle-pwd:hover { opacity: 1; }

.login-error {
    background: rgba(255,77,109,0.12);
    border: 1px solid rgba(255,77,109,0.3);
    color: var(--danger);
    padding: 0.625rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.login-hint {
    text-align: center;
    color: var(--muted2);
    font-size: 0.75rem;
    margin-top: 1rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-primary:hover { background: #5a52dd; transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    background: var(--surface3);
    color: var(--text);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-secondary:hover { background: var(--border2); border-color: var(--accent); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-ghost:hover { background: var(--surface3); color: var(--text); }

.btn-danger {
    background: rgba(255,77,109,0.15);
    color: var(--danger);
    border: 1px solid rgba(255,77,109,0.3);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-danger:hover { background: rgba(255,77,109,0.25); }

.btn-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface3);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 1rem;
}
.btn-icon:hover { background: var(--border2); border-color: var(--accent); }

.btn-copy {
    padding: 0.5rem 0.75rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition);
}
.btn-copy:hover { background: #5a52dd; }

/* Login specific */
.login-screen .btn-primary {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    border-radius: var(--radius);
    justify-content: center;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    height: 100vh;
    overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
    font-family: 'DM Serif Display', serif;
    font-size: 1.2rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo span:first-child { font-size: 1.4rem; }
.logo-text {
    background: linear-gradient(135deg, #6c63ff, #ff6584);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.875rem;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    width: 100%;
}
.nav-item:hover { background: var(--surface3); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }
.nav-icon { font-size: 1rem; }

.sidebar-storage {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}
.storage-label {
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.storage-bar-bg {
    height: 4px;
    background: var(--border2);
    border-radius: 999px;
    margin-bottom: 0.4rem;
    overflow: hidden;
}
.storage-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 999px;
    transition: width 0.5s ease;
}
.storage-text { font-size: 0.75rem; color: var(--muted); }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--border);
}
.user-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
    color: white;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--muted); }
.btn-logout {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    background: none;
    border: 1px solid var(--border2);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--muted);
    transition: all var(--transition);
    flex-shrink: 0;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); background: rgba(255,77,109,0.1); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.view-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    flex-shrink: 0;
    background: var(--surface);
}

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

.view-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.25rem;
    font-weight: 400;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.crumb {
    font-size: 0.875rem;
    color: var(--muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all var(--transition);
    white-space: nowrap;
}
.crumb:hover { background: var(--surface3); color: var(--text); }
.crumb.active { color: var(--text); font-weight: 600; cursor: default; background: none; }

.crumb-sep {
    color: var(--muted2);
    font-size: 0.75rem;
    user-select: none;
}

/* ============================================================
   DROP ZONE
   ============================================================ */
.drop-zone {
    margin: 0.75rem 1.5rem 0;
    border: 2px dashed var(--border2);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
    flex-shrink: 0;
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
}
.drop-zone-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--muted);
    font-size: 0.875rem;
}
.drop-icon { font-size: 1.5rem; }

/* ============================================================
   UPLOAD QUEUE
   ============================================================ */
.upload-queue {
    margin: 0.5rem 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    flex-shrink: 0;
}

.upload-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
}
.upload-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}
.upload-item-name { font-size: 0.8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70%; }
.upload-item-status { font-size: 0.75rem; color: var(--muted); }
.upload-progress-bg {
    height: 3px;
    background: var(--border2);
    border-radius: 999px;
    overflow: hidden;
}
.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 999px;
    transition: width 0.3s ease;
}

/* ============================================================
   FILE BROWSER
   ============================================================ */
.file-browser {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem 1.5rem;
}

.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted2);
    margin: 0.75rem 0 0.5rem;
}

/* GRID VIEW */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.item-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 0.875rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    position: relative;
    user-select: none;
}
.item-card:hover {
    border-color: var(--accent);
    background: var(--surface2);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.item-card.selected { border-color: var(--accent); background: var(--accent-glow); }

.item-icon { font-size: 2.5rem; line-height: 1; }
.item-name {
    font-size: 0.8rem;
    font-weight: 500;
    word-break: break-word;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.item-meta { font-size: 0.7rem; color: var(--muted); }
.item-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.7rem;
}

/* LIST VIEW */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.item-row {
    display: grid;
    grid-template-columns: 2rem 1fr 100px 120px 80px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
    user-select: none;
}
.item-row:hover { background: var(--surface); border-color: var(--border); }
.item-row.selected { background: var(--accent-glow); border-color: var(--accent); }
.item-row-icon { font-size: 1.2rem; text-align: center; }
.item-row-name { font-size: 0.875rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-row-size { font-size: 0.8rem; color: var(--muted); }
.item-row-date { font-size: 0.75rem; color: var(--muted2); }
.item-row-actions { display: flex; gap: 0.4rem; justify-content: flex-end; opacity: 0; transition: opacity var(--transition); }
.item-row:hover .item-row-actions { opacity: 1; }

/* Thumbnail for images in grid */
.item-thumb {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 0.25rem;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--muted);
    gap: 0.5rem;
}
.empty-icon { font-size: 3rem; }
.empty-hint { font-size: 0.8rem; color: var(--muted2); }

/* ============================================================
   SEARCH
   ============================================================ */
.search-box-wrap {
    padding: 1.25rem 1.5rem 0.5rem;
    flex-shrink: 0;
}
.search-input {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: all var(--transition);
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1.5rem 1.5rem;
}
.search-hint { color: var(--muted); font-size: 0.875rem; text-align: center; padding: 3rem; }
.search-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted2);
    margin: 1rem 0 0.5rem;
}
.search-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
}
.search-item:hover { background: var(--surface); border-color: var(--border); }
.search-item-icon { font-size: 1.25rem; }
.search-item-info { flex: 1; }
.search-item-name { font-size: 0.875rem; font-weight: 500; }
.search-item-path { font-size: 0.75rem; color: var(--muted); }
.search-no-results { color: var(--muted); text-align: center; padding: 2rem; font-size: 0.875rem; }

/* ============================================================
   SHARES LIST
   ============================================================ */
.shares-list {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.share-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.share-card-icon { font-size: 1.5rem; flex-shrink: 0; }
.share-card-info { flex: 1; min-width: 0; }
.share-card-name { font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-card-meta { font-size: 0.75rem; color: var(--muted); margin-top: 0.2rem; }
.share-card-expire {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    margin-top: 0.4rem;
    display: inline-block;
}
.share-card-expire.valid { background: rgba(67,233,123,0.12); color: var(--accent3); }
.share-card-expire.expired { background: rgba(255,77,109,0.12); color: var(--danger); }
.share-card-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ============================================================
   ADMIN / USERS
   ============================================================ */
.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.user-card-avatar {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.user-card-info { flex: 1; }
.user-card-name { font-size: 0.9rem; font-weight: 600; }
.user-card-meta { font-size: 0.75rem; color: var(--muted); }
.role-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.role-badge.admin { background: rgba(108,99,255,0.2); color: var(--accent); }
.role-badge.user { background: rgba(107,107,138,0.2); color: var(--muted); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 18px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 40px 80px rgba(0,0,0,0.6);
    animation: slideUp 0.2s cubic-bezier(0.4,0,0.2,1);
}

.modal-preview-inner {
    max-width: 800px;
}

.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; }
.modal-close {
    width: 28px; height: 28px;
    background: var(--surface3);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.modal-close:hover { background: var(--border2); color: var(--text); }

.modal-body { padding: 1.5rem; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.share-result { margin-top: 1rem; }
.share-result label { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.5rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.share-link-box { display: flex; }
.share-link-box input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    background: var(--bg);
    border: 1px solid var(--border2);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    outline: none;
}

.preview-body { padding: 1rem 1.5rem 1.5rem; }
.preview-body img { max-width: 100%; border-radius: var(--radius-sm); display: block; margin: 0 auto; }

/* ============================================================
   CONTEXT MENU
   ============================================================ */
.context-menu {
    position: fixed;
    z-index: 999;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 0.4rem;
    min-width: 180px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6);
    animation: fadeIn 0.1s ease;
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background var(--transition);
    border: none;
    background: none;
    color: var(--text);
    width: 100%;
    text-align: left;
}
.ctx-item:hover { background: var(--surface3); }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover { background: rgba(255,77,109,0.1); }
.ctx-sep { height: 1px; background: var(--border); margin: 0.3rem 0; }
.ctx-icon { font-size: 1rem; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    animation: toastIn 0.3s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 320px;
    pointer-events: auto;
}
.toast.success { border-left: 3px solid var(--accent3); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }
.toast.out { animation: toastOut 0.3s ease forwards; }

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

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted2); }

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: var(--muted);
}
