/* ===================================================
   GOOGLE MATERIAL DESIGN 3 (M3) DESIGN SYSTEM
   Instagram Media Manager & Cleaner Pro
   Expressive, Tonal Surface Architecture & Motion
   =================================================== */

/* ===================================================
   1. M3 DESIGN TOKENS, TONAL PALETTES & ELEVATION
   =================================================== */
:root {
  /* M3 Typography Scale */
  --font-sans: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'Roboto Mono', ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;

  /* M3 Color System (Dark Theme Defaults) */
  --md-sys-color-primary: #a8c7fa;
  --md-sys-color-on-primary: #042b67;
  --md-sys-color-primary-container: #0842a0;
  --md-sys-color-on-primary-container: #d3e3fd;

  --md-sys-color-secondary: #c2e7ff;
  --md-sys-color-on-secondary: #003355;
  --md-sys-color-secondary-container: #004a77;
  --md-sys-color-on-secondary-container: #c2e7ff;

  --md-sys-color-tertiary: #d4bbff;
  --md-sys-color-on-tertiary: #381e72;
  --md-sys-color-tertiary-container: #4f378b;
  --md-sys-color-on-tertiary-container: #eedcff;

  --md-sys-color-error: #f2b8b5;
  --md-sys-color-on-error: #601410;
  --md-sys-color-error-container: #8c1d18;
  --md-sys-color-on-error-container: #f9dedc;

  /* M3 Surface Tonal Elevation (Dark) */
  --md-sys-color-surface: #0b132b;
  --md-sys-color-surface-dim: #0b0f19;
  --md-sys-color-surface-bright: #1e293b;
  --md-sys-color-surface-container-lowest: #060911;
  --md-sys-color-surface-container-low: #0c1220;
  --md-sys-color-surface-container: #121a2d;
  --md-sys-color-surface-container-high: #18233c;
  --md-sys-color-surface-container-highest: #202e4d;

  --md-sys-color-on-surface: #e2e8f0;
  --md-sys-color-on-surface-variant: #94a3b8;
  --md-sys-color-outline: rgba(255, 255, 255, 0.16);
  --md-sys-color-outline-variant: rgba(255, 255, 255, 0.08);

  /* M3 State Layers */
  --md-sys-state-hover: rgba(255, 255, 255, 0.08);
  --md-sys-state-focus: rgba(255, 255, 255, 0.12);
  --md-sys-state-pressed: rgba(255, 255, 255, 0.14);
  --md-sys-state-dragged: rgba(255, 255, 255, 0.16);

  /* Legacy & Semantic Mapping */
  --bg-canvas: var(--md-sys-color-surface-container-lowest);
  --bg-card: var(--md-sys-color-surface-container-low);
  --bg-card-hover: var(--md-sys-color-surface-container);
  --bg-surface: var(--md-sys-color-surface-container);
  --bg-surface-hover: var(--md-sys-color-surface-container-high);
  --bg-darkroom: #05070c;

  --border-subtle: var(--md-sys-color-outline-variant);
  --border-hover: var(--md-sys-color-outline);
  --border-focus: var(--md-sys-color-primary);
  --ring-selected: var(--md-sys-color-primary);

  --text-primary: var(--md-sys-color-on-surface);
  --text-secondary: var(--md-sys-color-on-surface-variant);
  --text-muted: #64748b;

  --color-primary: var(--md-sys-color-primary);
  --color-primary-hover: #7baaf7;
  --color-primary-glow: rgba(168, 199, 250, 0.25);
  --color-danger: #f43f5e;
  --color-danger-hover: #fb7185;
  --color-danger-glow: rgba(244, 63, 94, 0.35);
  --color-amber: #fbbc04;
  --color-success: #34a853;

  /* M3 Elevation Shadow Tokens */
  --md-sys-elevation-0: none;
  --md-sys-elevation-1: 0 1px 3px 1px rgba(0, 0, 0, 0.2), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --md-sys-elevation-2: 0 2px 6px 2px rgba(0, 0, 0, 0.2), 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --md-sys-elevation-3: 0 4px 8px 3px rgba(0, 0, 0, 0.25), 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --md-sys-elevation-4: 0 6px 10px 4px rgba(0, 0, 0, 0.3), 0 2px 3px 0 rgba(0, 0, 0, 0.45);
  --md-sys-elevation-5: 0 8px 12px 6px rgba(0, 0, 0, 0.35), 0 4px 4px 0 rgba(0, 0, 0, 0.5);

  --shadow-sm: var(--md-sys-elevation-1);
  --shadow-md: var(--md-sys-elevation-2);
  --shadow-lg: var(--md-sys-elevation-3);
  --shadow-floating: var(--md-sys-elevation-4), 0 0 0 1px var(--md-sys-color-outline-variant);

  /* M3 Shape Corner Tokens */
  --md-shape-none: 0px;
  --md-shape-xs: 4px;
  --md-shape-sm: 8px;
  --md-shape-md: 12px;
  --md-shape-lg: 16px;
  --md-shape-xl: 28px;
  --md-shape-full: 9999px;

  --radius-sm: var(--md-shape-xs);
  --radius-md: var(--md-shape-sm);
  --radius-lg: var(--md-shape-lg);
  --radius-full: var(--md-shape-full);

  /* M3 Motion & Easing Tokens */
  --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1);
  --md-sys-motion-easing-emphasized-accelerate: cubic-bezier(0.3, 0, 0.8, 0.15);
  --md-sys-motion-duration-short: 150ms;
  --md-sys-motion-duration-medium: 250ms;
  --md-sys-motion-duration-long: 400ms;

  --transition-fast: var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-emphasized);
  --transition-smooth: var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

body.light-theme {
  /* M3 Color System (Light Theme) */
  --md-sys-color-primary: #0b57d0;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d3e3fd;
  --md-sys-color-on-primary-container: #041e49;

  --md-sys-color-secondary: #00639b;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #c2e7ff;
  --md-sys-color-on-secondary-container: #001d32;

  --md-sys-color-error: #ba1a1a;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #ffdad6;
  --md-sys-color-on-error-container: #410002;

  /* M3 Surface Tonal Elevation (Light) */
  --md-sys-color-surface: #fdfbff;
  --md-sys-color-surface-dim: #ded8e1;
  --md-sys-color-surface-bright: #fdfbff;
  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #f7f2fa;
  --md-sys-color-surface-container: #f3edf7;
  --md-sys-color-surface-container-high: #ece6f0;
  --md-sys-color-surface-container-highest: #e6e0e9;

  --md-sys-color-on-surface: #1d1b20;
  --md-sys-color-on-surface-variant: #49454f;
  --md-sys-color-outline: rgba(0, 0, 0, 0.16);
  --md-sys-color-outline-variant: rgba(0, 0, 0, 0.08);

  /* M3 State Layers (Light) */
  --md-sys-state-hover: rgba(0, 0, 0, 0.06);
  --md-sys-state-focus: rgba(0, 0, 0, 0.1);
  --md-sys-state-pressed: rgba(0, 0, 0, 0.12);

  --bg-canvas: var(--md-sys-color-surface-container-lowest);
  --bg-card: #ffffff;
  --bg-card-hover: var(--md-sys-color-surface-container-low);
  --bg-surface: var(--md-sys-color-surface-container);
  --bg-surface-hover: var(--md-sys-color-surface-container-high);
  --bg-darkroom: #05070c;

  --border-subtle: var(--md-sys-color-outline-variant);
  --border-hover: var(--md-sys-color-outline);
  --border-focus: var(--md-sys-color-primary);
  --ring-selected: var(--md-sys-color-primary);

  --text-primary: var(--md-sys-color-on-surface);
  --text-secondary: var(--md-sys-color-on-surface-variant);
  --text-muted: #79747e;

  --color-primary: var(--md-sys-color-primary);
  --color-primary-hover: #0842a0;
  --color-primary-glow: rgba(11, 87, 208, 0.18);
  --color-danger: #e11d48;
  --color-danger-hover: #be123c;
  --color-danger-glow: rgba(225, 29, 72, 0.2);

  --md-sys-elevation-1: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
  --md-sys-elevation-2: 0 3px 6px -2px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
  --md-sys-elevation-3: 0 6px 12px -2px rgba(0, 0, 0, 0.12), 0 3px 6px -2px rgba(0, 0, 0, 0.08);
  --md-sys-elevation-4: 0 10px 18px -4px rgba(0, 0, 0, 0.14), 0 4px 8px -3px rgba(0, 0, 0, 0.1);

  --shadow-sm: var(--md-sys-elevation-1);
  --shadow-md: var(--md-sys-elevation-2);
  --shadow-lg: var(--md-sys-elevation-3);
  --shadow-floating: var(--md-sys-elevation-3), 0 0 0 1px var(--md-sys-color-outline-variant);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
  padding-bottom: 90px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

.text-danger {
  color: var(--color-danger) !important;
}

.text-muted {
  color: var(--text-muted) !important;
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

/* ===================================================
   2. APP HEADER & TOP BRANDING
   =================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.75rem;
  background-color: rgba(8, 12, 20, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  transition: background-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.app-header.scrolled {
  background-color: var(--md-sys-color-surface-container);
  box-shadow: var(--md-sys-elevation-2);
}

body.light-theme .app-header {
  background-color: rgba(255, 255, 255, 0.9);
}

body.light-theme .app-header.scrolled {
  background-color: var(--md-sys-color-surface-container);
  box-shadow: var(--md-sys-elevation-2);
}

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

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--md-shape-sm);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  flex-shrink: 0;
}

.brand-svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-stats {
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  display: block;
  margin-top: 1px;
}

.brand-stats b {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===================================================
   REAL-TIME WEBSOCKET STATUS PILL (MATERIAL 3)
   =================================================== */
.realtime-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--md-shape-full);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  background-color: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  user-select: none;
  cursor: default;
}

