/* ============================================
   PXST Design System — Darkroom Lightbox Theme
   ============================================ */

:root {
  /* Colors — darkroom palette */
  --color-bg: #0A0A0A;
  --color-surface: #111111;
  --color-text: #D4D4D4;
  --color-text-secondary: #8A8A8A;
  --color-text-muted: #555555;
  --color-border: #1E1E1E;
  --color-accent: #D4A853;
  --color-accent-hover: #E8C373;
  --color-safelight-dim: rgba(212, 168, 83, 0.08);

  /* Viewer */
  --viewer-backdrop: rgba(0, 0, 0, 0.95);
  --viewer-panel: #0D0D0D;
  --viewer-text: #C8C8C8;
  --viewer-text-muted: #5A5A5A;
  --viewer-border: #1A1A1A;

  /* Typography */
  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  /* Shadows — minimal, no glow */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-glow: none;
  --shadow-glow-hover: 0 2px 8px rgba(0, 0, 0, 0.6);

  /* Radii — sharper, technical */
  --radius-sm: 4px;
  --radius-md: 4px;
  --radius-lg: 8px;

  /* Layout */
  --max-width: 1400px;
  --header-height: 56px;
}

/* ============================================
   Reset & Base
   ============================================ */

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

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

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

main {
  flex-grow: 1;
}

/* ============================================
   Header
   ============================================ */

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-accent);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

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

header nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.25rem;
}

header nav a {
  color: var(--color-text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background-color 0.15s;
  display: inline-block;
}

header nav a:hover {
  color: var(--color-text);
  background-color: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}

header nav a.active {
  color: var(--color-accent);
  background-color: rgba(212, 168, 83, 0.15);
}

/* Keyboard shortcut hint letters */
header nav a .sk, .filter-toggle-btn .sk, .admin-toggle-btn .sk { text-decoration: none; }
header nav a.shortcut-hint .sk {
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--color-accent);
}
.filter-toggle-btn.shortcut-hint .sk {
  text-decoration: underline;
  text-underline-offset: 2px;
}
/* When filter button is active (gold bg), hint letter stays readable */
.filter-toggle-btn.filter-toggle-active.shortcut-hint .sk {
  color: var(--color-bg);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-trigger {
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s;
  display: flex;
  align-items: center;
}

.search-trigger:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.search-trigger svg {
  fill: var(--color-text-secondary);
  width: 20px;
  height: 20px;
  transition: fill 0.15s;
}

.search-trigger:hover svg {
  fill: var(--color-text);
}

/* ============================================
   Container & Page Header
   ============================================ */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

#page-header {
  padding: 1.5rem 0 0.75rem;
}

#page-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
}

#page-header p {
  margin: 0.25rem 0 0;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

/* Album detail header — title left, stats right, single row */
#page-header.album-detail-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
#page-header.album-detail-header h2 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.album-detail-stats {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
}
.album-detail-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  white-space: nowrap;
}
.album-detail-stat-val {
  color: var(--color-text);
  font-weight: 700;
}

#page-header.event-header-with-emoji {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: 0.25rem;
}
#page-header.event-header-with-emoji h2,
#page-header.event-header-with-emoji p {
  flex: 1 1 auto;
}
.event-header-emoji {
  font-size: 3rem;
  line-height: 1;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.9;
}

/* ============================================
   Media Grid
   ============================================ */

#content-area {
  padding-bottom: 3rem;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.media-item {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background-color: var(--color-border);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07);
  transition: opacity 0.2s, box-shadow 0.15s;
  opacity: 0.88;
}

.media-item:hover {
  opacity: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Loading shimmer animation for media items before image loads */
.media-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    var(--color-border) 0%,
    rgba(212, 168, 83, 0.06) 40%,
    var(--color-border) 60%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  z-index: 0;
}

/* Loading icon in center of media item */
.media-item::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid var(--color-text-muted);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 1;
  opacity: 0.5;
}

/* Hide shimmer and spinner once image loads */
.media-item.loaded::before,
.media-item.loaded::after {
  display: none;
}

/* Failed state — show camera icon */
.media-item.load-failed::after {
  display: block !important;
  animation: none;
  border: none;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23555'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: 0.6;
}

.media-item.load-failed::before {
  display: block !important;
  animation: none;
  background: var(--color-border);
}

/* Thumbnail pending state — px.st logo + text */
.media-item.thumb-pending::before {
  display: block !important;
  animation: pending-pulse 4s ease-in-out infinite;
  background: var(--color-surface);
}

.media-item.thumb-pending::after {
  display: block !important;
  animation: none;
  border: none;
  width: 40px;
  height: 40px;
  margin: -28px 0 0 -20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='6' fill='%230A0A0A'/%3E%3Crect x='1' y='1' width='30' height='30' rx='5' fill='none' stroke='%23D4A853' stroke-width='1' opacity='0.3'/%3E%3Cg fill='%23D4A853'%3E%3Crect x='6' y='10' width='3' height='14'/%3E%3Crect x='9' y='10' width='6' height='3'/%3E%3Crect x='9' y='16' width='6' height='3'/%3E%3Crect x='15' y='13' width='3' height='3'/%3E%3Crect x='20' y='10' width='3' height='3'/%3E%3Crect x='25' y='10' width='3' height='3'/%3E%3Crect x='22.5' y='13' width='3' height='3'/%3E%3Crect x='20' y='16' width='3' height='3'/%3E%3Crect x='25' y='16' width='3' height='3'/%3E%3C/g%3E%3Ccircle cx='22' cy='25' r='1.5' fill='%23D4A853' opacity='0.6'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: 0.8;
}

.media-item.thumb-pending .thumb-pending-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 16px);
  font-size: 0.55rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  opacity: 0.5;
  white-space: nowrap;
  z-index: 2;
  pointer-events: none;
}

/* Home mosaic pending state */
.home-mosaic-item.thumb-pending {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Generic thumb-pending for any container (album covers, comment thumbs, etc.) */
.thumb-pending {
  position: relative;
  background: var(--color-surface);
  animation: pending-pulse 4s ease-in-out infinite;
}
.thumb-pending .thumb-pending-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  opacity: 0.5;
}
.thumb-pending .thumb-pending-inner img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.thumb-pending .thumb-pending-inner span {
  font-size: 0.45rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* Override for mosaic items (larger containers get bigger icon) */
.home-mosaic-item.thumb-pending .thumb-pending-inner { opacity: 0.6; gap: 0.5rem; }
.home-mosaic-item.thumb-pending .thumb-pending-inner img { width: 40px; height: 40px; }
.home-mosaic-item.thumb-pending .thumb-pending-inner span { font-size: 0.55rem; letter-spacing: 0.1em; }

/* Override for hero/trending areas (large containers) */
.home-trending.thumb-pending .thumb-pending-inner img,
.popular-hero.thumb-pending .thumb-pending-inner img { width: 48px; height: 48px; }
.home-trending.thumb-pending .thumb-pending-inner span,
.popular-hero.thumb-pending .thumb-pending-inner span { font-size: 0.55rem; }

/* Offset placeholder upward in album cards to account for the info bar overlay */
.album-card-cover.thumb-pending .thumb-pending-inner {
  padding-bottom: 2.25rem;
}

/* Very small containers — icon only, hide text */
.home-comment-card-thumb.thumb-pending .thumb-pending-inner span,
.home-recent-like-thumb.thumb-pending .thumb-pending-inner span,
.home-album-card-cover.thumb-pending .thumb-pending-inner span,
.album-card-cover.thumb-pending .thumb-pending-inner span,
.comment-card-thumb.thumb-pending .thumb-pending-inner span,
.profile-comment-thumb.thumb-pending .thumb-pending-inner span { display: none; }
.home-comment-card-thumb.thumb-pending .thumb-pending-inner img,
.home-recent-like-thumb.thumb-pending .thumb-pending-inner img,
.profile-comment-thumb.thumb-pending .thumb-pending-inner img { width: 20px; height: 20px; }

@keyframes pending-pulse {
  0%, 100% { background-color: var(--color-surface); }
  50% { background-color: color-mix(in srgb, var(--color-surface) 88%, var(--color-accent)); }
}

/* Viewer (detail) pending state — matches grid pending style */
.viewer-thumb-pending {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  height: 100%;
  min-height: 40vh;
  background: var(--color-surface);
  animation: pending-pulse 4s ease-in-out infinite;
  border-radius: 6px;
}
.viewer-thumb-pending img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  opacity: 0.7;
}
.viewer-thumb-pending span {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  opacity: 0.6;
}

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

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

/* Video play icon overlay */
.media-item .play-icon {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.media-item .play-icon svg {
  width: 14px;
  height: 14px;
  fill: #fff;
  margin-left: 2px;
}

/* Comment count badge overlay */
.media-item .comment-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 100px;
  pointer-events: none;
  line-height: 1;
}

.media-item .comment-badge svg {
  width: 12px;
  height: 12px;
  fill: #fff;
  opacity: 0.9;
  flex-shrink: 0;
}

.media-item .comment-badge span {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
}

/* Restricted overlay badge on thumbnails and album covers */
.media-item .restricted-overlay,
.album-card-cover .restricted-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6px;
  border: 2px solid rgba(200, 50, 50, 0.7);
  box-shadow: inset 0 0 12px rgba(200, 50, 50, 0.35);
  color: rgba(255, 255, 255, 0.95);
  pointer-events: none;
  z-index: 2;
  border-radius: inherit;
}

.media-item .restricted-overlay svg,
.album-card-cover .restricted-overlay svg {
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}

/* Restricted lock in search results */
.search-result-restricted {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  color: #e55;
  vertical-align: middle;
}

/* ============================================
   Album Cards
   ============================================ */

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.album-card {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
}

.album-card:hover {
  border-color: var(--color-border);
}

.album-card-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background-color: var(--color-border);
  overflow: hidden;
}

.album-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
  transition: opacity 0.2s;
}

.album-card:hover .album-card-cover img {
  opacity: 1;
}

.album-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1;
}

.album-card-title {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.album-card-meta {
  margin: 0.125rem 0 0;
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================
   Tag Pills
   ============================================ */

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.tag-pill:hover {
  border-color: var(--color-accent);
  background-color: rgba(212, 168, 83, 0.1);
  box-shadow: var(--shadow-sm);
}

.tag-pill .tag-count {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-muted);
  background: var(--color-bg);
  padding: 0.125rem 0.5rem;
  border-radius: 100px;
}

/* ============================================
   Viewer Overlay
   ============================================ */

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s, visibility 0.2s;
}

.overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Media Viewer */
#media-viewer-overlay {
  background-color: var(--viewer-backdrop);
  display: flex;
}

#media-viewer-overlay .viewer-media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  position: relative;
  padding: 1rem;
}

#media-viewer-overlay .viewer-media img,
#media-viewer-overlay .viewer-media video {
  max-width: 100%;
  max-height: 100vh;
  object-fit: contain;
}
#media-viewer-overlay .viewer-media img {
  opacity: 0;
  transition: opacity 0.15s ease;
}
#media-viewer-overlay .viewer-media img.loaded {
  opacity: 1;
}
@media (min-width: 1024px) {
  #media-viewer-overlay .viewer-media img.zoomable {
    cursor: zoom-in;
  }
  #media-viewer-overlay .viewer-media img.zoomed {
    cursor: grab;
  }
  #media-viewer-overlay .viewer-media.zoom-active {
    overflow: hidden;
  }
  #media-viewer-overlay .viewer-media img.zoom-animating {
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }
}
#media-viewer-overlay .viewer-media video {
  width: 100%;
  height: 100%;
}

.video-processing-placeholder {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.video-processing-placeholder img {
  max-width: 100%;
  max-height: 100vh;
  object-fit: contain;
  filter: brightness(0.4);
}
.video-processing-overlay {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.video-processing-overlay svg {
  stroke: var(--color-accent);
  animation: processingPulse 2s ease-in-out infinite;
}
@keyframes processingPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

.viewer-sidebar {
  width: 380px;
  background-color: var(--viewer-panel);
  color: var(--viewer-text);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--viewer-border);
}

.viewer-sidebar-header {
  padding: 1.25rem 2.5rem 0 1.25rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.viewer-album-breadcrumb {
  width: 100%;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: -0.15rem;
  padding-left: 0.15rem;
}
.viewer-album-breadcrumb a {
  color: var(--color-accent);
  text-decoration: none;
}
.viewer-album-breadcrumb a:hover {
  text-decoration: underline;
}

.viewer-album-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.viewer-album-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-accent);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.15s;
}
.viewer-album-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

/* Description placeholder for empty state */
.viewer-description[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: var(--color-text-secondary);
  font-style: italic;
  opacity: 0.6;
}

/* Uploader byline (inline after title) */
.viewer-uploader-byline {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  width: 100%;
  padding-left: 0.15rem;
  margin-top: 0.1rem;
}
.viewer-uploader-byline a {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}
.viewer-uploader-byline a:hover {
  color: var(--color-accent);
}

.viewer-sidebar-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #fff;
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

.viewer-sidebar-header .close-viewer {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
}

.viewer-sidebar-header .close-viewer:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Sidebar toggle button (desktop only) */
.viewer-sidebar-toggle {
  position: absolute;
  top: 12px;
  right: 392px;
  z-index: 20;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s, right 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.15s;
  opacity: 0.5;
}
.viewer-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  opacity: 1;
}

/* Sidebar collapse/expand animation */
.viewer-sidebar {
  transition: margin-right 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
#media-viewer-overlay.sidebar-collapsed .viewer-sidebar {
  margin-right: -380px;
  overflow: hidden;
}
#media-viewer-overlay.sidebar-collapsed .viewer-sidebar-toggle {
  right: 56px;
  opacity: 0.7;
}

/* Copy Link Button */
.copy-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.375rem;
  cursor: pointer;
  color: var(--viewer-text-muted);
  transition: color 0.15s, background-color 0.15s;
  margin-left: 0.5rem;
  vertical-align: middle;
  flex-shrink: 0;
}

.copy-link-btn:hover {
  color: var(--color-accent);
  background: rgba(212, 168, 83, 0.15);
}

.copy-link-btn.copied {
  color: var(--color-accent);
  background: rgba(212, 168, 83, 0.15);
}

/* Star/Like button (left of title) */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  padding: 0.2rem;
  cursor: pointer;
  color: var(--viewer-text-muted);
  transition: color 0.15s, transform 0.15s;
  flex-shrink: 0;
  font-size: 0.75rem;
}
.like-btn:hover {
  color: var(--color-accent);
}
.like-btn.liked {
  color: #ED4956;
}
.like-heart {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: fill 0.2s, stroke 0.2s, transform 0.2s;
}
.like-btn.liked .like-heart {
  fill: #ED4956;
  stroke: #ED4956;
  animation: heartPop 0.3s ease;
}
.like-count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
@keyframes heartPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Viewers list */
.viewers-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
}

.viewers-list a.viewer-nav-link {
  display: inline-flex;
  text-decoration: none;
}

.viewer-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  transition: opacity 0.15s;
}

.viewer-avatar:hover { opacity: 0.8; }

.viewer-avatar-initials {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.25);
  color: var(--viewer-text);
  font-size: 0.5625rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}

.viewer-avatar-initials:hover { opacity: 0.8; }

/* Viewer Tags */
.viewer-tags {
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.viewer-tag {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  font-size: 0.75rem;
  color: var(--viewer-text);
  cursor: pointer;
  transition: background-color 0.15s;
}

.viewer-tag:hover {
  background: rgba(255, 255, 255, 0.15);
  text-decoration: none;
}

/* Viewer Metadata */
.viewer-metadata {
  padding: 0 1.25rem;
  flex-shrink: 0;
}

.viewer-metadata-section {
  border-top: 1px solid var(--viewer-border);
  padding: 0.875rem 0;
}

.viewer-metadata-section:first-child {
  border-top: none;
}

.viewer-metadata-section h3 {
  margin: 0 0 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  opacity: 0.85;
}

.metadata-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.625rem;
}

.metadata-section-header h3 {
  margin: 0;
}

.camera-logo {
  height: 1.25rem;
  width: auto;
  max-width: 4rem;
  object-fit: contain;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.camera-logo:hover {
  opacity: 0.8;
}


/* Download section in viewer sidebar */
.viewer-downloads {
  border-top: 1px solid var(--viewer-border);
  padding: 0.875rem 0;
}
.viewer-downloads h3 {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  opacity: 0.85;
}
.dl-list {
  display: flex;
  flex-direction: column;
}
.dl-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.12s;
}
.dl-row:last-child {
  border-bottom: none;
}
.dl-row:hover {
  background: var(--color-safelight-dim);
}
.dl-row:hover .dl-main,
.dl-row:hover .dl-label {
  color: var(--color-accent);
}
.dl-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.4rem;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  min-width: 0;
  cursor: pointer;
  transition: color 0.12s;
  user-select: none;
}
.dl-btn-download {
  cursor: pointer;
}
.dl-label {
  white-space: nowrap;
}
.dl-badge {
  display: inline-block;
  padding: 0.05rem 0.3rem;
  border-radius: 2px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--color-border);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
/* Transcode method badge colors (green = fast/HW, orange = slow/SW) */
.dl-badge.tc-hw         { background: rgba(76,175,80,0.06); border-color: rgba(76,175,80,0.18); color: #7ab87c; }
.dl-badge.tc-hwswdec    { background: rgba(126,187,80,0.05); border-color: rgba(126,187,80,0.16); color: #8fb876; }
.dl-badge.tc-hwprescale { background: rgba(180,180,60,0.05); border-color: rgba(180,180,60,0.15); color: #a3a368; }
.dl-badge.tc-swseq      { background: rgba(220,150,50,0.05); border-color: rgba(220,150,50,0.16); color: #b89a64; }
.dl-badge.tc-sw         { background: rgba(210,120,40,0.06); border-color: rgba(210,120,40,0.18); color: #b48d5c; }
.dl-size {
  margin-left: auto;
  font-size: 0.6rem;
  opacity: 0.5;
  white-space: nowrap;
}
.dl-meta {
  margin-left: auto;
  font-size: 0.6rem;
  opacity: 0.5;
  white-space: nowrap;
  color: var(--color-text-muted);
}
.tc-batch-summary {
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-left: 0.5rem;
  text-transform: none;
}
.dl-actions {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}
.dl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color 0.12s, background 0.12s;
}
.dl-btn:hover {
  color: var(--color-accent);
  background: rgba(212, 168, 83, 0.1);
}

/* Admin section */
.viewer-admin {
  border-top: 1px solid var(--viewer-border);
  padding: 0.875rem 0;
}
.viewer-admin h3 {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  opacity: 0.85;
}
.admin-feature-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 0.375rem;
}
.rotation-controls {
  display: flex;
  gap: 0.5rem;
}
.rotation-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.375rem 0.5rem;
  background: transparent;
  border: 1px solid var(--viewer-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.rotation-btn:hover:not(:disabled) {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: rgba(212, 168, 83, 0.08);
}
.rotation-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.rotation-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-text-muted);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.admin-highlight-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}
.admin-highlight-thumb {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--viewer-border);
  flex-shrink: 0;
}
.admin-highlight-album-title {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-highlight-btn {
  flex: none;
  white-space: nowrap;
}
.admin-highlight-btn.is-current {
  color: var(--color-accent);
  border-color: var(--color-accent);
  opacity: 0.7;
  cursor: default;
}

.metadata-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3125rem 0.875rem;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.metadata-grid dt {
  color: var(--viewer-text-muted);
  white-space: nowrap;
  font-weight: 500;
  font-size: 0.75rem;
}

.metadata-grid dd {
  margin: 0;
  color: var(--viewer-text);
  word-break: break-word;
}

.metadata-grid dd.mono-value {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.6;
  color: #d1d5db;
}

.meta-link {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.15s;
}
.meta-link:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

.meta-empty {
  font-size: 0.8125rem;
  color: var(--viewer-text-muted);
}

/* Hash list (stacked layout) */
.hash-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hash-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.hash-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--viewer-text-muted);
}

.hash-value {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  line-height: 1.5;
  color: #d1d5db;
  word-break: break-all;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  user-select: all;
  cursor: text;
}
.hash-copyable {
  cursor: pointer;
  position: relative;
  display: block;
  padding: 0.125rem 0.25rem;
  margin: -0.125rem -0.25rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.hash-copyable:hover {
  background: rgba(212, 168, 83, 0.08);
  border-color: rgba(212, 168, 83, 0.2);
}
.hash-copied {
  color: var(--color-accent) !important;
}
.hash-copied::after {
  content: 'Copied!';
  position: absolute;
  top: -1.6rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-accent);
  color: var(--color-bg);
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  animation: copied-fade 1.5s ease forwards;
}
@keyframes copied-fade {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

/* Location Map */
.location-map-container {
  position: relative;
  margin-top: 0.75rem;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--viewer-border);
}

.location-map {
  width: 100%;
  height: 200px;
  border: none;
  display: block;
  filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9);
}

.location-map-link {
  display: block;
  text-align: center;
  padding: 0.375rem 0;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.15s;
  background: var(--color-surface);
}

.location-map-link:hover {
  color: var(--color-accent);
}

/* Video Badges */
.video-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.video-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}

.badge-8k {
  background: var(--color-accent);
  color: #0A0A0A;
}

.badge-4k {
  background: var(--color-accent);
  color: #0A0A0A;
}

.badge-2k {
  background: rgba(212, 168, 83, 0.25);
  color: var(--color-accent);
  border: 1px solid rgba(212, 168, 83, 0.4);
}

.badge-fhd {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge-hd {
  background: rgba(255, 255, 255, 0.08);
  color: var(--viewer-text);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.badge-sd {
  background: rgba(255, 255, 255, 0.05);
  color: var(--viewer-text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-hdr {
  background: rgba(123, 47, 190, 0.25);
  color: #b388ff;
  border: 1px solid rgba(123, 47, 190, 0.4);
}

.badge-dolby-vision {
  background: rgba(26, 26, 46, 0.6);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.badge-apple-spatial {
  background: rgba(0, 122, 255, 0.2);
  color: #5ac8fa;
  border: 1px solid rgba(0, 122, 255, 0.35);
  font-weight: 600;
}

.badge-60fps,
.badge-hfr {
  background: rgba(76, 175, 80, 0.2);
  color: #81C784;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.badge-codec {
  background: rgba(255, 255, 255, 0.06);
  color: var(--viewer-text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* QR Code */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.qr-code {
  width: 160px;
  height: 160px;
  image-rendering: pixelated;
  border-radius: 4px;
}

.qr-label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--viewer-text-muted);
}

/* Viewer Comments */
.viewer-comments {
  flex-shrink: 0;
  padding: 0 1.25rem 1.25rem;
}

.viewer-comments h3 {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--viewer-text-muted);
  padding-top: 0.875rem;
  border-top: 1px solid var(--viewer-border);
}

#comment-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#comment-list li {
  padding: 0.35rem 0;
  font-size: 0.8125rem;
  color: var(--viewer-text);
  border-bottom: none;
}
#comment-list li.comment-item {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}
.comment-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--color-surface);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-top: 0.15rem;
}
.comment-content {
  flex: 1;
  min-width: 0;
}
.comment-bubble {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0 0.75rem 0.75rem 0.75rem;
  padding: 0.4rem 0.65rem;
  margin-top: 0.15rem;
  line-height: 1.45;
}

#comment-list li:last-child {
  border-bottom: none;
}

