/* =====================================================================
   Kvill — Mobile CSS Module
   Loaded on /app route (adaptive desktop+mobile)
   Dependencies: style.css (tokens), mobile-animations.css (keyframes)

   Sections:
   1.  Mobile Custom Properties
   2.  Mobile Reset & Base
   3.  Auth Overlay
   4.  Toolbar
   5.  Empty State
   6.  Slide Feed
   7.  FAB Group
   8.  Chat Panel
   9.  Scrim
   10. Drag Handle
   11. Fullscreen Overlay
   12. Sidebar Drawer (incl. Sections, Folders, Actions, Context Menu)
   13. Loading States
   14. Toast Notifications
   15. Breakpoint Overrides
   16. Accessibility
   17. iOS Safari Fixes
   ===================================================================== */


/* =====================================================================
   1. MOBILE CUSTOM PROPERTIES
   Mobile-only tokens with --m- prefix.
   Shared tokens (--canvas, --text-*, --accent-*, etc.) come from style.css.
   ===================================================================== */

:root {
  --m-fab-size: 56px;
  --m-fab-secondary-size: 48px;
  --m-fab-bg: rgba(255, 255, 255, 0.72);
  --m-fab-bg-hover: rgba(255, 255, 255, 0.88);
  --m-fab-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08);
  --m-fab-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.10);
  --m-panel-bg: rgba(255, 255, 255, 0.82);
  --m-panel-border: rgba(0, 0, 0, 0.06);
  --m-panel-shadow: 0 12px 48px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
  --m-sidebar-bg: #ffffff;
  /* Neutral accent — graphite instead of black */
  --accent-blue: #36363e;
  --accent-blue-hover: #2e2e35;
  --m-accent-faded: rgba(0, 0, 0, 0.25);
  --m-msg-user-bg: rgba(0, 0, 0, 0.04);
  --m-msg-ai-bg: rgba(255, 255, 255, 0.92);
  --m-msg-ai-border: rgba(0, 0, 0, 0.08);
  --m-toolbar-bg: rgba(255, 255, 255, 0.78);
  --m-toolbar-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
  --m-safe-top: env(safe-area-inset-top, 0px);
  --m-safe-bottom: env(safe-area-inset-bottom, 0px);
  --m-vvh: 100dvh;
  --m-keyboard-height: 0px;
}

[data-theme="dark"] {
  --m-fab-bg: rgba(36, 36, 40, 0.78);
  --m-fab-bg-hover: rgba(44, 44, 48, 0.90);
  --m-fab-shadow: 0 4px 24px rgba(0, 0, 0, 0.35), 0 1px 4px rgba(0, 0, 0, 0.25);
  --m-fab-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.30);
  --m-panel-bg: rgba(28, 28, 32, 0.88);
  --m-panel-border: rgba(255, 255, 255, 0.06);
  --m-panel-shadow: 0 12px 48px rgba(0, 0, 0, 0.45), 0 4px 16px rgba(0, 0, 0, 0.30);
  --m-msg-user-bg: rgba(255, 255, 255, 0.06);
  --m-msg-ai-bg: rgba(255, 255, 255, 0.10);
  --m-msg-ai-border: rgba(255, 255, 255, 0.08);
  --m-sidebar-bg: #18181b;
  /* Neutral accent — soft gray for dark mode */
  --accent-blue: #8b8b96;
  --accent-blue-hover: #9d9da8;
  --m-accent-faded: rgba(255, 255, 255, 0.25);
  --m-toolbar-bg: rgba(24, 24, 27, 0.82);
  --m-toolbar-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}


/* =====================================================================
   2. MOBILE RESET & BASE
   ===================================================================== */

body {
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--text-1);
  width: 100%;
  height: 100dvh;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: none;
  overscroll-behavior: none;
  overflow: hidden;
}

/* Main app container — fills viewport, flex column */
.m-app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
}

/* Main content area — wraps toolbar + slide feed.
   On mobile: acts as simple flex column (same as .m-app).
   On desktop (>=768px): takes remaining space after sidebar. */
.m-app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}


/* =====================================================================
   3. AUTH OVERLAY
   Full-screen centered card with glassmorphism.
   ===================================================================== */

.m-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.m-auth-card {
  width: 100%;
  max-width: 380px;
  padding: 32px 28px;
  background: var(--bg-solid);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Logo block */
.m-auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 4px;
}

.m-auth-logo .logo-mark {
  width: 32px;
  height: 28px;
}

.m-auth-logo .logo-mark::before,
.m-auth-logo .logo-mark::after {
  width: 23px;
  height: 18px;
}

.m-auth-logo .logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-0);
  letter-spacing: -0.5px;
}

/* Input */
.m-auth-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-0);
  font-family: var(--font-body);
  font-size: 16px; /* Prevents iOS zoom on focus */
  line-height: 48px;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

.m-auth-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.m-auth-input::placeholder {
  color: var(--text-2);
}

/* Primary CTA button */
.m-btn-primary {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--canvas);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s var(--ease), transform 0.1s var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

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

.m-btn-primary:disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Google sign-in button */
.m-btn-google {
  width: 100%;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-solid);
  color: var(--text-0);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.m-btn-google:hover {
  background: var(--bg-input);
  border-color: var(--border-hover);
}

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

.m-btn-google svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Error message */
.m-auth-error {
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-xs);
  color: #dc2626;
  font-size: 13px;
  line-height: 1.4;
}

[data-theme="dark"] .m-auth-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

/* Email badge (shown after email step) */
.m-auth-email-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  align-self: center;
}

/* Divider with text */
.m-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}

.m-auth-divider::before,
.m-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Footer links */
.m-auth-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
}

.m-auth-links a {
  color: var(--accent-blue);
  text-decoration: none;
}

.m-auth-links a:active {
  opacity: 0.7;
}

/* Consent text */
.m-auth-consent {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-2);
  text-align: center;
}

.m-auth-consent a {
  color: var(--text-1);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Confirmation icon (for email code sent screen) */
.m-auth-confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--accent-blue);
}

.m-auth-confirm-icon svg {
  width: 28px;
  height: 28px;
}

.m-auth-confirm-text {
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-1);
}


/* =====================================================================
   4. TOOLBAR
   Sticky top bar with glassmorphism, safe-area padding.
   ===================================================================== */

.m-toolbar {
  flex-shrink: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  padding-top: max(8px, var(--m-safe-top));
  background: var(--m-toolbar-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--m-toolbar-shadow);
}

.m-toolbar-btn {
  width: 36px;
  height: 36px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-1);
  cursor: pointer;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s var(--ease);
}

.m-toolbar-btn:active {
  background: var(--accent-subtle);
}

.m-toolbar-btn svg {
  width: 20px;
  height: 20px;
}

.m-toolbar-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.m-toolbar-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

.m-toolbar-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  text-align: center;
  margin-top: -2px;
}

/* Slide counter pill */
.m-slide-counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-input);
  padding: 3px 10px;
  border-radius: 20px;
  font-variant-numeric: tabular-nums;
}

/* Toolbar actions group */
.m-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Slide nav pill — HIDDEN (scroll is enough on both mobile and desktop) ── */
.m-slide-nav {
  display: none !important;
}

.m-slide-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.m-slide-nav-btn:active {
  background: var(--bg-input);
}

.m-slide-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.m-slide-nav-btn svg {
  width: 18px;
  height: 18px;
}

.m-slide-nav-counter {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  min-width: 48px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  user-select: none;
}


/* =====================================================================
   5. EMPTY STATE
   Shown when no presentation is loaded.
   ===================================================================== */

/* ═══════ Hero state (empty — no presentation loaded) ═══════ */

.m-hero-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 120px;
  gap: 28px;
}

/* Demo slide cards — floating animated mockups */
.m-demo-slides {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 360px;
}

.m-demo-card {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  overflow: hidden;
}

/* Accent strip at top of each card */
.m-demo-card-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-blue));
  border-radius: var(--radius) var(--radius) 0 0;
}

/* Placeholder lines */
.m-demo-line {
  border-radius: 4px;
  background: var(--bg-input);
}

.m-demo-title-line {
  width: 55%;
  height: 12px;
  margin-bottom: 10px;
  background: var(--bg-input-hover);
}

.m-demo-text-line {
  width: 85%;
  height: 7px;
  margin-bottom: 6px;
}

.m-demo-text-line.short {
  width: 50%;
}

/* Mini chart in card 1 */
.m-demo-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 36px;
  margin-top: auto;
  padding-top: 8px;
}

.m-demo-bar {
  flex: 1;
  height: var(--h, 50%);
  border-radius: 3px 3px 0 0;
  background: linear-gradient(to top, var(--accent), var(--accent-blue));
  opacity: 0.6;
  animation: m-demo-bar-grow 3s ease-in-out infinite alternate;
}

.m-demo-bar:nth-child(1) { animation-delay: 0s; }
.m-demo-bar:nth-child(2) { animation-delay: 0.3s; }
.m-demo-bar:nth-child(3) { animation-delay: 0.6s; }
.m-demo-bar:nth-child(4) { animation-delay: 0.9s; }

@keyframes m-demo-bar-grow {
  0%   { transform: scaleY(0.7); }
  100% { transform: scaleY(1); }
}

/* Dots in card 2 */
.m-demo-dots {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.m-demo-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-input-hover);
  animation: m-demo-pulse 2.5s ease-in-out infinite;
}

.m-demo-dot:nth-child(1) { animation-delay: 0s; }
.m-demo-dot:nth-child(2) { animation-delay: 0.4s; }
.m-demo-dot:nth-child(3) { animation-delay: 0.8s; }

@keyframes m-demo-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

/* Tagline under demo slides */
.m-hero-tagline {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
  text-align: center;
  padding: 8px 20px;
  letter-spacing: -0.01em;
  margin-bottom: 80px;
}

@media (prefers-reduced-motion: reduce) {
  .m-demo-card,
  .m-demo-bar,
  .m-demo-dot {
    animation: none;
  }
}



