
:root{--haven-shell-h:48px}
html,body{margin:0;min-height:100%;}
body{overflow-x:hidden}
#root{min-height:100vh}
.haven-memory-root{min-height:100vh}
.haven-memory-nav{height:var(--haven-shell-h);box-sizing:border-box;display:flex;align-items:center;gap:18px;padding:0 18px;position:sticky;top:0;z-index:10000;background:rgba(248,247,250,.92);backdrop-filter:blur(16px);border-bottom:1px solid rgba(110,79,154,.13);font-family:Inter,"Noto Sans SC",system-ui,sans-serif}
[data-theme="dark"] .haven-memory-nav{background:rgba(25,24,34,.92);border-bottom-color:rgba(255,255,255,.09)}
.haven-memory-brand{font-weight:650;letter-spacing:.02em;margin-right:8px;color:#4f3b72;white-space:nowrap}
[data-theme="dark"] .haven-memory-brand{color:#c9b9e5}
.haven-memory-tabs{display:flex;gap:4px;min-width:0}
.haven-memory-tab{appearance:none;border:0;background:transparent;padding:7px 11px;border-radius:9px;font:inherit;font-size:13px;color:#746d80;cursor:pointer;white-space:nowrap}
.haven-memory-tab[aria-current="page"]{background:rgba(110,79,154,.11);color:#5e4586;font-weight:650}
[data-theme="dark"] .haven-memory-tab{color:#aaa2b5}[data-theme="dark"] .haven-memory-tab[aria-current="page"]{color:#dacbed;background:rgba(151,120,194,.16)}
.haven-memory-stage{position:relative;min-height:calc(100vh - var(--haven-shell-h));}
.haven-memory-stage>.haven-view-host{min-height:calc(100vh - var(--haven-shell-h));}
/* Original constellation owns a fixed viewport. Keep it below the one persistent shadow nav. */
.haven-memory-root[data-view="galaxy"] .cs-root{inset:var(--haven-shell-h) 0 0 0!important;height:auto!important}
.haven-shadow-badge{margin-left:auto;font-size:11px;color:#958da1;white-space:nowrap}
@media(max-width:640px){.haven-memory-nav{gap:6px;padding:0 8px}.haven-memory-brand{display:none}.haven-memory-tabs{width:100%;justify-content:space-between}.haven-memory-tab{padding:7px 8px}.haven-shadow-badge{display:none}}

/* Galaxy is a native deep-space Folio surface. The persistent Memory nav follows it. */
.haven-memory-root[data-view="galaxy"] .haven-memory-nav{
  background:rgba(14,13,24,.94);border-bottom-color:rgba(236,233,244,.09);color:#ece9f4
}
.haven-memory-root[data-view="galaxy"] .haven-memory-brand{color:#c9b9e5}
.haven-memory-root[data-view="galaxy"] .haven-memory-tab{color:#aaa2b5}
.haven-memory-root[data-view="galaxy"] .haven-memory-tab[aria-current="page"]{color:#ece9f4;background:rgba(167,139,208,.16)}
.haven-memory-root[data-view="galaxy"] .haven-shadow-badge{color:#7a7589}
/* HAVEN_GALAXY_SHELL_DARK_R1_4 */

/* HAVEN_MEMORY_KEEPALIVE_R2 */
.haven-view-keepalive{display:none;min-height:calc(100vh - var(--haven-shell-h))}
.haven-view-keepalive.is-active{display:block}
.haven-view-keepalive[data-keepalive-view="galaxy"]{position:relative;min-height:calc(100vh - var(--haven-shell-h))}
.haven-view-keepalive[data-keepalive-view="galaxy"] .cs-root{inset:var(--haven-shell-h) 0 0 0!important;height:auto!important}
@media(max-width:900px){.haven-shadow-badge{display:none}}

/* HAVEN_FOLIO_DIARY_ROOT_R1 — common desktop Persistent Root */
.haven-client-root{min-height:100vh;background:#f4f2f6}
[data-theme="dark"] .haven-client-root{background:#1b1921}
.haven-client-nav{height:var(--haven-shell-h);box-sizing:border-box;display:flex;align-items:center;gap:12px;padding:0 18px;position:sticky;top:0;z-index:10000;background:rgba(248,247,250,.93);backdrop-filter:blur(16px);border-bottom:1px solid rgba(110,79,154,.13);font-family:Inter,"Noto Sans SC",system-ui,sans-serif;transition:background .16s ease,border-color .16s ease}
[data-theme="dark"] .haven-client-nav{background:rgba(25,24,34,.93);border-bottom-color:rgba(255,255,255,.09)}
.haven-client-brand{appearance:none;border:0;background:transparent;color:#4f3b72;font:italic 650 15px Georgia,"Noto Serif SC",serif;letter-spacing:.01em;padding:5px 7px 5px 0;cursor:pointer;white-space:nowrap}
[data-theme="dark"] .haven-client-brand{color:#c9b9e5}
.haven-area-tabs{display:flex;gap:3px}.haven-area-tab{appearance:none;border:0;background:transparent;color:#887f91;border-radius:8px;padding:6px 9px;font:650 11px Inter,"Noto Sans SC",sans-serif;cursor:pointer}.haven-area-tab.on{color:#5e4586;background:rgba(110,79,154,.09)}[data-theme="dark"] .haven-area-tab{color:#aaa2b5}[data-theme="dark"] .haven-area-tab.on{color:#dacbed;background:rgba(151,120,194,.14)}
.haven-client-divider{width:1px;height:18px;background:rgba(110,79,154,.13);margin:0 1px}.haven-diary-nav-note{color:#aaa2ad;font:500 10px Georgia,"Noto Serif SC",serif;letter-spacing:.06em}
.haven-client-nav.is-galaxy{background:rgba(14,13,24,.94);border-bottom-color:rgba(236,233,244,.09)}.haven-client-nav.is-galaxy .haven-client-brand{color:#c9b9e5}.haven-client-nav.is-galaxy .haven-area-tab{color:#aaa2b5}.haven-client-nav.is-galaxy .haven-area-tab.on{color:#ece9f4;background:rgba(167,139,208,.16)}.haven-client-nav.is-galaxy .haven-memory-tab{color:#aaa2b5}.haven-client-nav.is-galaxy .haven-memory-tab[aria-current="page"]{color:#ece9f4;background:rgba(167,139,208,.16)}.haven-client-nav.is-galaxy .haven-shadow-badge{color:#7a7589}
.haven-client-stage{position:relative;min-height:calc(100vh - var(--haven-shell-h))}.haven-area-keepalive{display:none;min-height:calc(100vh - var(--haven-shell-h))}.haven-area-keepalive.is-active{display:block}
.haven-client-root[data-area="memory"] .haven-memory-stage{min-height:calc(100vh - var(--haven-shell-h))}.haven-client-root[data-area="memory"][data-memory-view="galaxy"] .cs-root{inset:var(--haven-shell-h) 0 0 0!important;height:auto!important}
/* HAVEN_FOLIO_DIARY_ROOT_R1_2_NAV — shared mobile Persistent Root navigation */
.haven-mobile-client-root{--haven-mobile-nav-h:57px;height:100dvh;min-height:100dvh;overflow:hidden;display:flex;flex-direction:column;background:#f7f6f9}
[data-theme="dark"] .haven-mobile-client-root{background:#1c1a22}
.haven-mobile-client-stage{position:relative;flex:1 1 auto;min-height:0;overflow:hidden}
.haven-mobile-area{display:none;position:absolute;inset:0;min-height:0;height:auto;overflow:hidden}.haven-mobile-area.is-active{display:block}
.haven-mobile-bottom-nav{box-sizing:border-box;flex:0 0 auto;height:calc(var(--haven-mobile-nav-h) + env(safe-area-inset-bottom));padding:5px 10px calc(5px + env(safe-area-inset-bottom));display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;background:rgba(248,247,250,.96);backdrop-filter:blur(18px);border-top:1px solid rgba(110,79,154,.13);position:relative;z-index:120;font-family:Inter,"Noto Sans SC",system-ui,sans-serif}
[data-theme="dark"] .haven-mobile-bottom-nav{background:rgba(27,25,33,.96);border-top-color:rgba(255,255,255,.09)}
.haven-mobile-nav-item{appearance:none;border:0;background:transparent;border-radius:13px;color:#91899a;display:flex;align-items:center;justify-content:center;gap:7px;min-width:0;padding:0 10px;font:600 10px/1 Inter,"Noto Sans SC",system-ui,sans-serif}
.haven-mobile-nav-item.is-active{background:rgba(110,79,154,.10);color:#5e4586}
[data-theme="dark"] .haven-mobile-nav-item{color:#9f97aa}[data-theme="dark"] .haven-mobile-nav-item.is-active{background:rgba(151,120,194,.15);color:#dacbed}
.haven-mobile-nav-en{font:italic 600 14px/1 Georgia,"Noto Serif SC",serif}.haven-mobile-nav-item small{font:600 10px/1 Inter,"Noto Sans SC",system-ui,sans-serif;color:inherit;opacity:.76}
.haven-mobile-client-root[data-area="memory"][data-memory-view="galaxy"] .haven-mobile-bottom-nav{background:rgba(14,13,24,.96);border-top-color:rgba(236,233,244,.09)}
.haven-mobile-client-root[data-area="memory"][data-memory-view="galaxy"] .haven-mobile-nav-item{color:#8f899a}.haven-mobile-client-root[data-area="memory"][data-memory-view="galaxy"] .haven-mobile-nav-item.is-active{background:rgba(167,139,208,.16);color:#ece9f4}
@media(max-width:900px){.haven-client-nav .haven-shadow-badge{display:none}}

/* HAVEN_FOLIO_CONSOLE_ROOT_R1_2 — third installed primary area */
.haven-console-tabs{display:flex;align-items:center;gap:2px;min-width:0;overflow-x:auto;scrollbar-width:none}.haven-console-tabs::-webkit-scrollbar{display:none}.haven-console-tab{appearance:none;border:0;background:transparent;padding:6px 8px;border-radius:8px;color:#827a89;font:600 10px/1 Inter,"Noto Sans SC",system-ui,sans-serif;cursor:pointer;white-space:nowrap}.haven-console-tab[aria-current="page"]{background:rgba(110,79,154,.09);color:#5e4586;font-weight:700}[data-theme="dark"] .haven-console-tab{color:#aaa2b5}[data-theme="dark"] .haven-console-tab[aria-current="page"]{background:rgba(151,120,194,.14);color:#dacbed}
.haven-mobile-bottom-nav{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:980px){.haven-client-nav{gap:8px;padding-left:12px;padding-right:12px}.haven-console-tab{padding-left:6px;padding-right:6px}.haven-shadow-badge{display:none}}

/* HAVEN_FOLIO_CONSOLE_ROOT_R1_6_NAV_ANCHORED_PERSISTENT
 * The selected primary area owns its secondary nav. It stays visible after click
 * and is centered under that primary button, never under the whole viewport.
 */
.haven-area-tabs{display:flex;align-items:stretch;gap:2px;height:100%}
.haven-area-tab-wrap{position:relative;height:100%;display:flex;align-items:center;overflow:visible}
.haven-area-tab{height:34px}
.haven-area-flyout{position:absolute;top:calc(100% - 2px);left:50%;z-index:10020;display:flex;align-items:center;justify-content:center;gap:3px;width:max-content;max-width:calc(100vw - 24px);padding:8px 9px;min-height:40px;box-sizing:border-box;overflow-x:auto;scrollbar-width:none;border:1px solid rgba(110,79,154,.13);border-radius:15px;background:rgba(250,249,252,.985);box-shadow:0 16px 42px rgba(48,36,58,.13),0 2px 9px rgba(48,36,58,.05);backdrop-filter:blur(22px) saturate(1.08);transform:translateX(-50%);animation:haven-flyout-anchor-in .12s ease-out both}
.haven-area-flyout::-webkit-scrollbar{display:none}
@keyframes haven-flyout-anchor-in{from{opacity:0;transform:translate(-50%,-5px) scale(.99)}to{opacity:1;transform:translate(-50%,0) scale(1)}}
.haven-flyout-item{appearance:none;border:1px solid transparent;background:transparent;color:#716a77;border-radius:9px;padding:8px 8px;white-space:nowrap;font:650 10px/1 Inter,"Noto Sans SC",system-ui,sans-serif;cursor:pointer;letter-spacing:0;transition:background .12s ease,color .12s ease,border-color .12s ease}
.haven-flyout-item:hover,.haven-flyout-item:focus-visible{outline:none;color:#4d3d62;background:rgba(110,79,154,.07);border-color:rgba(110,79,154,.07)}
.haven-flyout-item[aria-current="page"]{color:#5d4380;background:rgba(110,79,154,.115);border-color:rgba(110,79,154,.08)}
[data-theme="dark"] .haven-area-flyout{background:rgba(28,26,34,.985);border-color:rgba(255,255,255,.09);box-shadow:0 20px 52px rgba(0,0,0,.34)}
[data-theme="dark"] .haven-flyout-item{color:#aaa4b0}[data-theme="dark"] .haven-flyout-item:hover,[data-theme="dark"] .haven-flyout-item:focus-visible,[data-theme="dark"] .haven-flyout-item[aria-current="page"]{color:#eeeaf4;background:rgba(167,139,208,.14);border-color:rgba(167,139,208,.08)}
.haven-client-nav.is-galaxy .haven-area-flyout{background:rgba(18,16,29,.985);border-color:rgba(236,233,244,.09);box-shadow:0 20px 54px rgba(0,0,0,.38)}
.haven-client-nav.is-galaxy .haven-flyout-item{color:#aaa2b5}.haven-client-nav.is-galaxy .haven-flyout-item:hover,.haven-client-nav.is-galaxy .haven-flyout-item:focus-visible,.haven-client-nav.is-galaxy .haven-flyout-item[aria-current="page"]{color:#ece9f4;background:rgba(167,139,208,.16)}
/* Galaxy must own the deep-space surface. R1.2 left the persistent root paper background above body. */
.haven-client-root[data-area="memory"][data-memory-view="galaxy"]{background:#0e0d18!important;color-scheme:dark}
.haven-client-root[data-area="memory"][data-memory-view="galaxy"] .haven-client-stage,
.haven-client-root[data-area="memory"][data-memory-view="galaxy"] .haven-area-keepalive,
.haven-client-root[data-area="memory"][data-memory-view="galaxy"] .haven-memory-root,
.haven-client-root[data-area="memory"][data-memory-view="galaxy"] .haven-memory-stage,
.haven-client-root[data-area="memory"][data-memory-view="galaxy"] .haven-view-keepalive,
.haven-client-root[data-area="memory"][data-memory-view="galaxy"] .haven-view-host{background:transparent!important}

/* HAVEN_FOLIO_LAZY_MODULES_R1 — route-local loading surface inside one Persistent Root */
.haven-module-loading{position:absolute;inset:0;z-index:40;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;box-sizing:border-box;padding:28px;text-align:center;color:#81798a;background:linear-gradient(180deg,rgba(247,246,249,.82),rgba(247,246,249,.96));font-family:Inter,"Noto Sans SC",system-ui,sans-serif}
[data-theme="dark"] .haven-module-loading{color:#aaa2b5;background:linear-gradient(180deg,rgba(28,26,34,.82),rgba(28,26,34,.96))}
.haven-module-loading-mark{font:italic 22px/1 Georgia,"Noto Serif SC",serif;color:#73569a;opacity:.74;animation:haven-module-pulse 1.1s ease-in-out infinite alternate}
.haven-module-loading-title{font-size:12px;font-weight:650;color:#5f5867}.haven-module-loading-sub,.haven-module-loading-error{max-width:390px;font-size:10px;line-height:1.6;color:#9a92a1}.haven-module-loading-error{color:#9b666d}
[data-theme="dark"] .haven-module-loading-title{color:#d8d1df}[data-theme="dark"] .haven-module-loading-sub{color:#88818f}
.haven-module-retry{margin-top:4px;appearance:none;border:1px solid rgba(110,79,154,.16);border-radius:999px;background:rgba(110,79,154,.08);color:#624a84;padding:7px 13px;font:650 10px/1 Inter,"Noto Sans SC",sans-serif;cursor:pointer}
@keyframes haven-module-pulse{from{opacity:.35;transform:scale(.96)}to{opacity:.82;transform:scale(1.04)}}
.haven-mobile-client-stage>.haven-module-loading{position:absolute;inset:0}

/* HAVEN_FOLIO_LAZY_MODULES_R2 — public shell invariants */
.haven-mobile-bottom-nav{grid-template-columns:repeat(4,minmax(0,1fr))}
/* Keep the previous route visually covered until route CSS has actually painted. */
.haven-client-stage>.haven-module-loading,
.haven-mobile-client-stage>.haven-module-loading{isolation:isolate}


/* HAVEN_ROUTE_ATOMIC_PAINT_GATE_R1_1_20260821
 * Hide every persistent business surface during an atomic route handoff.
 * The always-loaded shell loading surface remains visible. */
html.haven-route-switching .haven-client-stage > .haven-area-keepalive,
html.haven-route-switching .haven-mobile-client-stage > .haven-mobile-area {
  visibility: hidden !important;
  pointer-events: none !important;
}
html.haven-route-switching .haven-module-loading {
  visibility: visible !important;
}


/* HAVEN_CONSOLE_CSS_PERMANENT_SCOPED_R1_2_20260821
 * The Console sheet remains resident after first load. */
html.haven-console-active .folio-console { visibility: visible; }