#comment-list li strong {
  color: var(--color-accent);
}

.comment-date {
  display: block;
  font-size: 0.6875rem;
  color: var(--viewer-text-muted);
  margin-top: 0.2rem;
  padding-left: 0.15rem;
}


.comment-form {
  padding: 0.75rem 0 1.25rem;
  border-top: none;
  margin-top: 0.25rem;
}
.comment-form-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.75rem;
  padding: 0.4rem 0.65rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: var(--viewer-text-muted);
}
.comment-form-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}
.comment-form-initials {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.comment-form #comment-input {
  width: 100%;
  min-height: 60px;
  max-height: 200px;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--viewer-border);
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--viewer-text);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-sizing: border-box;
}

.comment-form #comment-input:empty::before {
  content: attr(data-placeholder);
  color: var(--color-text-muted);
  pointer-events: none;
}

.comment-form #comment-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.comment-form #comment-input .inline-mention {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(var(--color-accent-rgb, 255,193,7), 0.12);
  border: 1px solid rgba(var(--color-accent-rgb, 255,193,7), 0.25);
  border-radius: 100px;
  padding: 0.05rem 0.35rem 0.05rem 0.25rem;
  font-size: 0.75rem;
  color: var(--color-accent);
  font-weight: 500;
  line-height: 1.5;
  vertical-align: baseline;
  user-select: all;
  white-space: nowrap;
  margin: 0 1px;
  cursor: default;
  contenteditable: false;
}
.comment-form #comment-input .inline-mention .inline-mention-remove {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0 0.05rem;
  margin-left: 0.1rem;
  transition: color 0.12s;
}
.comment-form #comment-input .inline-mention .inline-mention-remove:hover {
  color: #ff6b6b;
}

.comment-form button {
  padding: 0.5rem 1rem;
  background-color: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s;
}

.comment-form button:hover {
  background-color: var(--color-accent-hover);
}

/* @mention autocomplete dropdown */
/* @mention dropdown */
.mention-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: #16162a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.04);
  z-index: 100;
  margin-bottom: 6px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.mention-dropdown.hidden {
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  font-size: 0.8125rem;
  color: #d0d0d0;
  transition: background 0.1s, color 0.1s;
  border-left: 2px solid transparent;
}
.mention-item:first-child { border-radius: 7px 7px 0 0; }
.mention-item:last-child { border-radius: 0 0 7px 7px; }
.mention-item:only-child { border-radius: 7px; }
.mention-item:hover, .mention-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-left-color: var(--color-accent);
}
.mention-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.mention-avatar-placeholder {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: #999;
  flex-shrink: 0;
}
.mention-name {
  font-weight: 500;
  white-space: nowrap;
}
.mention-email {
  margin-left: auto;
  font-size: 0.7rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* Legacy mention pills (kept for reference, now inline in contenteditable) */
.comment-mention {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  margin: 0 0.15em;
}
.comment-mention:hover {
  text-decoration: underline;
}

/* Viewer Nav Buttons */
.nav-button {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.75rem 1rem;
  z-index: 1001;
  border-radius: var(--radius-md);
  transition: background-color 0.15s;
}

.nav-button:hover {
  background: rgba(0, 0, 0, 0.7);
}

.nav-button.prev {
  left: 16px;
}

.nav-button.next {
  right: 400px;
  transition: right 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
#media-viewer-overlay.sidebar-collapsed .nav-button.next {
  right: 16px;
}

/* ============================================
   Search Overlay
   ============================================ */

#search-overlay {
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.search-panel {
  background: var(--color-surface);
  border: 1px solid rgba(212, 168, 83, 0.2);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(212, 168, 83, 0.1);
  width: 100%;
  max-width: 680px;
  max-height: 65vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-panel-input {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}

.search-panel-input::before {
  content: '>';
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-accent);
  flex-shrink: 0;
}

#search-input {
  flex: 1 1 120px;
  min-width: 120px;
  padding: 0.5rem 0;
  font-size: 1.25rem;
  font-family: var(--font-mono);
  font-weight: 500;
  border: none;
  background: none;
  color: var(--color-text);
  outline: none;
  caret-color: var(--color-accent);
}

#search-input::placeholder {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.search-restrict-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(212, 168, 83, 0.12);
  border: 1px solid rgba(212, 168, 83, 0.25);
  border-radius: 4px;
  padding: 0.2rem 0.4rem 0.2rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-accent);
  white-space: nowrap;
  flex-shrink: 0;
  animation: searchPillIn 0.12s ease;
}
.search-restrict-pill.hidden { display: none; }
@keyframes searchPillIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.search-restrict-pill-remove {
  background: none; border: none;
  color: rgba(212, 168, 83, 0.4);
  cursor: pointer; font-size: 1rem; line-height: 1;
  padding: 0 0.1rem; transition: color 0.12s;
}
.search-restrict-pill-remove:hover { color: var(--color-accent); }

/* Face search pills — multi-select person names */
.face-pills {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.face-pills.hidden { display: none; }
.face-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(139, 180, 230, 0.12);
  border: 1px solid rgba(139, 180, 230, 0.3);
  border-radius: 100px;
  padding: 0.15rem 0.25rem 0.15rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  animation: searchPillIn 0.12s ease;
}
.face-pill-remove {
  background: none; border: none;
  color: rgba(139, 180, 230, 0.5);
  cursor: pointer; font-size: 0.9rem; line-height: 1;
  padding: 0 0.15rem; transition: color 0.12s;
  border-radius: 50%;
}
.face-pill-remove:hover { color: #e74c3c; }

/* Search guide — shown when input is empty */
.search-guide {
  padding: 1rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: searchGuideIn 0.15s ease;
}
@keyframes searchGuideIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.search-guide-divider {
  height: 1px;
  background: var(--color-border);
  margin: 0.1rem 0;
}
.search-guide-title {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 0.45rem;
  font-family: var(--font-mono);
}
.search-guide-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.search-guide-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem 0.25rem 0.35rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  transition: border-color 0.12s, background 0.12s;
}
.search-guide-item:hover {
  border-color: rgba(212, 168, 83, 0.3);
  background: rgba(212, 168, 83, 0.04);
}
.search-guide-item kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: rgba(212, 168, 83, 0.1);
  border: 1px solid rgba(212, 168, 83, 0.25);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-accent);
}
.search-guide-hint {
  margin-top: 0.35rem;
  font-size: 0.62rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}
.search-guide-hint kbd {
  display: inline;
  padding: 0.05rem 0.3rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--color-text-secondary);
}
.search-guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem 1.5rem;
}
.search-guide-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0;
}
.search-guide-row svg {
  flex-shrink: 0;
  color: var(--color-text-muted);
  opacity: 0.6;
}
.search-guide-row span {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  line-height: 1.35;
}
.search-guide-row kbd {
  display: inline;
  padding: 0.05rem 0.25rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--color-text-secondary);
}
@media (max-width: 500px) {
  .search-guide { padding: 0.75rem 1rem; }
  .search-guide-grid { grid-template-columns: 1fr; }
}

#search-results {
  list-style: none;
  padding: 0.375rem 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

#search-results li {
  padding: 0.625rem 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--color-text);
  transition: background-color 0.08s;
  border-left: 2px solid transparent;
}

#search-results li:hover,
#search-results li.highlighted {
  background-color: rgba(212, 168, 83, 0.08);
  border-left-color: var(--color-accent);
}

#search-results li.highlighted {
  background-color: rgba(212, 168, 83, 0.12);
}

#search-results li img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.search-result-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-accent);
}

.search-result-icon svg {
  width: 24px;
  height: 24px;
}

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

.search-result-title {
  display: block;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-type {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.search-result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.15);
  color: rgb(167, 139, 250);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-sans);
  overflow: hidden;
}
.search-result-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ============================================
   Footer
   ============================================ */

footer {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  margin-top: 2rem;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

footer p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

footer nav {
  display: flex;
  gap: 1.5rem;
}

footer nav a {
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  transition: color 0.15s;
}

footer nav a:hover {
  color: var(--color-text);
}

/* ============================================
   Loading Skeleton
   ============================================ */

.skeleton {
  background: linear-gradient(90deg, var(--color-border) 25%, #2A2A2A 50%, var(--color-border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.skeleton-item {
  aspect-ratio: 1 / 1;
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--color-text-muted);
}

.empty-state p {
  font-size: 1rem;
}

/* Error message */
.error-message {
  text-align: center;
  padding: 2rem 1rem;
  color: #E55353;
}

/* ============================================
   Popular View
   ============================================ */

.popular-layout {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.popular-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 21 / 9;
  overflow: hidden;
  border-radius: 2px;
  cursor: pointer;
}

.popular-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.popular-hero:hover img {
  opacity: 1;
}

.popular-hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 1.5rem;
  background: linear-gradient(transparent 0%, rgba(0, 0, 0, 0.7) 100%);
  pointer-events: none;
}

.popular-hero-overlay h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #fff;
}

.popular-hero-overlay span {
  color: var(--color-accent);
  font-size: 0.875rem;
  font-weight: 500;
}

.popular-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.popular-section-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.popular-section-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

.popular-section-header span {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* View count badge */
.view-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 100px;
  pointer-events: none;
  line-height: 1;
}

.view-badge svg {
  width: 12px;
  height: 12px;
  fill: var(--color-accent);
  opacity: 0.9;
  flex-shrink: 0;
}

.view-badge span {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
}

/* ============================================
   Memories View
   ============================================ */

.memories-layout {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

/* --- Memories Year Navigation --- */
.memories-nav {
  position: sticky;
  top: 54px;
  z-index: 20;
  background: var(--color-bg);
  margin: -0.5rem -0.5rem 0.5rem;
  padding: 0 0.5rem;
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
}
.memories-nav-arrow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3rem;
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.3s ease;
}
.memories-nav-arrow.arrow-right {
  right: 0;
  justify-content: flex-end;
  padding-right: 0.5rem;
  background: linear-gradient(to right, transparent, var(--color-bg) 50%);
}
.memories-nav-arrow.arrow-left {
  left: 0;
  justify-content: flex-start;
  padding-left: 0.5rem;
  background: linear-gradient(to left, transparent, var(--color-bg) 50%);
}
.memories-nav-arrow.hidden { opacity: 0; }
.memories-nav-arrow svg {
  width: 18px;
  height: 18px;
  color: var(--color-text-secondary);
}
.memories-nav-arrow.arrow-right svg {
  animation: memories-arrow-pulse-right 1.5s ease-in-out infinite;
}
.memories-nav-arrow.arrow-left svg {
  animation: memories-arrow-pulse-left 1.5s ease-in-out infinite;
}
@keyframes memories-arrow-pulse-right {
  0%, 100% { transform: translateX(0); opacity: 0.6; }
  50% { transform: translateX(4px); opacity: 1; }
}
@keyframes memories-arrow-pulse-left {
  0%, 100% { transform: translateX(0); opacity: 0.6; }
  50% { transform: translateX(-4px); opacity: 1; }
}
.memories-nav-track {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.75rem 1rem;
}
.memories-nav-track::-webkit-scrollbar { display: none; }
.memories-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 0.5rem 0.875rem;
  border-radius: 10px;
  background: transparent;
  text-decoration: none;
  color: var(--color-text-secondary);
  transition: all 0.2s ease;
  flex-shrink: 0;
  min-width: 64px;
  position: relative;
}
.memories-nav-item:hover {
  background: var(--color-surface);
  color: var(--color-text);
}
.memories-nav-item.active {
  background: var(--color-accent);
  color: #fff;
}
.memories-nav-num {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
.memories-nav-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  line-height: 1;
}
.memories-nav-year {
  font-size: 0.6875rem;
  font-weight: 500;
  opacity: 0.5;
  line-height: 1;
  margin-top: 2px;
}
.memories-nav-count {
  font-size: 0.5625rem;
  opacity: 0.4;
  line-height: 1;
}
.memories-nav-item.active .memories-nav-num,
.memories-nav-item.active .memories-nav-label,
.memories-nav-item.active .memories-nav-year,
.memories-nav-item.active .memories-nav-count {
  opacity: 1;
}

/* --- Memories Sections --- */
.memories-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-margin-top: 140px;
}

.memories-section-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.memories-section-header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: -0.02em;
}

.memories-section-date {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.memories-section-count {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-left: auto;
}

.memories-section-header span {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

@media (max-width: 768px) {
  .memories-nav { top: 48px; }
  .memories-nav-item { padding: 0.375rem 0.625rem; min-width: 52px; }
  .memories-nav-num { font-size: 1.25rem; }
  .memories-section-header { flex-wrap: wrap; gap: 0.25rem 0.75rem; }
  .memories-section-header h3 { font-size: 1.25rem; }
  .memories-section-count { margin-left: 0; }
}

/* ============================================
   Comments View
   ============================================ */

.comments-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.comment-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.comment-card-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: var(--color-border);
}

.comment-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
  transition: opacity 0.2s;
}

.comment-card-thumb:hover img {
  opacity: 1;
}

.comment-card-thumb .play-icon {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.comment-card-thumb .play-icon svg {
  width: 14px;
  height: 14px;
  fill: #fff;
  margin-left: 2px;
}

.comment-card-body {
  padding: 0.75rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.comment-card-more {
  font-size: 0.6875rem;
  color: var(--color-accent);
  font-weight: 500;
}

/* Comment bubble rows */
.comment-bubble-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}
.comment-bubble-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}
.comment-bubble-avatar-placeholder {
  background: var(--color-border);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
}
.comment-bubble {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  padding: 0.4rem 0.6rem;
  flex: 1;
  min-width: 0;
}
.comment-bubble::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 8px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 6px solid rgba(255, 255, 255, 0.06);
}
.comment-bubble-header {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.15rem;
}
.comment-bubble-name {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  white-space: nowrap;
}
.comment-bubble-name:hover { text-decoration: underline; }
.comment-bubble-time {
  font-size: 0.5625rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.comment-bubble-text {
  font-size: 0.8125rem;
  color: var(--color-text);
  line-height: 1.4;
}

.comment-author-link {
  color: var(--color-accent);
  text-decoration: none;
  cursor: pointer;
}
.comment-author-link:hover {
  text-decoration: underline;
}
.comment-card-inline-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.comment-card-input {
  flex: 1;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  color: var(--color-text-primary);
  font-family: inherit;
}
.comment-card-input:focus {
  outline: none;
  border-color: var(--color-accent);
}
.comment-card-post-btn {
  padding: 0.35rem 0.75rem;
  background: var(--color-accent);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.comment-card-post-btn:hover { opacity: 0.85; }
.comment-card-post-btn:disabled { opacity: 0.5; cursor: default; }

/* ============================================
   Likes View
   ============================================ */
.likes-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.likes-stats-ribbon {
  display: flex;
  gap: 2rem;
  padding: 1.25rem 2rem;
  background: linear-gradient(135deg, rgba(212, 168, 83, 0.06), rgba(212, 168, 83, 0.03));
  border: 1px solid rgba(212, 168, 83, 0.15);
  border-radius: var(--radius-lg);
  justify-content: center;
}
.likes-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.likes-stat-link {
  text-decoration: none;
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  transition: background 0.15s;
}
.likes-stat-link:hover {
  background: rgba(255, 255, 255, 0.05);
}
.likes-stat-val {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-accent);
}
.likes-stat-lbl {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}
.likes-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.likes-section-header h3 {
  margin-bottom: 0;
}
.likes-section-more {
  font-size: 0.75rem;
  color: var(--color-accent);
  text-decoration: none;
  white-space: nowrap;
}
.likes-section-more:hover {
  text-decoration: underline;
}
.likes-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
}
.likes-sub-back {
  margin-bottom: 0.5rem;
}
.likes-back-link {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  text-decoration: none;
}
.likes-back-link:hover {
  color: var(--color-accent);
}
.likes-sub-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.likes-sub-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.likes-show-more {
  display: block;
  margin: 1.5rem auto;
  padding: 0.6rem 2rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.likes-show-more:hover {
  border-color: var(--color-accent);
}
.likes-sub-counter {
  text-align: center;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}
.likes-top-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
}
.likes-top-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  transition: transform 0.2s;
}
.likes-top-card:hover {
  transform: scale(1.03);
}
.likes-top-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.likes-top-overlay {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(0,0,0,0.65);
  border-radius: 20px;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
}
.likes-top-heart {
  color: #e25555;
  font-size: 0.8rem;
}
.likes-top-count {
  font-variant-numeric: tabular-nums;
}
.likes-top-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 0.5rem 0.5rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  font-size: 0.7rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.likes-feed {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.likes-feed-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background 0.15s;
}
.likes-feed-row:hover {
  background: rgba(255,255,255,0.03);
}
.likes-feed-thumb-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.likes-feed-thumb-wrap .thumb-pending-inner img { width: 16px; height: 16px; }
.likes-feed-thumb-wrap .thumb-pending-inner span { display: none; }
.likes-feed-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}
.likes-feed-info {
  flex: 1;
  min-width: 0;
}
.likes-feed-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.likes-feed-meta {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.likes-feed-heart {
  color: #e25555;
  font-size: 0.75rem;
}
.likes-feed-user {
  color: var(--color-accent);
  text-decoration: none;
}
.likes-feed-user:hover {
  text-decoration: underline;
}
.likes-feed-time {
  margin-left: auto;
}
.likes-inline-btn {
  position: absolute;
  bottom: 0.4rem;
  right: 0.4rem;
  background: rgba(0,0,0,0.6);
  border: none;
  color: var(--color-text-muted);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  z-index: 2;
}
.likes-inline-btn:hover { background: rgba(0,0,0,0.8); }
.likes-inline-btn.liked { color: #ED4956; }
.likes-feed-like {
  position: static;
  flex-shrink: 0;
  margin-left: auto;
}
.likes-feed-card {
  display: flex;
  flex-direction: column;
}
.likes-feed-card-who {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.35rem;
  padding: 0 0.15rem;
  min-width: 0;
}
.likes-feed-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
}
.likes-feed-who-name {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.likes-feed-who-name a {
  color: var(--color-accent);
  text-decoration: none;
}
.likes-feed-who-name a:hover {
  text-decoration: underline;
}
.likes-feed-who-time {
  font-size: 0.6rem;
  color: var(--color-text-muted);
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.7;
}

@media (max-width: 768px) {
  .likes-top-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .likes-stats-ribbon {
    flex-wrap: wrap;
    gap: 1rem;
  }
}

/* ============================================
   Stats View
   ============================================ */

.stats-layout {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.stats-overview {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.5rem;
  text-align: center;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.stat-card:hover {
  border-color: rgba(212, 168, 83, 0.3);
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.25rem;
}

.stat-subtitle {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  margin-top: 0.125rem;
}

.stats-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.stats-section h3 {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
}

.stats-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1rem;
}

/* Bar chart */
.stats-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 50px;
  align-items: center;
  gap: 0.75rem;
}

.bar-label {
  font-size: 0.75rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  height: 18px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  min-width: 2px;
}

.bar-value {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Spark chart (vertical bars — timeline) */
.stats-spark-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 180px;
  padding: 0 0.25rem;
  overflow-x: auto;
}

.spark-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
  min-width: 8px;
  max-width: 32px;
  height: 100%;
  cursor: default;
}

.spark-bar {
  width: 100%;
  background: var(--color-accent);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.spark-col:hover .spark-bar {
  opacity: 1;
}

.spark-label {
  font-size: 0.5rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  line-height: 1;
}

/* Clickable bar rows */
.bar-row-clickable {
  cursor: pointer;
  transition: background 0.15s;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: var(--radius-sm);
}

.bar-row-clickable:hover {
  background: var(--color-safelight-dim);
}

.bar-row-clickable:hover .bar-label {
  color: var(--color-accent);
}

/* Clickable spark columns */
.spark-col-clickable {
  cursor: pointer;
}

.spark-col-clickable:hover .spark-bar {
  background: var(--color-accent-hover);
  opacity: 1;
}

/* Chart.js canvas containers */
.stats-chart-container {
  position: relative;
  width: 100%;
  height: 260px;
  margin-bottom: 1rem;
}

.stats-chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Clickable stat cards */
.stat-card-clickable {
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.stat-card-clickable:hover {
  border-color: var(--color-accent);
  transform: translateY(-1px);
}

/* Filter toolbar */
.filter-toolbar-wrap {
  margin-bottom: 1rem;
}

.filter-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toolbar-push-right {
  margin-left: auto;
}

/* Filter toggle button — matches admin activity type button style */
.filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.375rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter-toggle-btn:hover {
  color: var(--color-text);
  border-color: var(--color-text-secondary);
}
.filter-toggle-btn.filter-toggle-active {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
}

/* Filter count badge */
.filter-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--color-accent);
  color: #0A0A0A;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.filter-toggle-active .filter-badge {
  background: var(--color-bg);
  color: var(--color-accent);
}

/* Collapsible filter panel */
.filter-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease, opacity 0.2s ease;
  opacity: 0;
  width: 100%;
}
.filter-panel-open {
  grid-template-rows: 1fr;
  opacity: 1;
}
.filter-panel-inner {
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0;
  transition: padding-top 0.25s ease;
}
.filter-panel-open .filter-panel-inner {
  padding-top: 0.75rem;
  overflow: visible;
}
.filter-loading {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  padding: 0.25rem 0;
}

/* Filter panel responsive */
@media (max-width: 768px) {
  .filter-toolbar { gap: 0.375rem; }
  .toolbar-push-right { margin-left: 0; }
  .filter-toggle-btn { padding: 0.4rem 0.75rem; font-size: 0.75rem; }
  .filter-panel-inner { flex-direction: column; gap: 0.375rem; }
  .filter-panel-inner .filter-dropdown { width: 100%; max-width: none; }
}

.filter-sort-select,
.filter-size-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238A8A8A' fill='none' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
}

.filter-sort-select:hover,
.filter-size-select:hover {
  border-color: var(--color-accent);
}

.filter-sort-select:focus,
.filter-size-select:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.filter-dropdown {
  appearance: none;
  -webkit-appearance: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 0.375rem 1.75rem 0.375rem 0.625rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238A8A8A' fill='none' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  max-width: 200px;
}
.filter-dropdown:hover { border-color: var(--color-accent); }
.filter-dropdown:focus { outline: none; border-color: var(--color-accent); }

