/* Lịch Việt v16.49 — one frontend frame contract, no DOM wrappers or behavior changes.
 * The visual edge is shared by the app shell, direct standalone page containers,
 * header, breadcrumb and fixed bottom bar. Admin/onboarding/print remain independent.
 * A single outer gutter is owned by the screen frame, NEVER by nested components. */
:root {
  --lv-page-max: 680px;
  --lv-page-gutter: max(10px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --lv-page-width: min(calc(100% - (2 * var(--lv-page-gutter))), var(--lv-page-max));
  --lvg-frame-max: var(--lv-page-max);
  --lvg-frame-gutter: var(--lv-page-gutter);
  --lvg-app-max: var(--lv-page-max);
  --lvg-mobile-gutter: var(--lv-page-gutter);
}
@media (max-width:430px) {
  :root { --lv-page-gutter:max(8px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)); }
}
/* Normalize default BODY margins on old standalone pages (e.g. Quick Access). */
body:not(.lvg-admin):not(.lvg-onboarding-screen) { margin:0; }
/* Read-only shared vault has an inline BODY 15px gutter: remove only that
 * horizontal inset to avoid an extra 30px narrowing the page. */
body:not(.lvg-admin):has(> main.wrap) { padding-inline:0 !important; }
/* All page wrappers take EXACTLY one viewport gutter. Including standalone
 * types avoids silent 640/960px switches when navigating away from /home. */
body:not(.lvg-admin):not(.lvg-onboarding-screen) > :is(
  .app-shell,.shell,.mt-shell,.us-shell,.ak-shell,.sync-shell,.sync-wrap,
  .saved-shell,.lr-wrap,.wrap,.plans-shell,.plans-wrap,.growth-shell,
  .fc-shell,.fe-shell,.pv-shell,.si-shell,.qa-shell,.sea-shell,
  .cd-shell,.easy-home-shell,.family-guest-shell
),
body:not(.lvg-admin):not(.lvg-onboarding-screen) > main:is(
  .app-shell,.shell,.mt-shell,.us-shell,.ak-shell,.sync-shell,.sync-wrap,
  .saved-shell,.lr-wrap,.wrap,.plans-shell,.plans-wrap,.growth-shell,
  .fc-shell,.fe-shell,.pv-shell,.si-shell,.qa-shell,.sea-shell,
  .cd-shell,.easy-home-shell,.family-guest-shell
),
body:not(.lvg-admin):not(.lvg-onboarding-screen) > .app-shell {
  box-sizing:border-box !important;
  inline-size:var(--lv-page-width) !important;
  width:var(--lv-page-width) !important;
  max-inline-size:var(--lv-page-max) !important;
  max-width:var(--lv-page-max) !important;
  min-inline-size:0 !important;
  margin-inline:auto !important;
  padding-inline:0 !important;
}
/* Direct standalone headers and breadcrumbs align with their sibling content.
 * Inside .app-shell they simply occupy 100% of its content box (no double inset). */
body:not(.lvg-admin):not(.lvg-onboarding-screen) > :is(
  .lvg-app-header.site-header,.lvg-screen-back,.lvg-breadcrumb-v139,.lvg-page-context-v136
) {
  box-sizing:border-box !important;
  width:var(--lv-page-width) !important;
  max-width:var(--lv-page-max) !important;
  min-width:0 !important;
  margin-inline:auto !important;
}
/* Shared axis for direct shell chrome AND content. Keep both sets of selectors
 * unchanged: the combined rule has exactly the prior specificity and values. */
body:not(.lvg-admin) .app-shell > :is(
  .lvg-app-header.site-header,.lvg-screen-back,.lvg-breadcrumb-v139,.lvg-page-context-v136
),
body:not(.lvg-admin) .app-shell > :is(
  .finder-main,.prayer-page,.iching-page,.tr-shell,.departure-native-v1202,
  .dashboard-grid,.traditional-grid,.studio-layout,.native-tools-hub,
  .daily-layout,.daily-main-grid,.utility-layout,.lvg-page-context-v136
) {
  box-sizing:border-box !important;
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  margin-inline:0 !important;
}
/* Mobile footer is fixed, but is always centered on the very same screen axis.
 * Original bottom safe-area padding remains owned by ios-pwa-layout-v140. */
body:not(.lvg-admin):not(.lvg-onboarding-screen) nav.mobile-bottom-nav.lvg-bottom-nav {
  box-sizing:border-box !important;
  position:fixed !important;
  left:50% !important;
  right:auto !important;
  transform:translateX(-50%) !important;
  width:var(--lv-page-width) !important;
  max-width:var(--lv-page-max) !important;
  min-width:0 !important;
  padding-inline:var(--lvui-space-2,8px) !important;
}
/* Shrinkable flex/grid descendants prevent intrinsic dates and long words
 * from increasing the viewport width; do not clip tables or fixed dialogs. */
body:not(.lvg-admin) :is(
  .app-shell,.shell,.mt-shell,.us-shell,.ak-shell,.sync-shell,.sync-wrap,
  .saved-shell,.lr-wrap,.plans-shell,.plans-wrap,.growth-shell,.qa-shell,.sea-shell
) :is(.grid,.row,.form-grid,.form-row,.dashboard-grid,.studio-layout) > * {
  min-inline-size:0;
}
body:not(.lvg-admin) :is(.app-shell,.qa-shell,.sea-shell) :is(img,video,iframe) {
  max-inline-size:100%;
}
/* Safe-area handling and bottom scroll clearance are intentionally unchanged. */
@media print {
  body:not(.lvg-admin) > :is(.app-shell,.shell,.qa-shell,.sea-shell),
  body:not(.lvg-admin) > main:is(.app-shell,.shell,.qa-shell,.sea-shell) {
    width:100% !important;
    max-width:none !important;
    padding-inline:0 !important;
  }
  body:not(.lvg-admin) nav.mobile-bottom-nav.lvg-bottom-nav { display:none !important; }
}
