:root {
  --bg: #ffffff;
  --bg-soft: #fafbfc;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e5e7eb;
  --border-soft: #f1f5f9;
  --brand: #0f172a;
  --brand-accent: #64748b;
  --brand-soft: #f8fafc;
  --brand-dark: #0f172a;
  --heading-weight: 700;
  --heading-letter: -0.02em;
  --radius: 12px;
  --radius-lg: 20px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =============== TOP BAR =============== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-soft);
}
.tb-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 16px 28px;
  display: flex; align-items: center; gap: 20px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  font-weight: 700; font-size: 14px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
}
.logo-swatch {
  height: 26px; width: auto;
  object-fit: contain;
  display: block;
}
.tb-crumb {
  flex: 1;
  font-size: 13px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
}
.tb-crumb a {
  color: var(--text-muted);
  text-decoration: none;
}
.tb-crumb a:hover { color: var(--text); }
.tb-crumb .sep { opacity: 0.5; }

/* Top brand switcher (always visible) */
.tb-brands {
  flex: 1;
  display: flex; align-items: center; gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tb-brands::-webkit-scrollbar { display: none; }
.tb-brands a {
  padding: 7px 14px;
  font-size: 13px; font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 100px;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.tb-brands a:hover { background: var(--bg-soft); color: var(--text); }
.tb-brands a.active { background: var(--brand); color: #fff; }
.tb-brands a.home { font-weight: 500; }
body.search-mode .tb-brands { display: none; }
.tb-search {
  position: relative; min-width: 260px;
}
.tb-search input {
  width: 100%; padding: 9px 14px 9px 36px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  transition: all .15s;
}
.tb-search input:focus {
  outline: none;
  background: white;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15,23,42,0.08);
}
.tb-search svg {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); width: 14px; height: 14px;
  color: var(--text-light);
}
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all .15s;
}
.back-btn:hover { background: var(--bg-soft); color: var(--text); }

/* =============== LANDING (BRAND PICKER) =============== */
.view { display: none; }
.view.active { display: block; }