/* =====================================================================
   6. SLIDE FEED
   Vertical scroll of slide cards.
   ===================================================================== */

.m-slide-feed {
  flex: 1;
  min-height: 0;
  padding: 12px;
  padding-bottom: calc(80px + var(--m-safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior: contain;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Floating stop button (visible during generation) ── */
.m-stop-fab {
  position: fixed;
  bottom: calc(24px + var(--m-safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9500;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 2px solid #ef4444;
  border-radius: 999px;
  background: var(--bg-solid);
  color: #ef4444;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.25);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.m-stop-fab.visible {
  display: flex;
}
.m-stop-fab:active {
  transform: translateX(-50%) scale(0.95);
}
.m-stop-fab svg {
  width: 16px;
  height: 16px;
}

.m-slide-card {
  width: 100%;
  flex-shrink: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--bg-solid);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease);
}

.m-slide-card:active {
  transform: scale(0.985);
}

/* Active slide highlight */
.m-slide-card.active {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-md), 0 0 0 2px var(--accent-glow);
}

/* Slide number badge */
.m-slide-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--bg-glass-strong);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  pointer-events: none;
}

/* Canvas wrapper — maintains aspect ratio */
.m-slide-canvas-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  position: relative;
}

/* Actual 1920x1080 content scaled down (div or iframe) */
.m-slide-canvas,
.m-slide-canvas iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: top left;
  overflow: hidden;
  pointer-events: none;
  border: none;
}


/* =====================================================================
   7. FAB GROUP
   Fixed bottom-right floating action buttons.
   Three stacked FABs: Chat (primary) + Download + Preset (secondary).
   ===================================================================== */

.m-fab-group {
  position: fixed;
  z-index: 9000;
  bottom: calc(16px + var(--m-safe-bottom));
  right: 16px;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 10px;
}

/* Shared FAB base */
.m-fab-btn {
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--m-fab-bg);
  box-shadow: var(--m-fab-shadow);
  background-image: linear-gradient(to bottom, var(--specular) 0%, transparent 50%);
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease),
              background 0.2s var(--ease), opacity 0.3s var(--ease);
  will-change: transform;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
}

.m-fab-btn:not(.m-fab-chat):hover {
  background: var(--m-fab-bg-hover);
  box-shadow: var(--m-fab-shadow-hover);
}

.m-fab-btn:active {
  transform: scale(0.94);
  transition-duration: 0.1s;
}

/* Chat FAB - primary, largest */
.m-fab-chat {
  width: var(--m-fab-size);
  height: var(--m-fab-size);
}

.m-fab-chat:hover {
  transform: scale(1.06);
}

.m-fab-chat.hidden {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

/* FAB wrapper (holds btn + popup + label) */
.m-fab-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-content: center;
}

/* Secondary FABs */
.m-fab-secondary {
  width: var(--m-fab-secondary-size);
  height: var(--m-fab-secondary-size);
}

.m-fab-secondary svg {
  width: 20px;
  height: 20px;
  color: var(--text-0);
}

/* Staggered entrance — initial state (animation delays in _visual-fab.css) */
.m-fab-preset-wrap,
.m-fab-cost-wrap,
.m-fab-share-wrap,
.m-fab-download-wrap,
.m-fab-fullscreen-wrap,
.m-slide-nav {
  opacity: 0;
  transform: scale(0) translateY(20px);
}

.m-fab-cost-value {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Zero state — dimmed */
.m-fab-cost.cost-zero .m-fab-cost-value {
  opacity: 0.45;
}

/* Indicator dot — active preset */
.m-fab-indicator {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--bg-solid);
  pointer-events: none;
}



/* When chat panel is open, hide ENTIRE FAB group (chat header has close btn) */
.m-fab-group.chat-open {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s var(--ease), visibility 0s 0.2s;
}

/* Chat FAB icon swap */
.m-fab-chat-icon {
  width: 24px;
  height: 24px;
  color: var(--text-0);
  transition: transform 0.3s var(--ease-spring), opacity 0.2s var(--ease);
}

.m-fab-chat.open .m-fab-chat-icon {
  transform: scale(0) rotate(90deg);
  opacity: 0;
}

.m-fab-chat-close-icon {
  position: absolute;
  width: 20px;
  height: 20px;
  color: var(--text-0);
  transform: scale(0) rotate(-90deg);
  opacity: 0;
  transition: transform 0.3s var(--ease-spring), opacity 0.2s var(--ease);
}

.m-fab-chat.open .m-fab-chat-close-icon {
  transform: scale(1) rotate(0deg);
  opacity: 1;
}

/* Notification badge on FAB */
.m-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0);
  transition: transform 0.3s var(--ease-spring);
  pointer-events: none;
  border: 2px solid var(--canvas);
}

.m-fab-badge.visible {
  transform: scale(1);
}

/* FAB glass pill labels */
.m-fab-label {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) scale(0.8);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-0);
  background: var(--m-fab-bg);
  border: 1px solid var(--border-glass);
  padding: 4px 12px;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease-spring);
}

.m-fab-label.visible {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

/* FAB popup containers (download + preset) */
.m-fab-popup {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) scale(0.8);
  display: flex;
  gap: 6px;
  background: var(--m-fab-bg);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--m-fab-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease-spring);
  z-index: 9001;
}

.m-fab-popup.visible {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  pointer-events: auto;
}

/* Popup action buttons */
.m-fab-popup-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-0);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 36px;
  min-width: 44px;
}

.m-fab-popup-btn:hover {
  background: var(--bg-input-hover);
}

.m-fab-popup-btn:active {
  background: var(--accent-subtle);
  transform: scale(0.96);
}

.m-fab-popup-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* "Coming soon" disabled state */
.m-fab-popup-btn--soon {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}

.m-soon-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  opacity: 0.7;
  margin-left: 2px;
}

