/* Living Book — Shared Account, Onboarding & Navigation Shell (v1)
   Carries forward the typography, materials, colour, spacing and interaction
   quality of the Painted Window entrance and Physical Codex Reader. */

:root {
  --lb-font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --lb-font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --lb-font-mono: ui-monospace, "SF Mono", Menlo, Monaco, monospace;

  /* Room & window dark surfaces */
  --lb-room-bg: #12161f;
  --lb-room-walnut: #1b1511;
  --lb-glass-bg: rgba(16, 20, 28, 0.86);
  --lb-glass-elevated: rgba(22, 27, 37, 0.95);
  --lb-card-bg: rgba(25, 20, 16, 0.88);
  --lb-card-subtle: rgba(34, 27, 22, 0.68);
  --lb-border: rgba(232, 198, 144, 0.22);
  --lb-border-strong: rgba(232, 198, 144, 0.46);
  --lb-border-subtle: rgba(232, 198, 144, 0.12);

  /* Ink & accents */
  --lb-ink: #f3eadb;
  --lb-ink-soft: #d7c7b0;
  --lb-ink-muted: #a6957e;
  --lb-gold: #e4b668;
  --lb-gold-soft: #c9a56a;
  --lb-gold-bg: rgba(228, 182, 104, 0.15);
  --lb-focus: #f2c97d;

  /* Status & semantic tones */
  --lb-ok: #8fd1a8;
  --lb-ok-bg: rgba(70, 138, 98, 0.18);
  --lb-ok-border: rgba(125, 198, 152, 0.36);
  --lb-warn: #f0c27b;
  --lb-warn-bg: rgba(196, 142, 58, 0.18);
  --lb-warn-border: rgba(228, 182, 104, 0.40);
  --lb-danger: #f2a293;
  --lb-danger-bg: rgba(168, 68, 56, 0.18);
  --lb-danger-border: rgba(214, 106, 92, 0.44);

  /* Flyleaf paper tokens (for inside-book confirmations) */
  --lb-paper-bg: #f3ead8;
  --lb-paper-edge: #e4d5bc;
  --lb-paper-ink: #221a13;
  --lb-paper-muted: #5c4b3b;
  --lb-paper-rule: rgba(110, 82, 48, 0.24);
  --lb-paper-accent: #6e4f28;
}

html[data-paper-mode="night"] {
  --lb-paper-bg: #1c1814;
  --lb-paper-edge: #28211b;
  --lb-paper-ink: #eadfce;
  --lb-paper-muted: #b5a48e;
  --lb-paper-rule: rgba(228, 182, 104, 0.22);
  --lb-paper-accent: #dfb063;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
html[data-reduced-motion="true"],
html[data-reduced-motion="true"] *,
html[data-reduced-motion="true"] *::before,
html[data-reduced-motion="true"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* ---- Top Loading Progress Bar & Immediate Navigation Feedback ----------- */
.lb-nav-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 220;
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding-top: 0.55rem;
}
.lb-nav-progress[hidden] {
  display: none !important;
}
.lb-nav-progress::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: linear-gradient(90deg, transparent, var(--lb-gold), #fff3d6, var(--lb-gold), transparent);
  background-size: 200% 100%;
  animation: lb-progress-sweep 1.35s linear infinite;
}
@keyframes lb-progress-sweep {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.lb-nav-progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.36rem 0.85rem;
  border-radius: 999px;
  background: rgba(15, 19, 27, 0.94);
  border: 1px solid var(--lb-border-strong);
  color: var(--lb-ink);
  font: 500 0.75rem/1.3 var(--lb-font-sans);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.lb-nav-spinner {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  border: 1.8px solid rgba(228, 182, 104, 0.32);
  border-top-color: var(--lb-gold);
  animation: lb-spin 0.75s linear infinite;
}
@keyframes lb-spin {
  to { transform: rotate(360deg); }
}

/* ---- Discreet Shared Account Control (Window, Shelf, Reader, Account) --- */
.lb-account-mount {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  pointer-events: auto;
  z-index: 65;
}

.lb-nav-pill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.44rem;
  min-height: 2.05rem;
  padding: 0.32rem 0.76rem;
  border-radius: 999px;
  border: 1px solid var(--lb-border);
  background: var(--lb-glass-bg);
  color: var(--lb-ink);
  font: 500 0.74rem/1.2 var(--lb-font-sans);
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.36);
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.lb-nav-pill:hover {
  background: rgba(32, 38, 52, 0.94);
  border-color: var(--lb-border-strong);
  color: #fffaf0;
}
.lb-nav-pill:focus-visible {
  outline: 2.5px solid var(--lb-focus);
  outline-offset: 3px;
}
.lb-nav-pill[aria-expanded="true"] {
  background: rgba(228, 182, 104, 0.22);
  border-color: rgba(228, 182, 104, 0.64);
  color: #fff6e5;
}
.lb-nav-pill-primary {
  background: linear-gradient(180deg, rgba(228, 182, 104, 0.24), rgba(182, 134, 62, 0.18));
  border-color: rgba(228, 182, 104, 0.52);
  color: #faeed8;
  font-weight: 600;
}
.lb-nav-pill-primary:hover {
  background: linear-gradient(180deg, rgba(228, 182, 104, 0.36), rgba(182, 134, 62, 0.28));
  border-color: rgba(242, 201, 125, 0.78);
}

.lb-status-dot {
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 50%;
  background: var(--lb-gold);
  box-shadow: 0 0 8px rgba(228, 182, 104, 0.65);
  flex-shrink: 0;
}
.lb-status-dot.is-signed-in {
  background: var(--lb-ok);
  box-shadow: 0 0 8px rgba(143, 209, 168, 0.55);
}
.lb-status-dot.is-owner {
  background: #f2c97d;
  box-shadow: 0 0 9px rgba(242, 201, 125, 0.8);
}

.lb-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.44rem;
  border-radius: 999px;
  font: 600 0.62rem/1.2 var(--lb-font-sans);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(228, 182, 104, 0.16);
  color: #edd09a;
  border: 1px solid rgba(228, 182, 104, 0.28);
}

