:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #1a1a1a;
  --bg-card: #141414;
  --bg-card-hover: #1c1c1c;
  --gold-primary: #d4a843;
  --gold-light: #f0c040;
  --gold-dark: #a07820;
  --gold-gradient: linear-gradient(135deg, #d4a843, #f0c040, #d4a843);
  --gold-gradient-text: linear-gradient(135deg, #f0c040, #d4a843, #a07820);
  --gold-glow: 0 0 20px rgba(212, 168, 67, 0.3);
  --gold-border: 1px solid rgba(212, 168, 67, 0.25);
  --text-primary: #f5f5f5;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --border-color: rgba(255, 255, 255, 0.08);
  --danger: #e74c3c;
  --danger-hover: #c0392b;
  --success: #2ecc71;
  --warning: #f39c12;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--gold-primary); text-decoration: none; }
a:hover { color: var(--gold-light); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: var(--transition);
}

input, select, textarea {
  font-family: inherit;
  background: var(--bg-tertiary);
  border: var(--gold-border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: var(--transition);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.15);
}

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

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-primary); }

.header {
  background: var(--bg-secondary);
  border-bottom: var(--gold-border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-brand .logo {
  width: 36px;
  height: 36px;
  background: var(--gold-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--bg-primary);
}

.header-brand h1 {
  font-size: 1.3rem;
  font-weight: 700;
  background: var(--gold-gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-nav {
  display: flex;
  gap: 8px;
}

.nav-btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

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

.nav-btn.active {
  background: rgba(212, 168, 67, 0.12);
  color: var(--gold-primary);
  border-color: rgba(212, 168, 67, 0.2);
}

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

.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: var(--gold-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  background: var(--gold-gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card .stat-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  position: relative;
  width: 280px;
}

.search-box input {
  padding-left: 38px;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}

.btn-gold {
  background: var(--gold-gradient);
  color: var(--bg-primary);
}

.btn-gold:hover {
  box-shadow: var(--gold-glow);
  transform: translateY(-1px);
}

.btn-gold:active {
  transform: translateY(0);
}

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

.btn-outline:hover {
  background: rgba(212, 168, 67, 0.08);
  border-color: var(--gold-primary);
}

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

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

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

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

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
}

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

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.file-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.file-card:hover {
  border-color: rgba(212, 168, 67, 0.3);
  background: var(--bg-card-hover);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.file-card.selected {
  border-color: var(--gold-primary);
  background: rgba(212, 168, 67, 0.05);
  box-shadow: 0 0 0 1px var(--gold-primary);
}

.file-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.file-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.file-icon.json-icon { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.file-icon.sqlite-icon { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.file-icon.file-icon-type { background: rgba(212, 168, 67, 0.15); color: var(--gold-primary); }

.file-card .file-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  word-break: break-word;
}

.file-card .file-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.file-card .file-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: var(--transition);
}

.file-card:hover .file-actions {
  opacity: 1;
}

.file-card .file-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-json { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.badge-sqlite { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.badge-file { background: rgba(212, 168, 67, 0.15); color: var(--gold-primary); }

.file-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-list-item {
  display: grid;
  grid-template-columns: 40px 1fr auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

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

.file-list-item.selected {
  background: rgba(212, 168, 67, 0.05);
  border: 1px solid rgba(212, 168, 67, 0.3);
}

.file-list-item .file-icon-sm {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.file-list-item .file-name {
  font-weight: 500;
  font-size: 0.9rem;
}

.file-list-item .file-size,
.file-list-item .file-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.file-list-item .file-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: var(--transition);
}

.file-list-item:hover .file-actions {
  opacity: 1;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: var(--transition);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  background: var(--gold-gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal .form-group {
  margin-bottom: 16px;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  border: var(--gold-border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  animation: toastIn 0.3s ease-out;
  min-width: 280px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--gold-primary); }

.toast.removing {
  animation: toastOut 0.3s ease-in forwards;
}

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

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

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

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

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

.drop-zone {
  border: 2px dashed rgba(212, 168, 67, 0.3);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  background: rgba(212, 168, 67, 0.02);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--gold-primary);
  background: rgba(212, 168, 67, 0.06);
  box-shadow: inset 0 0 40px rgba(212, 168, 67, 0.05);
}

.drop-zone .drop-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.drop-zone .drop-text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.drop-zone .drop-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.drop-zone input[type="file"] {
  display: none;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

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

.empty-state p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto;
}

.checkbox-wrapper {
  position: absolute;
  top: 12px;
  right: 12px;
  opacity: 0;
  transition: var(--transition);
}

.file-card:hover .checkbox-wrapper,
.file-card.selected .checkbox-wrapper {
  opacity: 1;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold-primary);
  cursor: pointer;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-toggle {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.view-toggle button {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  background: transparent;
  color: var(--text-muted);
}

.view-toggle button.active {
  background: var(--bg-card);
  color: var(--gold-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.select-bar {
  background: var(--bg-secondary);
  border: var(--gold-border);
  border-radius: var(--radius);
  padding: 12px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.select-bar .select-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.select-bar .select-actions {
  display: flex;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-gold {
  background: rgba(212, 168, 67, 0.15);
  color: var(--gold-primary);
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.records-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.records-table td {
  padding: 10px 14px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.records-table tr:hover td {
  background: rgba(212, 168, 67, 0.03);
}

.storage-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}

.storage-bar-fill {
  height: 100%;
  background: var(--gold-gradient);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.hidden { display: none !important; }

@media (max-width: 768px) {
  .header { padding: 12px 16px; }
  .header-brand h1 { font-size: 1.1rem; }
  .header-nav { gap: 4px; }
  .nav-btn { padding: 6px 12px; font-size: 0.78rem; }
  .main { padding: 16px; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 1.4rem; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .search-box { width: 100%; }
  .file-grid { grid-template-columns: 1fr; }
  .file-list-item { grid-template-columns: 36px 1fr auto; gap: 10px; }
  .file-list-item .file-date { display: none; }
  .select-bar { flex-direction: column; text-align: center; }
  .select-bar .select-actions { justify-content: center; }
  .modal { padding: 24px; width: 95%; }
}

@media (max-width: 480px) {
  .stats-bar { grid-template-columns: 1fr; }
  .header-brand .logo { width: 30px; height: 30px; font-size: 0.9rem; }
  .header-brand h1 { font-size: 1rem; }
  .btn { padding: 8px 14px; font-size: 0.8rem; }
  .drop-zone { padding: 32px 16px; }
}

@media (min-width: 1024px) {
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

@media (min-width: 1440px) {
  .main { max-width: 1200px; }
}

.loading-skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-card-hover) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

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

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.glow {
  box-shadow: var(--gold-glow);
}

/* === SPLASH SCREEN === */
.splash-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-logo {
  width: 80px;
  height: 80px;
  background: var(--gold-gradient);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 2.2rem;
  color: var(--bg-primary);
  margin-bottom: 24px;
  animation: splashPulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 40px rgba(212, 168, 67, 0.4);
}

.splash-title {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--gold-gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  animation: splashFadeUp 0.8s ease-out 0.3s both;
}

.splash-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  animation: splashFadeUp 0.8s ease-out 0.5s both;
}

.splash-loader {
  margin-top: 40px;
  width: 40px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  animation: splashFadeUp 0.8s ease-out 0.7s both;
}

.splash-loader-bar {
  width: 100%;
  height: 100%;
  background: var(--gold-gradient);
  border-radius: 2px;
  animation: splashLoad 1.5s ease-in-out forwards;
}

@keyframes splashPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 40px rgba(212, 168, 67, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 60px rgba(212, 168, 67, 0.6); }
}

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

@keyframes splashLoad {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* === AUTH PAGE === */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-primary);
}

.auth-container {
  width: 100%;
  max-width: 440px;
}

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

.auth-brand .auth-logo {
  width: 64px;
  height: 64px;
  background: var(--gold-gradient);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.8rem;
  color: var(--bg-primary);
  margin-bottom: 16px;
  box-shadow: 0 0 30px rgba(212, 168, 67, 0.3);
}

.auth-brand h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--gold-gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-brand p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.auth-card {
  background: var(--bg-secondary);
  border: var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 36px;
}

.auth-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 6px;
  background: var(--gold-gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-card .auth-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 28px;
}

.auth-form .form-group {
  margin-bottom: 18px;
}

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

.auth-form .input-wrapper {
  position: relative;
}

.auth-form .input-wrapper input {
  padding-right: 44px;
}

.auth-form .input-wrapper .toggle-pass {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
}

.auth-form .input-wrapper .toggle-pass:hover {
  color: var(--gold-primary);
}

.auth-form .btn-auth {
  width: 100%;
  padding: 13px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 8px;
}

.auth-form .form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.auth-form .form-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.auth-form .form-row label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--gold-primary);
}

.auth-form .form-row a {
  font-size: 0.83rem;
  color: var(--gold-primary);
  font-weight: 500;
}

.auth-form .form-row a:hover {
  color: var(--gold-light);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.auth-divider span {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--gold-primary);
  font-weight: 600;
}

.auth-footer a:hover {
  color: var(--gold-light);
}

.auth-tabs {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 28px;
}

.auth-tabs button {
  flex: 1;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  background: transparent;
  color: var(--text-muted);
  transition: var(--transition);
}

.auth-tabs button.active {
  background: var(--bg-card);
  color: var(--gold-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.auth-tabs button:hover:not(.active) {
  color: var(--text-secondary);
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

.auth-error {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 0.85rem;
  color: var(--danger);
  display: none;
}

.auth-error.show {
  display: block;
}

.auth-success {
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 0.85rem;
  color: var(--success);
  display: none;
}

.auth-success.show {
  display: block;
}

.password-strength {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.password-strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
  width: 0;
}

/* === HEADER USER MENU === */
.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: var(--gold-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--bg-primary);
  cursor: pointer;
}

.user-menu-wrapper {
  position: relative;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: var(--gold-border);
  border-radius: var(--radius);
  padding: 8px;
  min-width: 200px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
  z-index: 200;
}

.user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown .dropdown-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 6px;
}

.user-dropdown .dropdown-header .user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.user-dropdown .dropdown-header .user-email {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.user-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
}

.user-dropdown button:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.user-dropdown button.danger {
  color: var(--danger);
}

.user-dropdown button.danger:hover {
  background: rgba(231, 76, 60, 0.1);
}

/* === API TAB === */
.api-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.api-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-section p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.7;
}

.api-endpoint {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 10px;
  font-family: 'Courier New', monospace;
}

.api-endpoint .method {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-right: 10px;
}

.api-endpoint .method.get { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.api-endpoint .method.post { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.api-endpoint .method.put { background: rgba(243, 156, 18, 0.15); color: #f39c12; }
.api-endpoint .method.delete { background: rgba(231, 76, 60, 0.15); color: #e74c3c; }

.api-endpoint .path {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.api-endpoint .desc {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.code-block {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.7;
}

.code-block .kw { color: #c678dd; }
.code-block .str { color: #98c379; }
.code-block .cm { color: #5c6370; }
.code-block .fn { color: #61afef; }

/* === DB CARD CREDENTIALS === */
.db-credentials {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 10px 0;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
}

.db-cred-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
}

.db-cred-row + .db-cred-row {
  border-top: 1px solid var(--border-color);
}

.db-cred-label {
  color: var(--text-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

.db-cred-value {
  color: var(--gold-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
  text-align: right;
  font-size: 0.73rem;
}

.db-cred-value.id-value {
  color: var(--text-secondary);
}

.btn-copy {
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: var(--transition);
}

.btn-copy:hover {
  background: rgba(212, 168, 67, 0.15);
  color: var(--gold-primary);
}

.btn-copy.copied {
  color: var(--success);
}

/* === USAGE BARS === */
.db-usage-bars {
  margin: 8px 0 4px;
}

.db-usage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.db-usage-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  min-width: 60px;
  flex-shrink: 0;
}

.db-usage-bar {
  flex: 1;
  height: 5px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.db-usage-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
  background: var(--gold-gradient);
}

.db-usage-bar-fill.warning {
  background: linear-gradient(90deg, var(--warning), #e67e22);
}

.db-usage-bar-fill.danger {
  background: linear-gradient(90deg, var(--danger), #c0392b);
}

.db-usage-text {
  font-size: 0.68rem;
  color: var(--text-muted);
  min-width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* === STATUS BADGES === */
.db-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.db-status-badge.active {
  background: rgba(46, 204, 113, 0.12);
  color: var(--success);
}

.db-status-badge.paused {
  background: rgba(243, 152, 18, 0.12);
  color: var(--warning);
}

.db-status-badge .status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.db-visibility-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.db-visibility-badge.public {
  background: rgba(52, 152, 219, 0.12);
  color: #3498db;
}

.db-visibility-badge.private {
  background: rgba(155, 155, 155, 0.12);
  color: var(--text-muted);
}

/* === DB CARD ACTIONS === */
.db-card-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.db-card-actions .btn-icon {
  width: 30px;
  height: 30px;
  font-size: 0.8rem;
}

/* === DB CARD DESCRIPTION === */
.db-description {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.db-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.db-tag {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(212, 168, 67, 0.1);
  color: var(--gold-primary);
}

/* === EDIT DB MODAL === */
.db-edit-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.db-edit-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.db-edit-section h3 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gold-primary);
  margin-bottom: 12px;
}

.db-edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.db-edit-row label {
  font-size: 0.83rem;
  color: var(--text-secondary);
  min-width: 120px;
}

.db-edit-row input,
.db-edit-row select,
.db-edit-row textarea {
  flex: 1;
}

.db-api-key-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--gold-primary);
}

.db-api-key-display span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-url-display {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--gold-primary);
  word-break: break-all;
  margin-bottom: 10px;
}

/* === DATA EXPLORER === */
.explorer-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 500px;
}

.explorer-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.explorer-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}

.explorer-collections-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.explorer-collection-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
}

.explorer-collection-item:hover {
  background: var(--bg-tertiary);
}

.explorer-collection-item.active {
  background: rgba(212, 168, 67, 0.12);
  color: var(--gold-primary);
}

.explorer-col-icon {
  font-size: 0.85rem;
  opacity: 0.6;
}

.explorer-col-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.explorer-col-name {
  font-size: 0.82rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explorer-col-count {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.explorer-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.explorer-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.explorer-tab {
  padding: 10px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  background: transparent;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.explorer-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
}

.explorer-tab.active {
  color: var(--gold-primary);
  border-bottom-color: var(--gold-primary);
  background: rgba(212, 168, 67, 0.05);
}

.explorer-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.explorer-query-bar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.explorer-search-row {
  display: flex;
  gap: 8px;
}

.explorer-search-input {
  flex: 1;
  padding: 7px 12px;
  font-size: 0.82rem;
}

.explorer-filter-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.explorer-filter-select,
.explorer-filter-input {
  padding: 6px 10px;
  font-size: 0.78rem;
  width: auto;
  min-width: 80px;
}

.explorer-filter-select {
  width: auto;
  min-width: 100px;
}

.explorer-sort-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.explorer-records-wrapper {
  overflow-x: auto;
}

.explorer-table {
  min-width: 600px;
}

.explorer-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

/* === ACTIVITY FEED === */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.activity-item:hover {
  background: var(--bg-tertiary);
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

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

.activity-action {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: capitalize;
}

.activity-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.activity-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* === SNAPSHOTS === */
.snapshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.snapshot-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
}

.snapshot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.snapshot-icon {
  font-size: 1.4rem;
}

.snapshot-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.snapshot-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.snapshot-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 768px) {
  .explorer-layout {
    grid-template-columns: 1fr;
  }
  .explorer-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    max-height: 160px;
  }
  .explorer-collections-list {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding: 6px;
  }
  .explorer-collection-item {
    flex-shrink: 0;
    margin-bottom: 0;
  }
  .explorer-filter-row {
    flex-direction: column;
    align-items: stretch;
  }
  .explorer-filter-select,
  .explorer-filter-input {
    width: 100%;
  }
  .explorer-tabs {
    overflow-x: auto;
  }
  .explorer-tab {
    padding: 8px 12px;
    font-size: 0.75rem;
    white-space: nowrap;
  }
  .snapshots-grid {
    grid-template-columns: 1fr;
  }
}

/* === MODAL SCROLL === */
.modal {
  scrollbar-width: thin;
}

.modal::-webkit-scrollbar {
  width: 4px;
}

.modal::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 2px;
}

/* === RESPONSIVE AUTH === */
@media (max-width: 480px) {
  .auth-card { padding: 24px; }
  .splash-title { font-size: 1.8rem; }
  .splash-logo { width: 64px; height: 64px; font-size: 1.8rem; }
  .header-nav { display: none; }
  .header-user .user-name-display { display: none; }
  .db-credentials { padding: 8px; }
  .db-cred-label { font-size: 0.62rem; }
  .db-cred-value { font-size: 0.68rem; }
  .db-edit-row { flex-direction: column; align-items: stretch; }
  .db-edit-row label { min-width: unset; }
}
