
/* ── LOADER ── */
#bea-loader {
  position: fixed; inset: 0; z-index: 900;
  background: var(--cream);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .14s;
}
#bea-loader.fade { opacity: 0; pointer-events: none; }
.bea-loader-mark { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.bea-loader-word {
  font-family: var(--font-brand); font-size: 1.5rem; letter-spacing: .18em;
  text-transform: uppercase;
}
.bea-loader-word span { color: var(--sage-ink); animation-duration: 2.4s; animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
.bea-loader-word .bl-be { animation-name: beaPulseGold; }
.bea-loader-word .bl-a { animation-name: beaPulseGold; animation-delay: .3s; }
.bea-loader-word .bl-mem { animation-name: beaSettleGold; animation-delay: .6s; }
@keyframes beaPulseGold {
  0% { color: var(--sage-ink); }
  15%, 40% { color: var(--gold); }
  65%, 100% { color: var(--sage-ink); }
}
@keyframes beaSettleGold {
  0% { color: var(--sage-ink); }
  15%, 100% { color: var(--gold); }
}
.bea-spin {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid var(--champagne); border-top-color: var(--sage-deep);
  animation: beaspin .9s linear infinite;
}
@keyframes beaspin { to { transform: rotate(360deg); } }

/* ── TOP NAV ── */
.bea-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px 0 0;
  background: var(--panel);
}
body.has-side { padding-top: var(--nav-h); }
.nav-brand {
  font-family: var(--font-brand); font-weight: 700; font-size: 1.06rem;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--sage-ink); text-decoration: none; white-space: nowrap;
  padding-left: 22px;
}
.nav-brand em { font-style: normal; color: var(--gold); }
.nav-space { flex: 1; }

/* ── PAGE CONTEXT CHIP ── */
.nav-context {
  display: none; min-width: 0; max-width: 38vw;
  padding: 6px 14px; border-radius: 999px;
  background: var(--sage-deep); color: var(--white);
  font-size: .8rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease;
}
.nav-context.show { opacity: 1; transform: none; }
@media(min-width:901px){ .nav-context { max-width: calc(41vw - var(--side-w)); } }
@media(max-width:640px){
  .nav-context { max-width: 44vw; padding: 5px 11px; font-size: .74rem; }
}
@media(prefers-reduced-motion:reduce){ .nav-context { transition: none; } }

/* ── Chip tab menu ── */
.nav-context.pick {
  cursor: pointer; padding-right: 31px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 11px;
}
.ctx-menu {
  position: fixed; z-index: 940; min-width: 172px; max-width: min(78vw, 280px);
  max-height: min(58vh, 380px); overflow-y: auto;
  padding: 7px; border-radius: 12px;
  background: var(--sage-deep); color: var(--white);
  box-shadow: 0 16px 34px -12px rgba(var(--sage-ink-rgb),.55);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s ease, visibility .16s ease, transform .16s ease;
}
.ctx-menu.open { opacity: 1; visibility: visible; transform: none; }
.ctx-menu-link {
  display: block; width: 100%; text-align: left;
  appearance: none; background: none; border: none; cursor: pointer;
  padding: 7px 10px; border-radius: 8px;
  font: inherit; font-size: .82rem; font-weight: 600; color: var(--white);
  transition: background .12s ease;
}
.ctx-menu-link:hover { background: rgba(var(--white-rgb),.16); }
.ctx-menu-link.active { background: rgba(var(--white-rgb),.24); }
.ctx-menu-link:focus-visible { outline: 2px solid rgba(var(--white-rgb),.75); outline-offset: -2px; }
@media(prefers-reduced-motion:reduce){ .ctx-menu { transition: none; } }

