/* SeatLink v3 app shell (3.02.002): left rail of destinations, top bar, signage band, main column.
   Desktop >= 64rem: the rail is a fixed column. Narrower: the rail is a drawer opened from the top bar.
   Without JavaScript the rail simply stacks above the page, so navigation is never lost. */
@layer components {
  .shell { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; }
  .shell__body { min-width: 0; display: flex; flex-direction: column; }
  .shell__main { flex: 1; padding: 0 0 var(--s-7); }
  .shell__main > .container { padding-top: var(--s-5); }
  .shell__foot { padding: var(--s-4); border-top: 1px solid var(--hairline); color: var(--ink-2); font-size: var(--text-sm); }
  .shell__foot-inner { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); justify-content: space-between; }

  /* ---------------------------------------------------------------- rail */
  .rail {
    --focus-color: var(--rail-ink);
    display: flex; flex-direction: column; gap: var(--s-5);
    background: var(--rail-bg); color: var(--rail-ink); padding: var(--s-4) var(--s-3);
  }
  .rail__brand {
    display: flex; align-items: center; gap: var(--s-3); min-height: var(--control-h); padding: 0 var(--s-3);
    color: inherit; text-decoration: none; font-weight: 800; font-size: var(--text-lg); letter-spacing: -0.01em;
  }
  .rail__brand .logo { width: 2rem; height: 2rem; }
  .rail__group { display: flex; flex-direction: column; gap: var(--s-1); }
  .rail__group-title {
    margin: 0; padding: 0 var(--s-3); color: var(--rail-ink-2); font-size: var(--text-sm); font-weight: 650;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .rail__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
  .rail__link {
    display: flex; align-items: center; gap: var(--s-3); min-height: var(--control-h); padding: 0 var(--s-3);
    border-radius: var(--r-1); color: var(--rail-ink); text-decoration: none; font-weight: 550;
  }
  .rail__link:hover { background: var(--rail-hover); text-decoration: none; }
  .rail__link[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 800; }
  .rail__foot { margin-top: auto; padding-top: var(--s-4); border-top: 1px solid var(--rail-line); }

  /* ---------------------------------------------------------------- top bar */
  .topbar {
    position: sticky; top: 0; z-index: var(--z-sticky);
    display: flex; align-items: center; gap: var(--s-2); min-height: 3.5rem; padding: var(--s-2) var(--s-4);
    background: var(--surface); border-bottom: 1px solid var(--hairline);
  }
  .topbar__brand { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--ink); text-decoration: none; font-weight: 800; font-size: var(--text-lg); }
  .topbar__brand .logo { width: 2rem; height: 2rem; }
  .topbar__spacer { flex: 1; }

  /* ---------------------------------------------------------------- a page that works signed out (Help): one column, the brand always visible */
  .shell--public { display: block; }
  .shell--public .topbar__brand, .shell--public .topbar__spacer { display: inline-flex; }
  .shell--public .topbar__spacer { display: block; }
  .shell--public .topbar { justify-content: flex-start; }

  /* ---------------------------------------------------------------- notifications bell and panel (js/v3/notifications.js) */
  .topbar__bell { position: relative; }
  .topbar__badge {
    position: absolute; top: 0.15rem; right: 0.1rem; min-width: 1.15rem; height: 1.15rem; padding: 0 0.25rem; display: grid; place-items: center;
    border-radius: var(--r-2); background: var(--signal); color: var(--ink); font-size: var(--text-xs); font-weight: 800; line-height: 1; border: 1px solid var(--ink);
  }
  .notif-panel { width: min(24rem, calc(100vw - 1rem)); padding: 0; overflow: hidden; }
  .notif-panel__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--hairline); }
  .notif-panel__head .h4 { margin: 0; }
  .notif-list { margin: 0; padding: 0; list-style: none; max-height: min(26rem, 60vh); overflow-y: auto; }
  .notif-item { border-top: 1px solid var(--hairline); }
  .notif-item:first-child { border-top: 0; }
  .notif-item__link { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3); color: var(--ink); text-decoration: none; }
  .notif-item__link:hover { background: var(--neutral-bg); }
  .notif-item--unread { background: var(--signal-soft); }
  .notif-item__icon { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--r-1); background: var(--teal-soft); color: var(--teal); }
  .notif-item__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
  .notif-item__title { font-weight: 750; }
  .notif-item__msg { color: var(--ink-2); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .notif-item__time { color: var(--ink-3); font-size: var(--text-sm); }
  .notif-item__dot { flex: none; width: 0.6rem; height: 0.6rem; margin-top: 0.4rem; border-radius: 50%; background: var(--teal); }
  .notif-empty { margin: 0; padding: var(--s-5) var(--s-3); text-align: center; color: var(--ink-2); }
  .notif-panel__foot { display: flex; align-items: center; justify-content: center; min-height: var(--control-h); border-top: 1px solid var(--hairline); font-weight: 650; text-decoration: none; }
  .notif-panel__foot:hover { background: var(--neutral-bg); }

  /* ---------------------------------------------------------------- band inside the shell */
  .shell .band { align-items: center; }
  .band__facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); }
  .band__facts li { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 650; }
  .band__actions { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: var(--s-2); }

  .container--wide { width: min(100% - 2 * var(--s-4), 90rem); }
  .shell__main > .container > * + * { margin-top: var(--s-5); }

  .shell__scrim { position: fixed; inset: 0; z-index: calc(var(--z-dialog) - 1); background: var(--scrim); border: 0; padding: 0; }

  /* ---------------------------------------------------------------- narrow: drawer */
  @media (max-width: 63.999rem) {
    .shell[data-js] .rail {
      position: fixed; inset: 0 auto 0 0; z-index: var(--z-dialog);
      width: min(18rem, 86vw); overflow-y: auto; visibility: hidden; transform: translateX(-100%);
    }
    .shell[data-js][data-nav-open] .rail { visibility: visible; transform: none; box-shadow: var(--shadow-pop); }
    .topbar__user-name { display: none; }
  }

  /* ---------------------------------------------------------------- wide: fixed rail */
  @media (min-width: 64rem) {
    .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
    .rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
    .topbar__menu, .topbar__brand, .shell__scrim { display: none; }
    .topbar { justify-content: flex-end; }
    .topbar__spacer { display: none; }
  }

  @media (prefers-reduced-motion: no-preference) {
    .shell[data-js] .rail { transition: transform var(--t-med) var(--ease-out), visibility 0s linear var(--t-med); }
    .shell[data-js][data-nav-open] .rail { transition: transform var(--t-med) var(--ease-out), visibility 0s; }
  }
}
