:root {
  color-scheme: light;
}

body.app-body {
  background: #f4f6fb;
  color: #162033;
}

.app-navbar {
  box-shadow: 0 0.25rem 1rem rgba(15, 23, 42, 0.04);
}

.top-offset {
  top: 5.75rem;
}

.min-w-0 {
  min-width: 0;
}

.explorer-shell,
.details-panel,
.hero-mock {
  border-radius: 1.25rem;
}

.explorer-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.root-dropzone {
  border: 1.5px dashed #d1d5db;
  background: #f3f4f6;
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  transition: all 0.18s ease;
}

.root-dropzone.drag-active,
.folder-target.drag-active {
  border-color: #2563eb !important;
  background: #eef4ff !important;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.explorer-table tbody tr.folder-target.drag-active > *,
.explorer-table tbody tr.plot-item.drag-active > * {
  background: #eef4ff !important;
}

.folder-cover,
.plot-thumb {
  width: 78px;
  height: 58px;
  border-radius: 0.9rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
}

.preview-shell {
  aspect-ratio: 16 / 10;
  border-radius: 1rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
}

.folder-placeholder,
.plot-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  color: #64748b;
  font-weight: 700;
}

.folder-placeholder {
  font-size: 1.45rem;
}

.explorer-item {
  cursor: pointer;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.explorer-item:hover {
  border-color: #b9c7ff !important;
}

.explorer-item.is-selected {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 0.18rem rgba(37, 99, 235, 0.14);
}

.explorer-item.dragging {
  opacity: 0.55;
}

.explorer-table tbody tr.explorer-item.is-selected > * {
  background: rgba(37, 99, 235, 0.08) !important;
}

.empty-state {
  padding: 1rem 1.15rem;
  border: 1px dashed #d6dbe6;
  border-radius: 1rem;
  color: #667085;
  background: #fbfcff;
}

.code-block {
  display: block;
  padding: 0.85rem 1rem;
  background: #f6f8fc;
  border: 1px solid #e3e8f2;
  border-radius: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.5;
}

#plot {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid #dbe2ef;
  border-radius: 1rem;
  overflow: hidden;
  background: #fff;
}

.viewer-toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

@media (max-width: 1199px) {
  .top-offset {
    top: auto;
  }
}

@media (max-width: 767px) {
  .folder-cover,
  .plot-thumb {
    width: 64px;
    height: 48px;
  }
}


#plot-grid-view .card-body {
  padding: 0.85rem;
}

#plot-grid-view .preview-shell {
  aspect-ratio: 4 / 3;
}

#plot-grid-view .h6,
#plot-grid-view .small {
  line-height: 1.3;
}

@media (min-width: 1400px) {
  #plot-grid-view .preview-shell {
    aspect-ratio: 1 / 1;
  }
}


.explorer-host {
  transition: opacity 0.18s ease;
}

.compact-grid-card .card-body {
  padding: 0.85rem;
}

.compact-grid-card .preview-shell {
  aspect-ratio: 4 / 3;
}

.compact-grid-card .h6,
.compact-grid-card .small,
.compact-meta {
  line-height: 1.3;
}

#folder-grid-view .preview-shell,
#plot-grid-view .preview-shell {
  aspect-ratio: 4 / 3;
}

#builder-preview-render {
  position: fixed;
  left: -10000px;
  top: -10000px;
  width: 640px;
  height: 420px;
  pointer-events: none;
  opacity: 0;
}

@media (min-width: 1400px) {
  #folder-grid-view .preview-shell,
  #plot-grid-view .preview-shell,
  .compact-grid-card .preview-shell {
    aspect-ratio: 1 / 1;
  }
}


.explorer-actions {
  align-items: center;
}

.explorer-action-btn {
  --bs-btn-padding-y: 0.38rem;
  --bs-btn-padding-x: 0.8rem;
  --bs-btn-font-size: 0.925rem;
  line-height: 1.2;
}

.folder-preview-shell {
  background: #f8fafc;
}

.folder-preview-shell .folder-placeholder {
  font-size: 2rem;
}

.builder-preview-surface {
  width: 100%;
  min-height: 420px;
  height: 420px;
  border: 1px solid #dbe2ef;
  border-radius: 1rem;
  overflow: hidden;
  background: #fff;
}

.series-card {
  border-radius: 1rem;
}

.series-card .form-control,
.series-card .form-select {
  font-size: 0.95rem;
}

.series-card .btn.btn-sm {
  --bs-btn-padding-y: 0.34rem;
  --bs-btn-padding-x: 0.72rem;
  line-height: 1.2;
}

@media (max-width: 767px) {
  .builder-preview-surface {
    min-height: 320px;
    height: 320px;
  }
}


.builder-page {
  align-items: start;
}

.builder-page .card-body {
  max-width: none;
}

.explorer-shell.drag-active {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 0.18rem rgba(37, 99, 235, 0.12);
}

.plotstudio-toast-stack {
  z-index: 1095;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  pointer-events: none;
}

.plotstudio-toast-stack .toast {
  pointer-events: auto;
}

.plotstudio-toast {
  min-width: 320px;
  max-width: min(420px, calc(100vw - 1.5rem));
}

.plotstudio-move-drag-badge {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 1086;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.24);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.plotstudio-move-drag-badge.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.plotstudio-move-drag-badge__title {
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.plotstudio-move-drag-badge__text {
  font-size: 0.93rem;
  color: rgba(255, 255, 255, 0.84);
}

.selection-summary {
  padding: 0.8rem 0.9rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.9rem;
  background: #f8fafc;
}

.selection-summary__list {
  line-height: 1.45;
}

.plotstudio-file-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 1085;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.38);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
  backdrop-filter: blur(2px);
}

.plotstudio-file-drop-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.plotstudio-file-drop-overlay__panel {
  width: min(720px, 100%);
  padding: 2rem 2rem 1.75rem;
  border-radius: 1.5rem;
  border: 2px dashed rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 1.5rem 4rem rgba(15, 23, 42, 0.18);
  text-align: center;
  color: #fff;
}

.plotstudio-file-drop-overlay.is-targeted .plotstudio-file-drop-overlay__panel {
  border-color: rgba(96, 165, 250, 0.95);
  background: rgba(37, 99, 235, 0.18);
}

.plotstudio-file-drop-overlay__icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.9rem;
}

.plotstudio-file-drop-overlay__title {
  font-size: clamp(1.4rem, 2vw, 2rem);
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.plotstudio-file-drop-overlay__text {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.86);
}

body.file-drop-active .explorer-shell,
body.file-drop-active .details-panel {
  filter: saturate(0.95);
}