/* ---- Account & Preview Popover Menu ------------------------------------- */
.lb-account-popover {
  position: fixed;
  top: 3.35rem;
  left: 1rem;
  z-index: 120;
  width: min(21.5rem, calc(100vw - 1.5rem));
  border-radius: 14px;
  background: var(--lb-glass-elevated);
  border: 1px solid var(--lb-border-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--lb-ink);
  font: 400 0.82rem/1.45 var(--lb-font-sans);
  padding: 0.9rem;
  pointer-events: auto;
}
.lb-account-popover.is-right-aligned {
  left: auto;
  right: 1rem;
}
.lb-account-popover[hidden] {
  display: none !important;
}

.lb-pop-identity {
  padding-bottom: 0.72rem;
  margin-bottom: 0.65rem;
  border-bottom: 1px solid var(--lb-border-subtle);
}
.lb-pop-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lb-gold);
  margin-bottom: 0.24rem;
}
.lb-pop-name {
  font: 600 1.04rem/1.25 var(--lb-font-serif);
  color: #fbf3e4;
  margin: 0;
}
.lb-pop-sub {
  margin: 0.22rem 0 0;
  font-size: 0.75rem;
  color: var(--lb-ink-soft);
  line-height: 1.45;
}

.lb-pop-list {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.lb-pop-action {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.52rem 0.65rem;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--lb-ink);
  font: 500 0.8rem/1.3 var(--lb-font-sans);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.lb-pop-action:hover {
  background: rgba(228, 182, 104, 0.12);
  border-color: rgba(228, 182, 104, 0.24);
  color: #fff8ec;
}
.lb-pop-action:focus-visible {
  outline: 2px solid var(--lb-focus);
  outline-offset: 2px;
}
.lb-pop-action-primary {
  background: rgba(228, 182, 104, 0.15);
  border-color: rgba(228, 182, 104, 0.34);
  color: #ffefd4;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.lb-pop-action-meta {
  font-size: 0.7rem;
  color: var(--lb-ink-muted);
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 9.5rem;
}
.lb-pop-divider {
  height: 1px;
  background: var(--lb-border-subtle);
  margin: 0.45rem 0;
}
.lb-pop-action-danger {
  color: #f0b8ad;
}
.lb-pop-action-danger:hover {
  background: rgba(180, 74, 60, 0.18);
  border-color: rgba(214, 106, 92, 0.36);
  color: #ffd9d1;
}

/* ---- Standalone & Journey Page Layout (Login, Invite, Password, Account) - */
body.lb-room-page {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(65% 55% at 24% 16%, rgba(228, 182, 104, 0.11), transparent 70%),
    radial-gradient(58% 62% at 82% 22%, rgba(92, 132, 178, 0.10), transparent 72%),
    linear-gradient(180deg, #131722 0%, #171412 52%, #110e0c 100%);
  color: var(--lb-ink);
  font: 400 1rem/1.62 var(--lb-font-serif);
  display: flex;
  flex-direction: column;
}

/* Top bar across Account, Sign-in, Onboarding, Privacy, Studio login */
.lb-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.85rem clamp(1rem, 3.5vw, 2.2rem);
  border-bottom: 1px solid var(--lb-border-subtle);
  background: rgba(14, 17, 24, 0.76);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.lb-top-bar-left,
.lb-top-bar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.lb-brand-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--lb-ink);
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--lb-border-subtle);
  background: rgba(255, 255, 255, 0.03);
}
.lb-brand-pill strong {
  font: 600 0.78rem/1.2 var(--lb-font-serif);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #f6ead6;
}
.lb-brand-pill span {
  font: 400 0.68rem/1.2 var(--lb-font-sans);
  color: var(--lb-ink-muted);
}