.landing-hero {
  padding: 80px 28px 50px;
  text-align: center;
}
.landing-hero .eyebrow {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.landing-hero h1 {
  font-size: clamp(38px, 5.5vw, 64px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 18px;
  color: var(--text);
}
.landing-hero p {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto 40px;
}

.brand-stats {
  display: flex; justify-content: center; gap: 48px;
  flex-wrap: wrap;
  padding: 30px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  max-width: 700px;
  margin: 0 auto;
}
.brand-stats .stat .n {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand-stats .stat .l {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-top: 4px;
}

.brand-picker-wrap {
  max-width: 1400px; margin: 0 auto;
  padding: 60px 28px 100px;
}
.bp-label {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 24px;
  text-align: center;
}
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.brand-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px;
  min-height: 280px;
  border: 1px solid transparent;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
  isolation: isolate;
}
.brand-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
}
.brand-card::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  transition: transform .35s;
}
.brand-card:hover::before { transform: scale(1.04); }
.bc-ngp::before { background: linear-gradient(135deg, #003DA5, #FF6B35); }
.bc-cv::before  { background: linear-gradient(135deg, #02274C, #04499C 50%, #00D6AE); }
.bc-gpg::before { background: linear-gradient(135deg, #C8117E, #84207E 33%, #3A3C8D 66%, #1397D4); }
.bc-ef::before  { background: linear-gradient(135deg, #002654, #ED2939); }
.bc-shared::before { background: linear-gradient(135deg, #1F2937, #6B7280); }
.bc-top {
  display: flex; justify-content: space-between; align-items: flex-start;
}
.bc-count {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  background: rgba(255,255,255,0.2);
  padding: 5px 12px;
  border-radius: 100px;
  backdrop-filter: blur(10px);
}
.bc-arrow {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  transition: all .25s;
}
.brand-card:hover .bc-arrow {
  background: white; color: #0f172a;
  transform: rotate(-45deg);
}
.bc-bottom .bc-name {
  font-size: 32px; font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 6px;
}
.bc-tag {
  font-size: 13px; opacity: 0.85;
  font-weight: 500;
}

/* =============== BRAND VIEW =============== */
.brand-hero {
  padding: 60px 28px 50px;
  background: var(--brand-soft);
  border-bottom: 1px solid var(--border);
}
.bh-inner {
  max-width: 1400px; margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
}
@media (max-width: 700px) { .bh-inner { grid-template-columns: 1fr; } }

.bh-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  background: var(--brand);
  color: white;
  border-radius: 14px;
  font-weight: 800; font-size: 18px;
  letter-spacing: -0.02em;
  margin-bottom: 22px;
}
.bh-eyebrow {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--brand-accent);
  margin-bottom: 12px;
}
.bh-title {
  font-family: var(--heading-font, inherit);
  font-size: clamp(40px, 5.5vw, 64px);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-letter);
  line-height: 1;
  color: var(--brand-dark);
  margin-bottom: 14px;
}
.bh-tag {
  font-size: 17px; color: var(--text-muted);
  max-width: 540px;
}
.bh-counter {
  display: flex; gap: 28px;
}
.bh-counter .stat .n {
  font-size: 32px; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand);
  display: block;
}
.bh-counter .stat .l {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-top: 4px;
}

/* Brand sidebar + content layout */
.brand-layout {
  max-width: 1400px; margin: 0 auto;
  padding: 44px 28px 100px;
  display: grid;
  grid-template-columns: 232px 1fr;
  gap: 44px;
  align-items: start;
}
.bs-side {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.bs-side a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 10px;
  transition: background .15s, color .15s;
}
.bs-side a:hover { background: var(--bg-soft); color: var(--text); }
.bs-side a.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.bs-side a .ct {
  font-size: 11px; font-weight: 600;
  color: var(--text-light);
  background: var(--border-soft);
  padding: 2px 9px;
  border-radius: 100px;
  font-variant-numeric: tabular-nums;
}
.bs-side a.active .ct { color: var(--brand); background: rgba(15,23,42,0.06); }

.brand-body { min-width: 0; }

@media (max-width: 820px) {
  .brand-layout { grid-template-columns: 1fr; gap: 18px; padding-top: 16px; }
  .bs-side {
    position: sticky; top: 60px; z-index: 20;
    flex-direction: row; gap: 4px;
    overflow-x: auto; scrollbar-width: none;
    padding: 10px 0;
    margin: 0 -4px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid var(--border-soft);
  }
  .bs-side::-webkit-scrollbar { display: none; }
  .bs-side a { white-space: nowrap; }
  .bs-side a .ct { display: none; }
}

.cat-section {
  margin-bottom: 72px;
  scroll-margin-top: 130px;
}
.cat-section:last-child { margin-bottom: 0; }

.cat-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.cat-header-l {
  display: flex; align-items: baseline; gap: 14px;
}
.cat-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.cat-header .cat-count {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.cat-header .cat-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 380px;
  text-align: right;
}

.sub-group { margin-bottom: 48px; }
.sub-group:last-child { margin-bottom: 0; }
.sub-group h4 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-bottom: 18px;
  padding-bottom: 11px;
  border-bottom: 2px solid var(--border);
}
.sub-group h4::before {
  content: '';
  width: 4px; height: 15px;
  border-radius: 2px;
  background: var(--brand);
  flex: none;
}

/* =============== GRIDS =============== */
.grid {
  display: grid;
  gap: 16px;
}
.grid.cols-1 { grid-template-columns: 1fr; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.grid.cols-6 { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

/* Feature card (brand guidelines hero) */
.feature {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: white;
  padding: 36px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--brand);
  transition: transform .25s, box-shadow .25s;
  isolation: isolate;
}
.feature::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}
.feature:hover { transform: translateY(-4px); box-shadow: 0 20px 50px rgba(0,0,0,0.18); }
.feature .ft-eyebrow {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  opacity: 0.8;
  margin-bottom: 12px;
}
.feature .ft-title {
  font-size: 26px;
  font-family: var(--heading-font, inherit);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-letter);
  line-height: 1.1;
  margin-bottom: 10px;
}
.feature .ft-desc {
  font-size: 14px; opacity: 0.85;
  line-height: 1.55;
  max-width: 380px;
}
.feature .ft-cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: white; color: var(--brand-dark);
  font-size: 13px; font-weight: 600;
  padding: 10px 18px;
  border-radius: 100px;
  align-self: flex-start;
  margin-top: 18px;
  transition: transform .2s;
}
.feature:hover .ft-cta { transform: translateX(4px); }

/* Asset card */
.asset {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.asset:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.08);
  border-color: var(--brand);
}
.asset-thumb {
  aspect-ratio: 4 / 3;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.asset-thumb img,
.asset-thumb video {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 12px;
}
.asset.cover .asset-thumb img,
.asset.cover .asset-thumb video { object-fit: cover; padding: 0; }
.asset.on-dark .asset-thumb { background: #0f172a; }

/* Office first-page thumbnails from Graph: Margot's paper-mat treatment
   (DocumentAssetCard.vue:221-257 + global.css --thumb-mat/--thumb-image-filter),
   expressed with this portal's own tokens. */
.asset-thumb.has-office-thumb {
  background: color-mix(in srgb, var(--text) 4%, var(--bg));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 55%, transparent);
  cursor: zoom-in;
}
.asset-thumb.has-office-thumb img {
  object-fit: contain;
  padding: 0.55rem;
  filter: drop-shadow(0 1px 4px rgb(18 29 64 / 0.16));
  transition: filter 140ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .asset:hover .asset-thumb.has-office-thumb img {
    filter: drop-shadow(0 2px 7px rgb(18 29 64 / 0.2));
  }
}
@media (prefers-reduced-motion: reduce) {
  .asset-thumb.has-office-thumb img { transition: none; }
}

/* Document thumb design */
.doc-thumb {
  width: 100%; height: 100%;
  background: linear-gradient(180deg, var(--brand-soft) 0%, white 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.doc-thumb .paper {
  position: relative;
  width: 56%; height: 78%;
  background: white;
  box-shadow: 0 6px 18px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.06);
  border-radius: 3px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.doc-thumb .paper::before {
  content: ''; position: absolute; top: 0; right: 0;
  width: 18px; height: 18px;
  background: linear-gradient(225deg, #e2e8f0 50%, transparent 50%);
  border-bottom-left-radius: 3px;
}
.doc-thumb .paper-bar {
  display: block; height: 3px;
  background: var(--brand);
  opacity: 0.6;
  border-radius: 2px;
  margin-bottom: 4px;
}
.doc-thumb .paper-bar.bar-title {
  height: 4px;
  opacity: 1;
  width: 70%;
  background: var(--brand);
}
.doc-thumb .paper-bar.bar-line {
  width: 100%;
  background: #cbd5e1;
  opacity: 0.6;
  height: 2px;
}
.doc-thumb .paper-bar.short { width: 60%; }
.doc-thumb .paper-bar.med   { width: 85%; }
.doc-thumb .paper-ext {
  position: absolute; bottom: 8px; right: 8px;
  font-size: 8px; font-weight: 800;
  letter-spacing: 0.04em;
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
}
.paper-ext.pdf  { background: #DC2626; }
.paper-ext.docx { background: #2563EB; }
.paper-ext.doc  { background: #2563EB; }
.paper-ext.pptx { background: #EA580C; }
.paper-ext.ppt  { background: #EA580C; }
.paper-ext.xlsx { background: #16A34A; }
.paper-ext.ai   { background: #F59E0B; color: #1f2937; }
.paper-ext.eps  { background: #EAB308; color: #1f2937; }
.paper-ext.zip  { background: #6B7280; }
.paper-ext.default { background: #475569; }

.play-tag {
  position: absolute;
  top: 8px; left: 8px;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 7px;
  background: rgba(15,23,42,0.85);
  color: white;
  border-radius: 4px;
  backdrop-filter: blur(6px);
}

.asset-body {
  padding: 12px 14px 14px;
}
.asset-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 4px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.asset-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  display: flex; justify-content: space-between;
}
.asset-meta .ext {
  text-transform: uppercase;
  font-weight: 600;
  color: var(--brand);
}

/* Logo tile */
.logo-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: white;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.logo-tile.dark { background: #0f172a; }
.logo-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.08);
  border-color: var(--brand);
}
.logo-tile img {
  max-width: 100%; max-height: 100%; object-fit: contain;
}
.logo-tile .lcap {
  position: absolute; bottom: 10px; left: 12px;
  font-size: 9px; font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.logo-tile.dark .lcap { color: rgba(255,255,255,0.5); }

/* Empty state */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

/* Per-card preview / download actions */
.card-wrap { position: relative; }
.card-actions {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 6px;
  z-index: 6;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s;
}
.card-wrap:hover .card-actions { opacity: 1; transform: none; }
.act-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  transition: background .15s, color .15s, border-color .15s;
  padding: 0;
}
.act-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.act-btn svg { width: 15px; height: 15px; }
@media (hover: none) {
  .card-actions { opacity: 1; transform: none; }
}

/* =============== LIGHTBOX =============== */
/* Port of Margot's DocumentPreviewLightbox.vue scoped styles
   (preview-lightbox__X -> lb-X). The portal is light-themed only, so Margot's
   light-scheme token values are copied here as literals. */
.lightbox {
  --preview-stage: #fbfcff;
  --preview-panel: #ffffff;
  --preview-panel-elev: #f7f9ff;
  --preview-line: #dbe2ef;
  --preview-ink: #07143b;
  --preview-muted: #5c6478;
  --preview-blue: #3469f6;
  --preview-shadow: rgba(18,29,64,0.09);
  position: fixed;
  inset: 0;
  /* Above the sticky topbar (z-index 50) and the sticky sub-nav (20). */
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  padding: clamp(0.75rem, 3vw, 2rem);
}
/* Author-origin rule so the attribute beats `.lightbox { display: grid }`. */
.lightbox[hidden] { display: none; }
.lightbox.active { animation: lb-enter 150ms ease-out both; }
@keyframes lb-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}
.lb-panel {
  display: flex;
  flex-direction: column;
  width: min(94vw, 60rem);
  max-height: 90vh;
  overflow: hidden;
  border: 1px solid var(--preview-line);
  border-radius: 1rem;
  background: var(--preview-panel);
  box-shadow: 0 26px 60px var(--preview-shadow);
  /* Inherit the portal's Inter / Open Sans rather than Margot's stack. */
  font-family: inherit;
}
.lb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--preview-line);
  padding: 0.85rem 1rem;
}
.lb-head h2 {
  min-width: 0;
  margin: 0;
  color: var(--preview-ink);
  font-size: 14.5px;
  font-weight: 780;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.lb-close {
  flex: 0 0 auto;
  border: 1px solid var(--preview-line);
  border-radius: 0.55rem;
  background: none;
  color: var(--preview-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0.35rem 0.55rem;
}
.lb-stage {
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: color-mix(in srgb, var(--preview-stage) 80%, transparent);
  padding: 1rem;
}
.lb-stage img,
.lb-stage video {
  max-width: 100%;
  max-height: 68vh;
  object-fit: contain;
}
/* Direct child only: the office embed is nested inside .lb-office and owns its
   own absolute sizing, which this rule would otherwise out-specify. */
.lb-stage > iframe {
  width: 100%;
  height: 68vh;
  border: 0;
  background: #fff;
}
/* The office stage is a fixed-height box so the loading cover and the final
   embed occupy the same region — no reflow when the iframe reveals. */
.lb-stage--office { padding: 0; }
.lb-office {
  position: relative;
  display: flex;
  width: 100%;
  height: 68vh;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
}
.lb-office-embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.lb-office-embed.lb-embed--ready {
  opacity: 1;
  pointer-events: auto;
}
.lb-office-cover {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
  opacity: 1;
  transition: opacity 220ms ease;
}
.lb-office-cover--out { opacity: 0; }
.lb-office-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Dimmed while the embed is minting so the "Loading…" copy reads clearly. */
  opacity: 0.55;
}
/* No Graph thumbnail for this item: the card's paper placeholder stands in. */
.lb-office-paper { width: 100%; height: 100%; }
/* Centered overlay for the loading / error state, sitting on the cover without
   changing the box size. */
.lb-office-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 1rem;
  pointer-events: none;
}
.lb-office-overlay .lb-embed-cta { pointer-events: auto; }
.lb-embed-cta {
  border: 1px solid color-mix(in srgb, var(--preview-blue) 42%, var(--preview-line));
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--preview-blue) 14%, transparent);
  color: var(--preview-ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 720;
  padding: 0.45rem 0.9rem;
  transition: border-color 130ms ease, background 130ms ease;
}
.lb-embed-cta:disabled { cursor: progress; opacity: 0.6; }
.lb-embed-status,
.lb-embed-error {
  max-width: 32rem;
  margin: 0;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--preview-panel) 82%, transparent);
  color: var(--preview-ink);
  font-size: 11.5px;
  line-height: 1.4;
  padding: 0.45rem 0.75rem;
  text-align: center;
}
.lb-embed-error { color: var(--preview-muted); }
@media (hover: hover) and (pointer: fine) {
  .lb-embed-cta:not(:disabled):hover {
    border-color: color-mix(in srgb, var(--preview-blue) 60%, var(--preview-line));
    background: color-mix(in srgb, var(--preview-blue) 22%, transparent);
  }
}
.lb-foot {
  display: flex;
  gap: 0.5rem;
  border-top: 1px solid var(--preview-line);
  padding: 0.75rem 1rem;
}
.lb-action {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--preview-line);
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--preview-panel-elev) 72%, transparent);
  color: var(--preview-ink);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  text-decoration: none;
  transition: border-color 130ms ease, background 130ms ease;
}
.lb-dl-icon {
  width: 0.9rem;
  height: 0.9rem;
  flex: 0 0 auto;
}
.lb-action:disabled { cursor: not-allowed; opacity: 0.48; }
@media (hover: hover) and (pointer: fine) {
  .lb-action:not(:disabled):hover {
    border-color: color-mix(in srgb, var(--preview-blue) 42%, var(--preview-line));
    background: color-mix(in srgb, var(--preview-blue) 12%, transparent);
  }
}
/* Non-previewable types keep the existing "Open in SharePoint" card, restyled
   to sit inside the stage. */
.lb-doc {
  background: var(--preview-panel);
  border: 1px solid var(--preview-line);
  border-radius: 0.75rem;
  padding: 36px 32px;
  text-align: center;
  width: min(100%, 380px);
}
.lb-doc-ic { color: var(--preview-muted); margin-bottom: 18px; }
.lb-doc-ic svg { width: 44px; height: 44px; }
.lb-doc-name { font-size: 15px; font-weight: 700; color: var(--preview-ink); word-break: break-word; margin-bottom: 8px; }
.lb-doc-sub { font-size: 12.5px; color: var(--preview-muted); margin-bottom: 22px; }
.lb-doc-btn {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--preview-blue) 42%, var(--preview-line));
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--preview-blue) 14%, transparent);
  color: var(--preview-ink);
  font-size: 11.5px; font-weight: 700;
  text-decoration: none;
}
.lb-doc-btn:hover { opacity: 0.9; }
@media (prefers-reduced-motion: reduce) {
  .lightbox.active { animation: none; }
  .lb-office-embed,
  .lb-office-cover,
  .lb-embed-cta,
  .lb-action { transition: none; }
}

/* Footer */
footer {
  border-top: 1px solid var(--border-soft);
  padding: 32px 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* Search results inside brand view (filters bento) */
.search-results-view {
  display: none;
  padding: 80px 28px;
  max-width: 1400px;
  margin: 0 auto;
}
body.search-mode .view.active { display: none; }
body.search-mode .search-results-view { display: block; }
body.search-mode .topbar .tb-crumb { display: none; }
.sr-title {
  font-size: 24px; font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

/* =============== ASSET SOURCE (LOCAL / SHAREPOINT) =============== */
.tb-source {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.tb-source-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-light);
  white-space: nowrap;
}
.tb-source-toggle {
  display: flex;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px;
}
.tb-source-toggle button {
  border: none; background: transparent;
  font-family: inherit;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.tb-source-toggle button:hover { color: var(--text); }
.tb-source-toggle button.active {
  background: var(--brand);
  color: #fff;
}
.tb-source-settings {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.tb-source-settings:hover { border-color: var(--brand); color: var(--text); }
.tb-source-settings svg { width: 16px; height: 16px; }
.tb-source-pill {
  font-size: 11px; font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 4px 10px;
  border-radius: 100px;
  max-width: 180px;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
  display: none;
}
body.source-sharepoint .tb-source-pill { display: block; }
body.source-sharepoint .tb-search { min-width: 200px; }

.source-modal {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(4px);
}
.source-modal.active { display: flex; }
.source-modal-panel {
  width: min(520px, 100%);
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(15,23,42,0.18);
  padding: 28px;
}
.source-modal-panel h3 {
  font-size: 18px; font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.source-modal-panel .hint {
  font-size: 13px; color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 20px;
}
.source-field { margin-bottom: 16px; }
.source-field label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.source-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.source-field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15,23,42,0.08);
}
.source-actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 22px;
}
.source-actions .btn {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
}
.source-actions .btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.source-actions .btn-link {
  border: none;
  background: transparent;
  color: var(--brand);
  text-decoration: none;
  padding: 10px 0;
}
.source-banner {
  display: none;
  max-width: 1400px; margin: 0 auto;
  padding: 10px 28px 0;
  font-size: 12px; color: var(--text-muted);
}
body.source-sharepoint .source-banner { display: block; }
.source-banner a { color: var(--brand); font-weight: 600; }

/* Pre-sign-in auth CTA (inside landing hero) */
.auth-cta {
  margin: 0 auto 32px;
  max-width: 420px;
}
.btn-signin-ms {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15,23,42,0.06);
  transition: border-color .2s, box-shadow .2s, transform .15s;
}
.btn-signin-ms:hover {
  border-color: #8c8c8c;
  box-shadow: 0 8px 24px rgba(15,23,42,0.1);
  transform: translateY(-1px);
}
.btn-signin-ms:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-signin-ms .ms-logo { width: 20px; height: 20px; flex-shrink: 0; }
.auth-note {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 14px;
  line-height: 1.5;
}
.auth-error {
  margin-top: 14px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.45;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  text-align: left;
}
body.portal-ready .auth-cta { display: none !important; }
body.pre-auth #view-landing { display: block !important; }
body.pre-auth .landing-hero {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 55%);
}
.brand-card-teaser { opacity: 0.92; }
.brand-card-teaser:hover { opacity: 1; }

