/* =========================
   Modern File-Manager Theme
   (FullCalendar + UI bits)
   ========================= */

/* ---- Root / page constraints (NO page scroll) ---- */
html, body { height: 100%; overflow: hidden; }

/* If you have a fixed top navbar, account for it here */
:root { --fm-appbar-h: 64px; }
@media (min-width: 992px) { :root { --fm-appbar-h: 70px; } }

/* ---- Design tokens (light/dark aware) ---- */
:root,
[data-bs-theme="light"] {
  --fm-bg: var(--bs-body-bg, #ffffff);
  --fm-text: var(--bs-body-color, #1a1d21);
  --fm-muted: var(--bs-secondary-color, #6c757d);
  --fm-surface: #ffffff;
  --fm-elevated: #f7f8fa;
  --fm-border: rgba(0,0,0,0.08);
  --fm-ring: rgba(13,110,253,0.35);
  --fm-accent: var(--bs-primary, #0d6efd);
  --fm-hover: rgba(13,110,253,0.06);
  --fm-danger: #dc3545;
  --fm-shadow: 0 10px 30px rgba(0,0,0,0.08);
  --fm-softshadow: 0 4px 16px rgba(0,0,0,0.06);

  /* Gradients */
  --fm-grad-1: linear-gradient(135deg, rgba(13,110,253,0.18), rgba(111,66,193,0.18));
  --fm-grad-2: linear-gradient(180deg, rgba(13,110,253,0.08), rgba(13,110,253,0.0));
}

[data-bs-theme="dark"] {
  --fm-bg: var(--bs-body-bg, #0e1117);
  --fm-text: var(--bs-body-color, #e7e9ee);
  --fm-muted: var(--bs-secondary-color, #a0a4ab);
  --fm-surface: #12151b;
  --fm-elevated: #141925;
  --fm-border: rgba(255,255,255,0.1);
  --fm-ring: rgba(61,139,253,0.45);
  --fm-accent: var(--bs-primary, #3d8bfd);
  --fm-hover: rgba(61,139,253,0.14);
  --fm-danger: #ff6b6b;
  --fm-shadow: 0 18px 42px rgba(0,0,0,0.45);
  --fm-softshadow: 0 6px 22px rgba(0,0,0,0.32);

  --fm-grad-1: linear-gradient(135deg, rgba(61,139,253,0.2), rgba(166,126,255,0.18));
  --fm-grad-2: linear-gradient(180deg, rgba(61,139,253,0.14), rgba(61,139,253,0.0));
}

/* ---- Calendar container (unchanged) ---- */
#calendar {
  width: 100%;
  margin: 24px auto;
  height: clamp(600px, 85vh, 1000px);
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  border-radius: 16px;
  box-shadow: var(--fm-shadow);
  overflow: hidden;
}

/* ---- FullCalendar: overall structure ---- */
.fc,
.fc * {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .12s ease;
}

.fc .fc-scrollgrid,
.fc-scrollgrid,
.fc-scrollgrid-section {
  border: 1px solid var(--fm-border) !important;
  background: var(--fm-surface);
}

.fc-theme-standard td,
.fc-theme-standard th,
.fc-daygrid-day,
.fc-daygrid-day-frame,
.fc-col-header-cell,
.fc-timegrid-slot,
.fc-timegrid-slot-label {
  border: 1px solid transparent !important;
}

/* ---- Header (like a file browser toolbar) ---- */
.fc-header-toolbar {
  padding: 12px 16px;
  background: var(--fm-elevated);
  border-bottom: 1px solid var(--fm-border);
}

.fc-toolbar-chunk .fc-button {
  border-radius: 999px !important;
  border: 1px solid var(--fm-border) !important;
  background: var(--fm-surface) !important;
  color: var(--fm-text) !important;
  box-shadow: var(--fm-softshadow);
  padding-inline: 14px !important;
}

.fc-toolbar-chunk .fc-button:hover,
.fc-toolbar-chunk .fc-button:focus-visible {
  outline: none;
  border-color: var(--fm-accent) !important;
  box-shadow: 0 0 0 4px var(--fm-ring);
}

/* ---- Column headers (days) ---- */
.fc-col-header-cell {
  background: var(--fm-elevated);
  border-bottom: 1px solid var(--fm-border) !important;
}
.fc-col-header-cell-cushion {
  color: var(--fm-muted);
  font-weight: 600;
  text-decoration: none;
  padding: 10px 8px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

/* ---- Day grid: file-tile vibe ---- */
.fc-daygrid-day {
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  border-radius: 12px;
  margin: 6px;
  overflow: hidden;
}
.fc-daygrid-day:hover {
  background: color-mix(in srgb, var(--fm-hover) 65%, var(--fm-surface));
}
.fc-daygrid-day-frame {
  padding: 6px;
}

/* Date number as a subtle chip */
.fc-daygrid-day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  color: var(--fm-muted);
  background: transparent;
  border-radius: 10px;
  padding: 2px 8px;
  text-decoration: none !important;
}
.fc-day-today .fc-daygrid-day-number {
  color: var(--fm-accent);
  background: var(--fm-hover);
  font-weight: 700;
}

/* Events = cards/files */
.fc-daygrid-event,
.fc-timegrid-event {
  border: 1px solid var(--fm-border);
  border-radius: 12px;
  background: var(--fm-elevated);
  box-shadow: var(--fm-softshadow);
  overflow: hidden;
}
.fc-daygrid-event:hover,
.fc-timegrid-event:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0,0,0,.15);
  z-index: 3;
}

/* ---- Time grid (week/day view) ---- */
.fc-timegrid-slot[data-time$=":00:00"] {
  border-top: 1px dashed var(--fm-border) !important;
}
.fc-timegrid-slot.fc-timegrid-slot-minor {
  border-top: 1px solid transparent !important;
}
.fc-timegrid-axis {
  font-size: 0.85rem;
  color: var(--fm-muted);
  background: var(--fm-elevated);
  border-right: 1px solid var(--fm-border) !important;
}

/* Now line */
.fc-timegrid-now-indicator-line {
  border-top: 2px solid var(--fm-danger) !important;
  z-index: 4;
}

/* ---- Selection / focus ring ---- */
.fc .fc-highlight,
.fc .fc-event.fc-event-selected {
  box-shadow: 0 0 0 3px var(--fm-ring) inset;
  outline: none;
}

/* ---- Progress bar (accent aware) ---- */
.progress-bar-animation {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  background-color: var(--fm-accent);
  width: 0%;
  transition: width .3s linear;
}
.progress-bar-running { width: 100%; }

/* ---- Pressed feedback ---- */
.button-pressed {
  transform: scale(0.98);
  transition: transform .08s ease-in-out;
}

/* ---- Context menu (dark/light aware) ---- */
.custom-context-menu {
  position: absolute;
  z-index: 1000;
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  border-radius: 14px;
  padding: 10px;
  box-shadow: var(--fm-shadow);
  min-width: 220px;
  backdrop-filter: saturate(120%) blur(6px);
}
.custom-context-menu ul {
  list-style: none;
  margin: 0; padding: 6px;
}
.custom-context-menu ul li {
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--fm-text);
  cursor: pointer;
}
.custom-context-menu ul li:hover {
  background: var(--fm-hover);
}

/* ---- Utility bits ---- */
[v-cloak] { display: none; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.spin-animation { animation: spin 1s ease-in-out; }

/* Optional: subtle grid padding for daygrid to resemble tiles */
.fc-daygrid-body,
.fc-daygrid-body-unbalanced .fc-daygrid-day-events {
  padding: 4px 6px;
}

/* =======================================================
   FILE MANAGER LAYOUT (dark/light via --fm-* variables)
   ======================================================= */

/* Lock app to viewport minus app bar */
.fm-wrap {
  background: var(--fm-bg);
  height: calc(100vh - var(--fm-appbar-h));
  min-height: auto;
}
.fm-shell { height: 100%; padding-top: 10px; }
.fm-layout { height: 100%; width: 100vw; margin: 0; }

/* ----- Sidebar ----- */
.fm-sidebar {
  height: 100%;
  border-right: 1px solid var(--fm-border);
  background: var(--fm-elevated);
  box-shadow: inset -1px 0 0 var(--fm-border);
  overflow: hidden;
}
.fm-sidebar-inner {
  height: 100%;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Sidebar toolbar */
.fm-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Rounded pill buttons */
.fm-btn-pill {
  border-radius: 999px !important;
  padding-inline: 14px !important;
}

/* ----- Content panel ----- */
.fm-content { height: 100%; min-height: 0; }
.fm-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  border-radius: 18px;
  margin: 12px;
  box-shadow: var(--fm-shadow);
  background-image: var(--fm-grad-2);
}

/* Header (glass, fixed inside panel) */
.fm-header {
  flex: 0 0 auto;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--fm-border);
  background: var(--fm-elevated);
  position: sticky;
  top: 0;
  z-index: 3;
}
.fm-glass {
  background: color-mix(in srgb, var(--fm-elevated) 60%, transparent);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
}

/* Breadcrumb chip */
.fm-breadcrumb-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(72vw, 720px);
  color: var(--fm-text);
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  box-shadow: var(--fm-softshadow);
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Refresh button */
.fm-refresh svg { pointer-events: none; }
.fm-refresh:hover { box-shadow: var(--fm-softshadow); }
.fm-spin-once {
  display: block;
  transform-origin: center;
  transform-box: fill-box;
  transition: transform .35s ease;
}
.fm-refresh.is-loading .fm-spin-once {
  animation: spin .9s linear infinite;
  transition: none;
}
.fm-refresh:active .fm-spin-once { transform: rotate(180deg); }

/* ----- Folder list ----- */
.fm-list {
  border: 1px solid var(--fm-border);
  border-radius: 14px;
  overflow: clip;
  background: var(--fm-surface);
  box-shadow: var(--fm-softshadow);
}
.fm-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  border-bottom: 1px solid var(--fm-border);
  background: transparent;
  color: var(--fm-text);
  padding: 12px 14px;
  text-align: left;
}
.fm-list-item:last-child { border-bottom: none; }
.fm-list-item:hover { background: var(--fm-hover); }
.fm-list-item.is-pressed { transform: scale(0.99); }

/* Long-press progress */
.fm-press-bar {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 0;
  background: var(--fm-accent);
  transition: width .3s linear;
}
.fm-press-bar.is-running { width: 100%; }

/* Dropdown panel */
.fm-dropdown { min-width: 260px; border: 1px solid var(--fm-border); }

/* ----- Files grid (the main scroll area) ----- */
.fm-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(114px, 1fr));
  gap: 16px;
  padding: 16px;
}
@media (min-width: 576px) {
  .fm-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 18px; }
}
@media (min-width: 992px) {
  .fm-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; }
}

