  :root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #10b981;
    --accent-hover: #059669;
    --danger: #ef4444;
    --blue: #2563eb;
    --blue-hover: #1d4ed8;
    --border: #e2e8f0;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }

  * {
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
  }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
  }

  body.is-locked {
    overflow: hidden !important;
  }

  /* Pantalla de Bloqueo Móvil y Desktop */
  .lock-screen-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw; width: 100dvw;
    height: 100vh; height: 100dvh;
    background: radial-gradient(circle at 50% 30%, #1e293b 0%, #0f172a 100%);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }
  .lock-screen-overlay.unlocked {
    opacity: 0;
    visibility: hidden;
    pointer-events: none !important;
    display: none !important;
  }
  .lock-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 360px;
    padding: 32px 24px;
    text-align: center;
  }
  .lock-card.shake {
    animation: lockShake 0.4s ease-in-out;
  }
  @keyframes lockShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
  }
  .lock-logo-badge {
    width: 54px; height: 54px;
    background: #0f172a;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-bottom: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
  }
  .lock-title { font-size: 20px; font-weight: 800; color: #0f172a; margin: 0 0 4px; }
  .lock-subtitle { font-size: 13px; color: #64748b; margin: 0 0 20px; }
  .lock-input-group { position: relative; margin-bottom: 14px; text-align: left; }
  .lock-input-group label { display: block; font-size: 11px; font-weight: 700; color: #475569; text-transform: uppercase; margin-bottom: 6px; }
  .lock-input-group input {
    width: 100%; min-height: 48px;
    padding: 12px 42px 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px !important;
    outline: none;
    transition: all 0.2s;
  }
  .lock-input-group input:focus { border-color: #3b82f6; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); }
  .lock-toggle-pwd { position: absolute; right: 10px; bottom: 8px; background: none; border: none; cursor: pointer; color: #94a3b8; font-size: 18px; padding: 6px; }
  .lock-btn {
    background: #0f172a; color: #fff;
    border: none; min-height: 48px;
    padding: 12px 20px; border-radius: 10px;
    font-size: 15px; font-weight: 700; width: 100%;
    cursor: pointer; transition: all 0.2s;
  }
  .lock-btn:hover { background: #1e293b; }
  .lock-msg { font-size: 12px; color: #ef4444; margin-top: 10px; min-height: 16px; font-weight: 600; }

  .top-navbar { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
  .navbar-container { max-width: 1400px; margin: 0 auto; padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  .brand-logo { display: flex; align-items: center; gap: 8px; }
  .brand-logo-icon { width: 36px; height: 36px; background: var(--primary); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
  .brand-text h1 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -0.3px; }
  .brand-text p { margin: 1px 0 0; font-size: 10px; color: var(--text-muted); font-weight: 500; display: none; }
  @media (min-width: 640px) { .brand-text p { display: block; } }
  .navbar-actions { display: flex; align-items: center; gap: 8px; }

  .btn { background: var(--primary); color: #fff; border: 1px solid transparent; min-height: 42px; padding: 8px 14px; border-radius: var(--radius-md); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: var(--transition); user-select: none; text-decoration: none; }
  .btn:hover { background: var(--primary-light); transform: translateY(-1px); }
  .btn:active { transform: translateY(0); }
  .btn-accent { background: var(--accent); color: #fff; }
  .btn-accent:hover { background: var(--accent-hover); }
  .btn-blue { background: var(--blue); color: #fff; }
  .btn-blue:hover { background: var(--blue-hover); }
  .btn-outline { background: #fff; color: var(--text); border: 1.5px solid var(--border); }
  .btn-outline:hover { background: #f8fafc; border-color: var(--primary); }
  .btn-small { min-height: 36px; padding: 6px 10px; font-size: 12px; border-radius: var(--radius-sm); }

  .pill-sync-status { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: var(--transition); user-select: none; }
  .pill-sync-status:hover { filter: brightness(0.95); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
  .pill-sync-status.syncing { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
  .pill-sync-status.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
  .pill-sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; transition: background 0.3s; }
  .pill-sync-status.syncing .pill-sync-dot { background: #2563eb; animation: syncDotPulse 0.8s ease-in-out infinite alternate; }
  .pill-sync-status.error .pill-sync-dot { background: #ef4444; }
  @keyframes syncDotPulse { from { opacity: 0.3; transform: scale(0.85); } to { opacity: 1; transform: scale(1.25); } }

  .main-wrapper { max-width: 1400px; margin: 0 auto; padding: 16px; width: 100%; display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; flex: 1; }
  @media (max-width: 860px) { .main-wrapper { grid-template-columns: 1fr; padding: 12px; } }

  .clients-sidebar { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; box-shadow: var(--shadow-sm); }
  .sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .sidebar-header h2 { font-size: 14px; font-weight: 700; margin: 0; }
  .client-count { font-size: 11px; font-weight: 700; background: #f1f5f9; color: var(--text-muted); padding: 2px 7px; border-radius: 999px; }

  .search-box { margin-bottom: 10px; position: relative; }
  .search-box input { width: 100%; min-height: 38px; padding: 8px 12px 8px 32px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; background: #f8fafc; outline: none; transition: var(--transition); }
  @media (max-width: 768px) { .search-box input { font-size: 16px !important; } }
  .search-box input:focus { border-color: var(--blue); background: #fff; }
  .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 13px; color: #94a3b8; pointer-events: none; }

  .client-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; padding-right: 2px; }
  @media (min-width: 861px) { .client-list { max-height: calc(100vh - 380px); } }

  .client-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md); border: 1.5px solid transparent; cursor: pointer; background: #f8fafc; transition: var(--transition); }
  .client-item:hover { background: #f1f5f9; }
  .client-item.active { background: #eff6ff; border-color: #bfdbfe; }
  .client-avatar { width: 34px; height: 34px; background: #0f172a; color: #fff; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
  .client-item.active .client-avatar { background: var(--blue); }
  .client-meta { flex: 1; min-width: 0; }
  .client-meta strong { display: block; font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .client-meta small { display: block; font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .drive-storage-widget { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
  .storage-header { display: flex; justify-content: space-between; align-items: center; }
  .storage-title strong { display: block; font-size: 12px; font-weight: 700; }
  .storage-title small { display: block; font-size: 10px; color: var(--text-muted); }
  .storage-progress-bar { width: 100%; height: 7px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
  .storage-progress-fill { height: 100%; background: linear-gradient(90deg, #10b981 0%, #3b82f6 100%); border-radius: 999px; transition: width 0.4s ease; }
  .storage-stats { display: flex; justify-content: space-between; font-size: 10px; font-weight: 600; color: var(--text-muted); }

  .client-content-area { display: flex; flex-direction: column; gap: 14px; }
  .client-header-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow-sm); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; position: relative; overflow: hidden; }
  .client-header-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 50%, var(--blue) 100%); }
  .client-info-left { display: flex; gap: 12px; align-items: center; }
  .client-large-avatar { width: 48px; height: 48px; background: #0f172a; color: #fff; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; box-shadow: var(--shadow-sm); flex-shrink: 0; }
  .client-titles h2 { margin: 0 0 2px; font-size: 18px; font-weight: 800; letter-spacing: -0.4px; }
  .client-titles p { margin: 0; font-size: 12px; color: var(--text-muted); }
  .client-header-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

  .view-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); padding-bottom: 2px; overflow-x: auto; }
  .tab-btn { border: none; background: transparent; padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2.5px solid transparent; display: inline-flex; align-items: center; gap: 6px; transition: var(--transition); white-space: nowrap; }
  .tab-btn:hover { color: var(--text); }
  .tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

  .drive-workspace-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 14px; }
  .drive-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
  .drive-breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; max-width: 100%; }
  .crumb { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: var(--radius-sm); background: #f1f5f9; color: var(--text); font-weight: 600; cursor: pointer; font-size: 12px; }
  .crumb:hover { background: #e2e8f0; }
  .crumb.active { background: #eff6ff; color: var(--blue); cursor: default; }
  .crumb-sep { color: #94a3b8; font-weight: 700; font-size: 11px; }

  .drive-toolbar-buttons { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; width: 100%; }
  @media (min-width: 640px) { .drive-toolbar-buttons { width: auto; } }

  .drop-zone { border: 2px dashed #cbd5e1; border-radius: var(--radius-md); padding: 18px 12px; text-align: center; background: #f8fafc; transition: var(--transition); cursor: pointer; }
  .drop-zone:hover, .drop-zone.dragover { border-color: var(--blue); background: #eff6ff; }
  .drop-zone-icon { font-size: 28px; margin-bottom: 4px; }
  .drop-zone strong { font-size: 13px; color: var(--text); display: block; margin-bottom: 2px; }
  .drop-zone p { font-size: 11px; color: var(--text-muted); margin: 0; }

  .drive-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; min-height: 180px; }
  @media (max-width: 500px) { .drive-items-grid { grid-template-columns: 1fr; } }

  .file-card { background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 12px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; transition: var(--transition); }
  .file-card:hover { border-color: #94a3b8; box-shadow: var(--shadow-sm); }
  .file-card.is-folder { background: #f8fafc; border-color: #cbd5e1; cursor: pointer; }
  .file-card.is-folder:hover { background: #eff6ff; border-color: #93c5fd; }
  .file-card-top { display: flex; align-items: flex-start; gap: 8px; }
  .file-icon { font-size: 22px; flex-shrink: 0; }
  .file-info { flex: 1; min-width: 0; }
  .file-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
  .file-meta { font-size: 11px; color: var(--text-muted); }
  .file-card-bottom { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding-top: 6px; border-top: 1px solid #f1f5f9; }

  .info-notes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  @media (max-width: 768px) { .info-notes-grid { grid-template-columns: 1fr; } }
  .info-panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow-sm); }
  .info-panel h3 { margin: 0 0 12px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .form-group { margin-bottom: 10px; }
  .form-group label { display: block; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
  .form-group input, .form-group textarea { width: 100%; min-height: 42px; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 16px !important; background: #fff; outline: none; transition: var(--transition); }
  .form-group input:focus, .form-group textarea:focus { border-color: var(--blue); }

  .toast-container { position: fixed; top: 12px; right: 12px; left: 12px; z-index: 100000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; align-items: flex-end; }
  @media (min-width: 600px) { .toast-container { left: auto; max-width: 380px; } }
  .toast { pointer-events: auto; width: 100%; background: #fff; border-radius: var(--radius-md); box-shadow: 0 10px 25px rgba(0,0,0,0.12); border: 1px solid var(--border); padding: 10px 14px; display: flex; align-items: center; gap: 10px; animation: toastSlideIn 0.25s ease; transition: opacity 0.25s, transform 0.25s; }
  .toast.toast-hiding { opacity: 0; transform: translateY(-8px); }
  .toast-icon { font-size: 16px; flex-shrink: 0; }
  .toast-msg { font-size: 12px; margin: 0; font-weight: 600; color: var(--text); }
  .toast-success { border-left: 4px solid var(--accent); }
  .toast-error { border-left: 4px solid var(--danger); }
  .toast-info { border-left: 4px solid var(--blue); }

  .modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
  .modal-overlay.active { opacity: 1; pointer-events: auto; }
  .modal-card { background: #fff; border-radius: var(--radius-lg); box-shadow: 0 20px 40px rgba(0,0,0,0.2); width: 100%; max-width: 420px; max-height: 90dvh; overflow-y: auto; padding: 20px; transform: scale(0.96); transition: transform 0.2s ease; }
  .modal-overlay.active .modal-card { transform: scale(1); }
  .modal-card h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; }
  .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

  @keyframes fadeIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes toastSlideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

  .empty-state { text-align: center; padding: 32px 16px; background: #fff; border: 1.5px dashed var(--border); border-radius: var(--radius-md); color: var(--text-muted); }
  .empty-state-icon { font-size: 32px; margin-bottom: 6px; }
  .oculto { display: none !important; }

/* Checkbox de Selección */
.file-card { position: relative; }
.file-checkbox {
  position: absolute;
  top: 8px; left: 8px;
  width: 18px; height: 18px;
  cursor: pointer;
  z-index: 10;
  accent-color: var(--blue);
  opacity: 0; /* Oculto por defecto hasta hover o selección activa */
  transition: opacity 0.2s;
}
.file-card:hover .file-checkbox { opacity: 1; }
.file-card.selected { border-color: var(--blue); background: #eff6ff; }
.file-card.selected .file-checkbox { opacity: 1; }
.file-card.is-folder.selected { background: #dbeafe; }

/* Ajuste del contenido de la tarjeta para no pisar el checkbox */
.file-card-top { padding-left: 20px; }

.move-folder-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px;
  cursor: pointer; transition: 0.2s;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.move-folder-item:hover { background: #e2e8f0; }
.move-folder-item.selected { background: #bfdbfe; border: 1px solid var(--blue); }
