/* ==========================================================================
   S4 · THE FOLIO RAIL
   --------------------------------------------------------------------------
   The Figma Make exploration supplied one useful structural idea: persistent
   navigation at the left edge. The exploration's visual system is not
   imported. The top bar switches products; this rail shows the real workflow
   inside the current product, using Conxfolio's existing visual system.

   Public home: unchanged. Mobile/tablet: unchanged. Context panels: unchanged.
   At desktop widths the repeated top product switcher steps aside and this one
   rail becomes the product-level navigation.
   ========================================================================== */

body.folio-v5 {
  --s4-nav-w: 216px;
}

.folio-v5 .studio-product-nav[hidden] { display: none !important; }

@media (min-width: 1180px) {
  body.folio-v5.has-studio-product-nav {
    --s3-gutter: var(--cx-s6);
  }

  body.folio-v5.has-studio-product-nav .studio-product-nav {
    position: fixed;
    z-index: 24;
    top: var(--s1-bar-h);
    bottom: 0;
    left: 0;
    width: var(--s4-nav-w);
    display: flex;
    flex-direction: column;
    background: var(--cx-porcelain);
    border-right: 1px solid var(--cx-line);
  }

  body.folio-v5.has-studio-product-nav > #main {
    width: calc(100% - var(--s4-nav-w));
    margin-left: var(--s4-nav-w);
  }

  .folio-v5 .studio-product-nav nav {
    display: flex;
    flex-direction: column;
    padding: var(--cx-s3) 0;
  }

  .folio-v5 .studio-product-nav-home {
    min-height: 72px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--cx-s3) var(--cx-s5);
    color: var(--cx-ink);
    text-decoration: none;
    border-bottom: 1px solid var(--cx-line);
  }

  .folio-v5 .studio-product-nav-home b { font: 500 14px/1.2 var(--cx-font-ui); }
  .folio-v5 .studio-product-nav-home small { margin-top: 5px; color: var(--cx-ink60); font: 400 11px/1.2 var(--cx-font-ui); }
  .folio-v5 .studio-product-nav-home:hover,
  .folio-v5 .studio-product-nav-home.on { background: var(--cx-mist); }

  .folio-v5 .tool-workflow-nav {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .folio-v5 .studio-product-nav-label {
    display: block;
    padding: var(--cx-s6) var(--cx-s5) var(--cx-s3);
    color: var(--cx-ink60);
    font: 500 10px/1 var(--cx-font-mono);
    letter-spacing: .1em;
    text-transform: uppercase;
  }

  .folio-v5 .tool-workflow-nav nav {
    min-height: 0;
    flex: 1 1 auto;
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }
  .folio-v5 .tool-workflow-nav nav::-webkit-scrollbar { display: none; }

  .folio-v5 .tool-workflow-step {
    position: relative;
    width: 100%;
    min-height: 82px;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    column-gap: var(--cx-s2);
    padding: var(--cx-s3) var(--cx-s5);
    color: var(--cx-ink60);
    text-align: left;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--cx-line);
    border-radius: 0;
    text-decoration: none;
  }

  .folio-v5 .tool-workflow-step::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    background: transparent;
  }

  .folio-v5 .tool-workflow-step > i {
    width: 10px;
    height: 10px;
    border: 1px solid var(--cx-ink60);
    border-radius: 50%;
  }

  .folio-v5 .tool-workflow-step > span { display: flex; flex-direction: column; gap: 5px; }
  .folio-v5 .tool-workflow-step b { color: inherit; font: 500 14px/1.2 var(--cx-font-ui); }
  .folio-v5 .tool-workflow-step small { color: var(--cx-ink60); font: 400 11px/1.25 var(--cx-font-ui); }

  .folio-v5 .tool-workflow-step:not(.disabled):hover { color: var(--cx-ink); background: var(--cx-paper); }
  .folio-v5 button.tool-workflow-step:disabled,
  .folio-v5 .tool-workflow-step.disabled { cursor: default; opacity: 1; }

  .folio-v5 .tool-workflow-step.on { color: var(--cx-ink); background: var(--cx-mist); }
  .folio-v5 .tool-workflow-step.on::before { background: var(--cx-ink); }
  .folio-v5 .tool-workflow-step.on > i { background: var(--cx-ink); border-color: var(--cx-ink); }
  .folio-v5 .tool-workflow-step.done > i { border-color: var(--cx-ok-fg); background: var(--cx-ok-fg); }
  .folio-v5 .tool-workflow-step.done > i::before { content: "✓"; display: block; color: var(--cx-paper); font: 500 8px/9px var(--cx-font-ui); text-align: center; }

  .folio-v5 .studio-product-nav-foot {
    margin-top: auto;
    padding: var(--cx-s5);
    border-top: 1px solid var(--cx-line);
  }

  .folio-v5 .studio-product-nav-foot p {
    margin: 0;
    color: var(--cx-ink60);
    font: 400 11px/1.5 var(--cx-font-ui);
  }

  .folio-v5 .tool-workflow-status { display: flex; flex-direction: column; gap: var(--cx-s2); }
  .folio-v5 .tool-workflow-status > span { display: flex; align-items: center; gap: var(--cx-s2); color: var(--cx-ink60); }
  .folio-v5 .tool-workflow-status > span i { width: 8px; height: 8px; border-radius: 50%; background: var(--cx-line); }
  .folio-v5 .tool-workflow-status[data-status="progress"] > span i { background: var(--cx-ask-fg); }
  .folio-v5 .tool-workflow-status[data-status="ready"] > span i { background: var(--cx-ok-fg); }
  .folio-v5 .tool-workflow-status > span b { font: 500 12px/1.2 var(--cx-font-ui); }
  .folio-v5 .tool-workflow-status > small { color: var(--cx-ink60); font: 400 11px/1.45 var(--cx-font-ui); }

  body.folio-v5.has-studio-product-nav .cxm-manage .v5-rail { display: none; }
  body.folio-v5.has-studio-product-nav .cxm-manage .v5-frame { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1179px) {
  body.folio-v5 .studio-product-nav { display: none !important; }
  body.folio-v5.has-studio-product-nav > #main { width: auto; margin-left: 0; }
}