@media (max-width: 767px) {
  .plotstudio-toast {
    min-width: min(100%, 280px);
  }

  .plotstudio-file-drop-overlay {
    padding: 1rem;
  }

  .plotstudio-file-drop-overlay__panel {
    padding: 1.5rem 1.1rem;
    border-radius: 1.15rem;
  }

  .plotstudio-file-drop-overlay__icon {
    font-size: 2.35rem;
  }
}


.plotstudio-toast {
  border-radius: 1rem;
  overflow: hidden;
}

.plotstudio-toast .toast-body {
  padding: 0.95rem 1rem;
  line-height: 1.45;
}

.plotstudio-toast-close {
  flex: 0 0 auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: 0.55rem 0.55rem 0 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  opacity: 0.92;
  transition: background-color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.plotstudio-toast-close:hover,
.plotstudio-toast-close:focus-visible {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
  opacity: 1;
}

.plotstudio-toast-close:active {
  transform: scale(0.96);
}

.plotstudio-toast-close i {
  font-size: 0.9rem;
  line-height: 1;
}

.root-dropzone,
.folder-pill,
.explorer-item.folder-target {
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, outline-color 0.18s ease, transform 0.18s ease;
}

.folder-pill {
  border-style: dashed;
}

.folder-target.drag-active {
  border-color: #2563eb !important;
  background: #eef4ff !important;
  box-shadow: 0 0 0 0.18rem rgba(37, 99, 235, 0.14), inset 0 0 0 1px rgba(37, 99, 235, 0.18);
  outline: 2px dashed rgba(37, 99, 235, 0.7);
  outline-offset: 2px;
}

.explorer-table tbody tr.folder-target.drag-active {
  outline: 2px dashed rgba(37, 99, 235, 0.72);
  outline-offset: -2px;
}

.explorer-table tbody tr.folder-target.drag-active > * {
  background: #eef4ff !important;
}

.explorer-table tbody tr.folder-target.drag-active > *:first-child {
  box-shadow: inset 2px 0 0 #2563eb, inset 0 2px 0 #2563eb, inset 0 -2px 0 #2563eb;
}

.explorer-table tbody tr.folder-target.drag-active > *:last-child {
  box-shadow: inset -2px 0 0 #2563eb, inset 0 2px 0 #2563eb, inset 0 -2px 0 #2563eb;
}

.explorer-table tbody tr.folder-target.drag-active > *:not(:first-child):not(:last-child) {
  box-shadow: inset 0 2px 0 #2563eb, inset 0 -2px 0 #2563eb;
}

.viewer-page-card {
  overflow: hidden;
  height: var(--viewer-available-height, calc(100dvh - 9rem));
  min-height: 420px;
}

.viewer-page-body {
  height: 100%;
  min-height: 0;
}

.viewer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 1rem;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

.viewer-stage-wrap,
.viewer-stage,
.viewer-sidebar,
.viewer-sidebar-card,
.viewer-sidebar-scroll {
  min-height: 0;
}

.viewer-stage-wrap,
.viewer-sidebar {
  min-width: 0;
}

.viewer-stage-wrap {
  height: 100%;
  overflow: hidden;
}

.viewer-stage {
  height: 100%;
  min-height: 0;
}

.viewer-sidebar {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.viewer-title {
  line-height: 1.2;
  word-break: break-word;
}

.viewer-inline-alerts {
  min-height: 1.25rem;
}

.viewer-sidebar-card {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-color: #dbe2ef !important;
  box-shadow: 0 0.75rem 2rem rgba(15, 23, 42, 0.06);
}

.viewer-sidebar-scroll {
  flex: 1 1 auto;
  height: auto;
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.viewer-sidebar-scroll > * {
  flex: 0 0 auto;
}

.viewer-sidebar-scroll::-webkit-scrollbar {
  width: 0.7rem;
}

.viewer-sidebar-scroll::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 999px;
}

.viewer-sidebar-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border: 2px solid #f1f5f9;
  border-radius: 999px;
}

.viewer-sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.viewer-meta-list {
  display: grid;
  gap: 0.9rem;
}

.viewer-meta-item {
  display: grid;
  gap: 0.22rem;
}

.viewer-meta-label {
  font-size: 0.82rem;
  color: #64748b;
}

.viewer-code {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 0.65rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  word-break: break-all;
}

.viewer-note {
  padding: 0.85rem 0.95rem;
  border-radius: 0.95rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  line-height: 1.5;
}

.viewer-action-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.viewer-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  width: 100%;
  white-space: normal;
  text-align: center;
  padding: 0.65rem 0.8rem;
}

@media (max-width: 991px) {
  .viewer-page-card {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .viewer-page-body {
    height: auto;
  }

  .viewer-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(360px, 58dvh) auto;
    height: auto;
  }

  .viewer-sidebar {
    position: static !important;
    top: auto !important;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .viewer-sidebar-card {
    height: auto;
    max-height: none;
  }

  .viewer-sidebar-scroll {
    height: auto;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 767px) {
  .plotstudio-toast-close {
    width: 1.85rem;
    height: 1.85rem;
    margin: 0.45rem 0.45rem 0 0;
  }

  .viewer-page-card {
    min-height: 0;
  }

  .viewer-layout {
    gap: 0.85rem;
    grid-template-rows: minmax(320px, 55dvh) auto;
  }

  .viewer-sidebar-scroll {
    padding: 0.9rem !important;
    gap: 0.85rem;
  }

  .viewer-action-btn {
    min-height: 2.5rem;
    padding: 0.55rem 0.65rem;
    font-size: 0.92rem;
  }
}

.series-card {
  overflow: hidden;
}

.series-card-head {
  min-height: 2.5rem;
}

.series-summary {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.series-card.is-collapsed .series-card-body {
  display: none;
}

.surface-settings {
  border-color: #dbe2ef !important;
}

.series-file-meta {
  min-height: 1.25rem;
}


.viewer-note .form-check + .form-check {
  margin-top: 0.5rem;
}



.tag-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.tag-badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.details-tags .tag-badge-row {
  margin-top: 0 !important;
}

.explorer-toolbar .btn-group .btn.active {
  background: var(--bs-primary);
  border-color: var(--bs-primary);
  color: #fff;
}

#explorer-app.view-mode-list .explorer-table thead {
  display: none;
}

#explorer-app.view-mode-list .explorer-table,
#explorer-app.view-mode-list .explorer-table tbody,
#explorer-app.view-mode-list .explorer-table tr,
#explorer-app.view-mode-list .explorer-table td {
  display: block;
  width: 100%;
}

#explorer-app.view-mode-list .explorer-table tr {
  margin-bottom: 0.85rem;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: #fff;
  overflow: hidden;
}

