/* ORIGINAL design, recovered 2026-07-19 byte-exact from Chrome's HTTP cache
 * (http://127.0.0.1:3000/css/app.css?v=42, fetched 2026-06-22). It replaces the
 * post-deletion "functional skin" rewrite, which had 406 lines to this file's 1665,
 * dropped 11 design tokens (including the layout vars the resize handles write to)
 * and 64 component classes, and had no motion at all. Verified against every
 * surviving session-log fragment at identical line numbers. ~110 late lines from the
 * final v=60 build are not in this copy and may need hand-restyling.
 * Evidence + raw cache entry: ~/Documents/vault-recovery-2026-07-19/ui-candidates/
 */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-hover: #1c2128;
  --bg-active: #263040;
  --border: #30363d;
  --border-light: #3d444d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-dim: #1f3a5f;
  --accent-hover: #79c0ff;
  --danger: #f85149;
  --danger-dim: #5f2120;
  --success: #3fb950;
  --success-dim: #1a4028;
  --warning: #d29922;
  --warning-dim: #4a3520;
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-width: 240px;
  --filelist-width: 320px;
  --toolbar-height: 42px;
  --transition: 150ms ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

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

.screen {
  position: absolute;
  inset: 0;
}

/* ---- Auth Screen ---- */

.auth-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 360px;
  text-align: center;
}

.auth-icon {
  color: var(--accent);
  margin-bottom: 16px;
}

.auth-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 14px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.auth-form input:focus {
  border-color: var(--accent);
}

.btn-primary {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-error {
  color: var(--danger);
  margin-top: 12px;
  font-size: 13px;
  min-height: 20px;
}

.auth-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 6px 2px;
  width: 100%;
}
.auth-link:hover { text-decoration: underline; }

.auth-hint {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: left;
  margin-bottom: 10px;
  line-height: 1.45;
}