/* ── LEFT MODULE PANEL ── */
.bea-side {
  position: fixed; top: var(--nav-h); left: 0; bottom: 0; z-index: 280;
  width: var(--side-w);
  display: flex; flex-direction: column;
  background: var(--panel);
  transition: transform .22s ease;
}
.side-scroll {
  flex: 1 1 auto; overflow-x: hidden; overflow-y: auto; padding: 26px 10px 10px;
  scrollbar-width: none;
}
.side-scroll::-webkit-scrollbar { display: none; }
.side-foot {
  flex: 0 0 auto; position: relative;
  padding: 12px 10px; display: flex; flex-direction: column; gap: 7px;
}
.side-foot::before {
  content: ''; position: absolute; top: 0; left: 12px; right: 12px; height: 1px;
  background: linear-gradient(to right,
    transparent, rgba(var(--sage-ink-rgb),.16) 22%,
    rgba(var(--sage-ink-rgb),.16) 78%, transparent);
}

/* ── THE COUPLE'S TITLE ── */
.nav-wedding {
  position: absolute; left: 50%; top: 50%;
  transform: translate(calc(-50% + 36px), -50%);
  max-width: 18vw;
  font-family: var(--font-script); font-style: italic; font-weight: 600;
  font-size: 1.16rem; line-height: 1; letter-spacing: .01em; color: var(--sage-deep);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
@media(min-width:901px){ .nav-wedding { font-size: 1.58rem; } }
.nav-wedding select { width: auto; max-width: 18vw; font-style: normal; }
@media(max-width:900px){ .bea-nav .nav-wedding { display: none; } }

.drawer-wedding {
  padding: 16px 44px 6px; text-align: center;
  font-family: var(--font-script); font-style: italic; font-weight: 600;
  font-size: 1.16rem; color: var(--sage-deep); line-height: 1.25;
}
.drawer-wedding select { width: 100%; font-style: normal; }

.side-group-label {
  display: flex; align-items: center; gap: 9px;
  font-size: .63rem; font-weight: 700; letter-spacing: .22em;
  text-transform: uppercase; color: var(--gold);
  padding: 0 10px; margin: 13px 0 5px;
}
.side-group-label::after {
  content: ''; flex: 1 1 auto; height: 1px;
  background: currentColor; opacity: .32;
}
.side-scroll > .side-group-label:first-child { margin-top: 6px; }
.side-link {
  display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 10px;
  min-height: 34px; padding: 5px 10px; border-radius: 9px;
  font-size: .85rem; font-weight: 600; color: var(--muted);
  text-decoration: none;
  transition: background .13s ease, color .13s ease, transform .13s ease;
}
.side-link .icon { width: 17px; height: 17px; justify-self: center; color: var(--sage-deep); opacity: .8; }
.side-link:hover .icon { opacity: 1; }
.side-link.active .icon { color: inherit; opacity: 1; }
.side-link:hover { color: var(--sage-ink); background: rgba(var(--sage-rgb),.12); transform: translateX(2px); }
.side-link.active:hover { transform: none; }
.side-link:focus-visible { outline: 2px solid var(--sage); outline-offset: 1px; }
.side-link.active { color: var(--white); background: var(--sage-deep); }

.side-badge {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  padding: 5px 11px; border-radius: 999px;
  background: rgba(var(--champagne-rgb),.42); border: 1px solid var(--champagne-deep);
  max-width: 230px; flex-shrink: 0;
}
.side-badge:empty { display: none; }
.side-badge-role, .side-badge-name {
  font-family: var(--font-body); font-size: .6rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink);
  line-height: 1.6;
}
.side-badge-role { flex-shrink: 0; }
.side-badge-role::after { content: '·'; margin-left: 6px; }
.side-badge-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media(max-width:900px){ .bea-nav .side-badge { display: none; } }
@media(min-width:901px){ #beaDrawer .side-badge { display: none; } }

.bea-side [data-tip]::after {
  position: fixed; left: var(--tip-x); top: var(--tip-y);
  right: auto; bottom: auto; transform: translateY(-50%) translateX(-6px);
  max-width: 260px;
  background: var(--sage-deep); border-radius: 10px;
  box-shadow: 0 12px 28px -10px rgba(var(--sage-ink-rgb),.5);
  transition: opacity .16s ease, visibility .16s ease, transform .16s ease;
}
.bea-side [data-tip]:hover::after,
.bea-side [data-tip]:focus-visible::after { transform: translateY(-50%) translateX(0); }
.bea-side [data-tip]::before { display: none; }

/* ── Module submenu ── */
.side-sub {
  position: fixed; z-index: 285; min-width: 176px; max-width: 248px;
  padding: 7px; border-radius: 12px;
  background: var(--sage-deep); color: var(--white);
  box-shadow: 0 16px 34px -12px rgba(var(--sage-ink-rgb),.55);
  opacity: 0; visibility: hidden; transform: translateX(-6px);
  transition: opacity .16s ease, visibility .16s ease, transform .16s ease;
}
.side-sub.open { opacity: 1; visibility: visible; transform: none; }
.side-sub::before { content: ''; position: absolute; top: 0; bottom: 0; left: -12px; width: 12px; }
.side-sub-head {
  font-size: .61rem; font-weight: 700; letter-spacing: .17em; text-transform: uppercase;
  color: rgba(var(--white-rgb),.7); padding: 5px 9px 7px;
}
.side-sub-link {
  display: block; padding: 7px 9px; border-radius: 8px;
  font-size: .82rem; font-weight: 600; color: var(--white); text-decoration: none;
  transition: background .12s ease;
}
.side-sub-link:hover { background: rgba(var(--white-rgb),.16); }
.side-sub-link:focus-visible { outline: 2px solid rgba(var(--white-rgb),.75); outline-offset: -2px; }
@media(max-width:900px){ .side-sub { display: none; } }
@media(prefers-reduced-motion:reduce){ .side-sub, .bea-side [data-tip]::after { transition: none; } }
/* ── Nav flyout shell ── */
.nav-flyout-btn, .notif-btn {
  appearance: none; background: none; border: none; cursor: pointer;
  padding: 9px; border-radius: 11px; display: flex; align-items: center; position: relative;
  color: var(--sage-deep); transition: .15s;
}
.nav-flyout-btn:hover, .notif-btn:hover { background: rgba(var(--sage-rgb),.14); }
.nav-flyout-btn:focus-visible, .notif-btn:focus-visible { outline: 2px solid var(--sage); outline-offset: 1px; }
.nav-flyout-btn svg, .notif-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-flyout-count {
  position: absolute; top: 3px; right: 3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--active); color: var(--active-on); border-radius: 9px;
  font-size: .6rem; font-weight: 700; line-height: 16px; text-align: center;
}
.nav-flyout-panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 400;
  width: 340px; max-width: calc(100vw - 24px);
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  display: none; overflow: hidden;
}
.nav-flyout-panel.open { display: block; }
.nav-flyout-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: .86rem; color: var(--sage-ink); background: var(--panel);
}
.nav-flyout-head button, .nav-flyout-head a {
  appearance: none; border: none; background: none; cursor: pointer;
  font: inherit; font-size: .72rem; font-weight: 600; color: var(--sage-ink); text-decoration: none;
}
.nav-flyout-head button:hover, .nav-flyout-head a:hover { text-decoration: underline; }
.nav-flyout-list { max-height: 380px; overflow-y: auto; }