.realtime-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Connected state (Green pulsing glow) */
.realtime-status-pill.connected {
  border-color: rgba(52, 168, 83, 0.35);
  background-color: rgba(52, 168, 83, 0.1);
  color: #34a853;
}

body.dark-theme .realtime-status-pill.connected {
  border-color: rgba(74, 222, 128, 0.3);
  background-color: rgba(74, 222, 128, 0.12);
  color: #4ade80;
}

.realtime-status-pill.connected .realtime-dot {
  background-color: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.8);
  animation: realtimePulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Reconnecting state (Amber blinking) */
.realtime-status-pill.reconnecting {
  border-color: rgba(251, 191, 36, 0.35);
  background-color: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}

.realtime-status-pill.reconnecting .realtime-dot {
  background-color: #fbbf24;
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.8);
  animation: realtimeBlink 1s ease-in-out infinite;
}

/* Disconnected state (Muted grey) */
.realtime-status-pill.disconnected {
  border-color: var(--md-sys-color-outline-variant);
  background-color: var(--md-sys-color-surface-container);
  color: var(--text-tertiary);
  opacity: 0.7;
}

.realtime-status-pill.disconnected .realtime-dot {
  background-color: var(--text-tertiary);
  box-shadow: none;
}

@keyframes realtimePulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.8);
  }
  50% {
    transform: scale(1.25);
    opacity: 0.75;
    box-shadow: 0 0 12px rgba(74, 222, 128, 1);
  }
}

@keyframes realtimeBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@media (max-width: 600px) {
  .realtime-status-pill {
    padding: 0.35rem 0.5rem;
  }
  .realtime-label {
    display: none;
  }
}

/* ===================================================
   CLEAN NATIVE DELETE ANIMATIONS (iOS / macOS Style)
   =================================================== */

/* Card deletion: smooth shrink-down fade */
.account-card.realtime-removing {
  opacity: 0 !important;
  transform: scale(0.93) translateY(6px) !important;
  transition: opacity 0.22s cubic-bezier(0.25, 1, 0.5, 1), transform 0.22s cubic-bezier(0.25, 1, 0.5, 1) !important;
  pointer-events: none !important;
}

/* Gallery grid item deletion: clean smooth collapse */
.gallery-grid-item.realtime-removing,
.gallery-item.realtime-removing {
  opacity: 0 !important;
  transform: scale(0.88) !important;
  filter: grayscale(0.5) !important;
  transition: opacity 0.2s cubic-bezier(0.25, 1, 0.5, 1), transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), filter 0.2s ease !important;
  pointer-events: none !important;
}

/* Lightbox deletion: subtle shrink & clean dissolve */
.lightbox-slot.lightbox-deleting {
  opacity: 0 !important;
  transform: scale(0.94) translateY(6px) !important;
  transition: opacity 0.16s cubic-bezier(0.25, 1, 0.5, 1), transform 0.16s cubic-bezier(0.25, 1, 0.5, 1) !important;
  pointer-events: none !important;
}

/* ===================================================
   MATERIAL DESIGN 3 (M3) RIPPLE & STATE LAYERS
   =================================================== */
.m3-ripple-surface {
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.m3-ripple-wave {
  position: absolute;
  border-radius: 50%;
  background-color: currentColor;
  opacity: 0.16;
  pointer-events: none;
  transform: scale(0);
  animation: m3RippleAnimation 550ms cubic-bezier(0.2, 0, 0, 1) forwards;
}

@keyframes m3RippleAnimation {
  0% {
    transform: scale(0);
    opacity: 0.22;
  }
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

/* Material Icon Vector System */
.mui-icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: middle;
  fill: currentColor;
  flex-shrink: 0;
  transition: fill var(--transition-fast), transform var(--transition-fast);
}

.material-symbols-rounded {
  font-family: 'Material Symbols Rounded', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

/* Material UI Button Base (MuiButton) */
.mui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.015em;
  padding: 0.45rem 1rem;
  border-radius: var(--md-shape-full);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  transition: background-color var(--transition-fast),
              box-shadow var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast),
              transform 150ms cubic-bezier(0.2, 0, 0, 1);
}

.mui-btn:active {
  transform: scale(0.97);
}

/* Outlined Variant (M3 Outlined Button) */
.mui-btn-outlined,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.95rem;
  border-radius: var(--md-shape-full);
  background: transparent;
  border: 1px solid var(--md-sys-color-outline);
  color: var(--md-sys-color-on-surface);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.mui-btn-outlined:hover,
.btn-ghost:hover {
  background: var(--md-sys-state-hover);
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-primary);
  transform: translateY(-1px);
}

.mui-btn-outlined:active,
.btn-ghost:active {
  transform: scale(0.97);
  background: var(--md-sys-state-pressed);
}

/* Contained Primary (M3 Filled Button) */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: var(--md-shape-full);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  cursor: pointer;
  box-shadow: var(--md-sys-elevation-1);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  box-shadow: var(--md-sys-elevation-2);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: var(--md-sys-elevation-1);
}

/* Contained Danger Variant (M3 Contained Error Button) */
.mui-btn-contained-danger,
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--color-danger);
  border: 1px solid var(--color-danger);
  color: #ffffff;
  font-weight: 600;
  border-radius: var(--md-shape-full);
  padding: 0.48rem 1.15rem;
  cursor: pointer;
  box-shadow: var(--md-sys-elevation-2);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.mui-btn-contained-danger:hover,
.btn-danger:hover {
  background-color: var(--color-danger-hover);
  border-color: var(--color-danger-hover);
  box-shadow: var(--md-sys-elevation-3);
  transform: translateY(-1px);
}

.mui-btn-contained-danger:active,
.btn-danger:active {
  transform: translateY(0) scale(0.97);
  box-shadow: var(--md-sys-elevation-1);
}

/* Text Variant (M3 Text Button) */
.mui-btn-text {
  background: transparent;
  border-color: transparent;
  color: var(--md-sys-color-primary);
  font-weight: 500;
  border-radius: var(--md-shape-full);
}

.mui-btn-text:hover {
  background: var(--md-sys-state-hover);
}

/* Material UI Standard Icon Button (M3 Icon Button) */
.mui-icon-btn,
.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  position: relative;
  overflow: hidden;
}

.mui-icon-btn:hover,
.btn-icon:hover {
  background: var(--md-sys-state-hover);
  border-color: var(--md-sys-color-outline);
  color: var(--md-sys-color-primary);
  transform: scale(1.05);
}

.mui-icon-btn:active,
.btn-icon:active {
  transform: scale(0.94);
  background: var(--md-sys-state-pressed);
}

/* M3 Icon Button Danger Tonal */
.mui-icon-btn-danger {
  color: var(--md-sys-color-error);
}