/* Active filter chips */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.25rem 0.625rem;
  font-size: 0.7rem;
  color: var(--color-text-secondary);
}
.filter-chip-label {
  color: var(--color-text-muted);
  font-weight: 500;
}
.filter-chip strong { color: var(--color-text); }
.filter-chip-link {
  color: inherit;
  text-decoration: none;
}
.filter-chip-link:hover {
  text-decoration: underline;
  color: var(--color-accent);
}
.filter-chip-link:hover strong { color: var(--color-accent); }
.filter-chip-remove {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  line-height: 1;
}
.filter-chip-remove:hover { color: var(--color-accent); }
.filter-chip-clear {
  cursor: pointer;
  color: var(--color-accent);
  border-color: var(--color-accent);
  font-weight: 500;
}
.filter-chip-clear:hover {
  background: var(--color-accent);
  color: #fff;
}

.filter-count {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 0 1rem;
}

.pagination-btn {
  appearance: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--color-accent);
  background: rgba(212, 168, 83, 0.08);
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.pagination-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 2rem 0 1rem;
  flex-wrap: wrap;
}

.pagination-nav .pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-width: 2.25rem;
  padding: 0.5rem 0.75rem;
}

.pagination-nav .pagination-btn.active {
  border-color: var(--color-accent);
  background: rgba(212, 168, 83, 0.15);
  color: var(--color-accent);
  cursor: default;
}

.pagination-nav .pagination-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination-ellipsis {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  padding: 0 0.25rem;
}

/* Footer execution time tooltip */
.footer-copyright {
  position: relative;
  cursor: default;
}

.footer-copyright .exec-time-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.75rem;
  font-size: 0.6875rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
  margin-bottom: 6px;
  box-shadow: var(--shadow-md);
}

.footer-copyright:hover .exec-time-tooltip {
  visibility: visible;
  opacity: 1;
}

/* Album Stats Module */
.album-stats-module {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.album-stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
}
.album-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.album-stat-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}
.album-stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.album-stats-tags {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-secondary);
}
.album-stats-tag {
  color: var(--accent);
  text-decoration: none;
}
.album-stats-tag:hover {
  text-decoration: underline;
}

/* Similar Albums */
.similar-albums-section {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.similar-albums-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.similar-albums-title {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
}

.similar-albums-list {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.similar-album-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background-color 0.1s;
}

.similar-album-link:hover {
  background: var(--color-safelight-dim);
  text-decoration: none;
}

.similar-album-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.similar-album-link:hover .similar-album-name {
  color: var(--color-accent);
}

.similar-album-count {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-bg);
  padding: 0.125rem 0.5rem;
  border-radius: 100px;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

/* Stats note */
.stats-note {
  font-size: 0.75rem;
  color: var(--color-accent);
  margin-top: 0.75rem;
  font-weight: 500;
}
.stats-note-link {
  text-decoration: none;
  cursor: pointer;
  display: block;
}
.stats-note-link:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

/* Size cards */
.stats-size-cards {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stat-size-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  min-width: 120px;
}

.stat-size-type {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.stat-size-avg,
.stat-size-max {
  font-size: 0.6875rem;
  color: var(--color-text-secondary);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 640px) {
  .header-container {
    padding: 0 1rem;
  }

  .header-left {
    gap: 1rem;
  }

  header nav ul {
    gap: 0.125rem;
  }

  header nav a {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
  }

  .container {
    padding: 0 1rem;
  }

  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 4px;
  }

  .media-item {
    border-radius: 6px;
  }

  .popular-hero {
    aspect-ratio: 16 / 9;
  }

  .popular-hero-overlay {
    padding: 1.5rem 1rem;
  }

  .popular-hero-overlay h3 {
    font-size: 1.125rem;
  }

  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.625rem;
  }

  .stats-grid-2 {
    grid-template-columns: 1fr;
  }

  .stats-overview {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .bar-row {
    grid-template-columns: 100px 1fr 40px;
  }

  #search-overlay {
    padding-top: calc(env(safe-area-inset-top, 0px) + 1rem);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    align-items: flex-start;
  }

  .search-panel {
    max-width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 1rem);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border: none;
    border-bottom: 1px solid rgba(212, 168, 83, 0.2);
  }

  .footer-container {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
    padding: 1.5rem 1rem;
  }
  .footer-container nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 0.625rem;
  }
  .footer-container nav a {
    font-size: 0.7rem;
  }
  footer p {
    font-size: 0.65rem;
  }

  .skeleton-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 4px;
  }

  #page-header {
    padding: 1.25rem 0 0.75rem;
  }

  #page-header h2 {
    font-size: 1.25rem;
  }

  #page-header.album-detail-header {
    flex-wrap: wrap;
    gap: 0.375rem 0.75rem;
  }
  .album-detail-stat {
    font-size: 0.625rem;
    padding: 0.2rem 0.5rem;
  }
}

@media (min-width: 641px) and (max-width: 768px) {
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
  }

  .skeleton-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
  }
}

@media (min-width: 1024px) {
  .media-grid {
    gap: 10px;
  }

  .skeleton-grid {
    gap: 10px;
  }
}

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

  .skeleton-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* ============================================
   Home Dashboard — Magazine Layout
   ============================================ */

.home-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  overflow-x: hidden;
}

/* Top row: trending photo + activity panel side by side */
.home-top-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 0.75rem;
}

/* Trending photo — height matched to activity panel */
.home-trending {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  cursor: pointer;
  min-height: 280px;
}

.home-trending img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s, opacity 0.3s;
  opacity: 0.88;
}

.home-trending:hover img {
  transform: scale(1.02);
  opacity: 1;
}

.home-trending::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.3) 100%);
  pointer-events: none;
}

.home-trending-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.25rem;
  background: linear-gradient(transparent 0%, rgba(0,0,0,0.15) 30%, rgba(0,0,0,0.75) 100%);
  pointer-events: none;
  z-index: 1;
}

.home-trending-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 0.15rem;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.home-trending-album {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
}

.home-trending-album a {
  color: var(--color-accent);
  text-decoration: none;
  pointer-events: auto;
}

.home-trending-album a:hover {
  text-decoration: underline;
}

/* Activity prose panel — right column, matches trending image height */
.home-activity-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 2.5rem;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border-left: 2px solid var(--color-accent);
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.home-activity-greeting {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.home-activity-greeting a {
  color: var(--color-accent);
  text-decoration: none;
}

.home-activity-greeting a:hover {
  text-decoration: underline;
}

.home-activity-prose {
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-text-secondary);
  letter-spacing: -0.01em;
  margin: 0;
}

.home-activity-prose a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
}

.home-activity-prose a:hover {
  text-decoration: underline;
}

.home-activity-prose strong {
  color: var(--color-text);
  font-weight: 600;
}

/* Stats ribbon — single row of stats */
.home-stats-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  align-items: start;
  margin-top: 1rem;
}

.home-panel-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Stats ribbon items */
.home-stat-item {
  flex: 1;
  min-width: 0;
  background: var(--color-surface);
  padding: 0.625rem 0.5rem;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
}
.home-stat-item:hover {
  background: rgba(212, 168, 83, 0.06);
  text-decoration: none;
}
.home-stat-val {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.home-stat-lbl {
  display: block;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-top: 0.15rem;
}

/* Camera ribbon — compact pills */
.home-camera-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}
.home-camera-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.home-camera-pill:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
}
.home-camera-pill span {
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* Album strip — horizontal scroll */
.home-album-strip {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.home-album-card {
  flex-shrink: 0;
  width: 140px;
  text-decoration: none;
  transition: transform 0.15s;
}

.home-album-card:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.home-album-card-cover {
  width: 140px;
  height: 140px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-border);
  margin-bottom: 0.375rem;
}

.home-album-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-album-card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-album-card-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Dual-section side-by-side layout */
.home-dual-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Year badge for On This Day */
.home-year-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0,0,0,0.75);
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  pointer-events: none;
}

/* View count badge */
.home-view-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  pointer-events: none;
}

/* 4-column mosaic variant */
.home-mosaic-4col {
  grid-template-columns: repeat(4, 1fr);
}

/* Sections */
.home-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.home-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.home-section-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

.home-section-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-accent);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.home-section-link:hover {
  color: var(--color-accent-hover);
}

/* Photo mosaic — magazine grid */
.home-mosaic {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 140px;
  gap: 6px;
}

.home-mosaic-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--color-border);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.home-mosaic-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
  transition: opacity 0.2s, transform 0.3s;
}

.home-mosaic-item:hover img {
  opacity: 1;
  transform: scale(1.03);
}

.home-mosaic-large {
  grid-column: span 2;
  grid-row: span 2;
}

.home-like-badge,
.home-comment-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  pointer-events: none;
}

.home-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.home-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  transition: border-color 0.15s, background 0.15s;
}
.home-tag:hover {
  border-color: var(--color-accent);
  background: var(--color-safelight-dim);
}
.home-tag-count {
  color: var(--color-text-secondary);
  font-size: 0.7rem;
}

/* Video grid */
.home-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.home-video-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--color-border);
  aspect-ratio: 16 / 9;
}

.home-video-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.home-video-item:hover img {
  opacity: 1;
}

.home-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.home-video-play svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  margin-left: 3px;
}

.home-video-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 0.625rem;
  background: rgba(0,0,0,0.6);
  font-size: 0.6875rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* Comments on home — horizontal strip with avatars */
.home-comments-strip {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}
.home-comment-card {
  flex: 0 0 260px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.home-comment-card-thumb { height: 120px; overflow: hidden; }
.home-comment-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.home-comment-card-body { padding: 0.5rem 0.6rem; }
.home-comment-card-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}
.home-comment-avatar, .home-comment-avatar-placeholder {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
}
.home-comment-avatar { object-fit: cover; }
.home-comment-avatar-placeholder {
  background: var(--color-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 700; color: var(--color-text-muted);
  text-transform: uppercase;
}
.home-comment-avatar-link { text-decoration: none; }
.home-comment-author-link {
  font-size: 0.7rem; font-weight: 600; color: var(--color-accent);
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.home-comment-author-link:hover { text-decoration: underline; }
.home-comment-card-time {
  font-size: 0.6rem; color: var(--color-text-muted); margin-left: auto; white-space: nowrap;
}
.home-comment-card-text {
  font-size: 0.75rem; color: var(--color-text); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Recently liked strip */
.home-recent-likes-strip {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}
.home-recent-like-card {
  flex: 0 0 140px;
  cursor: pointer;
  text-align: center;
}
.home-recent-like-thumb {
  width: 140px; height: 140px; border-radius: var(--radius-md); overflow: hidden;
}
.home-recent-like-thumb img { width: 100%; height: 100%; object-fit: cover; }
.home-recent-like-who {
  display: flex; align-items: center; gap: 0.3rem;
  justify-content: center; margin-top: 0.35rem;
}
.home-like-avatar, .home-like-avatar-placeholder {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
}
.home-like-avatar { object-fit: cover; }
.home-like-avatar-placeholder {
  background: var(--color-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.55rem; font-weight: 700; color: var(--color-text-muted);
  text-transform: uppercase;
}
.home-recent-like-name {
  font-size: 0.65rem; color: var(--color-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Recently tagged people strip */
.home-persons-strip {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}
.home-person-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  gap: 0.35rem;
}
.home-person-avatar, .home-person-placeholder {
  width: 56px; height: 56px; border-radius: 50%;
  border: 2px solid var(--color-border);
  transition: border-color 0.15s;
}
.home-person-avatar { object-fit: cover; }
.home-person-placeholder {
  background: var(--color-surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700; color: var(--color-text-muted);
  text-transform: uppercase;
}
.home-person-card:hover .home-person-avatar,
.home-person-card:hover .home-person-placeholder { border-color: var(--color-accent); }
.home-person-name {
  font-size: 0.65rem; color: var(--color-text-secondary);
  text-align: center;
  line-height: 1.3;
  max-width: 80px;
  word-wrap: break-word;
}

/* Explore cards */
.home-explore {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.home-explore-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.home-explore-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-1px);
  text-decoration: none;
}

.home-explore-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 0.25rem;
}

.home-explore-desc {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}


@media (max-width: 768px) {
  .home-top-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .home-trending {
    aspect-ratio: 4 / 3;
    border-radius: 0;
    margin: 0 -1rem;
    width: calc(100% + 2rem);
  }

  .home-trending-overlay {
    padding: 0.75rem 1.5rem;
  }

  .home-trending-title {
    font-size: 1rem;
  }

  .home-activity-panel {
    padding: 1.25rem 0;
    background: none;
    border-radius: 0;
    border-left: none;
    border-top: 1px solid var(--color-border);
    padding-top: 1rem;
    overflow-y: visible;
  }

  .home-activity-greeting {
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
  }

  .home-activity-prose {
    font-size: 1rem;
    line-height: 1.6;
  }

  .home-dual-section {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .home-mosaic {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 100px;
  }

  .home-mosaic-4col {
    grid-template-columns: repeat(3, 1fr);
  }

  .home-mosaic-large {
    grid-column: span 2;
    grid-row: span 2;
  }

}

/* Static Pages */
.static-page {
  max-width: 860px;
  margin: 0 auto;
  line-height: 1.7;
  color: var(--text-primary);
}

.static-page h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.static-page h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.static-page p {
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.static-page ul {
  margin: 0.5rem 0 1rem 1.5rem;
  color: var(--text-secondary);
}

.static-page ul li {
  margin-bottom: 0.375rem;
}

.static-page kbd {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  font-size: 0.8125rem;
  font-family: inherit;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.faq-item {
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.faq-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.faq-item h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.faq-item .tech-code {
  margin: 1rem 0;
}

.tech-code {
  background: #0d0d0d;
  border: 1px solid rgba(212, 168, 83, 0.15);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin: 0.75rem 0 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.65;
  color: #a0a0a0;
  overflow-x: auto;
  white-space: pre;
}

.tech-comment {
  color: #5a5a5a;
  font-style: italic;
}

.tech-value {
  color: var(--color-accent);
}

.static-page a {
  color: var(--color-accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(212, 168, 83, 0.3);
  transition: border-color 0.2s;
}

.static-page a:hover {
  border-bottom-color: var(--color-accent);
}

.static-page ol {
  margin: 0.5rem 0 1rem 1.5rem;
  color: var(--text-secondary);
}

.static-page ol li {
  margin-bottom: 0.375rem;
}

.static-page table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1rem;
}

.static-page table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.static-page table td:first-child {
  white-space: nowrap;
  width: 1%;
}

/* ============================================
   Login Page — Futuristic Darkroom
   ============================================ */

.login-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #050505;
  z-index: 10000;
  overflow: hidden;
}

.login-ambient {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(212, 168, 83, 0.06) 0%, transparent 70%);
  pointer-events: none;
  animation: login-pulse 4s ease-in-out infinite alternate;
}

@keyframes login-pulse {
  0% { opacity: 0.5; transform: translate(-50%, -50%) scale(0.9); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  padding: 0 2rem;
  text-align: center;
}

.login-brand {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.login-subtitle {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-text-muted);
  margin-bottom: 3rem;
  white-space: nowrap;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form.hidden {
  display: none;
}

.login-field-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 1.25rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-field-wrap:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px rgba(212, 168, 83, 0.2), 0 0 30px rgba(212, 168, 83, 0.05);
}

.login-prompt {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-accent);
  flex-shrink: 0;
  user-select: none;
}

.login-input {
  width: 100%;
  padding: 1rem 0;
  background: none;
  border: none;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 500;
  outline: none;
  caret-color: var(--color-accent);
}

.login-input::placeholder {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.login-button {
  width: 100%;
  padding: 0.875rem;
  background: var(--color-accent);
  color: #0A0A0A;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.login-button:hover {
  background: var(--color-accent-hover);
}

.login-button:active {
  transform: scale(0.985);
}

.login-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.login-button-arrow {
  font-size: 1.125rem;
  transition: transform 0.15s;
}

.login-button:hover .login-button-arrow {
  transform: translateX(3px);
}

.login-error {
  color: #E55353;
  font-size: 0.8125rem;
  min-height: 1.25rem;
  text-align: center;
}

/* Sent confirmation state */
.login-sent {
  text-align: center;
}

.login-sent.hidden {
  display: none;
}

.login-sent-icon {
  margin: 0 auto 1.5rem;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 168, 83, 0.1);
  border: 1px solid rgba(212, 168, 83, 0.25);
  border-radius: 50%;
  color: var(--color-accent);
  animation: login-sent-appear 0.4s ease-out;
}

@keyframes login-sent-appear {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

.login-sent-icon svg {
  width: 24px;
  height: 24px;
}

.login-sent-title {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}

.login-sent-text {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.375rem;
}

.login-sent-text strong {
  color: var(--color-accent);
}

.login-sent-hint {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.login-back-link {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

.login-back-link:hover {
  color: var(--color-text);
}

.login-footer {
  position: absolute;
  bottom: 2rem;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.15);
  z-index: 1;
  font-family: var(--font-mono);
}
.login-buttons-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}
.login-buttons-row .login-button {
  flex: 1;
}
.login-buttons-row .login-passkey-btn {
  flex: 1;
  background: var(--color-accent);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.875rem;
}
.login-buttons-row .login-passkey-btn:hover {
  background: var(--color-accent-hover);
}
.login-passkey-divider {
  display: none;
}
.login-passkey-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.login-passkey-btn:hover {
  border-color: var(--color-accent);
  background: rgba(212, 168, 83, 0.05);
}
.login-passkey-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
.login-passkey-btn svg {
  opacity: 0.7;
}

/* Passkey management — profile */
.passkey-empty {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  padding: 0.5rem 0;
}
.passkey-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.375rem;
}
.passkey-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.passkey-name {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text);
}
.passkey-name svg {
  color: var(--color-accent);
  opacity: 0.7;
}
.passkey-meta {
  font-size: 0.65rem;
  color: var(--color-text-muted);
}
.passkey-delete {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.passkey-delete:hover {
  color: #e55;
  background: rgba(238, 85, 85, 0.1);
}
.profile-passkey-add {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.375rem;
  padding: 0.4rem 0.75rem;
  background: transparent;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.profile-passkey-add:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.profile-passkey-add:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* ============================================
   Profile Dropdown
   ============================================ */

.profile-area {
  position: relative;
}

.profile-trigger {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(212, 168, 83, 0.2);
  color: var(--color-accent);
  border: 1px solid rgba(212, 168, 83, 0.35);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s, border-color 0.15s;
}

.profile-trigger:hover {
  background: rgba(212, 168, 83, 0.3);
  border-color: var(--color-accent);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem;
  z-index: 200;
}

.profile-dropdown.hidden {
  display: none;
}

.profile-dropdown-link {
  display: block;
  text-decoration: none;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s;
}

.profile-dropdown-link:hover {
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

.profile-dropdown-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.profile-dropdown-email {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.125rem;
}

.profile-dropdown-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0.25rem 0;
}

.profile-dropdown-admin,
.profile-dropdown-settings {
  display: block;
  width: 100%;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.profile-dropdown-admin:hover,
.profile-dropdown-settings:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-accent);
}

.profile-dropdown-admin-activity {
  color: var(--color-text-tertiary);
  text-decoration: none;
  font-weight: 400;
}

.profile-dropdown-admin-activity:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.profile-dropdown-logout {
  display: block;
  width: 100%;
  padding: 0.5rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s, color 0.15s;
}

.profile-dropdown-logout:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #E55353;
}

/* ============================================
   Profile Page
   ============================================ */

.profile-page {
  margin: 0 auto;
}

.profile-locked-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 50;
  background: rgba(10, 10, 10, 0.6);
}

.profile-locked-banner span {
  font-size: 6rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.18);
  letter-spacing: 0.2em;
  white-space: nowrap;
  text-transform: uppercase;
  user-select: none;
  transform: rotate(-25deg);
}

.profile-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 2rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}

.profile-page-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(212, 168, 83, 0.2);
  border: 1px solid rgba(212, 168, 83, 0.35);
  color: var(--color-accent);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-avatar-lg {
  width: 88px;
  height: 88px;
  font-size: 1.75rem;
  background-size: cover;
  background-position: center;
}
.profile-avatar-editable {
  cursor: pointer;
  position: relative;
  transition: opacity 0.2s;
}
.profile-avatar-editable::after {
  content: 'Change';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 0.6rem;
  text-align: center;
  padding: 3px 0;
  border-radius: 0 0 50% 50%;
  opacity: 0;
  transition: opacity 0.2s;
}
.profile-avatar-editable:hover::after {
  opacity: 1;
}

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

.profile-page-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
}

.profile-name-lg {
  font-size: 1.5rem;
}

.profile-bio {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-top: 0.5rem;
  line-height: 1.5;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.profile-website {
  color: var(--color-accent);
  text-decoration: none;
}
.profile-website:hover { text-decoration: underline; }

.profile-joined::before,
.profile-active::before {
  content: '\00b7';
  margin-right: 0;
}

.profile-events {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}
.profile-event-pill {
  display: inline-block;
  padding: 0.15rem 0.625rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
a.profile-event-pill:hover {
  background: currentColor;
  color: var(--color-bg) !important;
  text-decoration: none;
}
.profile-event-no-access {
  opacity: 0.6;
  cursor: default;
}

.profile-header-stats {
  width: 100%;
  display: flex;
  gap: 0;
  margin-top: 0.75rem;
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
}

.profile-stat {
  flex: 1;
  text-align: center;
  padding: 0.375rem 0.25rem;
  border-right: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
  border-radius: var(--radius-sm);
}
.profile-stat:last-child { border-right: none; }
.profile-stat-link:hover { background: var(--color-safelight-dim); }
.profile-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  font-family: var(--font-mono);
}
.profile-stat-label {
  font-size: 0.6rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.125rem;
}

/* Profile responsive — mobile */
@media (max-width: 640px) {
  .profile-header {
    padding: 1.25rem;
    gap: 1rem;
  }
  .profile-avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 1.25rem;
  }
  .profile-name-lg {
    font-size: 1.2rem;
  }
  .profile-meta {
    gap: 0.25rem 0.75rem;
  }
  .profile-header-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
  }
  .profile-stat {
    border-right: none;
    padding: 0.375rem 0.125rem;
  }
  .profile-stat-value {
    font-size: 0.875rem;
  }
  .profile-stat-label {
    font-size: 0.55rem;
  }
}

.profile-section {
  margin-top: 1.5rem;
}
.profile-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.profile-section-icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.profile-tagged-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  padding: 0.1rem 0.4rem;
  background: rgba(139, 92, 246, 0.15);
  color: rgb(167, 139, 250);
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 100px;
  letter-spacing: 0;
  text-transform: none;
}

.profile-section-more {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.15s;
}
.profile-section-more:hover {
  color: var(--color-accent-hover);
}

