:root,
[data-theme="light"] {
  --bg-app: #f4f6fb;
  --bg-sidebar: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-2: #f8fafd;
  --bg-surface-hover: #eef2ff;
  --bg-elevated: #ffffff;
  --bg-input: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --emerald: #059669;
  --emerald-soft: rgba(5, 150, 105, 0.11);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.16);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-sidebar: #0f1624;
  --bg-surface: #131c2e;
  --bg-surface-2: #182338;
  --bg-surface-hover: #1e2b45;
  --bg-elevated: #162033;
  --bg-input: #19243a;
  --border-subtle: #1f2d47;
  --border-strong: #2d4063;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.15);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.16);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.6);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

.hidden {
  display: none !important;
}

/* =================== APP SHELL =================== */

.app-shell {
  display: grid;
  grid-template-columns: 268px 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* =================== SIDEBAR =================== */

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 16px;
  overflow-y: auto;
  z-index: 30;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px;
}

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

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.28);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand-sub {
  font-size: 11.5px;
  color: var(--emerald);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

/* Upload CTA Group */
.upload-cta-wrap {
  position: relative;
}

.btn-upload-main {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, #3b82f6 100%);
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.28);
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

.btn-upload-main:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.36);
}

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

.quick-upload-subrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 8px;
}

.btn-sub-action {
  padding: 7.5px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-sub-action:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* Sidebar Navigation */
.nav-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 4px 10px 2px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  width: 100%;
  padding: 9.5px 11px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.14s, color 0.14s;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  opacity: 0.85;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--bg-input);
  color: var(--text-muted);
}

.nav-item.active .nav-badge {
  background: var(--accent);
  color: #fff;
}

/* Storage Box in Sidebar */
.storage-widget {
  margin-top: auto;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.storage-widget-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.storage-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.unlimited-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--emerald-soft);
  color: var(--emerald);
  white-space: nowrap;
}

.storage-meter {
  height: 7px;
  border-radius: 99px;
  background: var(--border-subtle);
  overflow: hidden;
  display: flex;
}

.meter-seg {
  height: 100%;
  transition: width 0.3s ease;
}

.storage-stats-line {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.storage-engine-tag {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.3;
}

.engine-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  flex-shrink: 0;
}

.btn-storage-settings {
  width: 100%;
  padding: 7.5px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: border-color 0.15s, color 0.15s;
}

.btn-storage-settings:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* =================== MAIN WORKSPACE =================== */

.main-area {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-app);
}

/* Topbar */
.topbar {
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 560px;
}

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  place-items: center;
  color: var(--text-primary);
}