.mui-icon-btn-danger:hover {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  border-color: var(--md-sys-color-error);
}

.mui-icon-btn-danger:active {
  background-color: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
}

/* ===================================================
   2.5 MATERIAL DESIGN 3 - PLATFORM SWITCHER BAR
   =================================================== */
.platform-bar {
  background: var(--md-sys-color-surface-container-low);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  position: sticky;
  top: 56px;
  z-index: 95;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color var(--transition-normal);
}

.platform-bar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.platform-bar-inner::-webkit-scrollbar {
  display: none;
}

.platform-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  height: 44px;
  padding: 0 1.1rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  position: relative;
  user-select: none;
  border-radius: var(--md-shape-sm) var(--md-shape-sm) 0 0;
}

.platform-tab:hover {
  background: var(--md-sys-state-hover);
  color: var(--md-sys-color-on-surface);
}

.platform-tab:active {
  transform: scale(0.98);
}

.platform-tab.active {
  color: var(--md-sys-color-primary);
  border-bottom-color: var(--md-sys-color-primary);
  background: rgba(168, 199, 250, 0.08);
}

.platform-tab .platform-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transition: transform var(--transition-fast);
}

.platform-tab.active .platform-icon {
  transform: scale(1.1);
}

.platform-tab-label {
  letter-spacing: 0.01em;
}

.platform-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  transition: all var(--transition-fast);
}

.platform-tab.active .platform-tab-badge {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

/* ===================================================
   3. UNIFIED COMMAND BAR (M3 SEARCH & FILTER DOCK)
   =================================================== */
.command-bar {
  padding: 0.85rem 1.75rem;
  background-color: var(--md-sys-color-surface-container);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  transition: background-color var(--transition-smooth);
}

.command-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

/* Search input with Ctrl+K - M3 Search View Capsule */
.search-wrap {
  flex: 1 1 260px;
  min-width: 220px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrap .search-icon {
  position: absolute;
  left: 0.95rem;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 1rem;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.search-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 4.6rem 0 2.85rem;
  background-color: var(--md-sys-color-surface-container-highest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-shape-full);
  color: var(--md-sys-color-on-surface);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.search-wrap input::placeholder {
  color: var(--md-sys-color-on-surface-variant);
  opacity: 0.75;
}

.search-wrap input:hover {
  border-color: var(--md-sys-color-outline);
}

.search-wrap input:focus {
  background-color: var(--md-sys-color-surface-container-high);
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px var(--md-sys-color-primary);
}

.search-wrap input:focus ~ .search-icon {
  color: var(--md-sys-color-primary);
}

.kbd-hint {
  position: absolute;
  right: 2.4rem;
  padding: 2px 7px;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-shape-xs);
  pointer-events: none;
}

.btn-clear {
  position: absolute;
  right: 0.75rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.btn-clear:hover {
  background: var(--md-sys-state-hover);
  color: var(--md-sys-color-on-surface);
}

/* M3 Filter Chips */
.filter-tabs {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.filter-tab {
  height: 32px;
  padding: 0 0.85rem;
  border-radius: var(--md-shape-sm);
  border: 1px solid var(--md-sys-color-outline);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.filter-tab::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 14px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") no-repeat center / contain;
  opacity: 0;
  transform: scale(0);
  transition: width 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.filter-tab:hover {
  background: var(--md-sys-state-hover);
  color: var(--md-sys-color-on-surface);
  border-color: var(--md-sys-color-outline);
}

.filter-tab.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: transparent;
  font-weight: 600;
  box-shadow: var(--md-sys-elevation-1);
}

.filter-tab.active::before {
  width: 14px;
  opacity: 1;
  transform: scale(1);
  margin-right: 2px;
}

.tab-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--md-shape-full);
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
  font-variant-numeric: tabular-nums;
  transition: all var(--transition-fast);
}

.filter-tab.active .tab-count {
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-on-secondary-container);
}

/* Command Tools */
.command-tools {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
  flex-wrap: wrap;
}

/* Official Google Material Design 3 (M3) Switch */
.instant-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
  padding: 0.25rem 0.5rem;
  border-radius: var(--md-shape-full);
  transition: background-color var(--transition-fast);
}

.instant-switch:hover {
  background: var(--md-sys-state-hover);
}

.instant-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* M3 Switch Track: 52px width, 32px height, 16px radius */
.switch-slider {
  width: 52px;
  height: 32px;
  background-color: var(--md-sys-color-surface-container-highest);
  border: 2px solid var(--md-sys-color-outline);
  border-radius: var(--md-shape-full);
  position: relative;
  transition: background-color 200ms var(--md-sys-motion-easing-emphasized),
              border-color 200ms var(--md-sys-motion-easing-emphasized);
  flex-shrink: 0;
}

/* M3 Switch Thumb: Inactive 16px, Active 24px */
.switch-slider::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 6px;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  background-color: var(--md-sys-color-outline);
  border-radius: 50%;
  transition: transform 250ms var(--md-sys-motion-easing-emphasized),
              width 200ms ease,
              height 200ms ease,
              background-color 200ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* M3 Switch Checked State */
.instant-switch input:checked + .switch-slider {
  background-color: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
}

.instant-switch input:checked + .switch-slider::after {
  transform: translate(20px, -50%);
  width: 24px;
  height: 24px;
  background-color: var(--md-sys-color-on-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230842a0'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
  background-size: 16px 16px;
  background-position: center;
  background-repeat: no-repeat;
}

body.light-theme .instant-switch input:checked + .switch-slider::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230b57d0'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
}

.switch-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  letter-spacing: 0.01em;
}

/* M3 Segmented Buttons: Select Group */
.select-group {
  display: flex;
  background: transparent;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-shape-full);
  padding: 2px;
  overflow: hidden;
}

.btn-tool {
  padding: 0.35rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: var(--md-shape-full);
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn-tool:hover {
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-state-hover);
}

.btn-tool:active {
  transform: scale(0.96);
  background: var(--md-sys-state-pressed);
}

/* M3 Outlined Sort Select */
.sort-wrap {
  position: relative;
}

.sort-wrap select {
  height: 36px;
  padding: 0 1.75rem 0 0.85rem;
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-shape-full);
  color: var(--md-sys-color-on-surface);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 16px;
}

.sort-wrap select:hover {
  border-color: var(--md-sys-color-primary);
  background-color: var(--md-sys-color-surface-container-high);
}

.sort-wrap select:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px var(--md-sys-color-primary);
}

/* M3 View Mode Segmented Buttons */
.view-toggle {
  display: flex;
  background: transparent;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-shape-full);
  padding: 2px;
}

.view-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.view-btn:hover {
  background: var(--md-sys-state-hover);
  color: var(--md-sys-color-on-surface);
}

.view-btn.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

/* ===================================================
   4. MAIN ACCOUNTS GRID & CARD ARCHITECTURE
   =================================================== */
.main-content {
  padding: 1.5rem 1.75rem;
}

.accounts-views-container {
  width: 100%;
}

.platform-view {
  width: 100%;
}

.platform-view.hidden {
  display: none !important;
}

.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  contain: content;
}

.accounts-grid.is-loading {
  opacity: 0.65;
  pointer-events: none;
}

/* Card: M3 Elevated Card Architecture */
.account-card {
  background-color: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-shape-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--md-sys-elevation-1);
  transition: transform 220ms var(--md-sys-motion-easing-emphasized),
              border-color 200ms ease,
              box-shadow 220ms var(--md-sys-motion-easing-emphasized),
              background-color 200ms ease;
  position: relative;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: 260px 320px;
  contain: content;
  will-change: transform;
}

.account-card:hover {
  transform: translateY(-2px);
  border-color: var(--md-sys-color-outline);
  box-shadow: var(--md-sys-elevation-2);
  background-color: var(--md-sys-color-surface-container);
}

.account-card.selected {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px var(--md-sys-color-primary), var(--md-sys-elevation-2);
  background-color: var(--md-sys-color-surface-container);
}

/* Media Wrap & Collage */
.card-media-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background-color: var(--md-sys-color-surface-container-lowest);
  overflow: hidden;
}

.card-collage {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 2px;
}

/* 1 photo: Full card 100% cover */
.card-collage.collage-1 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

/* 2 photos: 2 equal columns side by side */
.card-collage.collage-2 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}

