/* Shared shell and scoped prototype; existing forms and other content remain intact. */
body.control-plane { background: var(--nb-page); color: var(--nb-text); }
.nb-app-shell { display: grid; grid-template-columns: var(--nb-sidebar-width) minmax(0,1fr); min-height: 100dvh; background: var(--nb-page); }
.nb-app-shell.is-collapsed { grid-template-columns: var(--nb-sidebar-collapsed) minmax(0,1fr); }
.nb-app-main { min-width: 0; margin: 0; }
.nb-app-shell #global-sidebar { position: sticky; top: 0; align-self: start; width: auto; height: 100dvh; min-height: 100dvh; overflow: hidden; background: var(--nb-sidebar); color: var(--nb-sidebar-text); border: 0; box-shadow: none; }
.nb-app-shell .sidebar-header { min-height: 76px; padding: 16px; gap: 8px; border-bottom: 1px solid #39423e; }
.nb-app-shell .sidebar-brand { color: var(--nb-sidebar-text); flex: 1; min-width: 0; text-decoration: none; }
.nb-app-shell #global-sidebar .icon-button { background: transparent; color: var(--nb-sidebar-text); border: 0; }
.nb-sidebar-context { display: grid; gap: 4px; padding: 16px 20px; border-bottom: 1px solid #39423e; overflow-wrap: anywhere; }
.nb-sidebar-context small,.nb-sidebar-context span { color: var(--nb-sidebar-muted); font-size: 12px; }
.nb-app-shell #global-sidebar > .sidebar-nav { padding: 8px 12px; }
.nb-app-shell .nb-nav-group { margin: 8px 0 18px; }
.nb-app-shell #global-sidebar .nb-nav-group{display:flex!important;flex-direction:column!important;flex-wrap:nowrap!important;width:100%;min-width:0;box-sizing:border-box;flex-shrink:0!important;overflow:visible!important}
.nb-app-shell #global-sidebar > .sidebar-nav{display:flex!important;flex-direction:column!important;flex-wrap:nowrap!important;width:100%;min-width:0;box-sizing:border-box}
.nb-app-shell #global-sidebar .nb-nav-link{flex:0 0 auto!important;width:100%;box-sizing:border-box;white-space:normal!important}
.nb-app-shell #global-sidebar .nb-nav-link>span{white-space:normal!important;overflow-wrap:anywhere}
.nb-app-shell .sidebar-group-label { color: var(--nb-sidebar-muted); font-size: 11px; letter-spacing: 0; padding: 8px 12px; margin: 0; }
.nb-app-shell #global-sidebar .nb-nav-link { display: flex; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 42px; padding: 10px 12px; margin: 2px 0; border-radius: var(--nb-radius-md); color: var(--nb-sidebar-text); border: 0; background: transparent; text-decoration: none; font-size: 13px; font-weight: 400; box-shadow: none; }
.nb-app-shell #global-sidebar .nb-nav-link .nav-icon { order: 0; color: currentColor; opacity: .85; }
.nb-app-shell #global-sidebar .nb-nav-link:hover { background: var(--nb-sidebar-hover); }
.nb-app-shell #global-sidebar .nb-nav-link[aria-current=page] { background: var(--nb-sidebar-active); color: white; font-weight: 600; box-shadow: inset -3px 0 0 #71bb8e; }
[dir=ltr].nb-app-shell #global-sidebar .nb-nav-link[aria-current=page] { box-shadow: inset 3px 0 0 #71bb8e; }
.nb-app-shell .sidebar-footer { margin-top: auto; border-top: 1px solid #39423e; padding: 16px; color: var(--nb-sidebar-muted); }

.nb-app-shell.is-collapsed .nb-nav-link span, .nb-app-shell.is-collapsed .sidebar-group-label, .nb-app-shell.is-collapsed .nb-sidebar-context, .nb-app-shell.is-collapsed .sidebar-footer-copy{ display: none; }
.nb-app-shell.is-collapsed .nb-nav-link { justify-content: center!important; padding: 12px!important; }
.nb-app-shell.is-collapsed .sidebar-header { flex-wrap: wrap; justify-content: center; padding: 12px 8px; }
.nb-app-shell.is-collapsed .sidebar-brand { flex: none; }
.nb-topbar { position: sticky; top: 0; min-height: 64px; padding-inline: 24px; background: var(--nb-surface); border-bottom: 1px solid var(--nb-border); box-shadow: none; }
.nb-page-content { width: 100%; max-width: 1440px; margin-inline: auto; padding: 24px 32px; }
.nb-skip-link { position: fixed; z-index: 2000; top: -100px; inset-inline-start: 20px; padding: 12px; background: white; color: var(--nb-text); }
.nb-skip-link:focus { top: 12px; }
.nb-prototype { display: grid; gap: 24px; min-width: 0; }
.nb-prototype > .local-nav { margin: 0; padding: 0; background: transparent; border: 0; }
.nb-prototype > .ux-page-header { margin: 0; padding-block: 8px; }
.nb-prototype :is(.card,.meta-section,.dashboard-surface,.ux-panel,.setup-advanced) { background: var(--nb-surface); border: 1px solid var(--nb-border); box-shadow: var(--nb-shadow-card); border-radius: var(--nb-radius-lg); }
.nb-prototype :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { background: white; color: var(--nb-text); border-color: var(--nb-border); }
.nb-prototype h1 { font-size: clamp(24px,3vw,30px); color: var(--nb-text); }
.nb-prototype .company-avatar { background: var(--nb-surface-muted); color: var(--nb-text); }
.nb-setup-progress { padding: 24px; background: white; border: 1px solid var(--nb-border); border-radius: var(--nb-radius-lg); min-width: 0; }
.nb-setup-progress__header { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.nb-setup-progress h2,.nb-action-panel h2 { font-size: 20px; margin: 4px 0 8px; }
.nb-eyebrow { font-size: 11px; font-weight: 600; color: var(--nb-text-muted); margin: 0 0 6px; letter-spacing: .03em; }
.nb-muted,.nb-help { color: var(--nb-text-muted); }
.nb-setup-progress p,.nb-action-panel p { margin: 0 0 8px; }
.nb-setup-steps { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; margin: 20px 0 0; padding: 0; list-style: none; }
.nb-setup-step { min-width: 0; border: 1px solid var(--nb-border); border-radius: var(--nb-radius-md); background: white; color: var(--nb-text-muted); }
.nb-setup-step a { display: block; height: 100%; padding: 12px; color: inherit; text-decoration: none; }
.nb-setup-step strong { font-size: 12px; }
.nb-setup-step small { display: block; padding-top: 8px; font-size: 11px; }
.nb-setup-step[data-status=complete],.nb-setup-step[data-status=active] { color: var(--nb-success); }
.nb-setup-step[aria-current=step] { background: var(--nb-primary-soft); border-color: var(--nb-primary); color: var(--nb-text); }
.nb-setup-step[data-status=blocked] { color: var(--nb-text-muted); }
.nb-step-marker { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-inline-end: 5px; border-radius: 50%; background: var(--nb-surface-muted); }
.nb-action-panel { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 24px; border: 1px solid var(--nb-border); border-inline-start: 3px solid var(--nb-primary); border-radius: var(--nb-radius-lg); background: white; }
.nb-action-panel p { max-width: 72ch; }
.nb-action-links { display: grid; gap: 8px; flex-shrink: 0; }
.nb-button { display: inline-flex; gap: 8px; align-items: center; justify-content: center; min-height: 42px; padding: 10px 16px; border: 1px solid var(--nb-border); border-radius: var(--nb-radius-md); background: white; color: var(--nb-text); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; }
.nb-button--primary { background: var(--nb-primary); color: white; border-color: var(--nb-primary); }
.nb-button--primary:hover { background: var(--nb-primary-hover); color: white; }
.nb-status { display: inline-block; color: var(--nb-text-muted); background: var(--nb-surface-muted); border-radius: var(--nb-radius-sm); padding: 6px 8px; font-size: 11px; }
.nb-secret-field { display: grid; gap: 8px; min-width: 0; }
.nb-field-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.nb-secret-status { font-size: 12px; color: var(--nb-text-muted); }
.nb-secret-field[data-credential-state=saved_verified] .nb-secret-status { color: var(--nb-success); }
.nb-secret-field:is([data-credential-state=expired],[data-credential-state=invalid]) .nb-secret-status { color: var(--nb-error); }
.nb-secret-input-wrap { display: flex; gap: 8px; min-width: 0; }
.nb-secret-input-wrap input { flex: 1; width: 100%; min-width: 0; }
.nb-secret-toggle { padding: 8px 12px; border: 1px solid var(--nb-border); border-radius: var(--nb-radius-md); background: var(--nb-surface-muted); color: var(--nb-text); font: inherit; cursor: pointer; }
.nb-secret-replace { justify-self: start; }
.nb-help { font-size: 12px; margin: 0; }
.nb-app-shell :is(a,button,input,select,textarea,summary):focus-visible { outline: 2px solid var(--nb-primary); outline-offset: 3px; }
.nb-app-shell #global-sidebar :is(a,button):focus-visible { outline-color: #a8d3b7; }
.nb-app-shell .user-menu > summary { anchor-name: --nb-owner-menu; }
.nb-app-shell .user-menu-panel { max-width: calc(100vw - 24px); }
.nb-app-shell .user-menu-panel[popover] { position: fixed; inset: auto; margin: 8px 0; position-anchor: --nb-owner-menu; position-area: bottom span-inline-start; position-try-fallbacks: flip-inline, flip-block; }
.nb-app-shell .user-menu-panel[popover]:not(:popover-open) { display: none; }
.nb-app-shell .user-menu-panel[popover]:popover-open { display: block; }
.nb-app-shell .nb-settings-record { margin-top: 16px; }
.nb-app-shell .nb-settings-record > summary { padding: 12px 0; cursor: pointer; font-weight: 600; }
.nb-app-shell .nb-settings-record form { padding-top: 16px; }
[data-state=loading] { cursor: progress; }
[data-state=error] { border-color: var(--nb-error); }
.nb-prototype [hidden],.nb-secret-field [hidden] { display: none!important; }
.nb-company-overview { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.nb-company-overview article { border: 1px solid var(--nb-border); padding: 20px; border-radius: var(--nb-radius-md); background: white; }
.nb-company-overview h3 { font-size: 16px; }
@media (max-width: 960px) {
  .nb-app-shell,.nb-app-shell.is-collapsed { display: block; }
  .nb-app-shell #global-sidebar { position: fixed; z-index: 1000; top: 0; bottom: 0; inset-inline-start: 0; inset-inline-end: auto; width: min(280px,86vw); transform: translateX(110%); transition: transform 180ms ease; }
  [dir=ltr].nb-app-shell #global-sidebar { transform: translateX(-110%); }
  .sidebar-open .nb-app-shell #global-sidebar { transform: translateX(0); }

.nb-app-shell.is-collapsed .nb-nav-link span, .nb-app-shell.is-collapsed .sidebar-group-label, .nb-app-shell.is-collapsed .nb-sidebar-context{ display: initial; }
  .nb-app-shell.is-collapsed .nb-nav-link { justify-content: start!important; }
  .nb-app-shell #global-sidebar:not(:hover) .brand-copy { opacity: 1; }
  .nb-page-content { padding: 16px; }
  .nb-topbar { padding-inline: 16px; }
  .nb-action-panel { flex-direction: column; align-items: stretch; gap: 12px; }
  .nb-action-links { display: flex; flex-wrap: wrap; }
}
@media (max-width: 720px) {
  .nb-setup-progress { padding: 16px; }
  .nb-setup-progress__header { flex-direction: column; gap: 4px; }
  .nb-setup-steps { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
  .nb-setup-step { flex: 0 0 148px; scroll-snap-align: start; }
  .nb-company-overview { grid-template-columns: minmax(0,1fr); }
  .nb-app-shell .nb-topbar .topbar-link { display: none; }
}
@media (prefers-reduced-motion: reduce) { .nb-app-shell #global-sidebar { transition: none; } }

/* Targeted journey corrections; preserve the Vercel Split foundations. */
.nb-prototype .nb-setup-progress{padding:16px;gap:12px}
.nb-prototype .nb-setup-progress__header p.nb-muted{display:none}
.nb-prototype .nb-action-panel{padding:16px;gap:16px}
.nb-prototype .nb-action-panel h2{font-size:18px}
.nb-prototype .nb-action-panel p,.nb-prototype .nb-help,.nb-prototype .nb-muted{font-size:14px;line-height:1.65}
.nb-prototype .nb-eyebrow,.nb-prototype .nb-status,.nb-prototype .nb-setup-step small{font-size:13px}
.nb-navigation-location{margin:8px 0;font-size:14px}
.nb-stage-review summary{cursor:pointer;font-weight:600;padding:8px 0}
.nb-prototype [aria-current="page"]{font-weight:700;text-decoration:underline;text-underline-offset:6px}
.nb-prototype [id]{scroll-margin-top:20px}

.nb-prototype .ux-note-small{font-size:14px;line-height:1.65}

/* Keep the existing brand/version rails in view; only the link list scrolls. */
.nb-app-shell #global-sidebar > .sidebar-header,
.nb-app-shell #global-sidebar > .nb-sidebar-context,
.nb-app-shell #global-sidebar > .sidebar-footer { flex-shrink: 0!important; }
.nb-app-shell #global-sidebar > .sidebar-nav {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}
.nb-app-shell #global-sidebar > .sidebar-nav::-webkit-scrollbar { width: 6px; }
.nb-app-shell #global-sidebar > .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 99px; }

/* Solid fixed rails; activity context belongs with the version in the footer. */
.nb-app-shell #global-sidebar > .sidebar-header,
.nb-app-shell #global-sidebar > .sidebar-footer { background-color: var(--nb-sidebar); z-index: 1; }
.nb-app-shell #global-sidebar > .sidebar-footer { display: block; }
.nb-app-shell #global-sidebar .sidebar-footer-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nb-app-shell #global-sidebar .sidebar-footer .nb-sidebar-context {
  padding: 0 0 12px; margin: 0 0 12px; max-height: none;
  overflow: visible; gap: 2px; font-size: 13px; line-height: 1.5;
}
.nb-app-shell.is-collapsed #global-sidebar .sidebar-footer-meta { justify-content: center; }