/* File tiles */
.fm-filetile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  border-radius: 16px;
  padding: 12px 10px;
  box-shadow: var(--fm-softshadow);
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background-color .12s ease;
  background-image: var(--fm-grad-1);
}
.fm-filetile:hover {
  transform: translateY(-2px);
  box-shadow: var(--fm-shadow);
  background: color-mix(in srgb, var(--fm-hover) 40%, var(--fm-surface));
}
.fm-filetile:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--fm-ring);
}
.fm-filetile.active {
  border-color: var(--fm-accent);
  background: color-mix(in srgb, var(--fm-hover) 60%, var(--fm-surface));
}

/* Optional: if you kept .fm-thumb-gradient, it still works */
.fm-thumb.fm-thumb-gradient {
  background-image:
    radial-gradient(120px 60px at 50% 0%, rgba(13,110,253,0.14), transparent 60%),
    radial-gradient(100px 80px at 20% 80%, rgba(111,66,193,0.14), transparent 60%);
}

/* Filename */
.fm-filename {
  max-width: 100%;
  font-size: .82rem;
  text-align: center;
  color: var(--fm-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress bar (zip/uploads) */
.fm-progress {
  background: var(--fm-elevated);
  border-bottom: 1px solid var(--fm-border);
  padding: 6px 8px;
}
.fm-progress-bar {
  height: 22px;
  background: var(--fm-accent);
  color: #fff;
  text-align: center;
  line-height: 22px;
  border-radius: 8px;
  box-shadow: var(--fm-softshadow);
}

.fm-dropzone {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.fm-dropzone--active {
  background: color-mix(in srgb, var(--fm-accent) 5%, transparent);
}

.fm-dropzone-overlay {
  position: absolute;
  inset: 12px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed color-mix(in srgb, var(--fm-accent) 75%, white);
  border-radius: 18px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--fm-accent) 12%, transparent), transparent 60%),
    color-mix(in srgb, var(--fm-surface) 85%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}

.fm-dropzone-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  color: var(--fm-text);
  padding: 24px 28px;
}

