/* One permanent controls row; page headings retain their original module scope.
   Studio's section buttons use 48px. Hiding Back must not remove its slot. */
html body.section-return-layout:not(.auth-mode) #top {
 --header-action:48px; --header-field-height:48px;
 display:flex!important;flex-wrap:nowrap!important;align-items:center;
 height:64px!important;min-height:64px!important;max-height:64px;
 box-sizing:border-box;gap:8px;padding:8px 0;margin-bottom:0!important;
}
html body.section-return-layout #top::before { display:none; }
html body.section-return-layout #top > #section-return {
 display:flex!important;align-items:center;flex:1 1 0;min-width:44px;
 height:48px;min-height:48px;max-height:48px;margin:0;padding:0;
}
html body.section-return-layout #top > #section-return[hidden] {
 visibility:hidden;pointer-events:none;
}
html body.section-return-layout #top > #section-return button {
 display:inline-flex;align-items:center;gap:10px;width:100%;max-width:100%;
 height:48px;min-height:48px;max-height:48px;padding:4px 0;
 border:0;border-radius:6px;background:transparent;box-shadow:none;
 color:var(--muted,#71839b);font:inherit;font-size:14px;font-weight:400;
 text-align:left;line-height:1.35;white-space:nowrap;cursor:pointer;
}
html body.section-return-layout #section-return button svg { width:24px;height:24px;flex:none; }
html body.section-return-layout #section-return button span {
 min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;
}
html body.section-return-layout #section-return button:hover { color:var(--blue,#087cfa); }
html body.section-return-layout #section-return button:focus-visible {
 outline:2px solid var(--blue,#087cfa);outline-offset:2px;
}
html body.section-return-layout #top > :is(#country,.header-organization) {
 position:static;transform:none;translate:none!important;
 flex:0 0 clamp(140px,18vw,240px);width:clamp(140px,18vw,240px);
 min-width:0;max-width:35%;margin:0!important;align-self:center;
 height:48px!important;min-height:48px!important;max-height:48px!important;
 box-sizing:border-box;
}
html body.section-return-layout #top > :is(#notifications,#refresh,#fullscreen,#profile) {
 flex:0 0 48px;width:48px!important;min-width:48px!important;max-width:48px;
 height:48px!important;min-height:48px!important;max-height:48px;
 box-sizing:border-box;align-self:center;margin-block:0;translate:none!important;
}
html body.section-return-layout #top > #profile { padding:0;object-fit:cover; }
/* Production keeps its real search form. Share the controls row instead of
   inheriting the older compositor's unconditional full-width search lane. */
html body.section-return-layout #top > #searchform:not([hidden]) {
 order:0;flex:1 1 160px;width:auto;min-width:100px;max-width:none;margin:0;
 height:48px;min-height:48px;max-height:48px;
 position:static;transform:none;translate:none;align-self:center;
}
@media (max-width:700px) {
 html body.section-return-layout #top:has(> #searchform:not([hidden])) {
  flex-wrap:wrap!important;height:auto!important;max-height:none;
 }
 html body.section-return-layout #top > #searchform:not([hidden]) {
  order:3;flex:1 0 100%;width:100%;min-width:0;
 }
}
/* Keep the existing heading node and its delegated actions. The first heading
   row starts below the controls both on direct entry and after a return. */
html body.section-return-layout:not(.auth-mode) #content .alp-top-heading {
 position:static!important;inset:auto!important;width:100%!important;max-width:100%!important;
 min-height:36px!important;height:auto!important;max-height:none!important;
 margin:0!important;padding:0!important;flex-wrap:wrap!important;
}
/* DEMO v196: 36px title row, 44px when it includes actions, then the existing
   shared 8px content gap. Do not add a second margin below the title. */
html body.section-return-layout #content .alp-top-heading .page-heading { min-height:36px!important; }
html body.section-return-layout #content .alp-top-heading:has(.erp-title-create,.erp-create-menu,.acc-heading-actions > :is(button,a,[role=button])),
html body.section-return-layout #content .alp-top-heading .page-heading:has(>.erp-title-create,>.erp-create-menu) {
 min-height:44px!important;
}
html body.section-return-layout #content .alp-top-heading h1,
html body.section-return-layout #content h1.alp-top-heading {
 line-height:1.15!important;min-height:0;white-space:nowrap;
}
html body.section-return-layout #content h1.alp-top-heading { display:flex!important;align-items:center!important;min-height:36px!important; }
html body.section-return-layout #content .alp-top-heading :is(button,a,[role=button]) { translate:none!important; }
/* Keep ordinary title actions beside the heading instead of reserving an
   unconditional second row for every journal on tablets and Desktop. */