#explorer-app.view-mode-list .explorer-table td {
  border: 0;
  padding: 0.55rem 0.9rem;
}

#explorer-app.view-mode-list .explorer-table td.text-end {
  text-align: left !important;
}

#explorer-app.view-mode-large-grid [data-view-group-container="folders"] > .explorer-host,
#explorer-app.view-mode-large-grid [data-view-group-container="plots"] > .explorer-host,
#explorer-app.view-mode-large-grid [data-view-group-container="folder-plots"] > .explorer-host {
  width: 50%;
}

@media (min-width: 992px) {
  #explorer-app.view-mode-large-grid [data-view-group-container="folders"] > .explorer-host,
  #explorer-app.view-mode-large-grid [data-view-group-container="plots"] > .explorer-host,
  #explorer-app.view-mode-large-grid [data-view-group-container="folder-plots"] > .explorer-host {
    width: 33.3333%;
  }
}

@media (min-width: 1400px) {
  #explorer-app.view-mode-large-grid [data-view-group-container="folders"] > .explorer-host,
  #explorer-app.view-mode-large-grid [data-view-group-container="plots"] > .explorer-host,
  #explorer-app.view-mode-large-grid [data-view-group-container="folder-plots"] > .explorer-host {
    width: 25%;
  }
}

#explorer-app.view-mode-grid [data-view-group-container="folders"] > .explorer-host,
#explorer-app.view-mode-grid [data-view-group-container="plots"] > .explorer-host,
#explorer-app.view-mode-grid [data-view-group-container="folder-plots"] > .explorer-host,
#explorer-app.view-mode-large-grid [data-view-group-container="folders"] > .explorer-host,
#explorer-app.view-mode-large-grid [data-view-group-container="plots"] > .explorer-host,
#explorer-app.view-mode-large-grid [data-view-group-container="folder-plots"] > .explorer-host {
  flex: 0 0 auto;
}

#explorer-app.view-mode-large-grid .compact-grid-card .preview-shell {
  aspect-ratio: 16 / 10;
}

.plotstudio-context-menu {
  position: fixed;
  z-index: 1097;
  min-width: 240px;
  max-width: min(320px, calc(100vw - 1rem));
  padding: 0.4rem;
  border: 1px solid #dbe2ef;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.18);
}

.plotstudio-context-menu__header {
  padding: 0.55rem 0.75rem 0.65rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: #334155;
  border-bottom: 1px solid #eef2f7;
  margin-bottom: 0.25rem;
}

.plotstudio-context-menu__divider {
  height: 1px;
  margin: 0.3rem 0.45rem;
  background: #eef2f7;
}

.plotstudio-context-menu__item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  color: #162033;
}

.plotstudio-context-menu__item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  font-size: 1rem;
  color: #64748b;
  flex: 0 0 1.25rem;
}

.plotstudio-context-menu__item-label {
  flex: 1 1 auto;
}

.plotstudio-context-menu__item:hover {
  background: #f1f5f9;
}

.plotstudio-context-menu__item:hover .plotstudio-context-menu__item-icon {
  color: #0f172a;
}

.plotstudio-context-menu__item.is-danger {
  color: #b42318;
}

.plotstudio-context-menu__item.is-danger .plotstudio-context-menu__item-icon {
  color: #b42318;
}

.plotstudio-context-menu__item.is-danger:hover {
  background: #fef3f2;
}

/* PlotStudio builder v3 */
.plot-editor-shell {
  --editor-border: #dbe2ef;
}

.editor-top-card,
.editor-settings-card,
.editor-preview-card {
  border-radius: 1.25rem;
}

.editor-tabs {
  gap: 0.45rem;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 0.25rem;
}

.editor-tabs .nav-link {
  white-space: nowrap;
  border-radius: 999px;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
}

.editor-tabs .nav-link.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.editor-preview-card.sticky-xxl-top {
  top: 5.5rem;
}

.typography-accordion .accordion-item,
.font-style-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb !important;
}

.typography-accordion .accordion-button {
  background: #f8fafc;
  box-shadow: none;
}

.typography-accordion .accordion-button:not(.collapsed) {
  color: #0f172a;
  background: #eef4ff;
}

.font-preview {
  min-height: 2.5rem;
  display: flex;
  align-items: center;
}

.editor-workspace .tab-pane {
  min-height: 420px;
}

@media (min-width: 1400px) {
  .editor-preview-card {
    position: sticky;
  }
}

@media (max-width: 1399px) {
  .editor-preview-card.sticky-xxl-top {
    position: static;
  }
}

@media (max-width: 575px) {
  }

/* Builder compact layout updates */
.builder-headline p {
  max-width: 760px;
}

.builder-top-actions .btn {
  align-self: flex-start;
  padding-block: 0.35rem;
  line-height: 1.2;
}

.editor-preview-actions .btn {
  min-width: 96px;
}

.builder-fold-card {
  overflow: hidden;
  border-radius: 1.25rem;
}

.builder-fold-toggle {
  width: 100%;
  border: 0;
  background: #fff;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 700;
  color: #0f172a;
  text-align: left;
}

.builder-fold-toggle:hover {
  background: #f8fafc;
}

.builder-fold-toggle .bi {
  transition: transform 0.18s ease;
}

.builder-fold-toggle:not(.collapsed) .bi {
  transform: rotate(180deg);
}

.builder-fold-card-danger .builder-fold-toggle {
  color: #991b1b;
}

.series-file-dropzone {
  min-height: 112px;
  width: 100%;
  border: 1.5px dashed #cbd5e1;
  border-radius: 1rem;
  background: #f8fafc;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.series-inner-details {
  overflow: hidden;
}

.series-inner-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .9rem 1rem;
  cursor: pointer;
  list-style: none;
}

.series-inner-details > summary::-webkit-details-marker {
  display: none;
}

.series-inner-details > summary::after {
  content: "⌄";
  color: #64748b;
  font-size: 1.05rem;
  transition: transform .15s ease;
}

.series-inner-details[open] > summary {
  border-bottom: 1px solid #e2e8f0;
}

.series-inner-details[open] > summary::after {
  transform: rotate(180deg);
}

.series-inner-details-body {
  background: #fff;
}

.series-file-dropzone:hover,
.series-file-dropzone.is-dragover {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.08);
}

.series-file-dropzone__icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  background: #e0ebff;
  color: #1d4ed8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.series-file-dropzone__text {
  font-weight: 650;
  color: #0f172a;
}