/* Centered Journey Card (Sign in, Password, Invite, Auth Complete) */
.lb-journey-shell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 4vw, 3rem) 1rem;
}
.lb-journey-card {
  width: min(100%, 35rem);
  background: linear-gradient(180deg, rgba(28, 23, 19, 0.95), rgba(20, 16, 13, 0.97));
  border: 1px solid var(--lb-border);
  border-radius: 16px;
  padding: clamp(1.5rem, 4vw, 2.4rem);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 236, 204, 0.08);
}
.lb-journey-card.is-wide {
  width: min(100%, 42rem);
}

/* Flyleaf / Endpaper Card (for inside-book Trial Start & Onboarding) */
body.lb-flyleaf-page {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(64% 68% at 50% 35%, rgba(36, 28, 22, 0.76), rgba(14, 12, 10, 0.94));
  color: var(--lb-paper-ink);
  font: 400 1rem/1.62 var(--lb-font-serif);
  display: flex;
  flex-direction: column;
}
.lb-flyleaf-shell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3.5vw, 2.5rem) 1rem;
}
.lb-flyleaf-card {
  width: min(100%, 39rem);
  background:
    radial-gradient(120% 90% at 15% 10%, rgba(255, 252, 244, 0.45), transparent 65%),
    var(--lb-paper-bg);
  color: var(--lb-paper-ink);
  border: 1px solid var(--lb-paper-edge);
  border-left: 6px solid #7d5b32;
  border-radius: 6px 14px 14px 6px;
  padding: clamp(1.4rem, 4vw, 2.35rem);
  box-shadow:
    -6px 0 18px rgba(0, 0, 0, 0.35),
    0 26px 64px rgba(0, 0, 0, 0.62),
    inset 0 0 0 1px rgba(130, 96, 54, 0.14);
}

.lb-kicker {
  font: 600 0.68rem/1.3 var(--lb-font-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lb-gold);
  margin: 0 0 0.45rem;
}
.lb-flyleaf-card .lb-kicker {
  color: var(--lb-paper-accent);
}

.lb-title {
  font: 400 clamp(1.65rem, 3.6vw, 2.25rem)/1.18 var(--lb-font-serif);
  margin: 0 0 0.65rem;
  color: #faf0df;
}
.lb-flyleaf-card .lb-title {
  color: var(--lb-paper-ink);
}

.lb-lead {
  margin: 0 0 1.15rem;
  color: var(--lb-ink-soft);
  font-size: 0.98rem;
}
.lb-flyleaf-card .lb-lead {
  color: var(--lb-paper-muted);
}

/* Step progress pills for multi-step setup (Invite -> Password -> Book) */
.lb-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}
.lb-step {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.26rem 0.64rem;
  border-radius: 999px;
  font: 500 0.7rem/1.2 var(--lb-font-sans);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--lb-border-subtle);
  color: var(--lb-ink-muted);
}
.lb-step.is-current {
  background: var(--lb-gold-bg);
  border-color: var(--lb-border-strong);
  color: #f9ebd2;
  font-weight: 600;
}
.lb-step.is-done {
  background: var(--lb-ok-bg);
  border-color: var(--lb-ok-border);
  color: var(--lb-ok);
}