/* Preset popup — vertical layout */
.m-fab-popup.m-preset-popup {
  flex-direction: column;
  min-width: 200px;
  max-height: 60vh;
  overflow: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Brand option row */
.m-brand-option {
  justify-content: flex-start !important;
  gap: 10px !important;
}

.m-brand-name {
  flex: 1;
  min-width: 0;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* Brand color dot */
.m-brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .m-brand-dot {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Coming soon brand — dimmed, non-clickable */
.m-brand-soon {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
}

/* Divider between available & coming-soon */
.m-brand-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}


/* =====================================================================
   8. CHAT PANEL
   Expands from FAB chat button. Glassmorphism panel.
   ===================================================================== */

.m-chat-panel {
  position: fixed;
  z-index: 8999;
  bottom: calc(16px + var(--m-safe-bottom));
  right: 16px;
  width: min(380px, calc(100vw - 32px));
  height: min(520px, calc(var(--m-vvh, 100dvh) - 100px));
  background: var(--m-panel-bg);
  border: 1px solid var(--m-panel-border);
  border-radius: 16px;
  box-shadow: var(--m-panel-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s var(--ease-spring), opacity 0.25s var(--ease),
              height 0.3s var(--ease-spring);
  will-change: transform, opacity;
}

.m-chat-panel.open {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Specular highlight at top */
.m-chat-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 10%, var(--specular) 50%, transparent 90%);
  z-index: 1;
  pointer-events: none;
}

/* Chat header */
.m-chat-header {
  display: flex;
  align-items: center;
  padding: 14px 16px 12px;
  gap: 10px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.m-chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0071e3 0%, #2997ff 100%);
  box-shadow:
    0 2px 8px rgba(0, 113, 227, 0.22),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.m-chat-avatar svg { display: none; }

.m-chat-title-group {
  flex: 1;
  min-width: 0;
}

.m-chat-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-0);
  line-height: 1.2;
}

.m-chat-subtitle {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.3;
}

.m-chat-close-btn {
  width: 32px;
  height: 32px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: none;
  border-radius: var(--radius-xs);
  color: var(--text-2);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.m-chat-close-btn:hover {
  background: var(--bg-input);
  color: var(--text-0);
}

.m-chat-close-btn:active {
  background: var(--bg-input-hover);
}

/* Chat messages area */
.m-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  overscroll-behavior: contain;
}

.m-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.m-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.m-chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Individual messages */
.m-chat-msg {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 85%;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: m-fab-msg-in 0.3s var(--ease-spring);
}

@keyframes m-fab-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* User message */
.m-chat-msg.user {
  background: var(--m-msg-user-bg);
  color: var(--text-0);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  border: 1px solid var(--border);
}

/* AI message */
.m-chat-msg.ai {
  background: var(--m-msg-ai-bg);
  color: var(--text-0);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--m-msg-ai-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.m-chat-msg.ai p {
  margin: 0 0 4px 0;
}

.m-chat-msg.ai p:last-child {
  margin-bottom: 0;
}

.m-chat-msg.ai strong {
  font-weight: 600;
}

/* File chip inside sent message */
.m-msg-file-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 4px;
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.2;
}
[data-theme="dark"] .m-msg-file-chip {
  background: rgba(255, 255, 255, 0.08);
}
.m-msg-file-chip.downloadable { cursor: pointer; transition: background 0.15s ease, transform 0.1s ease; }
.m-msg-file-chip.downloadable:hover {
  background: rgba(0, 0, 0, 0.10);
}
[data-theme="dark"] .m-msg-file-chip.downloadable:hover {
  background: rgba(255, 255, 255, 0.14);
}
.m-msg-file-chip.downloadable:active {
  background: rgba(0, 0, 0, 0.14);
  transform: scale(0.97);
}
[data-theme="dark"] .m-msg-file-chip.downloadable:active {
  background: rgba(255, 255, 255, 0.18);
}
.m-msg-file-icon { font-size: 14px; flex-shrink: 0; }
.m-msg-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
  color: var(--text-1);
}
/* .m-msg-file-ext removed — format shown on icon label */
.m-msg-file-ext {
  display: none;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
/* Light theme ext colors */
.m-msg-file-ext.ext-pdf { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.m-msg-file-ext.ext-docx, .m-msg-file-ext.ext-doc { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.m-msg-file-ext.ext-xlsx, .m-msg-file-ext.ext-xls, .m-msg-file-ext.ext-csv { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.m-msg-file-ext.ext-pptx, .m-msg-file-ext.ext-ppt { background: rgba(249, 115, 22, 0.15); color: #ea580c; }
.m-msg-file-ext.ext-png, .m-msg-file-ext.ext-jpg, .m-msg-file-ext.ext-jpeg, .m-msg-file-ext.ext-gif, .m-msg-file-ext.ext-webp { background: rgba(168, 85, 247, 0.15); color: #9333ea; }
.m-msg-file-ext.ext-txt, .m-msg-file-ext.ext-md, .m-msg-file-ext.ext-json { background: rgba(0, 0, 0, 0.08); color: rgba(0, 0, 0, 0.55); }
/* Dark theme ext colors */
[data-theme="dark"] .m-msg-file-ext.ext-pdf { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
[data-theme="dark"] .m-msg-file-ext.ext-docx, [data-theme="dark"] .m-msg-file-ext.ext-doc { background: rgba(59, 130, 246, 0.25); color: #93c5fd; }
[data-theme="dark"] .m-msg-file-ext.ext-xlsx, [data-theme="dark"] .m-msg-file-ext.ext-xls, [data-theme="dark"] .m-msg-file-ext.ext-csv { background: rgba(34, 197, 94, 0.25); color: #86efac; }
[data-theme="dark"] .m-msg-file-ext.ext-pptx, [data-theme="dark"] .m-msg-file-ext.ext-ppt { background: rgba(249, 115, 22, 0.25); color: #fdba74; }
[data-theme="dark"] .m-msg-file-ext.ext-png, [data-theme="dark"] .m-msg-file-ext.ext-jpg, [data-theme="dark"] .m-msg-file-ext.ext-jpeg, [data-theme="dark"] .m-msg-file-ext.ext-gif, [data-theme="dark"] .m-msg-file-ext.ext-webp { background: rgba(168, 85, 247, 0.25); color: #d8b4fe; }
[data-theme="dark"] .m-msg-file-ext.ext-txt, [data-theme="dark"] .m-msg-file-ext.ext-md, [data-theme="dark"] .m-msg-file-ext.ext-json { background: rgba(255, 255, 255, 0.10); color: rgba(255, 255, 255, 0.55); }
/* Fallback — no matching ext class */
.m-msg-file-ext:not([class*="ext-"]) { background: rgba(0, 0, 0, 0.08); color: rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .m-msg-file-ext:not([class*="ext-"]) { background: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.6); }

.m-msg-file-size {
  color: rgba(0, 0, 0, 0.4);
  font-size: 10px;
  flex-shrink: 0;
}
[data-theme="dark"] .m-msg-file-size {
  color: rgba(255, 255, 255, 0.55);
}
/* download icon removed — whole chip is clickable */

/* Typing indicator */
.m-chat-typing {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  align-self: flex-start;
}

.m-typing-dots {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.m-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-2);
  animation: m-typing-bounce 1.4s infinite;
}

.m-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.m-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

.m-typing-status {
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

@keyframes m-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* In-chat stop button (above composer, visible during generation) */
.m-chat-stop-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 16px 8px;
  padding: 8px 16px;
  border: 1.5px solid #ef4444;
  border-radius: 999px;
  background: transparent;
  color: #ef4444;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.m-chat-stop-btn.visible {
  display: flex;
}
.m-chat-stop-btn:active {
  background: rgba(239, 68, 68, 0.1);
}
.m-chat-stop-btn svg {
  flex-shrink: 0;
}

/* Recording indicator — styles moved to _visual-chat.css */

/* Keyboard-open adjustments */
.m-chat-panel.keyboard-open {
  bottom: 0;
  left: 0;
  right: 0;
  width: auto;
  border-radius: 16px 16px 0 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  height: calc(var(--m-vvh, 100dvh) - 20px);
  max-height: calc(var(--m-vvh, 100dvh) - 20px);
}

.m-chat-panel.keyboard-open .m-chat-composer {
  padding-bottom: 10px;
}


/* =====================================================================
   9. SCRIM
   Subtle background overlay when chat panel is open.
   ===================================================================== */

.m-scrim {
  position: fixed;
  inset: 0;
  z-index: 8998;
  background: transparent;
  pointer-events: none;
  transition: background 0.3s var(--ease);
}

.m-scrim.active {
  background: rgba(0, 0, 0, 0.01);
  pointer-events: auto;
}

[data-theme="dark"] .m-scrim.active {
  background: rgba(0, 0, 0, 0.15);
}


/* =====================================================================
   10. DRAG HANDLE
   Centered bar visible on touch devices for chat panel dragging.
   ===================================================================== */

.m-drag-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--text-3);
  margin: 0 auto;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  position: relative;
}

/* Expand hit target for touch */
.m-drag-handle::before {
  content: '';
  position: absolute;
  inset: -10px -20px;
}

/* Show on touch devices */
@media (hover: none) and (pointer: coarse) {
  .m-drag-handle {
    opacity: 1;
    margin-top: 8px;
    margin-bottom: -4px;
  }
}


/* =====================================================================
   11. FULLSCREEN OVERLAY
   Full-screen slide viewer with prev/next navigation.
   ===================================================================== */

.m-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  display: flex;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
  outline: none;
}
.m-fullscreen.m-fs-active {
  visibility: visible;
  pointer-events: auto;
  /* No animation here — CSS animations on the fullscreen element
     break Chrome's visual fullscreen transition (known Chromium bug) */
}

@keyframes m-fs-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Close button — top-right, glass pill */
.m-fs-close {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: all 0.2s ease;
}

.m-fs-close svg {
  width: 18px;
  height: 18px;
}

.m-fs-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Slide container — fills entire viewport */
.m-fs-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Canvas — 1920x1080, positioned absolutely, JS sets scale + left/top */
.m-fs-canvas {
  position: absolute;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  background: #000;
  border: none;
  overflow: hidden;
  pointer-events: none; /* Prevent iframe from stealing focus */
  will-change: transform;
  -webkit-backface-visibility: hidden;
}

/* Bottom navigation bar — floating centered pill */
.m-fs-nav {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10001;
}

/* Prev/Next buttons */
.m-fs-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: all 0.2s ease;
}

.m-fs-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.m-fs-btn:active {
  background: rgba(255, 255, 255, 0.25);
}

.m-fs-btn svg {
  width: 18px;
  height: 18px;
}

.m-fs-btn:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* Slide counter */
.m-fs-counter {
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 50px;
  text-align: center;
}

/* Auto-hide nav/close in fullscreen (show on mouse move) */
.m-fullscreen .m-fs-close,
.m-fullscreen .m-fs-nav {
  transition: opacity 0.4s ease;
}
.m-fullscreen.m-fs-autohide .m-fs-close,
.m-fullscreen.m-fs-autohide .m-fs-nav {
  opacity: 0;
  pointer-events: none;
}


/* =====================================================================
   12. SIDEBAR DRAWER
   Left-side drawer for presentation history/navigation.
   ===================================================================== */

/* Backdrop scrim */
.m-sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 9499;
  background: transparent;
  pointer-events: none;
  transition: background 0.3s var(--ease);
}

.m-sidebar-scrim.active {
  background: rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

/* Drawer panel */
.m-sidebar-drawer {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(300px, 85vw);
  z-index: 9500;
  background: var(--m-sidebar-bg);
  border-right: 1px solid var(--m-panel-border);
  box-shadow: var(--m-panel-shadow);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s var(--ease-spring);
  will-change: transform;
}

.m-sidebar-drawer.open {
  transform: translateX(0);
}

/* ── Collapsed strip (desktop only) ── */
.m-sidebar-strip {
  display: none; /* hidden on mobile, shown on desktop when collapsed */
}

/* ── Full sidebar content wrapper ── */
.m-sidebar-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

/* Sidebar header — clean, no border (matches desktop) */
.m-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px 8px;
  padding-top: max(12px, calc(var(--m-safe-top) + 4px));
  flex-shrink: 0;
  white-space: nowrap;
}

.m-sidebar-header .logo-mark {
  width: 28px;
  height: 24px;
}

.m-sidebar-header .logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-0);
  letter-spacing: -0.3px;
}

.m-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.m-sidebar-close {
  width: 32px;
  height: 32px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: none;
  color: var(--text-2);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.m-sidebar-close:hover {
  background: var(--bg-input);
  color: var(--text-0);
}

.m-sidebar-close:active {
  background: var(--bg-input-hover);
}

.m-sidebar-close svg {
  width: 20px;
  height: 20px;
}

/* Sidebar header actions — grey container like desktop */
.m-sidebar-header-actions {
  display: flex;
  gap: 2px;
  margin-left: auto;
  background: var(--bg-input);
  border-radius: 8px;
  padding: 2px;
}

.m-sidebar-header-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease;
}

.m-sidebar-header-btn:active {
  background: var(--bg-input);
  color: var(--text-0);
}

.m-sidebar-header-btn svg {
  width: 14px;
  height: 14px;
}

/* Desktop-only: collapse button hidden on mobile, + button hidden everywhere (redundant) */
#mNewPresHeaderBtn {
  display: none !important;
}
.m-sidebar-collapse-btn {
  display: none;
}

/* Sidebar resize handle (desktop only, hidden on mobile) */
.m-sidebar-resize-handle {
  display: none;
}

/* Folder more button */
.m-sidebar-folder-more {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: none;
  background: transparent;
  color: var(--text-3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  opacity: 0.4;
  transition: opacity 0.15s, background 0.15s;
}

.m-sidebar-folder-more:active {
  background: var(--bg-input);
  opacity: 1;
}

.m-sidebar-folder-more svg {
  width: 14px;
  height: 14px;
}

/* New presentation button */
.m-sidebar-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 32px);
  margin: 12px 16px;
  height: 44px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
              color 0.15s var(--ease);
}

.m-sidebar-new-btn:hover {
  background: var(--bg-input-hover);
  border-color: var(--border-hover);
  color: var(--text-0);
}

.m-sidebar-new-btn:active {
  transform: scale(0.98);
}

.m-sidebar-new-btn svg {
  width: 16px;
  height: 16px;
}

/* Presentation list */
.m-sidebar-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  overscroll-behavior: contain;
}