/* ── Floating to-do ── */
.todo-wrap { position: relative; flex-shrink: 0; }
.todo-wrap + .todo-wrap, .todo-wrap + .notif-wrap { margin-left: -4px; }
.todo-nav-row { display: flex; gap: 8px; align-items: flex-start; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.todo-nav-row:last-child { border-bottom: none; }
.todo-nav-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--sage-deep); margin-top: 2px; flex-shrink: 0; }
.todo-nav-row.done .todo-nav-topic { text-decoration: line-through; color: var(--muted); }
.todo-nav-topic { font-size: .82rem; font-weight: 600; color: var(--ink); }
.todo-nav-detail { font-size: .72rem; color: var(--muted); margin-top: 1px; }
.todo-nav-who { font-size: .68rem; color: var(--sage-deep); margin-top: 2px; }
.todo-nav-empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: .8rem; }
.todo-nav-row.todo-nav-editing { display: block; }
.todo-nav-input {
  width: 100%; font: inherit; font-size: .8rem; color: var(--ink);
  background: var(--input-bg); border: 1px solid var(--input-bdr);
  border-radius: 8px; padding: 6px 9px;
}
@media(max-width:430px){
  .nav-flyout-panel { position: fixed; left: 12px; right: 12px; top: calc(var(--nav-h) + 8px); width: auto; }
}