/* Callout / Notice boxes */
.lb-callout {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--lb-border);
  background: rgba(228, 182, 104, 0.08);
  margin: 0.9rem 0;
  font: 400 0.86rem/1.5 var(--lb-font-sans);
  color: var(--lb-ink-soft);
}
.lb-callout strong {
  color: var(--lb-ink);
}
.lb-flyleaf-card .lb-callout {
  background: rgba(125, 91, 50, 0.08);
  border-color: var(--lb-paper-rule);
  color: var(--lb-paper-ink);
}
.lb-flyleaf-card .lb-callout strong {
  color: var(--lb-paper-ink);
}
.lb-callout-ok {
  background: var(--lb-ok-bg);
  border-color: var(--lb-ok-border);
  color: #d9f2e2;
}
.lb-callout-warn {
  background: var(--lb-warn-bg);
  border-color: var(--lb-warn-border);
  color: #fae4be;
}
.lb-callout-danger {
  background: var(--lb-danger-bg);
  border-color: var(--lb-danger-border);
  color: #ffd8d0;
}

/* Forms, Inputs, Checkboxes & Buttons */
.lb-field {
  margin: 0.95rem 0;
}
.lb-label {
  display: block;
  font: 600 0.8rem/1.35 var(--lb-font-sans);
  color: var(--lb-ink);
  margin-bottom: 0.35rem;
}
.lb-flyleaf-card .lb-label {
  color: var(--lb-paper-ink);
}
.lb-hint {
  display: block;
  font: 400 0.75rem/1.4 var(--lb-font-sans);
  color: var(--lb-ink-muted);
  margin-top: 0.25rem;
}
.lb-flyleaf-card .lb-hint {
  color: var(--lb-paper-muted);
}

.lb-input,
.lb-select {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.62rem 0.82rem;
  border-radius: 9px;
  border: 1px solid rgba(232, 198, 144, 0.32);
  background: rgba(10, 12, 16, 0.72);
  color: var(--lb-ink);
  font: 400 0.94rem/1.4 var(--lb-font-sans);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lb-flyleaf-card .lb-input,
.lb-flyleaf-card .lb-select {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(110, 82, 48, 0.38);
  color: var(--lb-paper-ink);
}
html[data-paper-mode="night"] .lb-flyleaf-card .lb-input,
html[data-paper-mode="night"] .lb-flyleaf-card .lb-select {
  background: rgba(12, 10, 8, 0.82);
  border-color: rgba(228, 182, 104, 0.34);
  color: var(--lb-paper-ink);
}
.lb-input:focus-visible,
.lb-select:focus-visible {
  outline: 2.5px solid var(--lb-focus);
  outline-offset: 2px;
  border-color: var(--lb-gold);
}

.lb-check-group {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 1rem 0;
}
.lb-check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.62rem 0.78rem;
  border-radius: 9px;
  border: 1px solid var(--lb-border-subtle);
  background: rgba(255, 255, 255, 0.025);
  font: 400 0.86rem/1.45 var(--lb-font-sans);
  color: var(--lb-ink);
  cursor: pointer;
}
.lb-room-page a:not(.lb-btn):not(.lb-nav-pill):not(.lb-brand-pill):not(.lb-proto-link):not(.lb-popover-item):not(.lb-section-pill) {
  color: #edd09a;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lb-flyleaf-page a:not(.lb-btn):not(.lb-nav-pill):not(.lb-brand-pill):not(.lb-proto-link) {
  color: #5b3c1c;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lb-flyleaf-card .lb-check-row {
  background: rgba(125, 91, 50, 0.05);
  border-color: var(--lb-paper-rule);
  color: var(--lb-paper-ink);
}
.lb-check-row.is-optional {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.015);
}
.lb-check-row input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.14rem 0 0;
  accent-color: var(--lb-gold);
  flex-shrink: 0;
  cursor: pointer;
}
.lb-flyleaf-card .lb-check-row input[type="checkbox"] {
  accent-color: #6e4f28;
}