/* Loading overlay */
.load-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(6px);
}
.load-overlay[hidden] { display: none !important; }
.load-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 24px 64px rgba(15,23,42,0.2);
  text-align: center;
}
.load-spinner {
  width: 40px; height: 40px;
  margin: 0 auto 20px;
  border: 3px solid var(--border-soft);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: load-spin 0.75s linear infinite;
}
@keyframes load-spin { to { transform: rotate(360deg); } }
.load-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.load-detail {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.45;
}
.load-track {
  height: 6px;
  background: var(--border-soft);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 20px;
}
.load-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #003DA5, #84207E);
  border-radius: inherit;
  transition: width 0.35s ease;
}
.load-steps {
  list-style: none;
  text-align: left;
  font-size: 12px;
  color: var(--text-light);
  margin: 0 0 12px;
  padding: 0;
}
.load-steps li {
  padding: 6px 0 6px 22px;
  position: relative;
}
.load-steps li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #fff;
}
.load-steps li.active { color: var(--text); font-weight: 600; }
.load-steps li.active::before { border-color: var(--brand); background: var(--brand-soft); }
.load-steps li.done { color: var(--text-muted); }
.load-steps li.done::before {
  border-color: #22c55e;
  background: #22c55e;
  box-shadow: inset 0 0 0 2px #fff;
}
.load-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  min-height: 18px;
}

.live-status {
  max-width: 1400px; margin: 0 auto; padding: 8px 28px;
  font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.live-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.live-status .dot.pending { background: #f59e0b; }
.live-status .dot.err { background: #ef4444; }
.live-loading {
  text-align: center; padding: 60px 28px; color: var(--text-muted);
}
body:not(.portal-ready) #view-brand,
body:not(.portal-ready) .search-results-view,
body:not(.portal-ready) .live-status,
body:not(.portal-ready) .tb-brands,
body:not(.portal-ready) .tb-search,
body:not(.portal-ready) #btnRescan,
body:not(.portal-ready) #btnSignOut { display: none !important; }
body.pre-auth .auth-cta { display: block !important; }
body.pre-auth .auth-cta[hidden] { display: none !important; }
.tb-live-actions { display: flex; gap: 8px; flex-shrink: 0; }
.tb-live-actions button {
  padding: 8px 14px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 8px;
  background: white; font-family: inherit; cursor: pointer;
}
.tb-live-actions button:hover { border-color: var(--brand); }