.profile-comments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.profile-comment-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.profile-comment-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.profile-comment-card-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
}
.profile-comment-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-comment-card-body {
  padding: 0.5rem 0.6rem;
}
.profile-comment-card-text {
  font-size: 0.8rem;
  color: var(--color-text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.profile-comment-card-meta {
  font-size: 0.675rem;
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-cameras {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.profile-camera {
  padding: 0.35rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  display: inline-block;
}
.profile-camera:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.profile-camera-count {
  color: var(--color-text-muted);
  margin-left: 0.25rem;
}

.profile-media-grid {
  grid-template-columns: repeat(3, 1fr);
}
@media (min-width: 641px) {
  .profile-media-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (min-width: 768px) {
  .profile-media-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
@media (min-width: 1024px) {
  .profile-media-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}
@media (min-width: 1280px) {
  .profile-media-grid {
    grid-template-columns: repeat(8, 1fr);
  }
}

/* Profile Edit Section */
.profile-edit-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.profile-edit-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.profile-edit-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.profile-edit-row label {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.profile-edit-row input,
.profile-edit-row textarea {
  padding: 0.5rem 0.75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  outline: none;
  transition: border-color 0.15s;
}
.profile-edit-row input:focus,
.profile-edit-row textarea:focus {
  border-color: var(--color-accent);
}
.profile-edit-row textarea {
  resize: vertical;
  min-height: 60px;
}

.profile-edit-save {
  align-self: flex-start;
  padding: 0.5rem 1.5rem;
  background: var(--color-accent);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 0.5rem;
}
.profile-edit-save:hover { opacity: 0.85; }
.profile-edit-save:disabled { opacity: 0.5; cursor: not-allowed; }

.profile-edit-status {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}
.profile-edit-success { color: #4ade80; }
.profile-edit-error { color: #f87171; }

.profile-page-email {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

/* ========== Settings Page ========== */
.settings-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 1rem 0;
}
.settings-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--color-text);
}
.settings-tabs {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 1.5rem;
}
.settings-section {
  margin-bottom: 1.75rem;
}
.settings-section h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  margin: 0 0 0.75rem;
  opacity: 0.85;
}
.settings-description {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: 0 0 0.75rem;
}
.settings-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 600px) {
  .settings-fields { grid-template-columns: 1fr; }
}
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.settings-field:has(textarea) {
  grid-column: 1 / -1;
}
.settings-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.settings-input {
  padding: 0.45rem 0.6rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  transition: border-color 0.15s;
}
.settings-input:focus {
  outline: none;
  border-color: var(--color-accent);
}
textarea.settings-input {
  resize: vertical;
  min-height: 140px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.settings-field-full {
  grid-column: 1 / -1;
}
.settings-input-mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.settings-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
}
.settings-save-btn {
  padding: 0.5rem 1.25rem;
  background: var(--color-accent);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.settings-save-btn:hover { opacity: 0.9; }
.settings-save-btn:disabled { opacity: 0.5; cursor: wait; }
.settings-save-status {
  font-size: 0.75rem;
  font-weight: 500;
}
.settings-danger-btn {
  padding: 0.45rem 1rem;
  background: transparent;
  border: 1px solid #e55;
  border-radius: var(--radius-sm);
  color: #e55;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
}
.settings-danger-btn:hover {
  background: rgba(238, 85, 85, 0.1);
}
.settings-login-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}
.settings-login-table th {
  text-align: left;
  padding: 0.35rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}
.settings-login-table td {
  padding: 0.35rem 0.5rem;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}
.settings-login-table tr:last-child td {
  border-bottom: none;
}
.login-success { color: var(--color-accent); }
.login-failed { color: #e55; }
.login-host { color: var(--color-text-secondary); font-size: 0.75rem; cursor: default; }
.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.375rem;
}
.session-current {
  border-color: var(--color-accent);
  border-width: 1px;
}
.session-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}
.session-device {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-primary);
}
.session-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  background: rgba(212, 168, 83, 0.12);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.35rem;
  vertical-align: middle;
}
.session-meta {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}
.session-ua {
  font-size: 0.6rem;
  color: var(--color-text-muted);
  opacity: 0.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 500px;
}
.session-revoke {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.session-revoke:hover {
  color: #e55;
  background: rgba(238, 85, 85, 0.1);
}
.profile-settings-link-section {
  text-align: center;
  padding-top: 0.5rem;
}
.profile-settings-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  text-decoration: none;
  transition: color 0.15s;
}
.profile-settings-link:hover {
  color: var(--color-accent);
}

/* ========== Admin Tab ========== */
.admin-tab, .event-tab {
  padding: 0.25rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.admin-tab:hover, .admin-tab.active {
  background: var(--color-accent);
  color: var(--color-bg);
  text-decoration: none;
}
.event-tab:hover, .event-tab.active {
  background: var(--tab-accent, var(--color-accent));
  color: var(--color-bg) !important;
  border-color: var(--tab-accent, var(--color-accent)) !important;
  text-decoration: none;
}

/* ========== Admin Dashboard ========== */
.admin-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
}

.admin-activity h3,
.admin-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
}

.admin-activity-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.admin-activity-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  transition: border-color 0.2s, transform 0.15s;
}
.admin-card-clickable {
  cursor: pointer;
}
.admin-card-clickable:hover {
  border-color: var(--color-accent);
  transform: translateY(-1px);
}
.admin-card-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}
.admin-card-main {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-card-link { color: var(--color-accent); }
.admin-card-sub {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
}
.admin-card-meta {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
  cursor: help;
}
.admin-card-empty {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: italic;
}
.admin-card-show-all {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
  cursor: pointer;
  transition: color 0.15s;
}
.admin-card-show-all:hover {
  color: var(--color-accent);
}
.admin-session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.admin-session-header h3 { margin: 0; }
.admin-session-count {
  font-size: 0.7rem;
  background: var(--color-accent);
  color: var(--color-bg);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  margin-left: 0.4rem;
  font-weight: 600;
}
.admin-meta-dim {
  color: var(--color-text-muted);
}

/* Activity "Show more" buttons */
.admin-activity-more {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.admin-more-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.admin-more-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Activity list panel */
.admin-activity-list {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  background: var(--color-surface);
}
.admin-activity-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.admin-activity-list-header h3 { margin: 0; }
.admin-activity-list-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0 0.25rem;
}
.admin-activity-list-close:hover { color: var(--color-text); }
.admin-activity-list-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.75rem;
}
.admin-activity-list-info {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}
.admin-activity-filter {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.admin-activity-right-group {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}
.admin-activity-admin-toggle {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: var(--color-accent);
  color: var(--color-bg);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.admin-activity-admin-toggle:hover {
  opacity: 0.85;
}
.admin-activity-admin-toggle.inactive {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}
.admin-activity-admin-toggle.inactive:hover {
  color: var(--color-text);
  border-color: var(--color-text-secondary);
  opacity: 1;
}
.admin-activity-admin-toggle.auto-active {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
  animation: autoRefreshPulse 5s ease-in-out infinite;
}
@keyframes autoRefreshPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.admin-activity-type-btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
}
.admin-activity-type-btn:hover {
  color: var(--color-text);
  border-color: var(--color-text-secondary);
}
.admin-activity-type-btn.active {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
}

.admin-stats-ribbon {
  display: flex;
  gap: 2rem;
  padding: 1rem 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.admin-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.admin-stat-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent);
}
.admin-stat-lbl {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

/* Admin Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.admin-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}
.admin-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--color-text-secondary);
}
.admin-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}
.admin-editable-email {
  cursor: text;
}
.admin-editable-email:hover {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.admin-table .truncate-cell {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-link {
  color: var(--color-accent);
  text-decoration: none;
}
.admin-link:hover { text-decoration: underline; }
.admin-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
}
.admin-badge-ok {
  background: rgba(80, 200, 120, 0.15);
  color: #50c878;
}
.admin-badge-fail {
  background: rgba(220, 80, 80, 0.15);
  color: #dc5050;
}
.admin-method-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  white-space: nowrap;
}
.admin-level-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(212, 168, 83, 0.15);
  color: var(--color-accent);
}
.admin-level-badge.level-0 {
  background: rgba(220, 80, 80, 0.15);
  color: #dc5050;
}

/* Admin user security icons (passkey, PGP) */
.admin-user-icon {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  color: var(--color-text-muted);
  opacity: 0.55;
  vertical-align: middle;
  cursor: default;
  transition: opacity 0.15s;
}
.admin-user-icon:hover {
  opacity: 1;
  color: var(--color-accent);
}

/* Admin security column */
.admin-sec-cell {
  white-space: nowrap;
}
.admin-sec-cell .admin-user-icon {
  margin-left: 0;
  margin-right: 0.25rem;
}

/* Admin login detail tooltip */
.admin-login-cell { cursor: default; }
.admin-login-tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  min-width: 220px;
  max-width: 420px;
  pointer-events: none;
}
.admin-login-tip-row {
  display: flex;
  gap: 0.5rem;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  line-height: 1.6;
  color: var(--color-text-primary);
}
.admin-login-tip-lbl {
  color: var(--color-text-muted);
  white-space: nowrap;
  min-width: 7em;
  flex-shrink: 0;
}
.admin-login-tip-ua {
  color: var(--color-text-muted);
  opacity: 0.7;
  word-break: break-all;
}

/* Admin Event Tags on Users */
.admin-events-cell {
  position: relative;
}
.admin-events-cell .admin-event-pill,
.admin-events-cell .admin-event-add {
  margin: 0.1rem 0.15rem;
}
.admin-event-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: default;
  white-space: nowrap;
}
.admin-event-pill-x {
  cursor: pointer;
  opacity: 0.5;
  font-size: 0.75rem;
  line-height: 1;
}
.admin-event-pill-x:hover {
  opacity: 1;
}
.admin-event-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px dashed var(--color-border);
  border-radius: 50%;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.admin-event-add:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.admin-event-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0;
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.admin-event-dropdown-item {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s;
}
.admin-event-dropdown-item:hover {
  background: rgba(255,255,255,0.05);
}

/* Add forms (shared layout for add-user, add-event, etc.) */
.admin-add-user,
.admin-add-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

/* User Filter Bar */
.admin-users-filter {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.admin-users-search {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
}
.admin-users-count {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  margin-left: auto;
}

/* Pagination */
.admin-users-pagination {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0 0.25rem;
}
.admin-pag-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  min-width: 30px;
  text-align: center;
  font-family: inherit;
}
.admin-pag-btn:hover:not(:disabled):not(.active) {
  background: rgba(255,255,255,0.06);
  border-color: var(--color-text-muted);
}
.admin-pag-btn.active {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
  font-weight: 600;
}
.admin-pag-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.admin-pag-dots {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  padding: 0 0.2rem;
}
.admin-input {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  color: var(--color-text-primary);
  font-family: inherit;
}
.admin-input:focus {
  outline: none;
  border-color: var(--color-accent);
}
.admin-select {
  appearance: none;
  padding-right: 1.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}
.admin-btn {
  padding: 0.4rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.admin-btn-add {
  background: var(--color-accent);
  color: var(--color-bg);
}
.admin-btn-add:hover { opacity: 0.85; }
.admin-btn-sm {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.7rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.admin-btn-sm:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

@media (max-width: 768px) {
  /* ── Sidebar collapses to hamburger at tablet/phone ────────────── */
  .admin-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
  }
  .admin-mobile-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
  }
  .admin-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: border-color 0.15s, color 0.15s;
  }
  .admin-mobile-toggle:hover { border-color: var(--color-accent); color: var(--color-text); }
  .admin-layout {
    flex-direction: column;
    position: relative;
    gap: 0;
  }
  .admin-nav-content { padding-left: 0; }
  /* ── Nav dropdown: 2-col CSS grid ─────────────────────────────── */
  .admin-nav-bar {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: auto;
    z-index: 200;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 0.25rem 0.5rem 0.75rem;
    width: auto;
    max-height: 75vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,.5);
  }
  .admin-nav-bar.admin-nav-open { display: block; }
  .admin-nav-group-label {
    padding: 0.6rem 0.6rem 0.2rem;
    margin-top: 0.2rem;
    border-top: 1px solid var(--color-border);
  }
  .admin-nav-tab { font-size: 0.85rem; padding: 0.5rem 0.6rem; }
  /* ── Tables ────────────────────────────────────────────────────── */
  .admin-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.75rem;
  }
  .admin-table th { padding: 0.4rem 0.5rem; font-size: 0.6rem; }
  .admin-table td { padding: 0.4rem 0.5rem; white-space: nowrap; }
  /* ── Content ───────────────────────────────────────────────────── */
  .admin-activity-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-stats-ribbon {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem 1rem;
    padding: 0.75rem 1rem;
  }
  /* ── Add forms + filter bars: stack to column ────────────────────── */
  .admin-add-user,
  .admin-add-form,
  .admin-mapping-form {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-users-filter { flex-direction: column; align-items: stretch; }
  .admin-users-search { max-width: none; }
  .admin-users-count { margin-left: 0; }

  /* ── Inputs + selects fill full column width ──────────────────────── */
  .admin-add-user .admin-input,
  .admin-add-user .pxst-select,
  .admin-add-form .admin-input,
  .admin-add-form .pxst-select,
  .admin-add-form .admin-btn,
  .admin-mapping-form .admin-input,
  .admin-mapping-form .admin-input-wide,
  .admin-mapping-form .pxst-select,
  .admin-mapping-form .admin-btn,
  .admin-mapping-form .vm-tag-input,
  .admin-users-filter .admin-input,
  .admin-users-filter .pxst-select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  /* Override any inline widths on event form inputs */
  .admin-add-form .admin-input { width: 100% !important; }

  /* ── Activity filter: right group wraps to new line ───────────────── */
  .admin-activity-right-group { margin-left: 0; }

  .admin-layout { gap: 0; }
  .admin-activity-card { padding: 0.65rem; }
  .admin-card-main { font-size: 0.9rem; }
  .admin-activity-list { padding: 0.75rem; }
}

@media (max-width: 480px) {

  /* ── Activity grid: single column ─────────────────────────────── */
  .admin-activity-grid { grid-template-columns: 1fr; gap: 0.5rem; }
  .admin-activity-card { padding: 0.65rem 0.75rem; }
  .admin-card-label { font-size: 0.6rem; }
  .admin-card-main { font-size: 0.9rem; white-space: normal; }

  /* ── Stats ribbon: 2-col grid ──────────────────────────────────── */
  .admin-stats-ribbon {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem 1rem;
    padding: 0.75rem;
  }
  .admin-stat { align-items: flex-start; }
  .admin-stat-val { font-size: 1.3rem; }
  .admin-stat-lbl { font-size: 0.58rem; }

  /* ── Section headers: keep readable, don't shrink ──────────────── */
  .admin-section h3,
  .admin-activity h3 {
    font-size: 0.82rem;
    margin-bottom: 0.6rem;
  }

  /* ── Form inputs: bigger touch targets ──────────────────────────── */
  .admin-add-user .admin-input,
  .admin-add-user .pxst-select,
  .admin-add-form .admin-input,
  .admin-add-form .pxst-select,
  .admin-mapping-form .admin-input,
  .admin-mapping-form .pxst-select,
  .admin-users-filter .admin-input,
  .admin-users-filter .pxst-select {
    font-size: 0.875rem;
    padding: 0.6rem 0.75rem;
    min-height: 42px;
  }

  /* ── Activity filter buttons: tighter on phone ──────────────────── */
  .admin-activity-type-btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
  }
  .admin-activity-admin-toggle {
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
  }

  /* ── Pagination ─────────────────────────────────────────────────── */
  .admin-pag-btn { min-width: 28px; padding: 0.25rem 0.35rem; font-size: 0.7rem; }
  .admin-users-pagination { gap: 0.2rem; }

  /* ── Buttons ────────────────────────────────────────────────────── */
  .admin-btn { font-size: 0.75rem; padding: 0.35rem 0.7rem; }
  .admin-btn-sm { font-size: 0.65rem; padding: 0.2rem 0.4rem; }

  /* ── Tables ─────────────────────────────────────────────────────── */
  .admin-table .truncate-cell { max-width: 130px; }

  /* ── Session header: wrap on narrow ────────────────────────────── */
  .admin-session-header { flex-wrap: wrap; gap: 0.4rem; }

  /* ── Login tooltip ──────────────────────────────────────────────── */
  .admin-login-tooltip { min-width: 180px; font-size: 0.65rem; }
}

/* ========== Video Resolution Switcher ========== */
.video-res-switcher {
  position: absolute;
  bottom: 60px;
  right: 12px;
  display: flex;
  gap: 4px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-sm);
  padding: 4px;
  backdrop-filter: blur(8px);
}

.video-res-btn {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.video-res-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.video-res-btn.active {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
}
.video-res-pending .video-res-pending-label {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  opacity: 0.85;
  white-space: nowrap;
  padding: 2px 6px;
}

/* ========== Video Stats Overlay ========== */
.video-stats-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.85);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  z-index: 10;
  pointer-events: none;
  backdrop-filter: blur(8px);
  min-width: 200px;
}
.video-stats-row {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1px 0;
}
.video-stats-row span:first-child {
  color: rgba(255, 255, 255, 0.5);
}
.video-stats-btn {
  position: absolute;
  bottom: 60px;
  left: 12px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-style: italic;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(8px);
  transition: all 0.15s;
}
.video-stats-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  border-color: var(--color-accent);
}

/* ========== Video Buffering Spinner ========== */
.video-buffering {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
}
.video-buffering-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: video-spin 0.8s linear infinite;
}
@keyframes video-spin {
  to { transform: rotate(360deg); }
}

/* ========== Tag Editing in Viewer ========== */
.viewer-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.viewer-tag-delete {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.viewer-tag:hover .viewer-tag-delete {
  opacity: 1;
}
.viewer-tag-delete:hover {
  color: #f87171;
}

.viewer-tag-input {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: transparent;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  outline: none;
  width: 80px;
  transition: border-color 0.15s, width 0.15s;
}
.viewer-tag-input:focus {
  border-color: var(--color-accent);
  border-style: solid;
  width: 120px;
}
.viewer-tag-input::placeholder {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

/* Tag Autocomplete */
.viewer-tag-autocomplete {
  display: inline-block;
  position: relative;
}

.tag-autocomplete-list {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  min-width: 160px;
  max-height: 200px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  list-style: none;
  padding: 0.25rem 0;
  margin: 0 0 4px 0;
  z-index: 20;
}
.tag-autocomplete-list.visible { display: block; }

.tag-autocomplete-item {
  padding: 0.35rem 0.75rem;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background 0.1s;
}
.tag-autocomplete-item:hover,
.tag-autocomplete-item.active {
  background: var(--color-safelight-dim);
  color: var(--color-accent);
}

/* ========== Person Tagging in Viewer ========== */
.viewer-persons {
  padding: 0 1.25rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
}

.person-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 100px;
  font-size: 0.75rem;
  color: var(--viewer-text);
  transition: background 0.15s, border-color 0.15s;
}
.person-pill:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(139, 92, 246, 0.4);
}
.person-pill-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  margin-left: -0.125rem;
}
.person-pill.has-region {
  cursor: pointer;
}
.person-pill a {
  color: var(--viewer-text);
  text-decoration: none;
  transition: color 0.15s;
}
.person-pill a:hover {
  color: var(--color-accent);
}

.person-pill-delete {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.person-pill:hover .person-pill-delete {
  opacity: 1;
}
.person-pill-delete:hover {
  color: #f87171;
}

.person-autocomplete-wrapper {
  display: inline-block;
  position: relative;
}

.person-input {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: transparent;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  outline: none;
  width: 80px;
  transition: border-color 0.15s, width 0.15s;
}
.person-input:focus {
  border-color: rgba(139, 92, 246, 0.6);
  border-style: solid;
  width: 140px;
}
.person-input::placeholder {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.person-auto-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.25rem;
  vertical-align: middle;
}
.person-auto-tag-btn:disabled {
  cursor: wait;
  opacity: 0.7;
  pointer-events: none;
}
.person-auto-tag-btn .auto-tag-icon {
  flex-shrink: 0;
}
.person-auto-tag-btn .auto-tag-spinner {
  flex-shrink: 0;
  animation: auto-tag-spin 0.8s linear infinite;
}
@keyframes auto-tag-spin {
  to { transform: rotate(360deg); }
}

.person-autocomplete-list {
  display: none;
  position: fixed;
  min-width: 220px;
  max-width: min(360px, calc(100vw - 2rem));
  max-height: 200px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  list-style: none;
  padding: 0.25rem 0;
  margin: 0;
  z-index: 1000;
}
.person-autocomplete-list.visible { display: block; }

.person-autocomplete-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}
.person-autocomplete-item:hover,
.person-autocomplete-item.active {
  background: var(--color-safelight-dim);
  color: var(--color-accent);
}

.person-autocomplete-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.person-autocomplete-avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-safelight-dim);
  color: var(--color-text-secondary);
  font-size: 0.6rem;
  font-family: var(--font-sans);
  font-weight: 600;
}

.person-autocomplete-badge {
  font-size: 0.6rem;
  padding: 0.1rem 0.35rem;
  background: rgba(139, 92, 246, 0.2);
  color: rgb(167, 139, 250);
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: auto;
}

/* Face Region Overlay */
.face-region-overlay {
  position: absolute;
  border: 2px solid rgba(139, 92, 246, 0.7);
  background: rgba(139, 92, 246, 0.1);
  border-radius: 3px;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.15s;
}

.face-region-label {
  position: absolute;
  bottom: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* Pending region preview (region-first flow) */
.face-region-pending {
  border-color: var(--color-accent);
  background: rgba(212, 168, 83, 0.15);
  animation: pendingPulse 1.5s ease-in-out infinite;
}
@keyframes pendingPulse {
  0%, 100% { border-color: rgba(212, 168, 83, 0.5); }
  50% { border-color: rgba(212, 168, 83, 1); }
}

/* Region Selection Mode */
.region-select-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: rgba(139, 92, 246, 0.85);
  color: #fff;
  font-size: 0.8rem;
  z-index: 15;
  backdrop-filter: blur(4px);
}

.region-select-skip {
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
}
.region-select-skip:hover {
  background: rgba(255, 255, 255, 0.3);
}

.region-select-overlay {
  position: absolute;
  cursor: crosshair;
  z-index: 10;
}

@media (min-width: 1024px) {
  #media-viewer-overlay .viewer-media img.tagging-ready {
    cursor: crosshair;
  }
}

.region-select-rect {
  display: none;
  position: absolute;
  border: 2px solid rgba(139, 92, 246, 0.8);
  background: rgba(139, 92, 246, 0.15);
  border-radius: 2px;
  pointer-events: none;
}

/* ========== Album Download Toolbar ========== */
.album-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.album-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.album-download-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.album-download-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.album-download-btn svg {
  flex-shrink: 0;
}
.dl-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: dl-spin 0.6s linear infinite;
  flex-shrink: 0;
}
@keyframes dl-spin {
  to { transform: rotate(360deg); }
}
.album-download-wrap {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

/* ========== Video Badges as Links ========== */
a.video-badge {
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
a.video-badge:hover {
  filter: brightness(1.2);
  transform: scale(1.05);
}

/* ========== Uploader Link ========== */
.uploader-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--viewer-text);
  text-decoration: none;
  font-size: 0.8125rem;
  padding: 0.25rem 0;
  transition: color 0.15s;
}
.uploader-link:hover {
  color: var(--color-accent);
}
.uploader-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(212, 168, 83, 0.15);
  color: var(--color-accent);
  font-size: 0.625rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.uploader-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ========== Album Admin Bar ========== */