/* 3 photos: 1 tall left, 2 stacked right */
.card-collage.collage-3 {
  grid-template-columns: 1.2fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.card-collage.collage-3 .collage-item:first-child {
  grid-row: span 2;
}

/* 4 photos: classic 2x2 */
.card-collage.collage-4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.collage-item {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background-color: var(--md-sys-color-surface-container);
}

.collage-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 350ms cubic-bezier(0.16, 1, 0.3, 1), opacity 200ms ease;
}

.lazy-thumb {
  opacity: 0;
  transition: opacity 200ms ease-out;
}

.lazy-thumb.loaded {
  opacity: 1;
}

.account-card:hover .collage-item img {
  transform: scale(1.03);
}

/* Video tile in Card Collage */
.collage-item.video-tile {
  position: relative;
  background-color: var(--md-sys-color-surface-container);
}

.video-play-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  pointer-events: none;
  box-shadow: var(--md-sys-elevation-2);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1), background-color 200ms ease;
  z-index: 2;
}

.video-play-badge .mui-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  margin-left: 2px;
}

.account-card:hover .video-play-badge {
  transform: translate(-50%, -50%) scale(1.12);
  background-color: var(--color-danger);
  border-color: #ffffff;
}

/* Overlays */
.preview-overlay-more {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 12, 0.72);
  backdrop-filter: blur(3px);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.no-previews-placeholder {
  grid-column: span 2;
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8rem;
  padding: 1rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
}

.no-previews-placeholder.has-media {
  color: var(--md-sys-color-on-surface);
  font-weight: 500;
  gap: 0.4rem;
  cursor: pointer;
}

.no-previews-placeholder.has-media:hover {
  background: var(--md-sys-state-hover);
}

/* M3 Square-Rounded Checkbox (Top-Left of Card) */
.card-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  width: 22px;
  height: 22px;
  border-radius: var(--md-shape-xs);
  background: rgba(8, 12, 20, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.card-checkbox::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
}

.card-checkbox:hover {
  transform: scale(1.1);
  border-color: #ffffff;
  background: rgba(8, 12, 20, 0.8);
}

.account-card.selected .card-checkbox {
  background-color: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 8px var(--color-primary-glow);
}

.card-checkbox::after {
  content: "";
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23042b67'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0;
  transform: scale(0.4);
  transition: all 180ms cubic-bezier(0.2, 0, 0, 1);
}

body.light-theme .card-checkbox::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
}

.account-card.selected .card-checkbox::after {
  opacity: 1;
  transform: scale(1);
}

/* Total Media Badge (Bottom-Right of Image) */
.card-media-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 5;
  background: rgba(5, 7, 12, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: var(--md-shape-full);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* Card Information Box */
.card-info {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-username {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn-single-del {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  opacity: 0.65;
  position: relative;
  overflow: hidden;
}

.btn-single-del .mui-icon {
  width: 16px;
  height: 16px;
}

.account-card:hover .btn-single-del {
  opacity: 1;
}

.btn-single-del:hover {
  background-color: var(--md-sys-color-error-container);
  border-color: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error-container);
  transform: scale(1.08);
}

.btn-single-del:active {
  transform: scale(0.92);
}

.card-meta-line {
  font-size: 0.75rem;
  color: var(--md-sys-color-on-surface-variant);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* List Mode View */
.accounts-grid.list-view {
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.accounts-grid.list-view .account-card {
  flex-direction: row;
  align-items: center;
  padding: 0.55rem 0.95rem;
  contain-intrinsic-size: 100% 64px;
}

.accounts-grid.list-view .card-media-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--md-shape-sm);
  flex-shrink: 0;
}

.accounts-grid.list-view .card-media-badge {
  display: none;
}

.accounts-grid.list-view .card-checkbox {
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
}

.accounts-grid.list-view .card-info {
  flex: 1;
  padding: 0 1rem;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

/* ===================================================
   5. STICKY FLOATING ACTION BAR (M3 EXTENDED FAB DOCK)
   =================================================== */
.floating-action-bar {
  position: fixed;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  width: 90%;
  max-width: 540px;
  height: 56px;
  background-color: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-shape-full);
  padding: 0 0.85rem;
  box-shadow: var(--md-sys-elevation-3);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  display: flex;
  align-items: center;
  animation: slideUp 250ms var(--md-sys-motion-easing-emphasized);
}

body.light-theme .floating-action-bar {
  background-color: rgba(236, 230, 240, 0.95);
}

@keyframes slideUp {
  from { transform: translate(-50%, 24px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.floating-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.floating-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.floating-pill-count {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-title {
  font-size: 0.84rem;
  font-weight: 600;
}

.floating-title b {
  color: var(--color-primary);
  font-family: var(--font-mono);
}

.floating-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-floating-cancel {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-floating-cancel:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.btn-floating-delete {
  background: var(--color-danger);
  color: #ffffff;
  border: none;
  padding: 0.45rem 1.15rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--color-danger-glow);
  transition: all var(--transition-fast);
}

.btn-floating-delete:hover {
  background: var(--color-danger-hover);
  transform: translateY(-1px);
}

.btn-floating-delete:active {
  transform: scale(0.97);
}

/* ===================================================
   6. STUDIO DARKROOM LIGHTBOX
   =================================================== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background-color: var(--bg-darkroom);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Minimalist Floating Top Bar */
.lightbox-top-bar {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.85rem;
  background: rgba(15, 22, 38, 0.65);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  z-index: 170;
  gap: 1.5rem;
  box-shadow: var(--shadow-floating);
  max-width: min(94vw, 540px);
}

.lightbox-top-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

#lightboxIndex.badge {
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
}

#lightboxTitle.meta-title {
  font-weight: 600;
  font-size: 0.78rem;
  color: #94a3b8;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===================================================
   FLOATING ULTRA-TRANSLUCENT MATERIAL UI BOTTOM DOCK (3 ICONS)
   =================================================== */
.lightbox-dock-wrap {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 180;
  pointer-events: none;
  display: flex;
  justify-content: center;
  width: auto;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.lightbox-dock-wrap.dock-autohide {
  opacity: 0 !important;
  transform: translate3d(-50%, 16px, 0) scale(0.92) !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.lightbox-dock-wrap.dock-autohide .lightbox-dock,
.lightbox-dock-wrap.dock-autohide .dock-btn {
  pointer-events: none !important;
}

.lightbox-dock {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.75rem;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-full);
  box-shadow: 0 10px 30px -4px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.lightbox-dock:hover {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 14px 36px -4px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.dock-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.dock-btn .mui-icon {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.dock-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.32);
  color: #ffffff;
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.dock-btn:active {
  transform: translateY(0) scale(0.94);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.dock-btn-danger {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.32);
  color: #fda4af;
}

.dock-btn-danger:hover {
  background: #f43f5e;
  border-color: #f43f5e;
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.5);
  transform: translateY(-2px) scale(1.1);
}

.dock-btn-danger:active {
  background: #e11d48;
  transform: translateY(0) scale(0.94);
}

.lightbox-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  transition: all var(--transition-fast);
}

.lightbox-close:hover {
  background: rgba(244, 63, 94, 0.35);
  border-color: rgba(244, 63, 94, 0.5);
}

/* Nav Prev/Next Buttons */
.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 22, 38, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 1.6rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 160;
  transition: all var(--transition-fast);
  backdrop-filter: blur(12px);
}

.lightbox-nav-btn:hover {
  background: var(--color-primary);
  transform: translateY(-50%) scale(1.08);
}

.lightbox-nav-btn.prev { left: 1.5rem; }
.lightbox-nav-btn.next { right: 1.5rem; }

/* ===================================================
   DUAL-SLOT CAROUSEL DISPLAY (SHOWS BOTH IMAGES DURING TRANSITION)
   =================================================== */
.lightbox-content-wrapper {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  perspective: 1400px;
  transform-style: preserve-3d;
}

/* Individual Slot (Current & Incoming) */
.lightbox-slot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  will-change: transform, opacity, filter;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

#lightboxSlotCurrent {
  z-index: 10;
  pointer-events: auto;
}

#lightboxSlotIncoming {
  z-index: 15;
  pointer-events: none;
}

.lightbox-slot.hidden,
#lightboxSlotIncoming.hidden,
#lightboxSlotCurrent.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Media inside Slots */
.lightbox-slot img,
.lightbox-slot video {
  max-width: 90vw;
  max-height: calc(100vh - 170px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.85);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
  transform-origin: center center;
}

.lightbox-slot video {
  max-width: 92vw;
  outline: none;
}

/* Filmstrip at Bottom ("Dây hình") */
.lightbox-filmstrip-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: linear-gradient(to top, rgba(5, 7, 12, 0.94), rgba(5, 7, 12, 0.6) 75%, transparent);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  overflow-x: auto;
  z-index: 160;
  scrollbar-width: none;
  mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
}

.lightbox-filmstrip-bar::-webkit-scrollbar {
  display: none;
}

.lightbox-filmstrip-inner {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 auto;
}

.filmstrip-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px solid transparent;
  opacity: 0.5;
  transition: all var(--transition-fast);
  position: relative;
  background: var(--bg-surface);
}

.filmstrip-thumb:hover {
  opacity: 0.9;
  transform: scale(1.06);
}

.filmstrip-thumb.active {
  opacity: 1;
  border-color: var(--color-primary);
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.75);
  transform: scale(1.08);
}

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