.search-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 9.5px 34px 9.5px 38px;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.search-box input:focus {
  border-color: var(--accent);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-clear {
  position: absolute;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 13px;
  color: var(--text-muted);
  display: grid;
  place-items: center;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}

.pill-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pill-btn.active-lock {
  background: var(--emerald-soft);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--emerald);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Guarantee Strip */
.guarantee-strip {
  padding: 8px 22px;
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
}

.guarantee-badges {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.g-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.g-badge strong {
  color: var(--emerald);
  font-weight: 700;
}

/* Toolbar & Breadcrumbs */
.drive-toolbar {
  padding: 14px 22px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 15px;
  font-weight: 600;
}

.crumb-btn {
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14.5px;
  transition: background 0.14s, color 0.14s;
}

.crumb-btn:hover {
  background: var(--bg-surface);
  color: var(--accent);
}

.crumb-btn.current {
  color: var(--text-primary);
  font-weight: 700;
}

.crumb-sep {
  color: var(--text-muted);
  font-size: 13px;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-sort {
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  outline: none;
}

.view-toggle {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.view-toggle button {
  width: 30px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.view-toggle button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-toolbar {
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.14s;
}

.btn-toolbar:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-toolbar.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Bulk Action Bar */
.bulk-bar {
  margin: 0 22px 10px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid rgba(99, 102, 241, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.bulk-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.btn-bulk {
  padding: 6px 11px;
  border-radius: 7px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-bulk:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

/* =================== DRIVE CONTENT SCROLL AREA =================== */

.drive-content {
  flex: 1;
  overflow-y: auto;
  padding: 6px 22px 96px;
}

.section-heading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 10px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Folders Grid */
.folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.folder-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
  user-select: none;
  position: relative;
}

.folder-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.folder-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.folder-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
}

.folder-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-surface-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.folder-meta {
  min-width: 0;
}

.folder-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-menu-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

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

/* Files Grid */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 14px;
}

.file-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

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

.file-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.file-thumb {
  height: 144px;
  background: var(--bg-surface-2);
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
}

.file-thumb img,
.file-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-type-emblem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ext-pill {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

/* Card top overlay controls */
.card-select-check {
  position: absolute;
  top: 9px;
  left: 9px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.62);
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  color: #fff;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.14s;
  z-index: 3;
}

.file-card:hover .card-select-check,
.file-card.selected .card-select-check {
  opacity: 1;
}

.file-card.selected .card-select-check {
  background: var(--accent);
  border-color: var(--accent);
}

.lossless-chip {
  position: absolute;
  bottom: 8px;
  left: 8px;
  padding: 2.5px 7px;
  border-radius: 6px;
  background: rgba(6, 78, 59, 0.86);
  color: #6ee7b7;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  backdrop-filter: blur(4px);
  z-index: 2;
}

.share-chip {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(79, 70, 229, 0.88);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  z-index: 2;
}

.play-overlay {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
}

.file-body {
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.file-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.file-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.file-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

.file-quick-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.mini-act-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: background 0.14s, color 0.14s;
}

.mini-act-btn:hover {
  background: var(--bg-input);
  color: var(--accent);
}

.mini-act-btn.starred {
  color: #f59e0b;
}

/* =================== LIST VIEW TABLE =================== */

.list-table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.list-table th {
  text-align: left;
  padding: 11px 14px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
}

.list-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

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

.list-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

.list-table tbody tr:hover {
  background: var(--bg-surface-hover);
}

.list-table tbody tr.selected {
  background: var(--accent-soft);
}

.list-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  max-width: 360px;
}

.list-name-cell span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-thumb {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--bg-surface-2);
  flex-shrink: 0;
}

/* Empty State */
.empty-state {
  margin-top: 28px;
  padding: 54px 24px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
}

.empty-state p {
  font-size: 13.5px;
  color: var(--text-secondary);
  max-width: 460px;
  line-height: 1.55;
}

.empty-btns {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

/* =================== FULL WINDOW DRAG OVERLAY =================== */

.drop-overlay {
  position: fixed;
  inset: 14px;
  border-radius: 20px;
  border: 3px dashed var(--accent);
  background: rgba(15, 23, 42, 0.84);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #fff;
  pointer-events: none;
}

.drop-overlay h2 {
  font-size: 24px;
  font-weight: 800;
}

.drop-overlay p {
  font-size: 14.5px;
  color: #cbd5e1;
}

/* =================== FLOATING UPLOAD QUEUE =================== */

.upload-drawer {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 370px;
  max-width: calc(100vw - 32px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 95;
  overflow: hidden;
}

.upload-drawer-header {
  padding: 12px 15px;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 700;
}

.upload-drawer-controls {
  display: flex;
  gap: 6px;
}

.upload-drawer-controls button {
  color: #fff;
  opacity: 0.85;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  display: grid;
  place-items: center;
}

.upload-drawer-controls button:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.16);
}

.upload-list {
  max-height: 270px;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.upload-item {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
}

.upload-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.upload-bar-bg {
  height: 6px;
  border-radius: 99px;
  background: var(--border-subtle);
  overflow: hidden;
}

.upload-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--emerald));
  transition: width 0.18s ease;
}

.upload-item-sub {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* =================== CONTEXT MENU =================== */

.context-menu {
  position: fixed;
  min-width: 196px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 150;
}

.ctx-item {
  width: 100%;
  padding: 8.5px 11px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
}

.ctx-item:hover {
  background: var(--bg-surface-hover);
  color: var(--accent);
}

.ctx-item.danger {
  color: var(--danger);
}

.ctx-item.danger:hover {
  background: var(--danger-soft);
}

.ctx-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 5px 0;
}

/* =================== MODALS =================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.72);
  backdrop-filter: blur(5px);
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-card.wide {
  max-width: 680px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  font-size: 13.5px;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  background: var(--bg-surface);
}

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 4px;
}

.btn-primary {
  padding: 9.5px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

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

.btn-secondary {
  padding: 9.5px 15px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-strong);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* =================== FILE PREVIEW & INSPECTOR MODAL =================== */

.preview-modal {
  width: 100%;
  max-width: 1080px;
  height: min(86vh, 780px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 1fr 330px;
  overflow: hidden;
}

.preview-stage {
  background: #070b12;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.preview-stage-top {
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.78);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-stage-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.preview-zoom-controls button {
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.preview-zoom-controls button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.preview-canvas {
  flex: 1;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 18px;
}

.preview-canvas img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.16s ease;
  border-radius: 4px;
}

.preview-canvas video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  outline: none;
}

.preview-canvas iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
  background: #fff;
}

