/* App Library page — scoped under `.library` so it doesn't bleed into the
   rest of the marketing site. Adapted from the design mockup at
   .claude_design/Connector Library/Library.html. */

.library {
  /* Light theme — the rest of the marketing site is dark, so the App
     Library deliberately inverts to feel like a separate "product surface"
     while keeping the orange brand. */
  --orange: #F47421;
  --orange-2: #E0641A;
  --orange-deep: #B04A0A;

  --bg:    #F4F5F7;     /* page background (slightly off-white) */
  --bg-2:  #FFFFFF;     /* raised surfaces — cards, search, sort, sidebar bg */
  --bg-3:  #EBEDF0;     /* hover/active state on a raised surface */
  --line:  #E5E7EB;     /* default border */
  --line-2:#D1D5DB;     /* stronger border (focus, hover) */

  --text:   #111827;    /* primary text */
  --text-2: #4B5563;    /* secondary text */
  --text-3: #6B7280;    /* tertiary / meta */

  /* Accent colors are darkened from the dark-theme set so badge text on
     a white card has enough contrast (WCAG AA on white). */
  --green:  #15803D;
  --blue:   #1D4ED8;
  --yellow: #B45309;
  --violet: #6D28D9;

  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;

  /* Clear the sticky site header. The header is ~80px tall on desktop
     and the rest of the marketing pages don't notice because their
     content is wrapped in jquery.sticky's placeholder; the library page
     starts with a tight eyebrow right at the top, so without this offset
     the eyebrow + hero title get clipped behind the fixed nav. */
  padding-top: 90px;
}

.library *,
.library *::before,
.library *::after { box-sizing: border-box; }

.library a { color: inherit; text-decoration: none; }
.library button { font-family: inherit; }
.library .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* ---------- Buttons ---------- */
.library .lib-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.library .lib-btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.library .lib-btn-ghost:hover { background: var(--bg-3); border-color: #3b3f4b; }
.library .lib-btn-primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.library .lib-btn-primary:hover { background: var(--orange-2); }
.library .lib-btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 7px; }

/* ---------- Hero ---------- */
.library .lib-hero {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line);
  padding: 60px 28px 36px;
}
.library .lib-hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(900px 380px at 15% 0%, rgba(244, 116, 33, 0.14), transparent 60%),
    radial-gradient(700px 300px at 90% 10%, rgba(109, 40, 217, 0.06), transparent 60%),
    linear-gradient(180deg, #FFFFFF 0%, #F4F5F7 100%);
}
.library .lib-hero::after {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at top, black 40%, transparent 75%);
          mask-image: radial-gradient(ellipse at top, black 40%, transparent 75%);
}
.library .lib-hero-inner { position: relative; z-index: 1; max-width: 1320px; margin: 0 auto; }

.library .lib-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--orange);
  padding: 5px 10px; border-radius: 999px;
  background: rgba(244, 116, 33, 0.10);
  border: 1px solid rgba(244, 116, 33, 0.25);
}
.library .lib-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 10px var(--orange); }

.library .lib-hero-title {
  margin: 18px 0 10px;
  font-size: 54px; line-height: 1.02; letter-spacing: -0.025em; font-weight: 800;
  max-width: 900px; color: var(--text);
}
.library .lib-hero-title em { font-style: normal; color: var(--orange); font-weight: 800; }
.library .lib-hero-sub { color: var(--text-2); font-size: 17px; max-width: 680px; line-height: 1.5; }

.library .lib-hero-stats {
  display: flex; gap: 36px; margin-top: 28px;
  color: var(--text-2); font-size: 13px;
  flex-wrap: wrap;
}
.library .lib-hero-stats strong {
  display: block; color: var(--text); font-size: 22px; font-weight: 700;
  letter-spacing: -0.01em;
}

/* ---------- Tabs ---------- */
.library .lib-tabs-wrap { max-width: 1320px; margin: 0 auto; padding: 36px 28px 0; }
.library .lib-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; width: fit-content;
}
.library .lib-tab {
  padding: 10px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--text-2);
  cursor: pointer; border: none; background: transparent;
  display: flex; align-items: center; gap: 8px;
  transition: all .15s;
}
.library .lib-tab:hover { color: var(--text); }
.library .lib-tab.active {
  background: var(--bg-3); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.library .lib-tab .count {
  font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); color: var(--text-3);
  font-weight: 600;
}
.library .lib-tab.active .count { background: rgba(244, 116, 33, 0.18); color: var(--orange); }

