/* =====================================================================
   Kvill — Visual Theme Layer
   Clean flat surfaces with clear hierarchy. No glassmorphism.

   HTML: Add <link rel="stylesheet" href="/_visual-theme.css"> AFTER mobile.css
   No HTML structure changes required — this file overrides existing styles.

   Surface hierarchy (dark):
     Canvas  #111113  →  Surface-1 #1a1a1e  →  Surface-2 #222228  →  Surface-3 #2a2a31

   Sections:
   1.  Mobile Custom Properties (--m-*)
   2.  App Base & Background
   3.  Typography
   4.  Slide Feed & Cards
   5.  Slide Badge
   6.  Loading / Shimmer States
   7.  Toast Notifications
   8.  Fullscreen Overlay
   9.  Auth Overlay
   10. Scrollbar
   11. Light Theme Overrides
   ===================================================================== */


/* =====================================================================
   1. MOBILE CUSTOM PROPERTIES
   Opaque surfaces, simple shadows, clear hierarchy.
   ===================================================================== */

:root {
  /* Solid surfaces */
  --m-fab-bg: #ffffff;
  --m-fab-bg-hover: #f5f5f7;
  --m-fab-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --m-fab-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);

  --m-panel-bg: #ffffff;
  --m-panel-border: rgba(0, 0, 0, 0.12);
  --m-panel-shadow:
    0 -1px 0 rgba(0, 0, 0, 0.06),
    0 -8px 32px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);

  --m-msg-user-bg: rgba(0, 0, 0, 0.04);
  --m-msg-ai-bg: #ffffff;
  --m-msg-ai-border: rgba(0, 0, 0, 0.06);

  --m-toolbar-bg: #ffffff;
  --m-toolbar-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);

  /* Card tokens */
  --m-card-bg: #ffffff;
  --m-card-border: rgba(0, 0, 0, 0.08);
  --m-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
  --m-card-shadow-active: 0 2px 8px rgba(0, 0, 0, 0.10), 0 0 0 1px rgba(0, 0, 0, 0.05);

  /* Shimmer */
  --m-shimmer-base: rgba(0, 0, 0, 0.04);
  --m-shimmer-highlight: rgba(0, 0, 0, 0.08);
  --m-shimmer-glow: rgba(255, 255, 255, 0.6);

  /* Toast */
  --m-toast-bg: #ffffff;
  --m-toast-border: rgba(0, 0, 0, 0.08);
  --m-toast-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

/* ─── Dark theme: clear surface steps, no glass ──────────────────── */
[data-theme="dark"] {
  --m-fab-bg: #2a2a31;
  --m-fab-bg-hover: #313139;
  --m-fab-shadow: 0 2px 8px rgba(0, 0, 0, 0.30), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --m-fab-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.40), 0 0 0 1px rgba(255, 255, 255, 0.08);

  --m-panel-bg: #1a1a1e;
  --m-panel-border: rgba(255, 255, 255, 0.14);
  --m-panel-shadow:
    0 -1px 0 rgba(255, 255, 255, 0.08),
    0 -8px 32px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);

  --m-msg-user-bg: rgba(255, 255, 255, 0.08);
  --m-msg-ai-bg: #222228;
  --m-msg-ai-border: rgba(255, 255, 255, 0.08);

  --m-toolbar-bg: #1a1a1e;
  --m-toolbar-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);

  --m-card-bg: #222228;
  --m-card-border: rgba(255, 255, 255, 0.10);
  --m-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --m-card-shadow-active: 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06);

  --m-shimmer-base: rgba(255, 255, 255, 0.05);
  --m-shimmer-highlight: rgba(255, 255, 255, 0.10);
  --m-shimmer-glow: rgba(255, 255, 255, 0.04);

  --m-toast-bg: #2a2a31;
  --m-toast-border: rgba(255, 255, 255, 0.10);
  --m-toast-shadow: 0 4px 16px rgba(0, 0, 0, 0.40);
}


/* =====================================================================
   2. APP BASE & BACKGROUND
   Clean solid color, no gradients.
   ===================================================================== */

body {
  background: var(--canvas);
  min-height: 100dvh;
}

/* Smooth area for slide feed — mobile only, desktop paddings in mobile.css media queries */
@media (max-width: 767px) {
  .m-slide-feed {
    padding: 12px;
    gap: 8px;
  }
}