.preview-text-box {
  width: 100%;
  height: 100%;
  background: #0d1321;
  color: #e2e8f0;
  padding: 18px;
  border-radius: 10px;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 12.5px;
  line-height: 1.6;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-inspector {
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-subtle);
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.verified-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.verified-card-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--emerald);
  display: flex;
  align-items: center;
  gap: 6px;
}

.verified-card p {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.btn-verify-live {
  padding: 6px 10px;
  border-radius: 7px;
  background: var(--bg-surface);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--emerald);
  font-size: 11.5px;
  font-weight: 700;
  align-self: flex-start;
}

.btn-verify-live:hover {
  background: var(--emerald);
  color: #fff;
}

.meta-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 12.5px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border-subtle);
}

.meta-row span:first-child {
  color: var(--text-muted);
}

.meta-row span:last-child {
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}

.hash-box {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  font-family: monospace;
  font-size: 11px;
  word-break: break-all;
  color: var(--text-secondary);
  line-height: 1.45;
}

.inspector-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

/* Storage Engine Tabs */
.engine-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.engine-tab {
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface-2);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.engine-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.engine-tab strong {
  font-size: 13.5px;
}

.engine-tab span {
  font-size: 11.5px;
  color: var(--text-muted);
}

.info-callout {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Color Swatches */
.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
}

.swatch.active {
  border-color: var(--text-primary);
  transform: scale(1.1);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 250;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: 99px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  animation: fadeUp 0.2s ease;
}

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

/* Vault Lock Fullscreen Gate */
.vault-gate {
  position: fixed;
  inset: 0;
  background: var(--bg-app);
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
}

/* Abyss.to Cloud Badges & Guide Styles */
.abyss-chip {
  position: absolute;
  bottom: 8px;
  left: 8px;
  padding: 2.5px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(219, 39, 119, 0.92), rgba(124, 58, 237, 0.92));
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  backdrop-filter: blur(4px);
  z-index: 2;
}

.abyss-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(236, 72, 153, 0.14);
  color: #db2777;
  white-space: nowrap;
}

[data-theme="dark"] .abyss-pill {
  color: #f472b6;
}

.step-guide-box {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid rgba(99, 102, 241, 0.28);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-primary);
}

.step-guide-box ol {
  margin-left: 18px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Responsive */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 275px;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-menu-btn {
    display: grid;
  }
  .mobile-close-btn {
    display: grid !important;
  }
  .preview-modal {
    grid-template-columns: 1fr;
    height: 92vh;
  }
  .preview-inspector {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    max-height: 44vh;
  }
  .form-row-2,
  .engine-tabs {
    grid-template-columns: 1fr;
  }
}