.series-file-dropzone__hint {
  color: #64748b;
  font-size: 0.82rem;
}

@media (min-width: 992px) {
  .editor-preview-card.sticky-xxl-top {
    position: sticky;
    top: 5.25rem;
    z-index: 5;
  }
}

@media (max-width: 991px) {
  .editor-preview-card.sticky-xxl-top {
    position: static;
  }
}


/* Fixed builder preview behavior */
@media (min-width: 992px) {
  .editor-preview-column {
    position: sticky;
    top: 5.25rem;
    z-index: 5;
    align-self: flex-start;
  }

  .editor-preview-card {
    max-height: calc(100vh - 6.5rem);
    overflow: auto;
  }
}

@media (max-width: 991px) {
  .editor-preview-column {
    position: static;
  }

  .editor-preview-card {
    max-height: none;
    overflow: visible;
  }
}

/* Dashboard preview/sidebar and mobile explorer controls */
.app-navbar {
  z-index: 1040;
}

.dashboard-details-panel {
  top: 5.25rem !important;
  z-index: 6;
  align-self: flex-start;
  max-height: calc(100vh - 6.25rem);
  overflow: auto;
}

.dashboard-details-panel .details-preview-image {
  width: 100%;
  max-height: min(42vh, 380px);
  object-fit: contain;
  background: #fff;
}

.details-action-stack {
  display: none !important;
}

.mobile-filter-toggle {
  border-radius: 0.9rem;
  min-height: 2.55rem;
}

.mobile-explorer-controls {
  position: absolute;
  display: flex;
  top: 0.55rem;
  right: 0.55rem;
  gap: 0.35rem;
  z-index: 4;
}

.explorer-mobile-cell {
  position: relative;
}

.explorer-table .explorer-mobile-cell {
  padding-right: 5.5rem !important;
}

.mobile-explorer-control {
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: 1px solid #dbe2ef;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #334155;
  box-shadow: 0 0.4rem 1rem rgba(15, 23, 42, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-explorer-control.is-selected {
  color: #2563eb;
  border-color: #93c5fd;
  background: #eff6ff;
}

.mobile-explorer-control:active {
  transform: translateY(1px);
}

@media (min-width: 992px) {
  .mobile-explorer-controls {
    display: none !important;
  }
}

@media (max-width: 1199.98px) {
  .dashboard-details-panel {
    position: static !important;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 991.98px) {
  .details-action-stack {
    display: grid !important;
  }

  .details-panel {
    border-radius: 1rem;
  }

  .explorer-toolbar .card-body {
    padding: 0.85rem !important;
  }

  .explorer-toolbar .btn-group {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 0.4rem;
  }

  .explorer-toolbar .btn-group .btn {
    border-radius: 0.75rem !important;
    width: 100%;
    text-align: left;
  }

  .explorer-toolbar .form-select,
  .explorer-toolbar #explorer-sort-order {
    width: 100% !important;
  }

  .explorer-table {
    min-width: 720px;
  }

  .app-navbar .navbar-nav {
    align-items: stretch !important;
    gap: 0.5rem !important;
    padding: 0.75rem 0 0.4rem;
  }

  .app-navbar .navbar-nav .nav-link {
    padding: 0.55rem 0.75rem;
    border-radius: 0.75rem;
  }

  .app-navbar .navbar-nav .btn,
  .app-navbar .navbar-nav form .btn {
    width: 100%;
    min-height: 2.45rem;
    text-align: left;
  }

  .app-navbar .navbar-nav form {
    width: 100%;
    margin-left: 0 !important;
  }
}

@media (max-width: 575.98px) {
  .explorer-actions {
    width: 100%;
  }

  .explorer-actions .explorer-action-btn {
    flex: 1 1 100%;
    text-align: center;
  }
}

.viewer-layers-panel {
  padding-bottom: 1rem;
}

.viewer-layer-global {
  padding: 0.75rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  background: #ffffff;
}

.viewer-layers-list {
  display: grid;
  gap: 0.65rem;
}

.viewer-layer-item {
  padding: 0.75rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  background: #ffffff;
}

.viewer-layer-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.65rem;
}

.viewer-layer-check {
  min-width: 0;
  margin-bottom: 0;
}

.viewer-layer-check .form-check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  line-height: 1.25;
}

.viewer-layer-color {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: var(--layer-color, #94a3b8);
  flex: 0 0 auto;
}

.viewer-layer-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-layer-kind {
  flex: 0 0 auto;
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-layer-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0 0 0.7rem;
}

.viewer-layer-stat {
  min-width: 0;
  padding: 0.45rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  background: #f8fafc;
}

.viewer-layer-stat span {
  display: block;
  margin-bottom: 0.1rem;
  color: #64748b;
  font-size: 0.74rem;
  line-height: 1.15;
}

.viewer-layer-stat strong {
  display: block;
  color: #0f172a;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-layer-stats-empty {
  margin: 0 0 0.7rem;
  padding: 0.45rem 0.55rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.65rem;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.82rem;
}

.viewer-layer-alpha-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 3.4rem;
  align-items: center;
  gap: 0.55rem;
}

.viewer-alpha-range {
  margin: 0;
}

.viewer-alpha-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: #475569;
}

@media (max-width: 767px) {
  .viewer-layer-main {
    flex-direction: column;
    align-items: stretch;
  }

  .viewer-layer-kind {
    width: fit-content;
  }

  .viewer-layer-alpha-row {
    grid-template-columns: 1fr 3.2rem;
  }

  .viewer-layer-alpha-row > .small {
    grid-column: 1 / -1;
  }
}

/* Global layout, navigation buttons and footer */
body.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1 0 auto;
}

.app-footer {
  flex-shrink: 0;
  box-shadow: 0 -0.25rem 1rem rgba(15, 23, 42, 0.03);
}

.nav-main-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  white-space: nowrap;
}

/* Trash mobile selection controls */
.trash-mobile-selection-bar {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 1035;
  display: none;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border: 1px solid #dbe2ef;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.18);
}

.trash-mobile-selection-bar.is-visible {
  display: flex;
}

.trash-mobile-selection-bar__main {
  min-width: 0;
}

.trash-mobile-selection-bar__count {
  font-weight: 700;
  color: #162033;
  line-height: 1.2;
}

.trash-mobile-selection-bar__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