.m-sidebar-list::-webkit-scrollbar {
  width: 3px;
}

.m-sidebar-list::-webkit-scrollbar-track {
  background: transparent;
}

.m-sidebar-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Individual presentation item */
.m-sidebar-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  min-height: 32px;
  padding: 0;
  margin: 0 4px;
  cursor: pointer;
  border-left: none;
  border-radius: 6px;
  position: relative;
  transition: background 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Sidebar item content wrapper */
.m-sidebar-item-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 6px;
  background: transparent;
  position: relative;
  z-index: 1;
}

/* Three-dot menu button on sidebar items */
.m-sidebar-more-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: none;
  background: transparent;
  color: var(--text-3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  opacity: 0.4;
  transition: opacity 0.15s, background 0.15s;
}

.m-sidebar-more-btn:active {
  background: var(--bg-input);
  opacity: 1;
}

.m-sidebar-more-btn svg {
  width: 16px;
  height: 16px;
}

.m-sidebar-item:active .m-sidebar-item-content {
  background: var(--bg-input-hover);
}

/* Active item */
.m-sidebar-item.active .m-sidebar-item-content {
  background: var(--accent-subtle);
}

.m-sidebar-item.active .m-sidebar-item-title {
  font-weight: 500;
  color: var(--text-0);
}

[data-theme="dark"] .m-sidebar-item.active .m-sidebar-item-content {
  background: var(--accent-subtle);
}

.m-sidebar-item-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.m-sidebar-item-icon svg {
  width: 16px;
  height: 16px;
}

.m-sidebar-item-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}

/* Sidebar footer — clean, no border (matches desktop) */
.m-sidebar-footer {
  display: flex;
  align-items: center;
  padding: 8px;
  padding-bottom: max(8px, var(--m-safe-bottom));
  flex-shrink: 0;
  gap: 4px;
  margin-top: auto;
}

.m-sidebar-balance {
  font-size: 13px;
  font-weight: 425;
  color: var(--text-1);
  cursor: pointer;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.m-sidebar-balance:hover {
  color: var(--text-0);
  background: var(--bg-input);
  border-radius: 6px;
}

.m-sidebar-balance:active {
  color: var(--text-0);
}

/* Theme toggle — no push right, stays inline with other footer buttons */

.m-sidebar-footer-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border: none;
  background: none;
  color: var(--text-2);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.m-sidebar-footer-btn:hover {
  background: var(--bg-input);
  color: var(--text-0);
}

.m-sidebar-footer-btn:active {
  background: var(--bg-input-hover);
}

.m-sidebar-footer-btn svg {
  width: 18px;
  height: 18px;
}

/* Desktop-only elements */
.m-desktop-only { display: none; }
@media (min-width: 768px) {
  .m-desktop-only { display: inline-flex; }
}

/* ── Keyboard Shortcuts Modal ── */
.m-shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
}
.m-shortcuts-overlay.open {
  opacity: 1;
  visibility: visible;
}
.m-shortcuts-card {
  background: var(--bg-solid);
  border: 1px solid var(--m-panel-border);
  border-radius: 16px;
  padding: 28px 32px 24px;
  min-width: 380px;
  max-width: 440px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
  position: relative;
}
.m-shortcuts-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-0);
  margin-bottom: 20px;
}
.m-shortcuts-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-2);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.m-shortcuts-close:hover {
  background: var(--m-msg-user-bg);
  color: var(--text-0);
}
.m-shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.m-shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.m-shortcut-label {
  font-size: 14px;
  color: var(--text-1);
}
.m-shortcut-keys {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.m-shortcut-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--m-msg-user-bg);
  border: 1px solid var(--m-panel-border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  font-family: inherit;
  box-shadow: 0 1px 0 var(--m-panel-border);
}

/* ── Sidebar Sections ── */
.m-sidebar-section {
  margin-bottom: 0;
}

.m-sidebar-section + .m-sidebar-section {
  margin-top: 8px;
}

.m-sidebar-section-header {
  height: 26px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px 4px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.m-sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}

.m-sidebar-section-badge {
  font-size: 10px;
  color: var(--text-2);
  background: var(--bg-input);
  padding: 1px 6px;
  border-radius: 8px;
}

.m-sidebar-section-chevron {
  width: 12px;
  height: 12px;
  margin-left: auto;
  color: var(--text-2);
  transition: transform 0.2s var(--ease);
}

.m-sidebar-section-chevron.collapsed {
  transform: rotate(-90deg);
}

.m-sidebar-section.collapsed .m-sidebar-section-chevron {
  transform: rotate(-90deg);
}

.m-sidebar-section-content.collapsed {
  display: none;
}

.m-sidebar-section.collapsed .m-sidebar-section-content {
  display: none;
}

.m-sidebar-section-empty {
  padding: 6px 12px 8px;
  font-size: 12px;
  color: var(--text-2);
  font-style: italic;
}


/* ── Date Groups ── */
.m-sidebar-date-group {
  /* Date group wrapper */
}

.m-sidebar-date-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  height: 24px;
}

.m-sidebar-date-header span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0;
}

.m-date-chevron {
  width: 8px;
  height: 8px;
  color: var(--text-2);
  transition: transform 0.2s var(--ease);
}

.m-date-chevron svg {
  width: 8px;
  height: 8px;
}

.m-sidebar-date-group.collapsed .m-date-chevron {
  transform: rotate(-90deg);
}

.m-sidebar-date-body {
  /* Items container inside date group */
}

.m-sidebar-date-group.collapsed .m-sidebar-date-body {
  display: none;
}

/* ── Admin: all users section ── */
[data-section="admin-users"] .m-sidebar-date-header {
  padding: 10px 12px 4px;
  height: auto;
  min-height: 20px;
}
[data-section="admin-users"] .m-sidebar-date-header span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - 16px);
  font-size: 11px;
  color: var(--accent, #6d9fff);
  font-weight: 600;
}
[data-section="admin-users"] .m-sidebar-item {
  padding: 4px 12px 4px 20px;
  min-height: 28px;
}
[data-section="admin-users"] .m-sidebar-item-title {
  font-size: 12px;
  line-height: 1.3;
}


/* ── Folders ── */
.m-sidebar-folder-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  margin: 0 4px;
  cursor: pointer;
  height: 32px;
  border-radius: 6px;
  transition: background 0.1s ease;
}

.m-sidebar-folder-header:hover {
  background: rgba(0, 0, 0, 0.04);
}

.m-sidebar-folder-header:active {
  background: var(--bg-input);
}

[data-theme="dark"] .m-sidebar-folder-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.m-sidebar-folder-icon {
  width: 16px;
  height: 16px;
  color: var(--text-2);
  flex-shrink: 0;
}

.m-sidebar-folder-name {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-1);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m-sidebar-folder-chevron {
  display: none;
}

.m-sidebar-folder-children {
  padding-left: 16px;
  overflow: hidden;
  transition: max-height 0.25s var(--ease), opacity 0.2s var(--ease);
  opacity: 1;
  position: relative;
}

/* Vertical indent guide line (VS Code style) */
.m-sidebar-folder-children::before {
  content: '';
  position: absolute;
  left: calc(4px + 14px);
  top: 0;
  bottom: 4px;
  width: 1px;
  background: var(--border);
  opacity: 0.5;
  z-index: 1;
  pointer-events: none;
}

/* Nested indent guide lines shift right */
.m-sidebar-folder-children .m-sidebar-folder-children::before {
  left: calc(4px + 12px);
}

.m-sidebar-folder-children.collapsed {
  max-height: 0 !important;
  opacity: 0;
  pointer-events: none;
}




/* ── Context Menu (Mobile Bottom Sheet) ── */
.m-context-backdrop,
.m-folder-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
}

.m-context-backdrop.visible,
.m-folder-menu-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.m-context-menu {
  position: fixed;
  bottom: calc(8px + var(--m-safe-bottom));
  left: 8px;
  right: 8px;
  z-index: 9901;
  background: var(--m-sidebar-bg);
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  transform: translateY(calc(100% + 8px + var(--m-safe-bottom)));
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.12),
    0 0 0 0.5px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .m-context-menu {
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.m-context-menu.visible {
  transform: translateY(0);
}

/* Drag handle — hidden (Apple action sheets have none) */
.m-context-menu::before {
  display: none;
}

/* Title — presentation name / folder name */
.m-context-title,
.m-context-menu-title {
  padding: 8px 20px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Action items group */
.m-context-actions {
  padding: 4px 8px;
}

.m-context-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  font-size: 16px;
  font-weight: 450;
  letter-spacing: -0.01em;
  color: var(--text-0);
  background: transparent;
  border: none;
  border-radius: 12px;
  width: 100%;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s ease;
}

.m-context-menu-item:active {
  background: rgba(0, 0, 0, 0.06);
  transition: none;
}

[data-theme="dark"] .m-context-menu-item:active {
  background: rgba(255, 255, 255, 0.08);
}

.m-context-menu-item .m-ctx-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  color: var(--text-1);
}

[data-theme="dark"] .m-context-menu-item .m-ctx-icon {
  background: rgba(255, 255, 255, 0.10);
}

.m-context-menu-item.danger .m-ctx-icon {
  background: rgba(239, 68, 68, 0.10);
  color: #ef4444;
}

[data-theme="dark"] .m-context-menu-item.danger .m-ctx-icon {
  background: rgba(239, 68, 68, 0.18);
}

.m-context-menu-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.m-context-menu-item.danger {
  color: #ef4444;
}

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