.auth-loading {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.password-strength {
  height: 3px;
  border-radius: 2px;
  background: var(--bg-tertiary);
  overflow: hidden;
  transition: all var(--transition);
}

.password-strength .bar {
  height: 100%;
  border-radius: 2px;
  transition: width 300ms ease, background 300ms ease;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ---- Toolbar ---- */

.toolbar {
  height: var(--toolbar-height);
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 8px;
  -webkit-app-region: drag;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.toolbar-btn.icon-only {
  padding: 6px;
}

.toolbar-icon {
  color: var(--accent);
}

.toolbar-title {
  font-size: 15px;
  font-weight: 600;
}

.toolbar-center {
  flex: 1;
  min-width: 0;
  -webkit-app-region: no-drag;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.search-box input:focus {
  border-color: var(--accent);
  background: var(--bg-primary);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  -webkit-app-region: no-drag;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

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

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

/* ---- Content Layout ---- */

/* Workspace is a full-height row: [ left-region | resize | viewer ].
   The toolbar lives INSIDE the left region, so the viewer spans the full window
   height on the right. */
.workspace {
  display: flex;
  height: 100vh;
}

.left-region {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.left-panels {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: 180px;
  max-width: 400px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-section:first-child {
  flex: 1;
  min-height: 0;
}

.sidebar-section:not(:first-child) {
  border-top: 1px solid var(--border);
}

.sidebar-section:nth-child(2) {
  flex-shrink: 0;
}

.sidebar-section:last-child {
  max-height: 40%;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.sidebar-action {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all var(--transition);
}

.sidebar-action:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-color: var(--border);
}

/* ---- Folder Tree ---- */

.folder-tree {
  overflow-y: auto;
  flex: 1;
  padding-bottom: 8px;
}

.folder-item {
  display: flex;
  align-items: center;
  padding: 5px 10px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 150ms ease, color 150ms ease;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
}

.indent-guide {
  width: 18px;
  flex-shrink: 0;
  align-self: stretch;
  margin-left: 4px;
  position: relative;
}

.indent-guide::before,
.indent-guide::after {
  content: '';
  position: absolute;
  pointer-events: none;
}

.indent-guide.continues::before,
.indent-guide.branch::before {
  left: 8px;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--border);
}

.indent-guide.branch.last::before {
  bottom: 50%;
}

.indent-guide.branch::after {
  left: 8px;
  right: -4px;
  top: 50%;
  border-top: 1px solid var(--border);
}

.indent-guide:first-child {
  margin-left: 8px;
}

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

.folder-item.active {
  background: var(--bg-active);
  color: var(--accent);
}

.folder-item.drop-target {
  background: var(--accent-dim);
  outline: 1px dashed var(--accent);
  outline-offset: -1px;
}

.folder-item[draggable="true"] {
  cursor: grab;
}

.folder-item[draggable="true"]:active {
  cursor: grabbing;
  opacity: 0.6;
}

.folder-chevron {
  width: 16px;
  min-width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.folder-chevron-spacer {
  display: inline-block;
  width: 16px;
  min-width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.folder-chevron svg {
  transition: transform 150ms ease;
}

.folder-chevron.expanded svg {
  transform: rotate(90deg);
}


.folder-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--warning);
}

.folder-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  flex-shrink: 0;
  padding-left: 4px;
}

/* ---- View List ---- */

.view-list {
  padding: 4px 8px 8px;
}

.view-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  transition: background 150ms ease, color 150ms ease;
}

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

.view-item.active {
  background: var(--bg-active);
  color: var(--accent);
}

.view-item-icon {
  width: 16px;
  text-align: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

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

/* ---- Tag List ---- */

.tag-list {
  overflow-y: auto;
  padding: 4px 10px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition);
  white-space: nowrap;
}

.tag-chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.tag-chip.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

.tag-chip .tag-remove {
  width: 14px;
  height: 14px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
}

.tag-chip:hover .tag-remove {
  display: flex;
}

/* ---- File List Panel ---- */

.file-list-panel {
  width: var(--filelist-width);
  min-width: 240px;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-primary);
}

.file-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}

.file-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.file-list-sort {
  display: flex;
  gap: 2px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.sort-btn {
  padding: 3px 10px;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: all var(--transition);
}

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

.sort-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.file-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  gap: 10px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: all var(--transition);
}

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

.file-item.active {
  background: var(--bg-active);
  border-bottom-color: var(--border);
}

.file-type-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  color: #fff;
}

.file-type-badge.folder-badge { background: #d2992233; color: var(--warning); display: flex; align-items: center; justify-content: center; }
.file-type-badge.image { background: #2ea04366; color: var(--success); }
.file-type-badge.video { background: #388bfd33; color: var(--accent); }
.file-type-badge.audio { background: #d2992233; color: var(--warning); }
.file-type-badge.pdf { background: #f8514933; color: var(--danger); }
.file-type-badge.text { background: #8b949e33; color: var(--text-secondary); }
.file-type-badge.other { background: #8b949e22; color: var(--text-muted); }

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

.file-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.file-tags {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.file-tag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.file-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  padding: 20px;
  text-align: center;
  gap: 8px;
}

.fav-star {
  color: var(--warning);
}

.activity-item {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}

.activity-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.activity-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Grid View ---- */

.file-list.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  padding: 8px;
  align-content: start;
}

.grid-tile {
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  background: var(--bg-secondary);
}

.grid-tile:hover {
  border-color: var(--border-light);
}

.grid-tile.active {
  border-color: var(--accent);
}

.grid-thumb {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
}

.grid-thumb {
  position: relative;
}

.grid-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.grid-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  padding-left: 2px;
  pointer-events: none;
}

.grid-thumb-icon {
  background: var(--bg-tertiary);
}

.grid-type-label {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  color: var(--text-muted);
  background: var(--bg-primary);
}

.grid-label {
  padding: 6px 8px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}

/* ---- Lightbox ---- */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  z-index: 900;
  display: flex;
  flex-direction: column;
}

.lightbox-media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: default;
}

.lb-img {
  max-width: 95vw;
  max-height: calc(100vh - 60px);
  object-fit: contain;
  transition: transform 100ms ease;
  will-change: transform;
  cursor: grab;
}

.lb-video {
  max-width: 95vw;
  max-height: calc(100vh - 60px);
  outline: none;
}

.lightbox-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 910;
}

#lb-prev, #lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: auto;
  width: 48px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.3);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  border-radius: var(--radius);
}

#lb-prev { left: 8px; }
#lb-next { right: 8px; }
#lb-prev:hover, #lb-next:hover { color: #fff; background: rgba(0,0,0,0.6); }

.lb-toolbar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: 6px 12px;
}