@media (min-width: 992px) {
  .trash-mobile-selection-bar {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  .app-navbar .navbar-nav {
    align-items: stretch !important;
    gap: 0.5rem !important;
    padding: 0.75rem 0 0.4rem;
  }

  .app-navbar .navbar-nav .nav-link,
  .app-navbar .navbar-nav .btn,
  .app-navbar .navbar-nav form .btn {
    width: 100%;
    min-height: 2.45rem;
    text-align: left;
    justify-content: flex-start;
  }

  .app-navbar .navbar-nav form {
    width: 100%;
    margin-left: 0 !important;
  }

  body.trash-mobile-selection-active {
    padding-bottom: 5.5rem;
  }
}

@media (max-width: 575.98px) {
  .trash-mobile-selection-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .trash-mobile-selection-bar__actions,
  .trash-mobile-selection-bar__actions .btn {
    width: 100%;
  }

  .trash-mobile-selection-bar__actions .btn {
    flex: 1 1 auto;
  }
}

/* Header action buttons, profile page and trash selection polish */
.app-navbar .navbar-nav .nav-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  line-height: 1.15;
  min-height: 2.1rem;
  white-space: nowrap;
  vertical-align: middle;
}

.app-navbar .navbar-nav form .nav-action-button {
  width: auto;
}

.app-navbar .navbar-nav .nav-action-button i {
  line-height: 1;
  font-size: 1rem;
}

.trash-back-button,
.profile-back-button,
.profile-save-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  line-height: 1.15;
  min-height: 2.1rem;
  width: auto;
  align-self: flex-start;
}

#explorer-app[data-page-kind="trash"],
#explorer-app[data-page-kind="trash"] .explorer-item,
#explorer-app[data-page-kind="trash"] .explorer-table,
#explorer-app[data-page-kind="trash"] .trash-table,
#explorer-app[data-page-kind="trash"] .trash-table * {
  -webkit-user-select: none;
  user-select: none;
}

.profile-card {
  border-radius: 1.15rem;
}

.profile-avatar {
  width: 4rem;
  height: 4rem;
  border-radius: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  color: #2563eb;
  font-size: 2rem;
}

.profile-info-list {
  display: grid;
  gap: 0.8rem;
}

.profile-info-row {
  display: grid;
  gap: 0.25rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  background: #f8fafc;
}

.profile-info-row span,
.profile-stat-item span {
  color: #64748b;
  font-size: 0.85rem;
}

.profile-info-row strong {
  color: #162033;
  word-break: break-word;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.profile-stat-item {
  min-height: 5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  background: #f8fafc;
}

.profile-stat-item strong {
  font-size: 1.45rem;
  line-height: 1;
  color: #162033;
}

.profile-password-form .form-control {
  min-height: 2.45rem;
}

@media (max-width: 1199.98px) {
  .profile-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .app-navbar .navbar-nav .nav-action-button,
  .app-navbar .navbar-nav form .nav-action-button {
    width: 100%;
    justify-content: flex-start;
    min-height: 2.45rem;
  }

  .trash-back-button,
  .profile-back-button {
    width: auto;
  }
}

@media (max-width: 575.98px) {
  .profile-stats-grid {
    grid-template-columns: 1fr;
  }

  .profile-save-button {
    width: 100%;
  }
}

.viewer-slices-panel {
  padding-bottom: 1rem;
}


.viewer-projection-status {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.85rem;
  border: 1px solid rgba(var(--bs-primary-rgb), 0.22);
  border-radius: 0.85rem;
  background: rgba(var(--bs-primary-rgb), 0.06);
}

.viewer-projection-status.d-none {
  display: none !important;
}

@media (max-width: 575.98px) {
  .viewer-projection-status {
    align-items: stretch;
    flex-direction: column;
  }

  .viewer-projection-status .btn {
    width: 100%;
  }
}

.viewer-slice-form {
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  background: #ffffff;
}

.viewer-slices-list {
  display: grid;
  gap: 0.65rem;
}


.viewer-slice-group-actions {
  padding: 0.75rem 0.85rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.85rem;
  background: #f8fafc;
}

.viewer-slice-item {
  padding: 0.75rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  background: #ffffff;
}

.viewer-slice-item.is-active {
  border-color: rgba(var(--bs-primary-rgb), 0.45);
  box-shadow: 0 0 0 0.18rem rgba(var(--bs-primary-rgb), 0.08);
}

.viewer-slice-info {
  min-width: 0;
  margin-bottom: 0.65rem;
}


.viewer-slice-select-line {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  cursor: pointer;
}

.viewer-slice-select-line .form-check-input {
  margin-top: 0.12rem;
  flex: 0 0 auto;
}

.viewer-slice-title {
  font-weight: 600;
  line-height: 1.25;
  word-break: break-word;
}

.viewer-slice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

@media (max-width: 767px) {
  .viewer-slice-actions .btn {
    flex: 1 1 auto;
  }
}

.viewer-settings-section {
  flex: 0 0 auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  background: #ffffff;
}

.viewer-settings-section.is-open .viewer-settings-summary {
  border-bottom-color: #e2e8f0;
}

.viewer-settings-summary {
  width: 100%;
  min-height: 4.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.viewer-settings-summary:hover,
.viewer-settings-summary:focus-visible {
  background: #f8fafc;
}

.viewer-settings-summary:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  outline-offset: -2px;
}

.viewer-settings-summary::after {
  content: "";
  width: 0.56rem;
  height: 0.56rem;
  flex: 0 0 auto;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.viewer-settings-section:not(.is-open) .viewer-settings-summary::after {
  transform: rotate(-45deg);
}

.viewer-collapse-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.26s ease, opacity 0.18s ease;
}

.viewer-settings-section.is-open .viewer-collapse-body {
  opacity: 1;
}

.viewer-settings-body {
  padding: 0;
}

.viewer-collapse-inner {
  padding: 0.9rem 1rem 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .viewer-collapse-body,
  .viewer-settings-summary,
  .viewer-settings-summary::after {
    transition: none;
  }
}

.viewer-heatmap-block {
  padding: 0.75rem 0.85rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.85rem;
  background: #f8fafc;
}

.viewer-heatmap-select {
  max-width: 11rem;
}

/* Lazy preview loading */
.preview-placeholder {
  position: relative;
  gap: 0.45rem;
  overflow: hidden;
}

.preview-placeholder.is-loading .preview-placeholder-label,
.preview-placeholder.is-loading .preview-fallback-icon {
  opacity: 0.7;
}

.preview-spinner {
  width: 1.05rem;
  height: 1.05rem;
  border: 2px solid rgba(100, 116, 139, 0.25);
  border-top-color: rgba(100, 116, 139, 0.9);
  border-radius: 999px;
  animation: plotstudio-preview-spin 0.85s linear infinite;
  flex: 0 0 auto;
}

.preview-details-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 7rem;
}

@keyframes plotstudio-preview-spin {
  to { transform: rotate(360deg); }
}

