@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=DM+Mono:wght@400;500;700&display=swap');

:root {
  --bg: #edf0f7;
  --bg-soft: #f8faff;
  --bg-card: #ffffff;
  --bg-card-elevated: #fdfcfa;
  --bg-hover: #eef2ff;
  --bg-input: #ffffff;
  --bg-dark: #0f172a;
  --sidebar: #111827;
  --sidebar-accent: #1f2937;
  --border: #e2e8f0;
  --border-strong: #cbd5f5;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-muted: #94a3b8;
  --accent: #DC2626;
  --accent-dark: #991B1B;
  --accent-soft: rgba(220,38,38,0.12);
  --accent-dim: rgba(220,38,38,0.12);
  --accent-glow: rgba(220,38,38,0.35);
  --green: #10b981;
  --purple: #6366f1;
  --violet: #8b5cf6;
  --cyan: #14b8a6;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --red: #ef4444;
  --mono: 'DM Mono', monospace;
  --sans: 'Prompt', sans-serif;
  --display: 'Space Grotesk', 'Prompt', sans-serif;
  --font-display: 'Space Grotesk', 'Prompt', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --radius: 18px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: radial-gradient(circle at top, rgba(249,115,22,0.08), transparent 40%);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
}

a { text-decoration: none; color: inherit; }

.ops-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar), #0b1121 70%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 18px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

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

.brand-mark img { width: 38px; height: 38px; border-radius: 12px; }
.brand-mark strong { display: block; font-family: var(--display); font-size: 18px; letter-spacing: -0.04em; }
.brand-mark span { font-size: 12px; color: rgba(255,255,255,0.6); }

.sidebar-section { margin-top: 10px; }
.sidebar-section p {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: rgba(255,255,255,0.4);
  margin-bottom: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
}

.nav-item svg { flex-shrink: 0; width: 18px; height: 18px; }
.nav-item span { white-space: nowrap; }

.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(249,115,22,0.22); color: #fff; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: rgba(255,255,255,0.6);
}
.sidebar-footer .dot {
  display: inline-flex;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin: 0 6px;
}
.dot-online { background: var(--green); box-shadow: 0 0 8px rgba(16,185,129,0.8); }

.workspace {
  padding: 32px clamp(24px, 5vw, 60px);
  background: linear-gradient(120deg, rgba(255,255,255,0.9), rgba(237,240,247,0.7));
}