.album-admin-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(212, 168, 83, 0.04);
  border: 1px solid rgba(212, 168, 83, 0.12);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
  width: 100%;
}
.album-admin-bar-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  opacity: 0.7;
  white-space: nowrap;
}
.album-admin-bar .album-event-tags,
.album-admin-bar .album-bulk-tag,
.album-admin-bar .album-bulk-restrict {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.album-admin-bar .admin-bar-divider {
  width: 1px;
  height: 1.25rem;
  background: var(--color-border);
  flex-shrink: 0;
}

/* Person linked-user badge */
.person-linked-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(212, 168, 83, 0.2);
  flex-shrink: 0;
  margin-left: -0.1rem;
}
.person-linked-badge svg {
  width: 9px;
  height: 9px;
  fill: var(--color-accent);
}

/* ============================================
   Event Page Layout
   ============================================ */
.event-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 3rem;
}

.event-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 21 / 8;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  min-height: 200px;
}

.event-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.event-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  padding: 2rem 2.5rem;
}

.event-hero-title {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.event-hero-years {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 0.5rem;
  opacity: 0.7;
}

.event-hero-desc {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  opacity: 0.6;
  max-width: 40ch;
}

/* Hero row: stats + timeline side by side */
.event-hero-row {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

.event-hero-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.event-hero-block:first-child {
  flex: 0 0 auto;
}

.event-hero-timeline {
  flex: 1 1 0;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.event-stats-ribbon {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.25rem 0;
  border-top: none;
  border-bottom: 1px solid var(--color-border);
}

.event-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
}

.event-stat-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
}

.event-stat-label {
  font-size: 0.6875rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Section titles */
.event-section-title {
  margin: 0 0 0.625rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Timeline */
.event-timeline {
  display: grid;
  grid-template-columns: repeat(var(--tl-cols, 8), 1fr) auto;
  grid-template-rows: 1fr 1fr;
  grid-auto-flow: dense;
  gap: 3px;
  min-height: 100px;
}

.event-timeline-all {
  grid-row: 1 / -1;
  grid-column: -1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text);
  transition: background-color 0.15s, color 0.15s;
}

.event-timeline-all:hover {
  background-color: color-mix(in srgb, var(--event-accent, var(--color-accent)) 12%, transparent);
}

.event-timeline-all.active {
  background-color: color-mix(in srgb, var(--event-accent, var(--color-accent)) 18%, transparent);
  color: var(--event-accent, var(--color-accent));
}

.event-timeline-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 60px;
  gap: 0.3rem;
  text-decoration: none;
  padding: 0.375rem 0.25rem 0.5rem;
  border-radius: var(--radius);
  transition: background-color 0.15s;
  cursor: pointer;
}
.event-timeline-item:hover {
  background-color: color-mix(in srgb, var(--event-accent, var(--color-accent)) 12%, transparent);
}

.event-timeline-item.active {
  background-color: color-mix(in srgb, var(--event-accent, var(--color-accent)) 18%, transparent);
}

.event-timeline-item.active .event-timeline-bar {
  opacity: 1;
}

.event-timeline-item.active .event-timeline-year {
  color: var(--event-accent, var(--color-accent));
}

.event-timeline-bar {
  width: 100%;
  max-width: 40px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--color-accent), color-mix(in srgb, var(--color-accent) 50%, transparent));
  opacity: 0.65;
  transition: opacity 0.2s, transform 0.2s;
}

.event-timeline-item:hover .event-timeline-bar {
  opacity: 1;
  transform: scaleY(1.05);
  transform-origin: bottom;
}

.event-timeline-year {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  transition: color 0.15s;
  line-height: 1;
}
.event-timeline-item:hover .event-timeline-year {
  color: var(--event-accent, var(--color-accent));
}

.event-timeline-count {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  line-height: 1;
  opacity: 0.7;
}
.event-timeline-item:hover .event-timeline-count {
  opacity: 1;
  color: var(--color-text-secondary);
}

/* Year view header + pagination */
.event-year-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.event-year-header-title {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.event-year-header .event-year-pagination {
  padding-top: 0;
}

.event-year-footer {
  margin-bottom: 0;
  margin-top: 0.75rem;
}

.event-year-pagination {
  display: flex;
  justify-content: center;
  gap: 0.375rem;
  padding-top: 1rem;
}

.event-year-page-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.event-year-page-btn:hover {
  border-color: var(--event-accent, var(--color-accent));
}

.event-year-page-btn.active {
  background: var(--event-accent, var(--color-accent));
  border-color: var(--event-accent, var(--color-accent));
  color: var(--color-bg);
}

/* Participants */
.event-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.event-participants-hero {
  gap: 0.375rem;
  align-items: center;
}

.event-participants-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-right: 0.25rem;
}

.event-participant {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.875rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.event-participant-chip {
  display: inline-flex;
  text-decoration: none;
  transition: transform 0.15s, opacity 0.15s;
}

.event-participant-chip:hover {
  transform: scale(1.1);
}

.event-participant-chip .event-participant-avatar {
  width: 32px;
  height: 32px;
  font-size: 0.6875rem;
}

.event-participant-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.event-participant:hover {
  border-color: var(--color-accent);
  background: rgba(212, 168, 83, 0.05);
}

.event-participant-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(212, 168, 83, 0.15);
  color: var(--color-accent);
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.event-participant-name {
  font-size: 0.8125rem;
  font-weight: 500;
}

.event-participant-role {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Admin Controls */
.event-admin-controls {
  border-top: 1px solid var(--color-border);
  padding-top: 1.5rem;
}

.event-admin-row {
  position: relative;
  margin-bottom: 0.75rem;
}

.event-admin-input {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.8125rem;
  font-family: var(--font-sans);
}

.event-admin-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.event-admin-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-width: 400px;
  max-height: 200px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 10;
}

.event-admin-dropdown.hidden { display: none; }

.event-admin-dropdown li {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  cursor: pointer;
  color: var(--color-text);
}

.event-admin-dropdown li:hover {
  background: rgba(212, 168, 83, 0.1);
  color: var(--color-accent);
}

.event-admin-tagged {
  margin-top: 1rem;
}

.event-admin-tagged h3 {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin: 0 0 0.5rem;
}

.event-admin-tagged-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 0;
  font-size: 0.8125rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.event-admin-remove {
  background: none;
  border: 1px solid rgba(255, 80, 80, 0.3);
  border-radius: var(--radius-sm);
  color: rgba(255, 80, 80, 0.7);
  font-size: 0.6875rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.event-admin-remove:hover {
  color: #ff5050;
  border-color: #ff5050;
}

/* ========== Cyberpunk Theme (AJG LAN) ========== */
.event-theme-cyberpunk {
  --event-accent: #00f0ff;
  --event-accent-secondary: #ff2d6f;
}

.event-theme-cyberpunk .event-hero {
  background: linear-gradient(135deg, #0a0e27 0%, #1a0a2e 50%, #0d1b2a 100%);
}

.event-theme-cyberpunk .event-hero-overlay {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 240, 255, 0.03) 2px,
    rgba(0, 240, 255, 0.03) 4px
  );
  animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
  0% { transform: translateY(0); }
  100% { transform: translateY(100px); }
}

.event-theme-cyberpunk .event-hero-title {
  color: #00f0ff;
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.4), 0 0 40px rgba(0, 240, 255, 0.2);
}

.event-theme-cyberpunk .event-hero-years {
  color: #ff2d6f;
}

.event-theme-cyberpunk .event-hero-desc {
  color: rgba(0, 240, 255, 0.6);
}

.event-theme-cyberpunk .event-stats-ribbon {
  border-color: rgba(0, 240, 255, 0.15);
}

.event-theme-cyberpunk .event-stat-value {
  color: #00f0ff;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
  font-family: var(--font-mono);
}

.event-theme-cyberpunk .event-stat-label {
  color: rgba(0, 240, 255, 0.5);
}

.event-theme-cyberpunk .event-section-title {
  color: #00f0ff;
  border-left: 3px solid #00f0ff;
  padding-left: 0.75rem;
}

.event-theme-cyberpunk .event-timeline-bar {
  background: linear-gradient(180deg, #00f0ff, #ff2d6f);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.event-theme-cyberpunk .event-participant {
  border-color: rgba(0, 240, 255, 0.15);
  background: rgba(0, 240, 255, 0.03);
}

.event-theme-cyberpunk .event-participant:hover {
  border-color: #00f0ff;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

.event-theme-cyberpunk .event-participant-avatar {
  background: rgba(0, 240, 255, 0.12);
  color: #00f0ff;
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.2);
}

.event-theme-cyberpunk .event-participant-name {
  color: rgba(0, 240, 255, 0.9);
}

.event-theme-cyberpunk .media-item {
  border: 1px solid rgba(0, 240, 255, 0.08);
}

.event-theme-cyberpunk .media-item:hover {
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

.event-theme-cyberpunk .album-card {
  border-color: rgba(0, 240, 255, 0.1);
}

.event-theme-cyberpunk .album-card:hover {
  border-color: #00f0ff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.15);
}

.event-theme-cyberpunk .album-card-title {
  color: rgba(0, 240, 255, 0.9);
}

/* ========== Snow Theme (Colorado) ========== */
.event-theme-snow {
  --event-accent: #7ec8e3;
  --event-accent-secondary: #e8a045;
}

.event-theme-snow .event-hero {
  background: linear-gradient(135deg, #1a2a3a 0%, #2a3a4a 40%, #e8eef2 100%);
}

.event-theme-snow .event-hero-overlay {
  background: radial-gradient(ellipse at 70% 30%, rgba(126, 200, 227, 0.08) 0%, transparent 60%);
}

.event-theme-snow .event-hero-title {
  color: #e8eef2;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.event-theme-snow .event-hero-years {
  color: #e8a045;
}

.event-theme-snow .event-hero-desc {
  color: rgba(232, 238, 242, 0.6);
}

.event-theme-snow .event-stats-ribbon {
  border-color: rgba(126, 200, 227, 0.15);
}

.event-theme-snow .event-stat-value {
  color: #e8eef2;
}

.event-theme-snow .event-stat-label {
  color: rgba(126, 200, 227, 0.6);
}

.event-theme-snow .event-section-title {
  color: #e8a045;
  border-left: 3px solid #e8a045;
  padding-left: 0.75rem;
}

.event-theme-snow .event-timeline-bar {
  background: linear-gradient(180deg, #7ec8e3, #e8a045);
}

.event-theme-snow .event-participant {
  border-color: rgba(126, 200, 227, 0.12);
  background: rgba(126, 200, 227, 0.03);
  backdrop-filter: blur(10px);
}

.event-theme-snow .event-participant:hover {
  border-color: #7ec8e3;
  background: rgba(126, 200, 227, 0.06);
}

.event-theme-snow .event-participant-avatar {
  background: rgba(232, 160, 69, 0.15);
  color: #e8a045;
}

.event-theme-snow .event-participant-name {
  color: #e8eef2;
}

.event-theme-snow .media-item {
  border-radius: 4px;
  border: 1px solid rgba(126, 200, 227, 0.06);
}

.event-theme-snow .media-item:hover {
  box-shadow: 0 2px 12px rgba(126, 200, 227, 0.12);
}

.event-theme-snow .album-card {
  border-color: rgba(126, 200, 227, 0.08);
  border-radius: 6px;
}

.event-theme-snow .album-card:hover {
  border-color: #7ec8e3;
  box-shadow: 0 2px 12px rgba(126, 200, 227, 0.1);
}

.event-theme-snow .album-card-title {
  color: #e8eef2;
}

/* ========== Venue Layout (Restaurants / Coffee) ========== */
.venue-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Controls bar */
.venue-controls {
  position: sticky;
  top: var(--header-height);
  z-index: 10;
  background: var(--color-bg);
  padding: 0.375rem 0;
  text-align: center;
}

/* Single filter row: search + sort + letters */
.venue-filter-row {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0 auto;
  padding: 0.375rem 0.625rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: fit-content;
  max-width: 100%;
}
.venue-filter-row::-webkit-scrollbar { display: none; }
.venue-search-wrap {
  position: relative;
  flex-shrink: 0;
}
.venue-search-icon {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}
.venue-search-input {
  width: 140px;
  padding: 0.25rem 0.5rem 0.25rem 1.75rem;
  font-size: 0.7rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.2s, width 0.2s;
}
.venue-search-input:focus {
  border-color: var(--color-accent);
  width: 200px;
}
.venue-sort-bar {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}
.venue-sort-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  font-family: var(--font-mono);
  white-space: nowrap;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.venue-sort-btn:hover {
  color: var(--color-text-secondary);
  border-color: var(--color-text-muted);
}
.venue-sort-btn.active {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: rgba(var(--accent-rgb, 255, 136, 0), 0.08);
}
.venue-filter-divider {
  width: 1px;
  height: 1rem;
  background: var(--color-border);
  margin: 0 0.375rem;
  flex-shrink: 0;
}

/* Letter bar (inline with sort) */
.venue-letter-bar {
  display: flex;
  gap: 0.125rem;
  flex-shrink: 0;
}
.venue-letter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.25rem;
  font-size: 0.6rem;
  font-weight: 600;
  font-family: var(--font-mono);
  white-space: nowrap;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.venue-letter-btn:hover {
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}
.venue-letter-btn.active {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: rgba(var(--accent-rgb, 255, 136, 0), 0.08);
}

/* Venue list & grid */
.venue-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.venue-letter-section {
  margin-bottom: 0.25rem;
}
.venue-letter-header {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  padding: 0.75rem 0 0.375rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.5rem;
}
.venue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

/* Venue card */
.venue-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--color-surface);
}
.venue-card:hover {
  border-color: var(--color-text-muted);
}
.venue-card.expanded {
  border-color: var(--color-accent);
  grid-column: 1 / -1;
}
.venue-card-body {
  padding: 0.5rem 0.75rem;
}
.venue-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.venue-card-subtitle {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-top: 0.125rem;
}
.venue-card-persons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.3rem;
}
.venue-person-name {
  font-size: 0.62rem;
  font-style: italic;
  color: var(--color-text-muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.venue-person-name + .venue-person-name::before {
  content: '\00b7';
  margin: 0 0.3em;
  font-style: normal;
  color: var(--color-text-muted);
  opacity: 0.45;
}

/* Expanded visits panel */
.venue-card-visits {
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}
.venue-visit-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}
.venue-visit-row:hover {
  background: var(--color-surface-hover, rgba(255,255,255,0.04));
}
.venue-visit-row + .venue-visit-row {
  border-top: 1px solid var(--color-border);
}
.venue-visit-date-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--color-text);
  min-width: 0;
  transition: color 0.15s;
  cursor: pointer;
}
.venue-visit-date-link:hover .venue-visit-date {
  color: var(--color-accent);
}
.venue-visit-date {
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.venue-visit-items {
  font-size: 0.6rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.venue-visit-persons {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.venue-visit-persons::before {
  content: '\00b7';
  margin: 0 0.45em;
  color: var(--color-text-muted);
  font-style: normal;
  flex-shrink: 0;
}
.venue-visit-person {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--color-text-secondary);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.015em;
  transition: color 0.15s;
}
a.venue-visit-person:hover {
  color: var(--color-text);
}
.venue-visit-person + .venue-visit-person::before {
  content: '\00b7';
  margin: 0 0.35em;
  font-style: normal;
  color: var(--color-text-muted);
  opacity: 0.6;
}

/* Show more */
.venue-show-more {
  display: block;
  width: 100%;
  padding: 0.75rem;
  background: none;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  margin-top: 0.5rem;
}
.venue-show-more:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* ---- Venue mobile (tablet) ---- */
@media (max-width: 768px) {
  .venue-controls { padding: 0.25rem 0; }
  .venue-filter-row {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    padding: 0.375rem;
    gap: 0.375rem;
    border-radius: var(--radius-md);
  }
  .venue-search-wrap { flex: 1 1 100%; order: -1; }
  .venue-search-input { width: 100%; }
  .venue-search-input:focus { width: 100%; }
  .venue-filter-divider { display: none; }
  .venue-sort-bar { flex-shrink: 0; }
  .venue-letter-bar { flex: 1 1 auto; flex-wrap: wrap; }
  .venue-grid { grid-template-columns: 1fr; gap: 0.5rem; }
  .venue-card-body { padding: 0.625rem 0.75rem; }
  .venue-card-title { font-size: 0.9rem; }
  .venue-card-subtitle { font-size: 0.75rem; }
  .venue-visit-row { padding: 0.625rem 0.75rem; }
  .venue-visit-date { font-size: 0.8rem; }
  .venue-visit-items { font-size: 0.65rem; }
  .venue-visit-person { font-size: 0.68rem; }
}

/* ---- Venue mobile (phone) ---- */
@media (max-width: 480px) {
  .venue-sort-btn { padding: 0.2rem 0.375rem; font-size: 0.6rem; }
  .venue-letter-btn { min-width: 1.125rem; height: 1.125rem; font-size: 0.55rem; }
  .venue-visit-row { padding: 0.5rem 0.625rem; gap: 0.375rem; }
  .venue-card-body { padding: 0.5rem 0.625rem; }
}

/* ========== Event Album Tagging (Album Detail) ========== */
.album-event-tags {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: nowrap;
}

.album-event-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  background: var(--color-surface);
  transition: border-color 0.15s, color 0.15s;
}

.album-event-tag:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.album-event-tag-remove {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.8125rem;
  padding: 0;
  line-height: 1;
}

.album-event-tag-remove:hover {
  color: #ff5050;
}

/* The select dropdown for adding events to albums */
select.album-event-tag {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238A8A8A' fill='none' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  cursor: pointer;
  border-style: dashed;
  color: var(--color-text-muted);
}
select.album-event-tag:focus {
  outline: none;
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* ========== Album Tag Pills ========== */
.album-tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.5rem 0;
}
.album-tag-pill {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--color-safelight-dim);
  color: var(--color-accent);
  border: 1px solid var(--color-border);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.album-tag-pill:hover {
  border-color: var(--color-accent);
  background: rgba(212, 168, 83, 0.15);
}

/* ========== Album Bulk Tag ========== */
.album-bulk-tag {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

/* Bulk tag pills */
.album-bulk-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.25rem 0.25rem 0.5rem;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--color-accent);
  background: rgba(212, 168, 83, 0.06);
  transition: opacity 0.2s;
}
.album-bulk-tag-pill.partial {
  border-style: dashed;
  opacity: 0.75;
}
.album-bulk-tag-pill-name {
  color: inherit;
  text-decoration: none;
}
.album-bulk-tag-pill-name:hover {
  text-decoration: underline;
}
.album-bulk-tag-pill-ratio {
  font-size: 0.625rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.album-bulk-tag-pill-x,
.album-bulk-tag-pill-add {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.125rem 0.3rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background-color 0.15s;
}
.album-bulk-tag-pill-x {
  color: var(--color-text-muted);
  margin-left: 0.15rem;
}
.album-bulk-tag-pill-x:hover {
  color: #ff5050;
  background: rgba(255, 80, 80, 0.15);
}
.album-bulk-tag-pill-add {
  color: var(--color-accent);
}
.album-bulk-tag-pill-add:hover {
  color: var(--color-accent-hover);
  background: rgba(212, 168, 83, 0.15);
}

/* Bulk tag autocomplete input */
.album-bulk-tag-ac-wrap {
  position: relative;
}
.album-bulk-tag-input {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  outline: none;
  width: 110px;
  transition: border-color 0.15s, color 0.15s, width 0.15s;
}
.album-bulk-tag-input::placeholder {
  color: var(--color-text-muted);
}
.album-bulk-tag-input:focus {
  border-color: var(--color-accent);
  color: var(--color-text);
  width: 160px;
}

/* ─── Bulk Restrict Controls ─────────────────────────────────────── */
.album-bulk-restrict {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.bulk-restrict-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #e55;
  opacity: 0.8;
  white-space: nowrap;
}
.album-bulk-restrict-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid rgba(220, 50, 50, 0.5);
  border-radius: 999px;
  font-size: 0.7rem;
  color: #e55;
  background: rgba(220, 50, 50, 0.06);
  white-space: nowrap;
}
.album-bulk-restrict-pill.partial {
  border-style: dashed;
  opacity: 0.75;
}
.album-bulk-restrict-pill-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.album-bulk-restrict-pill-ratio {
  font-size: 0.6rem;
  opacity: 0.6;
}
.album-bulk-restrict-pill-add,
.album-bulk-restrict-pill-x {
  background: none;
  border: none;
  color: #e55;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
  line-height: 1;
  opacity: 0.6;
}
.album-bulk-restrict-pill-add:hover,
.album-bulk-restrict-pill-x:hover {
  opacity: 1;
}
.bulk-restrict-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid rgba(220, 50, 50, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(220, 50, 50, 0.08);
  color: #e55;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.bulk-restrict-action-btn:hover {
  background: rgba(220, 50, 50, 0.15);
  border-color: rgba(220, 50, 50, 0.6);
}
.bulk-restrict-action-btn.unrestrict {
  border-color: rgba(80, 180, 80, 0.4);
  background: rgba(80, 180, 80, 0.08);
  color: #5a5;
}
.bulk-restrict-action-btn.unrestrict:hover {
  background: rgba(80, 180, 80, 0.15);
  border-color: rgba(80, 180, 80, 0.6);
}
/* Album autotag */
.album-autotag-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.album-autotag-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
.album-autotag-status {
  font-size: 0.68rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.album-autotag-status.done {
  color: #5a5;
}
.album-autotag-status.error {
  color: #e55;
}

/* Album regen (thumbnails / transcodes) buttons */
.album-regen-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.album-regen-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
.album-regen-btn:disabled {
  opacity: 0.55;
  cursor: default;
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.album-regen-status {
  font-size: 0.68rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.album-regen-status.done {
  color: #5a5;
}
.album-regen-status.error {
  color: #e55;
}

/* Album people chips in stats footer */
.album-stats-people {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--color-border);
}
.album-person-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.album-person-chip:hover {
  border-color: var(--color-text-secondary);
  color: var(--color-text);
}
.album-person-chip.linked {
  border-color: rgba(212, 168, 83, 0.35);
  color: var(--color-accent);
}
.album-person-chip.linked:hover {
  border-color: var(--color-accent);
}

.bulk-restrict-input {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border: 1px dashed rgba(220, 50, 50, 0.3);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  outline: none;
  width: 110px;
  transition: border-color 0.15s, width 0.15s;
}
.bulk-restrict-input::placeholder {
  color: var(--color-text-muted);
  font-size: 0.7rem;
}
.bulk-restrict-input:focus {
  border-color: #e55;
  color: var(--color-text);
  width: 160px;
}
/* ========== Admin Restricted Tab — Grid Layout ========== */
/* --- Restricted Media Grid --- */
.restricted-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
}
.restricted-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.restricted-tile:hover {
  border-color: #dc5050;
  box-shadow: 0 0 0 1px rgba(220, 80, 80, 0.3);
}
.restricted-tile.expanded {
  border-color: #dc5050;
  box-shadow: 0 0 0 1px #dc5050;
}
.restricted-tile-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: rgba(255,255,255,0.03);
  overflow: hidden;
}
.restricted-tile-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.restricted-tile-type {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.8);
  font-family: var(--font-mono);
}
.restricted-tile-access-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.6rem;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  background: rgba(200, 50, 50, 0.85);
  color: #fff;
  font-weight: 600;
  padding: 0 4px;
}
.restricted-tile-title {
  padding: 0.3rem 0.4rem;
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Expand panel inserted after tile row */
.restricted-expand-panel {
  grid-column: 1 / -1;
  background: var(--color-surface);
  border: 1px solid #dc5050;
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: restrictedExpand 0.15s ease-out;
}
@keyframes restrictedExpand {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.restricted-expand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.restricted-expand-header .admin-link {
  font-size: 0.85rem;
  font-weight: 500;
}
.restricted-expand-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.2rem;
  line-height: 1;
}
.restricted-expand-close:hover {
  color: var(--color-text);
}
.restricted-expand-access {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.restricted-expand-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.admin-restricted-access-label {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.admin-restricted-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}
.admin-restricted-pills .access-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.35rem;
  border-radius: 10px;
  font-size: 0.6rem;
  background: rgba(200, 50, 50, 0.1);
  color: var(--color-text-secondary);
  border: 1px solid rgba(200, 50, 50, 0.15);
}
.admin-restricted-pills .access-pill-x {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0;
  line-height: 1;
}
.admin-restricted-pills .access-pill-x:hover {
  color: #ff5050;
}
.admin-restricted-ac {
  position: relative;
  display: inline-flex;
}
.admin-restricted-ac input {
  width: 90px;
  padding: 0.1rem 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: transparent;
  color: var(--color-text);
  font-size: 0.6rem;
  outline: none;
  transition: width 0.2s, border-color 0.2s;
}
.admin-restricted-ac input:focus {
  width: 130px;
  border-color: #e55;
}
.admin-restricted-ac input::placeholder {
  color: var(--color-text-muted);
  font-size: 0.6rem;
}
.admin-restricted-ac .access-ac-list {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  min-width: 160px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  margin-top: 2px;
  max-height: 150px;
  overflow-y: auto;
}
.admin-restricted-ac .access-ac-item {
  padding: 0.35rem 0.5rem;
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  cursor: pointer;
}
.admin-restricted-ac .access-ac-item:hover,
.admin-restricted-ac .access-ac-item.highlighted {
  background: rgba(255,255,255,0.06);
  color: var(--color-text);
}
.admin-unrestrict-btn {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(220, 80, 80, 0.1);
  border: 1px solid rgba(220, 80, 80, 0.2);
  color: #dc5050;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.admin-unrestrict-btn:hover {
  background: rgba(220, 80, 80, 0.2);
  border-color: rgba(220, 80, 80, 0.4);
}
/* Album pills */
.restricted-album-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.restricted-album-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.7rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.restricted-album-pill:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}
.restricted-album-pill-count {
  font-size: 0.6rem;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  background: rgba(200, 50, 50, 0.15);
  color: #dc5050;
  padding: 0 4px;
}
.admin-pagination .paging-btn {
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.admin-pagination .paging-btn:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-text);
}
.admin-pagination .paging-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
@media (max-width: 600px) {
  .restricted-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.35rem;
  }
  .restricted-tile-title {
    font-size: 0.6rem;
    padding: 0.2rem 0.3rem;
  }
  .restricted-expand-panel {
    padding: 0.5rem 0.75rem;
  }
}