/* =====================================================================
   3. TYPOGRAPHY
   Outfit for headings, Inter for body. Proper weight distribution.
   ===================================================================== */

.m-toolbar-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.3px;
}

.m-chat-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.2px;
}

.m-sidebar-header .logo-text,
.m-auth-logo .logo-text,
.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* Body text consistency */
.m-chat-msg,
.m-sidebar-item-title,
.m-auth-input {
  font-family: var(--font-body);
}


/* =====================================================================
   4. SLIDE FEED & CARDS
   Premium card feel: layered shadows, subtle inner glow, active state.
   ===================================================================== */

.m-slide-card {
  background: var(--m-card-bg);
  border: 1px solid var(--m-card-border);
  border-radius: 16px;
  box-shadow: var(--m-card-shadow);
  overflow: hidden;
  transition:
    transform 0.2s var(--ease-spring),
    box-shadow 0.3s var(--ease);
}

/* No specular highlight — flat cards */
.m-slide-card::after {
  display: none;
}

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

/* Active slide — accent ring with depth */
.m-slide-card.active {
  border-color: var(--accent-blue);
  box-shadow:
    var(--m-card-shadow),
    0 0 0 2px var(--accent-glow),
    0 0 20px var(--accent-subtle);
}

[data-theme="dark"] .m-slide-card.active {
  box-shadow:
    var(--m-card-shadow),
    0 0 0 2px var(--accent-glow),
    0 0 24px var(--accent-subtle);
}

/* Canvas wrapper — clip + subtle inner shadow */
.m-slide-canvas-wrap {
  border-radius: 0;
  position: relative;
}


/* =====================================================================
   5. SLIDE BADGE — Solid pill
   ===================================================================== */

.m-slide-badge {
  background: var(--m-toast-bg);
  border: 1px solid var(--m-toast-border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  letter-spacing: 0.3px;
}

[data-theme="dark"] .m-slide-badge {
  color: var(--text-1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.30);
}


/* =====================================================================
   6. LOADING / SHIMMER STATES
   Premium gradient shimmer with subtle glow overlay.
   ===================================================================== */

/* Enhanced shimmer keyframe — diagonal sweep with glow */
@keyframes m-premium-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Skeleton base */
.m-skeleton {
  background: linear-gradient(
    105deg,
    var(--m-shimmer-base) 0%,
    var(--m-shimmer-base) 35%,
    var(--m-shimmer-highlight) 45%,
    var(--m-shimmer-glow) 50%,
    var(--m-shimmer-highlight) 55%,
    var(--m-shimmer-base) 65%,
    var(--m-shimmer-base) 100%
  );
  background-size: 300% 100%;
  animation: m-premium-shimmer 2.2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* Slide skeleton — wider shimmer, rounded corners */
.m-slide-skeleton {
  background: linear-gradient(
    105deg,
    var(--m-shimmer-base) 0%,
    var(--m-shimmer-base) 35%,
    var(--m-shimmer-highlight) 45%,
    var(--m-shimmer-glow) 50%,
    var(--m-shimmer-highlight) 55%,
    var(--m-shimmer-base) 65%,
    var(--m-shimmer-base) 100%
  );
  background-size: 300% 100%;
  animation: m-premium-shimmer 2.2s ease-in-out infinite;
  border-radius: 16px;
  border: 1px solid var(--m-card-border);
  box-shadow: var(--m-card-shadow);
}

/* Shimmer overlay during generation */
.m-shimmer-overlay {
  background: linear-gradient(
    105deg,
    transparent 0%,
    transparent 30%,
    rgba(255, 255, 255, 0.04) 40%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.04) 60%,
    transparent 70%,
    transparent 100%
  );
  background-size: 300% 100%;
  animation: m-premium-shimmer 2.5s ease-in-out infinite;
  border-radius: 16px;
}

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

/* Text skeleton lines — softer corners */
.m-skeleton-line {
  border-radius: 8px;
}


/* =====================================================================
   7. TOAST NOTIFICATIONS
   Solid pills, clean entry/exit.
   ===================================================================== */

.m-toast {
  background: var(--m-toast-bg);
  border: 1px solid var(--m-toast-border);
  border-radius: 9999px;
  box-shadow: var(--m-toast-shadow);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-0);
  gap: 8px;
}