/* ── NOTIFICATIONS (bell + panel) ── */
.notif-wrap { position: relative; flex-shrink: 0; }
.notif-count {
  position: absolute; top: 3px; right: 3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--active); color: var(--active-on); border-radius: 9px;
  font-size: .6rem; font-weight: 700; line-height: 16px; text-align: center;
  display: none;
}
.notif-count.on { display: block; }
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 400;
  width: 340px; max-width: calc(100vw - 24px);
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  display: none; overflow: hidden;
}
.notif-panel.open { display: block; }
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: .86rem; color: var(--sage-ink); background: var(--panel);
}
.notif-head button {
  appearance: none; border: none; background: none; cursor: pointer;
  font: inherit; font-size: .72rem; font-weight: 600; color: var(--sage-ink);
}
.notif-head button:hover { text-decoration: underline; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.notif-item:hover { background: rgba(var(--sage-rgb),.08); }
.notif-item.unread { background: rgba(var(--champagne-rgb),.28); }
.notif-item.unread:hover { background: rgba(var(--champagne-rgb),.45); }
.notif-icon {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(var(--sage-rgb),.16); color: var(--sage-deep); margin-top: 1px;
}
.notif-body-wrap { min-width: 0; flex: 1; }
.notif-item:last-child { border-bottom: none; }
.notif-title { font-size: .8rem; font-weight: 600; color: var(--ink); line-height: 1.35; }
.notif-body { font-size: .73rem; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-time { font-size: .66rem; color: var(--muted); margin-top: 3px; opacity: .8; }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: .8rem; line-height: 2.4; }
.notif-empty .icon { opacity: .45; }
@media(max-width:430px){
  .notif-panel { position: fixed; left: 12px; right: 12px; top: calc(var(--nav-h) + 8px); width: auto; }
}

.side-signout {
  appearance: none; font: inherit; font-size: .78rem; font-weight: 600;
  background: none; border: 1px solid var(--input-bdr); border-radius: 10px;
  color: var(--muted); padding: 7px 12px; cursor: pointer;
  transition: background .13s ease, color .13s ease, border-color .13s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  text-decoration: none; white-space: nowrap;
}
.side-signout .icon { width: 15px; height: 15px; }
.side-signout:hover {
  color: var(--red); border-color: rgba(var(--red-rgb),.45);
  background: rgba(var(--red-rgb),.07);
}
.side-signout:focus-visible { outline: 2px solid var(--sage); outline-offset: 1px; }
.side-signout::after { content: none; }
/* ── Menu button ── */
.nav-ham {
  display: none; appearance: none; background: none; border: none; cursor: pointer;
  flex-direction: column; gap: 4px; padding: 8px;
}
.nav-ham span { width: 20px; height: 2px; background: var(--sage-deep); border-radius: 2px; }
/* ── Editor bar drawer button ── */
.fe-bar .nav-ham { display: flex; flex: 0 0 auto; }

/* ── Unpinned panel ── */
.side-edge { display: none; }
/* ══ ONE SHELL ═══════════════════════════════════════════════════════════ */

.bea-nav { border-radius: 0 0 16px 16px; }

@media(min-width:901px){
  .bea-nav { border-radius: 0 0 16px 0; }
  .bea-side { border-radius: 0 0 16px 0; }
  .bea-side::after {
    content: ''; position: absolute; top: 0; left: 100%;
    width: 16px; height: 16px; pointer-events: none;
    background: radial-gradient(circle 16px at 100% 100%,
      rgba(0,0,0,0) 98%, var(--panel) 100%);
  }
  body.has-side:not(.side-unpinned) { padding-left: var(--side-w); }
  body.has-side:not(.side-unpinned):not(.side-mini) main { margin-inline: 0 auto; }
  body.side-unpinned .side-edge {
    display: block; position: fixed; left: 0; top: var(--nav-h); bottom: 0;
    width: 14px; z-index: 279;
  }
  body.side-unpinned .bea-side {
    transform: translateX(-100%); box-shadow: 14px 0 34px -12px rgba(var(--sage-ink-rgb),.3);
    transition-delay: .18s;
  }
  body.side-unpinned .side-edge:hover ~ .bea-side,
  body.side-unpinned .bea-side:hover,
  body.side-unpinned .bea-side:focus-within,
  body.side-unpinned.side-flyout .bea-side { transform: none; transition-delay: 0s; }
  /* ── Wordmark column ── */
  body:not(.side-unpinned):not(.side-mini) .bea-nav .nav-brand { width: var(--side-w); flex-shrink: 0; }

  /* ── Minimal panel ── */
  body.side-mini { --side-w: 64px; }
  body.side-mini .bea-side .side-scroll { padding: 22px 10px 10px; }
  body.side-mini .bea-side .side-link {
    grid-template-columns: 1fr; justify-items: center; gap: 0;
    min-height: 40px; padding: 10px 0; border-radius: 11px;
  }
  body.side-mini .bea-side .side-link > span { display: none; }
  body.side-mini .bea-side .side-link .icon { width: 19px; height: 19px; }
  body.side-mini .bea-side .side-link:hover { transform: none; }
  body.side-mini .bea-side .side-link[data-tip]::after { content: attr(data-label); }
  body.side-mini .bea-side .side-link:hover::after { transition-delay: .05s; }
  body.side-mini .bea-side .side-group-label {
    font-size: 0; letter-spacing: 0; gap: 0; padding: 0 2px; margin: 14px 0 9px;
  }
  body.side-mini .bea-side .side-foot { padding: 12px 10px; }
  body.side-mini .bea-side .side-signout { padding: 9px 0; }
  body.side-mini .bea-side .side-signout > span { display: none; }
  body.side-mini .bea-side .side-signout .icon { width: 17px; height: 17px; }
  body.side-mini .bea-side .side-signout::after { content: attr(data-tip); }
  body.side-mini .bea-side .side-signout:hover::after { transition-delay: .05s; }
}
@media(prefers-reduced-motion:reduce){ .bea-side { transition: none; } }

/* ── Drawer ── */
#beaDrawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 350;
  width: 272px; max-width: 85vw;
  background: var(--panel);
  box-shadow: -14px 0 34px rgba(var(--sage-ink-rgb),.16);
  transform: translateX(105%); transition: transform .25s;
  display: flex; flex-direction: column; overflow: hidden;
}
#beaDrawer.open { transform: none; }
#beaDrawerBack {
  position: fixed; inset: 0; z-index: 340;
  background: transparent;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