html body.section-return-layout #content .alp-top-heading > .page-heading {
 flex:1 1 auto!important;width:auto!important;min-width:0;max-width:100%;
}
html body.section-return-layout #content .alp-top-heading .acc-heading-actions {
 flex:0 1 auto!important;min-width:0;max-width:100%;margin:0!important;
 align-self:center;justify-content:flex-end;
}
html body.section-return-layout #content .alp-top-heading h1 { min-width:0;overflow:hidden;text-overflow:ellipsis; }
html body.section-return-layout #content .push-page-heading { margin:0;gap:8px;min-width:0;max-width:100%; }
html body.section-return-layout #content .push-page-heading > .alp-top-heading { flex:1 1 auto;width:auto!important;min-width:0; }
/* Async journals use a normal-flow .iam-page instead of the shell's flex gap. */
html body.section-return-layout #content :is(.iam-page,.pay-page) > .alp-top-heading + .page-main-toolbar { margin-top:8px!important; }
html body.section-return-layout #content .pay-page { margin:0;max-width:100%; }
/* Shared primary context: the approved tenant/month caption-value geometry.
   Values and calendar/date handlers remain owned by their original module. */
html body.section-return-layout #content .page-main-toolbar {
 --page-context-width:var(--filter-control-width);
}
html body.section-return-layout #content .page-main-toolbar:has(> .page-context > .date-range) {
 --page-context-width:var(--filter-period-width);
}
html body.section-return-layout #content .page-main-toolbar > .page-context {
 align-items:stretch;gap:8px;
}
html body.section-return-layout #content .page-main-toolbar > .page-context > .page-context-field {
 display:flex;flex:0 0 auto;flex-direction:column;align-items:stretch;justify-content:center;
 width:var(--page-context-width)!important;min-width:0;max-width:100%;margin:0!important;
 height:auto!important;min-height:var(--filter-control-height)!important;max-height:none!important;
 padding:calc(7 * var(--u)) calc(13 * var(--u))!important;gap:3px!important;
 border:1px solid var(--line);border-radius:10px;background:#fff;box-sizing:border-box;
 text-align:left;font:inherit;font-weight:400;line-height:1.3!important;
}
html body.section-return-layout #content .page-main-toolbar > .page-context > .page-context-field > :is(small,label) {
 display:block!important;margin:0;padding:0;font-size:.8rem;font-weight:400;line-height:1.3;color:var(--muted);
}
html body.section-return-layout #content .page-main-toolbar > .page-context > .page-context-field > :is(span,button,input) {
 flex:0 0 auto;min-width:0;width:100%;margin:0;line-height:1.4;
 white-space:nowrap;
}
html body.section-return-layout #content .page-main-toolbar > .page-context > .page-context-field > button,
html body.section-return-layout #content .page-main-toolbar > .page-context > .page-context-field > input {
 min-height:0;height:1.4em;padding:0;border:0;border-radius:0;background:transparent;
 font:inherit;line-height:1.4;text-align:left;
}
html body.section-return-layout #content .page-context-field > span { display:flex;align-items:center;gap:8px; }
html body.section-return-layout #content .page-context-field :is(.filter-value,.calendar-value) {
 overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;
}
html body.section-return-layout #content .page-context-field svg { width:20px;height:20px;flex:none; }
html body.section-return-layout #content .page-context-field > .page-context-value { overflow:hidden;text-overflow:ellipsis; }
/* Keep the quick-button lane exactly 40px tall, including when it scrolls. */
html body.section-return-layout #content .page-main-toolbar > .page-primary-tabs {
 height:40px;min-height:40px;scrollbar-width:none;
}
html body.section-return-layout #content .page-main-toolbar > .page-primary-tabs::-webkit-scrollbar { display:none; }
html body.section-return-layout #content .page-main-toolbar > .page-primary-tabs > button { height:40px;min-height:40px; }
/* Empty legacy filter shells must not retain their former layout row. */
html body.section-return-layout #content .page-context > .utilities-context-filters { margin:0; }
@media (min-width:701px) {
 html[data-calendar-demo="257"] body.section-return-layout #content .page-main-toolbar:has(.calendar-standard-field):not(:has(> .page-context > .date-range)) {
  --page-context-width:clamp(180px,18vw,250px);
 }
 html body.section-return-layout #content .page-main-toolbar:not(.page-toolbar-context-only) > .page-context {
  position:relative;z-index:21;translate:0 calc((40px - 100%)/2);
 }
}
@media (max-width:700px) {
 html body.section-return-layout #content .page-main-toolbar > .page-context { flex-wrap:wrap; }
 html body.section-return-layout #content .page-main-toolbar > .page-context > .page-context-field {
  flex:1 0 100%;width:100%!important;
 }
}
/* Small phones retain the same Back slot while the context field gets its own
   row. iPad and desktop keep all controls on the single top row. */
@media (max-width:480px) {
 html body.section-return-layout:not(.auth-mode) #top {
  flex-wrap:wrap!important;height:auto!important;max-height:none;gap:6px;
 }
 html body.section-return-layout #top > #section-return { flex:1 1 0;order:0; }
 html body.section-return-layout #top > :is(#notifications,#refresh,#profile) { order:1; }
 html body.section-return-layout #top > :is(#country,.header-organization) {
  order:2;flex:1 0 100%;width:100%;max-width:100%;
 }
}
@media print { html body.section-return-layout #top > #section-return { display:none!important; } }