/* Toast icon colors */
.m-toast.success .m-toast-icon { color: var(--success); }
.m-toast.error .m-toast-icon   { color: var(--error); }
.m-toast.info .m-toast-icon    { color: var(--accent-blue); }
.m-toast.warning .m-toast-icon { color: var(--warning); }

/* Toast entry — slide up with spring */
@keyframes m-toast-enter-premium {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.92);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.m-toast {
  animation: m-toast-enter-premium 0.4s var(--ease-spring) both;
}

/* Toast exit — fade down */
@keyframes m-toast-exit-premium {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
}

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


/* =====================================================================
   8. FULLSCREEN OVERLAY
   Solid dark overlay, flat buttons.
   ===================================================================== */

.m-fullscreen {
  background: #000;
}

/* Close button — glass pill (matches desktop) */
.m-fs-close {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Navigation bar — glass pill (matches desktop) */
.m-fs-nav {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Bottom nav bar — solid */
.m-fs-nav {
  background: rgba(20, 20, 24, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 0;
  border-radius: 20px;
  margin-left: 16px;
  margin-right: 16px;
  margin-bottom: max(8px, var(--m-safe-bottom));
  padding: 10px 20px;
  justify-content: center;
}


/* =====================================================================
   9. AUTH OVERLAY
   Clean card with solid background.
   ===================================================================== */

.m-auth-overlay {
  background: var(--canvas);
}

.m-auth-card {
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 36px 28px;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .m-auth-card {
  background: #1a1a1e;
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.40);
}

/* No specular edge */
.m-auth-card::before {
  display: none;
}

/* Auth logo mark — slightly larger */
.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;
}

/* Input refinement */
.m-auth-input {
  border-radius: 12px;
  height: 50px;
  font-size: 16px;
  transition:
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    background 0.2s var(--ease);
}

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

/* Primary button — subtle gradient highlight */
.m-btn-primary {
  border-radius: 12px;
  height: 50px;
  font-size: 15px;
  font-weight: 650;
  background: var(--accent);
  position: relative;
  overflow: hidden;
}

.m-btn-primary::before {
  display: none;
}

.m-btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* Google button */
.m-btn-google {
  border-radius: 12px;
  height: 50px;
  transition:
    background 0.15s var(--ease),
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}

.m-btn-google:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Confirm icon — softer glow */
.m-auth-confirm-icon {
  width: 60px;
  height: 60px;
  background: var(--accent-subtle);
  box-shadow: 0 0 20px var(--accent-subtle);
}

[data-theme="dark"] .m-auth-confirm-icon {
  background: var(--accent-subtle);
  box-shadow: 0 0 24px var(--accent-subtle);
}


/* =====================================================================
   10. SCROLLBAR
   Thin, themed scrollbar; hidden on narrow viewports.
   ===================================================================== */

/* Feed scrollbar — very subtle */
.m-slide-feed {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.08) transparent;
}

[data-theme="dark"] .m-slide-feed {
  scrollbar-color: rgba(255, 255, 255, 0.06) transparent;
}

.m-slide-feed::-webkit-scrollbar {
  width: 4px;
}

.m-slide-feed::-webkit-scrollbar-track {
  background: transparent;
}

.m-slide-feed::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 2px;
}

[data-theme="dark"] .m-slide-feed::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.06);
}

/* Hide scrollbar on narrow phones */
@media (max-width: 480px) {
  .m-slide-feed {
    scrollbar-width: none;
  }
  .m-slide-feed::-webkit-scrollbar {
    display: none;
  }
}

/* Chat and sidebar scrollbars — same treatment */
.m-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 2px;
}

[data-theme="dark"] .m-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.06);
}

.m-sidebar-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 2px;
}

[data-theme="dark"] .m-sidebar-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.04);
}


/* =====================================================================
   11. LIGHT THEME OVERRIDES
   Light uses :root values already defined above — no extra overrides needed.
   Only fullscreen gets a special treatment.
   ===================================================================== */

[data-theme="light"] .m-fullscreen {
  background: #000;
}


/* =====================================================================
   12. DESKTOP LAYOUT TOKENS
   CSS custom properties for desktop breakpoints.
   ===================================================================== */

:root {
  --m-sidebar-width: 280px;
  --m-sidebar-width-collapsed: 0px;
  --m-chat-panel-width: 340px;
  --m-desktop-content-max-width: 1200px;
  --m-desktop-toolbar-height: 56px;
}