/* ========== Similar Albums Side-by-Side ========== */
.similar-albums-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.similar-col {
  overflow-x: auto;
  min-width: 0;
}
@media (max-width: 768px) {
  .similar-albums-columns {
    grid-template-columns: 1fr;
  }
}

/* ========== Album Access Control ========== */
.album-access-section {
  padding: 0.75rem 0;
}
.album-access-users {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}
.album-access-user {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}
.album-access-remove {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.8125rem;
  padding: 0;
  line-height: 1;
}
.album-access-remove:hover {
  color: #ff5050;
}

/* ========== Event Page Responsive — Tablet ========== */
@media (max-width: 768px) {
  .event-layout {
    gap: 1rem;
    padding-bottom: 2rem;
  }

  /* Hero banner */
  .event-hero {
    aspect-ratio: 16 / 9;
    min-height: 160px;
    border-radius: var(--radius-md);
  }
  .event-hero-content {
    padding: 1.25rem 1.5rem;
  }
  .event-hero-title {
    font-size: 1.5rem;
  }
  .event-hero-years {
    font-size: 0.75rem;
    margin-top: 0.375rem;
  }
  .event-hero-desc {
    font-size: 0.8125rem;
    max-width: 100%;
  }

  /* Hero row: stack stats + timeline vertically */
  .event-hero-row {
    flex-direction: column;
    gap: 0.75rem;
  }
  .event-hero-block {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  /* Stats ribbon: tighter */
  .event-stats-ribbon {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.125rem 0;
  }
  .event-stat {
    min-width: 64px;
  }
  .event-stat-value {
    font-size: 1.1rem;
  }
  .event-stat-label {
    font-size: 0.625rem;
  }

  /* Participant chips */
  .event-participants-hero {
    gap: 0.25rem;
  }
  .event-participant-chip .event-participant-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.625rem;
  }
  .event-participant-avatar-img {
    width: 28px;
    height: 28px;
  }

  /* Timeline: horizontal scroll on tablet, auto height */
  .event-hero-timeline {
    flex: 0 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .event-timeline {
    min-height: 80px;
    /* Use fixed minmax so grid overflows instead of squishing columns */
    grid-template-columns: repeat(var(--tl-cols, 8), minmax(56px, 1fr)) auto;
  }
  .event-timeline-item {
    min-width: 52px;
    padding: 0.25rem 0.2rem 0.375rem;
  }
  .event-timeline-year {
    font-size: 0.875rem;
  }
  .event-timeline-count {
    font-size: 0.625rem;
  }
  .event-timeline-all {
    min-width: 44px;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  /* Year view header bar */
  .event-year-header {
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }
  .event-year-header-title {
    font-size: 0.75rem;
  }
  .event-year-pagination {
    gap: 0.25rem;
  }
  .event-year-page-btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Year footer bar */
  .event-year-footer {
    margin-top: 0.5rem;
  }

  /* Section titles */
  .event-section-title {
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
  }

  /* Album grid inside events */
  .event-page .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
  }

  /* Header emoji */
  .event-header-emoji {
    font-size: 2rem;
  }
}

/* ========== Event Page Responsive — Phone ========== */
@media (max-width: 480px) {
  .event-layout {
    gap: 0.75rem;
    padding-bottom: 1.5rem;
  }

  /* Hero: shorter on small phones */
  .event-hero {
    aspect-ratio: 16 / 10;
    min-height: 140px;
    border-radius: var(--radius-sm);
  }
  .event-hero-content {
    padding: 1rem;
  }
  .event-hero-title {
    font-size: 1.25rem;
    letter-spacing: -0.02em;
  }
  .event-hero-years {
    font-size: 0.6875rem;
    margin-top: 0.25rem;
  }
  .event-hero-desc {
    font-size: 0.75rem;
    margin-top: 0.25rem;
  }

  /* Hero blocks: minimal padding */
  .event-hero-block {
    padding: 0.625rem 0.75rem;
    gap: 0.375rem;
    border-radius: var(--radius-sm);
  }

  /* Stats: compact 2x2 */
  .event-stats-ribbon {
    gap: 0.5rem 1rem;
    justify-content: space-evenly;
  }
  .event-stat {
    min-width: 56px;
  }
  .event-stat-value {
    font-size: 1rem;
  }
  .event-stat-label {
    font-size: 0.5625rem;
  }

  /* Participant chips: smaller */
  .event-participant-chip .event-participant-avatar {
    width: 26px;
    height: 26px;
    font-size: 0.5625rem;
  }
  .event-participant-avatar-img {
    width: 26px;
    height: 26px;
  }

  /* Timeline: force horizontal scroll on phone */
  .event-timeline {
    min-height: 60px;
    gap: 2px;
    grid-template-columns: repeat(var(--tl-cols, 8), minmax(48px, 1fr)) auto;
  }
  .event-timeline-item {
    min-width: 44px;
    padding: 0.2rem 0.15rem 0.3rem;
    gap: 0.2rem;
  }
  .event-timeline-bar {
    max-width: 30px;
  }
  .event-timeline-year {
    font-size: 0.75rem;
  }
  .event-timeline-count {
    font-size: 0.5625rem;
  }
  .event-timeline-all {
    min-width: 38px;
    font-size: 0.6875rem;
    padding: 0.2rem 0.375rem;
  }

  /* Year header: stack title and pagination on tiny screens */
  .event-year-header {
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 0.625rem;
    gap: 0.375rem;
  }
  .event-year-header-title {
    font-size: 0.6875rem;
    text-align: center;
  }
  .event-year-header .event-year-pagination {
    justify-content: center;
    flex-wrap: wrap;
  }
  .event-year-page-btn {
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
    min-width: 32px;
    min-height: 32px;
  }

  /* Album cards: full width on phone */
  .event-page .album-grid {
    grid-template-columns: 1fr;
    gap: 0.625rem;
  }

  /* Section title */
  .event-section-title {
    font-size: 0.75rem;
    margin-bottom: 0.375rem;
  }

  /* Header emoji */
  .event-header-emoji {
    font-size: 1.5rem;
  }

  /* Tighter page header */
  #page-header.event-header-with-emoji {
    gap: 0.375rem;
    padding-bottom: 0.125rem;
  }
  #page-header.event-header-with-emoji h2 {
    font-size: 1.125rem;
  }
}

/* --- Admin Venue Mappings --- */
.admin-mapping-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.admin-mapping-form .admin-input-wide {
  flex: 1;
  min-width: 200px;
}
.admin-mapping-alias {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-text-secondary);
  white-space: nowrap;
  margin: 0.1rem;
}
.vm-tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  min-width: 200px;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
  cursor: text;
}
.vm-tag-input:focus-within {
  border-color: var(--color-accent);
}
.vm-tag-text {
  border: none;
  outline: none;
  background: transparent;
  color: var(--color-text);
  font-size: 0.85rem;
  flex: 1;
  min-width: 120px;
  padding: 0.3rem 0;
}
.vm-tag-pill {
  cursor: default;
}
.vm-tag-remove {
  cursor: pointer;
  opacity: 0.5;
  font-size: 0.85rem;
  margin-left: 0.25rem;
  line-height: 1;
}
.vm-tag-remove:hover {
  opacity: 1;
}
.vm-edit-canonical {
  width: 100%;
}

/* ─── Unified Select Styling (.pxst-select) ─────────────────────────── */
.pxst-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-sans);
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23D4A843' fill='none' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 12px;
  transition: border-color 0.15s;
}
.pxst-select:hover { border-color: var(--color-accent); }
.pxst-select:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent); }

/* ─── Larger Spark Labels ─────────────────────────────────────────────── */
.spark-label {
  font-size: 0.65rem !important;
}

/* ─── Admin Tabs ─────────────────────────────────────────────────────── */
/* Admin sidebar nav — hidden on desktop, shown via ≤768px media query */
@media (min-width: 769px) {
  .admin-mobile-header {
    display: none;
  }
}
.admin-nav-bar {
  width: 190px;
  flex-shrink: 0;
  padding: 0 0.5rem 2rem 0;
  border-right: 1px solid var(--color-border);
  position: sticky;
  top: 4rem;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  scrollbar-width: none;
}
.admin-nav-bar::-webkit-scrollbar { display: none; }
.admin-nav-group-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: 1.1rem 0.75rem 0.3rem;
}
.admin-nav-tab {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
  box-sizing: border-box;
}
.admin-nav-tab-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.12s;
}
.admin-nav-tab-icon svg {
  width: 14px;
  height: 14px;
}
.admin-nav-tab:hover {
  color: var(--color-text);
  background: rgba(255,255,255,0.04);
}
.admin-nav-tab:hover .admin-nav-tab-icon { opacity: 0.8; }
.admin-nav-tab.active {
  color: var(--color-accent);
  background: var(--color-safelight-dim);
  font-weight: 600;
}
.admin-nav-tab.active .admin-nav-tab-icon {
  opacity: 1;
  stroke: var(--color-accent);
}
.admin-nav-tab.active .admin-nav-tab-icon svg {
  stroke: var(--color-accent);
}
.admin-nav-content {
  flex: 1;
  min-width: 0;
  padding-left: 2rem;
  min-height: 200px;
}

/* ─── Admin meta dim text ────────────────────────────────────────────── */
.admin-meta-dim {
  color: var(--color-text-muted);
}

/* ─── Admin Force Logout Button ──────────────────────────────────────── */
.admin-btn-logout {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.admin-btn-logout:hover {
  border-color: #c44;
  color: #c44;
}

/* Autocomplete dropdown (used by tag input) */
.album-access-ac-wrap {
  position: relative;
  width: 200px;
}
.album-access-ac-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  max-height: 200px;
  overflow-y: auto;
}
.album-access-ac-list.visible {
  display: block;
}
.album-access-ac-item {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.1s;
}
.album-access-ac-item:hover,
.album-access-ac-item.highlighted {
  background: var(--color-safelight-dim);
  color: var(--color-accent);
}


/* ─── Profile Inline Editing ─────────────────────────────────────────── */
.profile-info-fields {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.profile-info-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.4;
}
.profile-info-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
}
.profile-info-icon svg { width: 16px; height: 16px; }
.profile-info-value {
  color: var(--color-text);
}
.profile-info-value a {
  color: var(--color-accent);
  text-decoration: none;
}
.profile-info-value a:hover { text-decoration: underline; }
.profile-info-empty {
  color: var(--color-text-secondary);
  font-style: italic;
  opacity: 0.6;
}
.profile-info-editable.profile-page-name {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s;
}
.profile-info-editable.profile-page-name:hover {
  border-bottom-color: var(--color-accent);
}
.profile-bio-field {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 0.35rem;
}
.profile-bio-text {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  white-space: pre-wrap;
  line-height: 1.5;
}
.profile-bio-text.profile-info-empty {
  font-style: italic;
  opacity: 0.6;
}
.profile-bio-field .profile-field-edit {
  opacity: 0;
  transition: opacity 0.15s;
}
.profile-bio-field:hover .profile-field-edit {
  opacity: 1;
}
.profile-bio-field .profile-info-textarea {
  margin-top: 0;
}
.profile-social-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.2rem 1rem;
}
@media (max-width: 900px) {
  .profile-social-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .profile-social-grid { grid-template-columns: 1fr; }
}
.profile-info-input,
.profile-info-textarea,
.profile-name-input {
  background: var(--color-surface);
  border: 1px solid var(--color-accent);
  color: var(--color-text);
  padding: 0.3rem 0.5rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
  width: 100%;
  max-width: 400px;
  font-family: inherit;
}
.profile-info-textarea {
  max-width: 100%;
  min-height: 3rem;
  resize: vertical;
}
.profile-name-input {
  font-size: 1.3rem;
  font-weight: 700;
  max-width: 500px;
}
.profile-info-input.hidden,
.profile-info-textarea.hidden,
.profile-name-input.hidden,
.profile-info-value.hidden {
  display: none;
}
.profile-info-input:focus,
.profile-info-textarea:focus,
.profile-name-input:focus {
  outline: none;
  box-shadow: 0 0 0 1px var(--color-accent);
}
.profile-info-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

/* Profile field action buttons */
.profile-field-edit,
.profile-field-copy {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  flex-shrink: 0;
  user-select: none;
}
.profile-info-field:hover .profile-field-edit,
.profile-info-field:hover .profile-field-copy {
  opacity: 1;
}
.profile-field-edit:hover { color: var(--color-accent); }
.profile-field-copy:hover { color: var(--color-accent); }
.profile-field-copied {
  color: var(--color-accent) !important;
  opacity: 1 !important;
  position: relative;
}
.profile-field-copied::after {
  content: 'Copied!';
  position: absolute;
  top: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-accent);
  color: var(--color-bg);
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  animation: copied-fade 2s ease forwards;
}
.profile-field-edit.hidden,
.profile-field-copy.hidden { display: none; }

/* Profile secure badge (lock icon) */
.profile-secure-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  color: var(--color-accent);
  opacity: 0.7;
  transition: opacity 0.15s;
  cursor: help;
}
.profile-secure-badge:hover { opacity: 1; }
.profile-secure-badge svg { width: 18px; height: 18px; fill: var(--color-accent); }

/* ========== Custom Modal ========== */
.pxst-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.pxst-modal {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  min-width: 320px;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.pxst-modal-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}
.pxst-modal-message {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
  line-height: 1.4;
}
.pxst-modal-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  margin-bottom: 1rem;
  box-sizing: border-box;
}
.pxst-modal-input:focus {
  outline: none;
  border-color: var(--color-accent);
}
.pxst-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.pxst-modal-cancel {
  padding: 0.4rem 0.875rem;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.pxst-modal-cancel:hover {
  border-color: var(--color-text-muted);
}
.pxst-modal-ok {
  padding: 0.4rem 0.875rem;
  background: var(--color-accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #000;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.pxst-modal-ok:hover {
  opacity: 0.9;
}
.pxst-modal-danger {
  background: #e55;
  color: #fff;
}
.pxst-modal-danger:hover {
  background: #c44;
}

/* Activity feed thumbnails */
.activity-thumb-cell {
    width: 36px;
    padding: 0.25rem 0 0.25rem 0.5rem !important;
}
.activity-thumb {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
    vertical-align: middle;
    display: block;
}

/* Search match highlighting */
.search-highlight {
    background: transparent;
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
    text-underline-offset: 2px;
}

/* ============================================
   Mobile Responsive — Hamburger Navigation
   ============================================ */

.hamburger {
  display: none;
}

.nav-backdrop {
  display: none;
}

@media (max-width: 768px) {
  /* --- Hamburger Button --- */
  .hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 101;
    flex-shrink: 0;
  }
  .hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--color-text);
    border-radius: 1px;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  .hamburger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }
  .hamburger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* --- Nav Drawer --- */
  header nav {
    position: fixed;
    top: calc(var(--header-height) + env(safe-area-inset-top, 0px));
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-height) - env(safe-area-inset-top, 0px));
    height: calc(100dvh - var(--header-height) - env(safe-area-inset-top, 0px));
    background: var(--color-surface);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 99;
    overflow-y: auto;
  }
  header nav.open {
    transform: translateX(0);
  }
  header nav ul {
    flex-direction: column;
    padding: 0.75rem 1.5rem 1.5rem;
    gap: 0.25rem;
  }
  header nav ul::before {
    content: '';
    display: block;
    height: 1px;
    background: var(--color-border);
    margin: 0 0.25rem 0.5rem;
  }
  header nav a {
    font-size: 1.125rem;
    padding: 0.75rem 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
  }
  header nav a:hover,
  header nav a.active {
    background: var(--color-safelight-dim);
  }

  /* Hide keyboard shortcut letters on mobile */
  header nav .sk {
    text-decoration: none;
  }

  /* Hide event pills from header-right on mobile (shown in drawer instead) */
  .event-tab {
    display: none;
  }

  /* --- Nav Backdrop --- */
  .nav-backdrop {
    display: none;
    position: fixed;
    top: calc(var(--header-height) + env(safe-area-inset-top, 0px));
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-height) - env(safe-area-inset-top, 0px));
    height: calc(100dvh - var(--header-height) - env(safe-area-inset-top, 0px));
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
  }
  .nav-backdrop.visible {
    display: block;
  }

  /* --- iOS Safe Areas --- */
  header {
    height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .container {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  footer {
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* --- Touch-Friendly Tap Targets (44px minimum per Apple HIG) --- */
  .search-trigger {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .profile-trigger {
    min-width: 44px;
    min-height: 44px;
  }
  .nav-button {
    width: 44px;
    height: 64px;
    font-size: 2rem;
  }
  .footer-container nav a {
    padding: 0.5rem 0.75rem;
  }

  /* --- Prevent iOS Double-Tap Zoom --- */
  header nav a,
  .nav-button,
  .search-trigger,
  .profile-trigger,
  .media-item,
  .album-card,
  .close-viewer {
    touch-action: manipulation;
  }
}

/* ============================================
   Mobile Viewer — Full Native Experience
   ============================================ */

@media (max-width: 1023px) {
  /* --- Layout: full-screen overlay --- */
  #media-viewer-overlay {
    flex-direction: column;
    background: #000;
    overflow: hidden;
  }

  /* --- Media area: full bleed --- */
  #media-viewer-overlay .viewer-media {
    position: absolute;
    inset: 0;
    padding: 0;
    z-index: 1;
    touch-action: none;
    overflow: hidden;
  }
  #media-viewer-overlay .viewer-media img {
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    object-fit: contain;
    will-change: transform;
  }
  #media-viewer-overlay .viewer-media video {
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    object-fit: contain;
  }

  /* --- Hide desktop nav arrows on mobile (!important overrides inline JS) --- */
  #media-viewer-overlay .nav-button {
    display: none !important;
  }

  /* --- Hide desktop close button and sidebar toggle on mobile --- */
  .viewer-sidebar-header .close-viewer,
  .viewer-sidebar-toggle {
    display: none !important;
  }

  /* --- Mobile close button (top-left back arrow) --- */
  .viewer-mobile-close {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    z-index: 1010;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
  }

  /* --- Tap zones --- */
  .viewer-tap-zone {
    position: absolute;
    top: 0;
    bottom: 72px; /* above peek bar */
    z-index: 10;
    display: block;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
  }
  .viewer-tap-prev { left: 0; width: 30%; }
  .viewer-tap-next { right: 0; width: 30%; }

  /* --- Peek bar (always visible above bottom sheet) --- */
  .viewer-peek-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1005;
    background: rgba(18, 18, 18, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 0 1rem calc(env(safe-area-inset-bottom, 0px) + 0.5rem) 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    touch-action: none;
    transition: opacity 0.2s ease;
  }
  .peek-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.3);
    margin: 8px 0;
    flex-shrink: 0;
  }
  .peek-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.75rem;
    min-height: 36px;
  }
  .peek-title {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .peek-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
  }
  .peek-like-btn,
  .peek-comment-btn,
  .peek-share-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8125rem;
    font-family: var(--font-mono);
    cursor: pointer;
    padding: 6px;
    touch-action: manipulation;
  }
  .peek-like-btn.liked { color: #ED4956; }
  .peek-like-btn.liked .like-heart { fill: #ED4956; stroke: #ED4956; }
  .peek-like-btn.like-pop { animation: likePop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
  @keyframes likePop {
    0% { transform: scale(1); }
    40% { transform: scale(1.35); }
    100% { transform: scale(1); }
  }
  .peek-share-btn.shared { color: var(--color-accent); }

  .peek-subtitle {
    width: 100%;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
  }
  .peek-subtitle:empty { display: none; }
  .peek-subtitle a {
    color: var(--color-accent);
    text-decoration: none;
  }

  .peek-comment-prompt {
    width: 100%;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.35);
    padding: 8px 12px;
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    touch-action: manipulation;
  }

  /* Prevent iOS zoom on focus */
  .comment-form #comment-input {
    font-size: 16px;
  }

  /* --- Bottom sheet (viewer-sidebar) --- */
  .viewer-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1004;
    width: 100%;
    max-height: 85dvh;
    border-left: none;
    border-top: none;
    border-radius: 16px 16px 0 0;
    background: var(--viewer-panel);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    touch-action: pan-y;
    overscroll-behavior: contain;
    overflow-y: auto;
  }
  .viewer-sidebar.sheet-expanded {
    transform: translateY(0);
  }

  /* When sheet is expanded, hide peek bar */
  .viewer-peek-bar.peek-hidden {
    opacity: 0;
    pointer-events: none;
  }

  /* --- Swipe animation classes --- */
  #media-viewer-overlay .viewer-media.swipe-animating {
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }

  /* --- Counter badge on peek bar buttons --- */
  .peek-comment-count,
  .peek-like-count {
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 0;
  }

  /* --- Keyboard-aware bottom sheet --- */
  .viewer-sidebar.keyboard-open {
    max-height: var(--kb-sheet-max-height, 50vh);
    bottom: var(--kb-offset-bottom, 0px);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1),
                max-height 0.25s cubic-bezier(0.32, 0.72, 0, 1),
                bottom 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  }

  /* Sticky comment form — always visible just above keyboard */
  .viewer-sidebar.keyboard-open .comment-form {
    position: sticky;
    bottom: 0;
    background: var(--viewer-panel);
    border-top: 1px solid var(--viewer-border);
    z-index: 2;
  }

  /* Hide non-essential content to maximize space */
  .viewer-sidebar.keyboard-open .viewer-metadata,
  .viewer-sidebar.keyboard-open .viewer-tags,
  .viewer-sidebar.keyboard-open .viewer-persons { display: none; }

  /* Compact input */
  .viewer-sidebar.keyboard-open .comment-form #comment-input {
    min-height: 44px;
    max-height: 80px;
  }

  /* Constrain mention dropdown in keyboard mode */
  .viewer-sidebar.keyboard-open .mention-dropdown { max-height: 120px; }
}

