: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%;
}

.viewer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  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 {
  height: 100%;
}

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

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

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

.viewer-sidebar-scroll {
  height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.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-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(240px, 1fr) minmax(220px, 0.88fr);
  }

  .viewer-sidebar {
    position: static !important;
    top: auto !important;
  }
}

@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(230px, 0.95fr) minmax(220px, 1fr);
  }

  .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;
}


.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) {
  }