.explorer-page-loader {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.9rem;
  color: #64748b;
  background: #f8fafc;
  font-size: 0.92rem;
}

.explorer-page-loader.is-hidden {
  display: none !important;
}

.explorer-page-loader__spinner {
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid rgba(100, 116, 139, 0.25);
  border-top-color: rgba(100, 116, 139, 0.9);
  border-radius: 999px;
  animation: plotstudio-preview-spin 0.85s linear infinite;
}

/* Inbox уведомлений */
.inbox-nav-dropdown {
  position: relative;
}

.inbox-nav-button {
  min-width: 92px;
}

.inbox-nav-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}

.inbox-dropdown-menu {
  width: min(420px, calc(100vw - 24px));
  border: 0;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 52px rgba(15, 23, 42, 0.18);
}

.inbox-dropdown-header,
.inbox-dropdown-footer {
  padding: 14px 16px;
  background: #fff;
}

.inbox-dropdown-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.inbox-dropdown-footer {
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.inbox-dropdown-list {
  max-height: 430px;
  overflow-y: auto;
  background: #f8fafc;
}

.inbox-dropdown-item {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
}

.inbox-dropdown-item.is-unread {
  background: #fff7f7;
}

.inbox-dropdown-title {
  display: block;
  color: #111827;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.25;
}

.inbox-dropdown-title:hover {
  color: #0d6efd;
}

.inbox-dropdown-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
}

.inbox-dropdown-empty {
  padding: 34px 16px;
  text-align: center;
  color: #6c757d;
  background: #fff;
}

.inbox-page,
.inbox-detail-card {
  border-radius: 22px;
}

.inbox-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inbox-card {
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.inbox-card:hover {
  border-color: rgba(13, 110, 253, 0.35) !important;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.inbox-card.is-unread {
  border-color: rgba(220, 53, 69, 0.35) !important;
  background: linear-gradient(90deg, rgba(220, 53, 69, 0.055), #fff 32%);
}

.inbox-unread-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #dc3545;
  flex: 0 0 auto;
}

.inbox-title-link {
  color: #111827;
  text-decoration: none;
}

.inbox-title-link:hover {
  color: #0d6efd;
}

.inbox-actions {
  min-width: 220px;
}

.inbox-object-box {
  background: #f8fafc;
}

@media (max-width: 991.98px) {
  .inbox-dropdown-menu {
    width: min(360px, calc(100vw - 24px));
  }

  .inbox-actions {
    min-width: 0;
  }
}

.explorer-workspace {
  min-height: 18rem;
}

.explorer-workspace .empty-state {
  user-select: none;
}

/* Compact header and profile navigation */
.nav-create-dropdown,
.nav-profile-dropdown {
  display: inline-flex;
}

.nav-create-menu,
.profile-nav-menu {
  min-width: 15rem;
  border-radius: 0.95rem;
  border-color: #e2e8f0;
  box-shadow: 0 1rem 2rem rgba(15, 23, 42, 0.12);
}

.profile-nav-menu {
  min-width: 17rem;
}

.nav-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.35rem;
  border-radius: 0.7rem;
}

.nav-menu-item i {
  width: 1.1rem;
  text-align: center;
}

.profile-nav-summary {
  max-width: 15rem;
}

.profile-menu-button {
  max-width: 14rem;
}

.profile-menu-button span:not(.inbox-nav-badge) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-nav-badge {
  right: -0.45rem;
  top: -0.45rem;
}

.profile-links-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.profile-link-card {
  min-height: 4.4rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  background: #f8fafc;
  color: #162033;
  text-decoration: none;
  font-weight: 600;
}

.profile-link-card:hover {
  color: #0d6efd;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.profile-link-card i {
  font-size: 1.25rem;
  color: #2563eb;
}

.profile-link-card strong {
  margin-left: auto;
  min-width: 1.45rem;
  height: 1.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 0.75rem;
}

.explorer-workspace {
  min-height: clamp(24rem, 52vh, 42rem);
  border-radius: 1rem;
}

@media (max-width: 991.98px) {
  .nav-create-dropdown,
  .nav-profile-dropdown {
    width: 100%;
  }

  .nav-create-dropdown > .btn,
  .nav-profile-dropdown > .btn {
    width: 100%;
  }

  .nav-create-menu,
  .profile-nav-menu {
    width: 100%;
    min-width: 0;
  }

  .profile-links-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .profile-links-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile navbar dropdown fix */
@media (max-width: 991.98px) {
  .app-navbar .navbar-collapse {
    width: 100%;
    padding-top: 0.65rem;
  }

  .app-navbar .navbar-nav {
    width: 100%;
    margin-left: 0 !important;
  }

  .app-navbar .nav-create-dropdown,
  .app-navbar .nav-profile-dropdown {
    display: block !important;
    width: 100%;
  }

  .app-navbar .nav-create-dropdown > .btn,
  .app-navbar .nav-profile-dropdown > .btn {
    width: 100%;
    min-height: 2.65rem;
    justify-content: flex-start;
    border-radius: 0.85rem;
  }

  .app-navbar .dropdown-menu.nav-create-menu,
  .app-navbar .dropdown-menu.profile-nav-menu,
  .app-navbar .dropdown-menu.nav-create-menu[data-bs-popper],
  .app-navbar .dropdown-menu.profile-nav-menu[data-bs-popper] {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    float: none !important;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0.45rem 0 0.65rem;
    border-radius: 0.95rem;
    box-shadow: none;
  }

  .app-navbar .profile-nav-summary {
    max-width: none;
  }

  .app-navbar .profile-menu-button {
    max-width: none;
    position: relative;
  }

  .app-navbar .profile-menu-button span:not(.inbox-nav-badge) {
    min-width: 0;
    max-width: calc(100% - 4.5rem);
  }

  .app-navbar .profile-nav-badge {
    top: 0.25rem;
    right: 0.65rem;
  }

  .app-navbar .dropdown-toggle::after {
    margin-left: auto;
  }

  .app-navbar .nav-menu-item {
    min-height: 2.5rem;
    white-space: normal;
  }
}

@media (max-width: 575.98px) {
  .app-navbar .container-fluid {
    padding-left: 0.9rem !important;
    padding-right: 0.9rem !important;
  }

  .app-navbar .navbar-brand {
    min-width: 0;
    max-width: calc(100% - 4rem);
  }

  .app-navbar .navbar-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-navbar .navbar-toggler {
    flex: 0 0 auto;
    border-radius: 0.75rem;
  }
}

.style-template-tools .dropdown-menu {
  min-width: min(22rem, 92vw);
}

.style-template-tools .dropdown-item:disabled {
  opacity: 0.45;
}

/* Data diagnostics */
.data-diagnostics-card {
  background: #ffffff;
}

.data-diagnostics-summary .badge {
  font-weight: 600;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.diagnostic-section {
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: #f8fafc;
  padding: 0.85rem;
}

.diagnostic-section-title {
  font-weight: 700;
  margin-bottom: 0.55rem;
  color: #0f172a;
}

.diagnostic-list {
  display: grid;
  gap: 0.45rem;
  font-size: 0.875rem;
  line-height: 1.35;
}

.diagnostic-item,
.diagnostic-empty {
  border-radius: 0.8rem;
  padding: 0.55rem 0.65rem;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.diagnostic-empty {
  color: #64748b;
}

.diagnostic-section-error .diagnostic-item {
  background: #fff5f5;
  border-color: #fecaca;
  color: #991b1b;
}

.diagnostic-section-warning .diagnostic-item {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.diagnostic-section-recommendation .diagnostic-item {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

/* Import wizard */
.import-wizard-modal .modal-body {
  background: #f8fafc;
}

.import-wizard-stepper {
  display: flex;
  gap: .65rem;
  overflow-x: auto;
  padding-bottom: .15rem;
}

.import-wizard-step {
  flex: 1 0 150px;
  display: flex;
  align-items: center;
  gap: .55rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .9rem;
  padding: .7rem .8rem;
  background: #fff;
  color: var(--bs-body-color);
  text-align: left;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.import-wizard-step span {
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--bs-light-bg-subtle);
  font-weight: 700;
}

.import-wizard-step strong {
  font-size: .92rem;
}

.import-wizard-step.is-active {
  border-color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), .08);
  color: var(--bs-primary);
}

.import-wizard-step.is-active span {
  background: var(--bs-primary);
  color: #fff;
}

.import-wizard-step.is-complete {
  border-color: rgba(var(--bs-success-rgb), .3);
}

.import-wizard-step-panel {
  min-height: 320px;
}


.import-wizard-dropzone {
  border: 1.5px dashed rgba(37, 99, 235, 0.35);
  border-radius: 1rem;
  padding: 1rem;
  text-align: center;
  background: rgba(37, 99, 235, 0.04);
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.import-wizard-dropzone.is-dragover {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.75);
  transform: translateY(-1px);
}

.import-preview-table-wrap {
  max-height: 360px;
  overflow: auto;
}

.import-preview-table {
  font-size: 0.86rem;
  min-width: 640px;
}

.import-preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  white-space: nowrap;
}

.import-preview-table td {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.import-wizard-diagnostics .diagnostic-list {
  max-height: 190px;
  overflow: auto;
}

@media (max-width: 575.98px) {
  .import-wizard-modal {
    min-height: 100vh;
    border-radius: 0;
  }

  .import-wizard-modal .modal-header,
  .import-wizard-footer {
    padding: .85rem;
  }

  .import-wizard-body {
    padding: .85rem;
  }

  .import-wizard-step {
    flex-basis: 118px;
    padding: .55rem;
  }

  .import-wizard-step span {
    width: 1.55rem;
    height: 1.55rem;
  }

  .import-wizard-step strong {
    font-size: .84rem;
  }

  .import-wizard-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
  }

  .import-wizard-footer .btn {
    width: 100%;
    margin: 0 !important;
  }

  .import-wizard-footer .btn[data-bs-dismiss="modal"] {
    grid-column: 1 / -1;
  }

  .import-preview-table {
    min-width: 520px;
  }

  .series-inner-details > summary {
    align-items: flex-start;
  }

  .series-inner-details > summary span:last-child {
    display: block;
  }

  .style-template-tools {
    flex-direction: column;
  }

  .style-template-tools > .form-select,
  .style-template-tools > .btn {
    width: 100%;
    border-radius: 0.5rem !important;
  }
}

.bulk-import-modal .bulk-import-dropzone {
  border: 1.5px dashed var(--bs-border-color);
  border-radius: 1rem;
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  background: var(--bs-light-bg-subtle);
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.bulk-import-modal .bulk-import-dropzone.is-dragover {
  border-color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), .08);
  box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .08);
}

.bulk-import-modal .bulk-import-dropzone__icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto .5rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), .1);
  font-size: 1.25rem;
}