/* Hide mobile-only elements on desktop */
@media (min-width: 1024px) {
  .viewer-tap-zone,
  .viewer-mobile-close,
  .viewer-peek-bar {
    display: none !important;
  }
}

/* ============================================
   Login Page — Mobile Optimization
   ============================================ */

@media (max-width: 480px) {
  .login-brand {
    font-size: 2.75rem;
  }
  .login-subtitle {
    white-space: normal;
    letter-spacing: 0.12em;
    margin-bottom: 2rem;
  }
  .login-ambient {
    width: 350px;
    height: 350px;
  }
  .login-container {
    padding: 0 1.5rem;
  }
  .login-buttons-row {
    flex-direction: column;
    gap: 0.75rem;
  }
  .login-buttons-row .login-button,
  .login-buttons-row .login-passkey-btn {
    width: 100%;
  }
}

/* ============================================
   Tablet Polish (641–1023px)
   ============================================ */

@media (min-width: 641px) and (max-width: 1023px) {
  .stats-overview {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
  .home-mosaic {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 120px;
  }
  .home-mosaic-4col {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================
   Timeline View
   ============================================ */

.timeline-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 2rem;
  align-items: start;
}

.timeline-main {
  min-width: 0;
}

.timeline-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.timeline-section-title-left {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}

.timeline-section-title h2 {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
  white-space: nowrap;
}

.timeline-section-title .timeline-section-count {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.timeline-sort-select {
  flex-shrink: 0;
}

.timeline-controls-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.timeline-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.timeline-page-btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.timeline-page-btn:hover:not(:disabled) {
  background: var(--color-safelight-dim);
  border-color: var(--color-text-muted);
}

.timeline-page-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.timeline-page-info {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.timeline-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  max-height: calc(100vh - var(--header-height) - 2rem);
  overflow-y: auto;
}

.timeline-sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.5rem;
}

.timeline-nav-all {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}

.timeline-nav-all:hover {
  background: var(--color-safelight-dim);
}

.timeline-nav-all.active {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-accent);
}

.timeline-year-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}

.timeline-year-btn:hover {
  background: var(--color-safelight-dim);
}

.timeline-year-btn.active {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-accent);
}

.timeline-year-btn .timeline-count {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.timeline-year-btn.active .timeline-count {
  color: var(--color-accent);
  opacity: 0.7;
}

.timeline-months {
  display: none;
  flex-direction: column;
  gap: 0.0625rem;
  padding-left: 0.75rem;
}

.timeline-months.expanded {
  display: flex;
}

.timeline-month-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}

.timeline-month-btn:hover {
  background: var(--color-safelight-dim);
  color: var(--color-text);
}

.timeline-month-btn.active {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-accent);
}

.timeline-month-btn .timeline-count {
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.timeline-month-btn.active .timeline-count {
  color: var(--color-accent);
  opacity: 0.7;
}

/* Timeline – Tablet (641–1023px) */
@media (min-width: 641px) and (max-width: 1023px) {
  .timeline-layout {
    grid-template-columns: 1fr 200px;
  }
}

/* Timeline – Mobile (<=768px) */
@media (max-width: 768px) {
  .timeline-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .timeline-sidebar {
    position: static;
    order: -1;
    max-height: none;
    overflow-y: visible;
  }

  .timeline-sidebar-inner {
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.25rem;
    padding: 0.375rem;
  }

  .timeline-nav-all,
  .timeline-year-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.375rem 0.625rem;
    font-size: 0.8rem;
  }

  /* Hide month counts in horizontal nav — too cluttered */

  .timeline-months {
    padding-left: 0;
    display: none;
  }

  .timeline-months.expanded {
    display: contents;
  }

  .timeline-month-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 1rem;
    background: var(--color-safelight-dim);
  }

  .timeline-month-btn .timeline-count {
    font-size: 0.65rem;
  }

  .timeline-section-title {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .timeline-section-title h2 {
    font-size: 1rem;
  }

  .timeline-controls-right {
    width: 100%;
    justify-content: space-between;
  }

  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
  }

  .timeline-pagination {
    gap: 0.5rem;
  }

  .timeline-page-btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
  }
}

/* ─── Restriction Badge & Access Controls ────────────────────────────── */

.restriction-section {
  margin-bottom: 0.75rem;
}
.restriction-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: rgba(220, 50, 50, 0.15);
  border: 1px solid rgba(220, 50, 50, 0.4);
  border-radius: 6px;
  color: #e55;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.restriction-badge svg {
  flex-shrink: 0;
}
.restriction-people {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* Viewer restricted message */
.viewer-restricted-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  color: var(--color-text-muted);
  text-align: center;
  gap: 0.75rem;
}
.viewer-restricted-message svg {
  opacity: 0.4;
  stroke: #e55;
}
.viewer-restricted-message p {
  margin: 0;
  font-size: 1.1rem;
  color: #e55;
  font-weight: 500;
}
.viewer-restricted-message .restricted-sub {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

/* Admin access control in viewer sidebar */
.admin-access-control {
  margin-top: 0.35rem;
}
.access-header-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.access-lock-icon {
  flex-shrink: 0;
  opacity: 0.5;
  margin-top: 0.1rem;
}
.access-lock-icon.locked {
  opacity: 1;
  color: #e55;
}
.access-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.access-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border: 1px dashed #e55;
  border-radius: 999px;
  font-size: 0.72rem;
  color: #e55;
  background: rgba(220, 50, 50, 0.08);
}
.access-pill-remove {
  background: none;
  border: none;
  color: #e55;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  line-height: 1;
  opacity: 0.6;
}
.access-pill-remove:hover {
  opacity: 1;
}
.access-input {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.3rem 0.5rem;
  border: 1px dashed var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.78rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s;
}
.access-input:focus {
  border-color: var(--color-accent);
}
.access-input::placeholder {
  color: var(--color-text-muted);
}
.access-ac-wrap {
  position: relative;
}
.access-ac-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
}
.access-ac-list.visible {
  display: block;
}
.access-ac-item {
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.1s;
}
.access-ac-item:hover,
.access-ac-item.highlighted {
  background: var(--color-safelight-dim);
  color: var(--color-accent);
}

/* =============================================================================
   Face Recognition Admin
   ============================================================================= */

.face-stats-bar {
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 0.5rem;
}
.face-stat-card {
  text-align: center;
  padding: 0.5rem 0.2rem;
}
.face-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
  margin-top: 0.15rem;
}
/* --- AI Tab Sub-Navigation --- */
.ai-container {
  padding: 0;
}
.ai-sub-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ai-sub-nav::-webkit-scrollbar { display: none; }
.ai-sub-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  position: relative;
}
.ai-sub-tab svg {
  opacity: 0.6;
  flex-shrink: 0;
}
.ai-sub-tab:hover {
  color: var(--color-text);
  background: rgba(255,255,255,0.03);
}
.ai-sub-tab:hover svg { opacity: 0.9; }
.ai-sub-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}
.ai-sub-tab.active svg {
  opacity: 1;
  stroke: var(--color-accent);
}
.ai-sub-tab-coming-soon {
  opacity: 0.4;
  cursor: default;
}
.ai-sub-tab-coming-soon::after {
  content: 'soon';
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 3px;
  padding: 0.05rem 0.3rem;
  margin-left: 0.3rem;
}
.ai-sub-tab-coming-soon:hover {
  color: var(--color-text-secondary);
  background: none;
}
.ai-tab-content {
  min-height: 200px;
}
.ai-faces-section {
  /* No extra padding needed */
}

.face-section-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.face-scan-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.ai-model-badge {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  background: var(--color-bg-tertiary, #1a1a2e);
  border: 1px solid var(--color-border, #333);
  font-size: 0.7rem;
  color: var(--color-text-secondary, #aaa);
  white-space: nowrap;
}
.ai-model-badge .ai-model-name {
  font-weight: 600;
  color: var(--color-text-primary, #e0e0e0);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  background: rgba(255,255,255,0.06);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
a.ai-model-name:hover {
  background: rgba(255,255,255,0.14);
  color: var(--color-accent, #60a5fa);
}
.ai-model-badge svg {
  width: 14px;
  height: 14px;
  opacity: 0.5;
}
.face-scan-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.face-scan-btn-stop {
  background: #e74c3c !important;
  border-color: #e74c3c !important;
  color: #fff !important;
}
.face-scan-btn-stop:hover {
  background: #c0392b !important;
  opacity: 1 !important;
}
.face-scan-btn-stop .face-scan-spinner {
  stroke: #fff !important;
}
.face-clear-pending-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.face-scan-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}
.face-scan-device .device-pill {
  display: inline-block;
  font-weight: 700;
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  border-radius: 9px;
  line-height: 1.5;
  text-transform: uppercase;
}
.device-pill.device-npu { background: rgba(46,204,113,0.18); color: #2ecc71; }
.device-pill.device-gpu { background: rgba(241,196,15,0.18); color: #f1c40f; }
.device-pill.device-cpu { background: rgba(231,76,60,0.18); color: #e74c3c; }
.face-scan-progress-bar {
  width: 120px;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}
.face-scan-progress-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 3px;
  transition: width 0.5s ease;
  width: 0%;
}
.face-scan-progress-text {
  color: var(--color-text-secondary);
  font-size: 0.7rem;
  white-space: nowrap;
}
.face-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: nowrap;
  margin-bottom: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  font-size: 0.7rem;
  line-height: 1;
}
.face-filter-bar > *, .face-filter-bar select,
.face-filter-bar button, .face-filter-right > * {
  vertical-align: middle;
}
.face-filter-spacer {
  flex: 1;
  min-width: 0.25rem;
}
.face-filter-right {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
  height: 24px;
}
.face-filter-pag {
  display: inline-flex;
  align-items: center;
  height: 22px;
}
.face-filter-total {
  font-size: 0.65rem;
  color: var(--color-text-secondary);
  font-weight: 600;
  white-space: nowrap;
  line-height: 22px;
  height: 22px;
}
.face-filter-pag .pagination {
  margin: 0;
  padding: 0;
  gap: 0.2rem;
  align-items: center;
  justify-content: flex-end;
}
.face-filter-pag .pagination-btn {
  font-size: 0.65rem;
  padding: 0.15rem 0.35rem;
  min-height: 0;
  line-height: 1.2;
  height: 22px;
  box-sizing: border-box;
}
.face-filter-pag .pagination-info {
  font-size: 0.65rem;
  line-height: 22px;
}
.face-filter-bar .admin-input {
  font-size: 0.7rem;
  padding: 0.25rem 0.4rem;
  height: 24px;
  line-height: 1;
  box-sizing: border-box;
}
.face-filter-bar .admin-select {
  padding-right: 1.4rem;
  height: 24px;
  box-sizing: border-box;
}
.face-status-toggles {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.face-status-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  line-height: 1;
  height: 24px;
  box-sizing: border-box;
  font-weight: 600;
  background: transparent;
  color: var(--color-text-secondary);
  border: none;
  border-right: 1px solid var(--color-border);
  cursor: pointer;
  transition: all 0.15s;
}
.face-status-btn:last-child {
  border-right: none;
}
.face-status-btn:hover {
  color: var(--color-text);
  background: rgba(255,255,255,0.04);
}
.face-status-btn.active {
  background: var(--color-accent);
  color: var(--color-bg);
}
.face-confidence-filter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  height: 24px;
}
.face-conf-slider {
  width: 60px;
  accent-color: var(--color-accent);
  height: 3px;
}
.face-conf-value {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  min-width: 2.5rem;
  font-weight: 600;
}
.face-bulk-approve:disabled,
.face-bulk-reject:disabled {
  opacity: 0.6;
  cursor: wait;
  pointer-events: none;
}
.face-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.face-group-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.4rem;
}
.face-group-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}
.face-group-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text);
}
.face-group-count {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  margin-left: auto;
}
.face-group-select-all {
  margin-left: 0.5rem;
  font-size: 0.65rem;
}
.face-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
}
.face-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
  user-select: none;
}
.face-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent);
}
.face-card-selected {
  border-color: var(--color-accent);
  background: rgba(var(--color-accent-rgb, 255,255,255), 0.06);
  box-shadow: 0 0 0 1px var(--color-accent);
}
.face-card-top {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}
.face-card-check {
  position: absolute;
  top: 2px;
  left: 2px;
  accent-color: var(--color-accent);
  cursor: pointer;
}
.face-crop-wrap {
  position: relative;
  display: inline-block;
}
.face-card-video-icon {
  position: absolute;
  bottom: 4px;
  right: 4px;
  color: #fff;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.7));
  pointer-events: none;
}
.face-crop {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-bg);
}
.confidence-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
}
.conf-high {
  background: rgba(80, 200, 120, 0.15);
  color: #50c878;
}
.conf-med {
  background: rgba(230, 180, 50, 0.15);
  color: #e6b432;
}
.conf-low {
  background: rgba(220, 80, 80, 0.15);
  color: #dc5050;
}
.face-status-badge {
  display: inline-block;
  font-size: 0.6rem;
  padding: 0.05rem 0.35rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  font-weight: 600;
}
.face-status-approved {
  background: rgba(80, 200, 120, 0.15);
  color: #50c878;
}
.face-status-rejected {
  background: rgba(220, 80, 80, 0.15);
  color: #dc5050;
}
.face-status-reassigned {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}
.face-card-title {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.face-card-title:hover {
  color: var(--color-accent);
}
.face-bulk-bar {
  position: sticky;
  bottom: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  z-index: 10;
  margin-top: 0.75rem;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.3);
}
.face-bulk-approve {
  background: rgba(80, 200, 120, 0.2);
  color: #50c878;
  border: 1px solid rgba(80, 200, 120, 0.3);
}
.face-bulk-approve:hover {
  background: rgba(80, 200, 120, 0.3);
}
.face-bulk-reject {
  background: rgba(220, 80, 80, 0.2);
  color: #dc5050;
  border: 1px solid rgba(220, 80, 80, 0.3);
}
.face-bulk-reject:hover {
  background: rgba(220, 80, 80, 0.3);
}
.face-bulk-reassign {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
}
.face-bulk-reassign:hover {
  background: rgba(96, 165, 250, 0.25);
}
.face-reassign-panel {
  display: flex;
  align-items: center;
  gap: 8px;
}
.face-reassign-panel.hidden {
  display: none;
}
.face-reassign-input-wrap {
  position: relative;
}
.face-reassign-input {
  background: var(--color-surface);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--color-text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  width: 220px;
  outline: none;
}
.face-reassign-input:focus {
  border-color: var(--color-accent, #60a5fa);
}
.face-reassign-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  margin-bottom: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
}
.face-reassign-option {
  padding: 6px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--color-text-primary);
}
.face-reassign-option:hover {
  background: rgba(255,255,255,0.08);
}
.face-reassign-confirm {
  background: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
  font-size: 0.82rem;
  padding: 6px 12px;
}
.face-reassign-confirm:hover:not(:disabled) {
  background: rgba(96, 165, 250, 0.3);
}
.face-reassign-cancel {
  font-size: 0.78rem;
  opacity: 0.7;
}
/* --- Content Safety (NSFW) --- */
.nsfw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 8px 0;
}
.nsfw-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
  user-select: none;
}
.nsfw-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent);
}
.nsfw-card-selected {
  border-color: var(--color-accent);
  background: rgba(var(--color-accent-rgb, 255,255,255), 0.06);
  box-shadow: 0 0 0 1px var(--color-accent);
}
.nsfw-card-restricted {
  border-color: rgba(220, 80, 80, 0.4);
}
.nsfw-card-thumb {
  position: relative;
  overflow: hidden;
  background: var(--color-bg);
}
.nsfw-card-thumb img {
  width: 100%;
  display: block;
  aspect-ratio: 1;
  object-fit: cover;
}
.nsfw-card-check {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  accent-color: var(--color-accent);
  cursor: pointer;
  width: 16px;
  height: 16px;
}
.nsfw-conf-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
}
.nsfw-detection-overlay {
  position: absolute;
  border: 2px solid rgba(255, 60, 60, 0.7);
  background: rgba(255, 60, 60, 0.08);
  border-radius: 3px;
  pointer-events: none;
}
.nsfw-card-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nsfw-card-classes {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.nsfw-class-label {
  background: rgba(220, 80, 80, 0.15);
  color: #dc5050;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-transform: uppercase;
}
.nsfw-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}
.nsfw-card-filename {
  font-size: 11px;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.nsfw-user-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--color-border);
}
.nsfw-user-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.nsfw-user-chip {
  background: var(--color-accent-soft);
  color: var(--color-text);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 3px;
}
.nsfw-user-chip button {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  line-height: 1;
}
.nsfw-user-dropdown {
  position: absolute;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.nsfw-user-option {
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}
.nsfw-user-option:hover {
  background: var(--color-accent-soft);
}
.nsfw-pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  padding: 8px 0;
  flex-wrap: wrap;
}
.nsfw-pagination .admin-btn-sm.active {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
}
/* NSFW: tablet */
@media (max-width: 768px) {
  .nsfw-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
  }
  .nsfw-user-picker {
    flex-direction: column;
    align-items: flex-start;
  }
  .nsfw-user-search {
    width: 100% !important;
  }
}
/* NSFW: phone */
@media (max-width: 480px) {
  .nsfw-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .nsfw-card-info {
    padding: 5px 6px;
  }
  .nsfw-class-label {
    font-size: 0.5rem;
    padding: 1px 3px;
  }
  .nsfw-card-meta span {
    font-size: 9px !important;
  }
  .nsfw-detection-overlay {
    border-width: 1px;
  }
}
/* NSFW: small phone */
@media (max-width: 380px) {
  .nsfw-grid {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }
}

/* ── Person Mapping Pet Badge ─────────────────────────────────────────── */
.pm-pet-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: capitalize;
}

/* ── Pet Detection ────────────────────────────────────────────────────────── */
.pet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  padding: 8px 0;
}
.pet-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
  user-select: none;
}
.pet-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent);
}
.pet-card-selected {
  border-color: var(--color-accent);
  background: rgba(var(--color-accent-rgb, 255,255,255), 0.06);
  box-shadow: 0 0 0 1px var(--color-accent);
}
.pet-card-thumb {
  position: relative;
  overflow: hidden;
  background: var(--color-bg);
}
.pet-card-thumb img {
  width: 100%;
  display: block;
  aspect-ratio: 1;
  object-fit: cover;
}
.pet-card-check {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  accent-color: var(--color-accent);
  cursor: pointer;
  width: 16px;
  height: 16px;
}
.pet-bbox-overlay {
  position: absolute;
  border: 2px solid rgba(34, 197, 94, 0.8);
  background: rgba(34, 197, 94, 0.06);
  border-radius: 3px;
  pointer-events: none;
}
.pet-class-badge {
  position: absolute;
  top: 6px;
  left: 30px;
  z-index: 2;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}
.pet-conf-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
}
.pet-card-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pet-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}
.pet-card-filename {
  font-size: 11px;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.pet-person-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.pet-person-option {
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}
.pet-person-option:hover {
  background: var(--color-accent-soft);
}
@media (max-width: 768px) {
  .pet-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
  }
}
@media (max-width: 480px) {
  .pet-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .pet-card-info { padding: 5px 6px; }
  .pet-bbox-overlay { border-width: 1px; }
}