.lb-tool {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 16px;
  transition: all var(--transition);
}

.lb-tool:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.lb-counter {
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  padding: 0 8px;
  white-space: nowrap;
}

/* ---- Resize Handle ---- */

.resize-handle {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  transition: background var(--transition);
  flex-shrink: 0;
}

.resize-handle:hover,
.resize-handle.active {
  background: var(--accent);
}

/* ---- Viewer Panel ---- */

.viewer-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  background: var(--bg-primary);
  position: relative;
}

/* Immersive mode: collapse the entire left region (toolbar + sidebar + file list),
   expand the viewer to fill the window. Exit with F or Esc. */
body.immersive .left-region,
body.immersive #resize-filelist {
  display: none;
}

body.immersive .immersive-btn-active {
  color: var(--accent);
  border-color: var(--accent);
}

.viewer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 8px;
}

.viewer-empty-icon {
  opacity: 0.3;
}

.viewer-hint {
  font-size: 12px;
}

.viewer-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px;
  min-height: 0;
}

.viewer-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
}

.viewer-content video {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  outline: none;
}

.viewer-content audio {
  width: 80%;
  max-width: 500px;
}

.viewer-content embed,
.viewer-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius);
  background: #fff;
}

.viewer-content pre {
  width: 100%;
  height: 100%;
  padding: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 13px;
  overflow: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  user-select: text;
}

.viewer-unsupported {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

.viewer-unsupported .unsupported-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.audio-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 500px;
}

.audio-art {
  width: 200px;
  height: 200px;
  background: linear-gradient(135deg, var(--accent-dim), var(--bg-tertiary));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--accent);
}

.audio-name {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  word-break: break-word;
}

.viewer-info {
  position: absolute;
  left: 0;
  right: 0;
  /* Anchored to the TOP so it never covers a video's native controls (which sit at
     the bottom). Behaves like a title strip; fades downward. */
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(to bottom, rgba(13,17,23,0.92), rgba(13,17,23,0.0));
  gap: 12px;
  opacity: 1;
  transition: opacity 300ms ease;
  pointer-events: none;
}

/* Only the interactive bits capture clicks, so the title strip never blocks media. */
.viewer-info-left,
.viewer-info-right {
  pointer-events: auto;
}

.viewer-info.hidden-idle {
  opacity: 0;
  pointer-events: none;
}