.m-context-cancel {
  display: block;
  width: 100%;
  text-align: center;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-top: 1px solid var(--m-panel-border);
  margin-top: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.m-context-cancel:active {
  background: var(--bg-input);
}


/* ── Profile Bottom Sheet ── */

.m-profile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
}

.m-profile-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.m-profile-sheet {
  position: fixed;
  bottom: calc(8px + var(--m-safe-bottom));
  left: 8px;
  right: 8px;
  z-index: 10001;
  background: var(--m-sidebar-bg);
  border-radius: 14px;
  padding: 0 0 4px;
  transform: translateY(calc(100% + 8px + var(--m-safe-bottom)));
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.12),
    0 0 0 0.5px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .m-profile-sheet {
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.m-profile-sheet.visible {
  transform: translateY(0);
}

/* Drag handle — hidden */
.m-profile-handle {
  display: none;
}

.m-profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px 16px;
}

.m-profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.m-profile-email {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-profile-balance {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

.m-profile-actions {
  padding: 0 8px 4px;
}

.m-profile-action-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  font-size: 16px;
  font-weight: 450;
  letter-spacing: -0.01em;
  color: var(--text-0);
  background: transparent;
  border: none;
  border-radius: 12px;
  width: 100%;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s ease;
}

.m-profile-action-btn:active {
  background: rgba(0, 0, 0, 0.06);
  transition: none;
}

[data-theme="dark"] .m-profile-action-btn:active {
  background: rgba(255, 255, 255, 0.08);
}

.m-profile-action-btn.danger {
  color: #ef4444;
}

.m-profile-action-btn.danger .m-ctx-icon {
  background: rgba(239, 68, 68, 0.10);
  color: #ef4444;
}

[data-theme="dark"] .m-profile-action-btn.danger .m-ctx-icon {
  background: rgba(239, 68, 68, 0.18);
}

.m-profile-actions .m-context-separator {
  margin: 4px 14px;
}

/* Password section */
.m-profile-pass-section {
  padding: 0 20px 12px;
}

.m-profile-pass-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--m-panel-border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-0);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

[data-theme="dark"] .m-profile-pass-input {
  background: rgba(255, 255, 255, 0.06);
}

.m-profile-pass-input:focus {
  border-color: var(--accent);
}

.m-profile-pass-save {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: opacity 0.15s ease;
}

.m-profile-pass-save:active {
  opacity: 0.85;
}


/* ── Topup Bottom Sheet ── */

/* ── Topup/Usage Overlay ── */
.m-topup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
}

[data-theme="dark"] .m-topup-backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.m-topup-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.m-topup-sheet {
  position: fixed;
  bottom: calc(8px + var(--m-safe-bottom));
  left: 8px;
  right: 8px;
  z-index: 10001;
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 20px 20px;
  max-height: calc(85vh - var(--m-safe-bottom));
  overflow-y: auto;
  transform: translateY(calc(100% + 8px + var(--m-safe-bottom)));
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.12),
    0 0 0 0.5px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .m-topup-sheet {
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.m-topup-sheet.visible {
  transform: translateY(0);
}

/* Header: tabs + close */
.m-topup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 12px;
}

.m-topup-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: 8px;
  padding: 3px;
}

.m-topup-tab {
  padding: 6px 16px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.m-topup-tab:hover { color: var(--text-0); }

.m-topup-tab.active {
  background: var(--bg-solid);
  color: var(--text-0);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.m-topup-close {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 22px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.m-topup-close:hover {
  background: var(--bg-input);
  color: var(--text-0);
}

/* Balance bar */
.m-topup-balance {
  font-size: 14px;
  color: var(--text-1);
  text-align: center;
  padding: 12px;
  background: var(--bg-input);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.m-topup-balance strong {
  color: var(--text-0);
  font-weight: 700;
}

/* Tab content */
.m-topup-tab-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Topup grid */
.m-topup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.m-topup-amount-btn {
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg-input);
  color: var(--text-1);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.m-topup-amount-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.m-topup-amount-btn.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--canvas);
}

.m-topup-amount-btn:active {
  transform: scale(0.97);
}

.m-topup-custom-input {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg-input);
  color: var(--text-0);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.m-topup-custom-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.m-topup-custom-input::placeholder {
  color: var(--text-2);
}

.m-topup-pay-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: var(--canvas);
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease;
}

.m-topup-pay-btn:active {
  opacity: 0.85;
}

.m-topup-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
}

/* ── Usage Tab Styles ── */
.m-usage-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.m-usage-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
}

[data-theme="dark"] .m-usage-card {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}

.m-usage-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.m-usage-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-0);
}

.m-usage-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.m-breakdown-chip {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  white-space: nowrap;
}

.m-usage-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.m-usage-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.m-usage-empty {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  padding: 14px;
}

/* Presentations list */
.m-usage-presentations {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
}

.m-usage-pres-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  gap: 10px;
}

.m-usage-pres-item.clickable { cursor: pointer; }

.m-usage-pres-item.clickable:hover {
  border-color: var(--border);
  background: var(--bg-solid);
}

.m-usage-pres-item.clickable:active {
  transform: scale(0.99);
}

.m-usage-pres-item.muted { opacity: 0.6; }

.m-usage-pres-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.m-usage-pres-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.m-usage-pres-cost {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-0);
}

.m-usage-pres-count {
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
}

/* Transaction log */
.m-usage-log {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--border);
}

.m-usage-log-row {
  display: grid;
  grid-template-columns: 48px 1fr 72px;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-solid);
  font-size: 12px;
  gap: 6px;
}

.m-usage-log-row:first-child { border-radius: 9px 9px 0 0; }
.m-usage-log-row:last-child { border-radius: 0 0 9px 9px; }

.m-usage-log-row.header {
  font-weight: 600;
  color: var(--text-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-input);
}

.m-usage-log-time {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.m-usage-log-desc {
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-usage-log-amount {
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.m-usage-log-amount.negative { color: var(--text-0); }
.m-usage-log-amount.positive { color: #22c55e; }


/* ── Share Bottom Sheet ── */

/* ── Share Backdrop ── */
.m-share-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
}

[data-theme="dark"] .m-share-backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.m-share-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Share Sheet ── */
.m-share-sheet {
  position: fixed;
  bottom: calc(8px + var(--m-safe-bottom));
  left: 8px;
  right: 8px;
  z-index: 10001;
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0 20px 20px;
  max-height: calc(85vh - var(--m-safe-bottom));
  overflow-y: auto;
  transform: translateY(calc(100% + 8px + var(--m-safe-bottom)));
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .m-share-sheet {
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

.m-share-sheet.visible {
  transform: translateY(0);
}

/* Drag handle */
.m-share-handle {
  width: 36px;
  height: 4px;
  background: var(--text-2, rgba(0, 0, 0, 0.18));
  border-radius: 2px;
  margin: 10px auto 4px;
}

[data-theme="dark"] .m-share-handle {
  background: rgba(255, 255, 255, 0.22);
}

/* Header: title + close */
.m-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 16px;
}

.m-share-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-0);
  letter-spacing: -0.02em;
}

.m-share-close {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.m-share-close:hover {
  background: var(--bg-input);
  color: var(--text-0);
}

/* Body */
.m-share-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Groups (sections) */
.m-share-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.m-share-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ── Publish card (public link toggle) ── */
.m-share-publish-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.m-share-publish-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.m-share-publish-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.m-share-publish-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-0);
}

.m-share-publish-desc {
  font-size: 12px;
  color: var(--text-2);
}

/* Toggle switch */
.m-share-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.m-share-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.m-share-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.m-share-toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.m-share-toggle input:checked + .m-share-toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.m-share-toggle input:checked + .m-share-toggle-slider::before {
  transform: translateX(20px);
}

/* ── Publish URL field + copy button ── */
.m-share-publish-url {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.m-share-link-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-solid);
  color: var(--text-1);
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.m-share-link-input:focus {
  border-color: var(--accent);
}

.m-share-link-input[readonly] {
  cursor: default;
  color: var(--text-2);
}

.m-share-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-solid);
  color: var(--text-0);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.m-share-copy-btn:hover {
  background: var(--bg-input-hover);
  border-color: var(--accent);
}

.m-share-copy-btn:active {
  transform: scale(0.94);
}

.m-share-copy-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.m-share-copy-btn.copied {
  border-color: #22c55e;
  color: #22c55e;
}

/* ── Invite form: email + level + button ── */
.m-share-invite-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.m-share-invite-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-0);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.m-share-invite-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.m-share-invite-input::placeholder {
  color: var(--text-2);
}

.m-share-invite-level {
  padding: 10px 28px 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-0);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%23888' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s ease;
}

.m-share-invite-level:focus {
  border-color: var(--accent);
}

.m-share-invite-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--canvas);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: opacity 0.15s ease;
}

.m-share-invite-btn:active {
  opacity: 0.85;
}

.m-share-invite-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── Invites list (collaborators) ── */
.m-share-invites-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.m-share-invite-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.m-share-invite-item:hover {
  background: var(--bg-input);
}

.m-share-invite-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.m-share-invite-email {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-share-invite-role {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-1);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%23888' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 22px;
  outline: none;
  transition: border-color 0.15s ease;
}

.m-share-invite-role:focus {
  border-color: var(--accent);
}

.m-share-invite-remove {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.m-share-invite-remove:hover {
  background: rgba(239, 68, 68, 0.10);
  color: #ef4444;
}

.m-share-invite-remove svg {
  width: 16px;
  height: 16px;
}

.m-share-invites-empty {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  padding: 14px;
}

/* ── Access card (link access + copy link button) ── */
.m-share-access-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.m-share-access-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.m-share-access-icon {
  flex-shrink: 0;
  color: var(--text-1);
}

.m-share-access-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.m-share-access-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-0);
}

.m-share-access-select {
  padding: 6px 28px 6px 0;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%23888' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
}

.m-share-access-hint {
  font-size: 12px;
  color: var(--text-2);
  margin: 0;
}