/* ── Rotation Check ──────────────────────────────────────────────────────── */
.rotation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 12px;
  padding: 8px 0;
}
.rotation-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
  user-select: none;
}
.rotation-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent);
}
.rotation-card-selected {
  border-color: var(--color-accent);
  background: rgba(var(--color-accent-rgb, 255,255,255), 0.06);
  box-shadow: 0 0 0 1px var(--color-accent);
}
.rotation-comparison {
  display: flex;
  gap: 2px;
}
.rotation-current,
.rotation-preview {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--color-bg);
}
.rotation-current img,
.rotation-preview img {
  width: 100%;
  display: block;
  aspect-ratio: 1;
  object-fit: cover;
}
.rotation-label-tag {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}
.rotation-card-check {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  accent-color: var(--color-accent);
  cursor: pointer;
  width: 16px;
  height: 16px;
}
.rotation-card-info {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.rotation-fix-label {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.rotation-card-filename {
  font-size: 11px;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.rotation-fix-all-btn {
  background: var(--color-warning, #f59e0b) !important;
  color: #000 !important;
  border-color: var(--color-warning, #f59e0b) !important;
}
@media (max-width: 768px) {
  .rotation-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 8px;
  }
}
@media (max-width: 480px) {
  .rotation-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .rotation-comparison {
    flex-direction: column;
  }
  .rotation-card-info { padding: 5px 6px; font-size: 10px; }
}

/* --- AI / Face Recognition: Tablet (768px) --- */
@media (max-width: 768px) {
  .ai-sub-tab {
    padding: 0.55rem 0.85rem;
    font-size: 0.75rem;
    gap: 0.3rem;
  }
  .ai-sub-tab svg { width: 14px; height: 14px; }
  .ai-sub-tab-coming-soon::after { font-size: 0.5rem; }
  .face-stats-bar {
    grid-template-columns: repeat(3, 1fr);
  }
  .face-filter-bar {
    gap: 0.3rem;
  }
  .face-status-btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.65rem;
  }
  .face-scan-controls {
    gap: 0.5rem;
  }
  .face-scan-btn {
    padding: 0.35rem 0.8rem;
  }
}
/* --- AI / Face Recognition: Phone (600px) --- */
@media (max-width: 600px) {
  /* AI sub-tab nav */
  .ai-sub-nav {
    margin-bottom: 0.6rem;
    gap: 0;
  }
  .ai-sub-tab {
    padding: 0.5rem 0.65rem;
    font-size: 0.72rem;
    gap: 0.25rem;
  }
  .ai-sub-tab svg { width: 13px; height: 13px; }
  .ai-sub-tab-coming-soon::after { font-size: 0.45rem; padding: 0.05rem 0.2rem; }
  /* Section header + scan controls */
  .face-section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
  }
  .face-scan-controls {
    flex-wrap: wrap;
    width: 100%;
    gap: 0.4rem;
  }
  .face-scan-btn {
    flex: 1;
    min-width: 0;
    text-align: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
  .face-scan-status {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  .face-scan-progress-bar {
    width: 100%;
    height: 5px;
    order: -1;
  }
  .face-scan-progress-text {
    font-size: 0.65rem;
  }
  /* Stats bar */
  .face-stats-bar {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
  }
  .face-stat-card {
    padding: 0.4rem 0.25rem;
  }
  .face-stat-value {
    font-size: 0.95rem;
  }
  /* Filter bar: wrap into rows */
  .face-filter-bar {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 0.3rem 0.25rem;
    padding: 0.35rem 0;
  }
  .face-person-filter {
    flex: 1;
    min-width: 120px;
  }
  .face-status-toggles {
    order: 0;
  }
  .face-status-btn {
    padding: 0.25rem 0.4rem;
    font-size: 0.65rem;
    height: 28px;
  }
  .face-confidence-filter {
    height: 28px;
  }
  .face-conf-slider {
    width: 60px;
  }
  .face-perpage-filter {
    height: 28px !important;
  }
  .face-filter-bar .admin-input {
    height: 28px;
  }
  .face-filter-spacer {
    display: none;
  }
  .face-filter-right {
    width: 100%;
    justify-content: space-between;
    margin-top: 0.15rem;
  }
  .face-filter-pag .pagination-btn {
    font-size: 0.6rem;
    padding: 0.15rem 0.3rem;
    height: 26px;
  }
  .face-filter-pag .pagination-info {
    font-size: 0.6rem;
  }
  /* Face card grid */
  .face-grid {
    gap: 0.75rem;
  }
  .face-cards {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.4rem;
  }
  .face-card {
    padding: 0.4rem;
    gap: 0.25rem;
    border-radius: var(--radius-sm);
  }
  .face-crop {
    width: 64px;
    height: 64px;
  }
  .confidence-badge {
    font-size: 0.58rem;
    padding: 0.05rem 0.3rem;
  }
  .face-card-title {
    font-size: 0.62rem;
  }
  .face-card-check {
    width: 16px;
    height: 16px;
  }
  /* Group headers */
  .face-group-header {
    padding: 0.3rem 0;
    gap: 0.35rem;
  }
  .face-group-name {
    font-size: 0.78rem;
  }
  .face-group-count {
    font-size: 0.62rem;
  }
  .face-group-select-all {
    font-size: 0.6rem;
    padding: 0.15rem 0.35rem;
  }
  /* Bulk action bar — touch-friendly */
  .face-bulk-bar {
    padding: 0.5rem 0.6rem;
    gap: 0.4rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
  }
  .face-bulk-bar .admin-btn,
  .face-bulk-bar .admin-btn-sm {
    padding: 0.4rem 0.7rem;
    font-size: 0.72rem;
  }
  .face-bulk-approve,
  .face-bulk-reject,
  .face-bulk-reassign {
    flex: 1;
    text-align: center;
    padding: 0.45rem 0.5rem;
  }
  .face-reassign-panel {
    flex-wrap: wrap;
    width: 100%;
  }
  .face-reassign-input {
    width: 100%;
    flex: 1;
  }
  /* Bottom pagination */
  .face-grid + .pagination {
    padding: 1rem 0;
    gap: 0.4rem;
  }
  .face-grid + .pagination .pagination-btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.7rem;
  }
}
/* --- AI / Face Recognition: Small phone (380px) --- */
@media (max-width: 380px) {
  .face-stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .face-cards {
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  }
  .face-crop {
    width: 56px;
    height: 56px;
  }
  .face-status-toggles {
    width: 100%;
  }
  .face-status-btn {
    flex: 1;
    text-align: center;
  }
  .ai-sub-tab {
    padding: 0.45rem 0.5rem;
    font-size: 0.65rem;
  }
  .ai-sub-tab svg { width: 12px; height: 12px; }
  .face-scan-progress-text {
    font-size: 0.6rem;
  }
}

/* ── Semantic Search (CLIP) ─────────────────────────────────────────────── */

.clip-search-area {
  margin-top: 1.2rem;
}

.clip-search-input-wrap {
  position: relative;
  margin-bottom: 1rem;
}

.clip-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.4;
  pointer-events: none;
}

.clip-search-input {
  width: 100%;
  padding: 0.75rem 0.75rem 0.75rem 2.5rem !important;
  font-size: 0.9rem !important;
  border-radius: 8px !important;
  box-sizing: border-box;
}

.clip-sample-queries {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 1rem;
}

.clip-sample-label {
  font-size: 0.7rem;
  color: var(--color-text-tertiary, #666);
  margin-right: 2px;
}

.clip-sample-chip {
  background: var(--color-bg-secondary, #1a1a1a);
  border: 1px solid var(--color-border, #333);
  color: var(--color-text-secondary, #aaa);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.68rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.clip-sample-chip:hover {
  background: var(--color-bg-tertiary, #252525);
  color: var(--color-text-primary, #eee);
  border-color: var(--color-text-tertiary, #666);
}

.clip-search-results-info {
  font-size: 0.75rem;
  color: var(--color-text-secondary, #888);
  margin-bottom: 0.75rem;
}

.clip-search-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.clip-result-card {
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-bg-secondary, #1a1a1a);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.clip-result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.clip-result-thumb-wrap {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--color-bg-tertiary, #111);
}

.clip-result-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.clip-result-score {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.clip-result-video-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0,0,0,0.6);
  border-radius: 4px;
  padding: 2px 5px;
  color: #fff;
  line-height: 1;
}

.clip-result-title {
  padding: 6px 8px 4px;
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-primary, #eee);
}

.clip-result-caption {
  padding: 0 8px 6px;
  font-size: 0.65rem;
  color: var(--color-text-secondary, #888);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clip-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--color-text-secondary, #888);
  font-size: 0.8rem;
}

.clip-result-skeleton {
  aspect-ratio: 4/3;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--color-bg-secondary, #1a1a1a) 25%, var(--color-bg-tertiary, #222) 50%, var(--color-bg-secondary, #1a1a1a) 75%);
  background-size: 200% 100%;
  animation: clipShimmer 1.5s infinite;
}

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

/* Search overlay semantic results */
.search-semantic-separator {
  padding: 0.5rem 0.75rem 0.3rem;
  font-size: 0.7rem;
  color: var(--color-text-tertiary, #666);
  border-top: 1px solid var(--color-border, #333);
  margin-top: 0.25rem;
  cursor: default;
  display: flex;
  align-items: center;
  gap: 2px;
}

.search-semantic-separator:hover {
  background: transparent !important;
}

.search-semantic-pill {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 600;
  color: #fff;
  margin-left: 6px;
  vertical-align: middle;
}

@media (max-width: 900px) {
  .clip-search-results {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .clip-search-results {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .clip-result-title { font-size: 0.65rem; }
}

/* =============================================================================
   OCR Text Recognition
   ============================================================================= */

/* Recent findings preview */
.ocr-recent-area {
  margin-top: 1rem;
}
.ocr-recent-header h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary, #aaa);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.6rem 0;
}
.ocr-recent-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}
.ocr-recent-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  background: var(--color-surface-hover, #1a1a2e);
  border: 1px solid var(--color-border, #333);
  border-radius: 6px;
  color: var(--color-text-primary, #e0e0e0);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ocr-recent-tag:hover {
  background: var(--color-accent, #6366f1);
  border-color: var(--color-accent, #6366f1);
  color: #fff;
}
.ocr-recent-tag-count {
  font-size: 0.65rem;
  opacity: 0.5;
  font-weight: 600;
}
.ocr-recent-thumbs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.ocr-recent-thumb {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  transition: transform 0.15s ease;
}
.ocr-recent-thumb:hover {
  transform: scale(1.04);
}
.ocr-recent-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ocr-recent-thumb-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 4px;
  background: rgba(0,0,0,0.75);
  color: #e0e0e0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 768px) {
  .ocr-recent-thumbs {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 480px) {
  .ocr-recent-thumbs {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ocr-search-area {
  margin-top: 1.2rem;
}

.ocr-search-input-wrap {
  position: relative;
  margin-bottom: 1rem;
}

.ocr-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.4;
  pointer-events: none;
}

.ocr-search-input {
  width: 100%;
  padding: 0.75rem 0.75rem 0.75rem 2.5rem !important;
  font-size: 0.9rem !important;
  border-radius: 8px !important;
  box-sizing: border-box;
}

.ocr-sample-queries {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 1rem;
}

.ocr-sample-label {
  font-size: 0.7rem;
  color: var(--color-text-tertiary, #666);
  margin-right: 2px;
}

.ocr-sample-chip {
  background: var(--color-bg-secondary, #1a1a1a);
  border: 1px solid var(--color-border, #333);
  color: var(--color-text-secondary, #aaa);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.68rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.ocr-sample-chip:hover {
  background: var(--color-bg-tertiary, #252525);
  color: var(--color-text-primary, #eee);
  border-color: var(--color-text-tertiary, #666);
}

.ocr-search-results-info {
  font-size: 0.75rem;
  color: var(--color-text-secondary, #888);
  margin-bottom: 0.75rem;
}

.ocr-search-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.ocr-result-card {
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-bg-secondary, #1a1a1a);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ocr-result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.ocr-result-thumb-wrap {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--color-bg-tertiary, #111);
}

.ocr-result-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ocr-confidence-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.ocr-word-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0,0,0,0.65);
  border-radius: 4px;
  padding: 2px 6px;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 500;
  line-height: 1.3;
}

.ocr-result-title {
  padding: 6px 8px 2px;
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-primary, #eee);
}

.ocr-text-snippet {
  padding: 2px 8px 6px;
  font-size: 0.63rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--color-text-tertiary, #777);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.ocr-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--color-text-secondary, #888);
  font-size: 0.8rem;
}

.ocr-result-skeleton {
  aspect-ratio: 4/3;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--color-bg-secondary, #1a1a1a) 25%, var(--color-bg-tertiary, #222) 50%, var(--color-bg-secondary, #1a1a1a) 75%);
  background-size: 200% 100%;
  animation: clipShimmer 1.5s infinite;
}

/* Global search OCR integration */
.search-ocr-separator {
  padding: 0.5rem 0.75rem 0.3rem;
  font-size: 0.7rem;
  color: var(--color-text-tertiary, #666);
  border-top: 1px solid var(--color-border, #333);
  margin-top: 0.25rem;
  cursor: default;
  display: flex;
  align-items: center;
  gap: 2px;
}

.search-ocr-separator:hover {
  background: transparent !important;
}

.search-ocr-pill {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 600;
  color: #fff;
  margin-left: 6px;
  vertical-align: middle;
  background: #6366f1;
}

.search-ocr-snippet {
  display: block;
  font-size: 0.62rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--color-text-tertiary, #777);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

@media (max-width: 900px) {
  .ocr-search-results {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .ocr-search-results {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .ocr-result-title { font-size: 0.65rem; }
  .ocr-text-snippet { font-size: 0.58rem; }
}


/* ============================================
   Keyboard Shortcut Overlay (?-key)
   ============================================ */

#shortcut-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

#shortcut-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.shortcut-overlay-inner {
  max-width: 640px;
  width: 90%;
  padding: 2rem 2.5rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
}

.shortcut-overlay-inner h2 {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 1.5rem;
  text-align: center;
}

.shortcut-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 2.5rem;
}

.shortcut-group h3 {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--color-border);
}

.shortcut-group-admin h3 {
  color: var(--color-accent);
  border-bottom-color: rgba(212, 168, 83, 0.25);
}

.shortcut-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
  font-size: 0.8rem;
  color: var(--color-text);
}

.shortcut-row span {
  margin-left: auto;
  color: var(--color-text-secondary);
  font-size: 0.75rem;
}

.shortcut-row kbd,
.shortcut-hint-text kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0.15em 0.45em;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-align: center;
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  line-height: 1.4;
}

.shortcut-hint-text {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

@media (max-width: 600px) {
  .shortcut-columns {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  .shortcut-overlay-inner {
    padding: 1.5rem;
  }
}

/* ── File Integrity Admin ───────────────────────────────────────────────────── */

/* ============================================
   Backup Section
   ============================================ */

.backup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.backup-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.backup-subtitle {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.5;
}

.backup-subtitle code {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.75rem;
  background: var(--color-border);
  padding: 1px 5px;
  border-radius: 3px;
}

.backup-run-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.backup-run-btn:hover:not(:disabled) { opacity: 0.85; }
.backup-run-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.backup-log {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  min-height: 80px;
  font-size: 0.8125rem;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  line-height: 1.7;
}

.backup-log-idle {
  color: var(--color-text-muted);
  font-family: inherit;
  font-style: normal;
}

.backup-log-idle em { font-style: italic; }

.backup-log-line { display: flex; align-items: center; gap: 0.5rem; }

.backup-log-ts   { color: var(--color-text-muted); font-size: 0.75rem; }
.backup-log-dim  { color: var(--color-text-muted); }

.backup-log-running { color: var(--color-text-secondary); }

.backup-log-ok   { color: #4caf82; font-weight: 600; }

.backup-log-filename {
  color: var(--color-text-primary);
  padding-left: 1.25rem;
}

.backup-log-error      { color: #e05c5c; font-weight: 600; }
.backup-log-error-detail {
  color: #c07070;
  padding-left: 1.25rem;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.backup-log-missing { display: flex; flex-direction: column; gap: 0.4rem; }

.backup-log-install {
  color: var(--color-text-secondary);
  font-family: inherit;
  font-size: 0.8125rem;
}

.backup-log-cmd {
  display: inline-block;
  background: var(--color-border);
  color: var(--color-text-primary);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  user-select: all;
}

/* Age warning banner */
.backup-age-warn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.6rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.backup-age-warn svg { flex-shrink: 0; }

.backup-age-warn-stale {
  background: rgba(212, 168, 83, 0.1);
  border: 1px solid rgba(212, 168, 83, 0.3);
  color: var(--color-accent);
}

.backup-age-warn-none {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

/* Backup list */
.bk-list-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
}

.bk-list-title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0;
}

.bk-list-meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.bk-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.bk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.bk-table thead th {
  padding: 0.5rem 0.875rem;
  text-align: left;
  font-weight: 500;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.bk-table tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background 0.1s;
}

.bk-table tbody tr:last-child { border-bottom: none; }
.bk-table tbody tr:hover { background: var(--color-surface); }

.bk-table td {
  padding: 0.6rem 0.875rem;
  vertical-align: middle;
}

.bk-col-name { width: 50%; }
.bk-col-size { width: 12%; white-space: nowrap; color: var(--color-text-secondary); }
.bk-col-date { width: 28%; white-space: nowrap; color: var(--color-text-secondary); font-size: 0.75rem; }
.bk-col-action { width: 15%; }

.bk-filename {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.75rem;
  color: var(--color-text-primary);
  word-break: break-all;
}

.bk-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

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

.bk-col-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.375rem;
}

.bk-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.45rem;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.bk-del-btn:hover:not(:disabled) {
  color: #e05c5c;
  border-color: #e05c5c;
}

.bk-del-btn:disabled { opacity: 0.4; cursor: not-allowed; }


.backup-spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--color-text-muted);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.integrity-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.integrity-header-left { flex: 1; min-width: 0; }
.integrity-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--color-text);
}
.integrity-title svg { stroke: var(--color-accent); flex-shrink: 0; }
.integrity-subtitle {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin: 0;
}
.integrity-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* Scan button — matches admin-btn admin-btn-add pattern */
.integrity-scan-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.4rem 1rem;
  background: var(--color-accent);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s;
  white-space: nowrap;
}
.integrity-scan-btn:hover { opacity: .85; }
.integrity-scan-btn:disabled { opacity: .5; cursor: not-allowed; }
.integrity-scan-btn-stop { background: #e74c3c !important; color: #fff !important; }
.integrity-scan-btn-stop:hover { background: #c0392b !important; opacity: 1 !important; }
.integrity-last-scan {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

/* Progress */
.integrity-progress-wrap { margin-bottom: 1.25rem; }
.integrity-progress-bar-track {
  height: 3px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}
.integrity-progress-bar-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width .4s ease;
}
.integrity-progress-text { font-size: 0.72rem; color: var(--color-text-secondary); }

/* Stats cards — matches admin-activity-grid pattern */
.integrity-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.integrity-stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}
.integrity-stat-num {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--color-text);
}
.integrity-stat-lbl {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.integrity-stat-ok .integrity-stat-num      { color: #4ade80; }
.integrity-stat-changed .integrity-stat-num  { color: var(--color-accent); }
.integrity-stat-missing .integrity-stat-num  { color: #f87171; }

/* Filter bar — matches admin-btn-sm pattern */
.integrity-filter-bar {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.integrity-filter-btn {
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: border-color .15s, color .15s;
}
.integrity-filter-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.integrity-filter-btn.active {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-safelight-dim);
}

/* Table */
.integrity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.integrity-table thead th {
  text-align: left;
  padding: 8px 10px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.integrity-table tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.integrity-row { transition: background .1s; }
.integrity-row:hover td { background: rgba(255,255,255,0.03); }
.integrity-thumb {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--color-border);
  flex-shrink: 0;
}
.integrity-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.integrity-filename {
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  display: inline;
}
a.integrity-filename:hover { color: var(--color-accent); }
.integrity-dir {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
  /* hash-copyable provides position:relative and hover/copied styles */
}
.integrity-size { color: var(--color-text-secondary); white-space: nowrap; font-size: 0.75rem; }
.integrity-dt  { color: var(--color-text-muted); white-space: nowrap; font-size: 0.7rem; }
.integrity-hash {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.68rem;
  color: var(--color-text-muted);
  cursor: copy;
}
.integrity-hash:hover { color: var(--color-text-secondary); }
.integrity-hash-full {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.68rem;
  color: var(--color-text-secondary);
  letter-spacing: 0.03em;
  word-spacing: 0.4em;
  line-height: 1.6;
  display: inline-block;
  /* hash-copyable overrides are applied via that class */
}

/* Status badges */
.integrity-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.integrity-badge-ok      { background: rgba(74,222,128,.12); color: #4ade80; border: 1px solid rgba(74,222,128,.2); }
.integrity-badge-changed { background: var(--color-safelight-dim); color: var(--color-accent); border: 1px solid rgba(212,168,83,.25); }
.integrity-badge-missing { background: rgba(248,113,113,.1); color: #f87171; border: 1px solid rgba(248,113,113,.2); }

/* Expanded history row */
.integrity-history-row td { padding: 0; }
.integrity-history-inner {
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border-top: 1px solid var(--color-border);
  font-size: 0.75rem;
}
.integrity-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}
.integrity-history-table th {
  text-align: left;
  padding: 5px 8px;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--color-border);
}
.integrity-history-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

/* Empty / all-clear states */
.integrity-all-clear { text-align: center; padding: 3rem 1rem; }
.integrity-all-clear svg { display: block; margin: 0 auto 12px; stroke: #4ade80; }
.integrity-all-clear p { color: #4ade80; font-weight: 600; font-size: 0.9rem; margin: 0; }
.integrity-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-secondary);
}
.integrity-empty-state svg { display: block; margin: 0 auto 12px; opacity: .3; }
.integrity-empty-state p { margin: 0; font-size: 0.85rem; }
.integrity-empty-msg { color: var(--color-text-muted); font-size: 0.8rem; padding: 1.5rem 0; }
.integrity-error { color: #f87171; font-size: 0.8rem; padding: 1rem 0; }
.integrity-pagination { padding: 0.5rem 0; }

/* Scope input + scan row */
.integrity-scope-row { width: 100%; margin-bottom: 6px; position: relative; }
.integrity-dir-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface-raised, var(--color-surface));
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.integrity-dir-option {
  padding: 0.3rem 0.75rem;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.integrity-dir-option:hover,
.integrity-dir-option.active { background: var(--color-accent-subtle, rgba(99,102,241,0.12)); color: var(--color-text); }
.integrity-dir-input {
  width: 100%;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  box-sizing: border-box;
  transition: border-color .15s;
}
.integrity-dir-input::placeholder { color: var(--color-text-muted); }
.integrity-dir-input:focus { outline: none; border-color: var(--color-accent); color: var(--color-text); }
.integrity-scan-row { display: flex; align-items: center; gap: 10px; }
.integrity-start-over {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  text-decoration: none;
  white-space: nowrap;
}
.integrity-start-over:hover { color: var(--color-text); }

/* Ingest hash reference block */
.integrity-ingest-ref {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 7px 10px;
  margin-bottom: 10px;
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: var(--radius-sm);
}
.integrity-ingest-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.integrity-ingest-dt {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.integrity-hash-matches-ingest { color: #4ade80 !important; }

/* Show more scans button */
.integrity-showmore-btn {
  display: block;
  margin: 8px 0 0;
  padding: 0.3rem 0.75rem;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.integrity-showmore-btn:hover { color: var(--color-text); border-color: var(--color-text-muted); }

/* Per-file rescan */
.integrity-history-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.integrity-rescan-btn {
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: transparent;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: border-color .15s, color .15s;
}
.integrity-rescan-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.integrity-rescan-btn:disabled { opacity: .4; cursor: not-allowed; }
.integrity-rescan-status { font-size: 0.7rem; color: var(--color-text-muted); }

@media (max-width: 900px) {
  .integrity-stats { grid-template-columns: repeat(2, 1fr); }
  .integrity-header { flex-direction: column; }
  .integrity-header-right { align-items: flex-start; width: 100%; }
  .integrity-dir-input { width: 100%; }
}
@media (max-width: 600px) {
  .integrity-stats { grid-template-columns: repeat(2, 1fr); }
  .integrity-table thead th:nth-child(3),
  .integrity-table tbody td:nth-child(3),
  .integrity-table thead th:nth-child(6),
  .integrity-table tbody td:nth-child(6) { display: none; }
}