.fm-dropzone-card i {
  font-size: 34px;
  color: var(--fm-accent);
}

.fm-dropzone-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.fm-dropzone-subtitle {
  max-width: min(70vw, 560px);
  color: var(--fm-muted);
  word-break: break-word;
}

/* Drag overlay compatibility (if you add .drag-over on #fileManager) */
#fileManager.drag-over { box-shadow: 0 0 0 4px var(--fm-ring); }

/* Context menu inherits variables set earlier */
.custom-context-menu { backdrop-filter: saturate(120%) blur(6px); }

/* Small helpers */
.text-warning { color: #f1b44c !important; } /* nicer folder yellow in dark mode */

/* ====== App Bar / Menu (dark-light aware) ====== */
.fm-nav {
  background: var(--fm-elevated) !important;
  border-bottom: 1px solid var(--fm-border);
  box-shadow: var(--fm-softshadow);
  -webkit-backdrop-filter: saturate(120%) blur(6px);
  backdrop-filter: saturate(120%) blur(6px);
}

.fm-brand {
  color: var(--fm-text) !important;
  font-weight: 700;
  letter-spacing: .2px;
  display: inline-flex;
  align-items: center;
}
.fm-brand:hover { opacity: .9; text-decoration: none; }

.fm-link {
  color: var(--fm-text) !important;
  border-radius: 12px;
  padding: 8px 12px !important;
}
.fm-link:hover {
  background: var(--fm-hover);
  color: var(--fm-text) !important;
}

/* Dropdown look aligns with the file-manager */
.fm-dropdown {
  min-width: 240px;
  border: 1px solid var(--fm-border);
  background: var(--fm-surface);
  box-shadow: var(--fm-softshadow);
  border-radius: 14px;
  overflow: clip;
}
.fm-dropdown .dropdown-item {
  color: var(--fm-text);
  border-radius: 10px;
}
.fm-dropdown .dropdown-item:hover,
.fm-dropdown .dropdown-item.active,
.fm-dropdown .dropdown-item:active {
  background: var(--fm-hover);
  color: var(--fm-text);
}

/* Make toggler visible in dark mode too */
.navbar-toggler { border-color: var(--fm-border) !important; }
.navbar-toggler-icon { filter: invert(var(--fm-toggler-invert, 0)); }
[data-bs-theme="dark"] .navbar-toggler-icon { --fm-toggler-invert: 1; }

/* If you previously used body padding for fixed header, keep it — but it's visual only now */
body { padding-top: var(--fm-appbar-h); }

/* Drawer polish */
.fm-drawer .offcanvas-header {
  border-bottom: 1px solid var(--fm-border);
  background: var(--fm-elevated);
}
.fm-drawer .offcanvas-body {
  background: var(--fm-surface);
}

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  .fm-filetile, .fc, .fc * { transition: none !important; }
}