/* ---------- Section heads / showcase ---------- */
.library .lib-section-head {
  max-width: 1320px; margin: 0 auto;
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 40px 28px 18px;
}
.library .lib-section-title {
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 10px;
}
.library .lib-section-title .accent {
  width: 4px; height: 22px; background: var(--orange); border-radius: 2px;
  display: inline-block;
}
.library .lib-section-link { color: var(--text-2); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.library .lib-section-link:hover { color: var(--orange); }

.library .lib-showcase {
  max-width: 1320px; margin: 0 auto; padding: 0 28px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.library .lib-sc-card {
  position: relative; overflow: hidden;
  border-radius: 16px; padding: 20px; height: 220px;
  display: flex; flex-direction: column; justify-content: space-between;
  cursor: pointer; transition: transform .25s ease;
  isolation: isolate;
  color: #fff;
}
.library .lib-sc-card:hover { transform: translateY(-3px); }
.library .lib-sc-card::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at bottom right, rgba(0, 0, 0, 0.35), transparent 60%);
}
.library .lib-sc-badge {
  align-self: flex-start;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.28); color: #fff;
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
.library .lib-sc-icon {
  width: 58px; height: 58px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  display: grid; place-items: center; color: #111;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.library .lib-sc-icon svg { width: 30px; height: 30px; }
.library .lib-sc-icon img { width: 40px; height: 40px; object-fit: contain; display: block; }
.library .lib-sc-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: #fff; }
.library .lib-sc-meta { font-size: 12px; color: rgba(255, 255, 255, 0.8); display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.library .lib-sc-meta .sep { opacity: 0.5; }

/* ---------- Type intro ---------- */
.library .lib-type-intro {
  max-width: 1320px; margin: 40px auto 0; padding: 0 28px;
  display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: end;
}
.library .lib-type-intro h2 {
  margin: 0 0 6px; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; color: var(--text);
}
.library .lib-type-intro p { margin: 0; color: var(--text-2); font-size: 14px; max-width: 640px; line-height: 1.5; }

/* ---------- Toolbar ---------- */
.library .lib-toolbar {
  max-width: 1320px; margin: 0 auto; padding: 28px 28px 0;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.library .lib-search {
  flex: 1; min-width: 260px;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px;
  transition: border-color .15s;
}
.library .lib-search:focus-within { border-color: var(--orange); }
.library .lib-search input {
  flex: 1; background: transparent; border: none; color: var(--text);
  font-size: 14px; outline: none; font-family: inherit;
}
.library .lib-search input::placeholder { color: var(--text-3); }
.library .lib-search svg { color: var(--text-3); }
.library .lib-kbd {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--text-3); padding: 2px 6px; border-radius: 5px;
  background: var(--bg-3); border: 1px solid var(--line-2);
}
.library .lib-sort {
  display: flex; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--bg-2);
}
.library .lib-sort button {
  padding: 10px 14px; background: transparent; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  border-right: 1px solid var(--line);
}
.library .lib-sort button:last-child { border-right: none; }
.library .lib-sort button.active { background: var(--bg-3); color: var(--text); }
.library .lib-sort button:hover { color: var(--text); }

/* ---------- Content grid (sidebar + cards) ---------- */
.library .lib-content {
  max-width: 1320px; margin: 0 auto; padding: 24px 28px 80px;
  display: grid; grid-template-columns: 240px 1fr; gap: 28px;
}
.library .lib-sidebar { position: sticky; top: 82px; align-self: start; }
.library .lib-filter-group { margin-bottom: 28px; }
.library .lib-filter-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.library .lib-filter-head h3 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -0.005em; color: var(--text); }
.library .lib-filter-clear { font-size: 12px; color: var(--orange); cursor: pointer; background: none; border: none; padding: 0; }
.library .lib-filter-clear:hover { text-decoration: underline; }
.library .lib-filter-list { display: flex; flex-direction: column; gap: 2px; }
.library .lib-filter-row {
  /* Reset browser default <button> styles. Without these the row inherits
     the OS-level light-gray button look that fights with the dark sidebar. */
  appearance: none; -webkit-appearance: none;
  background: transparent; border: none; outline: none;
  width: 100%; text-align: left; font: inherit; color: var(--text-2);

  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  font-size: 13.5px;
  transition: background .15s, color .15s;
}
.library .lib-filter-row:hover { background: var(--bg-3); color: var(--text); }
.library .lib-filter-row:focus-visible { background: var(--bg-3); box-shadow: 0 0 0 2px rgba(244, 116, 33, 0.35); }
.library .lib-filter-row.active { color: var(--text); background: rgba(244, 116, 33, 0.08); }
.library .lib-filter-row .count { font-size: 11px; color: var(--text-3); font-family: 'JetBrains Mono', monospace; }
.library .lib-filter-row-right { display: flex; align-items: center; gap: 10px; }
.library .lib-toggle {
  width: 30px; height: 18px; border-radius: 999px;
  background: #E5E7EB; border: 1px solid #D1D5DB;
  position: relative; flex-shrink: 0; transition: background .15s, border-color .15s;
}
.library .lib-toggle::after {
  content: ""; position: absolute; top: 1px; left: 1px;
  width: 14px; height: 14px; border-radius: 50%; background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: all .18s;
}
.library .lib-filter-row.active .lib-toggle { background: var(--orange); border-color: var(--orange); }
.library .lib-filter-row.active .lib-toggle::after { left: 13px; background: #fff; }

/* ---------- Card grid ---------- */
.library .lib-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.library .lib-card {
  position: relative;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px;
  display: flex; gap: 14px;
  cursor: pointer; transition: all .18s;
  min-height: 140px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.library .lib-card:hover {
  border-color: var(--line-2);
  background: var(--bg-3);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.08);
}
.library .lib-card-icon {
  width: 52px; height: 52px; border-radius: 11px;
  display: grid; place-items: center; flex-shrink: 0;
  color: #fff;
  overflow: hidden;
}
.library .lib-card-icon svg { width: 26px; height: 26px; }
.library .lib-card-icon img { width: 36px; height: 36px; object-fit: contain; display: block; }
/* Image icons (real upstream PNGs) sit on a white tile so the icon's own
   colors render naturally rather than fighting a colored brand tile. */
.library .lib-card-icon-image {
  background: #FFFFFF;
  border: 1px solid var(--line);
  padding: 6px;
}
.library .lib-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.library .lib-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.library .lib-card-title { font-size: 15px; font-weight: 700; letter-spacing: -0.005em; margin: 0 0 4px; color: var(--text); }
.library .lib-card-sub { font-size: 12px; color: var(--text-3); margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
.library .lib-card-desc {
  font-size: 13px; color: var(--text-2); line-height: 1.45; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.library .lib-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-3);
  flex-wrap: wrap; gap: 8px;
}

.library .lib-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.library .lib-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em;
  padding: 3px 7px; border-radius: 5px;
  background: rgba(255, 255, 255, 0.04); color: var(--text-2);
  border: 1px solid var(--line);
}
.library .lib-badge.verified { background: rgba(76, 175, 122, 0.10); color: var(--green); border-color: rgba(76, 175, 122, 0.25); }
.library .lib-badge.free { background: rgba(58, 143, 219, 0.10); color: var(--blue); border-color: rgba(58, 143, 219, 0.25); }
.library .lib-badge.paid { background: rgba(233, 185, 73, 0.10); color: var(--yellow); border-color: rgba(233, 185, 73, 0.25); }
.library .lib-badge.enterprise { background: rgba(138, 110, 240, 0.12); color: var(--violet); border-color: rgba(138, 110, 240, 0.28); }
.library .lib-badge.type { background: rgba(244, 116, 33, 0.10); color: var(--orange); border-color: rgba(244, 116, 33, 0.22); }
.library .lib-stars { display: inline-flex; align-items: center; gap: 4px; color: var(--yellow); font-weight: 600; }
.library .lib-stars span { color: var(--text-2); font-weight: 500; }
.library .lib-installs { display: inline-flex; align-items: center; gap: 4px; }