.viewer-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.viewer-info-left span:first-child {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-info-right {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* The transcode limitation notice. Allowed to shrink and ellipsize rather than push the filename
   out of the strip — the filename is what identifies what you are looking at. */
.viewer-transcode-note {
  color: var(--warning);
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-muted {
  color: var(--text-muted);
  font-size: 12px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

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

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

/* ---- Drop Overlay ---- */

.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--accent);
  font-size: 20px;
  font-weight: 500;
  padding: 60px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
}

/* ---- Context Menu ---- */

.context-menu {
  position: fixed;
  z-index: 500;
  min-width: 180px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.context-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  transition: background var(--transition);
}

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

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

.context-item.danger:hover {
  background: var(--danger-dim);
}

.context-separator {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

/* ---- Modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-width: 320px;
  max-width: 500px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

.modal h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

.modal-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  margin-bottom: 16px;
}

.modal-input:focus {
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-actions button {
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

/* The Devices panel carries a credential flow; its buttons get the same padding as the modal's own
   action row so "Enrol this device" reads as a button, not a coloured rule. Scoped on purpose: the
   other settings panels are left exactly as they were. */
#settings-devices button {
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 6px;
}

.modal-btn-secondary {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.modal-btn-secondary:hover {
  background: var(--bg-hover);
}

.modal-btn-primary {
  background: var(--accent);
  border: 1px solid transparent;
  color: #fff;
}

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

.modal-btn-danger {
  background: var(--danger);
  border: 1px solid transparent;
  color: #fff;
}

.modal-btn-danger:hover {
  background: #e5443c;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.modal-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.modal-tag.selected {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

.modal-tag:hover {
  border-color: var(--border-light);
}

/* Settings modal */
.settings-section {
  margin-bottom: 20px;
}

.settings-section h4 {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

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

.settings-row label {
  color: var(--text-primary);
  font-size: 13px;
}

/* ---- Scrollbar ---- */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}

/* ---- Animations ---- */

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

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

.fade-in {
  animation: fadeIn 200ms ease;
}

.slide-up {
  animation: slideUp 200ms ease;
}

/* ---- Toast ---- */

/* THE BACKEND-STALENESS STRIP. Deliberately NOT the toast: showToast() removes whatever toast is on
   screen, so the one warning that must not be missed would be erased by the next routine message —
   and it is shown once per page, so it would never come back. Reported by review. Dev checkout only;
   this element is created and appended only when the server says its code has moved. */
.backend-drift {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;                 /* above the toast slot, below the panic cover */
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--warning);
  color: #1a1200;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
  /* ⛔ IT MUST NEVER BE A DRAG TARGET. This is a fixed strip across the top of the app, and the whole
     app accepts drops — a warning bar that swallows a drop, or a click on the toolbar beneath it,
     would break the thing it is trying to help you fix. Only the Dismiss button takes pointer events. */
  pointer-events: none;
}
.backend-drift__body { flex: 1; min-width: 0; }
.backend-drift__close {
  pointer-events: auto;
  border: 0;
  background: rgba(0, 0, 0, .18);
  color: inherit;
  border-radius: var(--radius);
  padding: 3px 10px;
  cursor: pointer;
  font: inherit;
}

/* THE BACKGROUND-TASK STRIP. Same reasoning as .backend-drift above, for the same reason: showToast()
   removes whatever toast is on screen, so a long-running background job would have its only indicator
   erased by the next routine message. This one is for work the owner AUTHORISED and then walked away
   from — today that is a scheduled "Delete originals", which now finishes in a maintenance pass rather
   than freezing the panel for a forced catalog publish per file.

   ⛔ IT MUST NEVER SWALLOW A DROP. The whole app is a drop target and this is a fixed strip across the
   bottom; pointer-events stay off except on the button, exactly as the top strip learned to do. */
.bg-task {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;                 /* above the toast slot, below the privacy cover */
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 12px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.bg-task__body { flex: 1; min-width: 0; }
.bg-task__spinner {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: bgTaskSpin 800ms linear infinite;
}
@keyframes bgTaskSpin { to { transform: rotate(360deg); } }
.bg-task__action {
  pointer-events: auto;
  border: 0;
  background: var(--bg-secondary);
  color: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 10px;
  cursor: pointer;
  font: inherit;
}
.bg-task__action:hover { background: var(--bg-primary); }

/* ── THE AUTO-LOCK COOLDOWN INDICATOR ─────────────────────────────────────────────────────────────
   ⛔ ITS OWN ELEMENT, NOT A THIRD CLAIMANT ON `.bg-task`. That strip has exactly one slot and two
   claimants already, with a documented priority — an import in progress owns it, a scheduled original
   re-asserts when the import clears. A cooldown folded into that queue would be HIDDEN for the whole
   of any import, and "visible the entire time it is in effect" is not decoration here: with `infinite`
   selected it is the only thing between a remembered setting and a vault that silently never
   auto-locks again. So it sits ABOVE the strip and shares its shape, never its slot.
   Same pointer-events rule: the whole app is a drop target. */
.autolock-pause {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 901;                 /* above .bg-task, still below the privacy cover */
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--warning);
  color: var(--text-primary);
  font-size: 12px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.autolock-pause__body { flex: 1; min-width: 0; }
.autolock-pause__dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--warning);
}
.autolock-pause__action {
  pointer-events: auto;
  background: var(--bg-secondary);
  color: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 10px;
  cursor: pointer;
  font: inherit;
}
.autolock-pause__action:hover { background: var(--bg-primary); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 13px;
  z-index: 800;
  opacity: 0;
  transition: opacity 300ms ease, transform 300ms ease;
  pointer-events: none;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Utility ---- */

.hidden {
  display: none !important;
}

/* ---- Privacy Covers (focus auto-cover + panic) ---- */

.privacy-cover {
  position: fixed;
  inset: 0;
  z-index: 2147483000; /* above lightbox, modal, toast, context menu, drop overlay */
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
}

/* Focus auto-cover: solid, calm, no controls */
#focus-cover {
  background: var(--bg-primary);
}

.privacy-cover-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.privacy-cover-brand svg {
  color: var(--accent);
}

/* Panic cover: fully opaque with a dismiss prompt */
#panic-cover.panic {
  background: var(--bg-primary);
}

.panic-box {
  width: 320px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panic-box form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panic-box input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.panic-box input:focus {
  border-color: var(--accent);
}

.panic-countdown {
  font-size: 12px;
  color: var(--text-muted);
  min-height: 16px;
}

.panic-hint {
  font-size: 13px;
  color: var(--text-secondary);
}

.privacy-cover.cover-drag {
  outline: 3px dashed var(--accent);
  outline-offset: -12px;
}

.privacy-cover.cover-drag .panic-hint {
  color: var(--accent);
}

.panic-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* --- Download Inbox --- */
.inbox-banner {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 1;
}
.inbox-target {
  font-size: 13px;
  color: var(--text-secondary);
}
.inbox-target strong {
  color: var(--accent);
}
.inbox-keys {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.inbox-suggest {
  font-size: 11px;
  color: var(--accent);
  margin-top: 3px;
}

/* --- Breadcrumb + history nav buttons --- */
.nav-btn {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  margin-right: 4px;
  transition: all var(--transition);
}
.nav-btn:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-color: var(--border-light);
}
.nav-btn:disabled { opacity: 0.35; cursor: default; }
.breadcrumb { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px; min-width: 0; }
.breadcrumb-seg { white-space: nowrap; }
.breadcrumb-link { color: var(--text-secondary); cursor: pointer; }
.breadcrumb-link:hover { color: var(--accent); text-decoration: underline; }
.breadcrumb-sep { color: var(--text-muted); margin: 0 2px; }

/* --- Multi-select + move picker --- */
.file-item.marked, .grid-tile.marked {
  box-shadow: inset 0 0 0 2px var(--accent);
  background: var(--accent-dim);
}
.file-item.marked::after {
  content: '✓';
  margin-left: auto;
  color: var(--accent);
  font-weight: 700;
  padding-left: 8px;
}
.grid-tile.marked { position: relative; }
.grid-tile.marked::after {
  content: '✓';
  position: absolute;
  top: 4px; right: 6px;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
#move-target-chip { color: var(--accent); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-list { max-height: 300px; overflow-y: auto; margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.fp-row { cursor: pointer; }
.fp-row.active { background: var(--accent-dim); color: var(--text-primary); }
.fp-create { color: var(--accent); }
.toast-action {
  margin-left: 14px;
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent-hover);
  border-radius: var(--radius);
  padding: 2px 10px;
  cursor: pointer;
  font-weight: 600;
}
.toast-action:hover { background: var(--accent-dim); }

/* --- Settings modal: tabbed sections (added 2026-07-19) ---
 * The strip and the Close row sit OUTSIDE the scroller, so only the active panel ever scrolls and
 * the section names stay on screen. Capping the scroller (not .modal) keeps the whole dialog inside
 * the viewport without touching the recovered .modal rule. */
.settings-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.settings-tab {
  padding: 7px 14px;
  background: none;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  margin-bottom: -1px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition);
}

.settings-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.settings-tab[aria-selected="true"] {
  background: var(--bg-tertiary);
  border-color: var(--border);
  border-bottom-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.settings-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.settings-panels {
  max-height: min(58vh, 460px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.settings-panel[hidden] {
  display: none;
}

.settings-panel > .settings-section:last-child {
  margin-bottom: 4px;
}

.settings-panels + .modal-actions {
  margin-top: 14px;
}

/* Cloud status tiles + meters (markup lives in showSettings → loadCloudStatus; these rules are part
 * of the ~110 late lines missing from the recovered stylesheet). Tiles carry magnitudes, meters
 * carry ratios — severity is always paired with its caption, never colour alone. */
.meter-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}

.stat-tile {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  min-width: 0;
}

.stat-tile__label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-tile__dot {
  font-size: 9px;
  vertical-align: 1px;
}

.stat-tile__value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.stat-tile__sub {
  font-size: 10px;
  color: var(--text-muted);
}

.meter {
  margin-bottom: 10px;
}

.meter__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.meter__name {
  color: var(--text-secondary);
}

.meter__value {
  color: var(--text-primary);
  font-weight: 600;
}

.meter__track {
  height: 6px;
  margin: 4px 0 4px;
  border-radius: 3px;
  background: var(--accent-dim);
  overflow: hidden;
}

.meter__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width var(--transition);
}

.meter--warning .meter__track { background: var(--warning-dim); }
.meter--warning .meter__fill { background: var(--warning); }
.meter--danger .meter__track { background: var(--danger-dim); }
.meter--danger .meter__fill { background: var(--danger); }

.meter__caption {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------------
   Import durability barrier — "N files not yet protected".
   Appended 2026-07-19. Everything above this line is the owner's original
   design, recovered byte-exact; nothing there is restyled or reordered.
   The banner borrows the existing warning hue and the
   meter/tile radius so it reads as part of the Cloud panel, not a bolt-on.
--------------------------------------------------------------------------- */
.durability-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.durability-banner--at-risk {
  border-color: var(--warning);
  background: var(--warning-dim);
  color: var(--text-primary);
}
.durability-banner__icon {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1.2;
}
.durability-banner--at-risk .durability-banner__icon { color: var(--warning); }
.durability-banner__body { min-width: 0; }
.durability-banner__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.durability-banner__detail { color: var(--text-secondary); }
.durability-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================================================
   MISSING BYTES — rows whose index entry survived but whose data exists nowhere.
   Derived server-side (lib/durability.js); see routes/files.js. Appended block:
   nothing above this line is modified.
   ========================================================================== */
.missing-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--danger-dim);
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.missing-badge-lg {
  width: 44px;
  height: 44px;
  font-size: 26px;
}
.file-item.missing-bytes .file-name,
.grid-tile.missing-bytes .grid-label {
  color: var(--danger);
}
.file-item.missing-bytes .file-type-badge {
  background: var(--danger-dim);
  color: var(--danger);
}
.grid-tile.missing-bytes .grid-thumb {
  border: 1px solid var(--danger);
}
.missing-meta {
  color: var(--danger);
}

.missing-group {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.missing-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: none;
  border-left: 3px solid var(--danger);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.missing-group-header:hover {
  background: var(--bg-hover);
}
.missing-group-caret {
  width: 10px;
  color: var(--text-muted);
}
.missing-group-title {
  color: var(--danger);
}
.missing-group-body.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  padding: 8px;
  align-content: start;
}

.viewer-missing .missing-icon {
  margin-bottom: 12px;
}
.missing-title {
  color: var(--danger);
  font-weight: 600;
}
.missing-record {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin: 14px auto;
  max-width: 420px;
  text-align: left;
  font-size: 13px;
}
.missing-record dt {
  color: var(--text-muted);
}
.missing-record dd {
  color: var(--text-primary);
  margin: 0;
  word-break: break-all;
}
.missing-keep {
  font-size: 12px;
}

/* ---- Near-duplicate compare (advisory) ----
   Above the settings modal (1000) it is opened from, below the privacy covers, which outrank
   everything. Sits between the lightbox (900) and the covers deliberately: a raised cover must still
   hide two files side by side. */
.compare-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(13, 17, 23, 0.98);
  display: flex;
  flex-direction: column;
}
.compare-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.compare-headline {
  font-size: 12px;
  color: var(--text-secondary);
}
.compare-panes {
  flex: 1;
  display: flex;
  gap: 10px;
  padding: 10px;
  min-height: 0; /* let the panes shrink instead of pushing the hint off-screen */
}
.compare-pane {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}
.compare-pane.active {
  border-color: var(--accent);
}
.compare-media {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-elevated);
  border-radius: 4px;
}
.cmp-img, .cmp-video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.compare-nopreview {
  color: var(--text-muted);
  font-size: 12px;
}
.compare-name {
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compare-facts {
  font-size: 11px;
  color: var(--text-muted);
}
.compare-weak {
  font-size: 11px;
  color: var(--warning);
}
.compare-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.compare-pos {
  font-size: 11px;
  color: var(--text-muted);
}
.compare-confirm-q {
  font-size: 12px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}
.compare-hint {
  padding: 6px 12px 10px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Media wall ──────────────────────────────────────────────────────────────────────────────────
   A full-viewport mode that fills the screen with as many images and videos as fit, each cell
   turning over on its own schedule.

   ⚠️ z-index 9000, and that ceiling is load-bearing. `.privacy-cover` sits at 2147483000 so the
   panic key and the focus-loss cover paint OVER the wall; a full-screen mode the covers could not
   reach would be a privacy regression rather than a cosmetic one. Nothing here may be raised into
   that range, and the wall must never be the element passed to requestFullscreen() — an element in
   the browser's top layer is above every z-index there is, covers included. */
.media-wall {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #000;
  overflow: hidden;
}
.media-wall[hidden] { display: none; }

.media-wall__grid { position: absolute; inset: 0; }

/* Cells are absolutely positioned from the geometry public/js/wall-layout.js computes. They tile the
   viewport exactly, so there is no gap, no gutter and nothing to collapse. */
.media-wall__cell {
  position: absolute;
  overflow: hidden;
  background: #0a0a0a;
  contain: strict;              /* a cell repainting must not invalidate the whole wall */
}
.media-wall__cell > img,
.media-wall__cell > video {
  width: 100%;
  height: 100%;
  object-fit: cover;            /* the layout already bounded the crop — see MAX_CROP */
  display: block;
}
/* The thumbnail sits under the real media as an instant poster: the first ~256 KB of every file is
   pinned locally, but a cold cell can still stall later, and a black rectangle reads as broken. */
.media-wall__cell > .media-wall__poster {
  position: absolute;
  inset: 0;
  filter: blur(8px);
  transform: scale(1.06);       /* hide the blur's soft edge */
  opacity: 1;
  transition: opacity 220ms ease;
}
.media-wall__cell.is-ready > .media-wall__poster { opacity: 0; }

.media-wall__bar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20, 20, 22, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0.25;
  transition: opacity 160ms ease;
}
.media-wall__bar:hover,
.media-wall__bar:focus-within { opacity: 1; }

.media-wall__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  color: #eee;
  font: inherit;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.media-wall__btn:hover { background: rgba(255, 255, 255, 0.12); }
.media-wall__btn[aria-pressed="true"] { color: #7fd1ff; }

.media-wall__btn--icon { padding: 4px 6px; }

/* The speaker is always in the bar; the slider unrolls beside it on hover or keyboard focus, the way
   a media player's does. WIDTH rather than display, so it animates and so the rest of the bar does
   not jump sideways when it appears. pointer-events is what keeps the collapsed slider from
   swallowing clicks aimed at the speaker behind it. */
.media-wall__audio { display: inline-flex; align-items: center; gap: 6px; }
.media-wall__volume {
  width: 0;
  opacity: 0;
  margin: 0;
  pointer-events: none;
  accent-color: #7fd1ff;
  transition: width 140ms ease, opacity 140ms ease;
}
.media-wall__audio:hover .media-wall__volume,
.media-wall__audio:focus-within .media-wall__volume {
  width: 96px;
  opacity: 1;
  pointer-events: auto;
}

/* A button, so it must shed the platform button chrome; it is still the density readout. */
.media-wall__count {
  background: transparent;
  border: 0;
  color: #9aa;
  font: inherit;
  font-size: 12px;
  min-width: 12ch;
  text-align: right;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.media-wall__count:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); color: #eee; }
.media-wall__count:disabled { cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .media-wall__cell.is-ready > .media-wall__poster { transition: none; }
  .media-wall__volume { transition: none; }
}