.filmstrip-video-indicator {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  pointer-events: none;
}

.filmstrip-video-indicator .mui-icon {
  width: 11px;
  height: 11px;
  fill: currentColor;
  margin-left: 1px;
}

/* ===================================================
   7. MODAL OVERLAYS & M3 DIALOG ARCHITECTURE (28px)
   =================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: rgba(5, 7, 12, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Official Google M3 Dialog (28px border-radius) */
.modal-container {
  background-color: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-shape-xl);
  box-shadow: var(--md-sys-elevation-3);
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: m3DialogScale 250ms var(--md-sys-motion-easing-emphasized);
}

@keyframes m3DialogScale {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  background-color: transparent;
}

.modal-title-area {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.modal-account-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.modal-account-title {
  font-family: var(--font-sans);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  letter-spacing: -0.01em;
}

.modal-account-stats {
  font-size: 0.78rem;
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 2px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn-close:hover {
  background-color: var(--md-sys-state-hover);
  color: var(--md-sys-color-on-surface);
}

.btn-close:active {
  background-color: var(--md-sys-state-pressed);
  transform: scale(0.92);
}

/* M3 Modal Tabs (Segmented Navigation Pills) */
.modal-tabs {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1.75rem;
  background-color: var(--md-sys-color-surface-container);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  overflow-x: auto;
}

.tab-btn {
  height: 36px;
  padding: 0 1rem;
  border-radius: var(--md-shape-full);
  border: 1px solid transparent;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  overflow: hidden;
}

.tab-btn:hover {
  color: var(--md-sys-color-on-surface);
  background-color: var(--md-sys-state-hover);
}

.tab-btn.active {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-weight: 600;
  box-shadow: var(--md-sys-elevation-1);
}

.modal-body {
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  flex: 1;
}

.media-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 0.75rem;
}

.gallery-item {
  aspect-ratio: 1;
  border-radius: var(--md-shape-sm);
  overflow: hidden;
  position: relative;
  background-color: var(--md-sys-color-surface-container);
  cursor: pointer;
  border: 1px solid var(--md-sys-color-outline-variant);
  content-visibility: auto;
  contain-intrinsic-size: 136px 136px;
  contain: layout paint;
  transition: transform 200ms var(--md-sys-motion-easing-emphasized),
              border-color 200ms ease,
              box-shadow 200ms ease;
}

.gallery-item:hover {
  transform: scale(1.03);
  border-color: var(--md-sys-color-outline);
  box-shadow: var(--md-sys-elevation-2);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-item-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 0.68rem;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  padding: 2px 6px;
  border-radius: var(--md-shape-xs);
  font-weight: 600;
  z-index: 5;
}

.gallery-video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.25);
  pointer-events: none;
  transition: background-color 200ms ease;
}

.gallery-item:hover .gallery-video-overlay {
  background-color: rgba(15, 23, 42, 0.45);
}

.gallery-video-play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: var(--md-sys-elevation-3);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1), background-color 200ms ease;
}

.gallery-video-play-btn .mui-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  margin-left: 2px;
}

.gallery-item:hover .gallery-video-play-btn {
  transform: scale(1.15);
  background-color: var(--color-danger);
  border-color: #ffffff;
}

.gallery-item-badge.video-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.gallery-item-badge.video-badge .mui-icon {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.gallery-item-badge.sub-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(16, 185, 129, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 4px;
  font-size: 0.64rem;
  padding: 2px 6px;
  color: #ffffff;
  font-weight: 600;
}

.gallery-item-badge.sub-badge .mui-icon {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

.gallery-item-select-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 15;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
              background-color 0.18s ease,
              border-color 0.18s ease,
              box-shadow 0.18s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.gallery-item-select-checkbox .mui-icon {
  width: 14px;
  height: 14px;
  fill: #ffffff;
}

.gallery-item.selectable.selected .gallery-item-select-checkbox {
  background-color: var(--color-primary, #3b82f6);
  border-color: var(--color-primary, #3b82f6);
  transform: scale(1.08);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.55);
}

.gallery-item.selectable.selected {
  outline: 2px solid var(--color-primary, #3b82f6);
  outline-offset: -2px;
  transform: scale(0.97);
}

/* Delete Confirm Modal (M3 Danger Dialog) */
.delete-modal-container {
  max-width: 540px;
}

.delete-header {
  border-bottom-color: rgba(244, 63, 94, 0.2);
  background-color: rgba(244, 63, 94, 0.06);
}

.delete-icon-wrapper {
  font-size: 1.8rem;
}

.delete-subtitle {
  font-size: 0.78rem;
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 2px;
}

.delete-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 1.25rem;
}

.new-folder-alert-box {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-md);
  color: #fca5a5;
  font-size: 0.82rem;
  line-height: 1.5;
}

.new-folder-alert-box .alert-icon-wrap {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 1px;
}

.new-folder-alert-box .alert-icon-wrap .mui-icon {
  width: 24px;
  height: 24px;
  fill: #ef4444;
}

.new-folder-alert-box .alert-text strong {
  display: block;
  color: #f87171;
  font-size: 0.84rem;
  margin-bottom: 0.25rem;
  letter-spacing: 0.02em;
}

.new-folder-alert-box .alert-text p {
  margin: 0;
  color: var(--text-secondary);
}

.delete-warning-box {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.95rem;
  font-size: 0.82rem;
}

.delete-accounts-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
  max-height: 110px;
  overflow-y: auto;
}

.delete-acc-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.delete-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.delete-options h4 {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.delete-option-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.delete-option-label:hover {
  border-color: var(--border-hover);
}

.delete-option-label.selected {
  border-color: var(--color-primary);
  background-color: rgba(99, 102, 241, 0.08);
}

.delete-option-label#labelOptionPermanent.selected {
  border-color: var(--color-danger);
  background-color: rgba(244, 63, 94, 0.08);
}

.option-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.option-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.option-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.modal-footer {
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  background-color: transparent;
}

.delete-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
}

.delete-warning-box {
  background-color: var(--md-sys-color-error-container);
  border: 1px solid var(--md-sys-color-error);
  border-radius: var(--md-shape-md);
  padding: 0.85rem 1.15rem;
  font-size: 0.84rem;
  color: var(--md-sys-color-on-error-container);
}

.delete-accounts-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
  max-height: 120px;
  overflow-y: auto;
}

.delete-acc-pill {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--md-shape-full);
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
}

.delete-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.delete-options h4 {
  font-size: 0.85rem;
  color: var(--md-sys-color-on-surface);
  font-weight: 600;
}

.delete-option-label {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1.15rem;
  border-radius: var(--md-shape-md);
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.delete-option-label:hover {
  border-color: var(--md-sys-color-outline);
  background-color: var(--md-sys-color-surface-container-high);
}

.delete-option-label.selected {
  border-color: var(--md-sys-color-primary);
  background-color: var(--md-sys-color-surface-container-highest);
  box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

.delete-option-label#labelOptionPermanent.selected {
  border-color: var(--color-danger);
  background-color: var(--md-sys-color-error-container);
  box-shadow: 0 0 0 1px var(--color-danger);
}

.option-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.option-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.option-desc {
  font-size: 0.74rem;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.4;
}

/* ===================================================
   8. PAGINATION & TABLES & QR MODAL (M3 STANDARD)
   =================================================== */
.pagination-bar {
  margin-top: 2rem;
  padding: 0.5rem 1.5rem;
  background-color: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-shape-full);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--md-sys-elevation-1);
}