.m-share-copy-link-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: var(--canvas);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: opacity 0.15s ease;
}

.m-share-copy-link-btn:active {
  opacity: 0.85;
}

.m-share-copy-link-btn svg {
  width: 14px;
  height: 14px;
}

.m-share-copy-link-btn.copied {
  background: #22c55e;
}


/* =====================================================================
   13. LOADING STATES
   Shimmer/skeleton placeholders during loading and generation.
   ===================================================================== */

/* Generic skeleton shimmer */
.m-skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-input) 25%,
    var(--bg-input-hover) 50%,
    var(--bg-input) 75%
  );
  background-size: 200% 100%;
  animation: m-shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

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

/* Slide skeleton placeholder */
.m-slide-skeleton {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: linear-gradient(
    90deg,
    var(--bg-input) 25%,
    var(--bg-input-hover) 50%,
    var(--bg-input) 75%
  );
  background-size: 200% 100%;
  animation: m-shimmer 1.8s ease-in-out infinite;
  position: relative;
}

.m-gen-status {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  z-index: 5;
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}

/* Shimmer overlay during generation (on top of feed) */
.m-shimmer-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.06) 30%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.06) 70%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: m-shimmer 2s ease-in-out infinite;
  border-radius: var(--radius);
}

[data-theme="dark"] .m-shimmer-overlay {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.03) 30%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.03) 70%,
    transparent 100%
  );
  background-size: 200% 100%;
}

/* Text skeleton lines */
.m-skeleton-line {
  height: 12px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.m-skeleton-line:last-child {
  margin-bottom: 0;
}

.m-skeleton-line.short {
  width: 60%;
}

.m-skeleton-line.medium {
  width: 80%;
}

/* ─── Enhanced Slide Shimmer (aurora + placeholders) ───── */

.m-slide-skeleton .m-slide-canvas-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 16 / 9;
}

.m-shimmer-aurora {
  position: absolute;
  inset: -40%;
  background: conic-gradient(
    from 0deg at 50% 50%,
    #667eea, #764ba2, #f093fb, #4facfe,
    #00f2fe, #43e97b, #fa709a, #fee140, #667eea
  );
  filter: blur(80px);
  opacity: 0.25;
  animation: m-aurora-rotate 10s linear infinite;
}

[data-theme="dark"] .m-shimmer-aurora {
  opacity: 0.15;
}

@keyframes m-aurora-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.m-shimmer-sweep {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 70%
  );
  animation: m-sweep-move 3s ease-in-out infinite;
}

[data-theme="dark"] .m-shimmer-sweep {
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 70%
  );
}

@keyframes m-sweep-move {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(130%); }
}

.m-shimmer-placeholders {
  position: absolute;
  inset: 0;
  padding: 12% 8%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.m-shimmer-ph {
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .m-shimmer-ph {
  background: rgba(255, 255, 255, 0.05);
}

.m-shimmer-ph-title {
  width: 55%;
  height: 14%;
  border-radius: 8px;
}

.m-shimmer-ph-subtitle {
  width: 35%;
  height: 7%;
  border-radius: 5px;
}

.m-shimmer-ph-body {
  display: flex;
  gap: 12px;
  flex: 1;
  margin-top: 6px;
}

.m-shimmer-ph-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}

.m-shimmer-ph-line {
  height: 8px;
  border-radius: 4px;
}

.m-shimmer-ph-line:nth-child(1) { width: 92%; }
.m-shimmer-ph-line:nth-child(2) { width: 78%; }
.m-shimmer-ph-line:nth-child(3) { width: 85%; }
.m-shimmer-ph-line:nth-child(4) { width: 65%; }

.m-shimmer-ph-image {
  flex: 0 0 38%;
  border-radius: 8px;
}

/* Slide skeleton appear animation */
.m-slide-skeleton {
  animation: m-skeleton-appear 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  background: none;
}

.m-slide-skeleton:nth-child(2) { animation-delay: 0.08s; }
.m-slide-skeleton:nth-child(3) { animation-delay: 0.16s; }
.m-slide-skeleton:nth-child(4) { animation-delay: 0.24s; }
.m-slide-skeleton:nth-child(5) { animation-delay: 0.32s; }
.m-slide-skeleton:nth-child(6) { animation-delay: 0.4s; }
.m-slide-skeleton:nth-child(7) { animation-delay: 0.48s; }
.m-slide-skeleton:nth-child(8) { animation-delay: 0.56s; }

@keyframes m-skeleton-appear {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── Generation Progress Bar (in slide counter area) ───── */

.m-gen-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9999;
  background: var(--border);
  overflow: hidden;
}

.m-gen-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.6s ease;
  border-radius: 0 2px 2px 0;
}

/* ─── Reassurance Cards (mobile-optimized) ───── */

.m-reassurance {
  position: fixed;
  top: 16px;
  right: 16px;
  left: auto;
  z-index: 10001;
  width: 280px;
  max-width: calc(100vw - 32px);
  padding: 14px 16px 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.10);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.06);
  font-family: var(--font-body);
  animation: m-reassurance-in 0.4s var(--ease-spring);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

[data-theme="dark"] .m-reassurance {
  background: rgba(30, 30, 34, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.40), 0 2px 8px rgba(0, 0, 0, 0.25);
}

.m-reassurance.fade-out {
  animation: m-reassurance-out 0.3s ease forwards;
}

.m-reassurance-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
}

.m-reassurance-body {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

.m-reassurance-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}

.m-reassurance-close:active {
  background: var(--bg-hover);
  color: var(--text-1);
}

.m-reassurance-mute {
  align-self: flex-end;
  padding: 4px 10px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-3);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 2px;
}

[data-theme="dark"] .m-reassurance-mute {
  border-color: rgba(255, 255, 255, 0.12);
}

@keyframes m-reassurance-in {
  from { transform: translateX(40px) scale(0.95); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes m-reassurance-out {
  to { transform: translateX(40px) scale(0.95); opacity: 0; }
}

/* ─── Chat Shimmer Message ───── */

.m-chat-shimmer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--bg-input);
  border: 1px solid var(--border);
  position: relative;
  overflow: visible;
}

.m-chat-shimmer .m-shimmer-text {
  display: block;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 13px;
  background: linear-gradient(
    90deg,
    #7b7f94 0%,
    #7b7f94 35%,
    var(--text-0) 50%,
    #7b7f94 65%,
    #7b7f94 100%
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: m-text-shimmer 2s ease-in-out infinite;
}

[data-theme="dark"] .m-chat-shimmer .m-shimmer-text {
  background: linear-gradient(
    90deg,
    #8e8e96 0%,
    #8e8e96 35%,
    #f0f0f3 50%,
    #8e8e96 65%,
    #8e8e96 100%
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes m-text-shimmer {
  0% { background-position: 100% center; }
  100% { background-position: 0% center; }
}

.m-chat-shimmer .m-shimmer-progress {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
}

.m-chat-shimmer .m-shimmer-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.6s ease;
}

.m-shimmer-trail {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  margin-top: 4px;
}

.m-trail-step {
  font-size: 11px;
  color: var(--text-3);
  opacity: 0;
  line-height: 1.3;
  animation: m-trail-fade-in 0.3s ease-out forwards;
}

@keyframes m-trail-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 0.5; transform: translateY(0); }
}


/* =====================================================================
   14. TOAST NOTIFICATIONS
   Fixed bottom-center notification pills above the FAB group.
   ===================================================================== */

.m-toast-container {
  position: fixed;
  bottom: calc(90px + var(--m-safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 11000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.m-toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--m-fab-bg);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-0);
  max-width: min(400px, calc(100vw - 32px));
  text-align: center;
  pointer-events: auto;
  animation: m-toast-in 0.35s var(--ease-spring) both;
}

.m-toast.warning {
  border-color: rgba(245, 158, 11, 0.25);
  background: color-mix(in srgb, var(--m-fab-bg) 92%, #f59e0b);
}

.m-toast.error {
  border-color: rgba(239, 68, 68, 0.25);
  background: color-mix(in srgb, var(--m-fab-bg) 92%, #ef4444);
}

@keyframes m-toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.m-toast.exit {
  animation: m-toast-out 0.2s var(--ease) forwards;
}

@keyframes m-toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
  }
}

.m-toast-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.m-toast.success .m-toast-icon {
  color: #22c55e;
}

.m-toast.error .m-toast-icon {
  color: #ef4444;
}

.m-toast.info .m-toast-icon {
  color: var(--accent-blue);
}

.m-toast.warning .m-toast-icon {
  color: #f59e0b;
}


/* =====================================================================
   15. BREAKPOINT OVERRIDES
   Phone-specific adjustments for narrow viewports.
   ===================================================================== */

@media (max-width: 480px) {
  /* FAB position tighter to edge */
  .m-fab-group {
    bottom: calc(12px + var(--m-safe-bottom));
    right: 12px;
  }

  /* Chat panel goes full-width */
  .m-chat-panel {
    left: 8px;
    right: 8px;
    bottom: calc(8px + var(--m-safe-bottom));
    width: auto;
    height: min(70vh, calc(var(--m-vvh, 100dvh) - 60px));
    max-height: calc(var(--m-vvh, 100dvh) - 60px);
    border-radius: 16px;
    transform-origin: calc(100% - 8px) 100%;
  }

  /* Messages slightly wider */
  .m-chat-msg {
    max-width: 90%;
    font-size: 14px;
  }

  /* 16px input prevents iOS zoom */
  .m-chat-input {
    font-size: 16px;
  }

  /* Ensure 44x44 tap targets */
  .m-chat-close-btn {
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
  }

  /* Sidebar takes more width */
  .m-sidebar-drawer {
    width: min(300px, 90vw);
  }

  /* Toast above FAB */
  .m-toast-container {
    bottom: calc(80px + var(--m-safe-bottom));
    max-width: calc(100vw - 32px);
  }

  .m-toast {
    font-size: 12px;
    padding: 8px 16px;
  }
}