.fm-filetile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* keep content at top of the tile */
  gap: 8px;
  line-height: 1.1;            /* avoids tall inline line boxes */
}

/* --- HARD CENTER the file icon inside the thumb --- */
.fm-thumb {
  position: relative;          /* anchor for absolute centering */
  width: 72px;
  height: 72px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--fm-border);
  background: var(--fm-surface);
  /* optional gradient:
  background-image:
    radial-gradient(120px 60px at 50% 0%, rgba(13,110,253,0.14), transparent 60%),
    radial-gradient(100px 80px at 20% 80%, rgba(111,66,193,0.14), transparent 60%);
  */
}

.fm-thumb img {
  position: absolute;          /* ignore line boxes entirely */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);  /* true center */
  max-width: 70%;
  max-height: 70%;
  width: auto;
  height: auto;
  display: block;              /* no baseline gap */
  object-fit: contain;         /* keep aspect */
  pointer-events: none;        /* just in case */
}

/* If Bootstrap's .img-fluid is present, keep our sizing rules */
.fm-thumb img.img-fluid {
  height: auto !important;
  max-width: 70% !important;
  max-height: 70% !important;
}

/* Ensure the tile itself doesn’t vertically distribute content oddly */
.fm-filetile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* content stays toward top */
  gap: 8px;
  line-height: 1.1;
  min-height: 0;               /* avoid grid-stretch issues in some browsers */
  height: 120px;
}
/* Thumb box sizing + centering */
.fm-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--fm-border);
  background-color: var(--fm-surface);
  flex: 0 0 72px;             /* never stretch/shrink in the tile */
}