.page-size-selector select {
  padding: 0.35rem 0.75rem;
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-shape-full);
  color: var(--md-sys-color-on-surface);
  margin-left: 0.45rem;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-page {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 50%;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  transition: all var(--transition-fast);
}

.btn-page:hover:not(:disabled) {
  background-color: var(--md-sys-state-hover);
  border-color: var(--md-sys-color-outline);
  color: var(--md-sys-color-primary);
}

.btn-page:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-indicator {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0 0.5rem;
  color: var(--md-sys-color-on-surface);
}

.page-info {
  font-size: 0.8rem;
  color: var(--md-sys-color-on-surface-variant);
}

/* Deleted Modal */
.deleted-modal-container {
  max-width: 880px;
}

.deleted-modal-body {
  overflow-y: auto;
  padding: 1.25rem 1.75rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--md-shape-md);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.deleted-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.deleted-table th {
  background-color: var(--md-sys-color-surface-container);
  padding: 0.75rem 1rem;
  color: var(--md-sys-color-on-surface);
  font-weight: 600;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  white-space: nowrap;
}

.deleted-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  font-variant-numeric: tabular-nums;
}

.deleted-table tbody tr:hover {
  background-color: var(--md-sys-state-hover);
}

.deleted-badge-trash {
  padding: 3px 9px;
  border-radius: var(--md-shape-full);
  background-color: rgba(52, 168, 83, 0.16);
  color: #34a853;
  font-size: 0.72rem;
  font-weight: 600;
}

.deleted-badge-perm {
  padding: 3px 9px;
  border-radius: var(--md-shape-full);
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-error);
  font-size: 0.72rem;
  font-weight: 600;
}

/* QR Modal */
.qr-modal-container {
  max-width: 420px;
  text-align: center;
}

.qr-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
}

.qr-code-box {
  background: #ffffff;
  padding: 14px;
  border-radius: var(--md-shape-lg);
  box-shadow: var(--md-sys-elevation-2);
  display: inline-block;
}

.qr-code-box img {
  display: block;
  width: 190px;
  height: 190px;
}

.qr-url-box {
  width: 100%;
  text-align: left;
}

.qr-url-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  display: block;
  margin-bottom: 0.4rem;
}

.qr-url-input-wrap {
  display: flex;
  gap: 0.5rem;
}

.qr-url-input-wrap input {
  flex: 1;
  height: 40px;
  padding: 0 0.85rem;
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-shape-full);
  color: var(--md-sys-color-on-surface);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  outline: none;
}

.qr-instructions {
  font-size: 0.78rem;
  color: var(--md-sys-color-on-surface-variant);
  text-align: left;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ===================================================
   SETTINGS MODAL & M3 CONFIGURATION HUB
   =================================================== */
.settings-modal-container {
  max-width: 640px;
}

.settings-modal-body {
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  max-height: calc(85vh - 120px);
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.settings-section-header h3 {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 0.25rem;
}

.settings-section-header p {
  font-size: 0.78rem;
  color: var(--md-sys-color-on-surface-variant);
}

.transition-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (max-width: 540px) {
  .transition-options-grid {
    grid-template-columns: 1fr;
  }
}

.transition-option-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-shape-md);
  cursor: pointer;
  transition: all 220ms var(--md-sys-motion-easing-emphasized);
  position: relative;
  user-select: none;
  overflow: hidden;
}

.transition-option-card input[type="radio"] {
  display: none;
}

.transition-option-card:hover {
  background-color: var(--md-sys-color-surface-container-high);
  border-color: var(--md-sys-color-outline);
  transform: translateY(-1px);
}

.transition-option-card.active {
  background-color: var(--md-sys-color-secondary-container);
  border-color: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary-container);
  box-shadow: var(--md-sys-elevation-1);
}

.option-card-content {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.option-card-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--md-sys-color-primary);
}

.option-card-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.transition-option-card.active .option-card-icon {
  color: var(--md-sys-color-on-secondary-container);
}

.option-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.option-card-title {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transition-option-card.active .option-card-title {
  color: var(--md-sys-color-on-secondary-container);
}

.option-card-desc {
  font-size: 0.72rem;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.35;
}

.transition-option-card.active .option-card-desc {
  color: var(--md-sys-color-on-secondary-container);
  opacity: 0.85;
}

.option-card-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.option-card-check svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.transition-option-card.active .option-card-check {
  display: flex;
}

/* Speed pills: M3 Segmented Buttons */
.speed-options-group {
  display: flex;
  background-color: transparent;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-shape-full);
  padding: 3px;
}

.speed-pill-btn,
.autohide-pill-btn,
.sound-pill-btn {
  flex: 1;
  padding: 0.45rem 0.85rem;
  background: transparent;
  border: none;
  border-radius: var(--md-shape-full);
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.speed-pill-btn:hover,
.autohide-pill-btn:hover,
.sound-pill-btn:hover {
  background-color: var(--md-sys-state-hover);
  color: var(--md-sys-color-on-surface);
}

.speed-pill-btn.active,
.autohide-pill-btn.active,
.sound-pill-btn.active {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-weight: 600;
  box-shadow: var(--md-sys-elevation-1);
}

/* Toggle row */
.settings-row-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-shape-md);
  gap: 1rem;
}

.settings-toggle-title {
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  display: block;
  margin-bottom: 0.2rem;
}

.settings-toggle-desc {
  font-size: 0.74rem;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
}

/* Lightbox top right group */
.lightbox-top-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lightbox-top-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.lightbox-top-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.35);
  transform: scale(1.08);
}

.lightbox-top-btn .mui-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* M3 Snackbar / Toast Notification */
.toast-container {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.75rem 1.25rem;
  border-radius: var(--md-shape-sm);
  background-color: var(--md-sys-color-surface-bright);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  box-shadow: var(--md-sys-elevation-3);
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.84rem;
  max-width: 460px;
  animation: m3ToastIn 250ms var(--md-sys-motion-easing-emphasized);
}

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

.toast.toast-success {
  border-left: 4px solid var(--color-success);
}

.toast.toast-danger {
  border-left: 4px solid var(--color-danger);
}

.toast-action-btn {
  margin-left: 0.5rem;
  padding: 0.3rem 0.8rem;
  border-radius: var(--md-shape-full);
  font-size: 0.76rem;
  font-weight: 600;
  background-color: var(--md-sys-color-secondary-container);
  border: 1px solid transparent;
  color: var(--md-sys-color-on-secondary-container);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.toast-action-btn:hover {
  background-color: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary);
}

/* ===================================================
   OFFICIAL GOOGLE MATERIAL DESIGN 3 (M3) NAVIGATION BAR
   =================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background-color: var(--md-sys-color-surface-container);
  border-top: 1px solid var(--md-sys-color-outline-variant);
  z-index: 100;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: var(--md-sys-elevation-2);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  flex: 1;
  position: relative;
  transition: color var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* M3 Active Indicator Pill (64x32px) */