/* =====================================================================
   16. ACCESSIBILITY
   Respect user's reduced-motion preference.
   ===================================================================== */

@media (prefers-reduced-motion: reduce) {
  .m-fab-btn,
  .m-chat-panel,
  .m-chat-msg,
  .m-fab-badge,
  .m-fab-chat-icon,
  .m-fab-chat-close-icon,
  .m-slide-card,
  .m-fab-wrap,
  .m-fab-popup,
  .m-fab-label,
  .m-composer-action-btn,
  .m-sidebar-drawer,
  .m-sidebar-scrim,
  .m-sidebar-section-chevron,
  .m-sidebar-folder-chevron,
  .m-sidebar-folder-children,
  .m-context-backdrop,
  .m-context-menu,
  .m-scrim,
  .m-toast,
  .m-fullscreen,
  .m-drag-handle {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .m-skeleton,
  .m-slide-skeleton,
  .m-shimmer-overlay,
  .m-shimmer-aurora,
  .m-shimmer-sweep,
  .m-chat-shimmer .m-shimmer-text {
    animation: none;
    background: var(--bg-input);
  }

  .m-reassurance,
  .m-reassurance.fade-out {
    animation-duration: 0.01ms !important;
  }

  .m-typing-dot {
    animation: none;
    opacity: 0.5;
  }

  .m-typing-dot:nth-child(1) { opacity: 0.35; }
  .m-typing-dot:nth-child(2) { opacity: 0.55; }
  .m-typing-dot:nth-child(3) { opacity: 0.75; }
}


/* =====================================================================
   17. iOS SAFARI FIXES
   Workarounds for Safari-specific rendering quirks.
   ===================================================================== */

/* Suppress tap highlight everywhere */
.m-toolbar-btn,
.m-fab-btn,
.m-slide-card,
.m-chat-close-btn,
.m-chat-send,
.m-composer-action-btn,
.m-composer-circle-btn,
.m-composer-send,
.m-fs-close,
.m-fs-btn,
.m-sidebar-close,
.m-sidebar-new-btn,
.m-sidebar-item,
.m-sidebar-footer-btn,
.m-sidebar-section-header,
.m-sidebar-folder-header,
.m-sidebar-more-btn,
.m-context-menu-item,
.m-context-cancel,
.m-btn-primary,
.m-btn-google,
.m-fab-popup-btn {
  -webkit-tap-highlight-color: transparent;
}

/* Manipulation touch-action on all buttons */
.m-toolbar-btn,
.m-fab-btn,
.m-chat-close-btn,
.m-chat-send,
.m-composer-action-btn,
.m-composer-circle-btn,
.m-composer-send,
.m-fs-close,
.m-fs-btn,
.m-sidebar-close,
.m-sidebar-new-btn,
.m-sidebar-item,
.m-sidebar-footer-btn,
.m-sidebar-more-btn,
.m-context-menu-item,
.m-context-cancel,
.m-btn-primary,
.m-btn-google,
.m-fab-popup-btn {
  touch-action: manipulation;
}

/* Overscroll containment */
.m-slide-feed,
.m-chat-messages,
.m-sidebar-list {
  overscroll-behavior: contain;
}

/* 100dvh fallback */
.m-fullscreen,
.m-auth-overlay {
  height: 100vh;
  height: 100dvh;
}

@supports (-webkit-touch-callout: none) {
  .m-chat-panel,
  .m-toolbar {
    isolation: isolate;
  }

  /* Fix iOS rubber-band scrolling interference with panels */
  .m-chat-panel,
  .m-sidebar-drawer {
    -webkit-overflow-scrolling: auto;
  }
}

/* Logo marks (reused in auth and sidebar) — two overlapping slides */
.logo-mark {
  display: block;
  position: relative;
  width: 28px;
  height: 24px;
  flex-shrink: 0;
}

.logo-mark::before,
.logo-mark::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 16px;
  border-radius: 5px;
  border: 1.5px solid var(--text-1);
}

.logo-mark::before {
  top: 0;
  left: 0;
  background: var(--accent-subtle);
}

.logo-mark::after {
  bottom: 0;
  right: 0;
  background: var(--accent-subtle);
}

.logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-0);
  letter-spacing: -0.5px;
}

/* =====================================================================
   18. BRAND PICKER POPUP
   Floating popup for selecting brand presets.
   ===================================================================== */

.m-brand-picker {
  position: fixed;
  z-index: 9600;
  right: 72px;
  bottom: calc(80px + var(--m-safe-bottom));
  width: 200px;
  max-height: min(320px, calc(var(--m-vvh, 100dvh) - 200px));
  background: var(--m-panel-bg);
  border: 1px solid var(--m-panel-border);
  border-radius: var(--radius);
  box-shadow: var(--m-panel-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.8);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s var(--ease-spring), opacity 0.2s var(--ease);
}

.m-brand-picker.visible {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}

.m-brand-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.m-brand-picker-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-0);
}

.m-brand-picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.m-brand-picker-list::-webkit-scrollbar {
  width: 3px;
}

.m-brand-picker-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.m-brand-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.m-brand-picker-item:hover {
  background: var(--bg-input);
}

.m-brand-picker-item:active {
  background: var(--bg-input-hover);
}

.m-brand-picker-item.active {
  background: var(--accent-subtle);
}

.m-brand-picker-item.coming-soon {
  opacity: 0.45;
  cursor: default;
}

.m-brand-picker-item-dot {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .m-brand-picker-item-dot {
  border-color: rgba(255, 255, 255, 0.12);
}

.m-brand-picker-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-0);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-brand-picker-item-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.m-brand-picker-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-2);
  padding: 12px 12px 4px;
}

@media (max-width: 480px) {
  .m-brand-picker {
    right: 64px;
    bottom: calc(72px + var(--m-safe-bottom));
  }
}


/* =====================================================================
   18b. BRAND PICKER — ENHANCED (search, industry tabs, cards grid)
   ===================================================================== */

.m-brand-search-wrap {
  position: relative;
  padding: 0 12px 8px;
  flex-shrink: 0;
}

.m-brand-search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(calc(-50% - 4px));
  color: var(--text-2);
  pointer-events: none;
}

.m-brand-search-input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input, var(--bg-1));
  color: var(--text-0);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.m-brand-search-input:focus {
  border-color: var(--accent);
}

.m-brand-search-input::placeholder {
  color: var(--text-2);
}

.m-brand-tabs-wrap {
  display: flex;
  gap: 4px;
  padding: 0 12px 8px;
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.m-brand-tabs-wrap::-webkit-scrollbar {
  display: none;
}

.m-brand-tab {
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-1);
  font-size: 12px;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.m-brand-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.m-brand-tab:active {
  transform: scale(0.96);
}

/* Grid of brand cards */
.m-brand-picker-grid {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  align-content: start;
}

.m-brand-picker-grid::-webkit-scrollbar {
  width: 3px;
}
.m-brand-picker-grid::-webkit-scrollbar-thumb {
  background: var(--text-2);
  border-radius: 3px;
  opacity: 0.3;
}

.m-brand-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  min-height: 0;
}

.m-brand-card:hover {
  border-color: var(--text-2);
}

.m-brand-card:active {
  transform: scale(0.97);
}

.m-brand-card.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-1));
}

.m-brand-card.coming-soon {
  opacity: 0.4;
  pointer-events: none;
}

.m-brand-card-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: color-mix(in srgb, var(--brand-color, #888) 8%, transparent);
}

.m-brand-card-logo img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.m-brand-card-logo--none {
  background: var(--bg-input, var(--bg-1));
  color: var(--text-2);
}

.m-brand-monogram {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-color, var(--text-0));
}

.m-brand-card-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-0);
  text-align: center;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  padding: 0 2px;
}

.m-brand-card-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-2);
  letter-spacing: 0.3px;
}

.m-brand-card-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.m-brand-section-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0 2px;
  color: var(--text-2);
}

.m-brand-section-icon {
  display: flex;
}

.m-brand-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.m-brand-empty {
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
}


/* =====================================================================
   18c. FILE BADGE (attached file chip above composer)
   ===================================================================== */

/* ── File chips (above composer) ── */
.m-composer-files {
  display: flex;
  gap: 6px;
  padding: 8px 12px 6px;
  overflow-x: auto;
  overflow-y: hidden;
  border-top: 1px solid var(--border);
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.m-composer-files::-webkit-scrollbar {
  display: none;
}

.m-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 8px;
  background: var(--m-msg-user-bg, rgba(0,0,0,0.04));
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-1);
  animation: m-fade-in 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.m-file-chip-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m-file-chip-remove {
  width: 16px;
  height: 16px;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.15s;
}

.m-file-chip-remove:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Loading state */
.m-file-chip.loading {
  opacity: 0.7;
}
.m-file-chip-spinner {
  width: 10px;
  height: 10px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  animation: m-chip-spin 0.6s linear infinite;
}
@keyframes m-chip-spin {
  to { transform: rotate(360deg); }
}


/* =====================================================================
   18d. PAYWALL BANNER
   ===================================================================== */

.m-paywall-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 0 10px 4px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06) 0%, rgba(59, 130, 246, 0.04) 100%);
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-1);
  flex-shrink: 0;
}

.m-paywall-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0071e3, #2997ff);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.m-paywall-icon svg {
  width: 16px;
  height: 16px;
  color: #fff;
}

.m-paywall-body { flex: 1; min-width: 0; }
.m-paywall-title { font-weight: 600; font-size: 13px; color: var(--text-0); line-height: 1.3; }
.m-paywall-sub { font-size: 11px; color: var(--text-2); margin-top: 1px; }

.m-paywall-topup-btn {
  padding: 6px 16px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: var(--canvas, #fff);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.m-paywall-topup-btn:active {
  transform: scale(0.96);
}

/* =====================================================================
   18e. DRAG OVER STATE
   ===================================================================== */

/* Full-page drop overlay */
.m-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.m-drop-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.m-drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 48px;
  border-radius: 20px;
  background: var(--bg-glass-strong);
  border: 2px dashed var(--accent);
  box-shadow: var(--shadow-lg);
}
.m-drop-overlay-icon {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
}
.m-drop-overlay-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  font-family: var(--font-body);
}