body.drawer-open #beaDrawerBack { opacity: 1; pointer-events: auto; }
@media(max-width:900px){ #beaDrawerBack { background: rgba(var(--ink-rgb),.42); } }

/* ── Drawer close ── */
.drawer-x {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  appearance: none; background: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px; color: var(--muted);
  transition: background .13s ease, color .13s ease;
}
.drawer-x .icon { width: 18px; height: 18px; }
.drawer-x:hover { background: rgba(var(--sage-rgb),.14); color: var(--sage-ink); }
.drawer-x:focus-visible { outline: 2px solid var(--sage); outline-offset: 1px; }
@media(prefers-reduced-motion:reduce){ #beaDrawer, #beaDrawerBack { transition: none; } }

@media(max-width:1160px){ :root { --side-w: 186px; } }
@media(max-width:900px){
  .bea-side, .side-edge { display: none; }
  .nav-ham { display: flex; }
}
/* ── Phone nav density ── */
@media(max-width:480px){
  .bea-nav { padding: 0 10px 0 0; gap: 3px; }
  .nav-brand { font-size: .88rem; letter-spacing: .08em; padding-left: 12px; }
  .todo-wrap + .todo-wrap, .todo-wrap + .notif-wrap { margin-left: 0; }
  .nav-flyout-btn, .notif-btn, .nav-ham { padding: 7px; }
  .nav-flyout-btn svg, .notif-btn svg { width: 20px; height: 20px; }
  .nav-flyout-count, .notif-count {
    top: 1px; right: 1px; min-width: 15px; height: 15px;
    line-height: 15px; font-size: .56rem;
  }
  .nav-context { max-width: 46vw; }
  .bea-nav:has(.nav-context.show) .nav-brand em { display: none; }
}