.bulk-import-table th,
.bulk-import-table td {
  vertical-align: top;
}

.bulk-import-results {
  min-height: 72px;
}

/* Bulk import wizard redesign */
.bulk-import-dialog {
  max-width: min(96vw, 1360px);
}

.bulk-import-modal {
  height: min(90vh, 920px);
  overflow: hidden;
}

.bulk-import-header,
.bulk-import-footer {
  flex: 0 0 auto;
  background: #fff;
  z-index: 2;
}

.bulk-import-body {
  min-height: 0;
  overflow: hidden;
  background: #f8fafc;
  padding: 0;
}

.bulk-import-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.bulk-import-stepper {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem;
  border-right: 1px solid var(--bs-border-color);
  background: #fff;
  overflow: auto;
}

.bulk-import-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.9rem;
  padding: 0.75rem;
  text-align: left;
  background: #fff;
  color: var(--bs-body-color);
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.bulk-import-step:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.bulk-import-step.is-active {
  border-color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), .08);
  color: var(--bs-primary);
}

.bulk-import-step.is-complete {
  border-color: rgba(var(--bs-success-rgb), .3);
}

.bulk-import-step__number {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--bs-light-bg-subtle);
  font-weight: 700;
}

.bulk-import-step.is-active .bulk-import-step__number {
  background: var(--bs-primary);
  color: #fff;
}

.bulk-import-step__text {
  display: grid;
  gap: .1rem;
}

.bulk-import-step__text small {
  color: var(--bs-secondary-color);
}

.bulk-import-content {
  min-width: 0;
  overflow: auto;
  padding: 1.25rem;
}

.bulk-import-step-panel {
  display: grid;
  gap: 1rem;
}

.bulk-import-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 1rem;
  background: #fff;
}

.bulk-import-dropzone {
  border: 1.5px dashed rgba(var(--bs-primary-rgb), .38);
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  background: rgba(var(--bs-primary-rgb), .04);
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.bulk-import-dropzone.is-dragover {
  border-color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), .1);
  box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .08);
  transform: translateY(-1px);
}

.bulk-import-dropzone__icon,
.bulk-import-success-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto .75rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), .1);
  font-size: 1.4rem;
}

.bulk-import-success-icon {
  color: var(--bs-success);
  background: rgba(var(--bs-success-rgb), .12);
  font-size: 1.65rem;
}