.lb-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.62rem 1.15rem;
  border-radius: 9px;
  border: 1px solid var(--lb-border-strong);
  background: linear-gradient(180deg, rgba(228, 182, 104, 0.26), rgba(176, 128, 56, 0.22));
  color: #fdf3e1;
  font: 600 0.88rem/1.25 var(--lb-font-sans);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.lb-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(228, 182, 104, 0.38), rgba(176, 128, 56, 0.32));
  border-color: #f2c97d;
}
.lb-btn:disabled {
  opacity: 0.58;
  cursor: wait;
}
.lb-btn-block {
  width: 100%;
}
.lb-btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--lb-border);
  color: var(--lb-ink);
  font-weight: 500;
}
.lb-btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.10);
  border-color: var(--lb-border-strong);
}
.lb-btn-danger {
  background: rgba(168, 68, 56, 0.22);
  border-color: var(--lb-danger-border);
  color: #ffd8cf;
}
.lb-btn-danger:hover:not(:disabled) {
  background: rgba(188, 76, 62, 0.34);
  border-color: #f2a293;
}
.lb-flyleaf-card .lb-btn-primary {
  background: #2c2117;
  border-color: #2c2117;
  color: #f8efe0;
}
.lb-flyleaf-card .lb-btn-primary:hover:not(:disabled) {
  background: #3d2e20;
}
html[data-paper-mode="night"] .lb-flyleaf-card .lb-btn-primary {
  background: rgba(228, 182, 104, 0.26);
  border-color: rgba(228, 182, 104, 0.56);
  color: #fdf3e1;
}

.lb-status-banner {
  margin: 0.85rem 0 0;
  padding: 0.68rem 0.85rem;
  border-radius: 9px;
  border: 1px solid var(--lb-border);
  background: rgba(228, 182, 104, 0.12);
  color: #f7e6c4;
  font: 500 0.82rem/1.45 var(--lb-font-sans);
}
.lb-status-banner:empty {
  display: none;
}
.lb-status-banner.is-error {
  background: var(--lb-danger-bg);
  border-color: var(--lb-danger-border);
  color: #ffd8cf;
}

.lb-footer-links {
  margin-top: 1.35rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--lb-border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font: 400 0.78rem/1.4 var(--lb-font-sans);
  color: var(--lb-ink-muted);
}
.lb-flyleaf-card .lb-footer-links {
  border-top-color: var(--lb-paper-rule);
  color: var(--lb-paper-muted);
}
.lb-footer-links a {
  color: inherit;
  text-underline-offset: 0.2em;
}
.lb-footer-links a:hover {
  color: var(--lb-gold);
}

/* ---- Reader Account Page Layout (Profile, Preferences, Security, Privacy) */
.lb-account-layout {
  width: min(100%, 64rem);
  margin: 0 auto;
  padding: clamp(1.4rem, 3.5vw, 2.6rem) clamp(1rem, 3.5vw, 2rem) 5rem;
  box-sizing: border-box;
}
.lb-account-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.35rem;
  border-bottom: 1px solid var(--lb-border-subtle);
}
.lb-account-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
}
.lb-subnav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.42rem 0.82rem;
  border-radius: 999px;
  border: 1px solid var(--lb-border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--lb-ink-soft);
  font: 500 0.76rem/1.2 var(--lb-font-sans);
  text-decoration: none;
}
.lb-subnav-link:hover {
  background: rgba(228, 182, 104, 0.12);
  border-color: var(--lb-border);
  color: var(--lb-ink);
}

.lb-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr));
  gap: 1.2rem;
  align-items: start;
}
.lb-account-card {
  background: var(--lb-card-bg);
  border: 1px solid var(--lb-border);
  border-radius: 14px;
  padding: 1.35rem clamp(1.1rem, 2.5vw, 1.55rem);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
}
.lb-account-card.is-full {
  grid-column: 1 / -1;
}
.lb-account-card.is-danger {
  border-color: rgba(214, 106, 92, 0.34);
  background: linear-gradient(180deg, rgba(32, 19, 17, 0.88), rgba(24, 15, 14, 0.92));
}
.lb-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.lb-card-title {
  font: 400 1.28rem/1.25 var(--lb-font-serif);
  color: #f9efde;
  margin: 0;
}
.lb-card-desc {
  margin: 0 0 1rem;
  font: 400 0.86rem/1.55 var(--lb-font-sans);
  color: var(--lb-ink-soft);
}