.library .lib-empty {
  grid-column: 1 / -1; padding: 60px 20px; text-align: center;
  color: var(--text-3); border: 1px dashed var(--line-2); border-radius: 12px;
}

/* ---------- Partner CTA strip ---------- */
.library .lib-partner-cta {
  margin-top: 40px; padding: 28px;
  border-radius: 14px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(244, 116, 33, 0.06) 0%, transparent 100%);
}
.library .lib-partner-cta-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.library .lib-partner-cta-text { flex: 1; min-width: 280px; }
.library .lib-partner-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--orange); margin-bottom: 8px;
}
.library .lib-partner-cta-text h3 {
  margin: 0 0 6px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text);
}
.library .lib-partner-cta-text p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }

/* ---------- Submit modal (stub) ---------- */
.library .lib-modal-bg {
  /* The site's `body header` rule sets z-index: 10000 !important on the
     sticky nav, so anything visually competing with the header has to
     go above 10000 AND use !important. Modals win, header loses. */
  position: fixed; inset: 0; z-index: 100000 !important;
  background: rgba(17, 24, 39, 0.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  padding: 28px;
}
.library .lib-modal-bg.open { display: flex; }
.library .lib-modal {
  width: 100%; max-width: 560px; max-height: 90vh; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px;
  display: flex; flex-direction: column;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.25);
}
.library .lib-modal-head {
  padding: 22px 26px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
}
.library .lib-modal-head h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.library .lib-modal-head .sub { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.library .lib-modal-close {
  margin-left: auto; width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text-2);
  cursor: pointer; display: grid; place-items: center;
}
.library .lib-modal-close:hover { color: var(--text); border-color: var(--line-2); }
.library .lib-modal-body { padding: 28px; overflow-y: auto; flex: 1; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.library .lib-modal-body strong { color: var(--text); }
.library .lib-modal-foot {
  padding: 16px 26px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  background: var(--bg-2);
}

/* ---------- Detail modal (per-SmartApp drill-down) ---------- */
.library .lib-detail-modal-bg {
  /* +1 above .lib-modal-bg so the detail modal sits on top if a user has
     both open at once (rare but possible — submit then click a card). */
  position: fixed; inset: 0; z-index: 100001 !important;
  background: rgba(17, 24, 39, 0.55);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  padding: 28px;
}
.library .lib-detail-modal-bg.open { display: flex; }

.library .lib-detail-modal {
  position: relative;
  width: min(1200px, 96vw);
  height: min(720px, 90vh);
  background: #FFFFFF;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.35);
}

.library .lib-detail-close {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  color: var(--text-2);
  cursor: pointer;
  display: grid; place-items: center;
  transition: color .15s, border-color .15s, background .15s;
}
.library .lib-detail-close:hover { color: var(--text); border-color: var(--line-2); background: #FFFFFF; }

/* ----- Left pane: dark navy info column ----- */
.library .lib-detail-left {
  flex: 0 0 38%;
  background: #1A2230;
  color: #F5F5F7;
  padding: 36px 32px;
  overflow-y: auto;
  position: relative;
  background-image:
    radial-gradient(600px 400px at 20% 100%, rgba(244, 116, 33, 0.10), transparent 60%),
    linear-gradient(180deg, #1F2A3B 0%, #131A25 100%);
}

.library .lib-detail-header {
  display: flex; align-items: center; gap: 18px;
  margin-bottom: 28px;
}
.library .lib-detail-icon {
  width: 64px; height: 64px; border-radius: 14px;
  background: #FFFFFF;
  display: grid; place-items: center;
  padding: 8px; flex-shrink: 0;
  box-shadow: 0 6px 14px -4px rgba(0, 0, 0, 0.3);
}
.library .lib-detail-icon img { width: 100%; height: 100%; object-fit: contain; }
.library .lib-detail-icon svg { width: 36px; height: 36px; }
.library .lib-detail-title {
  font-size: 26px; font-weight: 700; letter-spacing: -0.015em;
  margin: 0; color: #FFFFFF;
}

.library .lib-detail-meta { margin-bottom: 28px; display: grid; gap: 18px; }
.library .lib-detail-meta-row {
  display: grid; gap: 4px;
}
.library .lib-detail-meta-label {
  font-size: 13px; font-weight: 700; color: #FFFFFF;
}
.library .lib-detail-meta-value {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13.5px; color: rgba(245, 245, 247, 0.78);
  line-height: 1.45;
}
.library .lib-detail-meta-value svg {
  width: 18px; height: 18px; flex-shrink: 0; color: rgba(245, 245, 247, 0.55); margin-top: 1px;
}
.library .lib-detail-meta-row.tier {
  display: flex; align-items: center; gap: 10px;
  position: relative;            /* anchors .lib-bundle-popup */
}
.library .lib-detail-meta-row.tier[data-action="hover-bundle"] {
  cursor: default;               /* signals "interactive" without being a link */
}
.library .lib-detail-meta-row.tier svg {
  width: 22px; height: 22px; color: #5BA9FF;
}
.library .lib-detail-meta-row.tier .tier-label {
  font-size: 15px; font-weight: 600; color: #5BA9FF;
  border-bottom: 1px dashed rgba(91, 169, 255, 0.45);
}

/* ---------- Bundle popup (Reports / Dashboards / Configurable Lists) ---------- */
/* Drops down underneath the "Included" row. Stays inside the left column so
   it can't overflow into the right (screenshot) pane and trigger a horizontal
   scroll on the modal. */
.library .lib-bundle-popup {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  width: max-content;            /* shrink to content; bounded by max-width */
  min-width: 240px;
  max-width: min(360px, 100%);   /* never wider than the left column */
  max-height: 60vh;
  overflow-y: auto;
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(20, 26, 38, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.55);
  color: #F5F5F7;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 13px;
  z-index: 5;
  opacity: 0; visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility .15s;
  pointer-events: none;
}
.library .lib-bundle-popup.open {
  opacity: 1; visibility: visible;
  transform: translateY(0);
  pointer-events: auto;          /* user can mouse over the popup itself */
}
/* Little arrow pointing up at the trigger row */
.library .lib-bundle-popup::before {
  content: "";
  position: absolute;
  top: -7px; left: 22px;
  width: 12px; height: 12px;
  background: rgba(20, 26, 38, 0.96);
  border-left: 1px solid rgba(255, 255, 255, 0.10);
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  transform: rotate(45deg);
}
.library .lib-bundle-head {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 12px;
}
.library .lib-bundle-section + .lib-bundle-section {
  margin-top: 14px;
}
.library .lib-bundle-section h4 {
  margin: 0 0 6px;
  font-size: 13px; font-weight: 700; color: #FFFFFF;
}
.library .lib-bundle-section ul {
  list-style: none; margin: 0; padding: 0;
}
.library .lib-bundle-section li {
  font-size: 13px; color: rgba(245, 245, 247, 0.84);
  padding: 3px 0;
  line-height: 1.4;
}
.library .lib-bundle-section li::before {
  content: "·"; color: var(--orange); margin-right: 8px; font-weight: 800;
}
.library .lib-bundle-loading,
.library .lib-bundle-empty {
  font-size: 13px; color: rgba(245, 245, 247, 0.72);
  text-align: center; padding: 12px 0;
}

.library .lib-detail-section h3 {
  margin: 0 0 8px; font-size: 14px; font-weight: 700; color: #FFFFFF;
}
.library .lib-detail-section p {
  margin: 0 0 14px; font-size: 14px; line-height: 1.6;
  color: rgba(245, 245, 247, 0.84);
}

/* ----- Install button (iframe mode only) -----
   Rendered inside the dark left pane of the detail modal when the
   embedder passed both ?zone and ?projectid. Click POSTs to
   central.<env>/api/Project/<id>/apps/install. */
.library .lib-detail-install-wrap {
  margin-top: 22px;
}
.library .lib-detail-install {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 22px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: #fff;
  background: var(--orange); border: 1px solid var(--orange);
  cursor: pointer; user-select: none;
  transition: background-color .15s, border-color .15s, opacity .15s;
}
.library .lib-detail-install:hover { background: var(--orange-2); border-color: var(--orange-2); }
.library .lib-detail-install.installing { cursor: progress; opacity: 0.85; }
.library .lib-detail-install.installed,
.library .lib-detail-install.installed:hover {
  background: #A9A9A9; border-color: #A9A9A9; cursor: default;
}
.library .lib-detail-install .install-spinner {
  display: none;            /* shown via inline style during the POST */
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lib-install-spin 0.7s linear infinite;
}
@keyframes lib-install-spin { to { transform: rotate(360deg); } }

/* ----- Right pane: white, device tabs + screenshot stage ----- */
.library .lib-detail-right {
  flex: 1;
  background: #FFFFFF;
  display: flex; flex-direction: column;
  min-width: 0;
}

.library .lib-detail-tabs {
  display: flex; gap: 0;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  margin-top: 8px;
}
.library .lib-detail-tab {
  appearance: none; -webkit-appearance: none;
  background: transparent; border: none; outline: none;
  font: inherit; cursor: pointer;
  padding: 18px 22px; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; color: var(--text-2);
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s;
}
.library .lib-detail-tab:hover { color: var(--text); }
.library .lib-detail-tab.active {
  color: #2563EB;
  border-bottom-color: #2563EB;
}
.library .lib-detail-tab.disabled {
  color: var(--text-3); cursor: not-allowed; opacity: 0.5;
}
.library .lib-detail-tab svg { width: 18px; height: 18px; }

.library .lib-detail-stage {
  flex: 1;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 36px 56px;
  overflow: hidden;
}
.library .lib-detail-image-wrap {
  max-width: 100%; max-height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.library .lib-detail-image-wrap img {
  max-width: 100%; max-height: 60vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.18);
}
.library .lib-detail-empty {
  color: var(--text-3); font-size: 14px; text-align: center;
  padding: 40px 20px;
}
.library .lib-detail-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid var(--line);
  color: var(--text-2);
  display: grid; place-items: center;
  cursor: pointer;
  transition: color .15s, border-color .15s, box-shadow .15s;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
}
.library .lib-detail-nav:hover { color: var(--text); border-color: var(--line-2); box-shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.12); }
.library .lib-detail-nav.prev { left: 12px; }
.library .lib-detail-nav.next { right: 12px; }
.library .lib-detail-nav svg { width: 20px; height: 20px; }
.library .lib-detail-nav.hidden { display: none; }

.library .lib-detail-counter {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--text-3);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  padding: 3px 10px; border-radius: 999px;
}