/* =====================================================================
   19. DESKTOP LAYOUT — TABLET (>=768px)
   Sidebar pinned left, main content pushed right.
   Chat panel as floating window instead of bottom sheet.
   ===================================================================== */

@media (min-width: 768px) {

  /* ── App container: horizontal layout ── */
  .m-app {
    flex-direction: row;
    height: 100dvh;
    height: 100vh;
  }

  /* ── Sidebar: always visible, pinned left ── */
  .m-sidebar-scrim {
    display: none;
  }

  .m-sidebar-drawer {
    position: relative;
    transform: none;
    width: var(--m-sidebar-width, 200px);
    min-width: var(--m-sidebar-width, 200px);
    z-index: auto;
    border-right: 1px solid var(--sidebar-border, var(--border));
    box-shadow: none;
    transition: width 0.3s var(--ease), min-width 0.3s var(--ease);
  }

  /* Disable transition during drag for instant feedback */
  .m-sidebar-drawer.is-resizing {
    transition: none;
  }

  .m-sidebar-drawer.open {
    transform: none;
  }

  /* Collapsed sidebar — show icon strip */
  .m-sidebar-drawer.m-sidebar-collapsed {
    width: 48px;
    min-width: 48px;
    overflow: hidden;
  }

  .m-sidebar-drawer.m-sidebar-collapsed .m-sidebar-content {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
  }

  .m-sidebar-drawer.m-sidebar-collapsed .m-sidebar-strip {
    display: flex;
  }

  /* Collapsed strip layout */
  .m-sidebar-strip {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    width: 48px;
    min-width: 48px;
    position: absolute;
    inset: 0;
    z-index: 2;
  }

  .m-sidebar-collapsed-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }

  .m-sidebar-collapsed-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
  }

  .m-sidebar-collapsed-icon {
    position: relative;
    width: 32px;
    height: 32px;
    cursor: pointer;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .m-sidebar-collapsed-icon .logo-mark {
    width: 24px;
    height: 20px;
    transition: opacity 0.15s var(--ease);
  }

  .m-sidebar-collapsed-icon .logo-mark::before,
  .m-sidebar-collapsed-icon .logo-mark::after {
    width: 17px;
    height: 14px;
    border-radius: 4px;
  }

  .m-sidebar-expand-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    color: var(--text-1);
    transition: opacity 0.15s var(--ease);
  }

  .m-sidebar-collapsed-icon:hover .logo-mark {
    opacity: 0;
  }

  .m-sidebar-collapsed-icon:hover .m-sidebar-expand-icon {
    opacity: 1;
  }

  .m-sidebar-collapsed-btn {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s var(--ease);
    padding: 0;
  }

  .m-sidebar-collapsed-btn:hover {
    background: var(--bg-input);
    color: var(--text-0);
  }

  .m-sidebar-collapsed-balance {
    font-size: 10px;
    font-weight: 500;
    font-family: var(--font-display);
  }

  /* Show desktop-only collapse button (+ is permanently hidden) */
  .m-sidebar-collapse-btn {
    display: flex;
  }

  /* Keep "Новая презентация" big button visible on desktop */

  /* Sidebar header: match desktop compact padding */
  .m-sidebar-header {
    padding: 12px 10px 8px;
    padding-top: 12px;
  }

  /* Sidebar resize handle (draggable edge) */
  .m-sidebar-resize-handle {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.15s;
  }
  .m-sidebar-resize-handle:hover,
  .m-sidebar-resize-handle.active {
    background: var(--accent-blue);
  }

  /* ── Main content wrapper: column layout taking remaining space ── */
  .m-app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
  }

  /* ── Toolbar: HIDDEN on desktop (sidebar has its own header) ── */
  .m-toolbar {
    display: none !important;
  }

  /* ── Slide feed starts from top since toolbar is hidden ── */
  .m-slide-feed {
    padding-top: 16px;
  }

  /* ── Slide feed: centered with max-width, account for FAB area ── */
  .m-slide-feed {
    padding: 16px 104px 32px 32px;
    gap: 16px;
    align-items: center;
  }

  .m-slide-card {
    max-width: 900px;
    width: 100%;
  }

  .m-hero-state {
    padding: 48px 32px 60px;
    gap: 32px;
  }

  .m-demo-slides {
    max-width: 480px;
  }

  /* ── FAB group: adjust position for desktop ── */
  .m-fab-group {
    right: 24px;
    bottom: calc(24px + var(--m-safe-bottom));
  }

  /* ── Desktop: hide slide nav pill (scroll/keyboard is enough) ── */
  .m-slide-nav {
    display: none !important;
  }

  /* ── Chat panel: opens to the LEFT of the FAB, bottom-aligned ── */
  .m-chat-panel {
    bottom: calc(28px + var(--m-safe-bottom));
    right: calc(24px + var(--m-fab-size) + 12px);
    width: var(--m-chat-panel-width);
    height: min(440px, calc(100vh - 80px));
    border-radius: 16px;
    transform-origin: bottom right;
  }

  .m-chat-panel.keyboard-open {
    bottom: calc(28px + var(--m-safe-bottom));
    left: auto;
    right: calc(24px + var(--m-fab-size) + 12px);
    width: var(--m-chat-panel-width);
    border-radius: 16px;
    height: min(440px, calc(100vh - 80px));
    max-height: calc(100vh - 60px);
  }

  /* ── Chat header: keep hidden on desktop too (same as mobile) ── */

  /* ── Chat drag handle: hide on desktop ── */
  .m-chat-drag-handle {
    display: none;
  }

  /* ── Scrim: no scrim on desktop (chat doesn't block content) ── */
  .m-scrim {
    display: none;
  }

  /* ── Brand picker: reposition for desktop (left of FAB column) ── */
  .m-brand-picker {
    right: calc(24px + var(--m-fab-size) + 12px);
    bottom: calc(24px + var(--m-safe-bottom));
    max-height: min(400px, calc(100vh - 80px));
  }

  /* ── Toast: centered above content ── */
  .m-toast-container {
    bottom: 32px;
  }

  /* ── Toolbar: hidden on desktop (sidebar has branding) ── */
  #menuBtn {
    display: none;
  }
  #newPresToolbarBtn {
    display: none;
  }

  /* ── Slide nav pill: larger on desktop ── */
  .m-slide-nav {
    padding: 4px 6px;
  }

  .m-slide-nav-btn {
    width: 38px;
    height: 38px;
  }

  .m-slide-nav-btn:hover:not(:disabled) {
    background: var(--bg-input);
    color: var(--text-0);
  }

  .m-slide-nav-counter {
    font-size: 14px;
    min-width: 52px;
  }

  /* ── Fullscreen: no safe-area needed ── */
  .m-fs-nav {
    margin-bottom: 16px;
  }

  /* ── Context menu: floating card instead of bottom sheet ── */
  .m-context-menu {
    bottom: auto;
    left: auto;
    right: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    max-width: 320px;
    width: calc(100vw - 48px);
    border-radius: 14px;
    transition: transform 0.25s var(--ease-spring), opacity 0.2s var(--ease);
    opacity: 0;
  }

  .m-context-menu.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  /* ── Profile sheet: centered modal on desktop ── */
  .m-profile-sheet {
    bottom: auto;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    max-width: 400px;
    width: calc(100vw - 48px);
    border-radius: 14px;
    opacity: 0;
    transition: transform 0.25s var(--ease-spring), opacity 0.2s var(--ease);
  }

  .m-profile-sheet.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  /* ── Topup sheet: centered modal on desktop ── */
  .m-topup-sheet {
    bottom: auto;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    max-width: 520px;
    width: calc(100vw - 48px);
    border-radius: 14px;
    opacity: 0;
    transition: transform 0.25s var(--ease-spring), opacity 0.2s var(--ease);
    max-height: 85vh;
  }

  .m-topup-sheet.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  .m-usage-summary {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }

  /* ── Share sheet: centered modal on desktop ── */
  .m-share-sheet {
    bottom: auto;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    max-width: 480px;
    width: calc(100vw - 48px);
    border-radius: 20px;
    opacity: 0;
    transition: transform 0.25s var(--ease-spring), opacity 0.2s var(--ease);
    max-height: 85vh;
  }

  .m-share-sheet.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

}


/* =====================================================================
   20. DESKTOP LAYOUT — DESKTOP (>=1024px)
   Wider sidebar, larger slide previews, more breathing room.
   ===================================================================== */

@media (min-width: 1024px) {

  /* .m-toolbar hidden via 768px media query */

  .m-slide-feed {
    padding: 32px 104px 32px 48px;
    padding-bottom: calc(40px + var(--m-safe-bottom));
    gap: 20px;
  }

  .m-hero-state {
    padding: 64px 48px 80px;
    gap: 40px;
  }

  .m-demo-slides {
    max-width: 560px;
  }

  /* Chat panel: compact, left of FAB */
  .m-chat-panel {
    width: var(--m-chat-panel-width);
    height: min(440px, calc(100vh - 80px));
  }

  .m-chat-panel.keyboard-open {
    width: var(--m-chat-panel-width);
    height: min(440px, calc(100vh - 80px));
  }
}


/* =====================================================================
   21. DESKTOP LAYOUT — WIDE (>=1440px)
   Max-width containment for ultra-wide screens.
   ===================================================================== */

@media (min-width: 1440px) {

  .m-slide-feed {
    padding: 40px 104px 48px 64px;
    padding-bottom: calc(48px + var(--m-safe-bottom));
  }

  .m-slide-card {
    max-width: 1100px;
  }

  .m-demo-slides {
    max-width: 640px;
  }

  .m-hero-state {
    padding: 80px 64px 100px;
  }
}