/* Render the icon as a background image */
.fm-thumb-has-image {
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 70% auto;  /* scale nicely without distortion */
}

/* Ensure tile layout never pushes the thumb down */
.fm-filetile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* keep content near top */
  gap: 8px;
  line-height: 1.1;
  min-height: 0;
}

/* If any old <img> survives inside .fm-thumb, neutralize it */
.fm-thumb img {
  display: none !important;
}
/* Icon-based thumb */
.fm-thumb--icon {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.fm-thumb--icon i {
  font-size: 28px;                 /* balanced with your 72px thumb */
  line-height: 1;
  color: var(--thumb-accent, var(--fm-muted));
}

/* Tiny extension badge */
.fm-ext {
  position: absolute;
  right: 6px;
  bottom: 6px;
  font-size: 10px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--thumb-accent, #6b7280) 18%, var(--fm-surface));
  border: 1px solid color-mix(in srgb, var(--thumb-accent, #6b7280) 35%, var(--fm-border));
  color: var(--fm-text);
  opacity: .9;
  user-select: none;
  pointer-events: none;
}
/* Warning badge for files missing from disk */
.fm-missing-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 12px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 6px;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.5);
  color: #ca8a04;
  pointer-events: none;
}
.fm-filetile--missing .fm-thumb {
  opacity: 0.55;
}
.fm-filetile--missing .fm-filename {
  color: var(--fm-muted);
}
/* Inline badge variant (list view) */
.cell-name .fm-missing-badge {
  position: static;
  font-size: 11px;
  padding: 2px 4px;
  flex-shrink: 0;
}

/* List view container uses the same panel height; only inner scrolls */
.fm-listview {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.fm-listview-head {
  display: grid;
  grid-template-columns: 1fr 120px 180px;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--fm-border);
  background: var(--fm-elevated);
  font-weight: 600;
  color: var(--fm-muted);
}
.fm-listview-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.fm-listview-row {
  display: grid;
  grid-template-columns: 1fr 120px 180px;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--fm-border);
  cursor: pointer;
}
.fm-listview-row:hover { background: var(--fm-hover); }

.fm-listview-row .cell-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.fm-listview-row .nm { color: var(--fm-text); }

.fm-thumb.fm-thumb-xs {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--fm-border);
  display: flex; align-items: center; justify-content: center;
}
.fm-thumb.fm-thumb-xs i { font-size: 14px; color: var(--thumb-accent, var(--fm-muted)); }

/* Compact active-state for the view toggle buttons */
.btn-group .btn.active {
  background: var(--fm-hover);
  border-color: var(--fm-accent);
}

/* ============================================================
   File Info Panel
   ============================================================ */

/* Shrink the main file panel when the info panel is open */
.fm-panel--info-open {
  margin-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* Info panel — slides in from the right inside fm-content */
.fm-info-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 0;
  overflow: hidden;
  transition: width 0.22s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  background: var(--fm-elevated);
  border: 1px solid var(--fm-border);
  border-radius: 18px;
  box-shadow: var(--fm-shadow);
  z-index: 10;
}
.fm-info-panel--open {
  width: 260px;
}

