/* BTP-style shell: sidebar + main + top bar */
:root {
  --shell-bg: #0f0e0a;
  --shell-sidebar: #1e1c17;
  --shell-main: #12110d;
  --shell-gold: #e3b93f;
  --shell-gold-hover: #c99b25;
  --shell-text: #efeee9;
  --shell-muted: #9d998c;
  --shell-border: rgba(227, 185, 63, 0.16);
}

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--shell-bg);
  color: var(--shell-text);
}

.shell-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--shell-sidebar);
  border-right: 1px solid var(--shell-border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: relative;
  transition: width 0.22s ease, padding 0.22s ease;
}

@media (prefers-reduced-motion: reduce) {
  .shell-sidebar {
    transition: none;
  }
}

.shell-sidebar-toggle {
  position: absolute;
  top: 14px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--shell-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--shell-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.shell-sidebar-toggle:hover {
  color: var(--shell-text);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.shell-sidebar-toggle-icon {
  font-size: 0.65rem;
  line-height: 1;
}

.shell-sidebar-toggle-icon-expand {
  display: none;
}

.app-shell.sidebar-collapsed .shell-sidebar-toggle-icon-collapse {
  display: none;
}

.app-shell.sidebar-collapsed .shell-sidebar-toggle-icon-expand {
  display: block;
}

.shell-nav-icon {
  display: none;
}

.app-shell.sidebar-collapsed .shell-nav a,
.app-shell.sidebar-collapsed .shell-sidebar-footer a,
.app-shell.sidebar-collapsed .shell-sidebar-footer button.shell-sidebar-admin {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

.app-shell.sidebar-collapsed .shell-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.app-shell.sidebar-collapsed .shell-nav-text {
  display: none;
}

.app-shell.sidebar-collapsed .shell-sidebar {
  width: 56px;
  padding-left: 0;
  padding-right: 0;
}

.app-shell.sidebar-collapsed .shell-brand {
  /* The collapse toggle is pinned to this corner, so the badge starts below it
     rather than underneath it. */
  padding: 44px 8px 16px;
  margin-bottom: 12px;
  text-align: center;
}

/* Collapsed to 56px there is no room for the wordmark, so the square G badge
   stands in for it. */
.app-shell.sidebar-collapsed .shell-brand-logo {
  display: none;
}

.app-shell.sidebar-collapsed .shell-brand-badge {
  display: block;
}

.app-shell.sidebar-collapsed .shell-nav {
  padding-left: 6px;
  padding-right: 6px;
}

.app-shell.sidebar-collapsed .shell-sidebar-footer {
  padding-left: 6px;
  padding-right: 6px;
}

.shell-brand {
  padding: 0 44px 20px 20px;
  border-bottom: 1px solid var(--shell-border);
  margin-bottom: 16px;
}

.shell-brand-link {
  display: block;
  line-height: 0;
  /* It wraps an image, so it must not inherit the default link blue -- which
     is what the alt text would fall back to if the logo ever failed to load. */
  color: inherit;
}

.shell-brand-logo {
  display: block;
  width: 100%;
  max-width: 142px;
  height: auto;
}

.shell-brand-badge {
  display: none;
  width: 34px;
  height: 34px;
  margin: 0 auto;
}

.shell-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
}

.shell-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  color: var(--shell-muted);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s;
}

.shell-nav a:hover {
  color: var(--shell-text);
  background: rgba(255, 255, 255, 0.05);
}

.shell-nav a.active {
  background: var(--shell-gold);
  color: #14110a;
}

.shell-sidebar-footer {
  margin-top: auto;
  padding: 16px 12px 0;
  border-top: 1px solid var(--shell-border);
}

.shell-sidebar-footer a {
  display: block;
  padding: 12px 14px;
  color: var(--shell-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.shell-sidebar-footer a:hover {
  color: var(--shell-text);
}

.hidden {
  display: none !important;
}

.shell-sidebar-footer button.shell-sidebar-admin {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  box-sizing: border-box;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--shell-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
}

.shell-sidebar-footer button.shell-sidebar-admin:hover {
  color: var(--shell-text);
}

.shell-sidebar-footer button.shell-sidebar-admin.shell-sidebar-admin--active {
  color: var(--shell-gold);
}

/* A handful of content links carry no class and relied on the browser's default
   link colour. That passed unnoticed while the theme was blue; against gold it
   is the one off-palette thing on the page. Per-page rules still win. */
.shell-main-wrap a:not([class]) {
  color: var(--shell-gold);
}

.shell-main-wrap a:not([class]):hover {
  color: var(--shell-gold-hover);
}

.shell-main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.shell-topbar {
  height: 52px;
  flex-shrink: 0;
  /* Black with a gold hairline, not a gold slab. The old bar was a solid brand
     fill, which worked in blue; gold at the same lightness is far brighter and
     would dominate every screen it sits on. The gold stays as the page title,
     the active nav item and the buttons. */
  background: var(--shell-sidebar);
  border-bottom: 1px solid rgba(227, 185, 63, 0.32);
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-weight: 600;
  font-size: 1rem;
  color: var(--shell-gold);
  letter-spacing: 0.02em;
  gap: 12px;
}

.shell-topbar-user {
  margin-left: auto;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.9rem;
  color: #fff;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-topbar-user.shown {
  display: inline-flex;
}

.shell-topbar-user::before {
  content: '◉';
  color: #6bff6b;
  font-size: 0.7rem;
  line-height: 1;
}

.shell-topbar-user-role {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
}

/* Change-password button — same pill treatment as Log out, and hidden the same
   way until a signed-in user arrives. */
.shell-topbar-password {
  display: none;
  align-items: center;
  flex-shrink: 0;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.shell-topbar-password.shown {
  display: inline-flex;
}

.shell-topbar-password:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.6);
}

.shell-topbar-password:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Log out button — hidden until an auth state with a signed-in user arrives. */
.shell-topbar-logout {
  display: none;
  align-items: center;
  flex-shrink: 0;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.shell-topbar-logout.shown {
  display: inline-flex;
}

.shell-topbar-logout:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.6);
}

.shell-topbar-logout:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* The user pill's margin-left:auto already pushes this group right; on narrow
   screens drop the email and keep the button, which is the actionable part. */
@media (max-width: 700px) {
  .shell-topbar-user.shown {
    display: none;
  }
  /* With the pill hidden, its margin-left:auto no longer pushes the group right,
     so the first visible button has to claim the free space itself. */
  .shell-topbar-password.shown {
    margin-left: auto;
  }
  .shell-topbar-logout.shown {
    margin-left: auto;
  }
  .shell-topbar-password.shown ~ .shell-topbar-logout.shown {
    margin-left: 0;
  }
}

.shell-content {
  flex: 1;
  padding: 24px;
  overflow: auto;
  background: var(--shell-main);
}

@media (max-width: 900px) {
  .shell-sidebar {
    width: 200px;
  }
  .shell-content {
    padding: 16px;
  }
}

@media (max-width: 700px) {
  .shell-sidebar-toggle {
    display: none;
  }

  .app-shell.sidebar-collapsed .shell-sidebar {
    width: 100%;
    padding: 12px;
  }

  .app-shell.sidebar-collapsed .shell-brand {
    padding: 0 20px 12px;
    margin-bottom: 8px;
  }

  .app-shell.sidebar-collapsed .shell-brand-logo {
    display: block;
  }

  .app-shell.sidebar-collapsed .shell-brand-badge {
    display: none;
  }

  .app-shell.sidebar-collapsed .shell-nav-icon {
    display: none;
  }

  .app-shell.sidebar-collapsed .shell-nav-text {
    display: inline;
  }

  .app-shell {
    flex-direction: column;
  }
  .shell-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px;
    border-right: none;
    border-bottom: 1px solid var(--shell-border);
  }
  .shell-brand {
    width: 100%;
    margin-bottom: 8px;
    padding-bottom: 12px;
    padding-right: 20px;
  }
  .shell-nav {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
  }
  .shell-nav a {
    flex: 1;
    min-width: 100px;
    justify-content: center;
  }
  .shell-sidebar-footer button.shell-sidebar-admin {
    flex: 1;
    min-width: 100px;
    justify-content: center;
  }
  .shell-sidebar-footer {
    width: 100%;
    margin-top: 8px;
    padding-top: 12px;
  }
}

