.platform-journey {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin: 14px 0 20px;
  padding: 14px;
  border: 1px solid rgba(117, 175, 255, .25);
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(10, 18, 42, .94), rgba(28, 20, 55, .9));
  color: #f7f9ff;
}

.studio-pipeline-graph {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line, #242429);
  border-radius: 9px;
  background: rgba(14, 14, 16, 0.94);
}

.studio-pipeline-graph .section-title { margin-bottom: 9px; }
.pipeline-node-row { display: flex; align-items: center; gap: 5px; overflow-x: auto; }
.pipeline-node-row i { color: #555563; font-style: normal; }
.pipeline-node {
  flex: 0 0 auto;
  padding: 5px 7px;
  border: 1px solid #34343c;
  border-radius: 6px;
  color: #8c8c98;
  font-size: 8px;
  letter-spacing: .04em;
}
.pipeline-node.is-complete { border-color: #1d7d50; color: #75eeb1; background: #0b2118; }
.pipeline-node.is-active { border-color: #8b5cf6; color: #fff; background: #2a1943; box-shadow: 0 0 12px rgba(139, 92, 246, .28); }
.pipeline-node.is-failed,
.pipeline-node.is-blocked { border-color: #d94d5c; color: #ffd8dc; background: #351319; }
.pipeline-node.is-skipped { border-style: dashed; opacity: .72; }
.pipeline-asset-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(110px, 150px);
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
.pipeline-asset-strip figure { margin: 0; min-width: 0; }
.pipeline-asset-strip img,
.pipeline-asset-strip video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid #34343c; border-radius: 7px; background: #07070a; }
.pipeline-asset-strip figcaption { margin-top: 4px; overflow: hidden; color: #9fa5bb; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-route-panel { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:8px; margin-top:9px; }
.pipeline-route-panel > div { min-width:0; padding:8px; border:1px solid #34343c; border-radius:7px; background:#0a0a0d; }
.pipeline-route-panel b { display:block; margin-bottom:5px; font-size:8px; letter-spacing:.08em; text-transform:uppercase; color:#aaaaba; }
.pipeline-route-panel button { display:block; width:100%; margin-top:5px; padding:6px 7px; border:1px solid #4d3b76; border-radius:6px; background:#181024; color:#ebe4ff; font-size:8px; text-align:left; cursor:pointer; }
.pipeline-route-panel button:hover { border-color:#8b5cf6; }
.pipeline-route-panel small { display:block; color:#8f91a1; font-size:8px; line-height:1.35; }
@media(max-width:820px){.pipeline-route-panel{grid-template-columns:1fr}}
.platform-journey[hidden] { display: none !important; }
.journey-dismiss {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(144, 162, 205, .32);
  border-radius: 7px;
  background: rgba(7, 12, 25, .78);
  color: #aeb9d2;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.journey-dismiss:hover,
.journey-dismiss:focus-visible { color: #fff; border-color: #7d6cf1; background: #1b2040; }
.platform-journey > div { flex: 1; min-width: 0; display: grid; grid-template-columns: 30px 1fr; column-gap: 9px; align-content: center; }
.platform-journey > div > span { grid-row: 1 / span 2; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #7457ff; font-weight: 800; }
.platform-journey strong { font-size: .88rem; line-height: 1.25; }
.platform-journey small { margin-top: 3px; color: #b9c6e8; line-height: 1.35; }
.platform-journey > i { align-self: center; color: #7fa8ff; font-style: normal; font-size: 1.2rem; }
.studio-journey { margin: 12px 18px; }
#video-avatar-readiness {
  display: block;
  margin-top: 6px;
  color: #9eabc9;
  font-size: 9px;
  line-height: 1.45;
}
#video-avatar-readiness.is-error {
  padding: 7px 8px;
  border: 1px solid rgba(255, 92, 103, .6);
  border-radius: 7px;
  background: rgba(104, 24, 34, .28);
  color: #ffd6d9;
  font-weight: 700;
}
.cast-identity-preflight {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
  padding: 9px 10px;
  border: 1px solid rgba(107, 126, 181, .42);
  border-radius: 9px;
  background: rgba(15, 22, 43, .72);
}
.cast-identity-preflight strong,
.cast-identity-preflight small { display: block; }
.cast-identity-preflight strong { font-size: 11px; color: #f3f6ff; }
.cast-identity-preflight small { margin-top: 3px; font-size: 9px; line-height: 1.4; color: #aeb9d2; }
.cast-identity-preflight a {
  white-space: nowrap;
  color: #9ebcff;
  font-size: 10px;
  font-weight: 750;
  text-decoration: none;
}
.cast-identity-preflight a:hover,
.cast-identity-preflight a:focus-visible { color: #fff; text-decoration: underline; }
.story-reference-card {
  display: grid;
  gap: 8px;
  margin: 8px 0;
  padding: 9px;
  border: 1px solid #35486b;
  border-radius: 9px;
  background: #0a1220;
}
.story-reference-heading strong,
.story-reference-heading small { display: block; }
.story-reference-heading strong { color: #eef3ff; font-size: 10px; }
.story-reference-heading small { margin-top: 3px; color: #97a6c2; font-size: 8px; line-height: 1.4; }
.story-reference-upload { display: grid; grid-template-columns: minmax(92px,.8fr) minmax(126px,1.2fr); gap: 7px; }
.story-reference-upload .button { grid-column: 1 / -1; }
.reference-file input[type="file"] { height: auto; min-height: 34px; padding: 6px; font-size: 8px; }
.story-reference-list { display: grid; gap: 5px; }
.story-reference-list > small { color: #8290a9; font-size: 8px; }
.story-reference-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 8px; border: 1px solid #2c3c59; border-radius: 7px; background: #0d1728; }
.story-reference-item span { min-width: 0; }
.story-reference-item strong,
.story-reference-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-reference-item strong { color: #f0f4ff; font-size: 9px; }
.story-reference-item small { margin-top: 2px; color: #8293b1; font: 7px ui-monospace, monospace; }
.story-reference-item button { flex: 0 0 auto; border: 0; background: transparent; color: #ff9ca3; font-size: 8px; }
@media (max-width: 900px) {
  .platform-journey { overflow-x: auto; }
  .platform-journey > div { min-width: 190px; }
  .cast-identity-preflight { grid-template-columns: 1fr; }
  .story-reference-upload { grid-template-columns: 1fr; }
}

/* Studio v18: the shell has four content rows (header, journey, workspace,
   timeline). Keeping this explicit prevents the browser from creating an
   oversized implicit row that crushes the three-column workstation. */
.studio-shell {
  --left: clamp(270px, 18vw, 340px);
  --right: clamp(370px, 25vw, 470px);
  --timeline: clamp(176px, 21dvh, 218px);
  grid-template-rows: var(--header) auto minmax(0, 1fr) var(--timeline);
}
.studio-journey {
  min-height: 68px;
  max-height: 88px;
  margin: 8px 14px;
  padding: 9px 42px 9px 12px;
  gap: 7px;
  border-radius: 12px;
}
.studio-journey > div { grid-template-columns: 25px 1fr; column-gap: 7px; }
.studio-journey > div > span { width: 25px; height: 25px; font-size: 11px; }
.studio-journey strong { font-size: 11px; }
.studio-journey small { font-size: 9px; line-height: 1.25; }
.studio-journey > i { font-size: 13px; }

.studio-workspace {
  grid-template-columns: var(--left) minmax(440px, 1fr) var(--right);
  min-height: 0;
  overflow: hidden;
}
.zone-left,
.zone-right {
  min-height: 0;
  padding: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #536585 transparent;
  scrollbar-gutter: stable;
}
.zone-monitor { min-height: 0; padding: 12px; }
.monitor-heading { min-height: 34px; }
.workspace-view-actions,
.timeline-tools { display: flex; align-items: center; gap: 7px; }
.panel-toggle {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #314463;
  border-radius: 7px;
  background: #0c1424;
  color: #aebbd0;
  font-size: 9px;
  font-weight: 750;
}
.panel-toggle[aria-pressed="true"] { color: #fff; border-color: #6f62ca; background: #1c2340; }
.monitor-frame { min-height: 210px; }
.monitor-empty { min-height: 0; overflow: hidden; }
.monitor-logo {
  width: clamp(68px, 11dvh, 112px);
  height: clamp(68px, 11dvh, 112px);
  flex: 0 0 auto;
}
.monitor-empty strong { flex: 0 0 auto; }
.monitor-empty p { margin-bottom: 0; }

.planning-card { padding: 10px; }
.planning-card > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}
.planning-card > summary::-webkit-details-marker { display: none; }
.planning-card > summary::after { content: "+"; color: #9ba9c7; font-size: 15px; }
.planning-card[open] > summary::after { content: "−"; }
.planning-card > summary strong { font-size: 10px; }
.planning-card > summary .card-kicker { font-size: 8px; }

.inspector-form { gap: 8px; }
.video-direction-card { padding: 10px; }
.video-direction-card > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  list-style: none;
}
.video-direction-card > summary::-webkit-details-marker { display: none; }
.video-direction-card > summary span { display: flex; align-items: center; gap: 7px; }
.video-direction-card > summary b {
  padding: 3px 5px;
  border-radius: 5px;
  background: #2f2753;
  color: #cfc5ff;
  font-size: 7px;
  letter-spacing: .1em;
}
.video-direction-card > summary small { color: #8190ac; font-size: 8px; font-weight: 600; }
.video-direction-card > summary::after { content: "+"; color: #a89bd1; font-size: 15px; }
.video-direction-card[open] > summary::after { content: "−"; }
.video-direction-card[open] > summary small { display: none; }

.video-toggles { gap: 7px; }
.video-toggles label,
.video-toggles .compact-toggle,
.video-toggles .consent-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  margin: 0;
  padding: 7px 8px;
  border: 1px solid #2a3855;
  border-radius: 7px;
  background: #0b1322;
  color: #e5ebf8;
  font-size: 9px;
  line-height: 1.35;
  letter-spacing: 0;
  font-weight: 500;
}
.video-toggles input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: #7c5cff;
}
.video-toggles label > span { min-width: 0; }
.video-toggles label strong,
.video-toggles label small { display: block; }
.video-toggles label strong { color: #f2f5ff; font-size: 9px; line-height: 1.3; }
.video-toggles label small { margin-top: 2px; color: #91a0bd; font-size: 8px; line-height: 1.4; font-weight: 450; }
.video-toggles label:has(input:checked) { border-color: #6657bd; background: #171b35; }

.timeline-tools { justify-content: flex-end; }
.zone-timeline .timeline-track { height: 29px; }
.zone-timeline .track-label { padding: 4px 8px; }
.zone-timeline .track-label span { margin-top: 1px; }
.zone-timeline .clip { top: 4px; height: 21px; padding: 4px 7px; }
.studio-shell.timeline-collapsed { --timeline: 45px; }
.studio-shell.timeline-collapsed .zone-timeline { padding-block: 7px; }
.studio-shell.timeline-collapsed .timeline-scroll { display: none; }
.studio-shell.timeline-collapsed .timeline-toolbar { height: 30px; align-items: center; }
.studio-shell.library-collapsed .zone-left,
.studio-shell.director-collapsed .zone-right { display: none; }
.studio-shell.library-collapsed:not(.director-collapsed) .studio-workspace { grid-template-columns: minmax(440px, 1fr) var(--right); }
.studio-shell.director-collapsed:not(.library-collapsed) .studio-workspace { grid-template-columns: var(--left) minmax(440px, 1fr); }
.studio-shell.library-collapsed.director-collapsed .studio-workspace { grid-template-columns: minmax(0, 1fr); }
.studio-mobile-nav { display: none; }

/* Dashboard hub-and-spoke rail and project anchor. */
.project-hub-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid rgba(98, 118, 170, .36);
  border-radius: 13px;
  background: linear-gradient(120deg, rgba(12, 21, 42, .96), rgba(28, 23, 55, .9));
}
.project-hub-context { min-width: 0; }
.project-hub-context > span { display: block; color: #8293b3; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.project-hub-context strong { display: block; margin-top: 3px; color: #f5f7ff; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-hub-context small { display: block; margin-top: 2px; color: #9dacc6; font-size: 10px; }
.project-hub-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.project-journey-toggle {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #374a70;
  border-radius: 8px;
  background: #0d1628;
  color: #aebbd2;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}
.project-journey-toggle[aria-expanded="true"] { border-color: #7565df; color: #fff; background: #1b2040; }
.project-hub-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.project-hub-actions button,
.project-hub-actions a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid #3b4e73;
  border-radius: 8px;
  background: #111a2e;
  color: #edf2ff;
  text-decoration: none;
  font-size: 10px;
  font-weight: 750;
}
.project-hub-actions .is-primary { border-color: #7968e4; background: linear-gradient(135deg, #654ce4, #4431ad); }
.project-hub-actions :disabled { opacity: .42; cursor: not-allowed; }

@media (max-width: 1199px) and (min-width: 821px) {
  .studio-shell { --left: 220px; --right: 330px; }
  .studio-workspace { grid-template-columns: var(--left) minmax(360px, 1fr) var(--right); }
  .studio-journey small { display: none; }
  .studio-journey > div > span { grid-row: 1; }
}

@media (max-height: 780px) and (min-width: 821px) {
  .studio-shell { --timeline: 164px; }
  .studio-journey { min-height: 54px; max-height: 60px; padding-block: 7px; }
  .studio-journey small { display: none; }
  .monitor-logo { width: 66px; height: 66px; margin-bottom: 7px; }
  .monitor-empty p { font-size: 9px; line-height: 1.35; }
}

@media (max-width: 820px) {
  body { padding-bottom: 58px; }
  body:not(:has(.studio-shell)) .header {
    margin-bottom: 14px;
    padding: 10px 12px;
  }
  body:not(:has(.studio-shell)) .header-content {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center !important;
    gap: 8px !important;
    width: 100%;
  }
  body:not(:has(.studio-shell)) .brand-name {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    font-size: 19px;
    white-space: nowrap;
  }
  body:not(:has(.studio-shell)) .brand-tagline { display: none; }
  body:not(:has(.studio-shell)) #globalSearchBar {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
    margin: 0;
  }
  body:not(:has(.studio-shell)) .dashboard-v5-inline-26 {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    min-width: 0;
  }
  body:not(:has(.studio-shell)) #vge-main-nav > .vge-nav-link { display: none !important; }
  body:not(:has(.studio-shell)) #vge-main-nav { flex: 0 0 36px; }
  body:not(:has(.studio-shell)) .connection-status-inline {
    width: 36px;
    height: 36px;
    justify-content: center;
    padding: 0;
  }
  body:not(:has(.studio-shell)) .connection-status-inline > span { display: none; }
  body:not(:has(.studio-shell)) .connection-status-inline .status-dot { margin: 0; }
  .studio-shell {
    display: block;
    height: auto;
    min-height: 100dvh;
  }
  .studio-header { position: sticky; top: 0; z-index: 50; }
  .studio-journey {
    min-height: 54px;
    max-height: 64px;
    margin: 7px 8px;
    padding: 7px 8px;
    overflow-x: auto;
    border-radius: 9px;
    scroll-snap-type: x proximity;
  }
  .studio-journey .journey-dismiss { display: none; }
  .studio-journey > div { min-width: 142px; grid-template-columns: 22px 1fr; scroll-snap-align: start; }
  .studio-journey > div > span { width: 22px; height: 22px; grid-row: 1; }
  .studio-journey strong { font-size: 9px; }
  .studio-journey small { display: none; }
  .studio-workspace { display: block; min-height: calc(100dvh - 125px); overflow: visible; }
  .studio-workspace > .zone,
  .zone-timeline { display: none; }
  .studio-shell[data-mobile-view="library"] .zone-left,
  .studio-shell[data-mobile-view="monitor"] .zone-monitor,
  .studio-shell[data-mobile-view="director"] .zone-right { display: block; }
  .studio-shell[data-mobile-view="monitor"] .zone-monitor { display: flex; }
  .studio-shell[data-mobile-view="timeline"] .studio-workspace { display: none; }
  .studio-shell[data-mobile-view="timeline"] .zone-timeline { display: block; height: calc(100dvh - 122px); overflow-x: auto; }
  .zone-left,
  .zone-right,
  .zone-monitor { min-height: calc(100dvh - 128px); max-height: none; overflow: visible; border: 0; }
  .workspace-view-actions .panel-toggle { display: none; }
  .monitor-frame { min-height: min(54dvh, 520px); }
  .video-direction-card > summary { min-height: 38px; }
  .video-toggles label strong { font-size: 10px; }
  .video-toggles label small { font-size: 9px; }
  .timeline-tools .timeline-legend { display: none; }
  .timeline-tools #toggle-timeline { display: none; }
  .studio-mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    height: 58px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid #2d3d5c;
    background: rgba(7, 12, 24, .98);
    box-shadow: 0 -10px 28px rgba(0, 0, 0, .34);
  }
  .studio-mobile-nav button {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    border: 0;
    border-top: 2px solid transparent;
    background: transparent;
    color: #8291ac;
    font-size: 9px;
    font-weight: 750;
  }
  .studio-mobile-nav button span { font-size: 15px; line-height: 1; }
  .studio-mobile-nav button.is-active { color: #f4f6ff; border-top-color: #7962ff; background: #11182a; }

  .dashboard-v5-inline-29.tab-navigation {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10020;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 0 0 env(safe-area-inset-bottom);
    overflow: visible;
    border: 0;
    border-top: 1px solid rgba(102, 126, 234, .4);
    background: rgba(8, 12, 25, .98);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .38);
  }
  .dashboard-v5-inline-29 .tab-btn {
    min-width: 0;
    min-height: 58px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    padding: 5px 2px;
    border: 0;
    border-top: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    font-size: 8px;
    line-height: 1.1;
    white-space: normal;
    text-align: center;
  }
  .dashboard-v5-inline-29 .tab-btn i { font-size: 15px; }
  .dashboard-v5-inline-29 .tab-btn small { display: none; }
  .dashboard-v5-inline-29 .tab-btn.active { border-top-color: #7764ff; box-shadow: none; background: #12182c; }
  #miniPlayer { bottom: calc(58px + env(safe-area-inset-bottom)) !important; }
  body:not(:has(.studio-shell)) { padding-bottom: 122px; }
  .project-hub-bar { grid-template-columns: 1fr; gap: 9px; margin: 8px 0; padding: 10px; }
  .project-hub-tools { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .project-hub-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
  .project-hub-actions button,
  .project-hub-actions a { min-width: 0; padding-inline: 5px; font-size: 9px; }
  .container > .platform-journey:not([hidden]) {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(66px + env(safe-area-inset-bottom));
    z-index: 1300;
    max-height: min(46dvh, 330px);
    margin: 0;
    padding: 38px 12px 12px;
    overflow: auto;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .62);
  }
}

@media (max-width: 430px) {
  .studio-header .brand-lockup h1,
  .studio-header .brand-lockup p { display: none; }
  .studio-header .brand-lockup { min-width: 32px; }
  .project-hub-actions { grid-template-columns: 1fr 1fr; }
  .project-hub-tools { grid-template-columns: 1fr; }
  .project-journey-toggle { justify-self: start; }
  .dashboard-v5-inline-29 .tab-btn { font-size: 7.5px; }
}