.mobile-nav-item .mob-icon {
  width: 64px;
  height: 32px;
  border-radius: var(--md-shape-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 200ms var(--md-sys-motion-easing-emphasized),
              color 200ms var(--md-sys-motion-easing-emphasized);
}

.mobile-nav-item .mob-icon .mui-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.mobile-nav-item:hover {
  color: var(--md-sys-color-on-surface);
}

.mobile-nav-item.active {
  color: var(--md-sys-color-on-surface);
  font-weight: 700;
}

.mobile-nav-item.active .mob-icon {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

/* ===================================================
   9. MOBILE & RESPONSIVE ARCHITECTURE
   =================================================== */
@media (max-width: 768px) {
  /* Layout & Spacing */
  body {
    padding-bottom: 96px;
  }

  .app-header {
    padding: 0.55rem 0.85rem;
  }

  .header-brand {
    gap: 0.5rem;
  }

  .brand-icon {
    font-size: 1.35rem;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .brand-stats {
    font-size: 0.7rem;
  }

  .header-actions .btn-ghost {
    display: none !important;
  }

  .main-content {
    padding: 0.75rem 0.65rem;
  }

  /* Command Bar (Stacked 3 Clean Rows) */
  .command-bar {
    padding: 0.5rem 0.75rem;
  }

  .command-bar-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  /* Row 1: Search Box */
  .search-wrap {
    width: 100%;
    flex: none;
  }

  .search-wrap input {
    padding-right: 2rem;
    font-size: 0.82rem;
  }

  .kbd-hint {
    display: none !important;
  }

  /* Row 2: Horizontal Filter Tabs */
  .filter-tabs {
    display: flex;
    overflow-x: auto;
    width: 100%;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 2px;
    gap: 2px;
  }

  .filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .filter-tab {
    flex-shrink: 0;
    padding: 0.35rem 0.65rem;
    font-size: 0.76rem;
  }

  /* Row 3: Command Tools Single Clean Row */
  .command-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.35rem;
    margin-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .command-tools::-webkit-scrollbar {
    display: none;
  }

  .instant-switch {
    flex-shrink: 0;
    padding: 0.28rem 0.55rem;
    font-size: 0.72rem;
    gap: 0.35rem;
  }

  .select-group {
    flex-shrink: 0;
  }

  .btn-tool {
    padding: 0.28rem 0.45rem;
    font-size: 0.72rem;
  }

  .sort-wrap {
    flex: 1;
    min-width: 105px;
  }

  .sort-wrap select {
    width: 100%;
    padding: 0.3rem 0.45rem;
    font-size: 0.72rem;
  }

  .view-toggle {
    display: none !important;
  }

  /* Account Cards 2-Column Grid on Mobile */
  .accounts-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.55rem !important;
  }

  .account-card {
    contain-intrinsic-size: 160px 220px;
    border-radius: var(--md-shape-md);
  }

  .card-media-badge {
    bottom: 5px;
    right: 5px;
    font-size: 0.65rem;
    padding: 1px 6px;
  }

  .card-checkbox {
    top: 6px;
    left: 6px;
    width: 22px;
    height: 22px;
  }

  .card-info {
    padding: 0.45rem 0.55rem;
    gap: 0.15rem;
  }

  .card-username {
    font-size: 0.78rem;
  }

  .card-meta-line {
    font-size: 0.68rem;
  }

  /* Single card delete button visible on mobile without hover */
  .btn-single-del {
    opacity: 0.85 !important;
    padding: 3px 5px;
    font-size: 0.78rem;
  }

  /* Floating Action Bar (Floats comfortably above the 80px M3 Navigation Bar) */
  .floating-action-bar {
    bottom: 92px !important;
    width: calc(100% - 1.25rem) !important;
    max-width: 440px !important;
    padding: 0.4rem 0.75rem !important;
    z-index: 150 !important;
  }

  .floating-title {
    font-size: 0.78rem;
  }

  .btn-floating-cancel {
    padding: 0.3rem 0.6rem;
    font-size: 0.74rem;
  }

  .btn-floating-delete {
    padding: 0.38rem 0.85rem;
    font-size: 0.78rem;
  }

  /* Mobile Bottom Navigation */
  .mobile-bottom-nav {
    display: flex !important;
    z-index: 120;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Full-Screen Sheet Modals on Mobile */
  .modal-overlay {
    padding: 0 !important;
    z-index: 250 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }

  .gallery-modal-container,
  .deleted-modal-container {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  .modal-header {
    padding: 0.6rem 0.75rem !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
  }

  .modal-title-area {
    flex: 1 1 auto;
    min-width: 0;
  }

  .modal-account-title {
    font-size: 0.95rem;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .modal-account-stats {
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
  }

  .modal-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
  }

  .modal-actions .btn-text {
    display: none !important;
  }

  .modal-actions .btn-tool,
  .modal-actions .btn-floating-delete {
    padding: 0.3rem 0.55rem;
    font-size: 0.76rem;
  }

  .btn-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    padding: 0;
  }

  /* Modal Tabs */
  .modal-tabs {
    padding: 0.35rem 0.65rem !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0.25rem !important;
  }

  .modal-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    padding: 0.28rem 0.65rem !important;
    font-size: 0.74rem !important;
    flex-shrink: 0;
  }

  .modal-body {
    padding: 0.4rem !important;
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Media Gallery Grid: 3-column square Instagram style */
  .media-gallery-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 3px !important;
  }

  .gallery-item {
    border-radius: 3px !important;
    border: none !important;
  }

  .gallery-item-badge.video-badge {
    bottom: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
  }

  .gallery-item-badge.video-badge .mui-icon {
    width: 11px;
    height: 11px;
  }

  .gallery-item-select-checkbox {
    top: 5px;
    left: 5px;
    width: 22px;
    height: 22px;
  }

  .gallery-item-select-checkbox .mui-icon {
    width: 13px;
    height: 13px;
  }

  /* Studio Darkroom Lightbox on Mobile */
  .lightbox-overlay {
    z-index: 300 !important;
  }

  .lightbox-nav-btn {
    display: none !important;
  }

  .lightbox-top-bar {
    top: 0.5rem !important;
    width: calc(100% - 1.25rem) !important;
    padding: 0.3rem 0.65rem !important;
    background: rgba(15, 22, 38, 0.55) !important;
  }

  #lightboxTitle.meta-title {
    max-width: 140px;
    font-size: 0.72rem;
  }

  /* Translucent Bottom Dock on Mobile (Ở giữa dưới hình, cực dễ bấm, không che khuất hình) */
  .lightbox-dock-wrap {
    bottom: 68px !important;
    width: auto !important;
    z-index: 180 !important;
  }

  .lightbox-dock {
    padding: 0.25rem 0.55rem !important;
    gap: 0.55rem !important;
    background: rgba(10, 16, 30, 0.3) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    border-radius: var(--radius-full) !important;
  }

  .dock-btn {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 50% !important;
  }

  .dock-btn .mui-icon {
    width: 20px !important;
    height: 20px !important;
  }

  .dock-btn-danger {
    background: rgba(244, 63, 94, 0.2) !important;
    border-color: rgba(244, 63, 94, 0.38) !important;
    color: #fda4af !important;
  }

  /* Dây hình (Filmstrip) on Mobile - Khôi phục và tối ưu cực mượt */
  .lightbox-filmstrip-bar {
    display: flex !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 56px !important;
    padding: 0 0.65rem !important;
    background: linear-gradient(to top, rgba(5, 7, 12, 0.96), rgba(5, 7, 12, 0.65) 75%, transparent) !important;
    z-index: 160 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .lightbox-filmstrip-inner {
    gap: 0.35rem !important;
  }

  .filmstrip-thumb {
    width: 38px !important;
    height: 38px !important;
    border-radius: 6px !important;
  }

  .lightbox-content-wrapper img,
  .lightbox-content-wrapper video,
  .lightbox-anim-ghost {
    max-width: 100vw !important;
    max-height: calc(100vh - 130px) !important;
    max-height: calc(100dvh - 130px) !important;
    border-radius: 0 !important;
  }

  /* Delete Confirm Dialog on Mobile (Card popup, not full screen) */
  .delete-modal-container {
    width: calc(100% - 1.5rem) !important;
    max-width: 420px !important;
    margin: auto !important;
    border-radius: var(--radius-lg) !important;
    max-height: 90vh !important;
    height: auto !important;
  }

  .modal-footer {
    flex-direction: column-reverse !important;
    gap: 0.5rem !important;
    padding: 0.65rem 0.85rem !important;
  }

  .modal-footer button {
    width: 100% !important;
    padding: 0.6rem !important;
    text-align: center !important;
  }

  /* Pagination Bar */
  .pagination-bar {
    margin-top: 1rem;
    padding: 0.65rem 0.85rem;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
  }

  .page-info {
    font-size: 0.72rem;
  }
}

@media (max-width: 360px) {
  .command-tools {
    gap: 0.25rem;
  }

  .instant-switch {
    font-size: 0.68rem;
    padding: 0.25rem 0.45rem;
  }

  .card-username {
    font-size: 0.74rem;
  }

  .card-meta-line {
    font-size: 0.64rem;
  }
}

/* ===================================================
   MATERIAL UI SYSTEM SVG ICONS & INDICATORS
   =================================================== */
.inline-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  fill: currentColor;
  margin-right: 4px;
}

.tab-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  vertical-align: middle;
  margin-right: 2px;
}