/* PlayIt — iframe takes the full stage; small floating "open in new tab" pill */
.library .lib-detail-stage-iframe {
  padding: 0;
  background: var(--bg);
}
.library .lib-detail-iframe {
  width: 100%; height: 100%;
  border: 0; display: block;
  background: #FFFFFF;
}
.library .lib-detail-newtab {
  position: absolute; top: 12px; right: 56px; z-index: 1;
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 999px;
  text-decoration: none;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transition: color .15s, border-color .15s, background .15s;
}
.library .lib-detail-newtab:hover {
  color: var(--text); border-color: var(--line-2); background: #FFFFFF;
}

/* Cards become click targets only on the smartapps tab where details exist */
.library .lib-card[data-clickable="true"] { cursor: pointer; }
.library .lib-card[data-clickable="false"] { cursor: default; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .library .lib-showcase { grid-template-columns: repeat(2, 1fr); }
  .library .lib-content { grid-template-columns: 1fr; }
  .library .lib-sidebar { position: static; }
}
@media (max-width: 920px) {
  .library .lib-detail-modal { flex-direction: column; height: min(92vh, 920px); }
  .library .lib-detail-left { flex: 0 0 auto; max-height: 40%; }
}
@media (max-width: 720px) {
  .library .lib-grid { grid-template-columns: 1fr; }
  .library .lib-hero-title { font-size: 38px; }
}

/* Density toggle (kept for parity with mockup; flipped via body[data-density]) */
.library[data-density="compact"] .lib-card { padding: 14px; min-height: 110px; }
.library[data-density="compact"] .lib-card-desc { display: none; }
.library[data-density="compact"] .lib-card-footer { padding-top: 10px; margin-top: 8px; }