.fip-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

/* Header */
.fip-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--fm-border);
}
.fip-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--fm-text);
  min-width: 0;
}
.fip-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--fm-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
}
.fip-close:hover { color: var(--fm-text); background: var(--fm-hover); }

/* Icon area */
.fip-icon-wrap {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 12px;
  gap: 10px;
}
.fip-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--thumb-accent, #6b7280) 12%, var(--fm-surface));
  border: 1px solid color-mix(in srgb, var(--thumb-accent, #6b7280) 25%, var(--fm-border));
  display: flex;
  align-items: center;
  justify-content: center;
}
.fip-icon i {
  font-size: 30px;
  color: var(--thumb-accent, #6b7280);
}
.fip-missing-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.45);
  color: #ca8a04;
}
:root[data-bs-theme="dark"] .fip-missing-badge { color: #fbbf24; }

/* Metadata */
.fip-meta {
  flex: 0 0 auto;
  padding: 0 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fip-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
}
.fip-label {
  color: var(--fm-muted);
  flex-shrink: 0;
  width: 56px;
}
.fip-value {
  color: var(--fm-text);
  min-width: 0;
  word-break: break-all;
}
.fip-ext-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: color-mix(in srgb, var(--fm-accent) 12%, transparent);
  color: var(--fm-accent);
}

/* Sections (groups / tags) */
.fip-section {
  flex: 0 0 auto;
  padding: 10px 14px 4px;
}
.fip-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fm-muted);
  margin-bottom: 6px;
}
.fip-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.fip-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--fm-hover);
  border: 1px solid var(--fm-border);
  color: var(--fm-text);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.fip-chip--inherited { opacity: .65; cursor: default; }
.fip-chip:not(.fip-chip--inherited) { cursor: pointer; }
.fip-chip:not(.fip-chip--inherited):hover { background: var(--fm-border); }
.fip-chip-note {
  font-size: 9px;
  color: var(--fm-muted);
}
.fip-chip-x {
  font-size: 9px;
  opacity: 0;
  transition: opacity .15s;
}
.fip-chip:hover .fip-chip-x { opacity: .7; }
.fip-chip--tag {
  background: color-mix(in srgb, var(--fm-accent) 10%, transparent);
  border-color: color-mix(in srgb, var(--fm-accent) 30%, transparent);
  color: var(--fm-accent);
}
.fip-add-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}
.fip-add-input {
  flex: 1;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--fm-border);
  background: var(--fm-hover);
  color: var(--fm-text);
  outline: none;
}
.fip-add-input:focus { border-color: var(--fm-accent); }
.fip-add-btn {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--fm-border);
  background: var(--fm-hover);
  color: var(--fm-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.fip-add-btn:hover { background: var(--fm-border); color: var(--fm-text); }
.fip-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.fip-toggle-check { cursor: pointer; }
.fip-toggle-label {
  font-size: 12px;
  color: var(--fm-muted);
  cursor: pointer;
  user-select: none;
}

/* Actions */
.fip-actions {
  flex: 0 0 auto;
  margin-top: auto;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--fm-border);
}

/* On small screens hide the panel (it would be too narrow) */
@media (max-width: 767px) {
  .fm-info-panel { display: none; }
}

/* ============================================================
   Multi-select
   ============================================================ */