/* =====================================================================
   PERFORMANCE & ACCESSIBILITY
   Respect reduced-motion, limit GPU promotion.
   ===================================================================== */

@media (prefers-reduced-motion: reduce) {
  .m-skeleton,
  .m-slide-skeleton,
  .m-shimmer-overlay {
    animation: none;
    background: var(--m-shimmer-base);
  }

  .m-toast {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .m-toast.exit {
    animation: none;
    opacity: 0;
    transition: opacity 0.15s var(--ease);
  }
}


/* =====================================================================
   13. POPUP MENUS — "Studio" Design System
   Covers: context menu, folder menu, profile sheet, topup sheet.
   Design: Clean surfaces, no blur, tight spacing, professional feel.
   Inspired by Linear / Raycast / Vercel — not Apple, not Material.
   ===================================================================== */


/* ─── 13a. BACKDROPS — Simple dim, NO blur ─────────────────────────── */

.m-folder-menu-backdrop,
.m-context-backdrop,
.m-profile-backdrop,
.m-topup-backdrop {
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

[data-theme="dark"] .m-folder-menu-backdrop,
[data-theme="dark"] .m-context-backdrop,
[data-theme="dark"] .m-profile-backdrop,
[data-theme="dark"] .m-topup-backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}


/* ─── 13b. CONTEXT MENU (presentations + folders) ──────────────────── */

.m-context-menu::before {
  display: none !important;
}

.m-context-menu {
  background: #fff;
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 4px 6px rgba(0, 0, 0, 0.04),
    0 12px 32px rgba(0, 0, 0, 0.10);
  transform: translateY(32px);
  opacity: 0;
  transition:
    transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1),
    opacity 0.18s ease;
  padding: 4px;
}

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

[data-theme="dark"] .m-context-menu {
  background: #252528;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 4px 6px rgba(0, 0, 0, 0.15),
    0 12px 32px rgba(0, 0, 0, 0.40);
}

/* Title — compact contextual label */
.m-context-title,
.m-context-menu-title {
  padding: 10px 12px 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-bottom: none;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .m-context-title,
[data-theme="dark"] .m-context-menu-title {
  border-bottom: none;
  color: rgba(255, 255, 255, 0.35);
}

/* Actions container */
.m-context-actions {
  padding: 2px 0 0;
}

/* Menu items — tight, clean, no decoration */
.m-context-menu-item {
  gap: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: 8px;
  color: var(--text-0);
  transition: background 0.1s ease;
}

.m-context-menu-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

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

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

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

/* Icons — bare, no background box */
.m-ctx-icon {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 0;
  background: none !important;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.m-ctx-icon svg {
  width: 18px;
  height: 18px;
}

[data-theme="dark"] .m-ctx-icon {
  background: none !important;
  color: rgba(255, 255, 255, 0.5);
}

/* Danger items */
.m-context-menu-item.danger {
  color: #e5484d;
}
.m-context-menu-item.danger .m-ctx-icon {
  background: none !important;
  color: #e5484d;
}

[data-theme="dark"] .m-context-menu-item.danger {
  color: #f27474;
}
[data-theme="dark"] .m-context-menu-item.danger .m-ctx-icon {
  background: none !important;
  color: #f27474;
}

/* Separator — minimal hairline */
.m-context-separator {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 3px 8px;
}

[data-theme="dark"] .m-context-separator {
  background: rgba(255, 255, 255, 0.07);
}

/* Cancel button — hidden by default, styled as fallback if JS creates one */
.m-context-cancel {
  display: none;
}


/* ─── 13c. PROFILE SHEET ───────────────────────────────────────────── */

.m-profile-handle {
  display: none !important;
}

.m-profile-sheet {
  background: #fff;
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 4px 6px rgba(0, 0, 0, 0.04),
    0 12px 32px rgba(0, 0, 0, 0.10);
  transform: translateY(32px);
  opacity: 0;
  transition:
    transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1),
    opacity 0.18s ease;
}

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

[data-theme="dark"] .m-profile-sheet {
  background: #252528;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 4px 6px rgba(0, 0, 0, 0.15),
    0 12px 32px rgba(0, 0, 0, 0.40);
}

/* Header */
.m-profile-header {
  padding: 16px 16px 12px;
  gap: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  margin-bottom: 0;
}

[data-theme="dark"] .m-profile-header {
  border-bottom-color: rgba(255, 255, 255, 0.07);
}

/* Avatar — warm gradient, compact */
.m-profile-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #2d2d30, #3a3a3d);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  box-shadow: none;
  border-radius: 10px;
}