/* FAB stack bottom-right */
.fab-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  align-items: center;
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--shell-gold);
  color: #14110a;
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(227, 185, 63, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s;
}

.fab:hover {
  background: var(--shell-gold-hover);
  transform: scale(1.05);
}

.fab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Modal */
.shell-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.shell-modal-overlay.hidden {
  display: none;
}

.shell-modal {
  background: #21201b;
  border: 1px solid var(--shell-border);
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 440px;
  width: 100%;
}

.shell-modal h3 {
  font-size: 1.35rem;
  margin-bottom: 12px;
  color: #fff;
}

.shell-modal p {
  color: var(--shell-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.shell-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
}

.shell-modal-actions button {
  background: none;
  border: none;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  color: #fff;
}

.shell-modal-actions .btn-yes {
  color: #f97316;
}

.shell-modal-actions .btn-yes:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Change-password dialog */
.shell-password-modal label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--shell-muted);
}

.shell-password-modal input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--shell-border);
  background: #191813;
  color: var(--shell-text);
  font: inherit;
  text-transform: none;
  letter-spacing: normal;
}

.shell-password-modal input:focus {
  outline: none;
  border-color: var(--shell-gold);
}

/* Always reserves a line so the dialog does not jump when the first error
   appears. */
.shell-password-msg {
  margin: 0 0 16px;
  font-size: 0.85rem;
  min-height: 1.2em;
}