.workspace-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.workspace-header p { color: var(--ink-muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.3em; }
.workspace-header h1 { font-size: clamp(26px, 3vw, 38px); font-weight: 600; letter-spacing: -0.02em; }

.workspace-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.page-heading {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.page-heading p { color: var(--ink-muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.3em; }
.page-heading h2 { font-size: 26px; font-weight: 600; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  border-radius: 20px;
  padding: 24px;
  background: var(--bg-card);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(15,23,42,0.05);
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(15,23,42,0.08);
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.stat-card-icon svg { color: var(--accent); }

.stat-label { color: var(--ink-muted); font-size: 13px; margin-bottom: 6px; }
.stat-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; font-family: var(--display); color: var(--ink); }
.stat-foot { font-size: 12px; color: var(--ink-muted); }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 30px 60px rgba(15,23,42,0.07);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-header {
  padding: 22px 24px 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.card-header p { color: var(--ink-muted); font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; }
.card-header h3 { font-size: 20px; font-weight: 600; }
.card-body { padding: 20px 24px 28px; }

.table-wrap { width: 100%; overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; min-width: 600px; }
.table-wrap th, .table-wrap td {
  font-size: 13px;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.table-wrap th { text-transform: uppercase; letter-spacing: 0.2em; font-size: 11px; color: var(--ink-muted); }
.table-wrap tbody tr:hover { background: var(--bg-soft); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  text-align: left;
}
.data-table th {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
}
.data-table tbody tr:hover { background: var(--bg-soft); }

.search-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.form-control {
  flex: 1;
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  background: #fff;
  transition: border 0.2s;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(249,115,22,0.15); }

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label { font-size: 13px; color: var(--ink-soft); }
.form-group textarea { resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border 0.2s;
}

.btn-pill { background: rgba(255,255,255,0.08); color: #fff; border-radius: 999px; padding: 8px 16px; font-size: 12px; border: 1px solid rgba(255,255,255,0.2); }
.btn-pill:hover { background: rgba(255,255,255,0.18); }

.btn-light { background: #fff; border-color: var(--border); color: var(--ink); }
.btn-light:hover { border-color: var(--ink-soft); }

.btn-solid { background: var(--accent); color: #fff; box-shadow: 0 12px 30px rgba(249,115,22,0.3); }
.btn-solid:hover { background: var(--accent-dark); }

.btn-primary { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 12px 30px rgba(249,115,22,0.3); }
.btn-primary:hover { background: var(--accent-dark); }

.btn-outline { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink-soft); }

.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--ink-soft); }
.btn-ghost:hover { color: var(--ink); background: rgba(15,23,42,0.05); }

.btn-danger { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 10px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--bg-soft);
  color: var(--ink-soft);
}
.badge-image { background: rgba(99,102,241,0.15); color: #4338ca; }
.badge-video { background: rgba(239,68,68,0.15); color: #be123c; }
.badge-audio { background: rgba(16,185,129,0.15); color: #047857; }
.badge-file { background: rgba(14,165,233,0.15); color: #0369a1; }
.badge-keeplab { background: rgba(249,115,22,0.15); color: #c2410c; }
.badge-google_drive { background: rgba(16,185,129,0.15); color: #047857; }
.badge-dropbox { background: rgba(59,130,246,0.15); color: #1d4ed8; }
.badge-s3 { background: rgba(249,115,22,0.15); color: #9a3412; }
.badge-onedrive { background: rgba(14,165,233,0.15); color: #0369a1; }
.badge-minio { background: rgba(249,115,22,0.12); color: #c2410c; }
.badge-telegram { background: rgba(14,165,233,0.12); color: #0369a1; }
.badge-s3 { background: rgba(249,115,22,0.15); color: #9a3412; }
.badge-onedrive { background: rgba(59,130,246,0.12); color: #1e40af; }
.badge-active { background: rgba(16,185,129,0.15); color: #047857; }
.badge-inactive { background: rgba(148,163,184,0.2); color: #475569; }

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.status-dot.on { background: var(--green); box-shadow: 0 0 8px rgba(16,185,129,0.8); }
.status-dot.off { background: rgba(226,232,240,0.6); }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-muted);
  padding: 20px 0;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,0.08);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

.file-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  margin-bottom: 12px;
}
.file-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}
.file-info { flex: 1; }
.file-info .name { font-weight: 600; }
.file-info .meta { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.file-actions { display: flex; gap: 8px; }
.file-actions .btn { min-height: 44px; min-width: 44px; }

/* Mobile touch targets — WCAG 2.5.5 / Apple HIG: ≥44px on small viewports */
@media (max-width: 640px) {
  .browse-files .btn,
  .browse-files button,
  .browse-search .btn,
  .browse-search input,
  .lang-toggle {
    min-height: 44px;
  }
  .file-card { gap: 12px; padding: 14px 16px; }
}

.empty-state {
  padding: 40px 0;
  text-align: center;
  color: var(--ink-soft);
}
.empty-state .icon { font-size: 32px; margin-bottom: 8px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-overlay.show,
.modal-overlay.active { display: flex; }

.modal {
  background: #fff;
  border-radius: 24px;
  padding: 28px;
  width: min(520px, 100%);
  box-shadow: 0 40px 80px rgba(15,23,42,0.25);
}

.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.modal-head p { color: var(--ink-muted); font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; font-family: var(--display); }
.modal-head h3 { font-size: 22px; font-weight: 600; }

.toggle-row { display: flex; gap: 20px; margin: 10px 0 4px; font-size: 13px; color: var(--ink-soft); }
.toggle-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

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

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-dark);
  color: #fff;
  padding: 14px 24px;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15,23,42,0.35);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  font-size: 14px;
}
.toast.show { opacity: 1; transform: translateY(0); }

.btn, .form-control, .card, .stat-card { transition: box-shadow 0.2s, transform 0.2s; }
.card:hover, .stat-card:hover { transform: translateY(-2px); box-shadow: 0 35px 70px rgba(15,23,42,0.12); }

/* ═══════════════ AUTH LAYOUT ═══════════════ */
.auth-body {
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, rgba(249,115,22,0.12), transparent 55%), var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 5vw, 60px);
}
.auth-shell {
  width: 100%;
  max-width: 1100px;
  background: #fff;
  border-radius: 32px;
  padding: clamp(28px, 4vw, 48px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 40px;
  box-shadow: 0 40px 80px rgba(15,23,42,0.08);
}
.auth-hero h1 {
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 600;
  margin-bottom: 16px;
}
.auth-hero p { color: var(--ink-soft); margin-bottom: 20px; line-height: 1.7; }
.auth-badge {
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 18px;
}
.auth-points { list-style: none; display: flex; flex-direction: column; gap: 10px; color: var(--ink-soft); font-size: 14px; }
.auth-points li::before { content: '• '; color: var(--accent); font-weight: 700; margin-right: 6px; }
.auth-panel {
  background: var(--bg-soft);
  border-radius: 24px;
  padding: clamp(20px, 3vw, 36px);
  display: flex;
  flex-direction: column;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.auth-brand img { width: 44px; height: 44px; border-radius: 16px; }
.auth-brand strong { font-size: 20px; font-weight: 600; display: block; }
.auth-brand span { font-size: 13px; color: var(--ink-muted); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-error {
  color: var(--red);
  font-size: 13px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 12px;
  padding: 10px 14px;
}
.auth-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--ink-muted); }
.auth-switch a { color: var(--accent); font-weight: 600; }

/* ═══════════════ BROWSE ═══════════════ */
.browse-body {
  min-height: 100vh;
  background: linear-gradient(135deg, rgba(249,115,22,0.12), transparent);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(24px, 6vw, 60px);
}
.browse-shell {
  width: 100%;
  max-width: 960px;
  background: #fff;
  border-radius: 28px;
  padding: clamp(24px, 4vw, 40px);
  box-shadow: 0 30px 70px rgba(15,23,42,0.08);
}
.browse-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.browse-header p { color: var(--ink-muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.3em; font-family: var(--display); }
.browse-header h1 { font-size: clamp(24px, 3vw, 36px); font-weight: 600; }
.browse-meta { display: flex; align-items: center; gap: 10px; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.mini-stat { padding: 18px; border-radius: 18px; border: 1px solid var(--border); background: var(--bg-soft); }
.mini-stat p { font-size: 12px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.2em; margin-bottom: 8px; }
.mini-stat h3 { font-size: 20px; font-weight: 600; }
.browse-search { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.browse-files { border-radius: 20px; border: 1px solid var(--border); background: var(--bg-card); min-height: 200px; padding: 20px; }

/* ═══════════════ USER DASHBOARD ═══════════════ */
.dashboard-body {
  background: var(--bg);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 0% 0%, rgba(99,102,241,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 0%, rgba(249,115,22,0.06) 0%, transparent 50%);
}
.topbar {
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 16px;
  margin: 12px 24px 0;
  padding: 12px clamp(20px, 4vw, 28px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-brand img { width: 44px; height: 44px; }
.topbar-brand strong { font-size: 18px; font-family: var(--display); display: block; }
.topbar-brand span { font-size: 12px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.2em; }
.topbar-user { display: flex; align-items: center; gap: 16px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta span { font-weight: 600; }
.user-meta small { font-size: 12px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.2em; }

.dashboard-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px clamp(20px, 5vw, 40px) 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.tab-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  flex-wrap: wrap;
}
.tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn.active { background: var(--accent-soft); color: var(--accent); }
.tab-btn:hover { color: var(--ink); }
.tab-panel { display: flex; flex-direction: column; gap: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.panel-head p { color: var(--ink-muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.3em; font-family: var(--display); }
.panel-head h3 { margin-top: 4px; font-size: 22px; font-weight: 600; }
.panel-note { font-size: 13px; color: var(--ink-muted); }
.conn-card, .file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin-bottom: 12px;
}

/* ═══════════════ ENHANCED TAB BAR ═══════════════ */
.tab-btn {
  font-weight: 500;
  position: relative;
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--accent), #fb923c);
  color: #fff;
  box-shadow: 0 4px 14px rgba(249,115,22,0.25);
}
.tab-btn:not(.active):hover {
  background: var(--bg-soft);
}

/* ═══════════════ ENHANCED TABLE ═══════════════ */
.data-table thead {
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
}
.data-table tbody tr {
  transition: background 0.15s, transform 0.15s;
}
.data-table tbody tr:hover {
  background: linear-gradient(90deg, rgba(99,102,241,0.04), rgba(249,115,22,0.04));
}

/* ═══════════════ QUOTA BAR ═══════════════ */
#quota-bar-wrap .card {
  background: var(--bg-card);
  border: 1px solid var(--border);
}
#quota-bar {
  background: var(--accent) !important;
}

/* ═══════════════ ENHANCED PANEL HEAD ═══════════════ */
.panel-head h3 {
  background: linear-gradient(135deg, var(--ink), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.panel-head p {
  letter-spacing: 0.35em;
}

/* ═══════════════ ENHANCED BUTTONS ═══════════════ */
.btn-solid {
  background: linear-gradient(135deg, var(--accent), #fb923c);
  box-shadow: 0 8px 24px rgba(249,115,22,0.3);
}
.btn-solid:hover {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  box-shadow: 0 12px 32px rgba(249,115,22,0.4);
  transform: translateY(-1px);
}

/* ═══════════════ CONNECTION CARDS ═══════════════ */
.conn-card {
  transition: border-color 0.2s, box-shadow 0.2s;
}
.conn-card:hover {
  border-color: var(--purple);
  box-shadow: 0 4px 16px rgba(99,102,241,0.1);
}

/* ═══════════════ TOPBAR ENHANCEMENTS ═══════════════ */
.topbar-brand strong {
  background: linear-gradient(135deg, #DC2626, #7F1D1D);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.user-meta span {
  color: var(--purple);
}

/* ═══════════════ STATS / BADGES SHARED ═══════════════ */
.mini-stats .badge, .browse-meta .badge { background: var(--accent-soft); color: var(--accent); }

/* ═══════════════ FILES PANEL ENHANCEMENTS ═══════════════ */

/* Search & Filter Bar */
.files-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.files-search {
  flex: 1;
  min-width: 220px;
  position: relative;
}
.files-search input {
  width: 100%;
  padding: 11px 16px 11px 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  background: var(--bg-soft);
  transition: border 0.2s, box-shadow 0.2s;
}
.files-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }
.files-search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-muted); pointer-events: none; }
.files-filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.filter-chip {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-chip:hover { border-color: var(--ink-muted); background: var(--bg-soft); }
.filter-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 2px 8px rgba(220,38,38,0.2); }
.filter-chip.active[data-type="image"] { background: rgba(99,102,241,0.15); color: #4338ca; border-color: rgba(99,102,241,0.3); box-shadow: 0 2px 8px rgba(99,102,241,0.15); }
.filter-chip.active[data-type="video"] { background: rgba(239,68,68,0.15); color: #be123c; border-color: rgba(239,68,68,0.3); box-shadow: 0 2px 8px rgba(239,68,68,0.15); }
.filter-chip.active[data-type="audio"] { background: rgba(16,185,129,0.15); color: #047857; border-color: rgba(16,185,129,0.3); box-shadow: 0 2px 8px rgba(16,185,129,0.15); }
.filter-chip.active[data-type="file"] { background: rgba(14,165,233,0.15); color: #0369a1; border-color: rgba(14,165,233,0.3); box-shadow: 0 2px 8px rgba(14,165,233,0.15); }
.filter-chip[data-type="image"]:hover { background: rgba(99,102,241,0.08); border-color: rgba(99,102,241,0.25); color: #4338ca; }
.filter-chip[data-type="video"]:hover { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.25); color: #be123c; }
.filter-chip[data-type="audio"]:hover { background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.25); color: #047857; }
.filter-chip[data-type="file"]:hover { background: rgba(14,165,233,0.08); border-color: rgba(14,165,233,0.25); color: #0369a1; }
.filter-chip .chip-count {
  font-size: 10px;
  opacity: 0.7;
  font-family: var(--font-mono);
}
.files-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
select.files-controls,
.files-controls select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  background: var(--bg-soft);
  cursor: pointer;
  color: var(--ink-soft);
}
.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.view-toggle button {
  padding: 9px 14px;
  border: none;
  background: var(--bg-card);
  cursor: pointer;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  transition: all 0.2s;
}
.view-toggle button.active { background: var(--accent); color: #fff; }
.view-toggle button:not(:last-child) { border-right: 1px solid var(--border); }

/* Bulk Actions Bar */
.bulk-bar {
  display: none;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px;
}
.bulk-bar.show { display: flex; }
.bulk-bar .bulk-count { font-size: 13px; font-weight: 600; color: var(--accent); }
.bulk-bar .btn { font-size: 12px; padding: 6px 14px; }

/* File Type Icons */
.file-type-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.file-type-icon.type-image { background: rgba(99,102,241,0.12); color: #4338ca; }
.file-type-icon.type-video { background: rgba(239,68,68,0.12); color: #be123c; }
.file-type-icon.type-audio { background: rgba(16,185,129,0.12); color: #047857; }
.file-type-icon.type-file { background: rgba(14,165,233,0.12); color: #0369a1; }
.file-type-icon.type-xlsx, .file-type-icon.type-csv { background: rgba(16,185,129,0.12); color: #047857; }
.file-type-icon.type-pdf { background: rgba(239,68,68,0.12); color: #be123c; }
.file-type-icon.type-doc, .file-type-icon.type-docx { background: rgba(59,130,246,0.12); color: #1d4ed8; }
.file-type-icon.type-zip { background: rgba(249,115,22,0.12); color: #c2410c; }

/* Grid View */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.file-grid-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.file-grid-card:hover { border-color: var(--accent); box-shadow: 0 8px 24px rgba(15,23,42,0.08); transform: translateY(-2px); }
.file-grid-card .file-type-icon { width: 52px; height: 52px; font-size: 18px; border-radius: 14px; }
.file-grid-card .file-grid-name {
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-grid-card .file-grid-meta { font-size: 11px; color: var(--ink-muted); }
.file-grid-card .star-btn { position: absolute; top: 8px; right: 8px; }
.file-grid-card .grid-check { position: absolute; top: 8px; left: 8px; }
.file-grid-card.previewable { cursor: pointer; }
.file-grid-card.previewable:hover { border-color: #4338ca; }

/* Grid thumbnail */
.file-grid-card.has-thumb { padding-top: 12px; }
.grid-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  background: var(--bg-soft);
  overflow: hidden;
  position: relative;
}
.grid-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s;
}
.grid-thumb.loaded img { opacity: 1; }
.grid-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}
.grid-thumb.loaded .grid-thumb-placeholder { opacity: 0; }

/* List view preview hint */
.file-name-preview { color: var(--ink); }
.file-name-preview:hover { color: #4338ca; }
.preview-eye { vertical-align: -2px; opacity: 0.4; margin-right: 2px; }
.file-name-preview:hover .preview-eye { opacity: 1; color: #4338ca; }

/* Star Button */
.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: var(--ink-muted);
  transition: color 0.2s, transform 0.2s;
  font-size: 16px;
  line-height: 1;
}
.star-btn:hover { color: var(--amber); transform: scale(1.15); }
.star-btn.starred { color: var(--amber); }

/* Starred Section */
.starred-section {
  margin-bottom: 20px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(245,158,11,0.06), rgba(249,115,22,0.04));
  border: 1px solid rgba(245,158,11,0.15);
  border-radius: 16px;
}
.starred-section h4 { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.starred-files { display: flex; gap: 10px; flex-wrap: wrap; }
.starred-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.starred-chip:hover { border-color: var(--accent); }

/* File Category Stats */
.file-categories {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.category-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.category-chip:hover { opacity: 0.85; transform: translateY(-1px); }
.category-chip.cat-image { background: rgba(99,102,241,0.1); color: #4338ca; }
.category-chip.cat-video { background: rgba(239,68,68,0.1); color: #be123c; }
.category-chip.cat-audio { background: rgba(16,185,129,0.1); color: #047857; }
.category-chip.cat-file { background: rgba(14,165,233,0.1); color: #0369a1; }
.category-chip .cat-bar {
  width: 48px;
  height: 5px;
  border-radius: 3px;
  background: rgba(0,0,0,0.06);
  overflow: hidden;
}
.category-chip .cat-bar-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }
.cat-image .cat-bar-fill { background: #4338ca; }
.cat-video .cat-bar-fill { background: #be123c; }
.cat-audio .cat-bar-fill { background: #047857; }
.cat-file .cat-bar-fill { background: #0369a1; }

/* Activity Timeline */
.activity-timeline {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px;
}
.activity-timeline h4 { font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.timeline-items { display: flex; flex-direction: column; gap: 10px; }
.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  padding: 12px 16px;
  background: var(--bg-soft);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.timeline-left {
  flex-shrink: 0;
  min-width: 90px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.timeline-date { font-weight: 600; font-size: 13px; color: var(--ink); white-space: nowrap; }
.timeline-count { font-size: 11px; color: var(--ink-muted); font-family: var(--font-mono); }
.timeline-files {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.timeline-file {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.timeline-filename {
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}
.timeline-more {
  font-size: 11px;
  color: var(--ink-muted);
  padding-left: 16px;
}
.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.timeline-dot.dot-image { background: #4338ca; }
.timeline-dot.dot-video { background: #be123c; }
.timeline-dot.dot-audio { background: #047857; }
.timeline-dot.dot-file { background: #0369a1; }

/* Storage Analytics */
.analytics-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 28px;
  box-shadow: 0 4px 16px rgba(15,23,42,0.04);
}
.analytics-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--ink); }
.donut-wrap { display: flex; align-items: center; gap: 28px; }
.donut-legend { display: flex; flex-direction: column; gap: 10px; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }

/* Pagination */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 4px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
.pagination-bar .page-info { font-family: var(--font-mono); font-size: 12px; }
.load-more-btn {
  padding: 10px 28px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--ink);
}
.load-more-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Empty State */
.files-empty {
  text-align: center;
  padding: 60px 24px;
}
.files-empty .empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--accent-soft), rgba(99,102,241,0.08));
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.files-empty h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.files-empty p { color: var(--ink-muted); font-size: 14px; margin-bottom: 24px; }
.empty-steps { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.empty-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-soft);
  border-radius: 12px;
  font-size: 13px;
}
.empty-step .step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Preview Modal */
.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.75);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.preview-modal {
  background: #fff;
  border-radius: 24px;
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  box-shadow: 0 40px 80px rgba(15,23,42,0.3);
}
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.preview-header h3 { font-size: 16px; font-weight: 600; max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-body { padding: 24px; display: flex; align-items: center; justify-content: center; min-height: 200px; flex-direction: column; }
.preview-body img { max-width: 100%; max-height: 60vh; border-radius: 12px; }
.preview-body video { max-width: 100%; max-height: 60vh; border-radius: 12px; }
.preview-body audio { width: 100%; }
.preview-body iframe { width: 100%; border-radius: 8px; }
.preview-info { padding: 16px 24px; background: var(--bg-soft); border-radius: 0 0 24px 24px; display: flex; gap: 20px; font-size: 13px; color: var(--ink-soft); flex-wrap: wrap; }

/* Share Modal */
.share-modal {
  background: #fff;
  border-radius: 24px;
  padding: 28px;
  width: min(420px, 100%);
  box-shadow: 0 40px 80px rgba(15,23,42,0.25);
  text-align: center;
}
.share-modal h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.share-modal p { color: var(--ink-muted); font-size: 13px; margin-bottom: 20px; }
.share-link-box {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.share-link-box input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  background: var(--bg-soft);
}
.qr-wrap { margin: 0 auto 16px; }
.qr-wrap canvas { border-radius: 12px; }

/* File row with checkbox and actions */
.file-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.data-table .cb-cell { width: 40px; text-align: center; }
.data-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Files panel specific spacing */
#panel-files { gap: 0; }
#panel-files .panel-head { margin-bottom: 24px; }
#panel-files .card { border-radius: 18px; }
#files-content { margin-top: 0; }
#panel-files .data-table th,
#panel-files .data-table td {
  padding: 14px 16px;
}
#panel-files .data-table th {
  font-size: 11px;
  letter-spacing: 0.08em;
  padding-top: 16px;
  padding-bottom: 16px;
}
#panel-files .data-table tbody tr {
  transition: background 0.15s;
}
#panel-files .data-table tbody tr:hover {
  background: linear-gradient(90deg, rgba(99,102,241,0.03), rgba(249,115,22,0.03));
}

@media (max-width: 960px) {
  .analytics-wrap { grid-template-columns: 1fr; }
  .ops-shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar-section { width: 100%; }
  .nav-item { padding: 10px; }
  .sidebar-footer { width: 100%; }
}

@media (max-width: 640px) {
  .workspace { padding: 24px 16px 60px; }
  .workspace-header { flex-direction: column; align-items: flex-start; }
  .table-wrap table { min-width: 520px; }
  .files-toolbar { flex-direction: column; }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .empty-steps { flex-direction: column; align-items: center; }
}

/* ═══════════════ CHART A11Y ═══════════════
   Each chart cell is keyboard-focusable so AT users can navigate values. */
.chart-cell {
  outline: none;
  transition: background 0.15s, transform 0.15s;
}
.chart-cell:focus-visible {
  background: var(--accent-soft);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.chart-cell:hover { transform: translateY(-1px); }

/* ═══════════════ REDUCED MOTION ═══════════════
   Honor users who opted out of animation at the OS level.
   Why: vestibular sensitivity + WCAG 2.3.3. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