/* Preferences grid inside Account */
.lb-pref-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.lb-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.62rem 0.78rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--lb-border-subtle);
}
.lb-pref-label {
  font: 500 0.82rem/1.3 var(--lb-font-sans);
  color: var(--lb-ink);
}
.lb-pref-label small {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--lb-ink-muted);
  margin-top: 0.12rem;
}
.lb-seg-control {
  display: inline-flex;
  background: rgba(10, 12, 16, 0.68);
  border: 1px solid var(--lb-border-subtle);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.lb-seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--lb-ink-muted);
  padding: 0.34rem 0.68rem;
  border-radius: 6px;
  font: 500 0.74rem/1.2 var(--lb-font-sans);
  cursor: pointer;
}
.lb-seg-btn[aria-pressed="true"],
.lb-seg-btn.is-active {
  background: rgba(228, 182, 104, 0.25);
  color: #ffefd4;
  font-weight: 600;
}

/* Sessions list inside Security & devices */
.lb-session-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--lb-border-subtle);
  margin-bottom: 1rem;
}
.lb-sessions-list {
  list-style: none;
  padding: 0;
  margin: 0.85rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.lb-session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.8rem 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--lb-border-subtle);
  background: rgba(14, 17, 23, 0.58);
}
.lb-session-item.is-current {
  border-color: rgba(143, 209, 168, 0.38);
  background: rgba(42, 72, 54, 0.14);
}
.lb-session-item.is-inactive {
  opacity: 0.74;
}
.lb-session-title {
  margin: 0;
  font: 600 0.84rem/1.35 var(--lb-font-sans);
  color: var(--lb-ink);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.lb-session-meta {
  margin: 0.2rem 0 0;
  font: 400 0.74rem/1.35 var(--lb-font-sans);
  color: var(--lb-ink-muted);
}
.lb-session-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.48rem;
  border-radius: 999px;
  font: 600 0.64rem/1.2 var(--lb-font-sans);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lb-session-badge.is-current {
  background: var(--lb-ok-bg);
  border: 1px solid var(--lb-ok-border);
  color: var(--lb-ok);
}
.lb-session-badge.is-active {
  background: rgba(228, 182, 104, 0.16);
  border: 1px solid rgba(228, 182, 104, 0.34);
  color: #f3ce89;
}
.lb-session-badge.is-expired {
  background: rgba(166, 149, 126, 0.16);
  border: 1px solid rgba(166, 149, 126, 0.32);
  color: #cbbba4;
}
.lb-session-badge.is-revoked {
  background: var(--lb-danger-bg);
  border: 1px solid var(--lb-danger-border);
  color: var(--lb-danger);
}

/* ---- Prototype State Switcher Bar (Local Review Fixture Only) ----------- */
.lb-proto-bar {
  position: fixed;
  bottom: 0.65rem;
  left: 0.75rem;
  z-index: 190;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-width: calc(100vw - 1.5rem);
  padding: 0.32rem 0.55rem;
  border-radius: 999px;
  background: rgba(12, 15, 22, 0.94);
  border: 1px solid rgba(228, 182, 104, 0.42);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font: 500 0.68rem/1.2 var(--lb-font-sans);
  color: var(--lb-ink-soft);
}
.lb-proto-bar.is-expanded {
  border-radius: 14px;
  padding: 0.45rem 0.65rem;
}
.lb-proto-bar[hidden] {
  display: none !important;
}
.lb-proto-toggle {
  appearance: none;
  border: 1px solid rgba(228, 182, 104, 0.38);
  background: rgba(228, 182, 104, 0.16);
  color: #f5d18c;
  font: 700 0.62rem/1.2 var(--lb-font-sans);
  letter-spacing: 0.04em;
  padding: 0.22rem 0.52rem;
  border-radius: 999px;
  cursor: pointer;
}
.lb-proto-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.lb-proto-links[hidden] {
  display: none !important;
}
.lb-proto-link {
  color: var(--lb-ink-soft);
  text-decoration: none;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.lb-proto-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}
.lb-proto-link.is-active {
  background: rgba(228, 182, 104, 0.24);
  border-color: rgba(228, 182, 104, 0.52);
  color: #fff5e0;
  font-weight: 600;
}

@media (max-width: 720px) {
  .lb-top-bar {
    padding: 0.65rem 0.85rem;
  }
  .lb-brand-pill span {
    display: none;
  }
  .lb-account-popover {
    left: 0.6rem;
    right: 0.6rem;
    width: auto;
  }
  .lb-proto-bar {
    border-radius: 12px;
    padding: 0.4rem 0.55rem;
    bottom: 0.4rem;
  }
}