.bulk-import-file-table,
.bulk-import-settings-table-wrap {
  background: #fff;
}

.bulk-import-file-cards {
  display: none;
}

.bulk-import-file-card,
.bulk-import-diagnostic-card,
.bulk-import-settings-card {
  border-radius: 1rem;
}

.bulk-import-file-card,
.bulk-import-diagnostic-card {
  border: 1px solid var(--bs-border-color);
  background: #fff;
  padding: 1rem;
}

.bulk-import-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.bulk-import-summary-card {
  border: 1px solid var(--bs-border-color);
  border-radius: 1rem;
  background: #fff;
  padding: 1rem;
}

.bulk-import-summary-card span {
  display: block;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.1;
}

.bulk-import-summary-card small {
  color: var(--bs-secondary-color);
}

.bulk-import-diagnostics {
  display: grid;
  gap: .5rem;
  font-size: .875rem;
}

.diagnostic-group {
  border-radius: .75rem;
  padding: .65rem .75rem;
  border: 1px solid var(--bs-border-color);
  background: #fff;
}

.diagnostic-group.is-error {
  border-color: rgba(var(--bs-danger-rgb), .25);
  color: var(--bs-danger-text-emphasis);
  background: rgba(var(--bs-danger-rgb), .06);
}

.diagnostic-group.is-warning {
  border-color: rgba(var(--bs-warning-rgb), .32);
  color: var(--bs-warning-text-emphasis);
  background: rgba(var(--bs-warning-rgb), .1);
}

.diagnostic-group.is-recommendation {
  border-color: rgba(var(--bs-primary-rgb), .22);
  color: var(--bs-secondary-color);
  background: rgba(var(--bs-primary-rgb), .04);
}

.bulk-import-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.bulk-import-mode-card {
  position: relative;
  display: grid;
  gap: .55rem;
  min-height: 180px;
  border: 1px solid var(--bs-border-color);
  border-radius: 1rem;
  padding: 1.25rem;
  text-align: left;
  background: #fff;
  color: var(--bs-body-color);
}

.bulk-import-mode-card.is-active {
  border-color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), .06);
  box-shadow: 0 0 0 .18rem rgba(var(--bs-primary-rgb), .08);
}

.bulk-import-mode-card__check {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: var(--bs-primary);
}

.bulk-import-mode-card strong {
  padding-right: 2rem;
  font-size: 1.05rem;
}

.bulk-import-mode-card span:not(.bulk-import-mode-card__check) {
  color: var(--bs-body-color);
}

.bulk-import-mode-card small {
  color: var(--bs-secondary-color);
}

.bulk-import-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
}

.bulk-import-actions-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: end;
}

.bulk-import-settings-table th,
.bulk-import-settings-table td {
  vertical-align: top;
}

.bulk-import-settings-table th {
  white-space: nowrap;
}

.bulk-import-settings-table td {
  min-width: 120px;
}

.bulk-import-settings-table td:first-child {
  min-width: 220px;
}

.bulk-import-row-details {
  width: 100%;
}

.bulk-import-details-row > td {
  background: #fbfdff;
  border-top: 0;
}

.bulk-import-row-details summary {
  cursor: pointer;
  color: var(--bs-primary);
  font-weight: 600;
}

.bulk-import-row-details[open] summary {
  margin-bottom: .5rem;
}

.bulk-import-footer-meta {
  max-width: 520px;
}

@media (max-width: 991.98px) {
  .bulk-import-modal {
    height: min(92vh, 900px);
  }

  .bulk-import-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .bulk-import-stepper {
    flex-direction: row;
    border-right: 0;
    border-bottom: 1px solid var(--bs-border-color);
    padding: .75rem;
  }

  .bulk-import-step {
    min-width: 160px;
  }

  .bulk-import-summary-grid,
  .bulk-import-mode-grid,
  .bulk-import-actions-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 575.98px) {
  .bulk-import-modal {
    height: 100vh;
    border-radius: 0;
  }

  .bulk-import-header {
    padding: .85rem;
  }

  .bulk-import-body {
    padding-bottom: 5.5rem;
  }

  .bulk-import-content {
    padding: .85rem;
  }

  .bulk-import-stepper {
    gap: .5rem;
    overflow-x: auto;
  }

  .bulk-import-step {
    min-width: 132px;
    padding: .55rem;
  }

  .bulk-import-step__number {
    width: 1.75rem;
    height: 1.75rem;
  }

  .bulk-import-step__text small {
    display: none;
  }

  .bulk-import-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    align-items: stretch;
    gap: .5rem;
    padding: .75rem;
    box-shadow: 0 -.5rem 1rem rgba(15, 23, 42, .08);
  }

  .bulk-import-footer-meta {
    display: none;
  }

  .bulk-import-footer .btn {
    flex: 1 1 0;
  }

  .bulk-import-panel-head {
    display: grid;
    padding: .85rem;
  }

  .bulk-import-file-table {
    display: none;
  }

  .bulk-import-file-cards {
    display: grid;
    gap: .75rem;
  }

  .bulk-import-summary-grid,
  .bulk-import-mode-grid,
  .bulk-import-actions-grid {
    grid-template-columns: 1fr;
  }

  .bulk-import-settings-table-wrap {
    overflow: visible;
    border: 0 !important;
  }

  .bulk-import-settings-table,
  .bulk-import-settings-table thead,
  .bulk-import-settings-table tbody,
  .bulk-import-settings-table tr,
  .bulk-import-settings-table td {
    display: block;
    width: 100%;
  }

  .bulk-import-settings-table thead {
    display: none;
  }

  .bulk-import-settings-table tr {
    margin-bottom: .85rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    background: #fff;
    padding: .75rem;
  }

  .bulk-import-settings-table td {
    border: 0;
    padding: .45rem 0;
    min-width: 0 !important;
  }

  .bulk-import-settings-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: .2rem;
    font-size: .75rem;
    color: var(--bs-secondary-color);
  }

  .bulk-import-settings-table tr.bulk-import-details-row {
    margin-top: -.85rem;
    padding-top: 0;
    border-top: 0;
    border-radius: 0 0 1rem 1rem;
  }

  .bulk-import-settings-table tr.bulk-import-details-row td {
    padding-top: .2rem;
  }

  .bulk-import-settings-table tr.bulk-import-details-row td::before {
    content: none;
    display: none;
  }

  .bulk-import-row-details summary {
    padding-top: .15rem;
  }

  .bulk-import-filter-group,
  .bulk-import-filter-group .btn {
    width: 100%;
  }
}