.shell-password-msg.error {
  color: #f87171;
}

.shell-password-msg.ok {
  color: #4ade80;
}

/* QR scan modal */
.qr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.qr-modal-overlay.hidden {
  display: none;
}

.qr-modal-box {
  background: #27251f;
  border-radius: 12px;
  max-width: 420px;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--shell-border);
}

.qr-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--shell-border);
}

.qr-modal-head h4 {
  margin: 0;
  font-size: 1rem;
}

.qr-modal-close {
  background: none;
  border: none;
  color: var(--shell-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.qr-modal-body {
  padding: 16px;
}

.qr-modal-body video {
  width: 100%;
  border-radius: 8px;
}

.qr-modal-foot {
  padding: 10px 16px;
  background: var(--shell-gold);
  color: #14110a;
  font-size: 0.85rem;
}

/* --- Membership lock ------------------------------------------------------
   Applied by singo-auth.js to [data-members-only] controls when the signed-in
   account has no membership. These stay clickable on purpose -- the click is
   caught and turned into a trip to checkout -- so the styling has to read as
   "locked", not merely "dim": the padlock is the affordance. */
.singo-locked {
  position: relative;
  opacity: 0.5;
  filter: grayscale(0.7);
  /* Not `not-allowed`: the click is not refused, it is redirected to checkout.
     The padlock is what says "locked"; the pointer says "this still does
     something", and both are true. */
  cursor: pointer;
}

.singo-locked::after {
  content: '\1F512';
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 0.72rem;
  line-height: 1;
  filter: none;
  pointer-events: none;
}

/* An inline locked link has no corner to hang a badge off, so the padlock goes
   in the text flow instead. */
a.singo-locked::after,
.singo-locked.membership-inline::after {
  position: static;
  margin-left: 5px;
}

.singo-locked:focus-visible {
  outline: 2px solid var(--shell-gold);
  outline-offset: 2px;
}

.membership-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 0 0 20px;
  padding: 13px 18px;
  border: 1px solid var(--shell-border);
  border-left: 3px solid var(--shell-gold);
  border-radius: 10px;
  background: rgba(227, 185, 63, 0.07);
  color: var(--shell-text);
  font-size: 0.94rem;
}

.membership-notice-cta {
  margin-left: auto;
  padding: 7px 16px;
  border-radius: 7px;
  background: var(--shell-gold);
  color: #14110a;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.membership-notice-cta:hover {
  background: var(--shell-gold-hover);
}

@media (max-width: 560px) {
  .membership-notice-cta {
    margin-left: 0;
  }
}