.warning-svg {
  width: 28px;
  height: 28px;
  fill: var(--color-danger);
}

.section-svg {
  width: 20px;
  height: 20px;
  fill: var(--md-sys-color-primary);
  vertical-align: middle;
  margin-right: 6px;
}

.badge-svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
  vertical-align: middle;
  margin-right: 3px;
}

.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-icon {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-svg {
  width: 56px;
  height: 56px;
  fill: var(--md-sys-color-outline);
  opacity: 0.7;
}

.qr-instructions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.qr-step-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: var(--md-sys-color-on-surface-variant);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.toast-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.toast-svg-success {
  fill: #4ade80;
}

.toast-svg-danger {
  fill: #f87171;
}

.toast-svg-warning {
  fill: #fbbf24;
}

.toast-svg-info {
  fill: #60a5fa;
}

/* ===================================================
   VIETNAMESE SUBTITLES & CLOSED CAPTIONS (VIETSUB)
   =================================================== */
video::cue {
  background-color: rgba(10, 15, 29, 0.85);
  color: #ffffff;
  font-family: 'Google Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 1.18rem;
  font-weight: 500;
  line-height: 1.45;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 2px rgba(0, 0, 0, 0.85);
  border-radius: 6px;
  padding: 3px 12px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

@media (max-width: 640px) {
  video::cue {
    font-size: 0.96rem;
    padding: 2px 8px;
  }
}

/* Subtitle badges in Lightbox top bar */
.badge.sub-badge {
  background: rgba(14, 165, 233, 0.22);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-weight: 600;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.02em;
  margin-left: 6px;
  vertical-align: middle;
}

/* Subtitle badge in Gallery cards */
.gallery-item-badge.sub-badge {
  background: rgba(14, 165, 233, 0.88);
  color: #ffffff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  top: 8px;
  right: 8px;
  bottom: auto;
  left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.gallery-item-badge.sub-badge .mui-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Lightbox Dock CC Button Active State */
.dock-btn.active-sub {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.35);
}

/* ==========================================================================
   ORIENTATION ENGINE: MOBILE LANDSCAPE ADAPTIVITY (Max Height 540px)
   Immersive Theater Mode, lateral edge controls, compact headers & multi-column grids
   ========================================================================== */
@media (orientation: landscape) and (max-height: 540px) {
  /* App Header: Ultra-compact single horizontal bar */
  .app-header {
    min-height: 42px !important;
    padding: max(4px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 4px max(12px, env(safe-area-inset-left, 0px)) !important;
  }

  .brand-icon {
    width: 26px !important;
    height: 26px !important;
  }

  .brand-icon svg {
    width: 15px !important;
    height: 15px !important;
  }

  .brand-title {
    font-size: 0.88rem !important;
  }

  .brand-stats {
    font-size: 0.68rem !important;
  }

  .header-actions {
    gap: 0.3rem !important;
  }

  .header-actions .mui-btn {
    padding: 0.2rem 0.5rem !important;
    font-size: 0.7rem !important;
    height: 28px !important;
  }

  /* Command Bar: Streamlined single row */
  .command-bar {
    padding: 0.25rem max(12px, env(safe-area-inset-left, 0px)) !important;
    margin-bottom: 0.4rem !important;
  }

  .command-row {
    gap: 0.35rem !important;
  }

  .search-input-wrap input {
    height: 30px !important;
    font-size: 0.76rem !important;
  }

  /* Accounts Grid: 3 to 4 columns in landscape */
  .accounts-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)) !important;
    gap: 0.6rem !important;
    padding-left: max(8px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(8px, env(safe-area-inset-right, 0px)) !important;
  }

  .account-card {
    contain-intrinsic-size: 190px 170px !important;
  }

  .card-media-wrap {
    height: 105px !important;
  }

  /* Mobile Bottom Navigation: Compact bar */
  .mobile-bottom-nav {
    height: 44px !important;
    padding-bottom: max(2px, env(safe-area-inset-bottom, 0px)) !important;
  }

  .mobile-nav-item {
    font-size: 0.6rem !important;
    gap: 1px !important;
  }

  .mobile-nav-item .mui-icon {
    width: 17px !important;
    height: 17px !important;
  }

  /* Floating Action Bar */
  .floating-action-bar {
    bottom: 50px !important;
    padding: 0.25rem 0.6rem !important;
  }

  /* Gallery Modal in Landscape: Maximize grid space */
  .gallery-modal-container {
    display: flex !important;
    flex-direction: column !important;
  }

  .gallery-modal-container .modal-header {
    padding: 0.3rem 0.75rem !important;
    min-height: 38px !important;
    flex-wrap: nowrap !important;
  }

  .modal-account-avatar {
    width: 22px !important;
    height: 22px !important;
  }

  .modal-account-title {
    font-size: 0.82rem !important;
  }

  .modal-account-stats {
    display: none !important; /* Hide secondary stats in landscape header to keep buttons on a single row */
  }

  .modal-tabs {
    padding: 0.15rem 0.55rem !important;
    gap: 0.3rem !important;
    min-height: 32px !important;
    overflow-x: auto !important;
  }

  .modal-tabs .tab-btn {
    padding: 0.18rem 0.55rem !important;
    font-size: 0.7rem !important;
    white-space: nowrap !important;
  }

  .modal-tabs .tab-btn .mui-icon {
    width: 13px !important;
    height: 13px !important;
  }

  .media-gallery-grid {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 3px !important;
    padding: 0.35rem !important;
  }

  /* Lightbox in Landscape: 100% Immersive Theater Mode */
  .lightbox-overlay {
    background: #000000 !important;
  }

  .lightbox-top-bar {
    top: max(6px, env(safe-area-inset-top, 0px)) !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 24px) !important;
    max-width: min(92vw, 480px) !important;
    padding: 0.25rem 0.85rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: rgba(10, 16, 28, 0.65) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: var(--radius-full) !important;
    z-index: 220 !important;
    opacity: 0.9 !important;
    transition: opacity 0.25s ease !important;
  }

  .lightbox-top-bar:hover,
  .lightbox-top-bar:focus-within {
    opacity: 1 !important;
  }

  .lightbox-top-left {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    min-width: 0 !important;
  }

  .lightbox-top-right {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    flex-shrink: 0 !important;
  }

  #lightboxTitle.meta-title {
    max-width: 180px !important;
    font-size: 0.76rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Media fills 100% height edge-to-edge */
  .lightbox-content-wrapper {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
  }

  .lightbox-slot:not(.hidden) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
  }

  .lightbox-slot.hidden,
  #lightboxSlotIncoming.hidden,
  #lightboxSlotCurrent.hidden {
    display: none !important;
  }

  .lightbox-slot img,
  .lightbox-slot video {
    max-width: 100vw !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 0 !important;
  }

  /* Floating Dock in Landscape: Positioned smoothly at bottom-center */
  .lightbox-dock-wrap {
    bottom: max(6px, env(safe-area-inset-bottom, 0px)) !important;
    z-index: 220 !important;
    opacity: 0.75 !important;
    transition: opacity 0.25s ease !important;
  }

  .lightbox-dock-wrap:hover {
    opacity: 1 !important;
  }

  .lightbox-dock-wrap.dock-autohide {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translate3d(-50%, 12px, 0) scale(0.92) !important;
  }

  .lightbox-dock {
    padding: 0.18rem 0.45rem !important;
    gap: 0.4rem !important;
    background: rgba(0, 0, 0, 0.5) !important;
    border-radius: var(--radius-full) !important;
  }

  .dock-btn {
    width: 32px !important;
    height: 32px !important;
  }

  .dock-btn .mui-icon {
    width: 16px !important;
    height: 16px !important;
  }

  /* Filmstrip in Landscape: Hidden so media gets 100% full vertical height */
  .lightbox-filmstrip-bar {
    display: none !important;
  }

  /* Lateral Navigation Arrows in Landscape: Float cleanly at lateral edges */
  .lightbox-nav-btn {
    display: flex !important;
    width: 36px !important;
    height: 36px !important;
    opacity: 0.65 !important;
  }

  .lightbox-nav-btn.prev {
    left: max(8px, env(safe-area-inset-left, 0px)) !important;
  }

  .lightbox-nav-btn.next {
    right: max(8px, env(safe-area-inset-right, 0px)) !important;
  }
}