[data-theme="dark"] .m-profile-avatar {
  background: linear-gradient(135deg, #38383b, #4a4a4e);
  color: #fff;
  box-shadow: none;
}

/* Email */
.m-profile-email {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Balance */
.m-profile-balance {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 1px;
}

/* Actions */
.m-profile-actions {
  padding: 4px;
}

/* Action buttons — match context menu items */
.m-profile-action-btn {
  gap: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: 8px;
  transition: background 0.1s ease;
}

.m-profile-action-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

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

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

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

/* Profile icons — bare */
.m-profile-action-btn .m-ctx-icon {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 0;
  background: none !important;
  color: var(--text-2);
}

.m-profile-action-btn .m-ctx-icon svg {
  width: 18px;
  height: 18px;
}

[data-theme="dark"] .m-profile-action-btn .m-ctx-icon {
  color: rgba(255, 255, 255, 0.5);
}

/* Danger */
.m-profile-action-btn.danger {
  color: #e5484d;
}
.m-profile-action-btn.danger .m-ctx-icon {
  background: none !important;
  color: #e5484d;
}

[data-theme="dark"] .m-profile-action-btn.danger {
  color: #f27474;
}
[data-theme="dark"] .m-profile-action-btn.danger .m-ctx-icon {
  background: none !important;
  color: #f27474;
}

/* Separator in profile */
.m-profile-actions .m-context-separator {
  margin: 3px 8px;
}

/* Password section */
.m-profile-pass-input {
  border-radius: 8px;
  border-color: var(--border);
  font-size: 14px;
}

.m-profile-pass-save {
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  height: 40px;
  padding: 0;
}


/* ─── 13d. TOPUP SHEET ──────────────────────────────────────────────── */

.m-topup-sheet .m-profile-handle {
  display: none !important;
}

.m-topup-sheet {
  border: none;
}

.m-topup-header {
  padding: 16px 0 14px;
}

.m-topup-close {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-2);
  font-size: 15px;
  font-weight: 400;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  padding-bottom: 1px;
}

[data-theme="dark"] .m-topup-close {
  background: rgba(255, 255, 255, 0.1);
}

.m-topup-tabs {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 2px;
}

[data-theme="dark"] .m-topup-tabs {
  background: rgba(255, 255, 255, 0.08);
}

.m-topup-tab {
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  padding: 6px 16px;
  color: var(--text-2);
}

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

[data-theme="dark"] .m-topup-tab.active {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.m-topup-balance {
  background: rgba(0, 0, 0, 0.03);
  border: none;
  border-radius: 10px;
}

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

.m-topup-amount-btn {
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.12s ease;
}

.m-topup-amount-btn.selected {
  border-color: rgba(0, 0, 0, 0.14);
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-0);
  font-weight: 700;
}

[data-theme="dark"] .m-topup-amount-btn.selected {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-0);
}

.m-topup-amount-btn:hover:not(.selected) {
  border-color: var(--text-2);
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .m-topup-amount-btn:hover:not(.selected) {
  background: rgba(255, 255, 255, 0.04);
}

.m-topup-custom-input {
  border-radius: 8px;
  border-color: var(--border);
  font-size: 14px;
  -moz-appearance: textfield;
}

.m-topup-custom-input::-webkit-inner-spin-button,
.m-topup-custom-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.m-topup-custom-input:focus {
  border-color: var(--text-1);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .m-topup-custom-input:focus {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.m-topup-pay-btn {
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  height: 44px;
  padding: 0;
}


/* ─── 13e. DESKTOP OVERRIDES (768px+) ──────────────────────────────── */

@media (min-width: 768px) {
  .m-context-menu,
  .m-profile-sheet {
    top: 50%;
    bottom: auto;
    left: 0;
    right: 0;
    margin: 0 auto;
    max-width: 320px;
    transform: translateY(calc(-50% + 16px));
    opacity: 0;
  }

  .m-context-menu.visible,
  .m-profile-sheet.visible {
    transform: translateY(-50%);
    opacity: 1;
  }

  .m-profile-handle {
    display: none !important;
  }

  .m-topup-sheet .m-profile-handle {
    display: none !important;
  }
}