/* Checkbox overlay on grid tiles */
.fm-select-check {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 5;
  font-size: 18px;
  color: var(--fm-muted);
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}
.fm-filetile--selected .fm-select-check,
.fm-select-check:hover { color: var(--fm-accent, #0d6efd); }

/* Selected tile highlight */
.fm-filetile--selected {
  outline: 2px solid var(--fm-accent, #0d6efd);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--fm-accent, #0d6efd) 8%, var(--fm-surface));
}

/* Dim thumb a little in select mode to make checkbox visible */
.fm-filetile--selectmode .fm-thumb { opacity: 0.85; }
.fm-filetile--selected .fm-thumb   { opacity: 1; }

/* Select-all button in list head (sits inline inside col-name) */
.fm-list-checkall {
  background: none;
  border: none;
  color: var(--fm-muted);
  cursor: pointer;
  font-size: 15px;
  padding: 0;
  line-height: 1;
  vertical-align: middle;
}
.fm-list-checkall:hover { color: var(--fm-accent, #0d6efd); }

/* Inline check icon inside each list row's cell-name */
.fm-list-check-icon {
  flex-shrink: 0;
  font-size: 16px;
  color: var(--fm-muted);
  cursor: pointer;
  margin-right: 2px;
}
.fm-list-check-icon:hover,
.fm-listview-row--selected .fm-list-check-icon { color: var(--fm-accent, #0d6efd); }

/* Selected list row */
.fm-listview-row--selected {
  background: color-mix(in srgb, var(--fm-accent, #0d6efd) 8%, transparent) !important;
}

/* Action bar */
.fm-select-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--fm-elevated);
  border-top: 1px solid var(--fm-border);
}

.fm-select-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--fm-text);
}

/* ============================================================
   Search Files
   ============================================================ */

.sf-wrap {
  position: relative;
}

.sf-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  border-radius: 10px;
  padding: 6px 10px;
  transition: border-color .15s, box-shadow .15s;
}
.sf-input-row:focus-within {
  border-color: var(--fm-accent, #0d6efd);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fm-accent, #0d6efd) 18%, transparent);
}

.sf-icon {
  color: var(--fm-muted);
  font-size: 13px;
  flex-shrink: 0;
}

.sf-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--fm-text);
  min-width: 0;
}
.sf-input::placeholder { color: var(--fm-muted); }

.sf-clear {
  background: none;
  border: none;
  color: var(--fm-muted);
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
}
.sf-clear:hover { color: var(--fm-text); }

/* Dropdown */
.sf-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--fm-elevated);
  border: 1px solid var(--fm-border);
  border-radius: 12px;
  box-shadow: var(--fm-shadow);
  z-index: 200;
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}

.sf-status {
  padding: 12px 14px;
  font-size: 12px;
  color: var(--fm-muted);
  display: flex;
  align-items: center;
}
.sf-status--error { color: #ef4444; }
.sf-status--empty { justify-content: center; }

.sf-result {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--fm-border);
  cursor: pointer;
  text-align: left;
  transition: background .1s;
}
.sf-result:last-child { border-bottom: none; }
.sf-result:hover { background: var(--fm-hover); }

.sf-result-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.sf-result-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sf-result-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--fm-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sf-result-path {
  font-size: 11px;
  color: var(--fm-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-result-nav {
  font-size: 11px;
  color: var(--fm-muted);
  flex-shrink: 0;
}

/* ---- Rename input (info panel header) ---- */
.fip-rename-input {
  flex: 1;
  min-width: 0;
  background: var(--fm-elevated);
  border: 1px solid var(--fm-accent);
  border-radius: 6px;
  color: var(--fm-text);
  font-size: 13px;
  font-weight: 600;
  padding: 3px 8px;
  outline: none;
  box-shadow: 0 0 0 2px var(--fm-ring);
}

/* ---- Move modal ---- */
.fip-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fip-modal {
  background: var(--fm-surface);
  border: 1px solid var(--fm-border);
  border-radius: 16px;
  box-shadow: var(--fm-shadow);
  width: min(440px, 92vw);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fip-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--fm-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--fm-text);
  gap: 8px;
}

.fip-modal-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.fip-modal-path {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--fm-border);
  font-size: 12px;
  color: var(--fm-muted);
  gap: 4px;
  min-width: 0;
}

.fip-modal-folders {
  overflow-y: auto;
  max-height: 260px;
}

.fip-modal-empty {
  padding: 24px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--fm-muted);
}

.fip-modal-folder {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--fm-border);
  color: var(--fm-text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background .1s;
  gap: 0;
}
.fip-modal-folder:last-child { border-bottom: none; }
.fip-modal-folder:hover { background: var(--fm-hover); }

.fip-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--fm-border);
}
.sf-result:hover .sf-result-nav { color: var(--fm-accent, #0d6efd); }
