/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #0a0a0a;
  color: #e0e0e0;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: #000000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
}

.logo {
  display: flex;
  align-items: center;
}

.logo-link,
.logo-link:visited,
.logo-link:hover,
.logo-link:active {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: transparent;
}

.logo-banner {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.nav {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  gap: 40px;
}

.nav-left {
  display: flex;
  gap: 30px;
  align-items: center;
}

.nav-right {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-left: auto;
}

.nav-link {
  color: #888;
  text-decoration: none;
  font-size: 16px;
  transition: color 0.3s;
}

.nav-link:hover {
  color: #fff;
}

.nav-link.active {
  color: #fff;
}

.nav-link-auth {
  padding: 7px 18px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  text-transform: uppercase;
}

.nav-link-login {
  background: transparent;
  color: #888;
  border: 1px solid #2a2a2a;
}

.nav-link-login:hover {
  color: #e0e0e0;
  border-color: #444;
  background: rgba(255, 255, 255, 0.04);
}

.nav-link-register {
  background: #DE1833;
  color: #fff;
  border: 1px solid transparent;
}

.nav-link-register:hover {
  background: #ff2244;
  box-shadow: 0 4px 20px rgba(222, 24, 51, 0.35);
}

.nav-link-logout {
  background: rgba(222, 24, 51, 0.1);
  color: #DE1833;
  border: 1px solid #DE1833;
}

.nav-link-logout:hover {
  background: rgba(222, 24, 51, 0.2);
  transform: translateY(-2px);
}

/* Main Content */
.main {
  flex: 1;
  padding: 20px 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 20px 20px;
  margin-bottom: 40px;
}

.hero-title {
  font-size: 48px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.hero-subtitle {
  font-size: 20px;
  color: #888;
}

/* ═══════════════════════════════════════════════════════════
   Landing Page — Terminal-minimal layout
   ═══════════════════════════════════════════════════════════ */

/* ── Layout overrides for landing ────────────────────── */
body:has(.landing-single) {
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: #030303;
}
body:has(.landing-single) .header,
body:has(.share-page) .header,
body:has(.notfound-section) .header,
body:has(.e2ed-section) .header {
  border-bottom-color: rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(3, 3, 3, 0.92) 0%, rgba(3, 3, 3, 0.72) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
}
body:has(.landing-single) .footer { display: none; }
body:has(.landing-single) .main { padding: 0; }
body:has(.landing-single) .main,
body:has(.landing-single) .main > .container,
body:has(.landing-single) .landing {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
}

.landing {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}

.land-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: calc(100vh - 84px);
  padding: 56px 32px 72px;
  overflow: hidden;
  background: #030303;
}

/* ── Particle canvas ─────────────────────────────────── */
.land-particles,
.share-particles,
.nf-particles,
.e2ed-ascii {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.land-particles { opacity: 0.5; }
.share-particles { opacity: 0.28; }
.nf-particles { opacity: 0.3; }
.e2ed-ascii { opacity: 0.3; }

/* ── Centre content block ────────────────────────────── */
.land-center {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

/* ── Badge / eyebrow ─────────────────────────────────── */
.land-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 3px;
  color: #f0f0f0;
  padding: 7px 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 100px;
  background: rgba(18, 18, 18, 0.92);
  margin-bottom: 32px;
  opacity: 0;
  animation: landUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
  position: relative;
  overflow: visible;
  font-family: 'JetBrains Mono', monospace;
}

/* Spinning white border trail — JS canvas for smooth trail */
.land-badge-trail-canvas {
  position: absolute;
  inset: -4px;
  pointer-events: none;
  z-index: 1;
}

/* Content above pseudo-elements */
.land-badge-dot,
.land-badge-text {
  position: relative;
  z-index: 1;
}

.land-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.5), 0 0 12px rgba(74, 222, 128, 0.2);
  flex-shrink: 0;
  animation: landPulse 4s ease-in-out infinite;
}

@keyframes landPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(74, 222, 128, 0.5), 0 0 12px rgba(74, 222, 128, 0.2); }
  50%      { box-shadow: 0 0 4px rgba(74, 222, 128, 0.3), 0 0 8px rgba(74, 222, 128, 0.1); }
}

/* ── Headline ────────────────────────────────────────── */
.land-h1 {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.1;
  color: #f0f0f0;
  margin: 0 0 24px;
  font-family: 'JetBrains Mono', monospace;
  opacity: 0;
  animation: landUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.25s forwards;
}

.land-h1-accent {
  background: linear-gradient(135deg, #DE1833 0%, #ff4060 50%, #DE1833 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: landGradShift 6s ease infinite;
}

@keyframes landGradShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Description ─────────────────────────────────────── */
.land-desc {
  font-size: 12px;
  font-weight: 400;
  color: #c3c3c3;
  line-height: 1.9;
  letter-spacing: 0.6px;
  margin: 0 auto 44px;
  max-width: 520px;
  font-family: 'JetBrains Mono', monospace;
  opacity: 0;
  animation: landUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.35s forwards;
}

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

/* ── Buttons ─────────────────────────────────────────── */
.land-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 48px;
  opacity: 0;
  animation: landUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.45s forwards;
}

.land-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 32px;
  min-width: 170px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #DE1833 0%, #a0102a 100%);
  border: 1px solid rgba(255, 80, 110, 0.15);
  cursor: pointer;
  transition: border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

/* Ambient glow behind button */
.land-btn-primary::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, #DE1833, #ff4060, #DE1833);
  background-size: 200% 200%;
  animation: landBtnGlow 4s ease infinite;
  z-index: -2;
  opacity: 0.35;
  filter: blur(14px);
  transition: opacity 0.4s;
}

@keyframes landBtnGlow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Shimmer sweep */
.land-btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(255, 255, 255, 0.08) 40%,
    rgba(255, 255, 255, 0.14) 50%,
    rgba(255, 255, 255, 0.08) 60%,
    transparent 80%
  );
  z-index: -1;
  animation: landShimmer 4s ease-in-out infinite;
}

@keyframes landShimmer {
  0%   { left: -100%; opacity: 0; }
  20%  { opacity: 1; }
  100% { left: 150%; opacity: 0; }
}

.land-btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: rgba(255, 80, 110, 0.3);
  box-shadow:
    0 0 20px rgba(222, 24, 51, 0.2),
    0 8px 32px rgba(222, 24, 51, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.land-btn-primary:hover::after { opacity: 0.55; }

.land-btn-primary svg {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 1;
}

.land-btn-primary span {
  position: relative;
  z-index: 1;
}

.land-btn-primary:hover svg { transform: translateX(4px); }

.land-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 30px;
  min-width: 150px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-decoration: none;
  color: #c3c3c3;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.land-btn-ghost:hover {
  color: #f0f0f0;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

/* ── Status line (de-emphasized backup stats) ────────── */
.land-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.6px;
  color: #b2b2b2;
  opacity: 0;
  animation: landUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

.land-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.land-status-ok { background: #4ade80; box-shadow: 0 0 4px rgba(74, 222, 128, 0.4); }
.land-status-warn { background: #f2c96d; box-shadow: 0 0 4px rgba(242, 201, 109, 0.4); }
.land-status-error { background: #ff7668; box-shadow: 0 0 4px rgba(255, 118, 104, 0.4); }

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVENESS ENHANCEMENTS
   Base rules (display:none defaults) — MUST appear before the
   @media blocks that override them to display:flex on mobile.
   ═══════════════════════════════════════════════════════════ */

/* ── Phase 1: Hamburger Menu + Mobile Header Actions ── */

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid #333;
  border-radius: 6px;
  cursor: pointer;
  padding: 8px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: #e0e0e0;
  border-radius: 2px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.nav-toggle.active .nav-toggle-bar:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active .nav-toggle-bar:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Header actions bar — hidden on desktop, shown on mobile */
.header-actions {
  display: none;
}

.header-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.header-user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header-user-name {
  font-size: 12px;
  font-weight: 600;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
  line-height: 1.2;
}

.header-user-role {
  font-size: 9px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  line-height: 1.2;
}

.header-user-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.header-logout-form,
.dropdown-logout-form {
  margin: 0;
}

.header-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
   border: none;
   background: transparent;
   padding: 0;
   color: #888;
   text-decoration: none;
   transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
   -webkit-tap-highlight-color: transparent;
}

.header-action-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e0e0e0;
}

.header-action-logout:hover {
  background: rgba(222, 24, 51, 0.1);
  color: #DE1833;
}

.header-auth-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-auth-btn {
  padding: 7px 18px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #888;
  background: transparent;
  border: 1px solid #2a2a2a;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.header-auth-btn:hover {
  color: #e0e0e0;
  border-color: #444;
  background: rgba(255, 255, 255, 0.04);
}

.header-auth-register {
  background: #DE1833;
  border-color: transparent;
  color: #fff;
}

.header-auth-register:hover {
  background: #ff2244;
  box-shadow: 0 4px 20px rgba(222, 24, 51, 0.35);
}

/* ── Phase 2: Sidebar Collapsible Drawer ── */

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #333;
  border-radius: 6px;
  cursor: pointer;
  color: #e0e0e0;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 199;
}

.sidebar-backdrop.open {
  display: block;
}


@media (max-height: 650px) {
  .land-h1 { font-size: 36px; margin-bottom: 16px; }
  .land-badge { margin-bottom: 20px; }
  .land-desc { font-size: 11px; margin-bottom: 28px; }
  .land-btn-primary,
  .land-btn-ghost { padding: 10px 24px; font-size: 11px; }
  .land-actions { margin-bottom: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .land-badge,
  .land-h1,
  .land-desc,
  .land-actions,
  .land-status { animation: none; opacity: 1; transform: none; }
  .land-badge-dot { animation: none; }
  .land-badge-trail-canvas { display: none; }
  .land-h1-accent { animation: none; background-position: 0% 50%; }
  .land-btn-primary::before { animation: none; opacity: 0; }
  .land-btn-primary::after { animation: none; }
  .share-orb { animation: none !important; }
  .share-aurora { animation: none; opacity: 1; }
  .share-grid { animation: none; opacity: 1; }
  .share-particles { display: none; }
  .share-title,
  .share-subtitle { animation: none; opacity: 1; transform: none; }
  .share-badge { animation: none; opacity: 1; transform: none; }
  .share-upload-area { animation: none; opacity: 1; transform: none; }
  .share-files-area { animation: none; opacity: 1; transform: none; }
  .share-page .drop-zone::before { animation: none; }
  .nf-orb { animation: none !important; }
  .nf-aurora { animation: none; opacity: 1; }
  .nf-grid { animation: none; opacity: 1; }
  .nf-particles { display: none; }
  .notfound-card { animation: none; opacity: 1; transform: none; }
  .notfound-digit { animation: none; opacity: 1; transform: none; }
  .notfound-divider { animation: none; opacity: 1; width: 40px; }
  .notfound-card::before { animation: none; }
  .e2ed-card { animation: none; opacity: 1; }
  .e2ed-icon { animation: none; opacity: 1; }
  .e2ed-divider { animation: none; opacity: 1; width: 36px; }
  .e2ed-submit::before { animation: none; opacity: 0; }
  .auth-box::before { animation: none; }
  .auth-box h1 { animation: none; }
  .e2ee-prompt-card { animation: none; opacity: 1; }
  .e2ee-prompt-backdrop { animation: none; opacity: 1; }
  .e2ee-prompt-icon { animation: none; opacity: 1; }
  .e2ee-prompt-divider { animation: none; opacity: 1; width: 36px; }
  .e2ee-prompt-btn::before { animation: none; opacity: 0; }
  .e2ee-prompt-input.e2ee-prompt-input-error { animation: none; }
}

/* ═══════════════════════════════════════════════════════════
   Share Page — Sleek dark layout matching landing page aesthetic
   ═══════════════════════════════════════════════════════════ */

/* ── Layout overrides ─────────────────────────────────── */
body:has(.share-page) {
  background: #030303;
  overflow: hidden;
}

body:has(.share-page) .main {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body:has(.share-page) .main::-webkit-scrollbar {
  display: none;
}

body:has(.share-page) .main > .container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.share-page {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  position: relative;
  overflow: hidden;
  background: #030303;
  flex: 1;
  min-height: 100vh;
}

/* ── Full-page background effects ─────────────────────── */

/* Subtle grid */
.share-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(222, 24, 51, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(222, 24, 51, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 50% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 50% at 50% 50%, black 20%, transparent 70%);
  opacity: 0;
  animation: shareFadeIn 3s ease 0.5s forwards;
  pointer-events: none;
}

/* Aurora orbs */
.share-aurora {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  animation: shareAuroraIn 3s ease 0.4s forwards;
}

.share-orb {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}

.share-orb-1 {
  width: 700px;
  height: 700px;
  top: -25%;
  left: -10%;
  background: radial-gradient(circle, rgba(222, 24, 51, 0.07) 0%, transparent 65%);
  filter: blur(140px);
  animation: shareDrift1 24s ease-in-out infinite alternate;
}

.share-orb-2 {
  width: 500px;
  height: 500px;
  bottom: -15%;
  right: -5%;
  background: radial-gradient(circle, rgba(180, 20, 60, 0.05) 0%, transparent 65%);
  filter: blur(130px);
  animation: shareDrift2 30s ease-in-out infinite alternate;
}

.share-orb-3 {
  width: 300px;
  height: 300px;
  top: 40%;
  left: 55%;
  background: radial-gradient(circle, rgba(222, 24, 51, 0.04) 0%, transparent 65%);
  filter: blur(100px);
  animation: shareDrift3 20s ease-in-out infinite alternate;
}

@keyframes shareDrift1 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 30px) scale(1.05); }
}
@keyframes shareDrift2 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-40px, -20px) scale(1.03); }
}
@keyframes shareDrift3 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-30px, 25px) scale(1.04); }
}

/* Vignette — soft edge darkening, doesn't choke the lower half */
.share-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 56% 44% at 50% 24%, rgba(3, 3, 3, 0.04) 0%, rgba(3, 3, 3, 0.24) 32%, rgba(3, 3, 3, 0.74) 70%, #030303 100%);
  pointer-events: none;
}

@keyframes shareFadeIn { to { opacity: 1; } }
@keyframes shareAuroraIn { to { opacity: 1; } }

/* ── Hero section ─────────────────────────────────────── */
.share-hero {
  position: relative;
  padding: 14vh 32px 32px;
  text-align: center;
  z-index: 1;
}

/* Hero content */
.share-hero-content {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 32px 24px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(8, 8, 8, 0.88) 0%, rgba(6, 6, 6, 0.68) 100%);
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
}

.share-hero-content::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 0%, rgba(222, 24, 51, 0.08) 0%, rgba(222, 24, 51, 0.04) 28%, transparent 60%);
  pointer-events: none;
}

.share-hero-content > * {
  position: relative;
  z-index: 1;
}

/* Badge */
.share-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2.5px;
  color: #999;
  padding: 6px 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 100px;
  background: rgba(20, 20, 20, 0.85);
  margin-bottom: 24px;
  opacity: 0;
  animation: shareUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

.share-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 5px rgba(74, 222, 128, 0.4), 0 0 10px rgba(74, 222, 128, 0.15);
  flex-shrink: 0;
  animation: sharePulse 4s ease-in-out infinite;
}

@keyframes sharePulse {
  0%, 100% { box-shadow: 0 0 5px rgba(74, 222, 128, 0.4), 0 0 10px rgba(74, 222, 128, 0.15); }
  50%      { box-shadow: 0 0 3px rgba(74, 222, 128, 0.25), 0 0 6px rgba(74, 222, 128, 0.08); }
}

/* Title */
.share-title {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -1.5px;
  color: #f0f0f0;
  margin: 0 0 12px;
  opacity: 0;
  animation: shareUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

/* Subtitle */
.share-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: #9a9a9a;
  line-height: 1.75;
  letter-spacing: 1.5px;
  margin: 0 auto;
  max-width: 520px;
  opacity: 0;
  animation: shareUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.35s forwards;
}

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

/* ── Upload area — connects to hero ───────────────────── */
.share-upload-area {
  position: relative;
  z-index: 1;
  padding: 0 32px 40px;
  opacity: 0;
  animation: shareUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

/* ── Files area ───────────────────────────────────────── */
.share-files-area {
  position: relative;
  z-index: 1;
  padding: 0 32px 60px;
  opacity: 0;
  animation: shareUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.7s forwards;
}

/* Override container max-width for share page sections */
.share-page .upload-section {
  max-width: 720px;
  margin: 0 auto;
}

.share-page .temp-files-section {
  max-width: 1000px;
  margin: 0 auto;
}

/* ── Drop zone refinements for share page ─────────────── */
.share-page .drop-zone {
  background: rgba(8, 8, 8, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 48px 36px 28px;
  min-height: 200px;
  transition: background 0.4s, box-shadow 0.4s, transform 0.4s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: clip;
}

/* Spinning reflection border — oversized conic gradient */
.share-page .drop-zone::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  transform: translate(-50%, -50%);
  background: conic-gradient(
    from 0deg at 50% 50%,
    transparent 0%,
    transparent 68%,
    rgba(255, 255, 255, 0.02) 73%,
    rgba(255, 255, 255, 0.06) 76%,
    rgba(255, 255, 255, 0.12) 79%,
    rgba(255, 255, 255, 0.06) 82%,
    rgba(255, 255, 255, 0.02) 85%,
    transparent 90%,
    transparent 100%
  );
  animation: shareDropSpin 12s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes shareDropSpin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Inner fill mask — fully opaque to completely hide spinning gradient inside */
.share-page .drop-zone::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 15px;
  background: #030303;
  pointer-events: none;
  z-index: 1;
  transition: background 0.4s;
}

/* Content above pseudo-elements */
.share-page .drop-zone > * {
  position: relative;
  z-index: 2;
}

.share-page .drop-zone:hover {
  background: rgba(255, 255, 255, 0.015);
  transform: translateY(-3px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.share-page .drop-zone:hover::before {
  background: conic-gradient(
    from 0deg at 50% 50%,
    transparent 0%,
    transparent 68%,
    rgba(255, 255, 255, 0.03) 73%,
    rgba(255, 255, 255, 0.10) 76%,
    rgba(255, 255, 255, 0.20) 79%,
    rgba(255, 255, 255, 0.10) 82%,
    rgba(255, 255, 255, 0.03) 85%,
    transparent 90%,
    transparent 100%
  );
}

.share-page .drop-zone:hover::after {
  background: #040404;
}

.share-page .drop-zone.dragover {
  transform: scale(1.01);
  box-shadow: 0 0 50px rgba(222, 24, 51, 0.08);
}

.share-page .drop-zone.dragover::before {
  background: conic-gradient(
    from 0deg at 50% 50%,
    transparent 0%,
    transparent 68%,
    rgba(222, 24, 51, 0.04) 73%,
    rgba(222, 24, 51, 0.12) 76%,
    rgba(222, 24, 51, 0.24) 79%,
    rgba(222, 24, 51, 0.12) 82%,
    rgba(222, 24, 51, 0.04) 85%,
    transparent 90%,
    transparent 100%
  );
}

.share-page .drop-zone-icon {
  color: #8a8a8a;
  margin-bottom: 16px;
  transition: color 0.3s;
}

.share-page .drop-zone:hover .drop-zone-icon {
  color: #DE1833;
}

.share-page .drop-zone-title {
  font-size: 22px;
  font-weight: 700;
  color: #e5e5e5;
  letter-spacing: 1px;
  margin-bottom: -4px;
}

.share-page .drop-zone-text {
  font-size: 13px;
  color: #9c9c9c;
  margin-bottom: 8px;
}

.share-page .drop-zone-limit {
  font-size: 10px;
  font-weight: 600;
  color: #7f7f7f;
  letter-spacing: 1px;
  margin-bottom: 0;
}

/* Uploading state — disable spinning border */
.share-page .drop-zone.uploading {
  background: rgba(3, 3, 3, 0.95);
}

.share-page .drop-zone.uploading::before {
  animation: none;
  background: none;
}

.share-page .drop-zone.uploading::after {
  background: #030303;
  border: none;
}

.share-page .drop-zone.uploading:hover {
  background: rgba(3, 3, 3, 0.95);
  transform: none;
  box-shadow: none;
}

/* ── Toggles inside drop zone ─────────────────────────── */
.drop-zone-toggles {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-top: 20px;
  position: relative;
  z-index: 5;
}

.drop-zone-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  width: 200px;
}

.drop-zone-toggle:hover {
  background: rgba(255, 255, 255, 0.03);
}

.drop-zone-toggle .toggle-switch {
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.drop-zone-toggle .toggle-slider {
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.drop-zone-toggle .toggle-slider::before {
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background: #444;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.drop-zone-toggle .toggle-checkbox:checked + .toggle-slider {
  background: #DE1833;
  border-color: rgba(222, 24, 51, 0.3);
  box-shadow: 0 0 10px rgba(222, 24, 51, 0.15);
}

.drop-zone-toggle .toggle-checkbox:checked + .toggle-slider::before {
  transform: translateX(16px);
  background: #fff;
  box-shadow: 0 1px 4px rgba(222, 24, 51, 0.3);
}

.drop-zone-toggle-label {
  font-size: 10px;
  font-weight: 600;
  color: #888;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  user-select: none;
  transition: color 0.2s;
}

.drop-zone-toggle:hover .drop-zone-toggle-label {
  color: #b0b0b0;
}

.drop-zone-toggle:has(.toggle-checkbox:checked) .drop-zone-toggle-label {
  color: #e0e0e0;
}

/* ── Temp browser refinements for share page ──────────── */
.share-page .temp-files-section .section-title {
  font-size: 12px;
  font-weight: 600;
  color: #444;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.share-page .temp-browser {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
}

.share-page .temp-browser-header {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.share-page .temp-browser-header .browser-col {
  color: #444;
  font-size: 11px;
  letter-spacing: 0.8px;
}

.share-page .temp-browser-row {
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.share-page .temp-browser-row:last-child {
  border-bottom: none;
}

.share-page .temp-browser-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* ── Share page responsive ────────────────────────────── */
/* ── Share page reduced motion ────────────────────────── */
/* Upload Section */
.upload-section {
  max-width: 800px;
  margin: 0 auto;
}

.drop-zone {
  background: rgba(0, 0, 0, 0.85);
  border: 3px solid #1a1a1a;
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  min-height: 220px;
}

.drop-zone::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(100, 100, 100, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

.drop-zone:hover {
  border-color: #333;
  background: rgba(0, 0, 0, 0.45);
  transform: translateY(-4px);
}

.drop-zone.dragover {
  border-color: #555;
  background: rgba(0, 0, 0, 0.5);
  transform: scale(1.02);
}

.drop-zone-icon {
  font-size: 64px;
  margin-bottom: 20px;
  color: #DE1833;
}

.drop-zone-title {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  margin-bottom: -5px;
}

.drop-zone-text {
  font-size: 15px;
  color: #888;
  margin-bottom: 15px;
  text-decoration: none;
}

.drop-zone-limit {
  font-size: 14px;
  font-weight: 600;
  color: #666;
}

/* Features Row */
.features-row {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 60px;
  flex-wrap: wrap;
}

/* Files Page */
.files-header {
  text-align: center;
  padding: 40px 20px;
  margin-bottom: 60px;
}

.files-title {
  font-size: 48px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.files-container {
  max-width: 1900px;
  margin: 0 auto;
  background: rgba(30, 30, 30, 0.6);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 20px 24px;
}

.files-table {
  width: 100%;
  border-collapse: collapse;
}

.files-table th {
  text-align: left;
  padding: 16px 12px;
  color: #888;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid #444;
}

.files-table th:nth-child(1) {
  min-width: 250px;
}

.files-table th:nth-child(2) {
  min-width: 80px;
}

.files-table th:nth-child(3) {
  min-width: 120px;
}

.files-table th:nth-child(4) {
  min-width: 100px;
}

.files-table th:nth-child(5) {
  min-width: 150px;
}

.files-table td {
  padding: 16px 12px;
  border-bottom: 1px solid #333;
  white-space: nowrap;
  height: 50px;
  vertical-align: middle;
}

.files-table tr:last-child td {
  border-bottom: none;
}

.files-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.file-name {
  color: #e0e0e0;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.file-name:hover {
  color: #E8304A;
}

.status-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.status-public {
  background: rgba(222, 24, 51, 0.2);
}

.status-protected {
  background: rgba(250, 204, 21, 0.2);
}

.status-e2e {
  background: rgba(222, 24, 51, 0.2);
}

.status-server-enc {
  background: rgba(250, 204, 21, 0.2);
}

.status-protected {
  background: rgba(250, 204, 21, 0.2);
}

.copy-link-btn {
  background: linear-gradient(135deg, #444 0%, #333 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.copy-link-btn:hover {
  background: linear-gradient(135deg, #555 0%, #444 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.edit-btn {
  background: linear-gradient(135deg, #444 0%, #333 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  text-decoration: none;
  white-space: nowrap;
}

.edit-btn:hover {
  background: linear-gradient(135deg, #555 0%, #444 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.delete-btn {
  background: linear-gradient(135deg, #DE1833 0%, #a8122a 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.delete-btn:hover {
  background: linear-gradient(135deg, #E8304A 0%, #DE1833 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(222, 24, 51, 0.3);
}

.files-empty {
  text-align: center;
  padding: 60px 40px;
}

.files-empty-icon {
  font-size: 80px;
  margin-bottom: 20px;
}

.files-empty-title {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.files-empty-text {
  font-size: 16px;
  color: #888;
  margin-bottom: 32px;
}

.files-empty-button {
  display: inline-block;
  background: linear-gradient(135deg, #444 0%, #333 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  text-decoration: none;
}

.files-empty-button:hover {
  background: linear-gradient(135deg, #555 0%, #444 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.feature-card {
  flex: 1;
  min-width: 250px;
  max-width: 350px;
  background: rgba(30, 30, 30, 0.6);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.feature-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.feature-title {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
}

.feature-desc {
  font-size: 16px;
  color: #888;
}

/* Manage Page */
.manage-header {
  text-align: center;
  padding: 40px 20px;
  margin-bottom: 40px;
}

.manage-header-content {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.manage-header-left {
  justify-self: start;
}

.manage-header-right {
  justify-self: end;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid #333;
  border-radius: 8px;
  color: #888;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn-back .back-icon {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.btn-back .back-text {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #444;
  color: #bbb;
}

.btn-back:hover .back-icon {
  transform: translateX(-2px);
}

.manage-title {
  font-size: 48px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  text-align: center;
}

.manage-subtitle {
  font-size: 18px;
  color: #888;
}

.manage-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.manage-info-section,
.manage-settings-section {
  flex: 1;
  min-width: 300px;
  background: rgba(30, 30, 30, 0.6);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 20px 24px;
}

.section-title {
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #444;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #444;
}

.section-header .section-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* File Preview Box */
.file-preview-box {
  width: 100%;
  max-height: 400px;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  overflow: hidden;
  padding: 12px;
}

.file-preview-thumbnail {
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
  border-radius: 4px;
}

/* Full-width Share Section */
.manage-share-section-full {
  width: 100%;
  max-width: 1200px;
  margin: 24px auto 40px;
  background: rgba(30, 30, 30, 0.6);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 20px 24px;
}

/* Info Grid */
.info-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}

.info-label {
  color: #888;
  font-size: 15px;
  flex-shrink: 0;
  margin-right: 16px;
}

.info-value {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}

.info-value-filename {
  display: flex;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.info-value-filename .file-name-base {
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.info-value-filename .file-name-ext {
  flex-shrink: 0;
  color: #888;
}

.status-protected {
  color: #ffffff;
}

.status-none {
  color: #facc15;
}

/* Settings Form */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.form-hint {
  font-size: 11px;
  color: #666;
  letter-spacing: 0.3px;
  margin-top: -4px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

/* Toggle Switch */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-checkbox {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
  margin: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #2d2d2d;
  transition: 0.3s;
  border-radius: 28px;
}

.toggle-slider::before {
  position: absolute;
  content: '';
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: #888;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-checkbox:checked + .toggle-slider {
  background: #DE1833;
}

.toggle-checkbox:checked + .toggle-slider::before {
  transform: translateX(24px);
  background: #fff;
}

.toggle-switch-locked {
  opacity: 0.5;
  pointer-events: none;
}

.toggle-switch-locked .toggle-checkbox {
  cursor: not-allowed;
}

.toggle-switch-locked .toggle-slider {
  cursor: not-allowed;
}

.toggle-text {
  color: #e0e0e0;
  font-size: 15px;
  font-weight: 500;
  width: 120px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Password Group */
.password-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.label-text {
  color: #888;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  width: 120px;
}

.e2e-panel {
  max-width: 600px;
  margin: 8px auto 0;
  padding: 12px 40px 4px;
  background: transparent;
  border: none;
  border-radius: 12px;
}

.e2e-toggle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.e2e-toggle-row:not(:first-child) {
  margin-top: 8px;
}

.e2e-label-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #666;
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  font-family: serif;
  cursor: help;
  position: relative;
  transition: background 0.3s ease, transform 0.3s ease;
}

.info-icon:hover {
  background: #888;
  transform: scale(1.1);
}

.info-icon::after {
  content: attr(title);
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.95);
  color: #e0e0e0;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  white-space: normal;
  width: 300px;
  text-align: center;
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 100;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  text-transform: none;
  letter-spacing: 0;
}

.info-icon:hover::after {
  opacity: 1;
  visibility: visible;
}

.e2e-label {
  color: #888;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── E2E Key Row: single-row layout ─────────────────────────── */

.e2e-key-row {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 340px;
  margin: 0 auto 16px;
}

.e2e-input {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 9px 12px;
  color: #e0e0e0;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  letter-spacing: 0.3px;
  transition: border-color 0.2s;
}

.e2e-input:focus {
  outline: none;
  border-color: #DE1833;
}

.e2e-input::placeholder {
  color: #555;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.e2e-icon-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #888;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.e2e-icon-btn:hover {
  color: #ddd;
  background: #242424;
  border-color: #444;
}

.e2e-icon-btn:active {
  color: #DE1833;
}

#generateBtn svg {
  transition: transform 0.3s ease;
}

#generateBtn:active svg {
  transform: rotate(180deg);
}


.e2e-note {
  color: #E8304A;
  font-size: 14px;
  margin: 0;
  font-weight: bold;
  text-transform: uppercase;
  text-align: center;
}

/* .copy-toast is deprecated — kept for compatibility, uses toast system visuals */
.copy-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #22c55e;
  color: #fff;
  padding: 14px 24px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  animation: toastSlideDown 0.3s ease;
}

.form-input,
.form-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #444;
  border-radius: 8px;
  padding: 12px 16px;
  color: #e0e0e0;
  font-size: 16px;
  transition: border-color 0.3s;
  flex: 1;
  min-width: 0;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #666;
}

.form-select option {
  background: #1a1a1a;
  color: #e0e0e0;
}

.form-input::placeholder {
  color: #666;
}

.form-submit {
  background: linear-gradient(135deg, #444 0%, #333 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.form-submit:hover {
  background: linear-gradient(135deg, #555 0%, #444 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Share Box */
.share-box {
  display: flex;
  gap: 12px;
}

.share-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #444;
  border-radius: 8px;
  padding: 12px 16px;
  color: #888;
  font-size: 14px;
  font-family: 'Monaco', 'Courier New', monospace;
}

.copy-button {
  background: linear-gradient(135deg, #444 0%, #333 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}

.copy-button:hover {
  background: linear-gradient(135deg, #555 0%, #444 100%);
  transform: translateY(-2px);
}

.share-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.share-row:last-of-type {
  margin-bottom: 0;
}

.share-row-label {
  font-size: 12px;
  font-weight: 700;
  color: #666;
  min-width: 40px;
  text-align: right;
  flex-shrink: 0;
}

.share-row .share-box {
  flex: 1;
}

.share-note {
  font-size: 14px;
  color: #666;
  margin-top: 16px;
}


.btn-delete-manage {
  background: linear-gradient(135deg, #DE1833 0%, #a8122a 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-delete-manage:hover {
  background: linear-gradient(135deg, #E8304A 0%, #DE1833 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(222, 24, 51, 0.3);
}

/* Modern Manage Page Layout */
.manage-modern {
  display: flex;
  gap: 0;
  max-width: 1200px;
  margin: 0 auto 0;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  overflow: hidden;
  min-height: 420px;
}

/* Left column wrapper (preview + detail grid) */
.manage-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: rgba(0, 0, 0, 0.15);
}

/* Preview Panel (left) */
.manage-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px 24px;
  min-width: 0;
  position: relative;
}

.manage-preview-img-wrap {
  width: 100%;
  max-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  border-radius: 10px;
  overflow: hidden;
}

.manage-preview-img {
  max-width: 100%;
  max-height: 340px;
  object-fit: contain;
  border-radius: 10px;
}

.manage-preview-link {
  cursor: default;
  text-decoration: none;
}

.manage-preview-link .manage-preview-img {
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
}

.manage-preview-link .manage-preview-img:hover {
  opacity: 0.85;
}

.manage-preview-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  font-size: 64px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 20px;
  border: 1px solid #222;
}

.manage-preview-icon .audio-note-icon {
  width: 64px;
  height: 64px;
}

.manage-preview-filename {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  word-break: break-word;
  max-width: 100%;
  margin-bottom: 8px;
}

.manage-preview-filename .file-name-ext {
  color: #666;
}

.manage-preview-filename-lg {
  font-size: 26px;
  font-weight: 700;
}

.manage-preview-meta {
  font-size: 13px;
  color: #666;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.manage-meta-sep {
  color: #444;
}

.manage-detail-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  width: 100%;
  max-width: 420px;
}

.manage-detail-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.manage-detail-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: #555;
  text-transform: uppercase;
}

.manage-detail-value {
  font-size: 14px;
  font-weight: 700;
  color: #ccc;
  white-space: nowrap;
}

.manage-detail-hint {
  font-size: 10px;
  font-weight: 400;
  color: #555;
  letter-spacing: 0.04em;
  margin-right: 8px;
}

.manage-detail-grid-below {
  margin-top: 0;
  padding: 16px 32px 24px;
  max-width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.manage-detail-grid-outside {
  max-width: 1200px;
  margin: 24px auto 40px;
  padding: 20px 32px;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  gap: 8px;
}

.manage-preview-badge,
.manage-preview-badges {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0;
}

.manage-preview-badges .file-badge {
  margin-left: 0;
}

/* Sidebar (right) */
.manage-sidebar {
  width: 380px;
  flex-shrink: 0;
  padding: 28px 24px;
  border-left: 1px solid #222;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.manage-setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manage-setting-toggle-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.manage-setting-label {
  font-size: 11px;
  font-weight: 700;
  color: #666;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.manage-setting-hint {
  display: block;
  font-size: 10px;
  color: #555;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

/* Hidden state for manage settings that preserves layout (no shifting) */
.manage-setting-hidden {
  visibility: hidden;
  max-height: 0;
  overflow: hidden;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  border: none !important;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.25s ease, padding 0.25s ease;
}

.manage-setting-visible {
  visibility: visible;
  max-height: 500px;
  opacity: 1;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.manage-setting-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 14px;
  color: #e0e0e0;
  font-size: 14px;
  transition: border-color 0.2s;
  cursor: pointer;
}

.manage-setting-select:focus {
  outline: none;
  border-color: #555;
}

.manage-setting-select option {
  background: #1a1a1a;
  color: #e0e0e0;
}

.manage-setting-input {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 14px;
  color: #e0e0e0;
  font-size: 14px;
  transition: border-color 0.2s;
}

.manage-setting-input:focus {
  outline: none;
  border-color: #555;
}

.manage-setting-input::placeholder {
  color: #555;
}

.manage-setting-pw-row {
  display: flex;
  gap: 8px;
}

.manage-setting-pw-btn {
  background: #333;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 10px 16px;
  color: #e0e0e0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.manage-setting-pw-btn:hover {
  background: #444;
  border-color: #555;
}

/* Share section inside sidebar */
.manage-share {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid #222;
}

.manage-share-row {
  display: flex;
  gap: 8px;
}

.manage-share-input {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 9px 12px;
  color: #777;
  font-size: 12px;
  font-family: 'Monaco', 'Courier New', monospace;
}

.manage-share-wget {
  font-size: 11px;
}

.manage-share-copy {
  background: #333;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 9px 14px;
  color: #e0e0e0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.manage-share-copy:hover {
  background: #444;
  border-color: #555;
}

.manage-share-note {
  font-size: 11px;
  color: #555;
  margin: 2px 0 0;
}

/* Action buttons at bottom of sidebar */
.manage-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid #222;
}

.manage-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  text-decoration: none;
  text-align: center;
}

.manage-action-download {
  background: rgba(96, 165, 250, 0.10);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.25);
}

.manage-action-download:hover {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.4);
  color: #93bbfd;
}

.manage-action-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.manage-action-delete {
  background: rgba(222, 24, 51, 0.12);
  color: #DE1833;
  border: 1px solid rgba(222, 24, 51, 0.25);
}

.manage-action-delete:hover {
  background: rgba(222, 24, 51, 0.22);
  border-color: rgba(222, 24, 51, 0.4);
}

/* Responsive: stack on mobile */

/* Temp Upload Progress Card
   The drop zone keeps its original dimensions so the page layout does not shift.
   The progress card fills the full drop zone area. */
.drop-zone.uploading {
  background: rgba(30, 30, 30, 0.8);
  border: 3px solid #444;
  padding: 0;
  box-shadow: none;
  transform: none;
  cursor: default;
}

.drop-zone.uploading::before {
  display: none;
}

.drop-zone.uploading:hover {
  background: rgba(30, 30, 30, 0.8);
  border: 3px solid #444;
  transform: none;
}

.upload-progress-card {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.upload-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
}

.upload-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

.upload-card-close {
  background: none;
  border: none;
  color: #666;
  font-size: 24px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease, color 0.2s ease;
  line-height: 1;
}

.upload-card-close:hover {
  background: rgba(222, 24, 51, 0.15);
  color: #DE1833;
}

.upload-card-body {
  padding: 16px 40px 24px;
}

.upload-card-bar {
  width: 100%;
  height: 4px;
  background: #1a1a1a;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 20px;
}

.upload-card-fill {
  height: 100%;
  background: linear-gradient(90deg, #DE1833, #E8304A);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

.upload-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.upload-card-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #222;
  border-radius: 8px;
  text-align: center;
}

.upload-card-stat-label {
  font-size: 9px;
  color: #555;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.upload-card-stat-value {
  font-size: 14px;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  overflow: visible;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.upload-card-filename {
  margin-top: 12px;
  font-size: 11px;
  color: #555;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-height: 16px;
  text-align: center;
}

/* Flash Messages */
/* ── Unified Toast System ─────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 500px;
  padding: 0 16px;
}

.toast-message {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  text-transform: uppercase;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: toastSlideDown 0.3s ease;
  width: fit-content;
  max-width: 100%;
}

.toast-message.toast-success {
  background: #22c55e;
  color: #fff;
}

.toast-message.toast-error {
  background: #E8304A;
  color: #fff;
}

.toast-message.toast-info {
  background: #333;
  color: #fff;
}

@keyframes toastSlideDown {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}


/* Legacy flash-messages (still used by Jinja2 server-side rendering) */
.flash-messages {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 500px;
  padding: 0 16px;
}

.flash-message {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  text-transform: uppercase;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: toastSlideDown 0.3s ease;
  background: #E8304A;
  width: fit-content;
  max-width: 100%;
}

.flash-message.error {
  background: #E8304A;
  color: #fff;
}

.flash-message.success {
  background: #22c55e;
  color: #fff;
}

/* Password & Not Found Sections */
.pw-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
  padding: 40px 20px;
  position: relative;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   404 / Not Found Page — Matches share/landing page aesthetic
   ═══════════════════════════════════════════════════════════ */

/* Layout overrides */
body:has(.notfound-section) {
  background: #030303;
  overflow: hidden;
}

body:has(.notfound-section) .footer { display: none; }
body:has(.notfound-section) .main { padding: 0; flex: 1; display: flex; flex-direction: column; }
body:has(.notfound-section) .main > .container { flex: 1; display: flex; flex-direction: column; }

.notfound-section {
  flex: 1;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #030303;
  min-height: 100vh;
}

/* ── Background effects ───────────────────────────────── */
.nf-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(222, 24, 51, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(222, 24, 51, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 50% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 50% at 50% 50%, black 20%, transparent 70%);
  opacity: 0;
  animation: nfFadeIn 3s ease 0.5s forwards;
  pointer-events: none;
}

.nf-aurora {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  animation: nfFadeIn 3s ease 0.4s forwards;
}

.nf-orb {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}

.nf-orb-1 {
  width: 700px;
  height: 700px;
  top: -25%;
  left: -10%;
  background: radial-gradient(circle, rgba(222, 24, 51, 0.07) 0%, transparent 65%);
  filter: blur(140px);
  animation: nfDrift1 24s ease-in-out infinite alternate;
}

.nf-orb-2 {
  width: 500px;
  height: 500px;
  bottom: -15%;
  right: -5%;
  background: radial-gradient(circle, rgba(180, 20, 60, 0.05) 0%, transparent 65%);
  filter: blur(130px);
  animation: nfDrift2 30s ease-in-out infinite alternate;
}

.nf-orb-3 {
  width: 300px;
  height: 300px;
  top: 40%;
  left: 55%;
  background: radial-gradient(circle, rgba(222, 24, 51, 0.04) 0%, transparent 65%);
  filter: blur(100px);
  animation: nfDrift3 20s ease-in-out infinite alternate;
}

@keyframes nfDrift1 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 30px) scale(1.05); }
}
@keyframes nfDrift2 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-40px, -20px) scale(1.03); }
}
@keyframes nfDrift3 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-30px, 25px) scale(1.04); }
}

.nf-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 58% 44% at 50% 32%, rgba(3, 3, 3, 0.04) 0%, rgba(3, 3, 3, 0.2) 32%, rgba(3, 3, 3, 0.72) 72%, #030303 100%);
  pointer-events: none;
}

@keyframes nfFadeIn { to { opacity: 1; } }

/* ── Card ─────────────────────────────────────────────── */
.notfound-card {
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, rgba(8, 8, 8, 0.92) 0%, rgba(6, 6, 6, 0.78) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 22px;
  padding: 60px 50px;
  text-align: center;
  max-width: 480px;
  width: 100%;
  overflow: clip;
  opacity: 0;
  animation: nfCardIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.38);
}

/* Spinning reflection border */
.notfound-card::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  transform: translate(-50%, -50%);
  background: conic-gradient(
    from 0deg at 50% 50%,
    transparent 0%,
    transparent 68%,
    rgba(255, 255, 255, 0.02) 73%,
    rgba(255, 255, 255, 0.06) 76%,
    rgba(255, 255, 255, 0.12) 79%,
    rgba(255, 255, 255, 0.06) 82%,
    rgba(255, 255, 255, 0.02) 85%,
    transparent 90%,
    transparent 100%
  );
  animation: nfBorderSpin 12s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes nfBorderSpin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Inner fill mask */
.notfound-card::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 21px;
  background: #030303;
  pointer-events: none;
  z-index: 1;
}

/* Content above pseudo-elements */
.notfound-card > * {
  position: relative;
  z-index: 2;
}

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

/* ── Error code ───────────────────────────────────────── */
.notfound-code {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.notfound-digit {
  font-size: 80px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.08);
  line-height: 1;
  letter-spacing: -2px;
  animation: nfDigitIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(0.4s + var(--delay, 0) * 0.1s);
}

.notfound-digit-accent {
  color: #DE1833;
  text-shadow: 0 0 40px rgba(222, 24, 51, 0.3);
}

@keyframes nfDigitIn {
  0% { opacity: 0; transform: translateY(-20px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ── Divider ──────────────────────────────────────────── */
.notfound-divider {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #DE1833, transparent);
  margin: 0 auto 28px;
  animation: nfDividerIn 0.8s ease both 0.6s;
}

@keyframes nfDividerIn {
  0% { transform: scaleX(0); opacity: 0; }
  100% { transform: scaleX(1); opacity: 1; }
}

/* ── Title & subtitle ─────────────────────────────────── */
.notfound-title {
  font-size: 22px;
  font-weight: 700;
  color: #f0f0f0;
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.notfound-subtitle {
  font-size: 13px;
  color: #9b9b9b;
  margin-bottom: 12px;
  line-height: 1.6;
  letter-spacing: 0.5px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Detail badge ─────────────────────────────────────── */
.notfound-detail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(222, 24, 51, 0.08);
  border: 1px solid rgba(222, 24, 51, 0.14);
  border-radius: 8px;
  padding: 10px 18px;
  margin-bottom: 32px;
  font-size: 11px;
  color: #b7b7b7;
  letter-spacing: 0.5px;
}

.notfound-detail-icon {
  color: #DE1833;
  flex-shrink: 0;
}

/* ── Actions ──────────────────────────────────────────── */
.notfound-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.notfound-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 14px 28px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  letter-spacing: 1px;
}

.notfound-button-primary {
  background: linear-gradient(135deg, #DE1833 0%, #a8122a 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(222, 24, 51, 0.2);
}

.notfound-button-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(222, 24, 51, 0.3);
  background: linear-gradient(135deg, #e52040 0%, #c41530 100%);
}

.notfound-button-secondary {
  background: rgba(255, 255, 255, 0.03);
  color: #c9c9c9;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.notfound-button-secondary:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.06);
  color: #f0f0f0;
  border-color: rgba(255, 255, 255, 0.1);
}

/* ── 404 reduced motion ───────────────────────────────── */
/* ── 404 mobile responsive ────────────────────────────── */

/* ── E2EE Download / Password page (shared design) ────── */

.e2ed-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
  flex: 1;
  padding: 40px 20px;
  position: relative;
  overflow: hidden;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}

.e2ed-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 56% 44% at 50% 34%, rgba(3, 3, 3, 0.04) 0%, rgba(3, 3, 3, 0.2) 34%, rgba(3, 3, 3, 0.72) 72%, #030303 100%);
  pointer-events: none;
}

body:has(.e2ed-section) {
  background: #030303;
}

body:has(.e2ed-section) .footer { display: none; }
body:has(.e2ed-section) .main { padding: 0; }
body:has(.e2ed-section) .main,
body:has(.e2ed-section) .main > .container { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.e2ed-card {
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.92) 0%, rgba(8, 8, 8, 0.8) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 22px;
  padding: 36px 36px 32px;
  text-align: center;
  max-width: 460px;
  width: 100%;
  animation: e2ed-card-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both,
             e2edGlowPulse 6s ease-in-out 0.5s infinite;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.02),
    0 24px 80px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(222, 24, 51, 0.04);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

@keyframes e2ed-card-in {
  0% { opacity: 0; transform: translateY(24px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes e2edGlowPulse {
  0%, 100% {
    border-color: rgba(255, 255, 255, 0.04);
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.02),
      0 24px 80px rgba(0, 0, 0, 0.6),
      0 0 60px rgba(222, 24, 51, 0.03);
  }
  50% {
    border-color: rgba(222, 24, 51, 0.12);
    box-shadow:
      0 0 0 1px rgba(222, 24, 51, 0.06),
      0 24px 80px rgba(0, 0, 0, 0.6),
      0 0 80px rgba(222, 24, 51, 0.06);
  }
}

.e2ed-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
  animation: e2ed-icon-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both 0.15s;
}

@keyframes e2ed-icon-in {
  0% { opacity: 0; transform: scale(0.7); }
  100% { opacity: 1; transform: scale(1); }
}

.e2ed-icon svg {
  width: 38px;
  height: 38px;
  stroke: #DE1833;
  filter: drop-shadow(0 0 16px rgba(222, 24, 51, 0.25));
}

.e2ed-divider {
  width: 36px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(222, 24, 51, 0.5), transparent);
  margin: 0 auto 18px;
  animation: e2ed-divider-in 0.8s ease both 0.3s;
}

@keyframes e2ed-divider-in {
  0% { transform: scaleX(0); opacity: 0; }
  100% { transform: scaleX(1); opacity: 1; }
}

.e2ed-title {
  font-size: 16px;
  font-weight: 700;
  color: #f0f0f0;
  margin-bottom: 8px;
  letter-spacing: 1.5px;
}

.e2ed-subtitle {
  font-size: 11px;
  color: #b0b0b0;
  margin-bottom: 20px;
  line-height: 1.6;
  letter-spacing: 0.4px;
}

.e2ed-error {
  font-size: 11px;
  font-weight: 600;
  color: #ff6b80;
  letter-spacing: 0.6px;
  margin: -6px 0 16px;
  text-align: center;
  animation: e2edErrorShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes e2edErrorShake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.e2ed-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  width: 100%;
}

.e2ed-input-wrapper {
  width: 100%;
}

.e2ed-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 12px 16px;
  color: #e0e0e0;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  text-align: center;
  letter-spacing: 1px;
  outline: none;
  box-sizing: border-box;
}

.e2ed-input:focus {
  border-color: rgba(222, 24, 51, 0.3);
  box-shadow: 0 0 0 3px rgba(222, 24, 51, 0.06);
  background: rgba(0, 0, 0, 0.55);
}

.e2ed-input::placeholder {
  color: #6a6a6a;
  letter-spacing: 1.5px;
  font-size: 12px;
  transition: opacity 0.15s ease;
}

.e2ed-input:focus::placeholder {
  opacity: 0;
}

.e2ed-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #DE1833 0%, #a0102a 100%);
  color: #fff;
  border: 1px solid rgba(255, 80, 110, 0.1);
  border-radius: 10px;
  padding: 11px 32px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  letter-spacing: 1px;
  box-shadow: 0 4px 24px rgba(222, 24, 51, 0.2);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

/* Shimmer sweep */
.e2ed-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(255, 255, 255, 0.06) 40%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.06) 60%,
    transparent 80%
  );
  animation: e2edShimmer 5s ease-in-out infinite;
}

@keyframes e2edShimmer {
  0%   { left: -100%; opacity: 0; }
  15%  { opacity: 1; }
  100% { left: 200%; opacity: 0; }
}

.e2ed-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(222, 24, 51, 0.3);
  border-color: rgba(255, 80, 110, 0.2);
  background: linear-gradient(135deg, #e52040 0%, #c41530 100%);
}

.e2ed-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.e2ed-submit:disabled::before {
  animation: none;
}

.e2ed-note {
  font-size: 12px;
  color: #8e8e8e;
  margin-top: 20px;
  line-height: 1.5;
  letter-spacing: 0.3px;
}

.e2ed-note svg {
  display: inline-block;
  vertical-align: -2px;
  margin-right: 4px;
  stroke: #8e8e8e;
}

.e2ed-glow {
  position: absolute;
  top: 30%;
  left: 50%;
  width: 500px;
  height: 500px;
  z-index: 0;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(222, 24, 51, 0.03) 0%, transparent 70%);
  pointer-events: none;
  filter: blur(60px);
}

/* Progress panel */
.e2ed-progress {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.e2ed-progress-inner {
  border-radius: 12px;
  overflow: hidden;
}

.e2ed-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.e2ed-progress-title {
  font-size: 12px;
  font-weight: 700;
  color: #e0e0e0;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.e2ed-progress-body {
  padding: 14px 18px;
}

.e2ed-progress-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
}

.e2ed-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #DE1833, #E8304A);
  transition: width 0.3s ease;
  width: 0%;
  border-radius: 3px;
}

.e2ed-progress-stats {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0;
}

.e2ed-progress-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 4px;
}

.e2ed-progress-stat:nth-child(1) { text-align: left; }
.e2ed-progress-stat:nth-child(2) { text-align: center; }
.e2ed-progress-stat:nth-child(3) { text-align: right; }

.e2ed-progress-label {
  font-size: 10px;
  color: #555;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.e2ed-progress-value {
  font-size: 12px;
  color: #e0e0e0;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Retry button */
.e2ed-retry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #aaa;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 28px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  letter-spacing: 1px;
  margin-top: 16px;
}

.e2ed-retry:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Reduced motion for e2ed */
/* Legacy pw-* classes (kept for backward compatibility) */
.pw-card {
  background: rgba(30, 30, 30, 0.6);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 60px 40px;
  text-align: center;
  max-width: 800px;
  width: 100%;
}

.pw-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.pw-title {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.pw-subtitle {
  font-size: 16px;
  color: #888;
  margin-bottom: 32px;
}

.pw-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.pw-input-wrapper {
  width: 100%;
}

.pw-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #444;
  border-radius: 8px;
  padding: 14px 18px;
  color: #e0e0e0;
  font-size: 16px;
  transition: border-color 0.3s;
  text-align: center;
}

.pw-input:focus {
  outline: none;
  border-color: #666;
}

.pw-submit {
  background: linear-gradient(135deg, #444 0%, #333 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px 48px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}

.pw-submit:hover {
  background: linear-gradient(135deg, #555 0%, #444 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pw-note {
  font-size: 13px;
  color: #666;
  margin-top: 20px;
}


/* Footer */
.footer {
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid #333;
  padding: 10px 20px 8px;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}

.footer-section {
  flex: 1;
  min-width: 200px;
  max-width: 250px;
}

.footer-section h3 {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.footer-section ul,
.footer-section ol {
  list-style: none;
}

.footer-section li {
  color: #888;
  padding: 2px 0;
  font-size: 11px;
}

.footer-section p {
  color: #888;
  font-size: 10px;
  line-height: 1.5;
}

.footer-bottom {
  max-width: 1200px;
  margin: 10px auto 0;
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid #333;
}

.footer-bottom p {
  color: #666;
  font-size: 10px;
}

/* Responsive */
/* Docs Page - Layout */
.main:has(.docs-layout) {
  overflow: visible;
}

/* Admin Page - Layout */
.main:has(.adm-layout) {
  overflow: visible;
}

.docs-layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 40px;
  gap: 0;
  min-height: calc(100vh - 200px);
}

/* Docs Sidebar */
.docs-sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  align-self: flex-start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 24px 0 24px 0;
}

.docs-sidebar-inner {
  padding-right: 24px;
  border-right: 1px solid #2a2a2a;
}

.docs-sidebar-heading {
  font-size: 11px;
  font-weight: 700;
  color: #8a8a8a;
  letter-spacing: 1.2px;
  padding: 8px 12px 6px;
  margin: 0;
}

.docs-nav {
  display: flex;
  flex-direction: column;
}

.docs-nav-link {
  display: block;
  padding: 8px 12px;
  color: #888;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: background 0.15s ease, border-left-color 0.15s ease, color 0.15s ease;
}

.docs-nav-link:hover {
  color: #e0e0e0;
  background: rgba(255, 255, 255, 0.03);
}

.docs-nav-link.active {
  color: #DE1833;
  border-left-color: #DE1833;
  background: rgba(222, 24, 51, 0.06);
}

.docs-nav-divider {
  height: 1px;
  background: #2a2a2a;
  margin: 12px 12px;
}

/* Docs Main Content */
.docs-main {
  flex: 1;
  min-width: 0;
  padding: 24px 0 0 40px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.docs-section {
  scroll-margin-top: 90px;
}

.docs-section-title {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 24px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #2a2a2a;
}

.docs-section-content {
  display: flex;
  flex-direction: column;
}

.docs-section-content h3 {
  font-size: 14px;
  font-weight: 700;
  color: #b0b0b0;
  letter-spacing: 0.8px;
  margin: 28px 0 12px 0;
}

.docs-section-content h3:first-child {
  margin-top: 0;
}

/* Info Grid (Overview) */
.docs-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.docs-info-card {
  background: rgba(30, 30, 30, 0.6);
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 16px 20px;
}

.docs-info-label {
  font-size: 11px;
  font-weight: 700;
  color: #8a8a8a;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.docs-info-value {
  font-size: 15px;
  color: #e0e0e0;
  font-weight: 600;
}

.docs-info-value code {
  color: #e0e0e0;
  background: none;
  padding: 0;
}

/* API Endpoint */
.api-endpoint {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.api-method {
  color: #fff;
  padding: 5px 12px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
  min-width: 56px;
  text-align: center;
  font-family: 'Monaco', 'Courier New', monospace;
}

.api-method-get {
  background: #2563eb;
}

.api-method-post {
  background: #16a34a;
}

.api-method-delete {
  background: #dc2626;
}

.api-path {
  font-family: 'Monaco', 'Courier New', monospace;
  color: #e0e0e0;
  font-size: 15px;
  font-weight: 600;
}

.api-description {
  margin-bottom: 20px;
}

.api-description p {
  color: #999;
  font-size: 14px;
  line-height: 1.7;
  margin: 0 0 8px 0;
}

.api-description p:last-child {
  margin-bottom: 0;
}

.api-description code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
  color: #e0e0e0;
}

/* Code Blocks */
.code-block {
  background: #0d0d0d;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(40, 40, 40, 0.6);
  border-bottom: 1px solid #2a2a2a;
}

.code-title {
  color: #999;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.copy-btn {
  background: linear-gradient(135deg, #333 0%, #282828 100%);
  color: #999;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  letter-spacing: 0.3px;
}

.copy-btn:hover {
  background: linear-gradient(135deg, #444 0%, #383838 100%);
  color: #e0e0e0;
  border-color: #555;
}

.code-block pre {
  padding: 16px;
  margin: 0;
  overflow-x: auto;
}

.code-block code {
  color: #e0e0e0;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.7;
}

/* Collapsible code blocks */
.code-block.collapsed pre {
  display: none;
}

.code-toggle-icon {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 10px;
  margin-right: 6px;
}

.code-block:not(.collapsed) .code-toggle-icon {
  transform: rotate(90deg);
}

/* Param Tables */
.param-table {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.param-row {
  display: grid;
  grid-template-columns: 180px 120px 1fr;
  padding: 10px 16px;
  border-bottom: 1px solid #222;
  align-items: center;
}

.param-row:last-child {
  border-bottom: none;
}

/* 4-column variant for the ALL ENDPOINTS table (METHOD/ENDPOINT/PERMISSION/DESCRIPTION) */
.param-table-4col .param-row {
  grid-template-columns: 70px 1.2fr 110px 1.6fr;
  gap: 10px;
}

.param-header {
  background: rgba(40, 40, 40, 0.6);
  font-weight: 700;
  color: #555;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.param-name {
  color: #E8304A;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
}

.param-type {
  color: #facc15;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 13px;
}

.param-desc {
  color: #888;
  font-size: 13px;
  line-height: 1.5;
}

.param-desc code {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  color: #e0e0e0;
}

/* Account Page */
.account-layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
  gap: 0;
  min-height: calc(100vh - 200px);
}

.account-sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  height: fit-content;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 24px 0;
}

.account-sidebar-inner {
  padding-right: 24px;
  border-right: 1px solid #2a2a2a;
}

.account-sidebar-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 12px 20px;
  margin-bottom: 16px;
  border-bottom: 1px solid #2a2a2a;
}

.account-sidebar-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin-bottom: 12px;
}

.account-sidebar-name {
  font-size: 14px;
  font-weight: 700;
  color: #e0e0e0;
  margin-bottom: 4px;
}

.account-sidebar-role {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.account-nav {
  display: flex;
  flex-direction: column;
}

.account-nav-heading {
  font-size: 11px;
  font-weight: 700;
  color: #555;
  letter-spacing: 1.2px;
  padding: 8px 12px 6px;
}

.account-nav-link {
  display: block;
  padding: 8px 12px;
  color: #888;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: background 0.15s ease, border-left-color 0.15s ease, color 0.15s ease;
}

.account-nav-link:hover {
  color: #e0e0e0;
  background: rgba(255, 255, 255, 0.03);
}

.account-nav-link.active {
  color: #DE1833;
  border-left-color: #DE1833;
  background: rgba(222, 24, 51, 0.06);
}

.account-nav-divider {
  height: 1px;
  background: #2a2a2a;
  margin: 12px 12px;
}

.account-main {
  flex: 1;
  min-width: 0;
  padding: 24px 0 0 40px;
}

.account-section {
  margin-bottom: 48px;
  scroll-margin-top: 90px;
}

.account-section-title {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 24px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #2a2a2a;
}

.account-section-desc {
  font-size: 13px;
  color: #8a8a8a;
  margin-bottom: 24px;
}

.account-card {
  background: rgba(20, 20, 20, 0.6);
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 16px;
}

.account-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #e0e0e0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 16px;
}

.account-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #1a1a1a;
}

.account-field:last-child {
  border-bottom: none;
}

.account-field-label {
  font-size: 13px;
  color: #888;
  font-weight: 500;
}

.account-field-value {
  font-size: 13px;
  color: #e0e0e0;
  font-weight: 600;
  min-width: 0;
  text-align: right;
  word-break: break-word;
}

.account-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.account-stat {
  background: rgba(30, 30, 30, 0.5);
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.account-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #e0e0e0;
  margin-bottom: 4px;
}

.account-stat-label {
  font-size: 11px;
  color: #8a8a8a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.account-storage-bar {
  height: 6px;
  background: #1a1a1a;
  border-radius: 3px;
  overflow: hidden;
  margin: 12px 0 8px;
}

.account-storage-fill {
  height: 100%;
  background: linear-gradient(90deg, #DE1833, #E8304A);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.account-storage-text {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #888;
}

.account-form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.account-form-label {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.account-form-input {
  padding: 10px 14px;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.account-form-input:focus {
  border-color: #DE1833;
}

.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  text-transform: uppercase;
}

.account-btn-primary {
  background: #DE1833;
  color: #fff;
}

.account-btn-primary:hover {
  background: #E8304A;
}

.account-btn-secondary {
  background: #222;
  color: #e0e0e0;
}

.account-btn-secondary:hover {
  background: #333;
}

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

.account-recovery-key {
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 16px;
  word-break: break-all;
  font-family: monospace;
  font-size: 12px;
  color: #DE1833;
  user-select: all;
  margin-bottom: 12px;
}

.account-btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.account-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.account-badge-active {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.account-badge-inactive {
  background: rgba(158, 158, 158, 0.15);
  color: #9e9e9e;
  border: 1px solid rgba(158, 158, 158, 0.3);
}

.account-nav-danger {
  color: #ff2244 !important;
}

.account-nav-danger:hover {
  color: #f87171 !important;
}

.account-danger-title {
  color: #ff2244;
}

.account-danger-card {
  border-color: rgba(222, 24, 51, 0.3);
}

.account-danger-warning {
  color: #888;
  font-size: 12px;
  line-height: 1.6;
  margin: 0 0 16px;
}

.account-danger-divider {
  border-top: 1px solid #333;
  margin: 16px 0;
}

.account-btn-danger {
  background: #7f1d1d;
  color: #fca5a5;
  border: 1px solid rgba(222, 24, 51, 0.3);
}

.account-btn-danger:hover {
  background: #991b1b;
  border-color: rgba(222, 24, 51, 0.5);
}

/* API Key Permissions & IP Whitelist */
.apikey-perms-section {
  margin-top: 16px;
  margin-bottom: 16px;
}

.apikey-perms-desc {
  font-size: 11px;
  color: #8a8a8a;
  margin-bottom: 10px;
  line-height: 1.4;
}

.apikey-perms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.apikey-perm-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: #0a0a0a;
  border: 1px solid #222;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.apikey-perm-checkbox:hover {
  border-color: #444;
}

.apikey-perm-checkbox input[type="checkbox"] {
  margin-top: 2px;
  accent-color: #DE1833;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}

.apikey-perm-name {
  font-size: 12px;
  font-weight: 700;
  color: #e0e0e0;
  display: block;
  line-height: 1;
}

.apikey-perm-detail {
  font-size: 11px;
  color: #8a8a8a;
  display: block;
  margin-top: 3px;
  line-height: 1.3;
}

.apikey-ips-section {
  margin-bottom: 8px;
}

.apikey-ip-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.apikey-ip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.apikey-ip-input {
  flex: 1;
  padding: 8px 12px;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 13px;
  font-family: monospace;
  outline: none;
  transition: border-color 0.2s;
}

.apikey-ip-input:focus {
  border-color: #DE1833;
}

.apikey-ip-remove {
  background: none;
  border: 1px solid #333;
  border-radius: 6px;
  color: #666;
  font-size: 18px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.apikey-ip-remove:hover {
  color: #fca5a5;
  border-color: rgba(222, 24, 51, 0.3);
  background: #7f1d1d;
}

.apikey-ip-add-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 14px;
  background: none;
  border: 1px dashed #333;
  border-radius: 6px;
  color: #888;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  text-transform: uppercase;
}

.apikey-ip-add-btn:hover {
  border-color: #DE1833;
  color: #DE1833;
}

/* API Key cards in active keys list */
.apikey-card {
  border-bottom: 1px solid #1a1a1a;
  padding: 12px 0;
}

.apikey-card:last-child {
  border-bottom: none;
}

.apikey-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.apikey-card-info {
  flex: 1;
  min-width: 200px;
}

.apikey-card-label {
  font-weight: 700;
  color: #fff;
  font-size: 13px;
}

.apikey-card-meta {
  color: #666;
  font-size: 11px;
  margin-top: 4px;
}

.apikey-card-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.apikey-badge {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(222, 24, 51, 0.15);
  border: 1px solid rgba(222, 24, 51, 0.25);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #DE1833;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.apikey-badge-none {
  background: rgba(100, 100, 100, 0.15);
  border-color: rgba(100, 100, 100, 0.25);
  color: #666;
}

.apikey-card-actions {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-shrink: 0;
}

.apikey-btn-edit {
  background: #222;
  color: #e0e0e0;
  padding: 6px 14px;
  font-size: 11px;
}

.apikey-btn-edit:hover {
  background: #333;
}

.apikey-btn-revoke {
  padding: 6px 14px;
  font-size: 11px;
}

.apikey-card-edit {
  margin-top: 12px;
  padding: 16px;
  background: rgba(10, 10, 10, 0.5);
  border: 1px solid #222;
  border-radius: 8px;
}

.apikey-card-edit .apikey-perms-section {
  margin-top: 0;
}

.apikey-edit-buttons {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.apikey-btn-cancel {
  background: #222;
  color: #e0e0e0;
}

.apikey-btn-cancel:hover {
  background: #333;
}

/* Auth Pages */
/* ═══════════════════════════════════════════════════════════
   Auth Pages — Login, Register, 2FA, Recovery
   ═══════════════════════════════════════════════════════════ */

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
  padding: 40px 20px;
  position: relative;
}

.auth-box {
  background: rgba(10, 10, 10, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 44px 40px 36px;
  max-width: 440px;
  width: 100%;
  position: relative;
  overflow: clip;
}

/* ── Traveling border light ──────────────────────────── */
.auth-box::before {
  content: '';
  position: absolute;
  /* oversized square centered on the box so rotation covers all edges */
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  transform: translate(-50%, -50%);
  background: conic-gradient(
    from 0deg at 50% 50%,
    transparent 0%,
    transparent 72%,
    rgba(222, 24, 51, 0.15) 78%,
    rgba(255, 60, 80, 0.28) 81%,
    rgba(222, 24, 51, 0.15) 84%,
    transparent 90%,
    transparent 100%
  );
  animation: authBorderSpin 14s linear infinite;
  pointer-events: none;
  z-index: 10;
}

@keyframes authBorderSpin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Mask the spinning gradient to only show at the 1px border edge */
.auth-box::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 15px;
  background: rgba(10, 10, 10, 1);
  pointer-events: none;
  z-index: 10;
}

/* ── Inner content above border pseudo ───────────────── */
.auth-box > *:not(style) {
  position: relative;
  z-index: 11;
}

/* ── Title with glow pulse ────────────────────────────── */
.auth-box h1 {
  text-align: center;
  margin-bottom: 28px;
  color: #e8e8e8;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 4px;
  animation: authTitleGlow 8s ease-in-out infinite;
}

@keyframes authTitleGlow {
  0%   { color: #e8e8e8; text-shadow: 0 0 0 transparent; }
  15%  { color: #fff; text-shadow: 0 0 8px rgba(255, 255, 255, 0.25), 0 0 20px rgba(222, 24, 51, 0.15), 0 0 40px rgba(222, 24, 51, 0.06); }
  30%  { color: #e8e8e8; text-shadow: 0 0 0 transparent; }
  100% { color: #e8e8e8; text-shadow: 0 0 0 transparent; }
}

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

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

.auth-form .form-group label {
  font-size: 10px;
  font-weight: 600;
  color: #8a8a8a;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.auth-form .form-input {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  color: #d0d0d0;
  font-size: 16px;
  transition: background 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-form .form-input:focus {
  outline: none;
  border-color: rgba(222, 24, 51, 0.3);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 0 0 3px rgba(222, 24, 51, 0.06);
}

.auth-form .form-input::placeholder {
  color: #6a6a6a;
}

.auth-form .btn-primary {
  padding: 13px 24px;
  background: linear-gradient(135deg, #DE1833 0%, #a0102a 100%);
  border: 1px solid rgba(255, 80, 110, 0.1);
  border-radius: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  margin-top: 4px;
  position: relative;
  overflow: hidden;
}

.auth-form .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(222, 24, 51, 0.2), 0 0 0 1px rgba(222, 24, 51, 0.1);
}

.auth-form .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-link {
  text-align: center;
  margin-top: 16px;
  font-size: 11px;
  color: #9b9b9b;
  letter-spacing: 0.3px;
}

.auth-link a {
  color: #b0b0b0;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.auth-link a:hover {
  color: #bbb;
}

/* ── Captcha ─────────────────────────────────────────── */
.captcha-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.captcha-image-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.captcha-image {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  height: 46px;
  width: 150px;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-drag: none;
  background: #080808;
}

.captcha-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: #888;
  cursor: pointer;
  transition: background 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.captcha-refresh:hover {
  color: #888;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.captcha-refresh:active svg {
  transform: rotate(-180deg);
  transition: transform 0.3s ease;
}

.captcha-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  flex: 1;
  min-width: 0;
}

@media (max-width: 400px) {
  .captcha-container {
    flex-wrap: wrap;
  }
  .captcha-image {
    width: 100%;
  }
  .captcha-input {
    flex-basis: 100%;
  }
}

/* ── Auth utility classes ─────────────────────────────── */
.auth-subtitle {
  color: #9b9b9b;
  font-size: 11px;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
  text-align: center;
  line-height: 1.6;
}

.auth-hint {
  color: #888;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.auth-code-input {
  text-align: center;
  font-size: 1.3em !important;
  letter-spacing: 0.35em;
  padding-left: 0.35em;
  font-family: monospace;
}

.auth-mono-input {
  font-family: monospace;
  font-size: 0.85em;
}

/* Dashboard */
.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
}

.dashboard-header {
  margin-bottom: 40px;
}

.dashboard-header h1 {
  font-size: 36px;
  margin-bottom: 20px;
  color: #e0e0e0;
}

.storage-info {
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 20px;
  max-width: 600px;
}

.storage-bar-container {
  width: 100%;
  height: 20px;
  background: rgba(30, 30, 30, 0.8);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.storage-bar {
  height: 100%;
  background: linear-gradient(90deg, #666, #444);
  transition: width 0.3s ease;
}

.storage-info p {
  color: #888;
  font-size: 14px;
  margin: 0;
}

.upload-section {
  margin-bottom: 10px;
}

/* Temporary Files Section */
.temp-files-section {
  margin-top: 0;
  margin-bottom: 40px;
}

.temp-files-section .section-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #e0e0e0;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: none;
  padding-bottom: 0;
}

/* Temp uploads browser — mirrors dashboard .browser-header / .browser-row grid */
.temp-browser {
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 12px;
  overflow: hidden;
}

.temp-browser-header {
  display: grid;
  grid-template-columns: 1fr auto 40px 120px 150px 130px;
  gap: 20px;
  padding: 2px 10px;
  background: #141414;
  border-bottom: 1px solid #222;
  font-size: 12px;
  color: #666;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.temp-browser-header .browser-col {
  color: #666;
  font-size: 12px;
}

.temp-browser-files {
  padding: 0;
}

.temp-browser-row {
  display: grid;
  grid-template-columns: 1fr auto 40px 120px 150px 130px;
  gap: 20px;
  padding: 10px 10px;
  background: #0a0a0a;
  border-bottom: 1px solid #1a1a1a;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.temp-browser-row:last-child {
  border-bottom: none;
}

.temp-browser-row:hover {
  background: #141414;
}

.files-section h2 {
  font-size: 28px;
  margin-bottom: 20px;
  color: #e0e0e0;
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.file-card {
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.file-card:hover {
  border-color: #e0e0e0;
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(255, 255, 255, 0.1);
}

.file-icon {
  font-size: 48px;
  text-align: center;
}

.file-info {
  flex: 1;
}

.file-name {
  font-size: 16px;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 8px;
  word-break: break-word;
}

.file-size, .file-date, .file-expires {
  font-size: 13px;
  color: #888;
  margin: 4px 0;
}

.file-actions {
  display: flex;
  gap: 10px;
}

.btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #555;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0.3px;
  min-height: 28px;
  box-sizing: border-box;
}

.btn-small:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #777;
}

.no-files {
  text-align: center;
  padding: 60px 20px;
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid #333;
  border-radius: 12px;
}

.no-files p {
  font-size: 18px;
  color: #888;
}

/* ── Admin Panel ────────────────────────────────────────────────────── */

.adm-layout {
  display: flex;
  min-height: calc(100vh - 60px);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.adm-sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  height: fit-content;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 24px 0;
}

.adm-sidebar-inner {
  padding-right: 24px;
  border-right: 1px solid #2a2a2a;
}

.adm-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #555;
  padding: 8px 12px 6px;
  margin: 0;
}

.adm-nav {
  display: flex;
  flex-direction: column;
}

.adm-nav-link {
  display: block;
  padding: 8px 12px;
  color: #888;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: background 0.15s ease, border-left-color 0.15s ease, color 0.15s ease;
  cursor: pointer;
}

.adm-nav-link:hover {
  color: #e0e0e0;
  background: rgba(255, 255, 255, 0.03);
}

.adm-nav-link.active {
  color: #DE1833;
  border-left-color: #DE1833;
  background: rgba(222, 24, 51, 0.06);
}

/* Main area */
.adm-main {
  flex: 1;
  min-width: 0;
  padding: 24px 0 60px 40px;
}

.adm-page-title {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 24px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #2a2a2a;
}

/* Tabs */
.adm-tab {
  display: none;
}

.adm-tab.active {
  display: block;
}

/* Admin flash — now uses unified toast system (CSS kept for backward compat) */
.adm-flash {
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #fff;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: toastSlideDown 0.3s ease;
  transition: opacity 0.3s;
}

.adm-flash-success {
  background: #22c55e;
  color: #fff;
}

.adm-flash-error {
  background: #E8304A;
  color: #fff;
}

.adm-flash-info {
  background: #333;
  color: #fff;
}

/* Stats Grid (legacy - kept for users tab) */
.adm-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.adm-stat-card {
  background: rgba(17, 17, 17, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 16px;
  transition: border-color 0.2s;
}

.adm-stat-card:hover {
  border-color: #2a2a2a;
}

.adm-stat-label {
  font-size: 10px;
  font-weight: 600;
  color: #8a8a8a;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.adm-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #e0e0e0;
}

/* ─── Overview Hero Cards ─────────────────────────────────────────── */
.adm-hero-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.adm-hero-card {
  background: rgba(17, 17, 17, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s, transform 0.2s;
}

.adm-hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--hero-accent, #DE1833), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.adm-hero-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.adm-hero-card:hover::before {
  opacity: 1;
}

.adm-hero-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.adm-hero-icon--users {
  background: rgba(222, 24, 51, 0.1);
  color: #DE1833;
}

.adm-hero-icon--files {
  background: rgba(100, 150, 255, 0.1);
  color: #6496ff;
}

.adm-hero-icon--downloads {
  background: rgba(74, 222, 128, 0.1);
  color: #4ade80;
}

.adm-hero-icon--folders {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.adm-hero-card:nth-child(1) { --hero-accent: #DE1833; }
.adm-hero-card:nth-child(2) { --hero-accent: #6496ff; }
.adm-hero-card:nth-child(3) { --hero-accent: #4ade80; }
.adm-hero-card:nth-child(4) { --hero-accent: #f59e0b; }

.adm-hero-data {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.adm-hero-value {
  font-size: 28px;
  font-weight: 800;
  color: #e0e0e0;
  letter-spacing: -0.5px;
  line-height: 1;
}

.adm-hero-label {
  font-size: 10px;
  font-weight: 700;
  color: #8a8a8a;
  letter-spacing: 1px;
}

.adm-hero-sub {
  font-size: 10px;
  color: #555;
  letter-spacing: 0.3px;
  font-weight: 500;
  margin-top: -2px;
}

/* ─── Storage Panel (full width) ──────────────────────────────────── */
.adm-storage-panel {
  margin-bottom: 16px;
}

.adm-storage-panel .adm-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.adm-storage-panel .adm-card-title svg {
  color: #DE1833;
}

.adm-storage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
}

.adm-storage-headline {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.adm-storage-pct-lg {
  font-size: 28px;
  font-weight: 800;
  color: #e0e0e0;
  letter-spacing: -0.5px;
  line-height: 1;
}

.adm-storage-pct-label {
  font-size: 9px;
  font-weight: 700;
  color: #555;
  letter-spacing: 1.2px;
  margin-top: 4px;
}

.adm-storage-bar-stack {
  margin: 16px 0 14px;
}

.adm-storage-bar-track {
  height: 10px;
  background: #1a1a1a;
  border-radius: 5px;
  overflow: hidden;
  display: flex;
}

.adm-storage-bar-seg {
  height: 100%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}

.adm-storage-bar-seg--user {
  background: #DE1833;
  border-radius: 5px 0 0 5px;
}

.adm-storage-bar-seg--temp {
  background: #f59e0b;
}

.adm-storage-bar-seg--other {
  background: #555;
}

.adm-storage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
}

.adm-storage-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.adm-storage-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.adm-storage-legend-label {
  color: #666;
  font-weight: 600;
  letter-spacing: 0.3px;
  font-size: 10px;
}

.adm-storage-legend-value {
  color: #aaa;
  font-weight: 700;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.adm-storage-total {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #1e1e1e;
  font-size: 10px;
  color: #888;
  letter-spacing: 0.4px;
  text-align: center;
  font-weight: 600;
}

/* ─── Info Cards Row ─────────────────────────────────────────────── */
.adm-info-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.adm-info-card .adm-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.adm-info-card--system .adm-card-title svg {
  color: #6496ff;
}

.adm-info-card--e2ee .adm-card-title svg {
  color: #4ade80;
}

.adm-info-list {
  display: flex;
  flex-direction: column;
}

.adm-info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #1e1e1e;
}

.adm-info-item:last-child {
  border-bottom: none;
}

.adm-info-key {
  font-size: 10px;
  font-weight: 600;
  color: #8a8a8a;
  letter-spacing: 0.6px;
}

.adm-info-val {
  font-size: 13px;
  font-weight: 700;
  color: #e0e0e0;
  font-variant-numeric: tabular-nums;
}

/* ─── Quick Actions Strip ─────────────────────────────────────────── */
.adm-quick-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.adm-qaction {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: #777;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.adm-qaction svg {
  opacity: 0.5;
  transition: opacity 0.15s;
}

.adm-qaction:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
}

.adm-qaction:hover svg {
  opacity: 0.9;
}

.adm-qaction--danger {
  border-color: rgba(222, 24, 51, 0.15);
  color: #DE1833;
}

.adm-qaction--danger:hover {
  background: rgba(222, 24, 51, 0.06);
  border-color: rgba(222, 24, 51, 0.3);
}

.adm-qaction--danger svg {
  opacity: 0.7;
}

/* Cards */
.adm-card-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.adm-card {
  background: rgba(17, 17, 17, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 20px;
}

.adm-card-title {
  font-size: 11px;
  font-weight: 700;
  color: #8a8a8a;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
}

/* ─── Storage Nodes & Replication Panel ──────────────────────────── */

.sn-repl-panel {
  background: rgba(17, 17, 17, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  margin-bottom: 24px;
  position: relative;
  z-index: 10;
}

.sn-repl-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px;
  gap: 12px;
}

.sn-repl-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sn-repl-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #555;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(85, 85, 85, 0.4);
  transition: background 0.3s, box-shadow 0.3s;
}

.sn-repl-dot.synced { background: #4CAF50; box-shadow: 0 0 8px rgba(76, 175, 80, 0.4); }
.sn-repl-dot.syncing { background: #FF9800; box-shadow: 0 0 8px rgba(255, 152, 0, 0.4); animation: sn-pulse 2s ease-in-out infinite; }
.sn-repl-dot.error { background: #f44336; box-shadow: 0 0 8px rgba(244, 67, 54, 0.4); }

@keyframes sn-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.sn-repl-label {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}

.sn-repl-pending {
  color: #666;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.sn-repl-bars {
  padding: 0 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sn-repl-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sn-repl-bar-name {
  color: #888;
  font-size: 11px;
  min-width: 110px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sn-repl-bar-track {
  flex: 1;
  height: 6px;
  background: #1a1a1a;
  border-radius: 3px;
  overflow: hidden;
}

.sn-repl-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease, background 0.3s;
}

.sn-repl-bar-pct {
  color: #666;
  font-size: 11px;
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sn-repl-bar-errors {
  color: #f44336;
  font-size: 10px;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.sn-repl-missing {
  margin: 0 22px 14px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  color: #444;
  font-size: 11px;
  letter-spacing: 0.3px;
}

/* Header left column (status + pending) */
.sn-repl-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* Action buttons (top-right of repl panel) */
.sn-repl-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.sn-repl-action {
  position: relative;
}

.sn-repl-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  cursor: pointer;
  color: #999;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
}

.sn-repl-action-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
  color: #ccc;
}

.sn-repl-action-btn svg {
  flex-shrink: 0;
  color: #666;
}

/* Context menu (absolute positioned) */
.sn-repl-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
}

.sn-repl-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.sn-repl-menu-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sn-repl-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 12px;
  border-radius: 7px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  color: #999;
  font-size: 11px;
  letter-spacing: 0.6px;
}

.sn-repl-opt:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ddd;
}

.sn-repl-opt.active {
  background: rgba(222, 24, 51, 0.12);
  color: #fff;
}

.sn-repl-opt-name {
  font-weight: 600;
}

.sn-repl-opt-meta {
  color: #555;
  font-size: 10px;
  letter-spacing: 0.3px;
}

.sn-repl-opt.active .sn-repl-opt-meta {
  color: rgba(222, 24, 51, 0.7);
}

/* Cache TTL row inside caching-only card */
.sn-cache-ttl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.sn-cache-ttl-info {
  min-width: 0;
}

.sn-cache-ttl-label {
  color: #aaa;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 3px;
}

.sn-cache-ttl-desc {
  color: #555;
  font-size: 10px;
  letter-spacing: 0.3px;
  line-height: 1.4;
}

.sn-cache-ttl-input {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sn-cache-ttl-input input {
  width: 64px;
  background: #111;
  border: 1px solid #333;
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  text-align: center;
  font-family: inherit;
}

.sn-cache-ttl-input input:focus {
  border-color: #DE1833;
  outline: none;
}

.sn-cache-ttl-input span {
  color: #555;
  font-size: 10px;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* ─── Storage Node Cards ─────────────────────────────────────────── */

.sn-node-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.sn-node-card {
  background: rgba(17, 17, 17, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 20px 22px;
  transition: border-color 0.2s;
}

.sn-node-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.sn-node-card.primary {
  border-left: 3px solid #DE1833;
}

.sn-node-card.caching-only {
  border-left: 3px solid #333;
}

.sn-node-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.sn-node-icon {
  color: #DE1833;
  display: flex;
  flex-shrink: 0;
}

.sn-node-icon.muted { color: #555; }

.sn-node-name {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
}

.sn-node-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sn-node-status-text {
  color: #666;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.sn-node-badge {
  background: #DE1833;
  color: #fff;
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
  font-weight: 700;
}

.sn-node-subtitle {
  font-size: 11px;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
  font-weight: 600;
  padding-left: 28px;
}

.sn-node-subtitle.tracked { color: #4CAF50; }
.sn-node-subtitle.cache { color: #666; }
.sn-node-subtitle.config { color: #555; }

.sn-node-counts {
  display: flex;
  gap: 20px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.sn-node-count {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sn-node-count svg { color: #444; flex-shrink: 0; }

.sn-node-count-label {
  color: #666;
  font-size: 10px;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.sn-node-count-val {
  color: #ccc;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── Storage Node Disk Usage Bar ─────────────────────────────── */
.sn-disk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  margin-bottom: 14px;
}

.sn-metric-pair {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 14px;
}

.sn-metric-pair .sn-disk-row {
  margin-bottom: 0;
}

.sn-metric-pair .sn-disk-row.used-only {
  display: flex;
  flex: 0 1 220px;
}

.sn-metric-pair .sn-disk-row.host-disk {
  flex: 1 1 360px;
}

.sn-disk-row.loading {
  opacity: 0.5;
}

.sn-disk-row.used-only {
  display: inline-flex;
  width: auto;
  max-width: 100%;
  justify-content: flex-start;
  gap: 12px;
}

.sn-disk-row.used-only .sn-disk-sizes {
  color: #999;
}

@media (max-width: 900px) {
  .sn-metric-pair {
    flex-direction: column;
  }

  .sn-metric-pair .sn-disk-row.used-only,
  .sn-metric-pair .sn-disk-row.host-disk {
    flex: 1 1 auto;
    width: 100%;
  }
}

.sn-disk-label {
  color: #555;
  font-size: 10px;
  letter-spacing: 0.8px;
  font-weight: 600;
  flex-shrink: 0;
}

.sn-disk-bar-track {
  flex: 1;
  height: 6px;
  background: #1a1a1a;
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}

.sn-disk-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease, background 0.3s;
}

.sn-disk-pct {
  color: #999;
  font-size: 11px;
  font-weight: 700;
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.sn-disk-sizes {
  color: #555;
  font-size: 10px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  white-space: nowrap;
}

.sn-node-seen {
  color: #888;
  font-size: 10px;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

.sn-node-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.sn-btn {
  background: rgba(255, 255, 255, 0.04);
  color: #888;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 10px;
  letter-spacing: 0.8px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}

.sn-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #ccc;
}

.sn-btn.danger {
  color: #c0392b;
}

.sn-btn.danger:hover:not(:disabled) {
  background: rgba(244, 67, 54, 0.08);
  border-color: rgba(244, 67, 54, 0.2);
  color: #f44336;
}

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

.sn-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #DE1833;
  color: #fff;
  border: none;
  padding: 11px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  transition: background 0.15s, transform 0.1s;
}

.sn-add-btn:hover {
  background: #c41530;
}

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

.sn-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Purge progress panel */
.sn-purge-panel {
  background: rgba(17, 17, 17, 0.9);
  border: 1px solid rgba(222, 24, 51, 0.2);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 16px;
}

.sn-purge-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sn-purge-title {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}

.sn-purge-phase {
  color: #888;
  font-size: 11px;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

.sn-purge-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sn-purge-bar-wrap .sn-repl-bar-track {
  flex: 1;
}

.sn-purge-stats {
  color: #666;
  font-size: 10px;
  letter-spacing: 0.5px;
  line-height: 1.6;
}

/* ─── Storage Nodes Responsive ───────────────────────────────────── */


/* Storage bar */
.adm-storage-info {
  margin-bottom: 12px;
}

.adm-storage-bar {
  height: 8px;
  background: #1e1e1e;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.adm-storage-fill {
  height: 100%;
  background: #DE1833;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.adm-storage-fill.adm-storage-warn {
  background: #ff2244;
}

.adm-storage-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #888;
  font-weight: 500;
}

.adm-storage-detail {
  font-size: 10px;
  color: #555;
  letter-spacing: 0.3px;
}

/* Quick actions */
.adm-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.adm-action-btn {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #1e1e1e;
  border-radius: 8px;
  color: #888;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.adm-action-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: #333;
  color: #e0e0e0;
}

.adm-action-danger {
  border-color: rgba(222, 24, 51, 0.2);
  color: #DE1833;
}

.adm-action-danger:hover {
  background: rgba(222, 24, 51, 0.08);
  border-color: rgba(222, 24, 51, 0.4);
}

/* Tab header with search */
.adm-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.adm-tab-header .adm-page-title {
  margin: 0;
}

.adm-search-wrap {
  position: relative;
}

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

.adm-search {
  background: rgba(17, 17, 17, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: #e0e0e0;
  padding: 8px 12px 8px 32px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  width: 220px;
  outline: none;
  transition: border-color 0.2s;
}

.adm-search:focus {
  border-color: #333;
}

.adm-search::placeholder {
  color: #777;
}

/* Tables */
.adm-table-wrap {
  overflow-x: auto;
  background: rgba(17, 17, 17, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.adm-table {
  width: 100%;
  border-collapse: collapse;
}

#tempTable {
  table-layout: fixed;
}

#tempTable colgroup .col-filename { width: 24%; }
#tempTable colgroup .col-size     { width: 9%; }
#tempTable colgroup .col-visitor  { width: 11%; }
#tempTable colgroup .col-uploaded { width: 13%; }
#tempTable colgroup .col-expires  { width: 13%; }
#tempTable colgroup .col-downloads{ width: 8%; }
#tempTable colgroup .col-flags    { width: 10%; }
#tempTable colgroup .col-actions  { width: 12%; }

.adm-table th {
  padding: 8px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: #8a8a8a;
  letter-spacing: 0.8px;
  border-bottom: 1px solid #1e1e1e;
  white-space: nowrap;
  user-select: none;
}

.adm-table td {
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  color: #ccc;
  border-bottom: 1px solid #141414;
  white-space: nowrap;
}

.adm-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.adm-table tbody tr:last-child td {
  border-bottom: none;
}

.adm-sortable {
  cursor: pointer;
  transition: color 0.15s;
}

.adm-sortable::after {
  content: '\2195';
  margin-left: 5px;
  opacity: 0.3;
  font-size: 9px;
}

.adm-sortable:hover {
  color: #aaa;
}

.adm-sortable.sorted-asc,
.adm-sortable.sorted-desc {
  color: #DE1833;
}

.adm-sortable.sorted-asc::after {
  content: '\2191';
  opacity: 1;
}

.adm-sortable.sorted-desc::after {
  content: '\2193';
  opacity: 1;
}

.adm-th-actions {
  text-align: right !important;
  width: 72px;
}

.adm-td-actions {
  text-align: right !important;
}

.adm-td-id {
  color: #555;
  font-size: 12px;
  font-weight: 600;
}

.adm-td-email {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-td-date {
  color: #777;
  font-size: 12px;
}

.adm-td-filename {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-td-size {
  white-space: nowrap;
}

.adm-td-visitor {
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-td-downloads {
  text-align: center;
}

.adm-td-flags {
  white-space: nowrap;
}

.adm-muted {
  color: #777;
}

.adm-empty {
  text-align: center !important;
  color: #555;
  padding: 40px 14px !important;
  font-size: 12px;
  letter-spacing: 0.5px;
}

/* User cell */
.adm-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.adm-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.adm-user-avatar svg {
  width: 28px;
  height: 28px;
}

.adm-user-name {
  font-weight: 600;
  font-size: 13px;
  color: #e0e0e0;
}

/* Role badge */
.adm-role {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.adm-role-admin {
  background: rgba(222, 24, 51, 0.12);
  color: #DE1833;
  border: 1px solid rgba(222, 24, 51, 0.3);
}

.adm-role-user {
  background: rgba(100, 150, 255, 0.1);
  color: #6496ff;
  border: 1px solid rgba(100, 150, 255, 0.25);
}

/* Flags */
.adm-flag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-right: 4px;
}

.adm-flag-e2e {
  background: rgba(222, 24, 51, 0.15);
  color: #DE1833;
}

.adm-flag-public {
  background: rgba(100, 150, 255, 0.15);
  color: #6496ff;
}

.adm-flag-pw {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

/* Storage cell */
.adm-storage-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 100px;
}

.adm-storage-mini {
  height: 4px;
  background: #1e1e1e;
  border-radius: 2px;
  overflow: hidden;
}

.adm-storage-mini-fill {
  height: 100%;
  background: #DE1833;
  border-radius: 2px;
}

.adm-storage-text {
  font-size: 11px;
  color: #777;
}

/* Visitor ID */
.adm-visitor {
  background: rgba(100, 100, 100, 0.15);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 10px;
  color: #888;
  word-break: break-all;
  white-space: normal;
}

/* Action buttons */
.adm-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.adm-btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  color: #888;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  text-decoration: none;
}

.adm-btn-sm:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #333;
  color: #e0e0e0;
}

.adm-btn-sm.adm-btn-danger:hover {
  background: rgba(222, 24, 51, 0.1);
  border-color: rgba(222, 24, 51, 0.4);
  color: #DE1833;
}

/* Pagination */
.adm-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
  justify-content: center;
}

.adm-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  color: #888;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.adm-page-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.04);
  border-color: #333;
  color: #e0e0e0;
}

.adm-page-btn.active {
  background: rgba(222, 24, 51, 0.1);
  border-color: rgba(222, 24, 51, 0.3);
  color: #DE1833;
}

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

.adm-page-dots {
  color: #555;
  font-size: 12px;
  padding: 0 4px;
}

.adm-page-info {
  font-size: 11px;
  color: #555;
  margin-left: 12px;
  letter-spacing: 0.3px;
}

/* Charts */
.adm-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.adm-chart-card {
  background: rgba(17, 17, 17, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 20px;
}

.adm-chart-card--hero {
  padding: 22px 22px 18px;
  background:
    radial-gradient(circle at top right, rgba(222, 24, 51, 0.14), transparent 38%),
    radial-gradient(circle at left center, rgba(100, 150, 255, 0.12), transparent 34%),
    rgba(17, 17, 17, 0.94);
}

.adm-chart-card--tall {
  min-height: 300px;
}

.adm-chart-card--span2 {
  grid-column: span 2;
}

.adm-chart-title {
  font-size: 13px;
  font-weight: 700;
  color: #d8d8d8;
  letter-spacing: 0.7px;
  line-height: 1.35;
}

.adm-chart-kicker {
  font-size: 10px;
  font-weight: 700;
  color: #6d7485;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}

.adm-stats-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.adm-stats-subtitle {
  margin-top: 6px;
  font-size: 11px;
  color: #666;
  letter-spacing: 0.5px;
  line-height: 1.5;
}

.adm-stats-window {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.adm-window-btn {
  background: #141414;
  border: 1px solid #2b2b2b;
  color: #8c93a4;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: 0.2s ease;
}

.adm-window-btn:hover,
.adm-window-btn.active {
  color: #fff;
  border-color: rgba(222, 24, 51, 0.45);
  background: rgba(222, 24, 51, 0.14);
  box-shadow: inset 0 0 0 1px rgba(222, 24, 51, 0.15);
}

.adm-stats-hero {
  margin-bottom: 14px;
}

.adm-stats-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.adm-chart-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  font-size: 10px;
  color: #7d8597;
  letter-spacing: 0.8px;
  text-align: right;
}

.adm-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.adm-stats-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.adm-chart-card canvas {
  width: 100% !important;
  height: 200px !important;
}

.adm-chart-card--hero canvas {
  height: 260px !important;
}

.adm-chart-card--tall canvas {
  height: 220px !important;
}

.adm-stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.adm-stats-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
  color: #777;
  letter-spacing: 0.7px;
}

.adm-stats-list-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.adm-stats-list-row strong {
  color: #f0f0f0;
  font-size: 12px;
  letter-spacing: 0.3px;
}

.adm-stats-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.adm-stats-minihead {
  font-size: 10px;
  color: #6d7485;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.adm-node-pills,
.adm-type-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.adm-node-pill,
.adm-type-pill {
  min-width: 120px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #161616;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #969dad;
}

.adm-node-pill strong,
.adm-type-pill strong {
  color: #fff;
}

.adm-node-pill--ok {
  border-color: rgba(74, 222, 128, 0.24);
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.07);
}

.adm-node-pill--syncing {
  border-color: rgba(245, 158, 11, 0.28);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.07);
}

.adm-node-pill--error {
  border-color: rgba(222, 24, 51, 0.32);
  box-shadow: inset 0 0 0 1px rgba(222, 24, 51, 0.08);
}

.adm-empty-inline {
  color: #666;
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* Settings */
.adm-settings-wrap {
  max-width: 680px;
}

.adm-settings-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.adm-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid #1e1e1e;
  gap: 24px;
}

.adm-setting-row:last-child {
  border-bottom: none;
}

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

.adm-setting-name {
  font-size: 13px;
  font-weight: 700;
  color: #e0e0e0;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.adm-setting-desc {
  font-size: 11px;
  color: #666;
  line-height: 1.5;
  letter-spacing: 0.3px;
}

.adm-setting-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.adm-setting-number {
  width: 80px;
  padding: 8px 10px;
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.2s;
}

.adm-setting-number:focus {
  outline: none;
  border-color: #DE1833;
}

.adm-setting-unit {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.5px;
}

.adm-settings-note {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(222, 24, 51, 0.05);
  border: 1px solid rgba(222, 24, 51, 0.15);
  border-radius: 8px;
  font-size: 11px;
  color: #888;
  letter-spacing: 0.3px;
  line-height: 1.5;
}

/* Toggle Switch */
.adm-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.adm-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.adm-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #333;
  border-radius: 24px;
  transition: background 0.25s ease;
}

.adm-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #888;
  border-radius: 50%;
  transition: transform 0.25s ease, background 0.25s ease;
}

.adm-toggle input:checked + .adm-toggle-slider {
  background: rgba(222, 24, 51, 0.3);
}

.adm-toggle input:checked + .adm-toggle-slider::before {
  transform: translateX(20px);
  background: #DE1833;
}

/* ─── Admin Notification Form ───────────────────────────────── */
.adm-notif-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.adm-notif-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.adm-notif-field-half {
  flex: 1;
  min-width: 0;
}

.adm-notif-row {
  display: flex;
  gap: 16px;
}

.adm-notif-label {
  font-size: 11px;
  font-weight: 600;
  color: #aaa;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.adm-notif-optional {
  font-weight: 400;
  color: #666;
}

.adm-notif-required {
  color: #DE1833;
}

.adm-notif-input {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 8px 12px;
  color: #ddd;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}

.adm-notif-input:focus {
  border-color: rgba(222, 24, 51, 0.4);
}

.adm-notif-input-sm {
  width: 80px;
  text-align: center;
}

.adm-notif-textarea {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 10px 12px;
  color: #ddd;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  min-height: 60px;
  transition: border-color 0.2s ease;
}

.adm-notif-textarea:focus {
  border-color: rgba(222, 24, 51, 0.4);
}

.adm-notif-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 8px 12px;
  color: #ddd;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.adm-notif-select option {
  background: #1a1a1a;
  color: #ddd;
}

.adm-notif-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.adm-notif-color-picker {
  width: 40px;
  height: 36px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: none;
  padding: 0;
}

.adm-notif-color-picker::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.adm-notif-color-picker::-webkit-color-swatch {
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
}

.adm-notif-color-hex {
  width: 100px;
  font-family: monospace;
  text-transform: uppercase;
}

.adm-notif-toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 36px;
}

.adm-notif-dismiss-seconds {
  display: flex;
  align-items: center;
  gap: 8px;
}

.adm-notif-unit {
  font-size: 11px;
  color: #888;
  letter-spacing: 0.3px;
}

.adm-notif-preview-wrap {
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 16px;
  background: rgba(0,0,0,0.2);
}

.adm-notif-actions {
  display: flex;
  gap: 10px;
  padding-top: 4px;
}

.adm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 20px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  font-family: inherit;
}

.adm-btn-primary {
  background: #DE1833;
  color: #fff;
}

.adm-btn-primary:hover {
  background: #c41530;
}

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

.adm-btn-secondary {
  background: rgba(255,255,255,0.06);
  color: #aaa;
  border: 1px solid rgba(255,255,255,0.1);
}

.adm-btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  color: #ddd;
}

.adm-btn.adm-btn-danger {
  background: rgba(222, 24, 51, 0.15);
  color: #DE1833;
  border: 1px solid rgba(222, 24, 51, 0.3);
}

.adm-btn.adm-btn-danger:hover {
  background: rgba(222, 24, 51, 0.28);
  color: #ff3352;
  border-color: rgba(222, 24, 51, 0.5);
}

.adm-btn-icon {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s ease, background 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.adm-btn-icon:hover {
  color: #ddd;
  background: rgba(255,255,255,0.06);
}

.adm-btn-danger:hover {
  color: #DE1833;
  background: rgba(222, 24, 51, 0.1);
}

.adm-actions-cell {
  display: flex;
  gap: 4px;
  align-items: center;
}

.adm-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.adm-badge-active {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.adm-badge-inactive {
  background: rgba(255,255,255,0.06);
  color: #666;
}

.adm-notif-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
}

#notifTable {
  table-layout: fixed;
}

#notifTable colgroup .notif-col-color   { width: 6%; }
#notifTable colgroup .notif-col-title   { width: 14%; }
#notifTable colgroup .notif-col-message { width: 30%; }
#notifTable colgroup .notif-col-trigger { width: 12%; }
#notifTable colgroup .notif-col-dismiss { width: 10%; }
#notifTable colgroup .notif-col-status  { width: 8%; }
#notifTable colgroup .notif-col-expires { width: 10%; }
#notifTable colgroup .notif-col-actions { width: 10%; }

.adm-notif-msg-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#notifTable td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-empty-state {
  text-align: center;
  padding: 32px 16px;
  color: #555;
  font-size: 12px;
  letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 900px) {
  .adm-layout {
    flex-direction: column;
    padding: 0 12px;
  }

  .adm-sidebar {
    width: 100%;
    padding: 16px 0 0;
    position: static;
    max-height: none;
  }

  .adm-sidebar-inner {
    position: static;
    padding-right: 0;
    border-right: none;
  }

  .adm-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .adm-nav-link {
    padding: 8px 12px;
    font-size: 11px;
    border-left: none;
  }

  .adm-main {
    padding: 20px 0 40px 0;
  }

  .adm-stats-grid,
  .adm-hero-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .adm-info-row {
    grid-template-columns: 1fr;
  }

  .adm-storage-header {
    flex-direction: column;
    gap: 8px;
  }

  .adm-storage-headline {
    align-items: flex-start;
  }

  .adm-card-row {
    grid-template-columns: 1fr;
  }

  .adm-charts-grid {
    grid-template-columns: 1fr;
  }

  .adm-stats-topbar,
  .adm-stats-card-head,
  .adm-stats-split {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .adm-stats-grid,
  .adm-stats-details {
    grid-template-columns: 1fr;
  }

  .adm-chart-card--span2 {
    grid-column: span 1;
  }

  .adm-chart-meta {
    align-items: flex-start;
    text-align: left;
  }

  .adm-node-pill,
  .adm-type-pill {
    width: 100%;
  }

  .adm-tab-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .adm-search {
    width: 100%;
  }

  .adm-quick-strip {
    flex-direction: column;
  }

  .adm-qaction {
    justify-content: center;
  }

  .adm-notif-row {
    flex-direction: column;
  }
}

/* Flash Messages */
/* Dashboard flash messages — inherit unified toast positioning */
.mega-dashboard .flash-messages {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  max-width: 500px;
  width: 100%;
  padding: 0 16px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mega-dashboard .flash-message {
  position: relative;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #E8304A;
  color: #fff;
  padding: 14px 36px 14px 24px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: toastSlideDown 0.3s ease;
  width: fit-content;
  max-width: 100%;
}

.flash-dismiss {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.flash-dismiss:hover {
  color: #fff;
}

/* ── Unified E2EE Prompt Overlay ────────────────────────── */
/* Used across dashboard, notes, temp-preview, e2e-download */

.e2ee-prompt-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
}

.e2ee-prompt-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 3, 0.82);
  backdrop-filter: blur(24px) saturate(0.5);
  -webkit-backdrop-filter: blur(24px) saturate(0.5);
  animation: e2eePromptBackdropIn 0.4s ease both;
}

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

.e2ee-prompt-card {
  position: relative;
  background: rgba(12, 12, 12, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 36px 36px 32px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.02),
    0 24px 80px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(222, 24, 51, 0.04);
  animation: e2eePromptCardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both,
             e2eePromptGlow 6s ease-in-out 0.5s infinite;
}

@keyframes e2eePromptCardIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes e2eePromptGlow {
  0%, 100% {
    border-color: rgba(255, 255, 255, 0.04);
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.02),
      0 24px 80px rgba(0, 0, 0, 0.6),
      0 0 60px rgba(222, 24, 51, 0.03);
  }
  50% {
    border-color: rgba(222, 24, 51, 0.12);
    box-shadow:
      0 0 0 1px rgba(222, 24, 51, 0.06),
      0 24px 80px rgba(0, 0, 0, 0.6),
      0 0 80px rgba(222, 24, 51, 0.06);
  }
}

.e2ee-prompt-dismiss {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: #444;
  font-size: 22px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.25s ease, color 0.25s ease;
}

.e2ee-prompt-dismiss:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #888;
}

.e2ee-prompt-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
  animation: e2eePromptIconIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

@keyframes e2eePromptIconIn {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

.e2ee-prompt-icon svg {
  width: 38px;
  height: 38px;
  stroke: #DE1833;
  filter: drop-shadow(0 0 16px rgba(222, 24, 51, 0.25));
}

.e2ee-prompt-divider {
  width: 36px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(222, 24, 51, 0.5), transparent);
  margin: 0 auto 18px;
  animation: e2eePromptDividerIn 0.8s ease 0.3s both;
}

@keyframes e2eePromptDividerIn {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}

.e2ee-prompt-greeting {
  font-size: 10px;
  font-weight: 500;
  color: #888;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}

.e2ee-prompt-title {
  font-size: 15px;
  font-weight: 700;
  color: #e8e8e8;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.e2ee-prompt-desc {
  font-size: 11px;
  color: #8a8a8a;
  line-height: 1.6;
  letter-spacing: 0.4px;
  margin-bottom: 20px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.e2ee-prompt-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  width: 100%;
}

.e2ee-prompt-input-wrap {
  width: 100%;
  position: relative;
}

.e2ee-prompt-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 16px;
  color: #e0e0e0;
  font-size: 14px;
  font-family: inherit;
  text-align: center;
  letter-spacing: 1px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  outline: none;
  box-sizing: border-box;
}

.e2ee-prompt-input:focus {
  border-color: rgba(222, 24, 51, 0.3);
  box-shadow: 0 0 0 3px rgba(222, 24, 51, 0.06);
  background: rgba(0, 0, 0, 0.55);
}

.e2ee-prompt-input::placeholder {
  color: #444;
  letter-spacing: 1.5px;
  font-size: 12px;
  transition: opacity 0.15s ease;
}

.e2ee-prompt-input:focus::placeholder {
  opacity: 0;
}

.e2ee-prompt-input.e2ee-prompt-input-error {
  border-color: rgba(222, 24, 51, 0.6);
  box-shadow: 0 0 0 3px rgba(222, 24, 51, 0.1);
  animation: e2eePromptShake 0.4s ease;
}

@keyframes e2eePromptShake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(5px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(2px); }
}

.e2ee-prompt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #DE1833 0%, #a0102a 100%);
  color: #fff;
  border: 1px solid rgba(255, 80, 110, 0.1);
  border-radius: 10px;
  padding: 11px 32px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 1px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(222, 24, 51, 0.2);
}

/* Shimmer sweep on button */
.e2ee-prompt-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(255, 255, 255, 0.06) 40%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.06) 60%,
    transparent 80%
  );
  animation: e2eePromptShimmer 5s ease-in-out infinite;
}

@keyframes e2eePromptShimmer {
  0%   { left: -100%; opacity: 0; }
  15%  { opacity: 1; }
  100% { left: 200%; opacity: 0; }
}

.e2ee-prompt-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(222, 24, 51, 0.3);
  border-color: rgba(255, 80, 110, 0.2);
  background: linear-gradient(135deg, #e52040 0%, #c41530 100%);
}

.e2ee-prompt-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.e2ee-prompt-btn:disabled::before {
  animation: none;
}

.e2ee-prompt-btn svg {
  opacity: 0.8;
}

/* Reduced motion */
/* Responsive */
/* MEGA.NZ Style Dashboard */
.mega-dashboard {
  display: flex;
  flex: 1;
  background: #0a0a0a;
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  min-height: 0;
}

/* SPA Page Content Container — holds injected page content when navigating
   away from files view while music player is active */
.spa-page-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: #0a0a0a;
  position: relative;
}

/* When SPA page is active, hide dashboard-specific UI */
.mega-dashboard.spa-active > .mega-sidebar,
.mega-dashboard.spa-active > .sidebar-backdrop,
.mega-dashboard.spa-active > .mega-main {
  display: none !important;
}

.mega-dashboard.spa-active > .spa-page-content {
  display: flex;
  flex-direction: column;
}

/* Wrapper that mimics base.html <main> layout inside SPA container */
.spa-page-content .spa-inner-main {
  flex: 1;
  padding: 20px 20px;
}

/* (Space background SPA variant removed — pages now use body #0a0a0a) */

.spa-page-content .spa-inner-main .container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Notes app inside SPA: fill the container instead of using viewport calc */
.spa-page-content:has(.notes-app) {
  overflow: hidden;
  padding-bottom: 0 !important;
}
.spa-page-content .spa-inner-main:has(.notes-app) {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.spa-page-content .notes-app {
  height: auto;
  flex: 1;
  min-height: 0;
}

/* Adjust sticky sidebars inside SPA pages — no base.html header present,
   so reduce the top offset from the normal 80px to 20px */
.spa-page-content .docs-sidebar,
.spa-page-content .account-sidebar {
  top: 20px;
  max-height: calc(100vh - 40px);
}

/* Offset SPA page content when music player is visible */
body.music-player-active .spa-page-content {
  padding-bottom: 120px;
}

/* Sidebar-aware music player positioning on desktop (full-width bottom bar) */
@media (min-width: 851px) {
  body:has(.mega-sidebar:not(.collapsed)) .music-player { left: 260px; }
  body:has(.mega-sidebar.collapsed) .music-player { left: 40px; }
  body:has(.music-sidebar) .music-player { left: 260px; }
  /* Notes page: sidebar (260px) + list panel (280px) with all collapse combos */
  body:has(.notes-sidebar:not(.collapsed)):has(.notes-list-panel:not(.collapsed)) .music-player { left: 540px; }
  body:has(.notes-sidebar.collapsed):has(.notes-list-panel:not(.collapsed)) .music-player { left: 320px; }
  body:has(.notes-sidebar:not(.collapsed)):has(.notes-list-panel.collapsed) .music-player { left: 300px; }
  body:has(.notes-sidebar.collapsed):has(.notes-list-panel.collapsed) .music-player { left: 80px; }
}
/* Notes page at narrower desktop (851-1100px): sidebar=220px, list=240px */
@media (min-width: 851px) and (max-width: 1100px) {
  body:has(.notes-sidebar:not(.collapsed)):has(.notes-list-panel:not(.collapsed)) .music-player { left: 460px; }
  body:has(.notes-sidebar.collapsed):has(.notes-list-panel:not(.collapsed)) .music-player { left: 280px; }
  body:has(.notes-sidebar:not(.collapsed)):has(.notes-list-panel.collapsed) .music-player { left: 260px; }
  body:has(.notes-sidebar.collapsed):has(.notes-list-panel.collapsed) .music-player { left: 80px; }
}

/* Sidebar */
.mega-sidebar {
  width: 260px;
  min-width: 260px;
  background: #111;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  padding: 0;
  transition: width 0.2s ease, min-width 0.2s ease;
  position: relative;
}

.sidebar-header {
  padding: 2px 12px 2px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  min-height: 38px;
}

.sidebar-header h2 {
  font-size: 11px;
  color: #555;
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #888;
  text-decoration: none;
  transition: background 0.2s ease, border-left-color 0.2s ease, color 0.2s ease;
  border-left: 3px solid transparent;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #e0e0e0;
}

.sidebar-item.active {
  background: rgba(255, 255, 255, 0.05);
  color: #e0e0e0;
  border-left-color: #e0e0e0;
}

.sidebar-icon {
  font-size: 20px;
}

.sidebar-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.sidebar-storage {
  padding: 13px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.storage-label {
  font-size: 10px;
  color: #555;
  margin-bottom: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.storage-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.storage-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #DE1833, #E8304A);
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(222, 24, 51, 0.3);
}

.storage-text {
  font-size: 11px;
  color: #555;
  font-weight: 500;
  text-transform: uppercase;
}

/* ─── Sidebar Collapse Toggle ────────────────────────────────────── */

.sidebar-collapse-toggle {
  background: none;
  border: none;
  color: #444;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  border-radius: 4px;
  transition: color 0.15s ease, transform 0.2s ease;
}

.sidebar-collapse-toggle:hover {
  color: #aaa;
}

/* ─── Sidebar Collapsed Vertical Label ───────────────────────────── */

.sidebar-collapsed-label {
  position: absolute;
  top: 38px;
  left: 0;
  width: 40px;
  bottom: 0;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  color: #444;
  user-select: none;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 1;
}

.sidebar-collapsed-label:hover {
  color: #888;
}

/* ─── Collapsed Sidebar State ────────────────────────────────────── */

.mega-sidebar.collapsed {
  width: 40px;
  min-width: 40px;
}

.mega-sidebar.collapsed .sidebar-collapsed-label {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.2s ease 0.1s;
}

.mega-sidebar.collapsed .sidebar-header {
  padding: 0;
  justify-content: center;
}

.mega-sidebar.collapsed .sidebar-header h2 {
  display: none;
}

.mega-sidebar.collapsed .sidebar-collapse-toggle {
  transform: rotate(180deg);
}

.mega-sidebar.collapsed .folder-tree,
.mega-sidebar.collapsed .sidebar-trash-item,
.mega-sidebar.collapsed .sidebar-storage {
  display: none;
}

/* Main Content Area */
.mega-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.files-ascii-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
}

.mega-main::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 4, 0);
  pointer-events: none;
  z-index: 1;
  transition: background 0.22s ease;
}

.mega-main > *:not(.files-ascii-canvas):not(.files-bg-controls):not(.mega-dropzone) {
  position: relative;
  z-index: 2;
}

.mega-main.files-ascii-active::after {
  background: rgba(4, 4, 4, 0.42);
}

.mega-main.files-ascii-active .mega-browser {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.mega-main.files-ascii-active .browser-header {
  background: #111;
  border-bottom-color: #222;
}

.mega-main.files-ascii-active .browser-row {
  background: #0a0a0a;
  border-bottom-color: #1a1a1a;
}

.mega-main.files-ascii-active .browser-row:hover {
  background: #141414;
}

.mega-main.files-ascii-active .tile-item {
  background: #111;
  border-color: #1e1e1e;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.mega-main.files-ascii-active .tile-thumb {
  background: #0d0d0d;
}

.mega-main.files-ascii-active .browser-empty {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 0;
  margin: 18px;
}

.files-bg-controls {
  position: fixed;
  right: 8px;
  bottom: 8px;
  width: auto;
  min-height: 36px;
  z-index: 12;
  pointer-events: none;
}

.files-bg-panel,
.files-bg-fab {
  pointer-events: auto;
}

.files-bg-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(240px, calc(100vw - 16px));
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(15, 15, 16, 0.94) 0%, rgba(8, 8, 9, 0.94) 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.files-bg-fab {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  height: 36px;
  padding: 0 10px 0 8px;
  border-radius: 10px;
}

.files-bg-controls-collapsed .files-bg-panel {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;
}

.files-bg-controls:not(.files-bg-controls-collapsed) .files-bg-fab {
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  pointer-events: none;
}

.files-bg-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.files-bg-panel-kicker {
  font-size: 8px;
  letter-spacing: 0.22em;
  color: #7f7f83;
  font-weight: 700;
}

.files-bg-panel-title {
  margin-top: 4px;
  font-size: 18px;
  color: #f5f5f5;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.05;
}

.files-bg-panel-sub {
  margin-top: 4px;
  font-size: 8px;
  letter-spacing: 0.18em;
  color: #626266;
}

.files-bg-panel-status-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.files-bg-panel-status-label {
  font-size: 8px;
  letter-spacing: 0.2em;
  color: #7a7a7f;
  font-weight: 700;
}

.files-bg-panel-status-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.04);
  color: #a8a8a8;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.files-bg-panel-status-value.is-active {
  border-color: rgba(222, 24, 51, 0.28);
  background: rgba(222, 24, 51, 0.14);
  color: #ffbac5;
}

.files-bg-collapse-btn,
.files-bg-fab,
.files-bg-enable-btn,
.files-bg-theme-trigger,
.files-bg-cycle-btn {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
  color: #d8d8d8;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.files-bg-collapse-btn:hover,
.files-bg-fab:hover,
.files-bg-enable-btn:hover,
.files-bg-theme-trigger:hover,
.files-bg-cycle-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.files-bg-collapse-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.files-bg-collapse-btn svg,
.files-bg-fab svg {
  width: 13px;
  height: 13px;
}

.files-bg-fab-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.files-bg-fab-icon svg {
  width: 13px;
  height: 13px;
}

.files-bg-fab-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  gap: 2px;
}

.files-bg-fab-label {
  font-size: 8px;
  letter-spacing: 0.2em;
  color: #7d7d82;
  font-weight: 700;
}

.files-bg-fab-state {
  max-width: 58px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: #f0f0f0;
  font-weight: 700;
}

.files-bg-fab.is-active {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
}

.files-bg-fab.is-active .files-bg-fab-icon {
  background: rgba(222, 24, 51, 0.12);
  border-color: rgba(222, 24, 51, 0.14);
  color: #ffb6c1;
}

.files-bg-fab.is-active .files-bg-fab-state {
  color: #fff0f2;
}

.files-bg-enable-btn {
  width: 100%;
  margin-top: 12px;
  min-height: 36px;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.files-bg-enable-btn.is-active {
  background: linear-gradient(180deg, rgba(58, 12, 18, 0.96) 0%, rgba(42, 8, 12, 0.96) 100%);
  border-color: rgba(222, 24, 51, 0.22);
  color: #ffe8ec;
}

.files-bg-theme-picker {
  position: relative;
  margin-top: 10px;
}

.files-bg-theme-trigger,
.files-bg-theme-item {
  width: 100%;
  border-radius: 11px;
  padding: 10px 11px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: left;
}

.files-bg-theme-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
}

.files-bg-theme-trigger svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: #9f9fa5;
}

.files-bg-theme-trigger-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.files-bg-theme-trigger-kicker {
  font-size: 7px;
  letter-spacing: 0.22em;
  color: #707076;
}

.files-bg-theme-trigger-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #efeff1;
}

.files-bg-theme-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(15, 15, 16, 0.98) 0%, rgba(8, 8, 9, 0.98) 100%);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.32);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.files-bg-theme-picker.files-bg-theme-picker-open .files-bg-theme-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.files-bg-theme-group + .files-bg-theme-group {
  margin-top: 12px;
}

.files-bg-theme-group-label {
  padding: 2px 2px 6px;
  color: #727277;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.files-bg-theme-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.files-bg-theme-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  color: #d7d7da;
  cursor: pointer;
  white-space: nowrap;
  min-height: 36px;
}

.files-bg-theme-item:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.files-bg-theme-item.files-bg-theme-item-active {
  background: linear-gradient(180deg, rgba(52, 12, 17, 0.9) 0%, rgba(33, 8, 11, 0.9) 100%);
  border-color: rgba(222, 24, 51, 0.22);
  color: #ffe6ea;
  box-shadow: 0 0 14px rgba(var(--files-bg-glow-rgb), 0.08);
}

.files-bg-theme-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.files-bg-theme-item.files-bg-theme-item-active .files-bg-theme-dot {
  box-shadow: 0 0 8px 2px var(--files-bg-dot-glow);
}

.files-bg-theme-item-copy {
  min-width: 0;
}

.files-bg-theme-item-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  letter-spacing: 0.16em;
}

.files-bg-theme-item-mark {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  justify-self: end;
}

.files-bg-theme-item.files-bg-theme-item-active .files-bg-theme-item-mark {
  border-color: rgba(255, 212, 218, 0.22);
  background: #de1833;
  box-shadow: 0 0 0 3px rgba(222, 24, 51, 0.15);
}

.files-bg-theme-menu::-webkit-scrollbar {
  width: 6px;
}

.files-bg-theme-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.files-bg-theme-menu::-webkit-scrollbar-track {
  background: transparent;
}

.files-bg-theme-menu {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

/* z-index for .files-bg-fab is set above with its position rule */

@media (max-width: 850px) {
  .mega-main.files-ascii-active::after {
    background: rgba(4, 4, 4, 0.22);
  }

  .mega-main.files-ascii-active .mega-browser {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .mega-main.files-ascii-active .tile-item {
    background: #111;
    border-color: #1e1e1e;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .mega-main.files-ascii-active .tile-thumb {
    background: #0d0d0d;
  }

  .mega-main.files-ascii-active .browser-empty {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .files-bg-controls {
    bottom: calc(8px + env(safe-area-inset-bottom));
  }
}

/* Top Bar */
.mega-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 20px;
  background: #111;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  height: 38px;
  box-sizing: border-box;
}

.topbar-title {
  font-size: 20px;
  color: #e0e0e0;
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.topbar-header-container {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}


.topbar-right {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

.btn-new-folder,
.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-new-folder svg,
.btn-upload svg {
  opacity: 0.75;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.btn-new-folder:hover,
.btn-upload:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-new-folder:hover svg,
.btn-upload:hover svg {
  opacity: 1;
}

.btn-new-folder:active,
.btn-upload:active {
  transform: translateY(0);
  box-shadow: none;
  background: rgba(255, 255, 255, 0.08);
}

.btn-browse-download {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  background: rgba(96, 165, 250, 0.10);
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 8px;
  color: #60a5fa;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.btn-browse-download svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.btn-browse-download:hover {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.4);
  color: #93bbfd;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.15);
}

.btn-browse-download:hover svg {
  opacity: 1;
}

.btn-browse-download:active {
  transform: translateY(0);
  box-shadow: none;
  background: rgba(96, 165, 250, 0.12);
}

.btn-icon-new-folder {
  display: none;
}

.btn-upload-large {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 20px;
}

.btn-upload-large svg {
  opacity: 0.75;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.btn-upload-large:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-upload-large:hover svg {
  opacity: 1;
}

.btn-upload-large:active {
  transform: translateY(0);
  box-shadow: none;
  background: rgba(255, 255, 255, 0.08);
}

/* Drop Zone Overlay */
.mega-dropzone {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 20, 20, 0.95);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.mega-dropzone.visible {
  display: flex;
}

.mega-dropzone.uploading {
  background: rgba(10, 10, 10, 0.95);
}

.mega-dropzone-content {
  text-align: center;
}

.dropzone-icon {
  display: block;
  margin-bottom: 20px;
  line-height: 1;
}

.dropzone-text {
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

/* File Browser */
.mega-browser {
  flex: 1;
  flex-basis: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: #0a0a0a;
  min-height: 0;
}

/* Hide server-rendered content until JS client-render completes.
   Prevents flash of wrong view mode (list -> grid) and flash of
   encrypted placeholder filenames (encrypted_*.ext -> real names). */
.mega-browser.loading > * {
  visibility: hidden;
}

.browser-header {
  display: grid;
  grid-template-columns: 36px 1fr auto 40px 120px 150px 130px;
  gap: 20px;
  padding: 2px 30px;
  background: #111;
  border-bottom: 1px solid #222;
  font-size: 12px;
  color: #666;
  font-weight: 600;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.browser-header .browser-col {
  color: #666;
  font-size: 12px;
}

.sort-header {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.sort-header:hover {
  color: #aaa;
}

.sort-header.sort-active {
  color: #ffffff;
}

.sort-arrow {
  font-size: 10px;
  margin-left: 2px;
  vertical-align: middle;
}

.browser-files {
  padding: 0;
}

.browser-row {
  display: grid;
  grid-template-columns: 36px 1fr auto 40px 120px 150px 130px;
  gap: 20px;
  padding: 7px 30px;
  background: #0a0a0a;
  border-bottom: 1px solid #1a1a1a;
  transition: background 0.2s ease;
  cursor: pointer;
  position: relative;
}

.browser-row {
  -webkit-tap-highlight-color: transparent;
}

.browser-row:hover {
  background: #141414;
  z-index: 2;
}

.file-row {
  cursor: pointer !important;
}

.file-row:hover {
  cursor: pointer !important;
}

.file-row * {
  cursor: pointer !important;
}

.browser-col {
  display: flex;
  align-items: center;
  color: #e0e0e0;
  font-size: 14px;
}

.col-name {
  gap: 12px;
  min-width: 0;
  overflow: visible;
}

.file-icon-small {
  font-size: 30px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8a8a8a;
  width: 42px;
  height: 42px;
}

.file-icon-small svg {
  width: 42px;
  height: 42px;
  stroke-width: 0.5;
}

.file-icon-preview {
  cursor: pointer;
  border-radius: 6px;
  padding: 4px;
  transition: background-color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-icon-preview:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* SVG music note icon for audio files — matches music player art style */
.audio-note-icon {
  color: #DE1833;
}

.file-icon-small .audio-note-icon {
  width: 30px;
  height: 30px;
  vertical-align: middle;
}

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

.file-name-base {
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.file-name-ext {
  flex-shrink: 0;
  color: #888;
}

.col-size,
.col-date {
  color: #888;
  font-size: 13px;
}

.col-actions {
  gap: 4px;
  justify-content: flex-end;
}

.col-check {
  width: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.col-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #DE1833;
}

.col-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}

.col-browsable {
  display: none;
}

.col-encryption {
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
  font-size: 16px;
  color: #707070;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  padding: 0;
}

/* Reveal/brighten all row actions when the row itself is hovered, so the
   available actions are discoverable without hunting icon-by-icon. */
.browser-row:hover .action-btn,
.file-row:hover .action-btn {
  color: #9a9a9a;
}

.action-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.action-btn:hover {
  color: #e0e0e0;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.action-btn.action-download:hover {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.08);
  border-color: rgba(96, 165, 250, 0.2);
}

.action-btn.action-manage:hover {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.2);
}

.action-btn.action-delete:hover {
  color: #ff2244;
  background: rgba(222, 24, 51, 0.08);
  border-color: rgba(222, 24, 51, 0.2);
}

.action-btn.action-restore:hover {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.2);
}

.action-btn.action-permdelete:hover {
  color: #ff2244;
  background: rgba(222, 24, 51, 0.08);
  border-color: rgba(222, 24, 51, 0.2);
}

.action-btn.action-copy:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.2);
}

/* Empty State */
.browser-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 60px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 80px;
  margin-bottom: 20px;
}
.empty-icon svg {
  width: 80px;
  height: 80px;
}

.browser-empty h3 {
  font-size: 20px;
  color: #e0e0e0;
  margin-bottom: 10px;
}

.browser-empty p {
  font-size: 14px;
  color: #888;
}

/* Pre-collapse responsive: sidebar still visible (260px), reduce table columns */
@media (max-width: 1100px) {
  .browser-header,
  .browser-row {
    grid-template-columns: 36px 1fr 40px 100px 130px 110px;
    gap: 12px;
    padding: 8px 20px;
  }
  .browser-header {
    padding: 2px 20px;
  }

  .col-tags {
    display: none;
  }
  .temp-browser-header,
  .temp-browser-row {
    grid-template-columns: 1fr 40px 100px 130px 110px;
    gap: 12px;
    padding: 2px 10px;
  }

  .temp-browser .col-tags {
    display: none;
  }
}


/* Responsive for Mega Dashboard -- sidebar collapses to drawer */
@media (max-width: 850px) {
  .mega-dashboard {
    flex-direction: column;
    flex: none;
    height: calc(var(--app-h, 100svh) - var(--dashboard-header-h, 0px));
  }
  
  .mega-sidebar {
    width: 100%;
    min-width: auto;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  
  .sidebar-nav {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
  }
  
  .sidebar-item {
    flex-shrink: 0;
  }
  
  /* Sidebar now drawer; full width. 5 visible: check, name, enc, size, actions */
  .browser-header,
  .browser-row {
    grid-template-columns: 36px 1fr 40px 80px 110px;
    padding: 8px 15px;
    gap: 10px;
  }
  .browser-header {
    padding: 2px 15px;
  }

  .browser-files {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }
  
  .mega-topbar {
    padding: 15px 20px;
  }
  
  .upload-progress-toast {
    width: calc(100% - 40px);
    bottom: 10px;
    right: 20px;
    left: 20px;
  }
  
  .upload-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .upload-stats .upload-stat,
  .upload-stats .upload-stat:nth-child(2),
  .upload-stats .upload-stat:last-child {
    text-align: left;
  }
  .sidebar-toggle {
    display: flex;
  }

  .mega-dashboard {
    flex-direction: column;
  }

  .mega-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    min-width: 280px;
    height: 100%;
    z-index: 200;
    background: #111;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    flex-direction: column;
    display: flex;
    padding-top: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

  /* Sidebar "MY CLOUD" row matches the header bar height.
     Header = 8px pad + 40px nav-toggle (tallest child) + 8px pad + 1px border = 57px.
     border-box means min-height includes this element's own 1px border-bottom. */
  .mega-sidebar .sidebar-header {
    min-height: 57px;
    padding: 2px 20px;
  }

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

  /* On mobile the sidebar is a drawer -- disable collapse toggle and collapsed state */
  .sidebar-collapse-toggle,
  .sidebar-collapsed-label {
    display: none !important;
  }

  .mega-sidebar.collapsed {
    width: 280px;
    min-width: 280px;
  }

  .mega-sidebar.collapsed .sidebar-header {
    padding: 2px 20px;
    justify-content: flex-start;
  }

  .mega-sidebar.collapsed .sidebar-header h2 {
    display: block;
  }

  .mega-sidebar.collapsed .folder-tree,
  .mega-sidebar.collapsed .sidebar-trash-item,
  .mega-sidebar.collapsed .sidebar-storage {
    display: block;
  }

  .mega-main {
    width: 100%;
    min-width: 0;
  }

  body.sidebar-open {
    overflow: hidden;
  }
  .mega-topbar {
    flex-wrap: wrap;
    gap: 0;
    padding: 4px 12px 4px;
    align-items: center;
    height: auto;
    min-height: 0;
  }

  /* Row 1: sidebar toggle + action buttons pushed right */
  .sidebar-toggle {
    order: 0;
  }

  /* Files view: sidebar toggle pushes buttons to far right (breadcrumb is on row 2) */
  .topbar-has-breadcrumb .sidebar-toggle {
    margin-right: auto;
  }

  .topbar-right {
    order: 1;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
  }

  /* Trash view: title stays inline on row 1 */
  .topbar-left {
    order: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    margin-left: 10px;
  }

  /* Files view: breadcrumb drops to its own full-width row 2 */
  .topbar-has-breadcrumb .topbar-left {
    order: 2;
    flex: none;
    width: 100%;
    margin-top: 4px;
    margin-left: 0;
  }

  .topbar-has-breadcrumb .topbar-header-container {
    width: 100%;
  }

  /* ── Breadcrumb / File Path row ── */
  .mega-topbar .breadcrumb-path {
    flex-wrap: nowrap;
    overflow: hidden;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 3px 10px;
    font-size: 16px;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
  }

  .breadcrumb-path-segment {
    font-size: 16px;
    gap: 5px;
  }

  .breadcrumb-path-item {
    font-size: 16px;
    white-space: nowrap;
    color: #555;
    letter-spacing: 0.2px;
  }

  .breadcrumb-path-current {
    color: #e0e0e0;
  }

  .breadcrumb-path-sep {
    font-size: 15px;
    color: #333;
    flex-shrink: 0;
  }

  .breadcrumb-folder-icon {
    width: 18px;
    height: 18px;
  }

  .breadcrumb-trash-icon {
    width: 18px;
    height: 18px;
  }
  /* Music player position handled by mini bar styles below */
  


}


/* User Menu Dropdown */
/* ── User Menu & Dropdown ──────────────────────────────────────────── */

.user-menu {
  position: relative;
}

.user-menu-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50px;
  color: #b0b0b0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.user-menu-button:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: #222;
  color: #e0e0e0;
}

.user-avatar-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  letter-spacing: 0.5px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-arrow {
  transition: transform 0.25s ease;
  margin-left: 2px;
  opacity: 0.5;
  flex-shrink: 0;
}

.user-menu-button:hover .user-arrow {
  opacity: 0.8;
}

.user-menu-button.active .user-arrow {
  transform: rotate(180deg);
  opacity: 0.8;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: #141414;
  border: 1px solid #1e1e1e;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.03);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.98);
  transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1), transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  overflow: hidden;
}

.user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
}

.dropdown-user-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.dropdown-user-details {
  flex: 1;
  min-width: 0;
}

.dropdown-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-role {
  font-size: 10px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 2px;
}

.dropdown-divider {
  height: 1px;
  background: #1e1e1e;
  margin: 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 14px;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  font-family: inherit;
   color: #888;
   text-decoration: none;
   font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease;
  cursor: pointer;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #e0e0e0;
}

.dropdown-item-logout:hover {
  background: rgba(222, 24, 51, 0.06);
  color: #DE1833;
}

.dropdown-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.12s ease;
}

.dropdown-item:hover .dropdown-icon {
  opacity: 1;
}

.dropdown-label {
  flex: 1;
}

/* Full width dashboard - no padding from main */
body:has(.mega-dashboard) .main {
  padding: 0;
  overflow: hidden;
}

body:has(.mega-dashboard) .container {
  max-width: 100%;
  padding: 0;
  margin: 0;
}

/* Lock dashboard pages to viewport height so only the file browser scrolls.
   The sidebar and topbar stay fixed in place while browsing long file lists.
   Progressive enhancement: 100vh -> 100svh -> JS var(--app-h).
   100dvh is intentionally avoided because on some mobile browsers (Brave/Android)
   it reports the large-viewport size while the browser bottom bar is visible,
   causing the last row of file tiles to be clipped. */
html:has(body .mega-dashboard) {
  height: 100vh;
  height: 100svh;
  height: var(--app-h, 100svh);
  overflow: hidden;
}

body:has(.mega-dashboard) {
  height: 100vh;
  height: 100svh;
  height: var(--app-h, 100svh);
  overflow: hidden;
}
/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px) saturate(0.5);
  -webkit-backdrop-filter: blur(20px) saturate(0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  animation: modalOverlayIn 0.25s ease;
}

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

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

.modal-content {
  background: #111111;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  min-width: 420px;
  max-width: 480px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  animation: modalSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
}

.modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #f0f0f0;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h3 .modal-icon {
  width: 18px;
  height: 18px;
  color: #DE1833;
  flex-shrink: 0;
}

.modal-close {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 18px;
  color: #666;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.modal-close:hover {
  background: rgba(222, 24, 51, 0.12);
  border-color: rgba(222, 24, 51, 0.2);
  color: #DE1833;
}

.modal-body {
  padding: 24px;
}

.modal-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #f0f0f0;
  font-size: 14px;
  font-weight: 450;
  letter-spacing: 0.2px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.modal-input::placeholder {
  color: #555;
  font-weight: 400;
}

.modal-input:focus {
  outline: none;
  border-color: rgba(222, 24, 51, 0.4);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(222, 24, 51, 0.08);
}

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(0, 0, 0, 0.15);
}

.btn-secondary {
  padding: 9px 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #b0b0b0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #e0e0e0;
}

.btn-primary-small {
  padding: 9px 22px;
  background: #DE1833;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary-small:hover {
  background: #E8304A;
  box-shadow: 0 4px 16px rgba(222, 24, 51, 0.25);
}

/* Upload Progress Toast (Bottom) */
.upload-progress-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 460px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
  z-index: 2000;
  animation: slideUp 0.3s ease;
}

/* Lift bottom-anchored progress toasts above the persistent music bar
   so they never overlap the player controls (AUDIT S9). */
body.music-player-active .upload-progress-toast {
  bottom: 92px;
}

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

.upload-toast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #2a2a2a;
}

.upload-toast-title {
  font-size: 13px;
  font-weight: 700;
  color: #e0e0e0;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.upload-toast-close {
  background: none;
  border: none;
  color: #666;
  font-size: 24px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease, color 0.2s ease;
  line-height: 1;
}

.upload-toast-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e0e0e0;
}

.upload-toast-body {
  padding: 16px 20px;
}

.upload-progress-bar {
  width: 100%;
  height: 6px;
  background: #222;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #DE1833, #E8304A);
  transition: width 0.3s ease;
}

.upload-stats {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0;
}

.upload-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 0 4px;
}

.upload-stat:first-child {
  text-align: left;
}

.upload-stat:nth-child(2) {
  text-align: center;
}

.upload-stat:last-child {
  text-align: right;
}

.upload-stat-label {
  font-size: 10px;
  color: #666;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.upload-stat-value {
  font-size: 13px;
  color: #e0e0e0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.upload-progress-text {
  font-size: 13px;
  color: #888;
}

.upload-filename {
  margin-top: 10px;
  font-size: 12px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-height: 16px;
}

/* Breadcrumb Path */
.breadcrumb-path {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  min-width: 0;
  flex-wrap: nowrap;
  padding: 0;
  overflow: hidden;
  -webkit-user-drag: none;
  user-select: none;
}

.breadcrumb-path * {
  -webkit-user-drag: none;
}

/* Ellipsis shown when middle breadcrumb segments are collapsed */
.breadcrumb-path-ellipsis {
  color: #555;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  flex-shrink: 0;
  user-select: none;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, opacity 0.1s ease;
}

.breadcrumb-path-ellipsis.bc-ellipsis-nav {
  cursor: pointer;
}

.breadcrumb-path-ellipsis.bc-ellipsis-nav:hover {
  color: #aaa;
}

.breadcrumb-path-ellipsis.bc-ellipsis-nav:active {
  opacity: 0.5;
}

/* Each breadcrumb segment: icon + text side by side */
.breadcrumb-path-segment {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  text-decoration: none;
  color: #8a8a8a;
  transition: color 0.15s ease, opacity 0.1s ease;
  white-space: nowrap;
  letter-spacing: 0.3px;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

.breadcrumb-path-segment:active {
  opacity: 0.5;
}

/* When the breadcrumb container is in truncate mode (all middle segments already
   collapsed but path still overflows), allow both root and current segments to
   shrink and show text-overflow ellipsis on their label spans. */
.breadcrumb-path.bc-truncate .breadcrumb-path-segment {
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}

.breadcrumb-path.bc-truncate .breadcrumb-path-segment > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 20px;
}

.breadcrumb-path-segment:hover {
  color: #aaa;
}

.breadcrumb-path-segment:hover .breadcrumb-folder-icon {
  color: #888;
}

.breadcrumb-path-segment.breadcrumb-path-current {
  color: #e0e0e0;
}

.breadcrumb-path-segment.breadcrumb-path-current:hover {
  color: #fff;
}

.breadcrumb-path-segment.breadcrumb-path-current .breadcrumb-folder-icon {
  color: #DE1833;
}

.breadcrumb-path-segment.breadcrumb-path-current:hover .breadcrumb-folder-icon {
  color: #ff2e4d;
}

/* Legacy standalone item links (kept for compatibility) */
.breadcrumb-path-item {
  color: #555;
  text-decoration: none;
  transition: color 0.15s ease;
  letter-spacing: 0.3px;
  white-space: nowrap;
  font-size: 16px;
}

.breadcrumb-path-item:hover {
  color: #aaa;
}

.breadcrumb-path-current {
  color: #e0e0e0;
}

.breadcrumb-path-current:hover {
  color: #fff;
}

.breadcrumb-path-sep {
  color: #555;
  font-size: 15px;
  font-weight: 300;
  user-select: none;
  flex-shrink: 0;
  margin: 0 2px;
}

/* Breadcrumb folder icon (inline with each segment) */
.breadcrumb-folder-icon {
  flex-shrink: 0;
  color: #555;
  width: 18px;
  height: 18px;
  transition: color 0.15s ease;
}

.breadcrumb-folder-root {
  color: #DE1833;
}

.breadcrumb-trash-icon {
  flex-shrink: 0;
  color: #DE1833;
  width: 18px;
  height: 18px;
  transition: color 0.15s ease;
}

/* Create Folder Button */
.btn-create-folder {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid #444;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.btn-create-folder:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #555;
}

/* Folder Row Styling */
.folder-row {
  cursor: pointer !important;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.folder-row:hover {
  background: #141414 !important;
}

.folder-row:active {
  background: #1a1a1a !important;
  transform: scale(0.998);
}

.folder-link {
  color: #e0e0e0;
  text-decoration: none;
  font-weight: 500;
  pointer-events: none;
}

.folder-row:hover .folder-link {
  text-decoration: none;
}

/* Row/tile selected state (single-click highlight, Explorer-style) */
.browser-row.row-selected {
  background: #1a1013 !important;
  transition: background 0.2s ease;
}

.browser-row.row-selected.row-selected-fading {
  background: #0a0a0a !important;
  transition: background 0.7s ease;
}

.tile-item.row-selected,
.tile-item.row-selected:hover {
  border-color: rgba(222, 24, 51, 0.4);
  box-shadow: 0 0 6px rgba(222, 24, 51, 0.15);
  background: #171113;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tile-item.row-selected.row-selected-fading,
.tile-item.row-selected.row-selected-fading:hover {
  border-color: #1e1e1e;
  box-shadow: none;
  background: #111;
  transition: background 0.7s ease, border-color 0.7s ease, box-shadow 0.7s ease;
}

/* Bulk-selected row highlight (list view, checkbox checked) */
.browser-row:has(input[type="checkbox"]:checked) {
  background: #171012 !important;
}

/* Drag and Drop States */
.file-row.dragging,
.file-tile.dragging,
.folder-tile.dragging {
  opacity: 0.5;
}

.folder-row.drop-target {
  background: rgba(255, 255, 255, 0.1) !important;
  border-left: 3px solid #e0e0e0;
}

.file-row {
  cursor: move;
}


/* Sidebar Folder Tree */

/* Scrollbar styling for folder tree */
.folder-tree::-webkit-scrollbar {
  width: 4px;
}
.folder-tree::-webkit-scrollbar-track {
  background: transparent;
}
.folder-tree::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}
.folder-tree::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

.folder-tree {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 8px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.folder-tree-item {
  display: flex;
  align-items: center;
  padding: 0 10px;
  margin: 0;
  position: relative;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  border-radius: 8px;
}

.folder-tree-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.folder-tree-item:hover .folder-tree-actions {
  opacity: 1;
}

/* ── Tree connector lines ──
   Each .folder-tree-item draws its own horizontal stub (::before) and
   vertical segment (::after).  The vertical runs full-height for middle
   siblings (T-branch) and half-height for the last sibling (L-bend).

   Additionally, each .folder-tree-children container draws a vertical
   continuation line (::before) that bridges the gap when a sibling above
   is expanded -- this keeps the guide line continuous through children. */

/* Horizontal branch stub: connects vertical guide to the folder icon */
.folder-tree-children > .folder-tree-item:not(.root-folder)::before {
  content: '';
  position: absolute;
  top: 50%;
  height: 1px;
  background: rgba(255, 255, 255, 0.13);
  pointer-events: none;
}

/* Vertical segment on each item: T-branch for middle items, L-bend for last */
.folder-tree-children > .folder-tree-item:not(.root-folder)::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.13);
  pointer-events: none;
}

/* Last folder-tree-item in a group: vertical only to center (L-shape) */
.folder-tree-children > .folder-tree-item:not(.root-folder):not(:has(~ .folder-tree-item))::after {
  bottom: auto;
  top: 0;
  height: 50%;
}

/* Vertical continuation line through .folder-tree-children containers.
   Bridges the gap between sibling items when a folder in between is
   expanded and showing its children.  Only drawn when there are more
   sibling items below this children block. */
.folder-tree-children > .folder-tree-children:has(~ .folder-tree-item)::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.13);
  pointer-events: none;
}

/* ── Per-level left offsets for connectors ──
   Uses data-level attribute for reliable depth targeting.
   Formula: left = 17 + level * 18, width = 10px for horizontal stubs.
   Items carry data-level = their nesting depth (0 = root's direct child).
   Children containers carry data-level = their parent item's depth,
   so the continuation line aligns with sibling items at that depth. */

/* Item connectors: left position computed from --level custom property.
   Full 18px increments for levels 0-3, then 10px per level, capped at 179px.
   CSS min() picks the smallest so the taper kicks in at level 4+. */
.folder-tree-item[data-level]::before {
  left: min(calc(17px + var(--level) * 18px), calc(71px + (var(--level) - 3) * 10px), 179px);
  width: 10px;
}
.folder-tree-item[data-level]::after {
  left: min(calc(17px + var(--level) * 18px), calc(71px + (var(--level) - 3) * 10px), 179px);
}

/* Continuation line on children containers (bridges expanded children).
   Uses same formula — the container's --level matches its sibling items. */
.folder-tree-children[data-level]:has(~ .folder-tree-item)::before {
  left: min(calc(17px + var(--level) * 18px), calc(71px + (var(--level) - 3) * 10px), 179px);
}

/* SVG chevron toggle */
.folder-tree-toggle {
  background: none;
  border: none;
  color: #555;
  padding: 2px;
  cursor: pointer;
  margin-right: 2px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.folder-tree-toggle:hover {
  color: #ccc;
  background: rgba(255, 255, 255, 0.06);
}

.toggle-chevron {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
}

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

.folder-tree-spacer {
  width: 22px;
  height: 22px;
  margin-right: 2px;
  flex-shrink: 0;
  display: inline-block;
}

.folder-tree-link {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  text-decoration: none;
  color: #808080;
  font-size: 13px;
  font-weight: 450;
  letter-spacing: 0.2px;
  padding: 7px 0;
  transition: color 0.15s ease;
  min-width: 0;
}

.folder-tree-link:hover {
  color: #d0d0d0;
}

.folder-tree-link.active {
  color: #c0c0c0;
  font-weight: 500;
}

/* Active folder item: soft background tint */
.folder-tree-item:has(.folder-tree-link.active) {
  background: rgba(255, 255, 255, 0.04);
}

/* When hovering a DIFFERENT item, suppress the active item's background */
.folder-tree:has(.folder-tree-item:hover) .folder-tree-item:has(.folder-tree-link.active):not(:hover) {
  background: transparent;
}

/* When hovering trash, suppress the active folder background */
.mega-sidebar:has(.sidebar-trash-link:hover) .folder-tree-item:has(.folder-tree-link.active) {
  background: transparent;
}

/* When hovering a folder item, suppress the active trash background */
.mega-sidebar:has(.folder-tree-item:hover) .sidebar-trash-link.active {
  background: transparent;
}

/* Sidebar folder drop-target state (drag-and-drop) */
.folder-tree-item.sidebar-drop-target {
  background: rgba(222, 24, 51, 0.10);
  border-radius: 6px;
}

.folder-tree-item.sidebar-drop-target > .folder-tree-link {
  color: #e0e0e0;
}

.folder-tree-item.sidebar-drop-target > .folder-tree-link .folder-tree-icon {
  color: #DE1833;
}

/* SVG folder icon styling */
.folder-tree-icon {
  flex-shrink: 0;
  color: #555;
  transition: color 0.15s ease;
  display: flex;
  align-items: center;
}

.folder-tree-link:hover .folder-tree-icon {
  color: #888;
}

.folder-tree-link.active .folder-tree-icon {
  color: #DE1833;
}

.folder-tree-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-tree-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
  position: absolute;
  right: 4px;
  padding-left: 8px;
}

.folder-tree-action {
  background: none;
  border: none;
  padding: 3px;
  cursor: pointer;
  color: #444;
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  line-height: 1;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.folder-tree-action:hover {
  color: #ccc;
  background: rgba(255, 255, 255, 0.06);
  transform: scale(1.1);
}

.folder-tree-action[data-action="delete"]:hover {
  color: #DE1833;
  background: rgba(222, 24, 51, 0.1);
}

.folder-tree-children {
  padding-left: 0;
}

/* Per-level indentation computed from --level custom property.
   Full 18px increments for levels 0-3, then 10px per level, capped at 190px.
   CSS min() picks the smallest so the taper kicks in at level 4+. */
.folder-tree-item[data-level] {
  padding-left: min(calc(28px + var(--level) * 18px), calc(82px + (var(--level) - 3) * 10px), 190px);
}

/* Indent guide positioning context */
.folder-tree-children {
  position: relative;
}

.folder-tree-file {
  display: flex;
  align-items: center;
  padding: 0 10px;
  margin: 0;
  position: relative;
  transition: background 0.15s ease;
  border-radius: 8px;
}

.folder-tree-file:hover {
  background: rgba(255, 255, 255, 0.04);
}

.root-folder {
  font-weight: 600;
}

/* Context Menu */
.context-menu {
  display: none;
  position: fixed;
  background: #141414;
  border: 1px solid #1e1e1e;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.03);
  min-width: 200px;
  z-index: 3000;
  overflow: hidden;
  padding: 4px 0;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  color: #888;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease;
  user-select: none;
}

.context-menu-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #e0e0e0;
}

.context-menu-item:hover .context-icon {
  opacity: 1;
}

.context-menu-item[data-action="open"]:hover {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.06);
}

.context-menu-item[data-action="open"]:hover .context-icon {
  color: #f59e0b;
}

.context-menu-item[data-action="download"]:hover {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.06);
}

.context-menu-item[data-action="download"]:hover .context-icon {
  color: #60a5fa;
}

.context-menu-item[data-action="copy-link"]:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.06);
}

.context-menu-item[data-action="copy-link"]:hover .context-icon {
  color: #38bdf8;
}

.context-menu-item[data-action="properties"]:hover {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.06);
}

.context-menu-item[data-action="properties"]:hover .context-icon {
  color: #a78bfa;
}

.context-menu-item.danger:hover {
  background: rgba(222, 24, 51, 0.06);
  color: #ff2244;
}

.context-menu-item.danger:hover .context-icon {
  color: #ff2244;
}

/* Background context menu action hover colors */
.context-menu-item[data-action="new-folder"]:hover {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.06);
}

.context-menu-item[data-action="new-folder"]:hover .context-icon {
  color: #f59e0b;
}

.context-menu-item[data-action="upload"]:hover {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.06);
}

.context-menu-item[data-action="upload"]:hover .context-icon {
  color: #4ade80;
}

.context-menu-item[data-action="select-all"]:hover {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.06);
}

.context-menu-item[data-action="select-all"]:hover .context-icon {
  color: #60a5fa;
}

.context-menu-item[data-action="toggle-view"]:hover {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.06);
}

.context-menu-item[data-action="toggle-view"]:hover .context-icon {
  color: #a78bfa;
}

.context-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.context-icon svg {
  width: 16px;
  height: 16px;
}

.context-menu-divider {
  height: 1px;
  background: #1e1e1e;
  margin: 4px 0;
}

/* Context Sub-Menu */
.context-menu-item.has-submenu {
  position: relative;
  padding-right: 28px;
}

.context-menu-item.has-submenu::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid #555;
  transition: border-color 0.12s ease;
}

.context-menu-item.has-submenu:hover::after {
  border-left-color: currentColor;
}

.context-submenu {
  display: none;
  position: fixed;
  background: #141414;
  border: 1px solid #1e1e1e;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.03);
  min-width: 180px;
  z-index: 3001;
  overflow: hidden;
  padding: 4px 0;
}

.context-submenu .context-submenu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  color: #888;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease;
  user-select: none;
  white-space: nowrap;
}

.context-submenu .context-submenu-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #e0e0e0;
}

.context-submenu .context-submenu-item:hover .context-icon {
  opacity: 1;
}

.context-submenu .context-submenu-item .submenu-ext {
  color: #555;
  font-size: 11px;
  margin-left: auto;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.context-submenu .context-submenu-item:hover .submenu-ext {
  color: #888;
}

.context-submenu .context-submenu-item.default-type {
  color: #aaa;
}

.context-submenu .context-submenu-item.default-type .submenu-ext {
  color: #666;
}

/* New file sub-menu hover colors */
.context-menu-item[data-action="new-file"]:hover {
  color: #34d399;
  background: rgba(52, 211, 153, 0.06);
}

.context-menu-item[data-action="new-file"]:hover .context-icon {
  color: #34d399;
}

.context-submenu .context-submenu-item:hover {
  color: #34d399;
  background: rgba(52, 211, 153, 0.06);
}

.context-submenu .context-submenu-item:hover .context-icon {
  color: #34d399;
}

.context-submenu .context-submenu-item:hover .submenu-ext {
  color: #34d399;
}

/* Create File Modal */
.create-file-ext-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 8px;
}

.create-file-ext-row .modal-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  flex: 1;
}

.create-file-ext-badge {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 14px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-left: none;
  border-radius: 0 8px 8px 0;
  color: #888;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  letter-spacing: 0.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.create-file-ext-badge:hover {
  color: #ccc;
  background: #222;
}

/* Extension dropdown picker */
.ext-dropdown {
  position: fixed;
  width: 220px;
  max-height: 260px;
  overflow-y: auto;
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.03);
  z-index: 10000;
  padding: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.ext-dropdown::-webkit-scrollbar {
  width: 5px;
}

.ext-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.ext-dropdown::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

.ext-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
  user-select: none;
}

.ext-dropdown-item:hover {
  background: rgba(52, 211, 153, 0.08);
}

.ext-dropdown-item.active {
  background: rgba(52, 211, 153, 0.12);
}

.ext-dropdown-item.active .ext-dropdown-label {
  color: #34d399;
}

.ext-dropdown-item.active .ext-dropdown-ext {
  color: #34d399;
}

.ext-dropdown-label {
  font-size: 12px;
  font-weight: 500;
  color: #999;
  letter-spacing: 0.5px;
  transition: color 0.1s ease;
}

.ext-dropdown-item:hover .ext-dropdown-label {
  color: #e0e0e0;
}

.ext-dropdown-ext {
  font-size: 11px;
  color: #555;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  transition: color 0.1s ease;
}

.ext-dropdown-item:hover .ext-dropdown-ext {
  color: #888;
}

.create-file-type-hint {
  margin-top: 8px;
  font-size: 11px;
  color: #555;
  letter-spacing: 0.3px;
}

/* Properties Modal */
.modal-properties {
  max-width: 550px;
}

.property-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.property-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  align-items: center;
}

.property-label {
  font-size: 13px;
  color: #888;
  font-weight: 600;
}

.property-value {
  font-size: 13px;
  color: #e0e0e0;
  display: flex;
  align-items: center;
}

.property-code {
  font-family: 'Monaco', 'Courier New', monospace;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

/* File Badges */
.file-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.file-badge-expires {
  background: rgba(245, 158, 11, 0.10);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.25);
  margin-left: 0;
  min-height: 22px;
  min-width: 42px;
  justify-content: center;
  box-sizing: border-box;
}

.file-badge-expires .badge-icon {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.file-badge-public {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
  min-height: 22px;
  min-width: 42px;
  justify-content: center;
  box-sizing: border-box;
}

.file-badge-private {
  background: rgba(158, 158, 158, 0.15);
  color: #9e9e9e;
  border: 1px solid rgba(158, 158, 158, 0.3);
}

.file-badge-warning {
  background: rgba(222, 24, 51, 0.15);
  color: #DE1833;
  border: 1px solid rgba(222, 24, 51, 0.3);
}

.file-badge-info {
  background: rgba(33, 150, 243, 0.15);
  color: #2196f3;
  border: 1px solid rgba(33, 150, 243, 0.3);
}

.file-badge-browsable {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.file-badge-e2e {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.file-badge-server-enc {
  background: rgba(250, 204, 21, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(250, 204, 21, 0.3);
}

/* Status column right-align */
.td-status {
  text-align: right;
}

.td-status .file-badge {
  margin-left: 4px;
  margin-right: 0;
}


.share-link-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-link-label {
  font-size: 10px;
  font-weight: 700;
  color: #555;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.share-link-url {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  color: #888;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #2a2a2a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.share-link-url:hover {
  color: #e0e0e0;
  border-color: #444;
}

.share-link-copy {
  background: rgba(255, 255, 255, 0.05);
  color: #888;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.share-link-copy:hover {
  color: #e0e0e0;
  border-color: #555;
  background: rgba(255, 255, 255, 0.1);
}

.toggle-label {
  font-size: 13px;
  color: #e0e0e0;
  min-width: 60px;
}

.toggle-label-text {
  font-size: 13px;
  color: #e0e0e0;
  margin-left: 12px;
  min-width: 60px;
}

/* Properties Modal - Password Group */
.prop-password-group {
  flex-wrap: wrap;
  gap: 8px;
}

.prop-password-input {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 12px;
  padding: 5px 10px;
  width: 140px;
  outline: none;
  transition: border-color 0.2s;
}

.prop-password-input:focus {
  border-color: #DE1833;
}

.prop-password-save {
  background: #DE1833;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: background 0.2s;
}

.prop-password-save:hover {
  background: #E8304A;
}

/* Properties Modal - Re-encryption Progress */
.prop-reencrypt-progress {
  padding: 12px 0;
}

.prop-reencrypt-status {
  font-size: 11px;
  color: #888;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.prop-reencrypt-bar-bg {
  width: 100%;
  height: 4px;
  background: #1a1a1a;
  border-radius: 2px;
  overflow: hidden;
}

.prop-reencrypt-bar {
  height: 100%;
  background: #DE1833;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ==========================================
   Universal Confirmation Modal (UCM)
   ========================================== */
.ucm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px) saturate(0.5);
  -webkit-backdrop-filter: blur(20px) saturate(0.5);
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.ucm-overlay.ucm-visible {
  display: flex;
  opacity: 1;
}
.ucm-overlay.ucm-hiding {
  opacity: 0;
}

.ucm-dialog {
  width: 380px;
  max-width: 90vw;
  background: rgba(14, 14, 14, 0.97);
  border: 1px solid rgba(222, 24, 51, 0.15);
  border-radius: 16px;
  padding: 32px 28px 24px;
  text-align: center;
  position: relative;
  box-shadow:
    0 0 30px rgba(222, 24, 51, 0.06),
    0 24px 64px rgba(0, 0, 0, 0.5);
  transform: translateY(0) scale(1);
  opacity: 1;
  animation: ucmSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.ucm-dialog.ucm-dialog-hiding {
  animation: ucmSlideOut 0.18s ease forwards;
}

@keyframes ucmSlideIn {
  from {
    transform: translateY(-14px) scale(0.97);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
@keyframes ucmSlideOut {
  to {
    transform: translateY(8px) scale(0.97);
    opacity: 0;
  }
}

/* Icon container */
.ucm-icon-wrap {
  width: 48px;
  height: 48px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(222, 24, 51, 0.08);
  border: 1px solid rgba(222, 24, 51, 0.18);
}
.ucm-icon-wrap svg {
  width: 22px;
  height: 22px;
  stroke: #DE1833;
  fill: none;
}

/* Title with file name + extension coloring */
.ucm-title {
  font-size: 15px;
  font-weight: 600;
  color: #f0f0f0;
  margin: 0 0 8px;
  word-break: break-word;
  overflow-wrap: break-word;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.ucm-name-base {
  color: #f0f0f0;
}
.ucm-name-ext {
  color: #888;
  font-weight: 500;
}

/* Description text */
.ucm-message {
  font-size: 13px;
  color: #666;
  line-height: 1.6;
  margin: 0 0 24px;
  letter-spacing: 0.01em;
}

/* Action buttons row */
.ucm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.ucm-btn {
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-transform: uppercase;
  flex: 1;
  max-width: 160px;
}

/* Cancel — ghost style */
.ucm-btn-cancel {
  background: transparent;
  border: 1px solid #1a1a1a;
  color: #555;
}
.ucm-btn-cancel:hover {
  color: #888;
  border-color: #2a2a2a;
  background: rgba(255, 255, 255, 0.02);
}

/* Confirm — red gradient */
.ucm-btn-confirm {
  background: linear-gradient(135deg, #DE1833 0%, #a0102a 100%);
  border: 1px solid rgba(255, 80, 110, 0.15);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.ucm-btn-confirm::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(255, 255, 255, 0.1) 40%,
    rgba(255, 255, 255, 0.18) 50%,
    rgba(255, 255, 255, 0.1) 60%,
    transparent 80%
  );
  animation: ucmShimmer 4s ease-in-out infinite;
}
@keyframes ucmShimmer {
  0%   { left: -100%; opacity: 0; }
  20%  { opacity: 1; }
  100% { left: 150%; opacity: 0; }
}
.ucm-btn-confirm:hover {
  border-color: rgba(255, 80, 110, 0.3);
  box-shadow:
    0 0 16px rgba(222, 24, 51, 0.2),
    0 6px 24px rgba(222, 24, 51, 0.15);
  transform: translateY(-1px);
}
.ucm-btn-confirm:active {
  transform: translateY(0);
  box-shadow: 0 0 8px rgba(222, 24, 51, 0.2);
}

/* ── Variant: Permanent delete ─────────── */
.ucm-permanent .ucm-dialog {
  border-color: rgba(222, 24, 51, 0.3);
  animation: ucmSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1), ucmPermGlow 3s ease-in-out infinite;
}
.ucm-permanent .ucm-dialog.ucm-dialog-hiding {
  animation: ucmSlideOut 0.18s ease forwards;
}
@keyframes ucmPermGlow {
  0%, 100% {
    border-color: rgba(222, 24, 51, 0.3);
    box-shadow: 0 0 30px rgba(222, 24, 51, 0.08), 0 24px 64px rgba(0, 0, 0, 0.5);
  }
  50% {
    border-color: rgba(222, 24, 51, 0.55);
    box-shadow: 0 0 40px rgba(222, 24, 51, 0.15), 0 24px 64px rgba(0, 0, 0, 0.5);
  }
}
.ucm-permanent .ucm-icon-wrap {
  background: rgba(222, 24, 51, 0.12);
  border-color: rgba(222, 24, 51, 0.3);
}
.ucm-permanent .ucm-title {
  color: #fca5a5;
}
.ucm-permanent .ucm-name-base {
  color: #fca5a5;
}
.ucm-permanent .ucm-btn-confirm {
  background: linear-gradient(135deg, #a8122a 0%, #7a0c1e 100%);
  border-color: rgba(222, 24, 51, 0.3);
}
.ucm-permanent .ucm-btn-confirm:hover {
  background: linear-gradient(135deg, #DE1833 0%, #a8122a 100%);
  box-shadow:
    0 0 20px rgba(222, 24, 51, 0.25),
    0 6px 24px rgba(222, 24, 51, 0.2);
}

/* ── Variant: E2E Warning (amber) ──────── */
.ucm-e2e-warn .ucm-dialog {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow:
    0 0 15px rgba(245, 158, 11, 0.08),
    0 0 40px rgba(245, 158, 11, 0.04),
    0 24px 64px rgba(0, 0, 0, 0.5);
  animation: ucmSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1), ucmWarnGlow 3s ease-in-out infinite;
}
.ucm-e2e-warn .ucm-dialog.ucm-dialog-hiding {
  animation: ucmSlideOut 0.18s ease forwards;
}
@keyframes ucmWarnGlow {
  0%, 100% {
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.08), 0 0 40px rgba(245, 158, 11, 0.04), 0 24px 64px rgba(0, 0, 0, 0.5);
  }
  50% {
    border-color: rgba(245, 158, 11, 0.6);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.15), 0 0 60px rgba(245, 158, 11, 0.08), 0 24px 64px rgba(0, 0, 0, 0.5);
  }
}
.ucm-e2e-warn .ucm-icon-wrap {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
  border-radius: 14px;
}
.ucm-e2e-warn .ucm-icon-wrap svg {
  stroke: #f5c542;
}
.ucm-e2e-warn .ucm-title {
  color: #f5c542;
}
.ucm-e2e-warn .ucm-message {
  color: #999;
  font-size: 13px;
  line-height: 1.7;
}
.ucm-e2e-warn .ucm-message .e2e-warn-filename {
  display: block;
  color: #e0e0e0;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
  word-break: break-all;
}
.ucm-e2e-warn .ucm-message .e2e-warn-size {
  color: #f5c542;
  font-weight: 600;
}
.ucm-e2e-warn .ucm-btn-cancel {
  border-color: #333;
  color: #888;
}
.ucm-e2e-warn .ucm-btn-cancel:hover {
  border-color: #555;
  color: #ccc;
  background: rgba(255, 255, 255, 0.03);
}
.ucm-e2e-warn .ucm-btn-confirm {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f5c542;
}
.ucm-e2e-warn .ucm-btn-confirm::before {
  display: none;
}
.ucm-e2e-warn .ucm-btn-confirm:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.12);
  transform: translateY(-1px);
}

/* ── Variant: No E2E (red glow) ────────── */
.ucm-no-e2e .ucm-dialog {
  border-color: rgba(222, 24, 51, 0.35);
  box-shadow:
    0 0 15px rgba(222, 24, 51, 0.08),
    0 0 40px rgba(222, 24, 51, 0.04),
    0 24px 64px rgba(0, 0, 0, 0.5);
  animation: ucmSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1), ucmNoE2eGlow 3s ease-in-out infinite;
}
.ucm-no-e2e .ucm-dialog.ucm-dialog-hiding {
  animation: ucmSlideOut 0.18s ease forwards;
}
@keyframes ucmNoE2eGlow {
  0%, 100% {
    border-color: rgba(222, 24, 51, 0.35);
    box-shadow: 0 0 15px rgba(222, 24, 51, 0.08), 0 0 40px rgba(222, 24, 51, 0.04), 0 24px 64px rgba(0, 0, 0, 0.5);
  }
  50% {
    border-color: rgba(222, 24, 51, 0.6);
    box-shadow: 0 0 20px rgba(222, 24, 51, 0.15), 0 0 60px rgba(222, 24, 51, 0.08), 0 24px 64px rgba(0, 0, 0, 0.5);
  }
}
.ucm-no-e2e .ucm-icon-wrap {
  background: rgba(222, 24, 51, 0.1);
  border-color: rgba(222, 24, 51, 0.25);
  border-radius: 14px;
}
.ucm-no-e2e .ucm-title {
  color: #ff2244;
}
.ucm-no-e2e .ucm-message {
  color: #999;
  font-size: 13px;
  line-height: 1.7;
}
.ucm-no-e2e .ucm-message .no-e2e-warn-count {
  display: block;
  color: #e0e0e0;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
}
.ucm-no-e2e .ucm-message .no-e2e-warn-hint {
  color: #666;
  font-size: 12px;
}
.ucm-no-e2e .ucm-btn-cancel {
  border-color: #333;
  color: #888;
}
.ucm-no-e2e .ucm-btn-cancel:hover {
  border-color: #555;
  color: #ccc;
  background: rgba(255, 255, 255, 0.03);
}
.ucm-no-e2e .ucm-btn-confirm {
  background: rgba(222, 24, 51, 0.15);
  border: 1px solid rgba(222, 24, 51, 0.4);
  color: #ff2244;
}
.ucm-no-e2e .ucm-btn-confirm::before {
  display: none;
}
.ucm-no-e2e .ucm-btn-confirm:hover {
  background: rgba(222, 24, 51, 0.25);
  border-color: rgba(222, 24, 51, 0.6);
  box-shadow: 0 4px 16px rgba(222, 24, 51, 0.12);
  transform: translateY(-1px);
}

/* ── Variant: Generic Warning (amber, non-delete) ── */
.ucm-warn .ucm-dialog {
  border-color: rgba(245, 158, 11, 0.2);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.06), 0 24px 64px rgba(0, 0, 0, 0.5);
}
.ucm-warn .ucm-icon-wrap {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
}
.ucm-warn .ucm-icon-wrap svg {
  stroke: #f5c542;
}
.ucm-warn .ucm-title {
  color: #f5c542;
}
.ucm-warn .ucm-btn-confirm {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f5c542;
}
.ucm-warn .ucm-btn-confirm::before {
  display: none;
}
.ucm-warn .ucm-btn-confirm:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.12);
  transform: translateY(-1px);
}

/* ── UCM responsive ── */
@media (max-width: 480px) {
  .ucm-dialog {
    width: calc(100vw - 32px);
    padding: 24px 20px 20px;
  }
  .ucm-btn {
    padding: 10px 16px;
    font-size: 11px;
  }
}

/* ==========================================
   SEARCH BOX
   ========================================== */
.search-box {
  position: relative;
}

/* Search toggle button -- hidden on desktop, shown on mobile */
.search-toggle-btn {
  display: none;
}

.search-input {
  width: 220px;
  padding: 5px 14px;
  background: rgba(30, 30, 30, 0.8);
  border: 1px solid #333;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: background 0.2s ease, border-color 0.2s ease, width 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: #555;
  width: 300px;
  background: rgba(40, 40, 40, 0.9);
}

.search-input::placeholder {
  color: #666;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.search-results {
  position: absolute;
  top: 100%;
  right: 0;
  width: 400px;
  max-height: 400px;
  overflow-y: auto;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
  z-index: 2000;
  margin-top: 8px;
}

.search-section-label {
  padding: 10px 16px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #666;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  text-decoration: none;
  color: #e0e0e0;
  transition: background 0.15s ease;
  cursor: pointer;
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.search-icon {
  font-size: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  color: #555;
}

.search-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 0.96;
}

.search-icon .audio-note-icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

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

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

.search-path {
  font-size: 11px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-no-results {
  padding: 20px;
  text-align: center;
  color: #666;
  font-size: 13px;
  font-weight: 600;
}

.search-thumb-wrap {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #333;
}

/* ── File Highlight Glow (search navigation) ── */
@keyframes fileHighlightGlow {
  0% { box-shadow: 0 0 0 0 rgba(222, 24, 51, 0); background: transparent; }
  15% { box-shadow: 0 0 12px 4px rgba(222, 24, 51, 0.5); background: rgba(222, 24, 51, 0.08); }
  40% { box-shadow: 0 0 12px 4px rgba(222, 24, 51, 0.5); background: rgba(222, 24, 51, 0.08); }
  100% { box-shadow: 0 0 0 0 rgba(222, 24, 51, 0); background: transparent; }
}

.file-highlight-glow {
  animation: fileHighlightGlow 2.5s ease-out forwards;
  border-radius: 6px;
  z-index: 5;
  position: relative;
}

/* ==========================================
   BULK OPERATIONS
   ========================================== */
.bulk-actions-bar {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 2px 20px;
  background: #111;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  height: 38px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.bulk-actions-bar.bulk-bar-active {
  display: flex;
  opacity: 1;
}

.bulk-actions-bar.bulk-bar-hiding {
  display: flex;
  opacity: 0;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 20;
  pointer-events: none;
}

.bulk-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bulk-select-all-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e0e0e0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.bulk-count {
  font-size: 13px;
  color: #888;
  font-weight: 600;
}

.bulk-right {
  display: flex;
  gap: 10px;
}

.bulk-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.06);
  color: #e0e0e0;
}

.bulk-btn svg {
  opacity: 0.75;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.bulk-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.bulk-btn:hover svg {
  opacity: 1;
}

.bulk-btn:active {
  transform: translateY(0);
  box-shadow: none;
  background: rgba(255, 255, 255, 0.08);
}

.bulk-btn-restore {
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.25);
  color: #4ade80;
}

.bulk-btn-restore:hover {
  background: rgba(74, 222, 128, 0.16);
  border-color: rgba(74, 222, 128, 0.4);
  color: #6ee7a0;
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.15);
}

.bulk-btn-restore:active {
  background: rgba(74, 222, 128, 0.1);
}

.bulk-btn-delete {
  background: rgba(222, 24, 51, 0.08);
  border-color: rgba(222, 24, 51, 0.25);
  color: #DE1833;
}

.bulk-btn-delete:hover {
  background: rgba(222, 24, 51, 0.16);
  border-color: rgba(222, 24, 51, 0.4);
  color: #f07370;
  box-shadow: 0 4px 12px rgba(222, 24, 51, 0.15);
}

.bulk-btn-delete:active {
  background: rgba(222, 24, 51, 0.1);
}

.bulk-btn-cancel {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  color: #888;
}

.bulk-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #bbb;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.bulk-btn-cancel:active {
  background: rgba(255, 255, 255, 0.06);
}

/* col-check, col-tags, col-browsable, col-encryption moved before media queries */

.enc-icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.enc-icon-e2e {
  background: #4ade80;
  box-shadow: 0 0 4px rgba(74, 222, 128, 0.5);
}

.enc-icon-server {
  background: #fbbf24;
  box-shadow: 0 0 4px rgba(251, 191, 36, 0.5);
}

.enc-icon-mixed {
  background: #f5c542;
  box-shadow: 0 0 4px rgba(245, 197, 66, 0.5);
}

/* ==========================================
   THUMBNAIL LOADING SPINNER
   ========================================== */
@keyframes thumb-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.thumb-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-top-color: rgba(255, 255, 255, 0.35);
  animation: thumb-spin 0.7s linear infinite;
  pointer-events: none;
  z-index: 1;
}

/* List view: 16px spinner inside .thumb-wrap (38x38 thumbnails) */
.thumb-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  margin-left: 2px;
}

.thumb-wrap .thumb-spinner {
  width: 16px;
  height: 16px;
}

/* Tile view: 22px spinner inside .tile-thumb (already position:relative) */
.tile-thumb > .thumb-spinner {
  width: 22px;
  height: 22px;
}

/* Search results: 14px spinner inside .search-thumb-wrap */
.search-thumb-wrap {
  position: relative;
}

.search-thumb-wrap .thumb-spinner {
  width: 14px;
  height: 14px;
}

/* Manage modal: 24px spinner inside .manage-modal-icon */
.manage-modal-icon {
  position: relative;
}

.manage-modal-icon > .thumb-spinner {
  width: 24px;
  height: 24px;
}

/* ==========================================
   FILE THUMBNAILS
   ========================================== */
.file-thumbnail {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #333;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
  /* Center within the 42px icon slot */
  margin-left: 2px;
}

/* Reset margin when inside .thumb-wrap (wrapper handles it) */
.thumb-wrap .file-thumbnail {
  margin-left: 0;
}

.file-thumbnail:hover {
  border-color: #666;
  transform: scale(1.08);
  transform-origin: center center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.e2e-thumb-placeholder {
  cursor: pointer;
}

/* ==========================================
   PREVIEW BUTTON
   ========================================== */
.preview-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  margin-left: 4px;
  flex-shrink: 0;
}

.browser-row:hover .preview-btn {
  opacity: 0.7;
}

.preview-btn:hover {
  opacity: 1 !important;
}

/* ==========================================
   PREVIEW SCROLL LOCK
   Prevents background scrolling when a media preview modal is open.
   Applied to <html> by JS; position:fixed is the only reliable
   cross-browser way to kill scroll on iOS Safari.
   ========================================== */
html.preview-scroll-lock,
html.preview-scroll-lock body {
  overflow: hidden !important;
  /* touch-action on body blocks pull-to-refresh & rubber-band */
  touch-action: none;
}
html.preview-scroll-lock {
  position: fixed;
  width: 100%;
}
html.preview-scroll-lock .header {
  z-index: 0;
}

/* ==========================================
   PREVIEW MODAL
   ========================================== */
.preview-modal {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(14px) saturate(0.5);
  -webkit-backdrop-filter: blur(14px) saturate(0.5);
  flex-direction: column;
}

.preview-modal.preview-visible {
  display: flex;
  animation: previewFadeIn 0.2s ease forwards;
}

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

.preview-modal.preview-hiding {
  animation: previewFadeOut 0.15s ease forwards;
}

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

/* Close button - top right floating */
.preview-resolution {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: none;
  align-items: center;
  padding: 0 12px;
  height: 40px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #aaa;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}

.preview-resolution.visible {
  display: flex;
}

.preview-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: #ddd;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.preview-close:hover {
  background: rgba(40, 40, 40, 0.98);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.7);
}

/* Stage - the main content area, fills available space */
.preview-stage {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 56px 24px 16px 24px;
  /* Allow touch interactions inside the stage (images, video controls, text scroll) */
  touch-action: auto;
}

/* When stage contains the text editor, prevent the stage from scrolling --
   the editor handles its own scrolling internally via .preview-editor-scroll */
.preview-stage:has(> .preview-editor-container) {
  overflow: hidden;
  align-items: stretch;
}

/* Bottom bar - filename and actions */
.preview-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 24px;
  /* Taller gradient via padding-top so the fade is gradual, no hard line */
  padding-top: 48px;
  background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 100%);
}

.preview-bar-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
  display: flex;
  min-width: 0;
}

.preview-bar-name .file-name-base {
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.preview-bar-name .file-name-ext {
  flex-shrink: 0;
  color: #888;
}

.preview-bar-download {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  text-decoration: none;
}

.preview-bar-download:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
}

/* Image preview - fills as much space as possible */
.preview-image {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  object-fit: contain;
  border-radius: 6px;
  animation: previewImgIn 0.25s ease forwards;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transform-origin: 0 0;
  will-change: transform;
}

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

/* Video preview */
.preview-video {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  border-radius: 6px;
  display: block;
}

/* ── Custom video player ── */
.preview-video-wrap {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  max-height: calc(100vh - 140px);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: #000;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
}
.preview-video-wrap *,
.preview-video-wrap video {
  -webkit-tap-highlight-color: transparent;
}
.preview-video-wrap .preview-video {
  max-height: calc(100vh - 140px);
  border-radius: 0;
}
.preview-video-wrap:fullscreen { border-radius: 0; }
.preview-video-wrap:fullscreen .preview-video { max-height: 100vh; width: 100%; height: 100%; object-fit: contain; }
.preview-video-wrap:-webkit-full-screen { border-radius: 0; }
.preview-video-wrap:-webkit-full-screen .preview-video { max-height: 100vh; width: 100%; height: 100%; object-fit: contain; }

/* Play overlay (centered, appears briefly on play/pause tap) */
.pvp-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 2;
}
.pvp-play-overlay.pvp-flash {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.pvp-play-overlay svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}

/* Control bar */
.pvp-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.82));
  opacity: 1;
  transition: opacity 0.3s ease;
  z-index: 3;
  line-height: 1;
}
.pvp-controls.pvp-hidden {
  opacity: 0;
  pointer-events: none;
}
.preview-video-wrap:fullscreen .pvp-controls { padding: 10px 18px 14px; }
.preview-video-wrap:-webkit-full-screen .pvp-controls { padding: 10px 18px 14px; }

/* Control buttons */
.pvp-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  opacity: 0.9;
  transition: opacity 0.15s ease;
}
.pvp-btn:hover { opacity: 1; }
.pvp-btn svg { width: 18px; height: 18px; fill: currentColor; }

/* Seek bar */
.pvp-seek-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  height: 28px;
  cursor: pointer;
  position: relative;
}
.pvp-seek-track {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  position: relative;
  overflow: hidden;
  transition: height 0.12s ease;
}
.pvp-seek-wrap:hover .pvp-seek-track {
  height: 6px;
}
.pvp-seek-fill {
  height: 100%;
  background: #DE1833;
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
}
.pvp-seek-buffer {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
}
.pvp-seek-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #DE1833;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.12s ease;
  pointer-events: none;
  z-index: 1;
}
.pvp-seek-wrap:hover .pvp-seek-thumb,
.pvp-seek-wrap.pvp-seeking .pvp-seek-thumb {
  transform: translate(-50%, -50%) scale(1);
}

/* Time label */
.pvp-time {
  color: rgba(255,255,255,0.8);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
  letter-spacing: 0.3px;
}

/* Volume */
.pvp-vol-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.pvp-vol-slider-wrap {
  width: 0;
  overflow: hidden;
  transition: width 0.2s ease;
  display: flex;
  align-items: center;
}
.pvp-vol-wrap:hover .pvp-vol-slider-wrap,
.pvp-vol-wrap.pvp-vol-open .pvp-vol-slider-wrap {
  width: 70px;
}
.pvp-vol-track {
  width: 64px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  position: relative;
  cursor: pointer;
  margin-left: 4px;
}
.pvp-vol-fill {
  height: 100%;
  background: #fff;
  border-radius: 2px;
  width: 100%;
  pointer-events: none;
}

/* Speed button */
.pvp-speed-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  color: rgba(255,255,255,0.8);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pvp-speed-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}
.pvp-speed-btn.pvp-speed-active {
  border-color: rgba(222, 24, 51, 0.6);
  color: #DE1833;
}

/* Speed dropdown menu */
.pvp-speed-wrap {
  position: relative;
  flex-shrink: 0;
}
.pvp-speed-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 4px 0;
  min-width: 72px;
  display: none;
  flex-direction: column;
  z-index: 10;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}
.pvp-speed-menu.pvp-speed-menu-open {
  display: flex;
}
.pvp-speed-option {
  background: none;
  border: none;
  padding: 6px 14px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
  line-height: 1;
  transition: background 0.1s ease, color 0.1s ease;
}
.pvp-speed-option:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.pvp-speed-option.pvp-speed-option-active {
  color: #DE1833;
  font-weight: 700;
}

/* ── Image zoom ── */
.preview-image.pv-zoomed {
  cursor: grab;
}
.preview-image.pv-dragging {
  cursor: grabbing;
}
.preview-stage.pv-zoom-active {
  overflow: hidden;
  padding-bottom: 0;
}
/* When zoomed, overlay the bar so the stage gets full height */
.preview-stage.pv-zoom-active ~ .preview-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 4;
  pointer-events: none;
}
.preview-stage.pv-zoom-active ~ .preview-bar * {
  pointer-events: auto;
}

/* Zoom badge */
.preview-zoom-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: none;
  align-items: center;
  padding: 0 10px;
  height: 32px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #aaa;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.preview-zoom-badge.visible {
  display: flex;
}

/* When resolution badge is also visible, push zoom badge below it */
.preview-resolution.visible ~ .preview-zoom-badge.visible {
  top: 64px;
}

/* ── Mobile overrides for video player ── */
@media (max-width: 850px) {
  .preview-video-wrap {
    max-height: calc(100vh - 200px);
    max-height: calc(100dvh - 200px);
  }
  .preview-video-wrap .preview-video {
    max-height: calc(100vh - 200px);
    max-height: calc(100dvh - 200px);
  }
  .pvp-vol-wrap { display: none; }
  .pvp-controls { gap: 8px; padding: 6px 10px; }
  .pvp-btn { width: 32px; height: 32px; }
  .pvp-btn svg { width: 20px; height: 20px; }
  .pvp-time { font-size: 11px; }
  .pvp-play-overlay { width: 48px; height: 48px; }
  .pvp-play-overlay svg { width: 22px; height: 22px; }
}

/* Audio preview */
.preview-audio-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px;
}

.preview-audio-icon {
  font-size: 80px;
  opacity: 0.7;
}

.preview-audio-icon .audio-note-icon {
  width: 80px;
  height: 80px;
  color: #DE1833;
}

.preview-audio {
  width: 100%;
  max-width: 500px;
  filter: invert(1) hue-rotate(180deg);
}

/* PDF preview */
.preview-pdf {
  width: 90vw;
  height: calc(100vh - 140px);
  border: none;
  border-radius: 6px;
}

/* Text preview */
.preview-text {
  width: 90vw;
  max-width: 900px;
  max-height: calc(100vh - 140px);
  overflow: auto;
  overscroll-behavior: contain;
  background: rgba(15, 15, 15, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #d4d4d4;
  padding: 24px;
  border-radius: 8px;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  box-shadow: none;
}

/* ---- Text Editor (inline preview editor) ---- */

.preview-editor-container {
  width: 90vw;
  max-width: 940px;
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  background: #0d0d0d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  margin: 0;
}

.preview-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  min-height: 38px;
}

.preview-editor-lang {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  white-space: nowrap;
}

.preview-editor-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 3px 10px 3px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.preview-editor-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.preview-editor-status.modified {
  color: #e8a832;
  background: rgba(232, 168, 50, 0.08);
  border-color: rgba(232, 168, 50, 0.18);
}
.preview-editor-status.modified .preview-editor-status-dot {
  background: #e8a832;
  box-shadow: 0 0 6px rgba(232, 168, 50, 0.5);
}

.preview-editor-status.saving {
  color: #5a9fd4;
  background: rgba(90, 159, 212, 0.08);
  border-color: rgba(90, 159, 212, 0.18);
}
.preview-editor-status.saving .preview-editor-status-dot {
  background: #5a9fd4;
  box-shadow: 0 0 6px rgba(90, 159, 212, 0.5);
  animation: statusPulse 1s ease-in-out infinite;
}

.preview-editor-status.saved {
  color: #4ec46a;
  background: rgba(78, 196, 106, 0.08);
  border-color: rgba(78, 196, 106, 0.18);
}
.preview-editor-status.saved .preview-editor-status-dot {
  background: #4ec46a;
  box-shadow: 0 0 6px rgba(78, 196, 106, 0.5);
}

.preview-editor-status.error {
  color: #DE1833;
  background: rgba(222, 24, 51, 0.08);
  border-color: rgba(222, 24, 51, 0.18);
}
.preview-editor-status.error .preview-editor-status-dot {
  background: #DE1833;
  box-shadow: 0 0 6px rgba(222, 24, 51, 0.5);
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.preview-editor-save {
  padding: 5px 16px;
  background: rgba(222, 24, 51, 0.15);
  color: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(222, 24, 51, 0.2);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  cursor: not-allowed;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}

.preview-editor-save.active {
  background: #DE1833;
  color: #fff;
  border-color: #DE1833;
  cursor: pointer;
}

.preview-editor-save.active:hover {
  background: #E8304A;
}

.preview-editor-save:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.preview-editor-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.preview-editor-gutter {
  flex-shrink: 0;
  padding: 12px 0;
  background: rgba(255, 255, 255, 0.015);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  min-width: 44px;
  text-align: right;
}

.preview-editor-gutter-inner {
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.13);
  padding-right: 12px;
  white-space: pre;
}

.preview-editor-scroll {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  position: relative;
  min-width: 0;
  background: #0d0d0d;
}

.preview-editor-code-pre {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

.preview-editor-code {
  display: block;
  padding: 12px 14px;
  margin: 0;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #c9d1d9;
  background: transparent !important;
  outline: none;
  border: none;
  caret-color: #c9d1d9;
  min-height: 100%;
  tab-size: 2;
  -moz-tab-size: 2;
  overflow: visible;
}

.preview-editor-code:focus {
  outline: none;
}

.preview-editor-code::selection {
  background: rgba(222, 24, 51, 0.3);
}

.preview-editor-code *::selection {
  background: rgba(222, 24, 51, 0.3);
}

/* Hidden textarea for value sync only */
.preview-editor-hidden-textarea {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.preview-editor-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  min-height: 28px;
}

.preview-editor-footer span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.preview-editor-readonly-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: rgba(255, 180, 0, 0.06);
  border-bottom: 1px solid rgba(255, 180, 0, 0.1);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: rgba(255, 180, 0, 0.6);
}

/* Loading spinner */
.preview-loading {
  color: #555;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
}

.preview-loading::after {
  content: '';
  display: block;
  width: 28px;
  height: 28px;
  margin: 16px auto 0;
  border: 2px solid rgba(255,255,255,0.08);
  border-top-color: rgba(255,255,255,0.3);
  border-radius: 50%;
  animation: previewSpin 0.7s linear infinite;
}

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

/* Error */
.preview-error {
  color: #DE1833;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ==========================================
   TRASH VIEW
   ========================================== */
.trash-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #DE1833;
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
}

.sidebar-trash-item {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0;
  flex-shrink: 0;
}

.sidebar-trash-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: #888;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.sidebar-trash-link:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #e0e0e0;
}

.sidebar-trash-link.active {
  color: #c0c0c0;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-trash-icon {
  display: flex;
  align-items: center;
}

.sidebar-trash-icon svg {
  width: 16px;
  height: 16px;
}

.sidebar-trash-label {
  font-weight: inherit;
  letter-spacing: 0.3px;
}

.btn-restore-all,
.btn-empty-trash {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-restore-all svg,
.btn-empty-trash svg {
  opacity: 0.75;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.btn-restore-all:hover svg,
.btn-empty-trash:hover svg {
  opacity: 1;
}

.btn-restore-all:active,
.btn-empty-trash:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-restore-all {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e0e0e0;
}

.btn-restore-all:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-empty-trash {
  background: rgba(222, 24, 51, 0.1);
  border: 1px solid rgba(222, 24, 51, 0.25);
  color: #E0635F;
}

.btn-empty-trash:hover {
  background: rgba(222, 24, 51, 0.18);
  border-color: rgba(222, 24, 51, 0.4);
  color: #f07370;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(222, 24, 51, 0.2);
}

.btn-empty-trash:active {
  background: rgba(222, 24, 51, 0.12);
}

.trash-row {
  opacity: 0.85;
}

.trash-row:hover {
  opacity: 1;
}

.trash-countdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.trash-countdown svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.trash-countdown-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 6px 6px;
  transition: width 0.3s ease;
}

.trash-countdown-time {
  font-variant-numeric: tabular-nums;
}

.trash-countdown.countdown-overdue {
  color: rgb(255, 80, 80);
  background: rgba(255, 80, 80, 0.1);
  border-color: rgba(255, 80, 80, 0.25);
  animation: overduePulse 2s ease-in-out infinite;
}

.trash-countdown.countdown-overdue .trash-countdown-bar {
  background: rgb(255, 80, 80);
  width: 100%;
}

@keyframes overduePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Rename button styling */
.rename-file-btn,
.rename-folder-btn {
  cursor: pointer;
  background: rgba(30, 30, 30, 0.8);
  border: none;
  outline: none;
  font-size: 16px;
  padding: 4px;
  color: #e0e0e0;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.rename-file-btn:hover,
.rename-folder-btn:hover {
  background: rgba(222, 24, 51, 0.2);
  color: #DE1833;
  transform: scale(1.1);
}

/* ==========================================
   BULK MOVE MODAL
   ========================================== */
.modal-move {
  min-width: 420px;
  max-width: 480px;
}

/* Move modal folder tree */
.move-folder-tree {
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  padding: 6px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.move-folder-tree::-webkit-scrollbar {
  width: 4px;
}
.move-folder-tree::-webkit-scrollbar-track {
  background: transparent;
}
.move-folder-tree::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}
.move-folder-tree::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

.move-tree-loading {
  color: #555;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-align: center;
  padding: 40px 0;
}

/* Row items inside the move tree reuse .folder-tree-item from the sidebar,
   plus an additional .move-tree-row class for move-specific overrides. */
.move-tree-row {
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
  transition: background 0.15s ease;
  margin: 1px 0;
}

.move-tree-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.move-tree-row .move-tree-link {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  color: #808080;
  font-size: 13px;
  font-weight: 450;
  letter-spacing: 0.2px;
  padding: 4px 6px;
  transition: color 0.15s ease;
  min-width: 0;
}

.move-tree-row:hover .move-tree-link {
  color: #d0d0d0;
}

.move-tree-row:hover .move-tree-link .folder-tree-icon {
  color: #999;
}

/* Selected folder in move tree */
.move-tree-row.selected {
  background: rgba(222, 24, 51, 0.12);
}

.move-tree-row.selected .move-tree-link {
  color: #e0e0e0;
  font-weight: 550;
}

.move-tree-row.selected .move-tree-link .folder-tree-icon {
  color: #DE1833;
}

/* Disabled folders (self or descendants being moved) */
.move-tree-row.move-disabled {
  opacity: 0.25;
  pointer-events: none;
}

/* Move tree toggle button -- mirrors sidebar's .folder-tree-toggle */
.move-tree-toggle-btn {
  background: none;
  border: none;
  color: #555;
  padding: 2px;
  cursor: pointer;
  margin-right: 2px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.move-tree-toggle-btn:hover {
  color: #ccc;
  background: rgba(255, 255, 255, 0.06);
}

/* Branch connectors and nesting indentation for the move tree are inherited
   from the sidebar's .folder-tree-item / .folder-tree-children rules. */

.btn-primary {
  background: #DE1833;
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn-primary:hover:not(:disabled) {
  background: #E8304A;
}

.btn-primary:disabled,
.btn-primary-small:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Responsive updates for small mobile */
/* ==========================================
   BROWSABLE FOLDER VIEW
   Uses full dashboard layout with sidebar.
   Folder links must be re-enabled because the
   dashboard CSS disables them (pointer-events: none)
   since dashboard.js handles row clicks instead.
   ========================================== */

/* Enable folder links in browse view */
body.browse-view .folder-link {
  pointer-events: auto;
  cursor: pointer;
}

body.browse-view .folder-row {
  cursor: pointer;
}

.bulk-btn-select-all {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #e0e0e0;
}

.bulk-btn-select-all:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.bulk-btn-select-all:active {
  background: rgba(255, 255, 255, 0.08);
}

.bulk-btn-download {
  background: rgba(96, 165, 250, 0.08);
  border-color: rgba(96, 165, 250, 0.25);
  color: #60a5fa;
}

.bulk-btn-download:hover {
  background: rgba(96, 165, 250, 0.16);
  border-color: rgba(96, 165, 250, 0.4);
  color: #78b4fb;
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.15);
}

.bulk-btn-download:active {
  background: rgba(96, 165, 250, 0.1);
}

/* Browse view: show action buttons in folder rows */
body.browse-view .folder-row .col-actions {
  display: flex;
  gap: 6px;
}

/* ═══════════════════════════════════════════════════════════════════
   Inline Manage Modal (dashboard overlay)
   ═══════════════════════════════════════════════════════════════════ */

.manage-modal {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px) saturate(0.5);
  -webkit-backdrop-filter: blur(20px) saturate(0.5);
  z-index: 2500;
  justify-content: center;
  align-items: center;
  overscroll-behavior: contain;
}

.manage-modal.manage-modal-visible {
  display: flex;
  animation: manageModalFadeIn 0.2s ease forwards;
}

.manage-modal.manage-modal-hiding {
  animation: manageModalFadeOut 0.15s ease forwards;
}

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

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

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

.manage-modal-panel {
  background: #111111;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  width: 420px;
  max-width: 92vw;
  max-height: 85vh;
  animation: manageModalSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.manage-modal-scroll {
  overflow-y: auto;
  padding: 28px 24px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.manage-modal-scroll::-webkit-scrollbar {
  width: 4px;
}

.manage-modal-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}

.manage-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #666;
  cursor: pointer;
  padding: 5px;
  border-radius: 8px;
  z-index: 10;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.manage-modal-close:hover {
  color: #DE1833;
  background: rgba(222, 24, 51, 0.12);
  border-color: rgba(222, 24, 51, 0.2);
}

/* ── Header ── */

.manage-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-right: 28px;
}

.manage-modal-icon {
  font-size: 48px;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
}

.manage-modal-icon img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 14px;
}

.manage-modal-icon .audio-note-icon {
  width: 42px;
  height: 42px;
}

.manage-modal-icon svg {
  width: 42px;
  height: 42px;
  color: #555;
  stroke-width: 0.7;
}

.manage-modal-title-wrap {
  min-width: 0;
  flex: 1;
}

.manage-modal-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.manage-modal-name {
  font-size: 15px;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0;
  letter-spacing: 0.02em;
  display: flex;
  min-width: 0;
  overflow: hidden;
  line-height: 1.4;
}

.manage-modal-name .file-name-base {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

.manage-modal-name .file-name-ext {
  color: #666;
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
}

.manage-modal-copy-name {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #555;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.manage-modal-copy-name:hover {
  color: #ccc;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.manage-modal-copy-name.copied {
  color: #4ade80;
}

.manage-modal-copy-name.copied:hover {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.15);
}

.manage-modal-badges {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.manage-modal-badges .file-badge {
  font-size: 10px;
  padding: 2px 7px;
}

/* ── Tabs ── */

.manage-modal-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.manage-modal-tab {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #505050;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
  font-family: inherit;
  text-align: center;
}

.manage-modal-tab:hover {
  color: #aaa;
}

.manage-modal-tab.manage-modal-tab-active {
  color: #f0f0f0;
  border-bottom-color: #DE1833;
}

.manage-modal-tab-content {
  display: none;
}

.manage-modal-tab-content.manage-modal-tab-active {
  display: block;
}

/* ── Detail grid ── */

.manage-modal-details {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.manage-modal-detail {
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 14px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.manage-modal-detail-label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.manage-modal-detail-value {
  font-size: 13px;
  color: #d0d0d0;
  font-weight: 700;
}

.manage-modal-detail-hint {
  font-size: 10px;
  font-weight: 400;
  color: #555;
  letter-spacing: 0.04em;
  margin-right: 8px;
}

/* Encryption value styling with backgrounds */
.manage-modal-encryption-value {
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.4px;
  display: inline-block;
}

.manage-modal-encryption-e2e {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.manage-modal-encryption-server {
  background: rgba(222, 24, 51, 0.15);
  color: #ff2244;
  border: 1px solid rgba(222, 24, 51, 0.3);
}

.manage-modal-encryption-mixed {
  background: rgba(245, 197, 66, 0.15);
  color: #f5c542;
  border: 1px solid rgba(245, 197, 66, 0.3);
}

/* ── Settings ── */

.manage-modal-settings {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.manage-modal-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.manage-modal-label {
  font-size: 11px;
  font-weight: 700;
  color: #606060;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

/* ── Expiry custom dropdown ── */
.manage-expiry-dropdown {
  position: relative;
}

.manage-expiry-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #999;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  font-family: inherit;
}

.manage-expiry-button:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e0e0e0;
}

.manage-expiry-arrow {
  transition: transform 0.25s ease;
  opacity: 0.5;
  flex-shrink: 0;
}

.manage-expiry-button:hover .manage-expiry-arrow {
  opacity: 0.8;
}

.manage-expiry-button.active .manage-expiry-arrow {
  transform: rotate(180deg);
  opacity: 0.8;
}

.manage-expiry-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.98);
  transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1), transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1100;
  overflow: hidden;
}

.manage-expiry-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.manage-expiry-item {
  padding: 10px 14px;
  color: #888;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.manage-expiry-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e0e0e0;
}

.manage-expiry-item.selected {
  color: #DE1833;
}

.manage-modal-toggle-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.manage-modal-toggle-text {
  min-width: 0;
  flex: 1;
}

.manage-modal-hint {
  font-size: 10px;
  color: #444;
  letter-spacing: 0.03em;
  display: block;
  margin-top: 2px;
}

/* ── Share section ── */

.manage-modal-share {
  padding-top: 2px;
}

.manage-modal-share-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.manage-modal-share-input {
  flex: 1;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: #999;
  font-size: 11px;
  font-family: inherit;
  outline: none;
  min-width: 0;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  transition: border-color 0.2s ease;
}

.manage-modal-share-input:focus {
  border-color: rgba(255, 255, 255, 0.12);
}

.manage-modal-share-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.manage-modal-share-input-wrap .manage-modal-share-input {
  width: 100%;
}

.manage-modal-share-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
}

.manage-modal-share-spinner-icon {
  width: 16px;
  height: 16px;
  border: 2px solid #333;
  border-top-color: #888;
  border-radius: 50%;
  animation: shareSpinnerRotate 0.6s linear infinite;
}

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

.manage-modal-share-copy {
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #999;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.manage-modal-share-copy:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
  border-color: rgba(255, 255, 255, 0.15);
}

.manage-modal-regenerate-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: #666;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  width: 100%;
  justify-content: center;
  font-family: inherit;
}

.manage-modal-regenerate-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ccc;
  border-color: rgba(255, 255, 255, 0.12);
}

.manage-modal-regenerate-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.manage-modal-regenerate-working {
  color: #DE1833;
  border-color: rgba(222, 24, 51, 0.3);
}

.manage-modal-regenerate-success {
  color: #ccc;
  border-color: rgba(255, 255, 255, 0.1);
}

/* ── Wget / CLI Command ── */

.manage-modal-wget {
  padding-top: 4px;
}

.manage-modal-cmd {
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 0.02em;
  display: block;
  cursor: default;
  user-select: all;
  -webkit-user-select: all;
}

.manage-modal-cmd .cmd-bin  { color: #6a9955; }
.manage-modal-cmd .cmd-flag { color: #569cd6; }
.manage-modal-cmd .cmd-str  { color: #ce9178; }
.manage-modal-cmd .cmd-pipe { color: #d4d4d4; }
.manage-modal-cmd .cmd-arg  { color: #9cdcfe; }

/* ── Actions ── */

.manage-modal-actions {
  display: flex;
  gap: 8px;
  padding-top: 18px;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.manage-modal-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 0;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  text-decoration: none;
  border: 1px solid transparent;
  text-align: center;
}

.manage-modal-btn svg {
  flex-shrink: 0;
}

.manage-modal-btn-download {
  background: rgba(96, 165, 250, 0.08);
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.12);
}

.manage-modal-btn-download:hover {
  background: rgba(96, 165, 250, 0.14);
  border-color: rgba(96, 165, 250, 0.25);
  color: #78b4fb;
}

.manage-modal-btn-delete {
  background: rgba(222, 24, 51, 0.08);
  color: #ff2244;
  border-color: rgba(222, 24, 51, 0.12);
}

.manage-modal-btn-delete:hover {
  background: rgba(222, 24, 51, 0.14);
  border-color: rgba(222, 24, 51, 0.25);
  color: #ff3355;
}


/* ── Loading state ── */

.manage-modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: #505050;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.6px;
}

.manage-modal-loading::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-top-color: #DE1833;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 10px;
}

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

/* ── Inline toggle spinner ── */
.toggle-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid #333;
  border-top-color: #DE1833;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 5px;
}

/* ── Responsive ── */

/* ═══════════════════════════════════════════════════════════════════════
   View Toggle Buttons
   ═══════════════════════════════════════════════════════════════════════ */

.view-toggle {
  display: inline-flex;
  align-items: center;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  margin-left: 8px;
  flex-shrink: 0;
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #666;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
  padding: 0;
}

.view-toggle-btn:hover {
  color: #aaa;
  background: #222;
}

.view-toggle-btn.active {
  color: #fff;
  background: #DE1833;
}

.view-toggle-btn svg {
  width: 15px;
  height: 15px;
}

/* ═══════════════════════════════════════════════════════════════════════
   Tile / Grid View (MEGA.nz style)
   ═══════════════════════════════════════════════════════════════════════ */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px 20px;
}

.tile-item {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #111;
  border: 1px solid #1e1e1e;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tile-item:hover {
  border-color: #333;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

.folder-tile:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tile-item:hover .tile-actions {
  opacity: 1;
  pointer-events: auto;
}

.tile-item.drop-target {
  border-color: #DE1833;
  box-shadow: 0 0 12px rgba(222, 24, 51, 0.3);
}

/* ── Tile Checkbox ── */

.tile-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.tile-item:hover .tile-checkbox,
.tile-checkbox:has(input:checked) {
  opacity: 1;
  pointer-events: auto;
}

.tile-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #DE1833;
}

/* ── Tile selected state (bulk mode) ── */

.tile-item.tile-selected {
  border-color: #DE1833;
  box-shadow: 0 0 8px rgba(222, 24, 51, 0.2);
}

.tile-item.tile-selected .tile-checkbox {
  opacity: 1;
  pointer-events: auto;
}

/* Show all tile checkboxes when bulk mode is active */
.tile-grid.bulk-mode-active .tile-checkbox {
  opacity: 1;
  pointer-events: auto;
}

/* ── Tile Thumbnail Area ── */

.tile-thumb {
  position: relative;
  width: 100%;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0d0d;
  overflow: hidden;
  flex-shrink: 0;
}

.tile-thumb-folder {
  background: #0f1114;
}

.tile-folder-icon {
  font-size: 52px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
}

.tile-folder-icon svg {
  width: 52px;
  height: 52px;
  stroke-width: 0.37;
}

.tile-thumb-icon {
  font-size: 42px;
  line-height: 1;
  opacity: 0.8;
}

.tile-thumb-icon .audio-note-icon {
  width: 42px;
  height: 42px;
}

.file-tile[data-previewable="true"] .tile-thumb {
  cursor: pointer;
}

.tile-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  user-drag: none;
}

.tile-thumb-has-img {
  background: #080808;
}

.tile-thumb-image .tile-thumb-img,
.tile-thumb-video .tile-thumb-img {
  object-fit: cover;
}

.tile-thumb-text {
  background: #1a1a1a;
}

.tile-thumb-text .tile-thumb-img {
  object-fit: contain;
}

/* ── Tile Link (folder navigation) ── */

.tile-link {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-height: 0;
  z-index: 1;
}

.tile-link .tile-thumb {
  flex-shrink: 0;
}

/* ── Tile Info Area ── */

.tile-info {
  padding: 10px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
}

.tile-name {
  font-size: 0.82em;
  font-weight: 600;
  color: #e0e0e0;
  overflow: hidden;
  letter-spacing: 0.01em;
  line-height: 1.3;
  min-width: 0;
}

.tile-name .file-name-text {
  display: flex;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-name .file-name-base {
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.tile-name .file-name-ext {
  flex-shrink: 0;
  color: #888;
}

.tile-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72em;
  color: #666;
  letter-spacing: 0.02em;
}

/* ── Tile Encryption Dot (bottom-right corner overlay) ── */

.tile-enc-dot {
  position: absolute;
  bottom: 8px;
  right: 10px;
  z-index: 2;
  line-height: 1;
}

.tile-enc-dot .enc-icon {
  width: 8px;
  height: 8px;
}

.tile-size {
  white-space: nowrap;
}

/* ── Tile Thumbnail Badges (bottom-left overlay) ── */

.tile-thumb-badges {
  position: absolute;
  bottom: 3px;
  left: 3px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  z-index: 2;
  max-width: calc(100% - 6px);
}

.tile-thumb-badges .file-badge {
  font-size: 0.65em;
  padding: 2px 6px;
  margin-left: 0;
  background: rgba(10, 10, 10, 0.85);
  border-radius: 4px;
  opacity: 0.85;
}

.tile-thumb-badges .trash-countdown {
  font-size: 0.72em;
  padding: 2px 7px;
  border-radius: 4px;
  opacity: 0.85;
}

/* ── Tile Actions Overlay ── */

.tile-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 20;
}

.tile-actions .action-btn {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid #333;
  border-radius: 6px;
  z-index: 21;
}

.tile-actions .action-btn svg {
  width: 14px;
  height: 14px;
}

.tile-actions .action-btn:hover {
  border-color: #555;
  background: rgba(30, 30, 30, 0.95);
}

/* ── Trash Tile ── */

.trash-tile {
  opacity: 0.85;
}

.trash-tile:hover {
  opacity: 1;
}

.trash-tile .tile-thumb-badges .trash-countdown {
  font-size: 0.72em;
  padding: 2px 7px;
}

/* ── Tile Grid Responsive ── */

/* ── Phase 3: Table Responsiveness ── */

/* 3a: index.html temp uploads browser — responsive grid (mirrors dashboard breakpoints) */
/* 3b: files.html table */
/* 3c: admin tables — already have overflow-x: auto on wrapper */
/* ── Phase 4: Modal, Toast & Overlay Mobile Fixes ── */

/* -- 768px: Align overlays and modals to top so virtual keyboard doesn't cover them -- */
/* -- 480px: Tighter sizing for small phones -- */
/* ── Phase 5: Dashboard Topbar Responsive ── */

@media (max-width: 1200px) {
  /* ── Hide text labels in topbar buttons, keep icons ── */
  .btn-new-folder span,
  .btn-upload span,
  .btn-browse-download span,
  .btn-restore-all span,
  .btn-empty-trash span {
    display: none;
  }

  .btn-new-folder,
  .btn-upload,
  .btn-browse-download,
  .btn-restore-all,
  .btn-empty-trash {
    padding: 8px;
    gap: 0;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
  }

  .btn-new-folder svg,
  .btn-upload svg,
  .btn-browse-download svg,
  .btn-restore-all svg,
  .btn-empty-trash svg {
    width: 16px;
    height: 16px;
  }

  /* ── View toggle: match other topbar button sizes ── */
  .view-toggle {
    padding: 2px;
  }

  .view-toggle-btn {
    width: 32px;
    height: 30px;
  }

  .view-toggle-btn svg {
    width: 16px;
    height: 16px;
  }

  /* ── Collapsible Search (icon-only by default) ── */
  .search-box {
    order: 0;
    width: auto;
    position: static;
  }

  .search-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #e0e0e0;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
    padding: 0;
  }

  .search-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
  }

  .search-toggle-btn svg {
    width: 16px;
    height: 16px;
    opacity: 0.75;
  }

  /* Hide the text input by default */
  .search-input {
    display: none;
  }

  /* ── Expanded Search Overlay ── */
  .search-box.expanded {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 2100;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #141414;
    border-bottom: 1px solid #333;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  }

  .search-box.expanded .search-toggle-btn {
    display: flex;
    background: rgba(255, 255, 255, 0.08);
    border-color: #444;
  }

  .search-box.expanded .search-toggle-btn svg {
    opacity: 1;
  }

  .search-box.expanded .search-input {
    display: block;
    flex: 1;
    width: 100% !important;
    background: rgba(30, 30, 30, 0.9);
    border-color: #444;
    font-size: 14px;
    padding: 10px 14px;
  }

  .search-box.expanded .search-input:focus {
    width: 100% !important;
    border-color: #DE1833;
  }

  .search-box.expanded .search-results {
    position: fixed;
    top: 57px;
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100vh - 57px);
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin-top: 0;
  }

  /* Backdrop behind expanded search */
  .search-backdrop {
    display: none;
  }

  .search-backdrop.active {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2050;
  }

  .search-results {
    width: calc(100vw - 32px);
    left: 0;
    right: auto;
  }

  body.search-open {
    overflow: hidden;
  }
}

/* ── Breadcrumb drops to its own row ── */

/* Search backdrop hidden on desktop */
.search-backdrop {
  display: none;
}

/* ── Phase 6: Bulk Actions Bar Mobile ── */

@media (max-width: 400px) {
  .bulk-btn {
    font-size: 0;
    padding: 8px 10px;
    gap: 0;
  }

  .bulk-btn svg {
    font-size: initial;
    width: 14px;
    height: 14px;
  }
}

/* ── Phase 7: Touch Target Sizes ── */

/* ── Phase 8: Footer Stacking ── */

/* ── Phase 9: E2E Panel & Misc Fixes ── */

/* ── Phase 10: Touch-friendly Context Menu Positioning ── */

/* ── Global Mobile Tweaks ── */

/* ── Phase 11: Manage Page Mobile Optimization ── */

/* =============================================
   MUSIC PLAYER
   ============================================= */
.music-player {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1500;
  width: auto;
  max-width: none;
  background: rgba(12, 12, 12, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  user-select: none;
  transition: left 0.2s ease;
}

/* Hidden on desktop — only shown on mobile (<=850px) */
.mp-mobile-close { display: none; }

.music-player.mp-visible {
  display: block;
  animation: mpSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.music-player.mp-hiding {
  display: block;
  animation: mpSlideOut 0.2s ease-in forwards;
}

@keyframes mpSlideIn {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes mpSlideOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(100%); }
}

.music-player-main {
  display: grid;
  grid-template-columns: 20px 48px minmax(120px, 0.5fr) minmax(280px, 1.3fr) auto;
  grid-template-rows: auto auto;
  gap: 2px 16px;
  padding: 8px 24px 8px 12px;
  align-items: center;
}

.music-player-art {
  grid-row: 1 / 3;
  grid-column: 2;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: rgba(222, 24, 51, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #DE1833;
}
.music-player-art img {
  width: 48px;
  height: 48px;
}

.music-player-info {
  grid-row: 1 / 3;
  grid-column: 3;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.music-player-title-wrap {
  overflow: hidden;
  max-width: 100%;
  -webkit-mask-image: none;
  mask-image: none;
  flex: 0 1 auto;
  min-width: 0;
  max-width: fit-content;
}

.music-player-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  position: relative;
}

.music-player-artist {
  display: block;
  font-size: 12px;
  color: #888;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  margin-top: 2px;
}

.mp-title-inner {
  display: inline;
  white-space: nowrap;
}

.music-player-title.mp-title-scrolling {
  text-overflow: clip;
  overflow: visible;
}

.music-player-title.mp-title-scrolling .mp-title-inner {
  animation: mpMarquee var(--mp-scroll-duration, 10s) linear infinite;
}

@keyframes mpMarquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ─── Visualizer Canvas ──────────────────────────── */
.mp-visualizer {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 8px;
  right: 8px;
  height: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: 10px 10px 0 0;
}

.mp-fx-active {
  overflow: visible !important;
}

.mp-fx-active .mp-visualizer {
  display: block;
  height: 36px;
  transition: height 0.3s ease;
}

/* ─── Chaos Mode (Easter Egg) ──────────────────────── */
.mp-fx-chaos .mp-visualizer {
  height: 85vh;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.4) 8%, rgba(0,0,0,0.85) 15%, black 22%);
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.4) 8%, rgba(0,0,0,0.85) 15%, black 22%);
}

@keyframes mp-chaos-wiggle {
  0%   { transform: rotate(0deg) scale(1); }
  15%  { transform: rotate(-15deg) scale(1.3); }
  30%  { transform: rotate(12deg) scale(1.2); }
  45%  { transform: rotate(-10deg) scale(1.15); }
  60%  { transform: rotate(8deg) scale(1.1); }
  80%  { transform: rotate(-4deg) scale(1.05); }
  100% { transform: rotate(0deg) scale(1); }
}

.mp-btn-chaos-wiggle {
  animation: mp-chaos-wiggle 0.6s ease;
  color: #ff4466 !important;
}

.mp-controls-divider {
  width: 30px;
  flex-shrink: 0;
}

.music-player-progress-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.music-player-time {
  font-size: 11px;
  color: #999;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: center;
}

.music-player-progress {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.music-player-progress::-moz-range-progress {
  background: rgba(222, 24, 51, 0.85);
  border-radius: 2px;
  height: 4px;
}

.music-player-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #DE1833;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 4px rgba(222, 24, 51, 0.4);
  transition: transform 0.15s ease;
  margin-top: -4px;
}

.music-player-progress::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.music-player-progress::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #DE1833;
  cursor: pointer;
  border: none;
}

.music-player-progress::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
}

.music-player-progress::-moz-range-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  border: none;
}

.music-player-controls {
  grid-row: 1;
  grid-column: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.music-player-right {
  grid-row: 1 / 3;
  grid-column: 5;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.music-player-volume {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.music-player-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 14px;
  background: transparent;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.music-player-volume-slider::-webkit-slider-runnable-track {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.music-player-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #999;
  cursor: pointer;
  border: none;
  margin-top: -6px;
}

.music-player-volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #999;
  cursor: pointer;
  border: none;
}

.music-player-volume-slider::-moz-range-track {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  border: none;
}

/* Player buttons */
.mp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #aaa;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}

@media (hover: hover) {
  .mp-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
  }
}
@media (hover: none) {
  .mp-btn:hover {
    background: transparent;
  }
  .mp-btn:active {
    color: #fff;
  }
}

.mp-btn-sm {
  width: 28px;
  height: 28px;
}

.mp-btn-play {
  width: 36px;
  height: 36px;
  background: rgba(222, 24, 51, 0.15);
  color: #DE1833;
  border-radius: 50%;
}

@media (hover: hover) {
  .mp-btn-play:hover {
    background: rgba(222, 24, 51, 0.3);
    color: #DE1833;
  }
}
@media (hover: none) {
  .mp-btn-play:hover {
    background: rgba(222, 24, 51, 0.15);
  }
  .mp-btn-play:active {
    color: #DE1833;
  }
}

.mp-btn-active {
  color: #DE1833 !important;
}

.mp-btn-accent {
  color: #DE1833 !important;
}

.music-player-close {
  opacity: 0.5;
}

.music-player-close:hover {
  opacity: 1;
  color: #DE1833;
}

/* Playlist Panel — overlay above the music bar */
.mp-playlist-panel {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: rgba(12, 12, 12, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
  z-index: 1;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.mp-playlist-panel.mp-playlist-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.mp-playlist-header {
  padding: 8px 14px;
  font-size: 10px;
  font-weight: 700;
  color: #555;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  background: rgba(12, 12, 12, 0.98);
}

.mp-playlist-list {
  padding: 0 6px 6px;
}

.mp-playlist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.mp-playlist-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.mp-playlist-current {
  background: rgba(222, 24, 51, 0.1);
}

.mp-playlist-current:hover {
  background: rgba(222, 24, 51, 0.15);
}

.mp-playlist-num {
  font-size: 10px;
  color: #555;
  min-width: 18px;
  text-align: right;
}

.mp-playlist-current .mp-playlist-num {
  color: #DE1833;
}

.mp-playlist-name {
  font-size: 11px;
  color: #bbb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.mp-playlist-current .mp-playlist-name {
  color: #eee;
}

.mp-playlist-ext {
  color: #555;
}

.mp-playlist-e2e {
  font-size: 8px;
  font-weight: 700;
  color: #DE1833;
  background: rgba(222, 24, 51, 0.12);
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.mp-playlist-empty {
  padding: 16px;
  text-align: center;
  font-size: 11px;
  color: #444;
}

.mp-playlist-divider {
  padding: 10px 12px 4px;
  font-size: 9px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-top: 1px solid #222;
  margin-top: 4px;
  user-select: none;
}

.mp-playlist-divider span {
  display: inline-block;
  opacity: 0.7;
}

.mp-playlist-suggested {
  opacity: 0.85;
}

/* Scrollbar in playlist */
.mp-playlist-panel::-webkit-scrollbar {
  width: 4px;
}

.mp-playlist-panel::-webkit-scrollbar-track {
  background: transparent;
}

.mp-playlist-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

/* ─── Devices Panel (Cross-Device Sync) ──────────────────────────── */
.mp-devices-panel {
  position: absolute;
  bottom: 100%;
  right: 0;
  width: 280px;
  max-height: 320px;
  overflow-y: auto;
  background: rgba(12, 12, 12, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
  z-index: 2;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.mp-devices-panel.mp-devices-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.mp-devices-header {
  padding: 10px 14px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #555;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  background: rgba(12, 12, 12, 0.98);
}
.mp-devices-list {
  padding: 0 6px 6px;
}
.mp-device-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.mp-device-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.mp-device-item:active {
  background: rgba(255, 255, 255, 0.12);
}
.mp-device-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}
.mp-device-item.mp-device-active .mp-device-icon {
  color: #1DB954;
}
.mp-device-info {
  flex: 1;
  min-width: 0;
}
.mp-device-name {
  font-size: 12px;
  font-weight: 600;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-device-item.mp-device-active .mp-device-name {
  color: #1DB954;
}
.mp-device-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #666;
  text-transform: uppercase;
  margin-top: 1px;
}
.mp-device-badge-active {
  color: #1DB954;
}
.mp-device-badge-transfer {
  color: #888;
  font-style: italic;
}
.mp-device-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.mp-device-action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #555;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mp-device-action-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.mp-device-transfer-btn {
  margin-top: 6px;
  width: 100%;
  padding: 8px 12px;
  background: rgba(29, 185, 84, 0.15);
  color: #1DB954;
  border: 1px solid rgba(29, 185, 84, 0.25);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.mp-device-transfer-btn:hover {
  background: rgba(29, 185, 84, 0.25);
  border-color: rgba(29, 185, 84, 0.4);
}
.mp-device-rename-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #ccc;
  font-size: 12px;
  padding: 3px 6px;
  width: 100%;
  outline: none;
  font-family: inherit;
}
.mp-device-rename-input:focus {
  border-color: rgba(255, 255, 255, 0.2);
}
.mp-devices-sync-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  margin: 0 2px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.mp-devices-sync-label {
  font-size: 11px;
  color: #777;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.mp-sync-toggle {
  position: relative;
  width: 32px;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.2s ease;
  border: none;
  padding: 0;
}
.mp-sync-toggle.mp-sync-on {
  background: rgba(29, 185, 84, 0.5);
}
.mp-sync-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #888;
  transition: transform 0.2s ease, background 0.2s ease;
}
.mp-sync-toggle.mp-sync-on::after {
  transform: translateX(14px);
  background: #1DB954;
}

/* Sync active indicator on devices button */
#mpDevicesBtn.mp-sync-active {
  color: #1DB954;
}
#mpDevicesBtn.mp-sync-active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1DB954;
}

/* Phantom player mode: subtle visual difference */
.music-player.mp-phantom .music-player-art {
  opacity: 0.7;
}
.mp-phantom-label {
  display: none;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #1DB954;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.music-player.mp-phantom .mp-phantom-label {
  display: block;
}

/* Scrollbar for devices panel */
.mp-devices-panel::-webkit-scrollbar {
  width: 4px;
}
.mp-devices-panel::-webkit-scrollbar-track {
  background: transparent;
}
.mp-devices-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

/* Offset main content when music player is visible (avoid content behind bottom bar) */
body.music-player-active .mega-main {
  padding-bottom: 120px;
}
/* Offset base.html pages and notes content when music player is visible */
body.music-player-active .main {
  padding-bottom: 100px;
}
/* Notes page: sidebars span full height, content areas get bottom padding */
body.music-player-active .notes-sidebar-nav {
  padding-bottom: 80px;
}
body.music-player-active .notes-list-panel .notes-list-body {
  padding-bottom: 90px;
}
body.music-player-active .notes-editor-panel {
  padding-bottom: 90px;
}

/* ─── Music Player: sidebar becomes drawer at <=850px, reset offset ── */
/* ─── Music Player Mobile Responsive ─────────────────────────── */
/* ─── Notification Wall Banners ──────────────────────────────── */
.notif-wall-container {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 720px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}

.notif-wall {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 44px 14px 18px;
  border-radius: 10px;
  color: #fff;
  pointer-events: auto;
  background: rgba(18, 18, 22, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid color-mix(in srgb, var(--notif-accent, #DE1833) 45%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--notif-accent, #DE1833) 15%, transparent),
    0 0 20px 3px color-mix(in srgb, var(--notif-accent, #DE1833) 18%, transparent),
    0 8px 32px rgba(0,0,0,0.4);
  animation: notifSlideIn 0.35s ease-out;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.notif-wall.notif-fade-out {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.notif-wall-inner {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.notif-wall-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--notif-accent, #DE1833);
  text-shadow: 0 0 8px color-mix(in srgb, var(--notif-accent, #DE1833) 50%, transparent);
  line-height: 1.3;
}

.notif-wall-text {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  opacity: 0.95;
  color: #e8e8e8;
  text-shadow: none;
  word-break: break-word;
}

.notif-wall-close {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.notif-wall-close:hover {
  color: rgba(255,255,255,0.9);
}

@keyframes notifSlideIn {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Notes App ────────────────────────────────────────────────────── */

html:has(.notes-app) {
  overflow: hidden;
}
body:has(.notes-app) {
  overflow: hidden;
}

body:has(.notes-app) .header {
  z-index: 9100;
}

.main:has(.notes-app) {
  padding: 0;
}

.notes-app {
  display: flex;
  height: calc(100vh - 52px);
  background: #0a0a0a;
  overflow: hidden;
  position: relative;
}

/* ─── Sidebar ────────────────────────────────────────────────────── */

.notes-sidebar {
  width: 260px;
  min-width: 260px;
  background: #111;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notes-sidebar-header {
  display: flex;
  align-items: center;
  padding: 0 12px 0 10px;
  height: 38px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 8px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.notes-sidebar-header h2 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #555;
  margin: 0;
  flex: 1;
}

/* ─── Collapse Toggle ────────────────────────────────────────────── */

.notes-collapse-toggle {
  background: none;
  border: none;
  color: #444;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  border-radius: 4px;
  transition: color 0.15s ease, transform 0.2s ease;
}

.notes-collapse-toggle:hover {
  color: #aaa;
}

.notes-sidebar-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: #666;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.notes-sidebar-btn:hover {
  color: #DE1833;
  border-color: #DE1833;
  background: none;
}

/* ─── Collapsed Vertical Label ────────────────────────────────────── */

.notes-collapsed-label {
  position: absolute;
  top: 40px;
  left: 0;
  width: 40px;
  bottom: 0;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  color: #444;
  user-select: none;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 1;
}

.notes-collapsed-label:hover {
  color: #888;
}

/* ─── Collapsed Sidebar ─────────────────────────────────────────── */

.notes-sidebar {
  transition: width 0.2s ease, min-width 0.2s ease;
  position: relative;
}

.notes-sidebar.collapsed {
  width: 40px;
  min-width: 40px;
}

.notes-sidebar.collapsed .notes-collapsed-label {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.2s ease 0.1s;
}

.notes-sidebar.collapsed .notes-sidebar-header {
  padding: 0;
  justify-content: center;
}

.notes-sidebar.collapsed .notes-sidebar-header h2,
.notes-sidebar.collapsed .notes-sidebar-btn {
  display: none;
}

.notes-sidebar.collapsed .notes-collapse-toggle {
  transform: rotate(180deg);
}

.notes-sidebar.collapsed .notes-sidebar-nav,
.notes-sidebar.collapsed .notes-sidebar-bottom {
  display: none;
}

/* ─── Collapsed List Panel ───────────────────────────────────────── */

.notes-list-panel {
  transition: width 0.2s ease, min-width 0.2s ease;
  position: relative;
}

.notes-list-panel.collapsed {
  width: 40px;
  min-width: 40px;
}

.notes-list-panel.collapsed .notes-collapsed-label {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.2s ease 0.1s;
}

.notes-list-panel.collapsed .notes-list-header-row:first-child {
  padding: 0;
  justify-content: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.notes-list-panel.collapsed .notes-header-default,
.notes-list-panel.collapsed .notes-header-search,
.notes-list-panel.collapsed .notes-mobile-menu {
  display: none !important;
}

.notes-list-panel.collapsed .notes-collapse-toggle {
  transform: rotate(180deg);
}

.notes-list-panel.collapsed .notes-list-body {
  display: none;
}

.notes-list-panel.collapsed .notes-list-header {
  border-bottom: none;
}

.notes-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.notes-sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  color: #808080;
  font-size: 13px;
  font-weight: 450;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  border-radius: 8px;
  position: relative;
  user-select: none;
}

.notes-sidebar-item:hover {
  color: #d0d0d0;
  background: rgba(255,255,255,0.04);
}

.notes-sidebar-item.active {
  color: #c0c0c0;
  font-weight: 500;
  background: rgba(255,255,255,0.04);
}

.notes-sidebar-item svg {
  flex-shrink: 0;
  color: #555;
  transition: color 0.15s ease;
}

.notes-sidebar-item:hover svg {
  color: #888;
}

.notes-sidebar-item.active svg {
  color: #DE1833;
}

.notes-sidebar-count {
  margin-left: auto;
  font-size: 10px;
  color: #555;
  min-width: 16px;
  text-align: center;
  background: rgba(255,255,255,0.04);
  padding: 1px 5px;
  border-radius: 8px;
}

.notes-nb-color {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: center;
}

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

.notes-sidebar-bottom {
  flex-shrink: 0;
}

.notes-sidebar-backdrop {
  display: none;
}

/* ─── Note List Panel ────────────────────────────────────────────── */

.notes-list-panel {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0d0d0d;
}

.notes-list-header {
  background: #111;
  flex-shrink: 0;
  position: relative;
}

.notes-list-header-row {
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 38px;
  box-sizing: border-box;
  gap: 8px;
}

.notes-list-header-row:first-child {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.notes-list-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #555;
  margin: 0;
  flex: 1;
}

.notes-list-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 0 8px;
  flex: 1;
  min-width: 0;
  height: 28px;
}

.notes-list-search svg {
  color: #555;
  flex-shrink: 0;
}

.notes-list-search input {
  background: none;
  border: none;
  outline: none;
  color: #e0e0e0;
  font-size: 11px;
  font-family: inherit;
  letter-spacing: 0.5px;
  padding: 0;
  width: 100%;
}

.notes-list-search input::placeholder {
  color: #444;
}

.notes-sort-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  color: #666;
  font-size: 10px;
  font-family: inherit;
  letter-spacing: 0.5px;
  padding: 0 6px;
  height: 28px;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}

.notes-sort-select option {
  background: #1a1a1a;
  color: #e0e0e0;
}

/* Search toggle button in list panel header */
.notes-search-toggle-btn {
  background: none;
  border: none;
  border-radius: 6px;
  color: #555;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.notes-search-toggle-btn:hover {
  color: #d0d0d0;
  background: rgba(255,255,255,0.04);
}

/* Search close (X) button */
.notes-search-close-btn {
  background: none;
  border: none;
  border-radius: 6px;
  color: #555;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.notes-search-close-btn:hover {
  color: #DE1833;
  background: rgba(222, 24, 51, 0.08);
}

/* Inline search: hidden by default, shown when header has .searching */
.notes-header-search {
  display: none;
}

.notes-list-header.searching .notes-header-search {
  display: flex;
}

.notes-list-header.searching .notes-header-default {
  display: none;
}

.notes-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: #666;
  width: 28px;
  height: 28px;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.notes-new-btn:hover {
  color: #DE1833;
  border-color: #DE1833;
}

.notes-new-btn svg {
  flex-shrink: 0;
}

.notes-list-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.notes-list-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #444;
  padding: 10px 10px 4px;
}

.notes-card {
  padding: 10px 10px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  border-left: 3px solid transparent;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.notes-card:hover {
  background: rgba(255,255,255,0.03);
}

.notes-card-active {
  background: rgba(255,255,255,0.05);
  border-left-color: #DE1833;
}

.notes-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notes-card-title {
  font-size: 12px;
  font-weight: 500;
  color: #d0d0d0;
  letter-spacing: 0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 0;
  min-width: 40px;
}

.notes-card:hover .notes-card-title {
  color: #fff;
}

.notes-card-size {
  font-size: 9px;
  color: #444;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
  padding-left: 8px;
}

.notes-card-pin {
  color: #DE1833;
  flex-shrink: 0;
}

.notes-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  gap: 8px;
}

.notes-card-time {
  font-size: 10px;
  color: #444;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ─── Notes: Tag Pills (on note cards) ───────────────────────────── */
.notes-card-tags {
  display: inline-flex;
  gap: 3px;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}

.notes-tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #fff;
  line-height: 1.4;
  white-space: nowrap;
}

.notes-tag-pill-editable {
  cursor: default;
  padding-right: 4px;
}

.notes-tag-remove {
  margin-left: 3px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.1s ease;
}

.notes-tag-remove:hover {
  opacity: 1;
}

/* ─── Notes: Tag Bar (in note header) ────────────────────────────── */
/* notes-tag-bar replaced by notes-title-row + notes-tag-inline */

.notes-tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.notes-tag-add-btn {
  background: none;
  border: 1px dashed #333;
  border-radius: 3px;
  color: #555;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.notes-tag-add-btn:hover {
  border-color: #666;
  color: #aaa;
}

.notes-tag-editor {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  background: rgba(22,22,22,0.9);
  border: 1px solid #333;
  border-radius: 6px;
}

.notes-tag-name-input {
  width: 100px;
  background: #111;
  border: 1px solid #333;
  border-radius: 3px;
  color: #e0e0e0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  outline: none;
  text-transform: uppercase;
}

.notes-tag-name-input:focus {
  border-color: #555;
}

.notes-tag-color-swatches {
  display: flex;
  gap: 2px;
}

.notes-tag-color-sw {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.1s ease;
  padding: 0;
}

.notes-tag-color-sw:hover {
  transform: scale(1.2);
}

.notes-tag-color-sw.active {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
}

.notes-tag-save-btn {
  background: #DE1833;
  border: none;
  border-radius: 3px;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.notes-tag-save-btn:hover {
  background: #c51530;
}

.notes-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 20px;
  color: #6a6a6a;
  text-align: center;
}

.notes-list-empty svg {
  margin-bottom: 12px;
  opacity: 0.55;
}

.notes-list-empty p {
  font-size: 11px;
  letter-spacing: 1px;
}

.notes-mobile-menu {
  display: none;
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 4px;
}

/* ─── Editor Panel ───────────────────────────────────────────────── */

.notes-editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0a0a0a;
  position: relative;
}

.notes-back-btn {
  display: none;
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
  margin-right: 4px;
  transition: color 0.15s ease;
}

.notes-back-btn:hover {
  color: #e0e0e0;
}

.notes-save-status {
  font-size: 10px;
  letter-spacing: 1px;
  font-weight: 500;
  padding: 0 4px;
  white-space: nowrap;
}

.notes-status-saved { color: #777; }
.notes-status-saving { color: #F1C40F; }
.notes-status-unsaved { color: #888; }
.notes-status-error { color: #DE1833; }

.notes-action-btn {
  background: none;
  border: none;
  border-radius: 4px;
  color: #555;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.12s ease;
  flex-shrink: 0;
}

.notes-action-btn:hover {
  color: #e0e0e0;
  background: rgba(255,255,255,0.06);
}

.notes-action-btn.notes-active {
  color: #DE1833;
}

.notes-action-danger:hover {
  color: #DE1833;
  background: rgba(222,24,51,0.08);
}

.notes-color-picker {
  position: relative;
}

.notes-color-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px;
  gap: 6px;
  flex-wrap: wrap;
  z-index: 100;
  width: 140px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.notes-color-dropdown.show {
  display: flex;
}

.notes-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.notes-color-dot:hover {
  transform: scale(1.2);
  border-color: rgba(255,255,255,0.3);
}

/* ─── Editor Body ────────────────────────────────────────────────── */

.notes-editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notes-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 12px;
  min-height: 41px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  flex-shrink: 0;
  gap: 0;
  box-sizing: border-box;
}

.notes-title-input {
  background: none;
  border: none;
  outline: none;
  color: #e0e0e0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 0;
  height: 41px;
  font-family: inherit;
  width: 120px;
  min-width: 120px;
  max-width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
}

.notes-title-input::placeholder {
  color: #2a2a2a;
}

.notes-tag-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  flex-shrink: 1;
  min-width: 0;
  flex-wrap: wrap;
  padding: 4px 0;
}

.notes-tag-editor-row {
  padding: 0 12px;
  flex-shrink: 0;
}

/* ─── Toolbar ────────────────────────────────────────────────────── */

.notes-toolbar {
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-wrap: nowrap;
  background: #111;
  height: 38px;
  box-sizing: border-box;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.notes-toolbar::-webkit-scrollbar {
  display: none;
}

.notes-toolbar-group {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

.notes-toolbar-sep {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.06);
  margin: 0 6px;
  flex-shrink: 0;
}

.notes-toolbar-right {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding-left: 12px;
  flex-shrink: 0;
  position: sticky;
  right: 0;
  background: #111;
  box-shadow: -10px 0 10px -4px #111;
}

.notes-tool-btn {
  background: none;
  border: none;
  border-radius: 4px;
  color: #7a7a7a;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  flex-shrink: 0;
}

.notes-tool-btn:hover {
  color: #e0e0e0;
  background: rgba(255,255,255,0.06);
}

.notes-tool-btn.notes-tool-disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

.notes-undo-btn {
  margin-right: 0;
}
.notes-redo-btn {
  margin-right: 2px;
}

.notes-tool-btn strong,
.notes-tool-btn em,
.notes-tool-btn u,
.notes-tool-btn s {
  font-size: 13px;
  pointer-events: none;
}

/* ─── Document Container (gutter + content + preview) ────────────── */

.notes-doc-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.notes-line-gutter {
  width: 40px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  text-align: right;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  border-right: 1px solid rgba(255,255,255,0.04);
  background: rgba(255,255,255,0.01);
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.notes-line-gutter::-webkit-scrollbar {
  display: none;
}

.notes-line-gutter-inner {
  position: relative;
  width: 100%;
}

.notes-line-gutter.hidden {
  display: none;
}

.notes-line-num {
  position: absolute;
  right: 0;
  font-size: 11px;
  font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
  color: #2a2a2a;
  padding: 0 8px 0 0;
  line-height: 23.8px;
  transition: color 0.15s ease;
  white-space: nowrap;
}

.notes-line-num.active {
  color: #666;
}

/* ─── Content Area ───────────────────────────────────────────────── */

.notes-content-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px 24px 40px;
  color: #d0d0d0;
  font-size: 14px;
  line-height: 1.7;
  outline: none;
  min-height: 200px;
  position: relative;
}

.notes-content-area.notes-content-readonly {
  cursor: default;
  background: linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0));
}

/* ─── Markdown Preview ───────────────────────────────────────────── */

.notes-md-preview {
  flex: 1;
  overflow-y: auto;
  padding: 12px 24px 40px;
  color: #d0d0d0;
  font-size: 14px;
  line-height: 1.7;
  min-height: 200px;
  cursor: text;
  position: relative;
}

.notes-md-preview h1 {
  font-size: 24px;
  font-weight: 600;
  color: #e0e0e0;
  margin: 16px 0 8px;
  letter-spacing: 0.3px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.notes-md-preview h2 {
  font-size: 19px;
  font-weight: 600;
  color: #d8d8d8;
  margin: 14px 0 6px;
  letter-spacing: 0.3px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.notes-md-preview h3 {
  font-size: 16px;
  font-weight: 600;
  color: #ccc;
  margin: 12px 0 4px;
  letter-spacing: 0.3px;
}

.notes-md-preview h4 {
  font-size: 14px;
  font-weight: 600;
  color: #bbb;
  margin: 10px 0 4px;
}

.notes-md-preview p {
  margin: 8px 0;
}

.notes-md-preview .notes-md-blank-line {
  height: 1em;
  line-height: 1.7;
  margin: 0;
  color: transparent;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.notes-md-preview blockquote {
  border-left: 3px solid #DE1833;
  margin: 12px 0;
  padding: 8px 16px;
  background: rgba(222,24,51,0.04);
  color: #aaa;
  border-radius: 0 6px 6px 0;
}

.notes-md-preview blockquote p {
  margin: 4px 0;
}

.notes-md-preview a {
  color: #DE1833;
  text-decoration: underline;
  text-decoration-color: rgba(222,24,51,0.3);
}

.notes-md-preview a:hover {
  text-decoration-color: #DE1833;
}

.notes-md-preview ul,
.notes-md-preview ol {
  padding-left: 24px;
  margin: 8px 0;
}

.notes-md-preview li {
  margin: 3px 0;
}

.notes-md-preview li > ul,
.notes-md-preview li > ol {
  margin: 2px 0;
}

.notes-md-preview hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 16px 0;
}

.notes-md-preview img {
  max-width: 100%;
  border-radius: 6px;
  margin: 8px 0;
}

.notes-md-preview code {
  font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  background: rgba(255,255,255,0.06);
  color: #e06c75;
  padding: 2px 6px;
  border-radius: 3px;
}

.notes-md-preview pre {
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 12px 0;
  overflow-x: auto;
}

.notes-md-preview pre code {
  background: none;
  color: #c9d1d9;
  padding: 0;
  border-radius: 0;
  font-size: 13px;
  line-height: 1.6;
}

.notes-md-preview strong {
  color: #e0e0e0;
  font-weight: 600;
}

.notes-md-preview em {
  font-style: italic;
  color: #c8c8c8;
}

.notes-md-preview del {
  color: #666;
}

.notes-md-preview table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
}

.notes-md-preview th,
.notes-md-preview td {
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  text-align: left;
}

.notes-md-preview th {
  background: rgba(255,255,255,0.03);
  font-weight: 600;
  color: #ccc;
}

.notes-md-preview .notes-md-task {
  list-style: none;
  margin-left: -20px;
}

.notes-md-preview .notes-md-task input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid #555;
  border-radius: 3px;
  background: none;
  vertical-align: middle;
  margin-right: 6px;
  position: relative;
  top: -1px;
}

.notes-md-preview .notes-md-task input[type="checkbox"]:checked {
  background: #DE1833;
  border-color: #DE1833;
}

.notes-md-preview .notes-md-task input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

/* ─── Document Toggle Controls ───────────────────────────────────── */

.notes-doc-toggles {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notes-toggle-label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.12s ease;
}

.notes-toggle-label:hover {
  background: rgba(255,255,255,0.04);
}

.notes-toggle-label input[type="checkbox"] {
  display: none;
}

.notes-toggle-check {
  width: 14px;
  height: 14px;
  border: 1.5px solid #333;
  border-radius: 3px;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.notes-toggle-label input:checked + .notes-toggle-check {
  background: #DE1833;
  border-color: #DE1833;
}

.notes-toggle-label input:checked + .notes-toggle-check::after {
  content: '';
  position: absolute;
  left: 3.5px;
  top: 1px;
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.notes-toggle-text {
  font-size: 10px;
  font-weight: 600;
  color: #444;
  letter-spacing: 0.5px;
  font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
  transition: color 0.15s ease;
}

.notes-toggle-label input:checked ~ .notes-toggle-text {
  color: #777;
}

/* ─── Edit MD Button (shown during markdown preview) ─────────────── */

.notes-edit-md-btn {
  background: none;
  border: 1px solid #DE1833;
  color: #DE1833;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  margin-left: 4px;
}

.notes-edit-md-btn:hover {
  background: #DE1833;
  color: #fff;
}

.notes-content-area:empty::before {
  content: attr(data-placeholder);
  color: #333;
  font-size: 13px;
  letter-spacing: 1px;
  pointer-events: none;
}

.notes-content-area h1 {
  font-size: 24px;
  font-weight: 600;
  color: #e0e0e0;
  margin: 16px 0 8px;
  letter-spacing: 0.3px;
}

.notes-content-area h2 {
  font-size: 19px;
  font-weight: 600;
  color: #d8d8d8;
  margin: 14px 0 6px;
  letter-spacing: 0.3px;
}

.notes-content-area h3 {
  font-size: 16px;
  font-weight: 600;
  color: #ccc;
  margin: 12px 0 4px;
  letter-spacing: 0.3px;
}

.notes-content-area blockquote {
  border-left: 3px solid #DE1833;
  margin: 12px 0;
  padding: 8px 16px;
  background: rgba(222,24,51,0.04);
  color: #aaa;
  border-radius: 0 6px 6px 0;
}

.notes-content-area a {
  color: #DE1833;
  text-decoration: underline;
  text-decoration-color: rgba(222,24,51,0.3);
  cursor: pointer;
}

.notes-content-area a:hover {
  text-decoration-color: #DE1833;
}

.notes-content-area ul,
.notes-content-area ol {
  padding-left: 24px;
  margin: 8px 0;
}

.notes-content-area li {
  margin: 3px 0;
}

.notes-content-area hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 16px 0;
}

.notes-content-area img {
  max-width: 100%;
  border-radius: 6px;
  margin: 8px 0;
}

/* ─── Checklist ──────────────────────────────────────────────────── */

.notes-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 0;
}

.notes-checklist-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid #555;
  border-radius: 3px;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 3px;
  transition: background 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.notes-checklist-item input[type="checkbox"]:checked {
  background: #DE1833;
  border-color: #DE1833;
}

.notes-checklist-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.notes-checklist-item.checked > span {
  text-decoration: line-through;
  color: #555;
}

.notes-checklist-item > span {
  flex: 1;
  outline: none;
  min-width: 0;
}

/* ─── Code Block ─────────────────────────────────────────────────── */

.notes-code-block {
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  margin: 12px 0;
  overflow: hidden;
}

.notes-code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: transparent;
}

.notes-code-block code {
  font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  color: #c9d1d9;
  outline: none;
  display: block;
  white-space: pre-wrap;
  line-height: 1.6;
  background: transparent !important;
  padding: 0 !important;
}

.notes-code-block code.hljs {
  background: transparent !important;
  padding: 0 !important;
}

.notes-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}

.notes-code-lang {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  color: #888;
  font-size: 10px;
  font-family: inherit;
  letter-spacing: 0.5px;
  padding: 3px 6px;
  outline: none;
  cursor: pointer;
  text-transform: uppercase;
  margin-right: auto;
}

.notes-code-lang option {
  background: #1a1a1a;
  color: #ccc;
}

.notes-code-copy {
  background: none;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  color: #555;
  font-size: 10px;
  font-family: inherit;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}

.notes-code-copy:hover {
  color: #e0e0e0;
  border-color: #555;
}

.notes-code-delete {
  background: none;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  color: #555;
  font-size: 14px;
  line-height: 1;
  padding: 2px 7px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
  margin-left: 4px;
}

.notes-code-delete:hover {
  color: #DE1833;
  border-color: #DE1833;
}

/* ─── Font Size Input ────────────────────────────────────────────── */

.notes-fontsize-wrap {
  position: relative;
  flex-shrink: 0;
  margin-left: 3px;
}

.notes-fontsize-btn {
  width: 38px;
  height: 26px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  color: #999;
  font-size: 11px;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notes-fontsize-btn:hover {
  border-color: #444;
  color: #e0e0e0;
}

.notes-fontsize-btn.active {
  border-color: #DE1833;
  color: #e0e0e0;
}

.notes-fontsize-dropdown {
  display: none;
  position: fixed;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 4px 0;
  z-index: 10001;
  max-height: 200px;
  overflow-y: auto;
  min-width: 52px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.notes-fontsize-dropdown.open {
  display: block;
}

.notes-fontsize-dropdown::-webkit-scrollbar {
  width: 4px;
}

.notes-fontsize-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.notes-fontsize-dropdown::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 2px;
}

.notes-fontsize-opt {
  display: block;
  width: 100%;
  padding: 5px 12px;
  background: none;
  border: none;
  color: #888;
  font-size: 11px;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}

.notes-fontsize-opt:hover {
  background: rgba(222,24,51,0.1);
  color: #e0e0e0;
}

.notes-fontsize-opt.active {
  color: #DE1833;
  font-weight: 600;
}

/* Canvas floating bar variant — slightly smaller */
.notes-cfmt-fontsize-wrap {
  margin: 0 1px;
}

.notes-cfmt-fontsize-btn {
  width: 34px;
  height: 22px;
  font-size: 10px;
}

.notes-cfmt-fontsize-dd {
  max-height: 180px;
}

.notes-cfmt-fontsize-dd .notes-fontsize-opt {
  font-size: 10px;
  padding: 4px 10px;
}

/* ─── Empty Editor ───────────────────────────────────────────────── */

.notes-empty-editor {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #5a5a5a;
  text-align: center;
  gap: 12px;
  position: absolute;
  inset: 0;
}

.notes-empty-editor svg {
  opacity: 0.3;
}

.notes-empty-editor p {
  font-size: 12px;
  letter-spacing: 1.5px;
  font-weight: 500;
}

/* ─── Move Modal ─────────────────────────────────────────────────── */

.notes-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.notes-modal {
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  width: 320px;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}

.notes-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.notes-modal-header h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #e0e0e0;
  margin: 0;
}

.notes-modal-close {
  background: none;
  border: none;
  color: #666;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.notes-modal-close:hover {
  color: #e0e0e0;
}

.notes-modal-body {
  overflow-y: auto;
  padding: 6px 0;
}

.notes-move-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: #bbb;
  font-size: 12px;
  font-family: inherit;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}

.notes-move-item:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

/* ─── Context Menu ───────────────────────────────────────────────── */

.notes-context-menu {
  position: fixed;
  background: rgba(26,26,26,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 4px 0;
  min-width: 160px;
  z-index: 10002;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.notes-context-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: #bbb;
  font-size: 12px;
  font-family: inherit;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.12s ease;
  text-align: left;
}

.notes-context-item:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

.notes-context-danger:hover {
  color: #DE1833;
}

.notes-context-sep {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 3px 0;
}

.notes-color-submenu {
  display: none;
  flex-wrap: wrap;
  padding: 8px;
  gap: 6px;
  min-width: auto;
  width: 140px;
}

/* ─── Trash Item Actions ─────────────────────────────────────────── */

.notes-trash-item {
  position: relative;
}

.notes-trash-item .notes-card-time {
  display: none;
}

.notes-trash-type-icon {
  flex-shrink: 0;
  color: #555;
}

.notes-trash-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 6px;
}

.notes-trash-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  color: #555;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  padding: 0;
}

.notes-trash-action-btn:hover {
  background: rgba(255,255,255,0.05);
  color: #ccc;
  border-color: rgba(255,255,255,0.15);
}

.notes-trash-restore:hover {
  color: #27AE60;
  border-color: rgba(39,174,96,0.3);
}

.notes-trash-delete:hover {
  color: #DE1833;
  border-color: rgba(222,24,51,0.3);
}

/* ─── Scrollbar Styling ──────────────────────────────────────────── */

.notes-sidebar-nav::-webkit-scrollbar,
.notes-list-body::-webkit-scrollbar,
.notes-content-area::-webkit-scrollbar,
.notes-modal-body::-webkit-scrollbar {
  width: 4px;
}

.notes-sidebar-nav::-webkit-scrollbar-track,
.notes-list-body::-webkit-scrollbar-track,
.notes-content-area::-webkit-scrollbar-track,
.notes-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.notes-sidebar-nav::-webkit-scrollbar-thumb,
.notes-list-body::-webkit-scrollbar-thumb,
.notes-content-area::-webkit-scrollbar-thumb,
.notes-modal-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
}

.notes-sidebar-nav::-webkit-scrollbar-thumb:hover,
.notes-list-body::-webkit-scrollbar-thumb:hover,
.notes-content-area::-webkit-scrollbar-thumb:hover,
.notes-modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.15);
}

/* ─── Responsive ─────────────────────────────────────────────────── */

/* ─── Notes: New Note Dropdown ───────────────────────────────────── */
.notes-new-dropdown {
  position: relative;
}

.notes-new-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 4px;
  min-width: 180px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.notes-new-menu.show {
  display: block;
}

.notes-new-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  color: #ccc;
  font-size: 12px;
  font-family: inherit;
  letter-spacing: 0.5px;
  cursor: pointer;
  border-radius: 6px;
  text-transform: uppercase;
}

.notes-new-menu-item:hover {
  background: #252525;
  color: #fff;
}

.notes-new-menu-item svg {
  opacity: 0.7;
  flex-shrink: 0;
}

.notes-new-menu-sep {
  height: 1px;
  background: #2a2a2a;
  margin: 4px 8px;
}

.notes-new-menu-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #555;
  padding: 4px 14px 2px;
  text-transform: uppercase;
}

.notes-new-menu-item[data-template] {
  padding: 8px 14px;
  font-size: 11px;
}

/* ─── Notes: Canvas Mode ─────────────────────────────────────────── */
.notes-canvas-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: contain;
}

.notes-canvas-tool {
  position: relative;
}

.notes-canvas-tool.active {
  background: #252525;
  color: #DE1833;
}

.notes-canvas-zoom {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.notes-zoom-level {
  font-size: 11px;
  color: #888;
  min-width: 44px;
  text-align: center;
  letter-spacing: 0.5px;
  user-select: none;
}

.notes-canvas-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  cursor: text;
  background: #0a0a0a;
  touch-action: none;
  overscroll-behavior: none;
}

.notes-canvas-readonly-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 25;
  display: none;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 18px;
  background: rgba(10, 10, 10, 0.08);
  pointer-events: auto;
}

.notes-canvas-readonly-overlay span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.9);
  color: #f0b060;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.notes-canvas-viewport.panning {
  cursor: grabbing;
}

.notes-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 10000px;
  height: 10000px;
  transform-origin: 0 0;
}

/* ─── Notes: Canvas Blocks ───────────────────────────────────────── */
.notes-canvas-block {
  position: absolute;
  border: 1.5px solid transparent;
  border-radius: 0 0 4px 4px;
  box-sizing: content-box;
  cursor: default;
  user-select: none;
  overflow: visible;
  transition: border-color 0.15s;
}

.notes-canvas-block:hover {
  border-color: rgba(58,58,58,0.45);
}

.notes-canvas-block-selected {
  border: 1.5px solid #3a3a3a !important;
}

.notes-canvas-block-selected .notes-canvas-handle {
  display: block;
}

.notes-canvas-block-text {
  background: transparent;
  min-width: 60px;
}

.notes-canvas-block-content {
  padding: 6px 10px;
  color: #fff;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  min-height: 1.6em;
  cursor: text;
  user-select: text;
  word-break: break-word;
}

.notes-canvas-block-content:empty::before {
  content: 'TYPE HERE...';
  color: #555;
  pointer-events: none;
}

.notes-canvas-block-content h1,
.notes-canvas-block-content h2,
.notes-canvas-block-content h3 {
  color: #fff;
  margin: 0 0 4px;
}

.notes-canvas-block-content h1 { font-size: 1.8em; }
.notes-canvas-block-content h2 { font-size: 1.4em; }
.notes-canvas-block-content h3 { font-size: 1.15em; }

.notes-canvas-block-content blockquote {
  border-left: 3px solid #DE1833;
  margin: 4px 0;
  padding: 2px 12px;
  color: #aaa;
  font-style: italic;
}

.notes-canvas-block-content a {
  color: #DE1833;
  text-decoration: underline;
  text-decoration-color: rgba(222,24,51,0.4);
  cursor: pointer;
}

.notes-canvas-block-content a:hover {
  text-decoration-color: #DE1833;
}

.notes-canvas-table td h1,
.notes-canvas-table td h2,
.notes-canvas-table td h3 {
  color: #fff;
  margin: 0;
}

.notes-canvas-table td h1 { font-size: 1.4em; }
.notes-canvas-table td h2 { font-size: 1.15em; }
.notes-canvas-table td h3 { font-size: 1em; }

.notes-canvas-table td blockquote {
  border-left: 2px solid #DE1833;
  margin: 2px 0;
  padding: 1px 8px;
  color: #aaa;
  font-style: italic;
}

.notes-canvas-table td a {
  color: #DE1833;
  text-decoration: underline;
  cursor: pointer;
}

.notes-canvas-table td a:hover {
  text-decoration-color: #DE1833;
}

.notes-canvas-block-image {
  background: transparent;
  overflow: visible;
}

.notes-canvas-block-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
  pointer-events: none;
}

/* ─── Canvas: Move Handle (sits OUTSIDE above the block, uniform with outline) ── */
.notes-canvas-move-handle {
  display: none;
  position: absolute;
  bottom: 100%;
  left: -1.5px;
  right: -1.5px;
  height: 13px;
  background: #3a3a3a;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  cursor: grab;
  z-index: 11;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.3);
  transition: background 0.15s, color 0.15s;
}

/* On hover: show the bar above the block */
.notes-canvas-block:hover .notes-canvas-move-handle {
  display: flex;
  background: rgba(58,58,58,0.55);
  color: rgba(255,255,255,0.2);
}

/* On selection: solid bar matching the outline */
.notes-canvas-block-selected .notes-canvas-move-handle {
  display: flex;
  background: #3a3a3a;
  color: rgba(255,255,255,0.4);
}

.notes-canvas-move-handle:hover {
  background: #4a4a4a !important;
  color: rgba(255,255,255,0.65) !important;
}

.notes-canvas-move-handle:active {
  cursor: grabbing;
  background: #585858 !important;
  color: #fff !important;
}

/* Grip dots in center of the move bar */
.notes-canvas-move-handle svg {
  width: 12px;
  height: 5px;
  pointer-events: none;
  opacity: 0.8;
}

/* ─── Canvas: Resize Handles ─────────────────────────────────────── */
/* Base: shared properties for all handles */
.notes-canvas-handle {
  display: none;
  position: absolute;
  background: #fff;
  border: 1.5px solid #3a3a3a;
  z-index: 12;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

/* Corner handles: small circles */
.notes-canvas-handle-nw,
.notes-canvas-handle-ne,
.notes-canvas-handle-sw,
.notes-canvas-handle-se {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Edge handles: directional pills -- wide for N/S, tall for E/W */
.notes-canvas-handle-n,
.notes-canvas-handle-s {
  width: 24px;
  height: 6px;
  border-radius: 3px;
}

.notes-canvas-handle-e,
.notes-canvas-handle-w {
  width: 6px;
  height: 24px;
  border-radius: 3px;
}

/* Corner positions */
.notes-canvas-handle-nw { top: -5px; left: -5px; cursor: nw-resize; }
.notes-canvas-handle-ne { top: -5px; right: -5px; cursor: ne-resize; }
.notes-canvas-handle-se { bottom: -5px; right: -5px; cursor: se-resize; }
.notes-canvas-handle-sw { bottom: -5px; left: -5px; cursor: sw-resize; }

/* Edge positions */
.notes-canvas-handle-n { top: -3px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.notes-canvas-handle-s { bottom: -3px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.notes-canvas-handle-e { top: 50%; right: -3px; transform: translateY(-50%); cursor: e-resize; }
.notes-canvas-handle-w { top: 50%; left: -3px; transform: translateY(-50%); cursor: w-resize; }

/* Corner hover/active */
.notes-canvas-handle-nw:hover, .notes-canvas-handle-ne:hover,
.notes-canvas-handle-sw:hover, .notes-canvas-handle-se:hover {
  transform: scale(1.3);
  box-shadow: 0 0 0 1px rgba(58,58,58,0.5), 0 2px 8px rgba(0,0,0,0.3);
}
.notes-canvas-handle-nw:active, .notes-canvas-handle-ne:active,
.notes-canvas-handle-sw:active, .notes-canvas-handle-se:active {
  transform: scale(1.1);
  background: #3a3a3a;
  border-color: #fff;
}

/* Edge hover/active */
.notes-canvas-handle-n:hover, .notes-canvas-handle-s:hover {
  transform: translateX(-50%) scaleX(1.25);
  box-shadow: 0 0 0 1px rgba(58,58,58,0.5), 0 2px 8px rgba(0,0,0,0.3);
}
.notes-canvas-handle-e:hover, .notes-canvas-handle-w:hover {
  transform: translateY(-50%) scaleY(1.25);
  box-shadow: 0 0 0 1px rgba(58,58,58,0.5), 0 2px 8px rgba(0,0,0,0.3);
}
.notes-canvas-handle-n:active, .notes-canvas-handle-s:active {
  transform: translateX(-50%) scaleX(1.1);
  background: #3a3a3a; border-color: #fff;
}
.notes-canvas-handle-e:active, .notes-canvas-handle-w:active {
  transform: translateY(-50%) scaleY(1.1);
  background: #3a3a3a; border-color: #fff;
}

/* ─── Canvas: Rotation Handle (removed from block, now in context menu) ── */

/* ─── Notes: Document Image Toolbar ──────────────────────────────── */
.notes-img-toolbar {
  display: none;
  position: fixed;
  align-items: center;
  gap: 4px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 6px 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 10000;
}

.notes-imgtool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  border: none;
  background: none;
  color: #aaa;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.5px;
  transition: background 0.15s, color 0.15s;
}

.notes-imgtool-btn:hover {
  background: #252525;
  color: #fff;
}

.notes-imgtool-danger {
  color: #DE1833;
}

.notes-imgtool-danger:hover {
  background: rgba(222, 24, 51, 0.15);
  color: #ff4060;
}

/* ─── Notes: Floating Canvas Text Format Bar ────────────────────── */
.notes-canvas-fmt {
  position: fixed;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 3px 5px;
  background: rgba(22,22,22,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 10000;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.notes-cfmt-btn {
  background: none;
  border: none;
  border-radius: 4px;
  color: #666;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  flex-shrink: 0;
  padding: 0;
}

.notes-cfmt-btn:hover {
  color: #e0e0e0;
  background: rgba(255,255,255,0.06);
}

.notes-cfmt-btn.active {
  color: #DE1833;
  background: rgba(222,24,51,0.1);
}

.notes-cfmt-btn strong,
.notes-cfmt-btn em,
.notes-cfmt-btn u,
.notes-cfmt-btn s {
  font-size: 13px;
  pointer-events: none;
}

.notes-cfmt-sep {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,0.06);
  margin: 0 3px;
  flex-shrink: 0;
}

.notes-cfmt-color {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid #333;
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}

.notes-cfmt-color::-webkit-color-swatch-wrapper {
  padding: 1px;
}

.notes-cfmt-color::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.notes-cfmt-color::-moz-color-swatch {
  border: none;
  border-radius: 2px;
}

.notes-cfmt-fill-none {
  width: 22px;
  height: 22px;
}

/* ─── Notes: Highlight Color Picker ───────────────────────────────── */
.notes-highlight-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.notes-highlight-btn {
  position: relative;
}

.notes-highlight-indicator {
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 3px;
  border-radius: 1px;
  background: transparent;
  border: 1px solid #666;
  pointer-events: none;
}

.notes-highlight-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  padding: 5px 6px;
  background: rgba(22,22,22,0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  z-index: 10002;
  margin-top: 3px;
  white-space: nowrap;
}

.notes-highlight-swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1.5px solid rgba(255,255,255,0.15);
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.notes-highlight-swatch:hover {
  transform: scale(1.15);
  border-color: rgba(255,255,255,0.4);
}

.notes-highlight-none {
  background: #1a1a1a;
  border-color: #444;
}

.notes-highlight-none:hover {
  border-color: #888;
}

.notes-highlight-none svg {
  stroke: #888;
}

/* ─── Notes: Doc Toolbar Color Inputs ────────────────────────────── */
.notes-doc-color {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border: 2px solid #333;
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}

.notes-doc-color::-webkit-color-swatch-wrapper {
  padding: 1px;
}

.notes-doc-color::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.notes-doc-color::-moz-color-swatch {
  border: none;
  border-radius: 2px;
}

/* ─── Notes: Link Editor Overlay ──────────────────────────────────── */
.notes-link-overlay {
  position: fixed;
  padding: 10px 12px;
  background: rgba(22,22,22,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.6);
  z-index: 10001;
  min-width: 240px;
  max-width: 320px;
}

.notes-link-overlay-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.notes-link-overlay-row label {
  color: #666;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  min-width: 28px;
  flex-shrink: 0;
}

.notes-link-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
  font-family: inherit;
  padding: 5px 8px;
  outline: none;
  transition: border-color 0.15s;
}

.notes-link-input:focus {
  border-color: rgba(255,255,255,0.25);
}

.notes-link-input::placeholder {
  color: #444;
}

.notes-link-overlay-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.notes-link-btn {
  flex: 1;
  padding: 4px 0;
  border: none;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.notes-link-btn-apply {
  background: #DE1833;
  color: #fff;
}

.notes-link-btn-apply:hover {
  background: #f02040;
}

.notes-link-btn-remove {
  background: rgba(255,255,255,0.08);
  color: #888;
}

.notes-link-btn-remove:hover {
  background: rgba(255,60,60,0.15);
  color: #f55;
}

.notes-link-btn-cancel {
  background: rgba(255,255,255,0.06);
  color: #666;
}

.notes-link-btn-cancel:hover {
  background: rgba(255,255,255,0.1);
  color: #aaa;
}

/* ─── Notes: Floating Canvas Image Effects Panel ─────────────────── */
.notes-canvas-imgfx {
  position: fixed;
  padding: 10px 14px;
  background: rgba(22,22,22,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 10000;
  min-width: 200px;
  max-width: 240px;
}

.notes-imgfx-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.notes-imgfx-row:last-child {
  margin-bottom: 0;
}

.notes-imgfx-row label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: #555;
  min-width: 48px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.notes-imgfx-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 3px;
  background: #2a2a2a;
  border-radius: 2px;
  outline: none;
  min-width: 50px;
}

.notes-imgfx-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #DE1833;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #161616;
}

.notes-imgfx-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #DE1833;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #161616;
}

.notes-imgfx-val {
  font-size: 10px;
  color: #777;
  min-width: 18px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.notes-imgfx-sep {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 6px 0;
}

.notes-imgfx-toggles {
  display: flex;
  gap: 3px;
}

/* ─── Notes: Document Image Selected State ───────────────────────── */
.notes-img-selected {
  outline: 2px solid #DE1833;
  outline-offset: 2px;
  cursor: pointer;
}

/* ─── Notes: Note Card Type Icon ─────────────────────────────────── */
.notes-card-type {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  opacity: 0.5;
}

.notes-card-type-placeholder {
  display: inline-block;
  width: 10px;
  margin-left: 4px;
  flex-shrink: 0;
}

/* ─── Notes: Canvas Responsive ───────────────────────────────────── */


/* ─── Notes: Canvas To-Do Block ──────────────────────────────────── */
.notes-canvas-block-todo {
  background: transparent;
  min-width: 120px;
}

.notes-canvas-todo {
  padding: 8px 10px;
  user-select: none;
}

.notes-canvas-todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  position: relative;
}

.notes-canvas-todo-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid #555;
  border-radius: 3px;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.notes-canvas-todo-item input[type="checkbox"]:checked {
  background: #DE1833;
  border-color: #DE1833;
}

.notes-canvas-todo-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.notes-canvas-todo-text {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  padding: 0;
  min-width: 40px;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.notes-canvas-todo-text::placeholder {
  color: #444;
}

.notes-canvas-todo-item.checked .notes-canvas-todo-text {
  text-decoration: line-through;
  color: #555;
}

.notes-canvas-todo-remove {
  display: none;
  background: none;
  border: none;
  color: #444;
  cursor: pointer;
  padding: 0;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  border-radius: 3px;
  transition: color 0.12s;
}

.notes-canvas-todo-item:hover .notes-canvas-todo-remove {
  display: flex;
}

.notes-canvas-todo-remove:hover {
  color: #DE1833;
}

.notes-canvas-todo-add {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 3px 0;
  background: none;
  border: none;
  color: #444;
  font-size: 11px;
  font-family: inherit;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: color 0.12s;
}

.notes-canvas-todo-add:hover {
  color: #888;
}

/* ─── Notes: Canvas Table Block ──────────────────────────────────── */
.notes-canvas-block-table {
  background: transparent;
  min-width: 120px;
  overflow: visible;
  cursor: move;
}

.notes-canvas-block-table .notes-canvas-table-wrap {
  cursor: move;
}

.notes-canvas-table-wrap {
  padding: 6px;
  position: relative;
}

.notes-canvas-table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  table-layout: fixed;
}

.notes-canvas-table td {
  border: 1px solid #333;
  padding: 8px 10px;
  color: #e0e0e0;
  font-size: 13px;
  line-height: 1.5;
  font-family: inherit;
  outline: none;
  min-width: 40px;
  height: 36px;
  vertical-align: top;
  word-break: break-word;
  background: transparent;
  cursor: text;
  user-select: text;
}

.notes-canvas-table td:focus {
  background: rgba(222,24,51,0.04);
  outline: 1px solid rgba(222,24,51,0.3);
  outline-offset: -1px;
}

.notes-canvas-table td::placeholder {
  color: #333;
}

.notes-canvas-table-add-col {
  position: absolute;
  top: 6px;
  right: -18px;
  width: 16px;
  height: calc(100% - 12px);
  background: none;
  border: 1px dashed #333;
  border-radius: 3px;
  color: #444;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
  padding: 0;
  opacity: 0;
}

.notes-canvas-block-table:hover .notes-canvas-table-add-col {
  opacity: 1;
}

.notes-canvas-table-add-col:hover {
  border-color: #DE1833;
  color: #DE1833;
  background: rgba(222,24,51,0.06);
}

.notes-canvas-table-add-row {
  position: absolute;
  left: 6px;
  bottom: -18px;
  width: calc(100% - 12px);
  height: 16px;
  background: none;
  border: 1px dashed #333;
  border-radius: 3px;
  color: #444;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
  padding: 0;
  opacity: 0;
}

.notes-canvas-block-table:hover .notes-canvas-table-add-row {
  opacity: 1;
}

.notes-canvas-table-add-row:hover {
  border-color: #DE1833;
  color: #DE1833;
  background: rgba(222,24,51,0.06);
}

/* ─── Notes: Table Size Picker ───────────────────────────────────── */
.notes-table-picker {
  position: fixed;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 10001;
}

.notes-table-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 24px);
  grid-template-rows: repeat(6, 24px);
  gap: 3px;
}

.notes-table-picker-cell {
  width: 24px;
  height: 24px;
  border: 1px solid #333;
  border-radius: 3px;
  background: none;
  cursor: pointer;
  transition: background 0.08s, border-color 0.08s, color 0.08s;
  padding: 0;
}

.notes-table-picker-cell.active {
  background: rgba(222,24,51,0.25);
  border-color: #DE1833;
}

.notes-table-picker-label {
  text-align: center;
  font-size: 11px;
  color: #888;
  letter-spacing: 0.5px;
  margin-top: 8px;
}

/* ─── Notes: Table Context Menu ──────────────────────────────────── */
.notes-table-ctx-heading {
  padding: 5px 14px 2px;
  color: #555;
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 600;
}

.notes-table-ctx-styles {
  display: flex;
  gap: 3px;
  padding: 3px 10px 5px;
}

.notes-table-style-btn {
  width: 32px;
  height: 22px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  transition: border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.notes-table-style-btn:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
}

.notes-table-style-btn.active {
  border-color: #DE1833;
  background: rgba(222,24,51,0.1);
}

.notes-table-style-btn svg {
  width: 100%;
  height: 100%;
}

/* ─── Canvas Code Block ──────────────────────────────────────────── */

.notes-canvas-block-code {
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  overflow: visible;
}

.notes-canvas-block-code .notes-canvas-code-wrap {
  overflow: hidden;
  border-radius: 8px;
}

.notes-canvas-code-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.notes-canvas-code-wrap .notes-code-header {
  flex-shrink: 0;
  cursor: default;
}

.notes-canvas-code-wrap pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  overflow-y: visible;
  background: transparent;
}

.notes-canvas-code-wrap code {
  font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  color: #c9d1d9;
  outline: none;
  display: block;
  white-space: pre-wrap;
  line-height: 1.6;
  background: transparent !important;
  padding: 0 !important;
  cursor: text;
}

.notes-canvas-code-wrap code.hljs {
  background: transparent !important;
  padding: 0 !important;
}

/* ─── Notes: Image Crop Overlay ──────────────────────────────────── */
.notes-crop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 20000;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.notes-crop-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 20px;
  background: #111;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.notes-crop-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #888;
  text-transform: uppercase;
}

.notes-crop-actions {
  display: flex;
  gap: 8px;
}

.notes-crop-btn {
  padding: 6px 18px;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
  font-family: inherit;
}

.notes-crop-cancel {
  background: #222;
  color: #aaa;
}

.notes-crop-cancel:hover {
  background: #2a2a2a;
  color: #ccc;
}

.notes-crop-apply {
  background: #DE1833;
  color: #fff;
}

.notes-crop-apply:hover {
  background: #c0142b;
}

.notes-crop-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 24px;
}

.notes-crop-stage canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.notes-crop-selection {
  position: absolute;
  border: 2px dashed rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  cursor: move;
  z-index: 2;
  min-width: 20px;
  min-height: 20px;
}

.notes-crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid #DE1833;
  border-radius: 2px;
  z-index: 3;
}

.notes-crop-handle-nw {
  top: -6px;
  left: -6px;
  cursor: nw-resize;
}

.notes-crop-handle-ne {
  top: -6px;
  right: -6px;
  cursor: ne-resize;
}

.notes-crop-handle-sw {
  bottom: -6px;
  left: -6px;
  cursor: sw-resize;
}

.notes-crop-handle-se {
  bottom: -6px;
  right: -6px;
  cursor: se-resize;
}

/* ─── Notes: Draw Tool Active State ──────────────────────────────── */
.notes-draw-tool.active {
  background: rgba(222, 24, 51, 0.18);
  color: #DE1833;
  box-shadow: inset 0 0 0 1px rgba(222, 24, 51, 0.3);
}

/* ─── Notes: Draw Properties Panel ───────────────────────────────── */
.notes-draw-props {
  position: fixed;
  padding: 10px 14px;
  background: rgba(22,22,22,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  min-width: 200px;
  max-width: 240px;
}

.notes-draw-props-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.notes-draw-props-row:last-child {
  margin-bottom: 0;
}

.notes-draw-props-row label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: #555;
  min-width: 48px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.notes-draw-color-input {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 22px;
  background: none;
  border: 1px solid #333;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

.notes-draw-color-input::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.notes-draw-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.notes-draw-arrow-btns {
  display: flex;
  gap: 3px;
}

.notes-draw-arrow-btns .notes-cfmt-btn.active {
  background: rgba(222, 24, 51, 0.18);
  color: #DE1833;
}

/* ─── Notes: Canvas Draw & Line Block Styles ─────────────────────── */
.notes-canvas-block-draw,
.notes-canvas-block-line {
  background: transparent;
  overflow: visible;
  pointer-events: none;
}

.notes-canvas-block-draw svg,
.notes-canvas-block-line svg {
  display: block;
  overflow: visible;
  pointer-events: all;
}

.notes-canvas-block-draw.notes-canvas-block-selected,
.notes-canvas-block-line.notes-canvas-block-selected {
  pointer-events: auto;
}

/* Crosshair cursor when draw mode is active */
.notes-canvas-viewport.draw-mode {
  cursor: crosshair;
}

.notes-canvas-viewport.draw-mode .notes-canvas-block {
  pointer-events: none;
}

.notes-canvas-viewport.draw-mode .notes-canvas-block.notes-canvas-block-selected {
  pointer-events: auto;
}

/* ─── Multi-Select Visual Style ──────────────────────────────────── */

.notes-canvas-block-multi {
  border-color: #DE1833 !important;
  border-style: dashed !important;
}

/* Hide individual resize/rotate handles in multi-select */
.notes-canvas-block-multi .notes-canvas-handle,
/* ─── Select / Lasso Mode ────────────────────────────────────────── */

.notes-select-tool.active {
  color: #DE1833 !important;
  background: rgba(222, 24, 51, 0.12);
}

.notes-canvas-viewport.select-mode {
  cursor: crosshair;
}

.notes-lasso-rect {
  position: absolute;
  border: 1.5px dashed #DE1833;
  background: rgba(222, 24, 51, 0.06);
  border-radius: 2px;
  pointer-events: none;
  z-index: 9999;
}

/* ─── Merge Context Menu Item ────────────────────────────────────── */

.notes-merge-item {
  color: #3498DB !important;
}

.notes-merge-item:hover {
  color: #5dade2 !important;
  background: rgba(52, 152, 219, 0.08) !important;
}

/* ─── Mobile-Friendly Selection Handles ──────────────────────────── */

@media (pointer: coarse) {
  .notes-canvas-block {
    border-width: 3px;
  }

  .notes-canvas-handle {
    width: 22px;
    height: 22px;
    border-width: 3px;
  }

  .notes-canvas-handle-nw { top: -11px; left: -11px; }
  .notes-canvas-handle-ne { top: -11px; right: -11px; }
  .notes-canvas-handle-sw { bottom: -11px; left: -11px; }
  .notes-canvas-handle-se { bottom: -11px; right: -11px; }

  .notes-canvas-block:hover {
    border-color: rgba(222, 24, 51, 0.5);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   NOTES: Export / Import / Send / Pending / Received Styles
   ═══════════════════════════════════════════════════════════════════ */

/* Import button in list header */
.notes-import-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #888;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.notes-import-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

/* Received item in sidebar */

.notes-unread-badge {
  animation: notes-badge-pulse 2s ease-in-out infinite;
}
@keyframes notes-badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Pending note badge on SHARED notebook sidebar item */
.notes-pending-nb-badge {
  margin-left: auto;
  background: rgba(230, 126, 34, 0.25);
  color: #f0b060;
  font-weight: 600;
  min-width: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 5px;
  font-size: 10px;
  line-height: 18px;
}
/* When pending badge is present, regular count loses its auto margin */
.notes-pending-nb-badge + .notes-sidebar-count {
  margin-left: 4px;
}

/* Inline pending note cards (in SHARED notebook view) */
.notes-pending-inline {
  background: rgba(230, 126, 34, 0.04);
  border-left: 3px solid #E67E22 !important;
  cursor: default;
}
.notes-pending-inline:hover {
  background: rgba(230, 126, 34, 0.07);
}
.notes-pending-inline-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.notes-pending-inline-reject,
.notes-pending-inline-accept {
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.notes-pending-inline-reject {
  color: #555;
}
.notes-pending-inline-reject:hover {
  color: #ff4444;
  border-color: rgba(255, 68, 68, 0.3);
  background: rgba(255, 68, 68, 0.08);
}
.notes-pending-inline-accept {
  color: #555;
}
.notes-pending-inline-accept:hover {
  color: #44cc44;
  border-color: rgba(68, 204, 68, 0.3);
  background: rgba(68, 204, 68, 0.08);
}

/* Note card: received badge (inline in footer, right-aligned) */
.notes-card-received {
  font-size: 9px;
  color: #666;
  font-weight: 400;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  text-align: right;
}

/* ─── Notes: File Picker Modal ────────────────────────────────────── */
.notes-filepicker-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notes-filepicker-modal {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  width: 460px;
  max-width: 90vw;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}

.notes-filepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #222;
}

.notes-filepicker-header h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ccc;
  margin: 0;
}

.notes-filepicker-close {
  background: none;
  border: none;
  color: #666;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.notes-filepicker-close:hover {
  color: #fff;
}

.notes-filepicker-breadcrumb {
  padding: 8px 16px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #666;
  border-bottom: 1px solid #1a1a1a;
}

.notes-filepicker-crumb {
  cursor: pointer;
  color: #888;
  transition: color 0.1s ease;
}

.notes-filepicker-crumb:hover {
  color: #DE1833;
}

.notes-filepicker-body {
  overflow-y: auto;
  flex: 1;
  padding: 4px;
}

.notes-filepicker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.notes-filepicker-item:hover {
  background: #1a1a1a;
}

.notes-filepicker-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: #ccc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-filepicker-size {
  font-size: 10px;
  color: #555;
  flex-shrink: 0;
}

.notes-filepicker-loading,
.notes-filepicker-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #555;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ─── Notes: Attachment Chips (Document Mode) ────────────────────── */
.notes-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  cursor: pointer;
  margin: 2px 0;
  vertical-align: middle;
  transition: background 0.1s ease;
}

.notes-attachment-chip:hover {
  background: #252525;
}

.notes-attachment-icon {
  display: inline-flex;
  flex-shrink: 0;
}

.notes-attachment-name {
  font-size: 11px;
  font-weight: 600;
  color: #ccc;
  letter-spacing: 0.3px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-attachment-size {
  font-size: 9px;
  color: #555;
  flex-shrink: 0;
}

/* ─── Notes: Attachment Block (Canvas Mode) ──────────────────────── */
.notes-canvas-block-attachment {
  cursor: default;
}

.notes-canvas-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  height: 100%;
}

.notes-canvas-attachment .notes-attachment-name {
  flex: 1;
  font-size: 12px;
  max-width: none;
}

.notes-canvas-attachment .notes-attachment-size {
  font-size: 10px;
}

/* ─── Notes: Attachment Thumbnail (Canvas) ───────────────────────── */
.notes-canvas-attachment-img {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  gap: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
}

.notes-canvas-attachment-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px 4px 0 0;
}

.notes-canvas-attachment-name-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3px 8px;
  background: rgba(0,0,0,0.7);
  color: #ccc;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Notes: File Picker Thumbnails ──────────────────────────────── */
.notes-filepicker-thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Note card: drag handle + drag reorder */
.notes-card-drag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  position: absolute;
  left: -2px;
  top: 0;
  bottom: 0;
  cursor: grab;
  color: #444;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.notes-card:hover .notes-card-drag {
  opacity: 1;
}

.notes-card-drag:active {
  cursor: grabbing;
}

.notes-card[draggable="true"] {
  position: relative;
}

.notes-card-dragging {
  opacity: 0.4;
}

.notes-card-dragover {
  border-top: 2px solid #DE1833 !important;
}

/* Note card: unread indicator */
.notes-card-unread {
  background: rgba(222,24,51,0.06);
}
.notes-card-unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #DE1833;
  border-radius: 3px 0 0 3px;
}
.notes-card {
  position: relative;
}

/* ─── Send Modal ──────────────────────────────────────────────── */
/* ─── Send Copy Modal ────────────────────────────────────────── */
.notes-send-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.notes-send-dialog {
  background: #111111;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.notes-send-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.notes-send-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #f0f0f0;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.notes-send-header h3 svg {
  color: #DE1833;
  flex-shrink: 0;
}
.notes-send-close {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 18px;
  color: #666;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.notes-send-close:hover {
  background: rgba(222, 24, 51, 0.12);
  border-color: rgba(222, 24, 51, 0.2);
  color: #DE1833;
}
.notes-send-body {
  padding: 24px;
}
.notes-send-info {
  font-size: 12px;
  color: #808080;
  margin-bottom: 16px;
  font-weight: 500;
  letter-spacing: 0.3px;
  line-height: 1.5;
}
.notes-send-label {
  display: block;
  font-size: 11px;
  color: #666;
  margin-bottom: 8px;
  letter-spacing: 0.8px;
  font-weight: 600;
}
.notes-send-search-wrap {
  position: relative;
}
.notes-send-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #f0f0f0;
  font-size: 14px;
  font-weight: 450;
  font-family: inherit;
  letter-spacing: 0.2px;
  outline: none;
  box-sizing: border-box;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.notes-send-input:focus {
  border-color: rgba(222, 24, 51, 0.4);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(222, 24, 51, 0.08);
}
.notes-send-input::placeholder {
  color: #555;
  font-weight: 400;
}
.notes-send-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  max-height: 180px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.notes-send-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: #ccc;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.15s ease;
}
.notes-send-result-item:first-child {
  border-radius: 10px 10px 0 0;
}
.notes-send-result-item:last-child {
  border-radius: 0 0 10px 10px;
}
.notes-send-result-item:only-child {
  border-radius: 10px;
}
.notes-send-result-item:hover {
  background: rgba(222, 24, 51, 0.12);
  color: #fff;
}
.notes-send-no-results {
  padding: 10px 16px;
  color: #555;
  font-size: 12px;
  letter-spacing: 0.3px;
}
.notes-send-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.notes-send-user-tag {
  display: inline-flex;
  align-items: center;
  background: rgba(222, 24, 51, 0.15);
  color: #DE1833;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  border: 1px solid rgba(222, 24, 51, 0.2);
}
.notes-send-remove {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #666;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.notes-send-remove:hover {
  background: rgba(222, 24, 51, 0.12);
  border-color: rgba(222, 24, 51, 0.2);
  color: #DE1833;
}
.notes-send-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(0, 0, 0, 0.15);
}
.notes-send-cancel {
  padding: 9px 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #b0b0b0;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.notes-send-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #e0e0e0;
}
.notes-send-confirm {
  padding: 9px 22px;
  background: #DE1833;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.notes-send-confirm:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.notes-send-confirm:not(:disabled):hover {
  background: #E8304A;
  box-shadow: 0 4px 16px rgba(222, 24, 51, 0.25);
}


/* ─── Nav Badge (for NOTES link) ──────────────────────────────── */
.nav-link:has(.notes-nav-badge) {
  position: relative;
}
.notes-nav-badge {
  position: absolute;
  top: -8px;
  right: -14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: rgba(222, 24, 51, 0.8);
  color: #ff8a9d;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  line-height: 16px;
  pointer-events: none;
  box-sizing: border-box;
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE OVERRIDES — Consolidated @media blocks
   Placed at end of file to ensure they always cascade AFTER base rules.
   Order: widest breakpoint first → narrowest last (for correct cascade).
   ═══════════════════════════════════════════════════════════════════════════ */


/* Hide date; 5 visible: check, name, enc, size, actions */
@media (max-width: 950px) {
  .browser-header,
  .browser-row {
    grid-template-columns: 36px 1fr 40px 80px 110px;
    gap: 10px;
  }

  .col-date {
    display: none;
  }
  .temp-browser-header,
  .temp-browser-row {
    grid-template-columns: 1fr 40px 80px 110px;
    gap: 10px;
  }

  .temp-browser .col-date {
    display: none;
  }
}

@media (max-width: 800px) {
  .manage-modern {
    flex-direction: column;
  }
  
  .manage-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid #222;
  }
  
  .manage-preview {
    padding: 28px 20px 20px;
  }
  
  .manage-preview-img-wrap {
    max-height: 260px;
  }
  
  .manage-preview-img {
    max-height: 260px;
  }

  .manage-detail-grid {
    max-width: 100%;
  }

  .manage-detail-grid-below {
    padding: 16px 20px 20px;
  }

  .manage-detail-grid-outside {
    margin: 16px auto 30px;
    padding: 16px 20px;
    border-radius: 16px;
  }
  .tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 14px 16px calc(56px + env(safe-area-inset-bottom, 0px));
  }

  .tile-thumb {
    height: 120px;
  }

  /* Remove invisible-but-clickable action buttons on mobile tiles —
     users access these actions via long-press context menu instead */
  .tile-actions {
    display: none !important;
  }
  /* Content padding when mini bar player is active */
  body.music-player-active .mega-main {
    padding-bottom: 80px;
  }

  body.music-player-active .spa-page-content {
    padding-bottom: 80px;
  }
  .notif-wall-container {
    top: 56px;
    max-width: 100%;
    padding: 0 8px;
  }

  .notif-wall {
    padding: 12px 40px 12px 14px;
    border-radius: 8px;
  }

  .notif-wall-title {
    font-size: 11px;
  }

  .notif-wall-text {
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  .land-h1 {
    font-size: 40px;
    letter-spacing: -1px;
  }
  .land-desc { font-size: 11px; }
  .land-hero { padding: 36px 24px 44px; }
  .land-actions { margin-bottom: 36px; }
  .land-status { font-size: 10px; letter-spacing: 1.3px; }
  .share-hero-content {
    padding: 24px 20px 20px;
    border-radius: 20px;
  }
  .share-hero {
    padding: 40px 20px 28px;
  }
  .share-title {
    font-size: 36px;
    letter-spacing: -1px;
  }
  .share-subtitle {
    font-size: 11px;
    letter-spacing: 1px;
  }
  .share-upload-area {
    padding: 0 16px 32px;
  }
  .share-files-area {
    padding: 0 16px 40px;
  }
  .share-orb-1 { width: 350px; height: 350px; filter: blur(100px); }
  .share-orb-2 { display: none; }
  .hero-title {
    font-size: 32px;
  }

  .docs-sidebar {
    display: none;
  }

  .docs-main {
    padding-left: 0;
  }

  .docs-layout {
    padding: 0 12px 40px;
  }

  .docs-section-title {
    font-size: 20px;
  }

  .param-row {
    grid-template-columns: 120px 80px 1fr;
    font-size: 12px;
  }

  .param-table-4col .param-row {
    grid-template-columns: 60px 1fr;
    gap: 4px 10px;
  }
  .param-table-4col .param-row .param-desc:last-child {
    grid-column: 1 / -1;
  }

  .docs-info-grid {
    grid-template-columns: 1fr 1fr;
  }

  .files-title {
    font-size: 32px;
  }

  .manage-title {
    font-size: 32px;
  }
  
  .hero-subtitle {
    font-size: 16px;
  }
  
  .drop-zone {
    padding: 60px 20px;
  }
  
  .drop-zone-icon {
  font-size: 42px;
  }
  
  .drop-zone-title {
    font-size: 22px;
  }
  
  .features-row {
    flex-direction: column;
    align-items: center;
  }
  
  .manage-layout {
    flex-direction: column;
  }
  
  .nav {
    gap: 20px;
  }
  
  .nav-link {
    font-size: 14px;
  }
  
  .share-box {
    flex-direction: column;
  }
  
  .share-row {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  
  .share-row-label {
    text-align: left;
  }
  .account-sidebar {
    display: none;
  }

  .account-main {
    padding-left: 0;
  }

  .account-layout {
    padding: 0 12px 40px;
  }

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

  .apikey-perms-grid {
    grid-template-columns: 1fr;
  }

  .apikey-card-header {
    flex-direction: column;
  }

  .apikey-card-actions {
    width: 100%;
  }

  .apikey-card-actions .account-btn {
    flex: 1;
    justify-content: center;
  }
  .file-grid {
    grid-template-columns: 1fr;
  }
  

  
  .users-table {
    font-size: 12px;
  }
  
  .users-table th,
  .users-table td {
    padding: 4px 8px;
  }
  
  .preview-stage {
    padding: 60px 8px 8px 8px;
  }
  .preview-bar-name {
    max-width: 70vw;
    font-size: 12px;
  }
  .preview-text {
    width: 96vw;
    padding: 16px;
    font-size: 12px;
  }
  .preview-pdf {
    width: 96vw;
  }
  .preview-editor-container {
    width: 98vw;
    max-width: none;
    max-height: none;
    border-radius: 6px;
  }
  .preview-editor-toolbar {
    padding: 6px 10px;
    gap: 6px;
    flex-wrap: nowrap;
    min-height: 34px;
  }
  .preview-editor-lang {
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .preview-editor-status {
    font-size: 9px;
    padding: 2px 8px 2px 6px;
    gap: 4px;
  }
  .preview-editor-status-dot {
    width: 5px;
    height: 5px;
  }
  .preview-editor-save {
    padding: 6px 14px;
    font-size: 11px;
    min-height: 32px;
    border-radius: 6px;
  }
  .preview-editor-gutter {
    min-width: 34px;
    display: none;
  }
  .preview-editor-gutter-inner {
    font-size: 11px;
    padding-right: 8px;
  }
  .preview-editor-code {
    font-size: 12px;
    line-height: 1.55;
    padding: 10px 10px;
  }
  .preview-editor-footer {
    padding: 5px 10px;
    gap: 10px;
  }
  .preview-editor-footer span {
    font-size: 10px;
  }
  .view-toggle {
    margin-left: 6px;
  }
  .nav-toggle {
    display: flex;
    order: 3;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
    order: 2;
  }

  .header-content {
    gap: 10px;
    justify-content: space-between;
  }

  .logo {
    order: 1;
  }

  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.98);
    border-bottom: 1px solid #333;
    flex-direction: column;
    gap: 0;
    padding: 4px 0;
    z-index: 99;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    order: 4;
  }

  .nav.open {
    display: flex;
  }

  .header {
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .header-content {
    position: relative;
  }

  .nav-left {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .nav-left .nav-link {
    display: block;
    padding: 14px 24px;
    font-size: 15px;
    border-bottom: 1px solid #1a1a1a;
    width: 100%;
  }

  .nav-left .nav-link:last-child {
    border-bottom: none;
  }

  .nav-left .nav-link:hover,
  .nav-left .nav-link.active {
    background: rgba(255, 255, 255, 0.03);
  }

  /* Hide user menu / auth links from the nav dropdown on mobile —
     they are now in .header-actions in the header bar */
  .nav-right {
    display: none;
  }
  .temp-browser-header,
  .temp-browser-row {
    padding: 2px 10px;
    gap: 10px;
  }

  .temp-browser .action-btn {
    min-width: 36px;
    min-height: 36px;
  }

  .temp-browser .file-thumbnail {
    width: 32px;
    height: 32px;
  }

  .temp-files-section .section-title {
    font-size: 18px;
  }
  .files-table {
    font-size: 13px;
  }

  /* Hide SIZE and EXPIRES columns */
  .files-table thead th:nth-child(2),
  .files-table thead th:nth-child(3),
  .files-table tbody td:nth-child(2),
  .files-table tbody td:nth-child(3) {
    display: none;
  }

  .files-table td .file-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
  }

  .files-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .action-buttons .edit-btn,
  .action-buttons .copy-link-btn,
  .action-buttons .delete-btn {
    font-size: 11px;
    padding: 5px 8px;
  }
  .adm-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .adm-table {
    min-width: 600px;
  }
  /* E2EE prompt overlay — top-align on mobile
     so the virtual keyboard doesn't cover the input/buttons */
  .e2ee-prompt-overlay {
    align-items: flex-start;
    padding: 6vh 0 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* All standard modals (create/rename folder, move, etc.) — top-align
     padding-top is small so modals with inputs stay fully visible above keyboard */
  .modal {
    align-items: flex-start;
    padding: 6vh 0 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Preview modal must always fill the full viewport edge-to-edge —
     the keyboard-avoidance padding/alignment above is only for form modals */
  .modal.preview-modal {
    padding: 0;
    align-items: stretch;
    overflow: hidden;
  }

  /* Confirmation modals (delete, etc.) — no input so slightly lower is fine */
  .modal-confirm {
    align-items: flex-start;
    padding: 8vh 0 20px;
  }

  /* Confirmation modal variant overlays */
  .modal-confirm.confirm-e2e-warn,
  .modal-confirm.confirm-no-e2e {
    align-items: flex-start;
    padding: 6vh 0 20px;
  }

  /* Toast container — ensure it clears the sticky header */
  .toast-container {
    top: 70px;
    max-width: calc(100% - 32px);
  }

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

  /* Upload progress toast — full-width bottom bar */
  .upload-progress-toast {
    width: calc(100% - 24px);
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .bulk-actions-bar {
    flex-wrap: wrap;
    padding: 4px 12px;
    height: auto;
    gap: 8px;
  }

  .bulk-left {
    width: 100%;
    justify-content: space-between;
  }

  .bulk-right {
    width: 100%;
    justify-content: flex-end;
    gap: 6px;
  }

  .bulk-btn {
    padding: 8px 10px;
    font-size: 11px;
  }

  /* Icon-only bulk buttons on very small screens */
  .bulk-btn svg {
    flex-shrink: 0;
  }

  .bulk-select-all-label {
    font-size: 12px;
  }

  .bulk-count {
    font-size: 12px;
  }
  /* Hide invisible-but-tappable folder actions (delete/new subfolder)
     on mobile — users access these via long-press context menu instead */
  .folder-tree-actions {
    display: none !important;
  }

  /* Prevent native browser long-press menu (Open in new tab, etc.)
     on sidebar folder links — our custom context menu handles this */
  .folder-tree-link {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .folder-tree-toggle {
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
  }

  .context-menu-item {
    padding: 14px 18px;
    font-size: 14px;
  }

  .context-submenu .context-submenu-item {
    padding: 12px 18px;
    font-size: 14px;
  }

  .action-btn {
    min-width: 36px;
    min-height: 36px;
  }

  .user-menu-button {
    min-height: 40px;
    padding: 8px 12px;
  }

  /* Thumbnail size stays consistent across breakpoints */

  .sidebar-trash-link {
    padding: 12px 16px;
  }

  .folder-tree-link {
    padding: 8px 4px;
    min-height: 40px;
    display: flex;
    align-items: center;
  }

  .folder-tree-item {
    min-height: 40px;
    border-radius: 8px;
  }

  /* Slightly more visible branch connectors on mobile for clarity */
  .folder-tree-children > .folder-tree-item:not(.root-folder)::before,
  .folder-tree-children > .folder-tree-item:not(.root-folder)::after,
  .folder-tree-children > .folder-tree-children:has(~ .folder-tree-item)::before {
    background: rgba(255, 255, 255, 0.16);
  }
  .footer-content {
    flex-direction: column;
    gap: 16px;
    align-items: center;
    text-align: center;
  }

  .footer-section {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .footer-section ul,
  .footer-section ol {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 16px;
  }

  .footer {
    padding: 16px 20px 10px;
  }
  .upload-progress-card .upload-card-stats {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .upload-section {
    padding: 0 8px;
  }
  .context-menu {
    min-width: 200px;
  }
  /* Prevent horizontal overflow on body */
  html, body {
    overflow-x: hidden;
  }

  .container {
    padding: 0 8px;
  }

  .main {
    padding: 12px 8px;
  }

  /* Hero section */
  .hero {
    padding: 12px 12px;
    margin-bottom: 20px;
  }
  /* --- Header: drastically reduce spacing --- */
  .manage-header {
    padding: 16px 12px 8px;
    margin-bottom: 12px;
  }

  .manage-header-content {
    gap: 10px;
  }

  .manage-title {
    font-size: 22px;
    letter-spacing: 0.5px;
  }

  .btn-back {
    padding: 6px 10px;
  }

  .btn-back .back-text {
    font-size: 11px;
  }

  /* --- manage-modern card: less border-radius on mobile --- */
  .manage-modern {
    border-radius: 12px;
    margin: 0 4px;
    min-height: unset;
  }

  /* --- Preview area: compact --- */
  .manage-preview {
    padding: 16px 16px 12px;
  }

  .manage-preview-icon {
    width: 72px;
    height: 72px;
    font-size: 40px;
    margin-bottom: 10px;
    border-radius: 14px;
  }

  .manage-preview-img-wrap {
    max-height: 180px;
    margin-bottom: 12px;
  }

  .manage-preview-img {
    max-height: 180px;
  }

  .manage-preview-filename {
    font-size: 15px;
    margin-bottom: 4px;
  }

  .manage-preview-filename-lg {
    font-size: 20px;
  }

  .manage-preview-badges {
    bottom: 10px;
    left: 10px;
  }

  /* --- Detail grid (inside preview): tighter --- */
  .manage-detail-grid {
    gap: 4px;
    margin-top: 2px;
  }

  .manage-detail-item {
    padding: 6px 8px;
  }

  .manage-detail-label {
    font-size: 9px;
    letter-spacing: 0.8px;
  }

  .manage-detail-value {
    font-size: 11px;
  }

  /* --- Detail grid outside: compact --- */
  .manage-detail-grid-outside {
    margin: 8px 4px 20px;
    padding: 12px 12px;
    border-radius: 12px;
    gap: 4px;
  }

  /* --- Sidebar: reduce padding and gaps --- */
  .manage-sidebar {
    padding: 16px 14px;
    gap: 12px;
    border-top: 1px solid #222;
  }

  .manage-setting-group {
    gap: 5px;
  }

  .manage-setting-label {
    font-size: 10px;
  }

  .manage-setting-hint {
    font-size: 9px;
  }

  .manage-setting-select {
    padding: 8px 10px;
    font-size: 13px;
  }

  .manage-setting-toggle-row {
    padding: 0;
  }

  /* --- Share section: compact --- */
  .manage-share {
    gap: 6px;
    padding-top: 10px;
  }

  .manage-share-row {
    gap: 6px;
  }

  .manage-share-input {
    padding: 7px 10px;
    font-size: 11px;
  }

  .manage-share-wget {
    font-size: 10px;
  }

  .manage-share-copy {
    padding: 7px 10px;
    font-size: 11px;
  }

  .manage-share-note {
    font-size: 10px;
  }

  /* --- Action buttons: full width, slightly smaller --- */
  .manage-actions {
    gap: 8px;
    padding-top: 10px;
    margin-top: auto;
  }

  .manage-action-btn {
    padding: 10px 12px;
    font-size: 12px;
    border-radius: 8px;
  }
}

@media (max-width: 600px) {
  .sn-repl-header {
    padding: 14px 16px;
    flex-wrap: wrap;
  }
  .sn-repl-bars {
    padding: 0 16px 12px;
  }
  .sn-repl-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
    position: relative;
  }
  .sn-repl-action {
    position: static;
  }
  .sn-repl-menu {
    left: 0;
    right: 0;
    min-width: unset;
    top: calc(100% + 6px);
  }
  .sn-node-card {
    padding: 16px;
  }
  .sn-purge-panel {
    padding: 16px;
  }
  .sn-node-counts {
    gap: 12px;
  }
  .sn-repl-bar-name {
    min-width: 80px;
  }
  .sn-cache-ttl-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .notes-title-row {
    padding: 0 10px;
  }
  .notes-title-input {
    font-size: 16px;
  }
  .notes-tag-editor-row {
    padding: 0 10px;
  }

  .notes-content-area {
    padding: 10px 16px 30px;
    font-size: 13px;
  }

  .notes-md-preview {
    padding: 10px 16px 30px;
    font-size: 13px;
  }

  .notes-line-gutter {
    width: 32px;
  }

  .notes-line-num {
    font-size: 10px;
  }

  .notes-doc-toggles {
    gap: 2px;
  }

  .notes-edit-md-btn {
    font-size: 9px;
    padding: 2px 6px;
  }

  .notes-toolbar {
    padding: 0 8px;
    min-height: 36px;
  }

  .notes-tool-btn {
    width: 26px;
    height: 26px;
  }

  .notes-action-btn {
    width: 26px;
    height: 26px;
  }

  .notes-toolbar-sep {
    margin: 0 3px;
  }

  .notes-toolbar-right .notes-save-status {
    display: none;
  }

}

@media (max-width: 520px) {
  .land-hero { padding: 28px 20px 36px; }
  .land-h1 {
    font-size: 32px;
    letter-spacing: -0.5px;
  }
  .land-h1 br { display: none; }
  .land-badge {
    font-size: 8px;
    letter-spacing: 2px;
    padding: 5px 12px;
    margin-bottom: 24px;
  }
  .land-desc {
    font-size: 10px;
    letter-spacing: 0.4px;
    margin-bottom: 32px;
  }
  .land-actions { flex-direction: column; gap: 8px; margin-bottom: 32px; }
  .land-btn-primary,
  .land-btn-ghost { width: 100%; justify-content: center; }
  .land-status { font-size: 9px; letter-spacing: 1.1px; }
  .share-hero {
    padding: 32px 16px 24px;
  }
  .share-title {
    font-size: 28px;
    letter-spacing: -0.5px;
  }
  .share-subtitle {
    font-size: 10px;
  }
  .share-upload-area {
    padding: 0 12px 24px;
  }
  .share-files-area {
    padding: 0 12px 32px;
  }
  .share-page .drop-zone {
    padding: 36px 20px 24px;
  }
  .share-page .drop-zone-title {
    font-size: 18px;
  }
  .drop-zone-toggle {
    width: 180px;
    padding: 8px 16px;
  }
  .drop-zone-toggle-label {
    font-size: 9px;
  }
  /* Auth container — top-align on mobile
     so the virtual keyboard doesn't cover the inputs */
  .auth-container {
    align-items: flex-start;
    min-height: 0;
    padding: 6vh 20px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .auth-box {
    padding: 32px 24px 28px;
    border-radius: 14px;
  }
  .auth-box h1 {
    font-size: 18px;
    letter-spacing: 3px;
    margin-bottom: 24px;
  }
}

@media (max-width: 480px) {
  .notfound-card {
    padding: 40px 24px;
  }
  .notfound-digit {
    font-size: 60px;
  }
  .notfound-title {
    font-size: 18px;
  }
  .notfound-actions {
    flex-direction: column;
  }
  .notfound-button {
    justify-content: center;
  }
  .e2ed-card {
    padding: 28px 18px 24px;
  }
  .e2ed-title {
    font-size: 14px;
    letter-spacing: 1px;
  }
  .e2ed-submit {
    width: 100%;
    justify-content: center;
  }
  .e2ee-prompt-card {
    padding: 28px 18px 24px;
  }
  .e2ee-prompt-title {
    font-size: 14px;
    letter-spacing: 1px;
  }
  .e2ee-prompt-btn {
    width: 100%;
  }
  .manage-modal-panel {
    width: 92vw;
    max-width: 92vw;
    border-radius: 14px;
    max-height: 85vh;
  }

  .manage-modal {
    align-items: center;
  }

  .manage-modal-scroll {
    padding: 24px 18px 18px;
  }

  .manage-modal-settings {
    gap: 10px;
    margin-bottom: 14px;
  }

  .manage-modal-toggle-row {
    padding: 4px 0;
  }

  .manage-modal-actions {
    flex-direction: row;
  }
  .tile-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px 12px calc(56px + env(safe-area-inset-bottom, 0px));
  }

  .tile-thumb {
    height: 100px;
  }

  .tile-info {
    padding: 8px 10px 6px;
  }

  .tile-name {
    font-size: 0.76em;
  }

  .view-toggle {
    margin-left: 4px;
  }
  .modal-content {
    min-width: unset;
    width: calc(100% - 32px);
    margin: 0 16px;
    max-width: none;
  }

  .modal-move {
    min-width: unset;
    width: calc(100% - 32px);
    margin: 0 16px;
    max-width: none;
  }

  .modal-header h3 {
    font-size: 14px;
    word-break: break-word;
  }

  .modal-footer {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-footer button {
    width: 100%;
    padding: 12px 20px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-footer {
    padding: 12px 16px;
  }

  .move-folder-tree {
    max-height: 280px;
  }

  /* Properties modal */
  .modal-properties .prop-grid {
    grid-template-columns: 1fr;
  }

  /* Confirmation modals */
  .modal-confirm-content {
    min-width: unset;
    width: calc(100% - 32px);
  }

  /* Auth container — tighter for small screens */
  .auth-container {
    padding: 4vh 16px 20px;
  }
  .auth-box {
    padding: 28px 18px 24px;
  }

  /* E2EE prompt overlay — tighter for small screens */
  .e2ee-prompt-overlay {
    padding-top: 4vh;
  }

  .e2ee-prompt-card {
    width: calc(100% - 32px);
    max-width: none;
    padding: 24px 16px 20px;
  }

  .e2ee-prompt-icon {
    margin-bottom: 12px;
  }

  .e2ee-prompt-icon svg {
    width: 32px;
    height: 32px;
  }

  .e2ee-prompt-title {
    font-size: 14px;
  }

  .e2ee-prompt-desc {
    font-size: 11px;
    margin-bottom: 16px;
  }

  .e2ee-prompt-btn {
    width: 100%;
    padding: 12px 20px;
  }

  /* Confirmation modal variants — compact padding */
  .confirm-e2e-warn .modal-confirm-header {
    padding: 24px 18px 16px;
  }

  .confirm-e2e-warn .modal-confirm-body {
    padding: 16px 18px 20px;
  }

  .confirm-e2e-warn .modal-confirm-footer {
    padding: 12px 18px;
  }

  .confirm-no-e2e .modal-confirm-header {
    padding: 24px 18px 16px;
  }

  .confirm-no-e2e .modal-confirm-body {
    padding: 16px 18px 20px;
  }

  .confirm-no-e2e .modal-confirm-footer {
    padding: 12px 18px;
  }

  /* Manage modal — centered on small phones */
  .manage-modal {
    align-items: center;
    padding-top: 0;
  }
  .e2e-key-row {
    gap: 4px;
  }

  .e2e-input {
    font-size: 12px;
    padding: 8px 10px;
  }

  .e2e-icon-btn {
    width: 32px;
    height: 32px;
  }

  .e2e-panel {
    padding: 12px;
  }

  .e2e-toggle-row {
    gap: 8px;
  }

  .e2e-label {
    font-size: 12px;
  }

  .info-icon::after {
    width: 220px;
    left: 0;
    transform: none;
  }
  .hero-title {
    font-size: 24px;
  }

  .drop-zone {
    padding: 40px 16px;
  }

  .drop-zone-title {
    font-size: 18px;
  }

  .drop-zone-text {
    font-size: 13px;
  }

  .drop-zone-limit {
    font-size: 11px;
  }

  .files-title {
    font-size: 24px;
  }

  /* --- Manage page: extra-small screen tweaks --- */
  .manage-header {
    padding: 12px 8px 4px;
    margin-bottom: 8px;
  }

  .manage-title {
    font-size: 18px;
  }

  .manage-modern {
    margin: 0 2px;
    border-radius: 10px;
  }

  .manage-preview {
    padding: 12px 12px 10px;
  }

  .manage-preview-icon {
    width: 56px;
    height: 56px;
    font-size: 32px;
    margin-bottom: 8px;
    border-radius: 12px;
  }

  .manage-preview-img-wrap {
    max-height: 150px;
    margin-bottom: 10px;
  }

  .manage-preview-img {
    max-height: 150px;
  }

  .manage-preview-filename {
    font-size: 14px;
  }

  .manage-preview-filename-lg {
    font-size: 17px;
  }

  .manage-detail-grid {
    gap: 3px;
  }

  .manage-detail-item {
    padding: 5px 6px;
  }

  .manage-detail-grid-outside {
    margin: 6px 2px 16px;
    padding: 10px 8px;
  }

  .manage-sidebar {
    padding: 12px 10px;
    gap: 10px;
  }

  .manage-setting-select {
    padding: 7px 8px;
    font-size: 12px;
  }

  .manage-actions {
    gap: 6px;
    padding-top: 8px;
  }

  .manage-action-btn {
    padding: 9px 10px;
    font-size: 11px;
  }
}


/* Hide size; 4 visible: check, name, enc, actions */
@media (max-width: 600px) {
  .browser-header,
  .browser-row {
    grid-template-columns: 36px 1fr 40px 110px;
    padding: 8px 10px;
    gap: 6px;
  }
  .browser-header {
    padding: 2px 10px;
  }

  .col-size {
    display: none;
  }
  .temp-browser-header,
  .temp-browser-row {
    grid-template-columns: 1fr 40px 110px;
    padding: 2px 10px;
    gap: 6px;
  }

  .temp-browser .col-size {
    display: none;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   NOTES RESPONSIVE OVERRIDES
   Placed after all notes base rules to ensure correct CSS cascade order.
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1100px) {
  .notes-sidebar {
    width: 220px;
    min-width: 220px;
  }
  .notes-sidebar.collapsed {
    width: 40px;
    min-width: 40px;
  }
  .notes-list-panel {
    width: 240px;
    min-width: 240px;
  }
  .notes-list-panel.collapsed {
    width: 40px;
    min-width: 40px;
  }
}

@media (max-width: 850px) {
.notes-collapse-toggle,
  .notes-collapsed-label {
    display: none !important;
  }

  .notes-sidebar,
  .notes-sidebar.collapsed {
    position: fixed !important;
    left: -280px;
    top: 52px;
    bottom: 0;
    width: 260px !important;
    min-width: 260px !important;
    z-index: 200;
    transition: left 0.25s ease;
  }

  .notes-sidebar.collapsed .notes-sidebar-header {
    padding: 0 16px;
    justify-content: space-between;
  }

  .notes-sidebar.collapsed .notes-sidebar-header h2 { display: block; }
  .notes-sidebar.collapsed .notes-sidebar-btn { display: flex; }
  .notes-sidebar.collapsed .notes-sidebar-nav { display: block; }
  .notes-sidebar.collapsed .notes-sidebar-bottom { display: block; }

  .notes-list-panel.collapsed {
    width: auto !important;
    min-width: 0 !important;
    flex: 1;
  }

  .notes-list-panel.collapsed .notes-list-header-row:first-child {
    padding: 0 12px;
    justify-content: initial;
    border-bottom: 1px solid rgba(255,255,255,0.04);
  }

  .notes-list-panel.collapsed .notes-header-default { display: flex !important; }
  .notes-list-panel.collapsed .notes-list-title { display: block !important; }
  .notes-list-panel.collapsed .notes-mobile-menu { display: flex !important; }
  .notes-list-panel.collapsed .notes-list-body { display: block; flex: 1; }
  .notes-list-panel.collapsed .notes-list-header { border-bottom: 1px solid rgba(255,255,255,0.06); }
  /* On mobile, searching state still works normally inside collapsed panel */
  .notes-list-panel.collapsed .notes-list-header.searching .notes-header-default { display: none !important; }
  .notes-list-panel.collapsed .notes-list-header.searching .notes-header-search { display: flex !important; }

  .notes-sidebar.open {
    left: 0;
  }

  .notes-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    top: 52px;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .notes-sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .notes-mobile-menu {
    display: flex;
  }

  .notes-list-panel {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .notes-editor-panel {
    position: fixed;
    left: 100%;
    top: 52px;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 150;
    transition: left 0.25s ease;
    touch-action: none;
    overscroll-behavior: contain;
  }

  .notes-app.notes-editor-active .notes-editor-panel {
    left: 0;
  }

  .notes-back-btn {
    display: flex;
  }

  .notes-toolbar {
    padding: 0 10px;
  }
  .notes-img-toolbar {
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
  }

  .notes-canvas-handle {
    width: 18px;
    height: 18px;
    border-width: 2.5px;
  }

  .notes-canvas-handle-nw { top: -9px; left: -9px; }
  .notes-canvas-handle-ne { top: -9px; right: -9px; }
  .notes-canvas-handle-sw { bottom: -9px; left: -9px; }
  .notes-canvas-handle-se { bottom: -9px; right: -9px; }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   MUSIC LIBRARY - Spotify-inspired music browsing page
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── Layout ──────────────────────────────────────────────────────────────── */
body:has(.music-app) { overflow: hidden; height: 100vh; height: 100dvh; }
body:has(.music-app) .header { border-bottom-color: rgba(255,255,255,0.04); }

/* Visualizer: full-width, taller, no rounded corners */
@media (min-width: 851px) {
  .mp-visualizer {
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 0;
  }
  .mp-fx-active .mp-visualizer {
    height: 80px;
  }
  .mp-fx-chaos .mp-visualizer {
    height: 90vh;
  }
  /* FX button styling in right group — right after playlist btn */
  .music-player-right #mpFxBtn {
    order: 2;
  }
}

/* ─── Fullscreen header (hidden by default) ──────────────────── */
.mp-fs-header {
  display: none;
}

/* ─── Mini play button (hidden by default, shown in mobile music mini bar) ── */
.mp-mini-play {
  display: none;
}
.mp-mini-devices {
  display: none;
}
.mp-fs-devices-btn {
  display: none;
}

/* ─── Fullscreen action buttons (hidden by default, shown in fullscreen mobile) ── */
.mp-fs-actions {
  display: none;
}
/* Hide heart/+ when playing from own library (keep sync button visible) */
.music-player.mp-own-library .mp-fs-heart-btn,
.music-player.mp-own-library .mp-fs-add-btn {
  display: none !important;
}

/* ─── Tap highlight fix for all player elements ──────────────── */
.music-player,
.music-player *,
.mp-fs-header,
.mp-fs-header * {
  -webkit-tap-highlight-color: transparent;
}

/* Spotify-style desktop player layout: info left | controls+progress center | right utils */
@media (min-width: 851px) {
  .mp-mobile-close {
    display: none;
  }
  /* Hide progress bar inside info area (shown as centered grid child instead) */
  .music-player-info .music-player-progress-wrap {
    display: none;
  }
  .music-player-controls {
    grid-row: 1;
    grid-column: 4;
    gap: 4px;
    justify-content: center;
  }
  .music-player-progress-wrap.mp-progress-center {
    display: flex;
    grid-row: 2;
    grid-column: 4;
    justify-self: center;
    width: 100%;
    max-width: 480px;
  }
  /* Right side: playlist + volume together */
  .music-player-right {
    grid-row: 1 / 3;
    grid-column: 5;
    align-self: center;
    display: flex;
    align-items: center;
    gap: 2px;
  }
  .music-player-right #mpPlaylistBtn {
    order: 1;
  }
  /* Move volume into right group visually by pulling it out of controls via JS */
  .music-player-volume {
    grid-row: unset;
    grid-column: unset;
    justify-content: unset;
    align-self: unset;
    order: 3;
  }
  .music-player-close {
    display: inline-flex;
  }
  /* Heart (like) button inside info area, left of the + button — pushed right */
  .mp-bar-heart {
    flex-shrink: 0;
    margin-left: auto;
    color: #555;
    transition: color 0.15s ease;
  }
  .mp-bar-heart:hover {
    color: #fff;
  }
  .mp-bar-heart.liked {
    color: #DE1833;
  }
  .mp-bar-heart.liked:hover {
    color: #ff2e4d;
  }
  /* Hide heart/+ when playing from own library */
  .music-player.mp-own-library .mp-bar-heart,
  .music-player.mp-own-library .mp-add-to-playlist {
    display: none !important;
  }
  /* Add-to-playlist button inside info area, right next to title/artist */
  .mp-add-to-playlist {
    flex-shrink: 0;
    margin-left: 4px;
    color: #555;
    transition: color 0.15s ease;
  }
  .mp-add-to-playlist:hover {
    color: #fff;
  }
  /* Bigger control buttons */
  .mp-btn {
    width: 40px;
    height: 40px;
  }
  .mp-btn svg {
    width: 20px;
    height: 20px;
  }
  .mp-btn-sm {
    width: 36px;
    height: 36px;
  }
  .mp-btn-sm svg {
    width: 18px;
    height: 18px;
  }
  .mp-btn-play {
    width: 48px;
    height: 48px;
  }
  .mp-btn-play svg {
    width: 24px;
    height: 24px;
  }
  /* Volume slider */
  .music-player-volume-slider {
    width: 130px;
  }
  /* Divider spacing */
  .mp-controls-divider {
    width: 16px;
  }
}

/* Clickable title -> album, artist links -> artist page */
.music-player-title.mp-title-clickable {
  cursor: pointer;
}
.music-player-title.mp-title-clickable:hover {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.4);
  text-underline-offset: 2px;
}
.mp-artist-link {
  cursor: pointer;
  transition: color 0.15s;
}
.mp-artist-link:hover {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.4);
  text-underline-offset: 2px;
}
.mp-artist-sep {
  color: #666;
}
/* Progress bar slightly bigger on desktop bottom bar */
@media (min-width: 851px) {
  .music-player-progress {
    height: 5px;
  }
  .music-player-progress::-webkit-slider-runnable-track {
    height: 5px;
  }
  .music-player-progress::-moz-range-track {
    height: 5px;
  }
}

.music-app {
  display: flex;
  flex: 1;
  background: #0a0a0a;
  overflow: hidden;
  min-height: 0;
  height: calc(100vh - 48px);
  height: calc(100dvh - 48px);
}

body.music-player-active .music-content { padding-bottom: 90px; }
body.music-player-active .music-sidebar { padding-bottom: 80px; }

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.music-sidebar {
  width: 260px;
  min-width: 260px;
  background: #0f0f0f;
  border-right: 1px solid rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease, min-width 0.2s ease;
}

.music-sidebar-header {
  padding: 16px 18px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.music-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  color: #555;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.music-sidebar-nav {
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.music-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #888;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
}

.music-nav-item:hover { background: rgba(255,255,255,0.04); color: #e0e0e0; }
.music-nav-item.active { background: rgba(255,255,255,0.06); color: #e0e0e0; }
.music-nav-item svg { flex-shrink: 0; opacity: 0.7; }
.music-nav-item.active svg { opacity: 1; }

/* Liked songs special entry */
.music-liked-entry {
  margin: 0 8px;
  position: relative;
}
.music-liked-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, #450a0a, #7f1d1d);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.music-liked-icon svg { color: #DE1833; opacity: 1; }
.music-liked-count {
  margin-left: auto;
  font-size: 10px;
  color: #555;
  font-weight: 500;
}

/* Sidebar divider */
.music-sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.04);
  margin: 6px 16px;
}

/* Playlists section */
.music-playlists-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px 4px;
  font-size: 10px;
  font-weight: 700;
  color: #444;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.music-create-playlist-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: #555;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.music-create-playlist-btn:hover { background: rgba(255,255,255,0.06); color: #e0e0e0; }

.music-playlists-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.06) transparent;
}
.music-playlists-list::-webkit-scrollbar { width: 4px; }
.music-playlists-list::-webkit-scrollbar-track { background: transparent; }
.music-playlists-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 2px; }

.music-playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
}
.music-playlist-item:hover { background: rgba(255,255,255,0.04); }
.music-playlist-item.active { background: rgba(255,255,255,0.06); }

.music-playlist-item-art {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: #1a1a1a;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.music-playlist-item-art img { width: 100%; height: 100%; object-fit: cover; }
.music-playlist-item-art svg { color: #333; }

.music-playlist-item-info {
  overflow: hidden;
  min-width: 0;
}
.music-playlist-item-name {
  font-size: 12px;
  font-weight: 500;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
}
.music-playlist-item-meta {
  font-size: 10px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Sidebar backdrop (mobile) */
.music-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}
.music-sidebar-backdrop.open { display: block; }


/* ─── Top bar ─────────────────────────────────────────────────────────────── */
.music-topbar {
  display: flex;
  align-items: center;
  padding: 6px 20px;
  background: rgba(15,15,15,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  min-height: 42px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.music-sidebar-toggle {
  display: none;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #888;
  cursor: pointer;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.music-sidebar-toggle:hover { background: rgba(255,255,255,0.06); color: #e0e0e0; }

/* Back button in topbar (mobile only, shown when in detail views) */
.music-topbar-back {
  display: none;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #888;
  cursor: pointer;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}
.music-topbar-back:hover { background: rgba(255,255,255,0.06); color: #e0e0e0; }

.music-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 480px;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  padding: 0 14px;
  height: 32px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.music-search-box:focus-within { border-color: rgba(255,255,255,0.15); background: #1e1e1e; }

.music-search-icon { color: #555; flex-shrink: 0; }

.music-search-input {
  flex: 1;
  border: none;
  background: transparent;
  color: #e0e0e0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  outline: none;
  min-width: 0;
}
.music-search-input::placeholder { color: #777; }

.music-search-clear {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  transition: color 0.15s ease;
}
.music-search-clear:hover { color: #e0e0e0; }


/* ─── Main content ────────────────────────────────────────────────────────── */
.music-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.music-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.06) transparent;
}
.music-content::-webkit-scrollbar { width: 6px; }
.music-content::-webkit-scrollbar-track { background: transparent; }
.music-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }
.music-content::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }


/* ─── Loading spinner ─────────────────────────────────────────────────────── */
.music-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
}
.music-loading-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255,255,255,0.06);
  border-top-color: #DE1833;
  border-radius: 50%;
  animation: musicSpin 0.7s linear infinite;
}
@keyframes musicSpin { to { transform: rotate(360deg); } }


/* ─── Home view greeting ──────────────────────────────────────────────────── */
.music-greeting {
  padding: 40px 28px 8px;
}
.music-greeting-text {
  font-size: 26px;
  font-weight: 700;
  color: #e0e0e0;
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

/* ─── Section headers ─────────────────────────────────────────────────────── */
.music-section {
  padding: 8px 28px 20px;
}
.music-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.music-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #e0e0e0;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.music-section-show-all {
  font-size: 11px;
  font-weight: 600;
  color: #666;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease;
  background: none;
  border: none;
  padding: 0;
}
.music-section-show-all:hover { color: #e0e0e0; }


/* ─── Horizontal scroll row ───────────────────────────────────────────────── */
.music-scroll-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.music-scroll-row::-webkit-scrollbar { display: none; }


/* ─── Album cards ─────────────────────────────────────────────────────────── */
.music-album-card {
  flex: 0 0 168px;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  padding: 12px 12px 10px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  position: relative;
  scroll-snap-align: start;
}
.music-album-card:hover { background: rgba(255,255,255,0.06); }

.music-album-art {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: #161616;
  overflow: hidden;
  position: relative;
  margin-bottom: 8px;
}
.music-album-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}
.music-album-art-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2a2a2a;
}

/* Play button overlay on album card */
.music-card-play {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #DE1833;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  z-index: 2;
}
.music-card-play svg { color: #fff; }
.music-album-card:hover .music-card-play { opacity: 1; transform: translateY(0); }
.music-card-play:hover { transform: scale(1.05) translateY(0); box-shadow: 0 8px 24px rgba(222,24,51,0.4); }

.music-album-name {
  font-size: 12px;
  font-weight: 600;
  color: #e0e0e0;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.music-album-artist {
  font-size: 11px;
  color: #666;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.music-album-meta {
  font-size: 10px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 1px;
}


/* ─── Album grid ──────────────────────────────────────────────────────────── */
.music-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}
.music-grid .music-album-card { flex: unset; }


/* ─── Artist cards ────────────────────────────────────────────────────────── */
.music-artist-card {
  flex: 0 0 152px;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
  text-align: center;
  scroll-snap-align: start;
}
.music-artist-card:hover { background: rgba(255,255,255,0.06); }

.music-artist-art {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: #161616;
  overflow: hidden;
  margin: 0 auto 12px;
  position: relative;
}
.music-artist-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.music-artist-art-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2a2a2a;
}
.music-artist-name {
  font-size: 12px;
  font-weight: 600;
  color: #e0e0e0;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.music-artist-meta {
  font-size: 10px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 2px;
}
.music-artist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 12px;
}
.music-artist-grid .music-artist-card { flex: unset; }


/* ─── Artist page: Spotify-style sections ─────────────────────────────────── */

/* Popular section: SEE MORE / SHOW LESS button */
.music-see-more {
  display: inline-block;
  background: none;
  border: none;
  color: #888;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  padding: 12px 0 0;
  transition: color 0.15s ease;
}
.music-see-more:hover { color: #e0e0e0; }

/* SHOW ALL / SHOW LESS link in section headers */
.music-show-all {
  background: none;
  border: none;
  color: #888;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
  white-space: nowrap;
}
.music-show-all:hover { color: #e0e0e0; }

/* Discography filter pills */
.music-disco-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.music-disco-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  color: #aaa;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 6px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.music-disco-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #e0e0e0;
}
.music-disco-pill.active {
  background: #e0e0e0;
  border-color: #e0e0e0;
  color: #0a0a0a;
}
.music-disco-pill.active:hover {
  background: #fff;
  border-color: #fff;
  color: #0a0a0a;
}

/* Empty inline message (when discography filter has no results) */
.music-empty-inline {
  font-size: 12px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 20px 0;
}


/* ─── Detail header (album / artist / playlist / liked) ───────────────────── */
.music-detail-header {
  display: flex;
  gap: 24px;
  padding: 32px 28px 20px;
  align-items: flex-end;
}
.music-detail-art {
  width: 192px;
  height: 192px;
  border-radius: 8px;
  background: #161616;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.music-detail-art.round { border-radius: 50%; }
.music-detail-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.music-detail-art-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2a2a2a;
}

/* Liked songs gradient art */
.music-liked-art {
  background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 50%, #991b1b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.music-liked-art svg { color: #fff; width: 64px; height: 64px; }

/* Playlist gradient art */
.music-playlist-art-gradient {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.music-playlist-art-gradient svg { color: #444; width: 56px; height: 56px; }

.music-detail-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding-bottom: 4px;
}
.music-detail-type {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.music-detail-title {
  font-size: 32px;
  font-weight: 700;
  color: #e0e0e0;
  letter-spacing: -0.5px;
  text-transform: uppercase;
  line-height: 1.1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.music-detail-title.editable {
  cursor: text;
  outline: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.music-detail-title.editable:focus { border-bottom-color: #DE1833; }

.music-detail-subtitle {
  font-size: 13px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.music-detail-subtitle a {
  color: #ccc;
  text-decoration: none;
  transition: color 0.15s ease;
}
.music-detail-subtitle a:hover { color: #fff; text-decoration: underline; }

.music-detail-meta {
  font-size: 12px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.music-detail-desc {
  font-size: 12px;
  color: #666;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  max-width: 400px;
  outline: none;
}
.music-detail-desc.editable { cursor: text; border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.music-detail-desc.editable:focus { border-bottom-color: #DE1833; }


/* ─── Action bar (play/shuffle/like) ──────────────────────────────────────── */
.music-actions-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 28px 16px;
}

.music-play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #DE1833;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.15s ease;
  box-shadow: 0 4px 16px rgba(222,24,51,0.3);
}
.music-play-btn:hover { transform: scale(1.06); box-shadow: 0 6px 20px rgba(222,24,51,0.4); background: #e52040; }
.music-play-btn svg { color: #fff; width: 20px; height: 20px; }

.music-shuffle-btn, .music-like-all-btn, .music-delete-playlist-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.music-shuffle-btn:hover, .music-like-all-btn:hover { color: #e0e0e0; border-color: rgba(255,255,255,0.2); }
.music-delete-playlist-btn:hover { color: #DE1833; border-color: rgba(222,24,51,0.3); }


/* ─── Track list ──────────────────────────────────────────────────────────── */
.music-track-list {
  padding: 0 16px 24px;
}

.music-track-header {
  display: grid;
  grid-template-columns: 40px 44px 1fr 0.5fr 60px 40px;
  gap: 12px;
  align-items: center;
  padding: 0 12px 8px;
  font-size: 10px;
  font-weight: 600;
  color: #444;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  margin-bottom: 4px;
}

.music-track-row {
  display: grid;
  grid-template-columns: 40px 44px 1fr 0.5fr 60px 40px;
  gap: 12px;
  align-items: center;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.12s ease;
  cursor: pointer;
  position: relative;
}
.music-track-row:hover { background: rgba(255,255,255,0.04); }
.music-track-row.playing { background: rgba(222,24,51,0.06); }
.music-track-row.unavailable { opacity: 0.35; pointer-events: none; }

.music-track-num {
  font-size: 13px;
  color: #666;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.music-track-row.playing .music-track-num { color: #DE1833; }
.music-track-row:hover .music-track-num-text { display: none; }
.music-track-row:hover .music-track-play-icon { display: flex; }
.music-track-play-icon {
  display: none;
  align-items: center;
  justify-content: center;
  color: #e0e0e0;
}

/* Static red play/pause icon for currently playing */
.music-track-row.playing .music-track-num-text { display: none; }
.music-track-row.playing .music-track-play-icon { display: flex; color: #DE1833; }

.music-track-art {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: #161616;
  overflow: hidden;
  flex-shrink: 0;
}
.music-track-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.music-track-art-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2a2a2a;
}

.music-track-info { min-width: 0; overflow: hidden; }
.music-track-title {
  font-size: 13px;
  font-weight: 500;
  color: #e0e0e0;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.1px;
}
.music-track-row.playing .music-track-title { color: #DE1833; }

.music-track-artists {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.music-track-artists a {
  color: #666;
  text-decoration: none;
  transition: color 0.12s ease;
}
.music-track-artists a:hover { color: #e0e0e0; text-decoration: underline; }

.music-track-album {
  font-size: 12px;
  color: #555;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: color 0.12s ease;
}
.music-track-album:hover { color: #e0e0e0; text-decoration: underline; }

.music-track-duration {
  font-size: 12px;
  color: #666;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.music-track-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.music-heart-btn, .music-more-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444;
  transition: color 0.15s ease, transform 0.15s ease;
  opacity: 0;
}
.music-track-row:hover .music-heart-btn,
.music-track-row:hover .music-more-btn { opacity: 1; }
.music-heart-btn.liked { opacity: 1; color: #DE1833; }
.music-heart-btn:hover { color: #DE1833; transform: scale(1.15); }
.music-more-btn:hover { color: #e0e0e0; }


/* ─── Browse tabs ─────────────────────────────────────────────────────────── */
.music-tabs {
  display: flex;
  gap: 8px;
  padding: 16px 28px 0;
}
.music-tab {
  padding: 7px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: none;
  color: #888;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.music-tab:hover { background: rgba(255,255,255,0.08); color: #e0e0e0; }
.music-tab.active { background: #e0e0e0; color: #0a0a0a; }


/* ─── Empty state ─────────────────────────────────────────────────────────── */
.music-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}
.music-empty-icon { color: #3f3f3f; margin-bottom: 16px; }
.music-empty-text {
  font-size: 14px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.music-empty-sub {
  font-size: 12px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 4px;
}
.music-empty-btn {
  margin-top: 16px;
  padding: 10px 24px;
  border-radius: 20px;
  background: #DE1833;
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.music-empty-btn:hover { background: #e52040; transform: scale(1.03); }


/* ─── Back button ─────────────────────────────────────────────────────────── */
.music-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 16px 28px 0;
  color: #666;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  background: none;
  border: none;
  transition: color 0.15s ease;
}
.music-back-btn:hover { color: #e0e0e0; }


/* ─── Context menu ────────────────────────────────────────────────────────── */
.music-context-menu {
  position: fixed;
  z-index: 2000;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 4px;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.music-context-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 4px;
  color: #ccc;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.1s ease;
  position: relative;
}
.music-context-item:hover { background: rgba(255,255,255,0.06); }
.music-context-item svg { flex-shrink: 0; opacity: 0.6; }
.music-context-arrow { margin-left: auto; }
.music-context-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 2px 8px; }

.music-context-submenu {
  position: absolute;
  left: 100%;
  top: -4px;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 4px;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  max-height: 300px;
  overflow-y: auto;
}


/* ─── Create playlist modal ───────────────────────────────────────────────── */
.music-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: musicFadeIn 0.15s ease;
}
@keyframes musicFadeIn { from { opacity: 0; } to { opacity: 1; } }

.music-modal {
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 28px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  animation: musicSlideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes musicSlideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.music-modal-header {
  font-size: 16px;
  font-weight: 700;
  color: #e0e0e0;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.music-modal-body { display: flex; flex-direction: column; gap: 12px; }

.music-modal-input {
  width: 100%;
  padding: 10px 14px;
  background: #111;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}
.music-modal-input:focus { border-color: rgba(255,255,255,0.2); }
.music-modal-input::placeholder { color: #444; text-transform: uppercase; }

.music-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.music-modal-btn {
  padding: 9px 22px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.music-modal-btn-cancel { background: transparent; color: #888; border: 1px solid rgba(255,255,255,0.1); }
.music-modal-btn-cancel:hover { color: #e0e0e0; border-color: rgba(255,255,255,0.2); }
.music-modal-btn-confirm { background: #DE1833; color: #fff; }
.music-modal-btn-confirm:hover { background: #e52040; transform: scale(1.02); }


/* ─── Search results sections ─────────────────────────────────────────────── */
.music-search-section {
  padding: 16px 28px;
}
.music-search-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #888;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}


/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .music-track-header, .music-track-row {
    grid-template-columns: 40px 44px 1fr 60px 40px;
  }
  .music-track-header .music-col-album,
  .music-track-row .music-track-album { display: none; }
}

@media (max-width: 850px) {
  .music-sidebar {
    position: fixed;
    left: -280px;
    top: 48px;
    bottom: 0;
    z-index: 100;
    transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }
  .music-sidebar.open {
    left: 0;
    box-shadow: 8px 0 32px rgba(0,0,0,0.5);
  }
  .music-sidebar-toggle { display: flex; }
  /* Topbar back button visible on mobile when in a detail view */
  .music-topbar-back.visible { display: flex; }
  /* Hide the inline back button in content on mobile -- topbar one takes over */
  .music-back-btn { display: none !important; }

  /* ── Spotify-style mini bar (all pages on mobile) ── */
  .music-player {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    overflow: hidden;
  }
  .music-player-main {
    grid-template-columns: 20px 48px 1fr auto auto;
    grid-template-rows: auto;
    gap: 0 8px;
    padding: 8px 12px;
  }
  .music-player-art {
    width: 48px;
    height: 48px;
    grid-row: 1;
    grid-column: 2;
    border-radius: 6px;
    background: #181818;
  }
  .music-player-art img { width: 48px; height: 48px; border-radius: 6px; }
  .music-player-info {
    grid-row: 1;
    grid-column: 3;
    align-self: center;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
    min-width: 0;
  }
  .music-player-title-wrap {
    -webkit-mask-image: none;
    mask-image: none;
    flex: 1;
    min-width: 0;
  }
  .music-player-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
  }
  .music-player-artist {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 1px;
  }
  /* Hide desktop heart/add-to-playlist in mini bar (mobile uses .mp-fs-actions instead) */
  .mp-add-to-playlist { display: none; }
  .mp-bar-heart { display: none; }
  /* Show sync + heart + add buttons in mini bar (all pages), evenly spaced */
  .mp-fs-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
  }
  .mp-fs-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .mp-fs-action-btn svg {
    width: 16px;
    height: 16px;
  }
  .mp-fs-heart-btn.liked {
    color: #DE1833;
  }
  /* Show the sync/devices button in mini bar (same row as heart/+) */
  /* Disable clickable title/artist in mini bar so taps expand to fullscreen */
  .music-player:not(.mp-fullscreen) .mp-title-clickable {
    cursor: default;
  }
  .music-player:not(.mp-fullscreen) .mp-artist-link {
    cursor: default;
  }
  /* Hide progress bar in mini bar (shown in fullscreen) */
  .music-player-progress-wrap,
  .music-player-progress-wrap.mp-progress-center,
  .music-player-info .music-player-progress-wrap {
    display: none;
  }
  /* Hide entire controls row in mini bar */
  .music-player-controls { display: none; }
  /* Hide visualizer in mini bar */
  .mp-fx-active .mp-visualizer { display: none; }
  .mp-fx-chaos .mp-visualizer { display: none; }
  /* Hide the right section in mini bar */
  .music-player-right { display: none; }
  .music-player-volume { display: none; }
  /* Hide the standalone mini devices button (sync is now in mp-fs-actions row) */
  .mp-mini-devices {
    display: none !important;
  }
  .mp-mini-devices.mp-sync-active { color: #1DB954; }
  .mp-mini-devices.mp-sync-active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #1DB954;
  }
  .mp-mini-play {
    display: flex;
    grid-row: 1;
    grid-column: 5;
    align-self: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: transparent;
    color: #fff;
    border-radius: 50%;
  }
  .mp-mini-play:hover,
  .mp-mini-play:active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
  }
  .mp-mini-play svg { width: 22px; height: 22px; }
  /* Mobile dismiss button - grid column 1, left of album art */
  .mp-mobile-close {
    display: flex;
    grid-row: 1;
    grid-column: 1;
    align-self: center;
    justify-self: center;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.25);
    padding: 0;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
  }
  .mp-mobile-close:hover,
  .mp-mobile-close:active {
    color: rgba(255, 255, 255, 0.5);
  }
  .mp-mobile-close svg {
    width: 12px;
    height: 12px;
  }
  .mp-mobile-close:hover,
  .mp-mobile-close:active {
    color: rgba(255, 255, 255, 0.5);
  }
  .mp-mobile-close svg {
    width: 12px;
    height: 12px;
  }
  /* Hide mini play and mini devices in fullscreen (real controls take over) */
  .music-player.mp-fullscreen .mp-mini-play {
    display: none;
  }
  .music-player.mp-fullscreen .mp-mini-devices {
    display: none;
  }
  /* Hide mobile close in fullscreen */
  .music-player.mp-fullscreen .mp-mobile-close {
    display: none;
  }
  /* Re-show controls and right section in fullscreen */
  .music-player.mp-fullscreen .music-player-controls {
    display: flex;
  }
  .music-player.mp-fullscreen .music-player-progress-wrap,
  .music-player.mp-fullscreen .music-player-progress-wrap.mp-progress-center {
    display: flex;
  }

  .music-detail-header { flex-direction: column; align-items: center; text-align: center; padding: 24px 20px 16px; gap: 16px; }
  .music-detail-art { width: 160px; height: 160px; }
  .music-detail-title { font-size: 24px; }
  .music-detail-info { align-items: center; }
}

@media (max-width: 600px) {
  .music-greeting { padding: 24px 16px 4px; }
  .music-greeting-text { font-size: 20px; }
  .music-section { padding: 8px 16px 16px; }
  .music-section-title { font-size: 14px; }
  .music-album-card { flex: 0 0 140px; padding: 10px; }
  .music-artist-card { flex: 0 0 120px; padding: 10px; }
  .music-artist-art { width: 88px; height: 88px; }
  .music-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .music-detail-art { width: 140px; height: 140px; }
  .music-detail-title { font-size: 20px; }
  .music-track-header, .music-track-row {
    grid-template-columns: 32px 36px 1fr 50px 32px;
    gap: 8px;
    padding: 5px 8px;
  }
  .music-track-art { width: 36px; height: 36px; }
  .music-track-title { font-size: 12px; }
  .music-track-artists { font-size: 10px; }
  .music-actions-bar { padding: 8px 16px 12px; }
  .music-track-list { padding: 0 8px 24px; }
  .music-tabs { padding: 12px 16px 0; }
  .music-back-btn { padding: 12px 16px 0; }
  .music-topbar { padding: 6px 12px; }
  .music-search-box { max-width: none; }
  .music-disco-pills { gap: 6px; }
  .music-disco-pill { font-size: 10px; padding: 5px 12px; }
  .music-see-more { font-size: 10px; }
  .music-show-all { font-size: 10px; }
}

/* ─── Fullscreen "Now Playing" Mobile View (Music Page only) ──────── */
/* Triggered by .mp-fullscreen class added via JS on mobile (<=850px) */

@media (max-width: 850px) {
  /* Slide-up animation */
  @keyframes mpFsSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  @keyframes mpFsSlideDown {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(100%); opacity: 0; }
  }

  .music-player.mp-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    z-index: 2000;
    border-radius: 0;
    border: none;
    background: #0a0a0a;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow-y: auto;
    overflow-x: hidden;
    animation: mpFsSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    display: flex;
    flex-direction: column;
    touch-action: none;              /* JS handles vertical swipe-to-dismiss */
    -webkit-overflow-scrolling: auto; /* disable momentum scroll to avoid gesture conflicts */
    overscroll-behavior: none;       /* prevent pull-to-refresh / overscroll chaining */
  }

  .music-player.mp-fullscreen.mp-fs-closing {
    animation: mpFsSlideDown 0.25s ease-in forwards;
  }

  /* Dragging state: disable CSS animation and scrolling so JS transform takes over */
  .music-player.mp-fullscreen.mp-fs-dragging {
    animation: none !important;
    will-change: transform, opacity;
    overflow-y: hidden !important;
  }

  /* Prevent native image drag on fullscreen album art */
  .music-player.mp-fullscreen .music-player-art img {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
    -webkit-touch-callout: none;
  }

  /* Prevent body scroll when fullscreen */
  body.mp-fs-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
  }

  /* ── Fullscreen header ── */
  .music-player.mp-fullscreen .mp-fs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    flex-shrink: 0;
  }

  .mp-fs-collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: #aaa;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
    padding: 0;
  }
  .mp-fs-collapse:hover,
  .mp-fs-collapse:active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
  }

  .mp-fs-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #888;
    text-transform: uppercase;
  }

  .music-player.mp-fullscreen .mp-fs-devices-btn {
    margin-right: auto;
  }
  .mp-fs-devices-btn {
    position: relative;
  }
  .mp-fs-devices-btn.mp-sync-active { color: #1DB954 !important; }
  .mp-fs-devices-btn.mp-sync-active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #1DB954;
  }
  .mp-fs-playlist-btn {
    width: 44px;
    height: 44px;
    color: #aaa;
  }

  /* ── Fullscreen main grid becomes vertical flex ── */
  .music-player.mp-fullscreen .music-player-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 28px;
    padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
    gap: 0;
    flex: 1;
    min-height: 0;
    justify-content: flex-end;
  }

  /* ── Large album art ── */
  .music-player.mp-fullscreen .music-player-art {
    order: 1;
    width: min(82vw, 380px);
    height: min(82vw, 380px);
    border-radius: 12px;
    margin: auto 0;
    flex-shrink: 0;
    background: rgba(222, 24, 51, 0.08);
    grid-row: unset;
    grid-column: unset;
    align-self: center;
  }
  .music-player.mp-fullscreen .music-player-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
  }
  .music-player.mp-fullscreen .music-player-art svg {
    width: 64px;
    height: 64px;
  }

  /* ── Track info: full width, left aligned, anchored to bottom zone ── */
  .music-player.mp-fullscreen .music-player-info {
    order: 2;
    width: 100%;
    grid-row: unset;
    grid-column: unset;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-top: 32px;
    margin-bottom: 28px;
    flex-shrink: 0;
  }
  .music-player.mp-fullscreen .music-player-title-wrap {
    width: 100%;
    max-width: 100%;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .music-player.mp-fullscreen .music-player-title {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .music-player.mp-fullscreen .music-player-artist {
    display: block;
    font-size: 14px;
    color: #aaa;
    margin-top: 2px;
  }
  /* Hide the inline heart/add-to-playlist buttons in fullscreen (uses .mp-fs-actions instead) */
  .music-player.mp-fullscreen .mp-add-to-playlist,
  .music-player.mp-fullscreen .mp-bar-heart {
    display: none;
  }

  /* ── Fullscreen action buttons (sync left, heart + add right) ── */
  .music-player.mp-fullscreen .mp-fs-actions {
    display: flex;
    align-items: center;
    align-self: stretch;
    gap: 16px;
    margin-top: 8px;
  }
  .music-player.mp-fullscreen .mp-fs-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #aaa;
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
    transition: color 0.15s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .music-player.mp-fullscreen .mp-fs-action-btn svg {
    width: 22px;
    height: 22px;
  }
  .music-player.mp-fullscreen .mp-fs-action-btn:active {
    transform: scale(0.9);
  }
  /* Heart button liked state */
  .music-player.mp-fullscreen .mp-fs-heart-btn.liked {
    color: #DE1833;
  }
  /* Hover only on pointer devices */
  @media (hover: hover) {
    .music-player.mp-fullscreen .mp-fs-action-btn:hover {
      color: #fff;
    }
    .music-player.mp-fullscreen .mp-fs-heart-btn.liked:hover {
      color: #ff2d4d;
    }
  }

  /* ── Progress bar: slider on top, timestamps below on same row ── */
  .music-player.mp-fullscreen .music-player-progress-wrap,
  .music-player.mp-fullscreen .music-player-progress-wrap.mp-progress-center {
    display: flex;
    order: 3;
    width: 100%;
    grid-row: unset;
    grid-column: unset;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 4px;
    flex-shrink: 0;
  }
  /* Slider takes full row, ordered first */
  .music-player.mp-fullscreen .music-player-progress {
    order: 1;
    width: 100%;
    flex: 0 0 100%;
    height: 4px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.15);
  }
  .music-player.mp-fullscreen .music-player-progress::-webkit-slider-runnable-track {
    height: 4px;
    background: transparent;
  }
  .music-player.mp-fullscreen .music-player-progress::-moz-range-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
  }
  .music-player.mp-fullscreen .music-player-progress::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    margin-top: -4px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  }
  .music-player.mp-fullscreen .music-player-progress::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  }
  .music-player.mp-fullscreen .music-player-progress::-moz-range-progress {
    background: #fff;
    height: 4px;
    border-radius: 2px;
  }
  /* Both timestamps below the slider on the same row */
  .music-player.mp-fullscreen .music-player-time {
    order: 2;
    font-size: 11px;
    color: #999;
    min-width: 0;
  }
  .music-player.mp-fullscreen .music-player-time:first-of-type {
    text-align: left;
  }
  .music-player.mp-fullscreen .music-player-time:last-of-type {
    order: 3;
    margin-left: auto;
    text-align: right;
  }

  /* ── Controls: large, evenly spaced row ── */
  .music-player.mp-fullscreen .music-player-controls {
    order: 4;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    padding: 16px 0 0;
    grid-row: unset;
    grid-column: unset;
    flex-wrap: nowrap;
    overflow: visible;
    max-width: none;
    flex-shrink: 0;
  }
  /* Hide FX, autoplay, divider in fullscreen controls */
  .music-player.mp-fullscreen #mpFxBtn,
  .music-player.mp-fullscreen #mpAutoplay,
  .music-player.mp-fullscreen .mp-controls-divider {
    display: none !important;
  }

  /* ── Volume slider: hidden on mobile fullscreen (hardware buttons control volume) ── */

  /* Fullscreen button sizes */
  .music-player.mp-fullscreen .music-player-controls > .mp-btn {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
  }
  .music-player.mp-fullscreen .music-player-controls > .mp-btn svg {
    width: 30px;
    height: 30px;
  }
  .music-player.mp-fullscreen .music-player-controls > .mp-btn-sm {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .music-player.mp-fullscreen .music-player-controls > .mp-btn-sm svg {
    width: 22px;
    height: 22px;
  }
  /* Prev/Next: 2x larger for easy thumb reach */
  .music-player.mp-fullscreen .music-player-controls > #mpPrev,
  .music-player.mp-fullscreen .music-player-controls > #mpNext {
    width: 80px;
    height: 80px;
    min-width: 80px;
    min-height: 80px;
  }
  .music-player.mp-fullscreen .music-player-controls > #mpPrev svg,
  .music-player.mp-fullscreen .music-player-controls > #mpNext svg {
    width: 42px;
    height: 42px;
  }
  /* Play/pause: large white circle like Spotify */
  .music-player.mp-fullscreen .music-player-controls > .mp-btn-play {
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    background: #fff;
    color: #000;
    border-radius: 50%;
  }
  .music-player.mp-fullscreen .music-player-controls > .mp-btn-play svg {
    width: 28px;
    height: 28px;
  }

  /* ── Fullscreen: kill ALL pseudo-class backgrounds unconditionally ── */
  /* (not gated behind @media hover:none — Chrome/Brave Android report hover:hover) */
  .music-player.mp-fullscreen .music-player-controls > .mp-btn,
  .music-player.mp-fullscreen .music-player-controls > .mp-btn:hover,
  .music-player.mp-fullscreen .music-player-controls > .mp-btn:active,
  .music-player.mp-fullscreen .music-player-controls > .mp-btn:focus,
  .music-player.mp-fullscreen .music-player-controls > .mp-btn:focus-visible {
    background: transparent !important;
    outline: none !important;
  }
  .music-player.mp-fullscreen .music-player-controls > .mp-btn-play,
  .music-player.mp-fullscreen .music-player-controls > .mp-btn-play:hover,
  .music-player.mp-fullscreen .music-player-controls > .mp-btn-play:active,
  .music-player.mp-fullscreen .music-player-controls > .mp-btn-play:focus,
  .music-player.mp-fullscreen .music-player-controls > .mp-btn-play:focus-visible {
    background: #fff !important;
    color: #000 !important;
    outline: none !important;
  }
  /* Fullscreen action buttons (heart/+) */
  .music-player.mp-fullscreen .mp-fs-action-btn,
  .music-player.mp-fullscreen .mp-fs-action-btn:hover,
  .music-player.mp-fullscreen .mp-fs-action-btn:active,
  .music-player.mp-fullscreen .mp-fs-action-btn:focus {
    background: transparent !important;
  }

  /* ── Hide the right section (playlist/close) in fullscreen ── */
  .music-player.mp-fullscreen .music-player-right {
    display: none;
    order: 99;
  }

  /* ── Hide visualizer in fullscreen ── */
  .music-player.mp-fullscreen .mp-visualizer {
    display: none !important;
    order: 98;
  }

  /* ── Devices panel in fullscreen: slide-down overlay drawer ── */
  .music-player.mp-fullscreen .mp-devices-panel {
    position: absolute;
    top: 60px;
    bottom: auto;
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100% - 60px);
    overflow-y: auto;
    touch-action: pan-y;
    background: rgba(18, 18, 18, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: none;
    border-left: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    z-index: 10;
    transform: translateY(-10px);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  }
  .music-player.mp-fullscreen .mp-devices-panel.mp-devices-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .music-player.mp-fullscreen .mp-devices-panel .mp-devices-header {
    background: rgba(18, 18, 18, 0.98);
    padding: 12px 20px;
    font-size: 11px;
    font-weight: 700;
    color: #999;
    letter-spacing: 1.2px;
  }
  .music-player.mp-fullscreen .mp-devices-panel .mp-devices-list {
    padding: 0 8px 12px;
  }
  .music-player.mp-fullscreen .mp-devices-panel .mp-device-item {
    padding: 10px 12px;
    border-radius: 8px;
  }
  .music-player.mp-fullscreen .mp-devices-panel .mp-device-name {
    font-size: 13px;
  }
  .music-player.mp-fullscreen .mp-devices-panel .mp-devices-sync-toggle {
    padding: 10px 14px;
    margin: 0 4px 4px;
  }
  .music-player.mp-fullscreen .mp-devices-panel .mp-devices-sync-label {
    font-size: 12px;
  }

  /* ── Playlist panel in fullscreen: slide-down overlay drawer ── */
  .music-player.mp-fullscreen .mp-playlist-panel {
    position: absolute;
    top: 60px;
    bottom: auto;
    left: 0;
    right: 0;
    max-height: calc(100% - 60px);
    height: auto;
    overflow-y: auto;
    touch-action: pan-y;  /* re-enable vertical scroll inside playlist overlay */
    background: rgba(18, 18, 18, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    z-index: 10;
    transform: translateY(-10px);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  }
  .music-player.mp-fullscreen .mp-playlist-panel.mp-playlist-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .music-player.mp-fullscreen .mp-playlist-panel .mp-playlist-header {
    background: rgba(18, 18, 18, 0.98);
    padding: 12px 20px;
    font-size: 11px;
    font-weight: 700;
    color: #999;
    letter-spacing: 1.2px;
  }
  .music-player.mp-fullscreen .mp-playlist-panel .mp-playlist-list {
    padding: 0 8px 12px;
  }
  .music-player.mp-fullscreen .mp-playlist-panel .mp-playlist-item {
    padding: 10px 12px;
    border-radius: 8px;
  }
  .music-player.mp-fullscreen .mp-playlist-panel .mp-playlist-name {
    font-size: 13px;
  }
  .music-player.mp-fullscreen .mp-playlist-panel .mp-playlist-current {
    background: rgba(222, 24, 51, 0.12);
  }
}

/* ============================================================
   ACCESSIBILITY — Unified keyboard focus rings (AUDIT S2)
   Applied broadly to interactive controls that previously had
   outline:none or no focus state at all. Mouse users are
   unaffected (:focus-visible only triggers for keyboard nav).
   ============================================================ */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible,
.btn-primary:focus-visible,
.auth-form .btn-primary:focus-visible,
.e2ed-submit:focus-visible,
.e2ee-prompt-btn:focus-visible,
.action-btn:focus-visible,
.btn-new-folder:focus-visible,
.btn-upload:focus-visible,
.view-toggle-btn:focus-visible,
.bulk-btn:focus-visible,
.modal-close:focus-visible,
.context-menu-item:focus-visible,
.btn-primary-small:focus-visible,
.btn-browse-download:focus-visible,
.notes-tool-btn:focus-visible,
.notes-action-btn:focus-visible,
.notes-context-item:focus-visible,
.notes-color-dot:focus-visible,
.notes-sidebar-btn:focus-visible,
.mp-btn:focus-visible,
.music-card-play:focus-visible,
.adm-nav-link:focus-visible,
.adm-qaction:focus-visible,
.adm-btn-sm:focus-visible,
.adm-page-btn:focus-visible,
.adm-window-btn:focus-visible,
.sn-btn:focus-visible,
.account-btn:focus-visible,
.account-nav-link:focus-visible,
.apikey-ip-add-btn:focus-visible,
.copy-btn:focus-visible,
.docs-nav-link:focus-visible,
.edit-btn:focus-visible,
.copy-link-btn:focus-visible,
.delete-btn:focus-visible,
.notfound-button:focus-visible,
.land-btn-primary:focus-visible,
.land-btn-ghost:focus-visible {
  outline: 2px solid #DE1833;
  outline-offset: 2px;
}

/* Custom toggle switches: visually-hidden checkbox -> ring the slider */
.toggle-checkbox:focus-visible + .toggle-slider,
.adm-toggle input:focus-visible + .adm-toggle-slider,
.notes-toggle-label input:focus-visible + .notes-toggle-check {
  box-shadow: 0 0 0 2px rgba(222, 24, 51, 0.6);
}

/* Text inputs already styled with a focus ring keep theirs; this adds a
   stronger keyboard ring to the field types that lacked one. */
.manage-setting-input:focus-visible,
.manage-setting-select:focus-visible,
.manage-share-input:focus-visible,
.account-form-input:focus-visible {
  outline: none;
  border-color: #DE1833;
  box-shadow: 0 0 0 3px rgba(222, 24, 51, 0.25);
}
