/* GriGsi VMCR — split part 3/10 — workbench columns (action/router/media/text), slots, overlay menus, edit dialogs. Part of website/css/vmcr.css, cut in original order (2026-09-23); load all 10 vmcr-*.css files together in order, never reorder. */
/* Action (primary cams) | Router (narrow) | Media | Text — Media/Text stay readable */
.vmcr-workbench {
  display: grid !important;
  grid-template-columns: minmax(0, 2.45fr) minmax(0, 0.34fr) minmax(10.25rem, 0.88fr) minmax(10.25rem, 0.88fr) !important;
  gap: 10px;
  align-items: stretch;
  margin: 0 0 14px;
  position: relative;
}

.vmcr-workbench > .vmcr-card {
  margin: 0;
  min-width: 0;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
}

.vmcr-action-panel {
  border: 1px solid rgba(47, 95, 138, 0.35);
  background:
    linear-gradient(180deg, rgba(47, 95, 138, 0.1) 0%, rgba(255, 255, 255, 0.72) 48%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  padding: 10px 12px 12px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

/* Action is the hero column — cams keep readable 16:9 tiles. Sized to its own
   content (head + cam grid) instead of stretching to match the taller Router/
   LIVE list columns beside it — that stretch was the source of the empty
   space below the last row of empty cam tiles. */
.vmcr-workbench > .vmcr-action-panel {
  min-width: min(100%, 380px);
  height: auto;
  align-self: start;
}

.vmcr-workbench > .vmcr-media-panel,
.vmcr-workbench > .vmcr-overlay-panel {
  max-width: none;
}

/* Cameras fill Action; tiles size from width (aspect), not crushed height */
.vmcr-action-panel > .vmcr-source-strip {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.vmcr-action-panel .vmcr-previews,
.vmcr-action-panel .vmcr-previews--row {
  flex: 0 1 auto;
  min-height: 0;
  height: auto;
  align-content: start;
  align-items: start;
  grid-auto-rows: auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.vmcr-action-panel .vmcr-preview {
  min-height: 0 !important;
  height: auto !important;
  display: flex !important;
  flex-direction: column;
}

.vmcr-action-panel .vmcr-preview video {
  flex: 0 0 auto;
  width: 100%;
  height: auto !important;
  min-height: 0;
  max-height: none;
  aspect-ratio: 16 / 9 !important;
  object-fit: cover;
  object-position: center;
  background: #000;
}

.vmcr-aux-panel {
  position: relative;
  border: 1px solid rgba(90, 70, 140, 0.35);
  background:
    linear-gradient(180deg, rgba(90, 70, 140, 0.1) 0%, rgba(255, 255, 255, 0.72) 48%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  padding: 8px 8px 10px;
  border-radius: 14px;
  z-index: 4;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.vmcr-aux-panel .vmcr-panel-head {
  margin-bottom: 5px;
}

.vmcr-aux-panel .vmcr-panel-head h2 {
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vmcr-aux-panel .vmcr-panel-head__hint {
  display: none;
}

.vmcr-aux-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  align-content: stretch;
  grid-auto-rows: 1fr;
}

.vmcr-aux-btn--more {
  grid-column: 1 / -1;
}

.vmcr-aux-btn {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 1px;
  width: 100%;
  margin: 0;
  padding: 4px 5px;
  border-radius: 8px;
  border: 1px solid rgba(90, 70, 140, 0.28);
  background: rgba(255, 255, 255, 0.78);
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  min-height: 0;
}

.vmcr-aux-btn strong {
  font-size: 0.67rem;
  font-weight: 750;
  line-height: 1.1;
}

.vmcr-aux-btn span {
  font-size: 0.56rem;
  font-weight: 650;
  color: var(--vmcr-muted);
  line-height: 1.15;
  word-break: break-word;
}

.vmcr-aux-btn--more {
  grid-column: 1 / -1;
}

.vmcr-aux-btn:hover,
.vmcr-aux-btn:focus-visible {
  border-color: rgba(90, 70, 140, 0.55);
  outline: none;
  box-shadow: 0 0 0 2px rgba(90, 70, 140, 0.18);
}

.vmcr-aux-btn.is-open {
  border-color: rgba(90, 70, 140, 0.7);
  background: rgba(236, 230, 255, 0.95);
}

.vmcr-aux-btn.is-routed {
  border-color: rgba(46, 125, 90, 0.5);
  background: rgba(232, 248, 239, 0.95);
}

.vmcr-aux-btn.is-routed span {
  color: #1f6b45;
}

.vmcr-aux-btn--more {
  border-style: dashed;
  text-align: center;
  align-items: center;
}

.vmcr-aux-menu {
  /* Used as the modal panel inside #vmcr-aux-pop (same pattern as Media/Text). */
  position: relative;
  left: auto;
  top: auto;
  width: min(380px, 92vw);
  max-width: 100%;
  max-height: min(82vh, 680px);
  overflow: auto;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(90, 70, 140, 0.35);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 40px rgba(30, 24, 60, 0.18);
  z-index: 1;
  display: grid;
  gap: 8px;
}

.vmcr-aux-menu[hidden] {
  display: none !important;
}

#vmcr-aux-pop .vmcr-aux-menu {
  display: grid;
}

.vmcr-aux-menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vmcr-aux-menu__field {
  display: grid;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--vmcr-muted);
}

.vmcr-aux-menu__field select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--vmcr-line);
  padding: 7px 8px;
  font: inherit;
  font-weight: 650;
  background: #fff;
  color: inherit;
}

.vmcr-aux-send {
  display: grid;
  gap: 5px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(47, 95, 138, 0.16);
  background: rgba(244, 247, 251, 0.9);
}

.vmcr-aux-send__title {
  margin: 0 0 2px;
  font-size: 0.68rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--vmcr-muted, #5a6b7d);
}

.vmcr-aux-send__opt {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
}

.vmcr-aux-menu__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.vmcr-aux-power {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 4.75rem;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-color: rgba(47, 95, 138, 0.35);
  background: rgba(244, 247, 251, 0.95);
  color: var(--vmcr-muted, #5a6b7d);
}

.vmcr-aux-power__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  flex-shrink: 0;
}

.vmcr-aux-power.is-on {
  border-color: rgba(47, 160, 110, 0.55);
  background: rgba(47, 160, 110, 0.14);
  color: #1f7a52;
}

.vmcr-aux-power.is-on .vmcr-aux-power__dot {
  background: #2fa06e;
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(47, 160, 110, 0.22);
}

.vmcr-aux-btn.is-standby {
  border-color: rgba(47, 95, 138, 0.35);
  background: rgba(244, 247, 251, 0.9);
}

.vmcr-aux-btn.is-standby span {
  color: var(--vmcr-muted, #5a6b7d);
}

@media (max-width: 1100px) {
  .vmcr-aux-menu {
    width: min(380px, 94vw);
  }
}

.vmcr-aux-ext {
  border-top: 1px solid var(--vmcr-line);
  padding-top: 8px;
  display: grid;
  gap: 7px;
}

.vmcr-aux-ext__title {
  font-size: 0.68rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--vmcr-muted);
  margin: 0;
}

.vmcr-aux-ext__row {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
}

.vmcr-aux-ext__url {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 8px;
  border: 1px solid var(--vmcr-line);
  padding: 5px 7px;
  font: inherit;
  font-size: 0.7rem;
  background: rgba(255,255,255,0.85);
  color: var(--vmcr-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vmcr-aux-ext__embed-row {
  align-items: flex-start;
}

.vmcr-aux-ext__embed {
  flex: 1 1 0;
  min-width: 0;
  resize: none;
  border-radius: 8px;
  border: 1px solid var(--vmcr-line);
  padding: 5px 7px;
  font: inherit;
  font-size: 0.68rem;
  font-family: monospace;
  background: rgba(255,255,255,0.85);
  color: var(--vmcr-muted);
  line-height: 1.4;
}

.vmcr-workbench > .vmcr-media-panel,
.vmcr-workbench > .vmcr-overlay-panel {
  margin: 0;
  padding: 8px 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(47, 95, 138, 0.28);
  min-width: 0;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: auto;
  touch-action: pan-y;
  display: flex !important;
  flex-direction: column;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.vmcr-workbench > .vmcr-media-panel .vmcr-sheet-close,
.vmcr-workbench > .vmcr-overlay-panel .vmcr-sheet-close {
  display: none !important;
}

.vmcr-workbench > .vmcr-media-panel .vmcr-panel-head,
.vmcr-workbench > .vmcr-overlay-panel .vmcr-panel-head,
.vmcr-workbench > .vmcr-media-panel .vmcr-sheet-head,
.vmcr-workbench > .vmcr-overlay-panel .vmcr-sheet-head {
  flex: 0 0 auto;
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.vmcr-workbench > .vmcr-media-panel .vmcr-panel-head h2,
.vmcr-workbench > .vmcr-overlay-panel .vmcr-panel-head h2,
.vmcr-workbench > .vmcr-media-panel .vmcr-sheet-head h2,
.vmcr-workbench > .vmcr-overlay-panel .vmcr-sheet-head h2 {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.vmcr-workbench > .vmcr-media-panel .vmcr-media-order,
.vmcr-workbench > .vmcr-overlay-panel .vmcr-ov-presets {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.vmcr-workbench .vmcr-bg-panel {
  display: none !important;
}

.vmcr-workbench .vmcr-slot-btn,
.vmcr-workbench .vmcr-bg-btn,
.vmcr-workbench .vmcr-slot-edit,
.vmcr-workbench .vmcr-slot-cue,
.vmcr-workbench .vmcr-slot-play,
.vmcr-workbench .vmcr-media-list,
.vmcr-workbench .vmcr-plate-list {
  touch-action: pan-y;
}

/* Slot stacks fill the column — no empty gap under File / Background / Overlay buttons */
.vmcr-workbench .vmcr-sheet-head {
  flex: 0 0 auto;
}

.vmcr-workbench .vmcr-media-order,
.vmcr-workbench .vmcr-ov-presets {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.vmcr-workbench .vmcr-slot-btns,
.vmcr-workbench .vmcr-bg-col {
  flex: 0 0 auto;
  gap: 5px;
  margin: 0;
  min-height: 0;
}

.vmcr-workbench .vmcr-slot-row {
  flex: 0 0 auto;
  min-height: 36px;
  gap: 5px;
  /* drag | slot | LIVE — z-order lives in MORE overlay only */
  grid-template-columns: auto minmax(0, 1fr) max-content;
}

.vmcr-workbench .vmcr-overlay-panel .vmcr-slot-row {
  grid-template-columns: auto minmax(0, 1fr) max-content;
}

.vmcr-workbench .vmcr-slot-z {
  display: none !important;
}

.vmcr-workbench .vmcr-slot-btn,
.vmcr-workbench .vmcr-bg-btn {
  height: auto;
  min-height: 32px;
  width: 100%;
  min-width: 0;
  padding: 5px 7px;
  justify-content: center;
  border-radius: 8px;
  gap: 1px;
  overflow: hidden;
}

.vmcr-workbench .vmcr-slot-btn span,
.vmcr-workbench .vmcr-bg-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vmcr-workbench .vmcr-slot-live-go {
  flex: 0 0 auto;
  width: auto !important;
  min-width: 3.35rem;
  padding: 5px 9px !important;
  white-space: nowrap;
}

.vmcr-workbench .vmcr-slot-edit,
.vmcr-workbench .vmcr-slot-cue,
.vmcr-workbench .vmcr-slot-play,
.vmcr-workbench .vmcr-slot-tools {
  display: none !important;
}

.vmcr-workbench .vmcr-slot-btn strong,
.vmcr-workbench .vmcr-bg-btn strong {
  font-size: 0.78rem;
  line-height: 1.15;
}

.vmcr-workbench .vmcr-slot-btn span,
.vmcr-workbench .vmcr-bg-btn span {
  font-size: 0.62rem;
  line-height: 1.15;
}

/* Soft per-section tint so the three Prepare columns match but read apart */
.vmcr-workbench .vmcr-media-panel {
  border-color: rgba(47, 95, 138, 0.28);
  background: linear-gradient(180deg, rgba(232, 242, 255, 0.72) 0%, rgba(255, 255, 255, 0.58) 100%);
}

.vmcr-workbench .vmcr-bg-panel {
  border-color: rgba(46, 125, 90, 0.28);
  background: linear-gradient(180deg, rgba(232, 248, 239, 0.72) 0%, rgba(255, 255, 255, 0.58) 100%);
}

.vmcr-workbench .vmcr-overlay-panel {
  border-color: rgba(140, 100, 48, 0.28);
  background: linear-gradient(180deg, rgba(255, 245, 230, 0.78) 0%, rgba(255, 255, 255, 0.58) 100%);
}

.vmcr-workbench .vmcr-sheet-head {
  min-height: 24px;
}

.vmcr-workbench .vmcr-sheet-head h3 {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.vmcr-aux-panel .vmcr-panel-head h2 {
  font-size: 0.72rem;
}

.vmcr-workbench .vmcr-slot-btn,
.vmcr-workbench .vmcr-bg-btn {
  min-height: 0;
  padding: 5px 7px;
}

.vmcr-workbench .vmcr-slot-btns,
.vmcr-workbench .vmcr-bg-col {
  gap: 4px;
}

.vmcr-workbench .vmcr-bg-panel > .vmcr-lead {
  display: none; /* keep button stacks aligned across columns */
}

/* Kill global style.css `section` padding — it shrank Media/Overlay vs Background */
.vmcr-workbench .vmcr-media-order,
.vmcr-workbench .vmcr-ov-presets {
  margin: 0;
  padding: 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 0;
}

/* Author display:flex was beating [hidden] and pushed Media buttons down */
.vmcr-workbench .vmcr-media-list[hidden],
.vmcr-workbench #vmcr-media-name[hidden],
.vmcr-workbench #vmcr-media-video[hidden],
.vmcr-workbench #vmcr-media-file[hidden],
.vmcr-workbench #vmcr-media-clear[hidden] {
  display: none !important;
}

/* One shared stack across Media / Background / Overlay — filled by rules above */
.vmcr-workbench .vmcr-slot-btns,
.vmcr-workbench .vmcr-bg-col {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  box-sizing: border-box;
}

.vmcr-workbench .vmcr-slot-btn,
.vmcr-workbench .vmcr-bg-btn {
  width: 100%;
  box-sizing: border-box;
}

.vmcr-bg-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0;
}

.vmcr-bg-btn {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
  margin: 0;
  padding: 3px 5px;
  border-radius: 7px;
  border: 1px solid rgba(46, 125, 90, 0.32);
  background: rgba(255, 255, 255, 0.78);
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.vmcr-bg-btn strong {
  font-size: 0.62rem;
  font-weight: 750;
  line-height: 1.1;
}

.vmcr-bg-btn span {
  font-size: 0.52rem;
  font-weight: 650;
  color: var(--vmcr-muted);
  line-height: 1.1;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vmcr-bg-panel .vmcr-slot-edit,
.vmcr-bg-col .vmcr-slot-edit,
.vmcr-bg-panel .vmcr-slot-cue,
.vmcr-bg-col .vmcr-slot-cue,
.vmcr-bg-panel .vmcr-slot-play,
.vmcr-bg-col .vmcr-slot-play {
  border-color: rgba(46, 125, 90, 0.32);
}

.vmcr-bg-btn:hover,
.vmcr-bg-btn:focus-visible {
  border-color: rgba(47, 95, 138, 0.55);
  outline: none;
  box-shadow: 0 0 0 2px rgba(47, 95, 138, 0.16);
}

.vmcr-bg-btn.is-open {
  border-color: rgba(47, 95, 138, 0.7);
  background: rgba(230, 240, 255, 0.95);
}

.vmcr-bg-btn.is-filled span {
  color: #1f5a7a;
}

.vmcr-bg-btn.is-on {
  border-color: rgba(46, 125, 90, 0.55);
  background: rgba(232, 248, 239, 0.95);
}

.vmcr-bg-btn.is-on span {
  color: #1f6b45;
}

.vmcr-bg-menu {
  position: fixed;
  inset: 0;
  /* Above sticky .grigsi-top-bar (z-index 9999) so tall Media/Overlay aren't covered */
  z-index: 10050;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px) + 64px) 16px 24px;
  margin: 0;
  border: 0;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

.vmcr-bg-menu[hidden] {
  display: none !important;
}

/* Page stays put while a Director overlay menu is open */
html.vmcr-modal-open,
html.vmcr-modal-open body {
  overflow: hidden !important;
  overscroll-behavior: none;
}
body.vmcr-modal-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}

/* Prepare Media / Overlay menus — floating overlay like Background / Router */
.vmcr-slot-pop {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px) + 64px) 16px 24px;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  overscroll-behavior: none;
}

.vmcr-slot-pop[hidden] {
  display: none !important;
}

/* Media / Text&BG slot → Preview | Program route menu */
.vmcr-slot-route {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  margin: 0;
  border: 0;
  background: transparent !important;
  background-color: transparent !important;
  overflow: hidden;
  overscroll-behavior: none;
}

.vmcr-slot-route[hidden] {
  display: none !important;
}

.vmcr-slot-route__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 28, 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.vmcr-slot-route__panel {
  position: relative;
  z-index: 1;
  width: min(720px, 96vw);
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(47, 95, 138, 0.28);
  background: #fff;
  box-shadow: 0 18px 48px rgba(20, 36, 56, 0.32);
  color: #1a2430;
}

.vmcr-slot-route__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.vmcr-slot-route__head strong {
  font-size: 1rem;
  color: inherit;
}

.vmcr-slot-route__cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.vmcr-slot-route__col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(47, 95, 138, 0.16);
  background: rgba(47, 95, 138, 0.05);
}

.vmcr-slot-route__col--both {
  border-color: rgba(0, 122, 255, 0.35);
  background: rgba(0, 122, 255, 0.08);
}

.vmcr-slot-route__col-hint {
  margin: -2px 0 2px;
  font-size: 0.68rem;
  line-height: 1.25;
  text-align: center;
  color: rgba(26, 36, 48, 0.62);
}

.vmcr-slot-route__col h4 {
  margin: 0 0 2px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  color: #1a2430;
}

@media (max-width: 720px) {
  .vmcr-slot-route__cols {
    grid-template-columns: 1fr;
  }
}

.vmcr-slot-route__btn {
  width: 100%;
  min-height: 36px;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
}

.vmcr-slot-route__btn.vmcr-btn--ghost {
  background: rgba(255, 255, 255, 0.92);
  color: #1a2430 !important;
  -webkit-text-fill-color: #1a2430 !important;
  border-color: rgba(47, 95, 138, 0.28);
}

.vmcr-slot-route__foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.vmcr-slot-route__foot .vmcr-btn {
  color: #1a2430 !important;
  -webkit-text-fill-color: #1a2430 !important;
}

body.vmcr-dir-page.vmcr-mix-fs .vmcr-slot-route__panel {
  background: rgba(12, 18, 28, 0.96);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

body.vmcr-dir-page.vmcr-mix-fs .vmcr-slot-route__col {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

body.vmcr-dir-page.vmcr-mix-fs .vmcr-slot-route__col h4 {
  color: #fff;
}

body.vmcr-dir-page.vmcr-mix-fs .vmcr-slot-route__col--both {
  background: rgba(0, 122, 255, 0.18);
  border-color: rgba(100, 180, 255, 0.4);
}

body.vmcr-dir-page.vmcr-mix-fs .vmcr-slot-route__col-hint {
  color: rgba(255, 255, 255, 0.65);
}

body.vmcr-dir-page.vmcr-mix-fs .vmcr-slot-route__btn.vmcr-btn--ghost,
body.vmcr-dir-page.vmcr-mix-fs .vmcr-slot-route__foot .vmcr-btn {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

body.vmcr-dir-page.vmcr-mix-fs .vmcr-slot-route__btn.vmcr-btn--primary {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

.vmcr-slot-pop__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 28, 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.vmcr-slot-pop__panel {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  max-height: min(86vh, 620px);
  overflow: auto;
  padding: 14px 14px 12px;
  border-radius: 16px;
  border: 1px solid rgba(47, 95, 138, 0.22);
  background: #fff;
  box-shadow: 0 18px 48px rgba(20, 36, 56, 0.3);
}

.vmcr-slot-pop__panel .vmcr-slot-menus,
.vmcr-slot-pop__panel .vmcr-media-order-list,
.vmcr-slot-pop__panel .vmcr-ov-preset-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: block;
}

.vmcr-slot-pop__panel .vmcr-slot-menu {
  margin: 0;
}

.vmcr-slot-pop__panel .vmcr-ov-preset.vmcr-slot-menu {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.vmcr-bg-menu__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 28, 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.vmcr-bg-menu__panel {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  max-height: min(86dvh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px 16px 14px;
  border-radius: 16px;
  border: 1px solid rgba(47, 95, 138, 0.22);
  background: #fff;
  box-shadow: 0 18px 48px rgba(20, 36, 56, 0.3);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-content: start;
  color: #1a2430;
}

.vmcr-bg-menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vmcr-bg-menu__head strong {
  font-size: 1.05rem;
  font-weight: 750;
}

.vmcr-bg-menu__preview-wrap {
  display: block;
  position: relative;
  z-index: 3;
  isolation: isolate;
  width: 100%;
  min-height: 120px;
  max-height: 220px;
  border-radius: 10px;
  border: 1px solid rgba(47, 95, 138, 0.18);
  background: #0a1018;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  contain: layout paint;
}

.vmcr-bg-menu__preview-wrap.is-frameable {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.vmcr-bg-menu__preview-wrap.is-frameable.is-dragging {
  cursor: grabbing;
}

.vmcr-bg-menu__preview-wrap.is-frameable:not(.has-media) {
  cursor: default;
}

.vmcr-bg-menu__thumb {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: fill;
  border-radius: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
}

.vmcr-bg-menu__preview-wrap.is-framed .vmcr-bg-menu__thumb {
  inset: auto;
  max-width: none;
  max-height: none;
  object-fit: fill;
}

/* display:block on thumb was beating [hidden] and expanding the black preview over Fit/actions */
.vmcr-bg-menu__thumb[hidden] {
  display: none !important;
}

.vmcr-asset-frame {
  display: grid;
  gap: 6px;
  margin-top: -2px;
}

.vmcr-asset-frame__scale {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--vmcr-muted, #5a6b7d);
}

.vmcr-asset-frame__scale input[type="range"] {
  width: 100%;
  accent-color: #2f5f8a;
}

.vmcr-asset-frame__pct {
  min-width: 3.2em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  text-transform: none;
  letter-spacing: 0;
  color: #1e4060;
}

.vmcr-asset-frame__hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--vmcr-muted, #5a6b7d);
}

.vmcr-asset-menu .vmcr-asset-frame {
  position: relative;
  z-index: 4;
  background: #fff;
  flex: 0 0 auto;
}

/* Media / Text&BG / Background edit dialogs */
.vmcr-asset-menu .vmcr-bg-menu__panel {
  max-height: min(86dvh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.vmcr-asset-menu .vmcr-bg-menu__head,
.vmcr-asset-menu .vmcr-lead,
.vmcr-asset-menu .vmcr-meta-line {
  flex: 0 0 auto;
}

/* Preview must NOT be sticky above Scale — that blocked the slider / Use clicks */
.vmcr-asset-menu .vmcr-bg-menu__preview-wrap {
  max-height: min(34vh, 220px);
  min-height: 140px;
  z-index: 1;
  flex: 0 0 auto;
  position: relative;
  top: auto;
  background: #0a1018;
  box-shadow: none;
}

.vmcr-asset-menu .vmcr-field {
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
  background: #fff;
  padding-top: 2px;
}

.vmcr-asset-menu .vmcr-bg-fit,
.vmcr-asset-menu .vmcr-bg-menu__actions {
  position: relative;
  z-index: 5;
  background: #fff;
  flex: 0 0 auto;
}

.vmcr-asset-menu .vmcr-bg-menu__actions {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding-top: 8px;
  padding-bottom: 2px;
  border-top: 1px solid rgba(47, 95, 138, 0.12);
  box-shadow: 0 -8px 16px rgba(255, 255, 255, 0.95);
}

.vmcr-bg-menu__preview-wrap[data-bg-fit="cover"] .vmcr-bg-menu__thumb {
  object-fit: cover;
}

.vmcr-bg-menu__preview-wrap[data-bg-fit="contain"] .vmcr-bg-menu__thumb {
  object-fit: contain;
}

.vmcr-bg-menu__preview-wrap[data-bg-fit="stretch"] .vmcr-bg-menu__thumb {
  object-fit: fill;
}

.vmcr-bg-menu__preview-wrap[data-asset-fit="cover"] .vmcr-bg-menu__thumb {
  object-fit: cover;
}

.vmcr-bg-menu__preview-wrap[data-asset-fit="contain"] .vmcr-bg-menu__thumb {
  object-fit: contain;
}

.vmcr-bg-menu__preview-wrap[data-asset-fit="stretch"] .vmcr-bg-menu__thumb {
  object-fit: fill;
}

/* Overlay has extra LT fields — tighten spacing so the whole dialog fits */
#vmcr-ov-pop .vmcr-bg-menu__panel {
  gap: 8px;
}

#vmcr-ov-pop .vmcr-field {
  margin-bottom: 0;
}

#vmcr-ov-pop .vmcr-field input {
  padding: 6px 8px;
  /* Never below 16px — smaller triggers iOS/Android's auto-zoom-on-focus. */
  font-size: max(16px, 0.85rem);
}

#vmcr-ov-pop .vmcr-lead {
  margin: 0;
  font-size: 0.75rem;
}

/* Fit buttons: never inherit global .vmcr-btn.is-active white-on-light */
.vmcr-asset-menu .vmcr-asset-fit__btn.is-active,
.vmcr-bg-menu .vmcr-bg-fit__btn.is-active,
.vmcr-asset-fit__btn.is-active,
.vmcr-bg-fit__btn.is-active {
  border-color: rgba(47, 95, 138, 0.65) !important;
  background: rgba(230, 240, 255, 0.98) !important;
  color: #1a2430 !important;
  -webkit-text-fill-color: #1a2430 !important;
  font-weight: 750;
}

.vmcr-asset-menu .vmcr-btn--ghost,
.vmcr-bg-menu .vmcr-btn--ghost {
  color: #1a2430 !important;
  -webkit-text-fill-color: #1a2430 !important;
}

.vmcr-asset-menu .vmcr-btn--primary,
.vmcr-bg-menu .vmcr-btn--primary {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

.vmcr-bg-fit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.vmcr-bg-fit__label {
  font-size: 0.68rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--vmcr-muted, #5a6b7d);
  margin-right: 2px;
}

.vmcr-bg-menu__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#vmcr-ov-pop .vmcr-bg-menu__actions {
  grid-template-columns: 1fr 1fr 1fr;
}

.vmcr-bg-menu__actions .vmcr-btn {
  min-height: 2.4rem;
  justify-content: center;
}

.vmcr-bg-menu__actions label.vmcr-btn {
  cursor: pointer;
}

#vmcr-media-menu-ok,
#vmcr-ov-menu-ok {
  font-weight: 750;
}

/* Text edit — Names / Your Text tabs */
.vmcr-ov-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 8px;
}

.vmcr-ov-tab {
  appearance: none;
  margin: 0;
  min-height: 2.2rem;
  border-radius: 10px;
  border: 1px solid rgba(47, 95, 138, 0.22);
  background: rgba(255, 255, 255, 0.72);
  color: #1a2430;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.vmcr-ov-tab.is-active {
  border-color: rgba(47, 95, 138, 0.55);
  background: rgba(230, 240, 255, 0.98);
  box-shadow: 0 0 0 2px rgba(47, 95, 138, 0.18);
}

.vmcr-ov-tabpanel {
  display: grid;
  gap: 8px;
}

.vmcr-ov-tabpanel[hidden] {
  display: none !important;
}

.vmcr-ov-free-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  border: 1px solid rgba(47, 95, 138, 0.18);
  background: #0a1018;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.vmcr-ov-free-stage.is-dragging {
  cursor: grabbing;
}

.vmcr-ov-free-preview {
  display: block;
  width: 100%;
  height: 100%;
}

.vmcr-ov-free-box {
  position: absolute;
  border: 1px dashed rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 3;
}

.vmcr-ov-free-box.is-active {
  border-color: rgba(74, 143, 212, 0.95);
  box-shadow: 0 0 0 2px rgba(74, 143, 212, 0.35);
}

.vmcr-ov-free-bg-box {
  position: absolute;
  border: 1px dashed rgba(240, 179, 90, 0.7);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 2;
}

.vmcr-ov-free-bg-box.is-active {
  border-color: rgba(240, 179, 90, 0.98);
  box-shadow: 0 0 0 2px rgba(240, 179, 90, 0.4);
}

.vmcr-ov-free-bg-box__label {
  position: absolute;
  left: 4px;
  top: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  color: #f0b35a;
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.vmcr-ov-free-box__handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: #fff;
  border: 1px solid rgba(47, 95, 138, 0.55);
  pointer-events: auto;
  cursor: nwse-resize;
  touch-action: none;
}

.vmcr-ov-free-layers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vmcr-ov-free-layers .is-active {
  border-color: rgba(47, 95, 138, 0.55);
  background: rgba(230, 240, 255, 0.98);
  box-shadow: 0 0 0 2px rgba(47, 95, 138, 0.18);
}

.vmcr-ov-free-bg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.vmcr-ov-free-bg__label {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  color: #3a4a5c;
}

#vmcr-ov-free-bg-name {
  flex: 1 1 100%;
  margin: 0;
}

.vmcr-ov-fonts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.vmcr-ov-font-btn {
  appearance: none;
  margin: 0;
  min-height: 2.1rem;
  border-radius: 10px;
  border: 1px solid rgba(47, 95, 138, 0.22);
  background: #fff;
  color: #1a2430;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.vmcr-ov-font-btn.is-active {
  border-color: rgba(196, 95, 18, 0.65);
  box-shadow: 0 0 0 2px rgba(196, 95, 18, 0.28);
}

.vmcr-ov-align {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.vmcr-ov-align-btn {
  appearance: none;
  margin: 0;
  min-height: 2.1rem;
  border-radius: 10px;
  border: 1px solid rgba(47, 95, 138, 0.22);
  background: #fff;
  color: #1a2430;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.vmcr-ov-align-btn.is-active {
  border-color: rgba(47, 95, 138, 0.55);
  background: rgba(230, 240, 255, 0.98);
  box-shadow: 0 0 0 2px rgba(47, 95, 138, 0.18);
}

.vmcr-ov-free-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.vmcr-ov-free-tools .vmcr-asset-frame__scale {
  flex: 1 1 140px;
}

#vmcr-ov-free-text {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid var(--vmcr-line, rgba(47, 95, 138, 0.25));
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

.vmcr-pvw-overlay__free {
  position: absolute;
  z-index: 5;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.15;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.vmcr-pvw-overlay__free-bg {
  position: absolute;
  z-index: 4;
  margin: 0;
  overflow: hidden;
  background: #0a1018;
  pointer-events: none;
}

.vmcr-pvw-overlay__free-bg img,
.vmcr-pvw-overlay__free-bg video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vmcr-pvw-overlay__lt[hidden],
.vmcr-pvw-overlay__free[hidden],
.vmcr-pvw-overlay__free-bg[hidden] {
  display: none !important;
}

/* Text menu — selected form lives in the upload/settings square */
#vmcr-ov-menu-preview .vmcr-ov-menu-form-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 0;
  background: #0c121c;
}

#vmcr-ov-menu-preview.has-media .vmcr-ov-menu-form-preview {
  opacity: 0.22;
}

#vmcr-ov-menu-preview .vmcr-bg-menu__thumb {
  z-index: 1;
}

/* Text — form gallery + spectrum color circle (under preview) */
.vmcr-ov-forms {
  flex: 0 0 auto;
  margin: 2px 0 8px;
  padding: 8px;
  border: 1px solid rgba(47, 95, 138, 0.18);
  border-radius: 12px;
  background: rgba(248, 251, 255, 0.9);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vmcr-ov-forms__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
}

.vmcr-ov-forms__label {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--vmcr-muted, #5a6a7a);
}

.vmcr-ov-color {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: 0 0 auto;
  cursor: pointer;
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 3px rgba(47, 95, 138, 0.35),
    0 4px 12px rgba(26, 36, 51, 0.18);
  background:
    conic-gradient(
      from 0deg,
      #ff0040,
      #ff8000,
      #ff0,
      #0f0,
      #0ff,
      #08f,
      #80f,
      #f0f,
      #ff0040
    );
  overflow: hidden;
}

.vmcr-ov-color__swatch {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #c45f12;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.vmcr-ov-color input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
}

.vmcr-ov-forms__clip {
  position: relative;
  overflow: hidden;
}


/* Bug #6: "Prepare a background first" opens the Background card (no landscape sheet exists for it). */
body.vmcr-dir-page.vmcr-sheet-background #vmcr-bg-panel {
  outline: 2px solid rgba(196, 95, 18, 0.75);
  outline-offset: 2px;
}
