/* Unified (option D): layout only. Looks come from DS tokens and classes and from the Phase 1 copies in p1/css. Loaded last. */

/* no ring on programmatic heading focus after a route change (Phase 1 moves focus to the heading without painting one) */
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible, [data-focus]:focus, [data-focus]:focus-visible, .st__title:focus, .st__title:focus-visible, .fx__t:focus, .pre__t:focus { outline: none; }

/* shell: Phase 1 main.rs + crumb; the view fills the rest */
main.rs.pgm { margin: 32px 0 0 160px; display: flex; flex-direction: column; min-height: calc(100vh - 32px); background: var(--surface-overlay-0); }
@media (max-width: 782px) { main.rs.pgm { margin-left: 0; } }
.view { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.view.rs-body { display: block; padding-bottom: 96px; }
.ds-tab.menu .cspin.nav-spin { margin-right: 6px; vertical-align: -3px; }
.rs-crumb a[data-inert] { cursor: pointer; }

/* hub: first run (setup guide) */
.hub { width: 100%; max-width: none; margin: 0; padding: 0; display: grid; gap: 24px; }
.hub--first { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.gd { padding: 24px; display: grid; gap: 0; }
.gd__h { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.gd__t { font: var(--heading-md); } .gd__s { font: var(--body-md); color: var(--type-secondary); margin-top: 2px; }
.gd__bar { width: 220px; max-width: 100%; height: 6px; border-radius: var(--radius-full); background: var(--surface-overlay-2); overflow: hidden; }
.gd__bar i { display: block; height: 100%; border-radius: inherit; background: var(--action-success); transition: width var(--m-slow) var(--m-ease); }
.gd__nba { display: flex; align-items: center; gap: 12px; margin: 20px 0 8px; padding: 16px; border: 1px solid var(--stroke-tertiary); border-radius: var(--radius-8); background: var(--surface-overlay-0); }
.gd__nba .icotile { --icotile-size: 36px; flex: none; }
.gd__nt { flex: 1; min-width: 0; display: grid; gap: 2px; } .gd__nt b { font-weight: 500; } .gd__nt span:last-child { font: var(--body-sm); color: var(--type-secondary); }
.gd__k { font: var(--btn-sm); color: var(--brand-300); }
.gd__l { list-style: none; display: grid; }
.gd__i { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--stroke-tertiary); }
.gd__i:first-child { border-top: 0; }
.gd__x { flex: 1; min-width: 0; display: grid; gap: 2px; } .gd__x b { font-weight: 500; } .gd__x span { font: var(--body-sm); color: var(--type-secondary); }
.gd__i.is-done .gd__x b { color: var(--type-secondary); }
.gd__ok { font: var(--body-sm); color: var(--type-success); }
.stepnum .fa { font-size: 10px; }
.lp { padding: 20px; display: grid; gap: 12px; align-content: start; }
.lp__t { font: var(--heading-sm); } .lp__l { list-style: none; display: grid; gap: 4px; }
.lp__l li { display: grid; grid-template-columns: 36px 1fr; gap: 4px 12px; align-items: center; }
.lp__l li > span:nth-child(2) { display: grid; } .lp__l small { font: var(--body-sm); color: var(--type-secondary); }
.lp__l .icotile { --icotile-size: 32px; }
.lp__a { grid-column: 1; display: grid; place-items: center; width: 32px; height: 16px; color: var(--type-tertiary); }
.lp__f { font: var(--body-sm); color: var(--type-secondary); }
/* hub: live */
.hub__cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.fc { padding: 24px; display: grid; gap: 16px; align-content: start; }
.fc__h { display: flex; align-items: center; gap: 12px; } .fc__h .icotile { --icotile-size: 40px; flex: none; }
.fc__t { font: var(--heading-md); margin-right: auto; }
.fc__l { list-style: none; display: grid; gap: 6px; font: var(--body-md); color: var(--type-secondary); }
.fc__l li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .fc__l li:first-child { color: var(--type-primary); }
.fc__bar { width: 100%; }
.fc__a { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hub__below { gap: 24px; }
.nba { padding: 24px; }
.hub .btn-wp, .hub .btn-wpo { justify-self: start; }
@media (max-width: 1099px) { .hub--first { grid-template-columns: 1fr; } .hub__below { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .hub__cards { grid-template-columns: 1fr; } .gd__nba { flex-wrap: wrap; } .gd__i { flex-wrap: wrap; } .gd__i > a { margin-left: 36px; } .gd__bar { width: 100%; } }

/* manage pages */
.mg-page .mg { width: 100%; max-width: none; margin: 0; padding: 0; gap: 24px; }
.mg-page .sr1-stat { margin-bottom: 24px; }
.sr1-stat__main .chip { flex: none; }
.lrows { list-style: none; display: grid; }
.lrow { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: 4px 16px; align-items: center; padding: 16px 0; border-top: 1px solid var(--stroke-tertiary); }
.lrow:first-child { border-top: 0; padding-top: 0; }
.lrow__av { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--radius-full); background: var(--brand-10); color: var(--brand-300); font: var(--btn-sm); }
.lrow__t { display: grid; gap: 2px; min-width: 0; } .lrow__t b { font-weight: 500; }
.lrow__q { font: var(--body-md); color: var(--type-primary); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lrow__m { font: var(--body-sm); color: var(--type-secondary); }
.lrow__s, .lrow__a { display: flex; align-items: center; gap: 8px; }
.st-pw { display: inline-block; position: relative; }
.st-pw .rs-chipbtn .fa { margin-left: 6px; font-size: 10px; }
.st-pw .fmenu { right: auto; left: 0; min-width: 200px; z-index: 40; }
@media (max-width: 760px) { .lrow { grid-template-columns: 40px minmax(0, 1fr); } .lrow__s, .lrow__a { grid-column: 2; } }
.mg-page .mg__g { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
@media (max-width: 1099px) { .mg-page .mg__g { grid-template-columns: 1fr; } }
.sum-page .sum { max-width: 860px; padding: 8px 24px 24px; }
.sum__l { list-style: none; display: grid; }
.sum__l li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 0; border-top: 1px solid var(--stroke-tertiary); } .sum__l li:first-child { border-top: 0; }
.sum__l .icotile { --icotile-size: 36px; }
.sum__t { display: grid; gap: 2px; min-width: 0; } .sum__t b { font-weight: 500; } .sum__t span { color: var(--type-secondary); }
.sum__f { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid var(--stroke-tertiary); }
.sum__n { font: var(--body-sm); color: var(--type-secondary); } .sum__a { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 600px) { .sum__l li { grid-template-columns: 36px minmax(0, 1fr); } .sum__l li .lnk-wp { grid-column: 2; justify-self: start; } .sum__a { width: 100%; } .sum__a .btn-wp, .sum__a .btn-wpo { flex: 1; justify-content: center; } }

/* Settings page */
.set-page { padding: 0; display: flex; flex-direction: column; }
.set-page .set-body { flex: 1; padding: 32px max(40px, calc((100% - 1500px) / 2)) 32px; width: 100%; }
.set-page .set-foot { padding-inline: max(40px, calc((100% - 1500px) / 2)); }
@media (max-width: 782px) { .set-page .set-body, .set-page .set-foot { padding-inline: 16px; } }
.set-g { display: grid; gap: 12px; padding: 20px 0; border-top: 1px solid var(--stroke-tertiary); } .set-g:first-child { border-top: 0; padding-top: 0; }
.set-g__t { font: var(--heading-sm); } .set-g__d { font: var(--body-sm); color: var(--type-secondary); margin-top: -8px; }
.aiset { display: grid; gap: 4px; }
.aiset__l { padding-top: 12px; } .aiset__l .lnk-wp { display: inline-flex; align-items: center; gap: 6px; }
.aiset__p, .aiset__n { font: var(--body-md); color: var(--type-secondary); }
.aiset__a { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.may__b { display: grid; gap: 8px; margin-bottom: 16px; } .may__bt { font: var(--heading-sm); } .may__h { font: var(--heading-xs); }
.set-page .set-g .field-label { font: var(--body-md); }
.set-sec__c .rs { max-width: 720px; }
.set-sec__c .trgs, .set-sec__c .pgs, .set-sec__c .two, .set-sec__c .f { max-width: 720px; }

/* Studio shell inside the Phase 1 frame */
.st__bar { background: var(--surface-screen); }
.view.st-page { padding: 0; }
.st__stage { min-height: 600px; }

/* Studio: below 1100 the inspector is a full-width panel UNDER a shorter canvas that stays in view while the panel scrolls */
@media (max-width: 1099px) {
  .st__stage { display: flex; flex-direction: column; min-height: 0; overflow: visible; background: var(--surface-overlay-0); }
  .cv { position: sticky; top: 92px; z-index: 6; flex: none; height: clamp(250px, 34vh, 340px); background-color: var(--neutral-50); background-image: radial-gradient(var(--neutral-100) 1px, transparent 1.4px); background-size: 22px 22px; border-bottom: 1px solid var(--stroke-tertiary); box-shadow: var(--shadow-card); }
  .cv__area { padding: 16px 16px 64px; }
  .cv__tools { bottom: 10px; }
  .insp { position: relative; inset: auto; width: auto; margin: 16px 16px 24px; max-height: none; overflow: visible; z-index: 3; }
  .insp__hd { padding-top: 16px; }
  .insp__bd { overflow: visible; }
  .insp__ft { position: sticky; bottom: 0; background: var(--surface-screen); z-index: 5; }
  /* steps whose canvas is a content page (site map, result frames) grow to their content and are not pinned: nothing overprints the page bar or the toolbar */
  .st[data-step="where"] .cv, .st[data-step="after"] .cv { position: relative; top: auto; height: auto; min-height: 0; box-shadow: none; }
  .st[data-step="where"] .cv__area, .st[data-step="after"] .cv__area { position: relative; inset: auto; padding: 20px 16px 72px; }
  .st[data-step="where"] .cv__body, .st[data-step="after"] .cv__body { height: auto; }
  .smap, .fr { height: auto; }
  .smap { align-content: start; max-width: none; }
}
@media (min-width: 1100px) {
  .smap { max-width: 900px; } .smap__g { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}
/* the page title of the site map never overprints the page bar: the canvas pads its stage */
.st[data-step="where"] .cv__area { padding-top: 24px; }
.st[data-step="where"] .cv__body, .st[data-step="after"] .cv__body { overflow-y: auto; }
/* 390: a bottom sheet at 60% height, a handle, and a Settings | Preview toggle */
.insp__pv { display: none; }
@media (max-width: 600px) {
  .cv { top: 46px; height: auto; min-height: 0; flex: 1; position: relative; }
  .st__stage { min-height: calc(100svh - 150px); padding-bottom: 0; }
  .insp { position: fixed; left: 0; right: 0; bottom: 0; top: auto; margin: 0; width: auto; height: 60svh; max-height: 60svh; border-radius: var(--radius-16) var(--radius-16) 0 0; transform: translateY(calc(100% - 132px)); z-index: 60; overflow: hidden; display: flex; }
  .insp.is-open { transform: none; }
  .insp__pv { display: flex; justify-content: center; padding: 0 16px 8px; flex: none; }
  .insp__pv .ds-seg { width: 100%; } .insp__pv .ds-seg > label { flex: 1; } .insp__pv .seg-in { justify-content: center; }
  .st[data-step="where"] .cv, .st[data-step="after"] .cv { position: relative; }
  .st[data-step="where"] .cv__area, .st[data-step="after"] .cv__area { padding-bottom: 150px; }
  body.sheet-open .cv { opacity: 1; }
}

.ds-ctxwrap { position: relative; }
.rs-head__acts .ds-ctxwrap .fmenu { right: 0; left: auto; }
.ds-ctxwrap > .fmenu { left: auto; right: 0; } .st-pw > .fmenu { left: 0; right: auto; }
.set-list, .set-sec, .set-sec__body, .set-sec__in, .set-sec__c, .aiset, .set-g { min-width: 0; } .set-sec__body { grid-template-columns: minmax(0, 1fr); } @media (max-width: 600px) { .set-sec__c .r { flex-wrap: wrap; } .set-sec__c .r__c { flex: 1 1 100%; } .set-sec__c .r__c .ds-select { width: 100%; } .set-sec { padding-inline: 15px; } .set-sec__head { gap: 12px; } .set-sec__head .icotile { --icotile-size: 36px; } }
.set-g, .aiset { grid-template-columns: minmax(0, 1fr); } .trg { flex-wrap: wrap; }
@media (max-width: 600px) { .set-sec__c .trg:has(.inp) { flex-wrap: wrap; } .set-sec__c .trg__u, .set-sec__c .trg:has(.inp) .k { white-space: normal; } }
.fc__l li { display: block; } .fc__l li.fc__run { display: flex; }

/* ===== Batch 2: the curator in the Phase 1 shell (layout only) ===== */
/* 390: the crumb stays on one line; the middle crumbs shorten with an ellipsis */
@media (max-width: 600px) {
  .rs-crumb { flex-wrap: nowrap; overflow: hidden; }
  .rs-crumb .fa { flex: none; }
  .rs-crumb > a { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rs-crumb > a:first-child { flex: none; }
  .rs-crumb > [aria-current] { flex: none; white-space: nowrap; }
}
/* Focus-flow setup: header and bars take the 1500 gutters, the footer is pinned to the viewport bottom */
.view.cur-fx-page { padding: 0; }
.cx { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cx__g { padding-inline: max(40px, calc((100% - 1500px) / 2)); }
.cur-fx-page .cx__g .rs-head { margin: 0; padding: 24px 0 16px; min-height: 0; }
.cur-fx-page .fx__top { padding-block: 12px; }
.fx__in { padding-top: 8px; }
#fx-foot { position: sticky; bottom: 0; z-index: 20; margin-top: auto; }
.fx__fi { width: min(680px, 100% - 32px); }
@media (max-width: 782px) { .cx__g { padding-inline: 16px; } }
/* run: the stage fills the 1500 shell */
.cur-run-page .run { max-width: none; margin: 0; padding: 8px 0 0; }
.cur-run-page .run__f { flex-wrap: wrap; }
.pre-page .pre { padding-top: 24px; }
/* results: status card, Review | Pages, mode toggle */
.cur-res-page .sr1-stat { margin-bottom: 4px; }
.cu-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 20px 0 16px; }
.cur-res-page .cbs { margin: 12px 0 0; }
/* DS-GAP: grey counts in .ds-seg (the DS count turns into the orange bubble when active) */
.cu-seg .ds-count, .cu-seg > label.active .ds-count, .cu-seg > label:has(input:checked) .ds-count, .cu-list .ds-seg .ds-count, .cu-list .ds-seg > label.active .ds-count, .cu-list .ds-seg > label:has(input:checked) .ds-count { background: var(--surface-overlay-2); color: var(--type-secondary); }
.cu-nudge { margin: 0 0 16px; align-items: center; } .cu-nudge > span { flex: 1; min-width: 0; } .cu-nudge .btn-wp { flex: none; }
.rc__b { min-width: 0; }
.cu-list { margin-bottom: 0; }
.cu-list .dash-row .av { flex: none; }
.cu-list .dash-tags__in { display: flex; flex-wrap: wrap; gap: 6px; }
.cu-list .rs-tools .ds-select { min-width: 150px; }
.fmenu--up { top: auto; bottom: calc(100% + 4px); }
.rs-bulk .ds-ctxwrap { display: inline-block; }
.cu-empty { padding: 24px 16px; }
.cu--m { display: none; }
@media (max-width: 700px) { .cu--m { display: grid; } .tri__lb .cu--m { padding: 24px 16px; } }
/* Pages: sets list, shortcode row on the board */
.pbc__sc { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pbc__ed { margin-left: auto; align-self: center; }
.cu-sets .rs-sl__m { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cu-sets .rs-sl__nr .path { flex: none; }
.cu-sets { margin-bottom: 8px; }
.pb__gh { margin-top: 32px; }
.ais-sheet__h h2 { font: var(--heading-sm); }
.dr__sub + .pbc__sc { margin-top: 4px; }
/* Settings: the AI curator card */
.cu-set { display: grid; gap: 0; min-width: 0; }
.cu-set .set-g { padding-block: 20px; }
.cu-set .stls { gap: 12px; } .cu-set .stl { box-shadow: none; }
.cu-set .cbs { margin: 0 0 8px; }
.set-sec__c .r--st { flex-wrap: nowrap; } .set-sec__c .r--st .r__c { flex: none; min-width: 0; }
.cu-set .ds-select { max-width: 100%; }
