/* Pizzafredag DAM — stylesheet */
:root {
  --pf-red: #D7263D;
  --pf-red-deep: #8B1E2C;
  --pf-yellow: #F4B942;
  --pf-green: #2E5339;
  --pf-cream: #FDF6E3;
  --pf-charcoal: #1A1A1A;
  --pf-crust: #E8B86D;

  --bg: #FDF6E3;
  --bg-elev: #ffffff;
  --bg-sidebar: #1A1A1A;
  --text: #1A1A1A;
  --text-soft: #5a5a5a;
  --text-muted: #8a8a8a;
  --border: #ECE3CC;
  --border-strong: #d8cdb2;
  --shadow-sm: 0 1px 2px rgba(26,26,26,0.06), 0 1px 3px rgba(26,26,26,0.04);
  --shadow-md: 0 4px 12px rgba(26,26,26,0.08), 0 2px 4px rgba(26,26,26,0.04);
  --shadow-lg: 0 24px 60px rgba(26,26,26,0.18), 0 8px 24px rgba(26,26,26,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --sidebar-w: 248px;
  --header-h: 64px;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-ui-display: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --transition: 180ms cubic-bezier(.2,.7,.3,1);
}

[data-theme="dark"] {
  --bg: #121212;
  --bg-elev: #1d1d1d;
  --bg-sidebar: #0a0a0a;
  --text: #FDF6E3;
  --text-soft: #c8c0a8;
  --text-muted: #8a8270;
  --border: #2a2a2a;
  --border-strong: #3a3a3a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* ---------- Accessibility primitives ---------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; top: -40px; left: 12px; z-index: 1000;
  background: var(--pf-charcoal); color: #FDF6E3;
  padding: 10px 16px; border-radius: 0 0 8px 8px; font-weight: 600; font-size: 14px;
  text-decoration: none;
}
.skip-link:focus { top: 0; outline: 3px solid var(--pf-yellow); outline-offset: 0; }

/* Visible focus rings for keyboard users — pure-mouse focus stays clean.
   Browsers that don't support :focus-visible fall back to :focus. */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
[role="button"]:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--pf-yellow);
  outline-offset: 2px;
  border-radius: 4px;
}
.card:focus-visible { outline: 3px solid var(--pf-yellow); outline-offset: 2px; }
/* Suppress the default focus ring inside the header search (uses its own glow) */
.header .search input:focus-visible { outline: none; }

/* Respect users who prefer reduced motion: disable big movement, keep cross-fades. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .card:hover { transform: none !important; }
  .card:hover .thumb img, .card:hover .thumb svg { transform: none !important; }
  .collection-card:hover { transform: none !important; }
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Login overlay (mock auth for external partners) ---------- */
.login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, var(--login-bg-start, #D7263D) 0%, var(--login-bg-end, #8B1E2C) 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px;
}
.login-card {
  background: var(--login-card-bg, var(--bg-elev));
  color: var(--login-card-text, var(--text));
  border-radius: var(--radius-lg);
  padding: 48px 40px; max-width: 440px; width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo { width: 80px; margin-bottom: 16px; }
.login-card h1 {
  font-family: var(--font-display); font-size: 32px; font-weight: 700;
  margin: 0 0 8px; letter-spacing: -0.5px;
  color: var(--login-card-text, var(--text));
}
.login-card .tagline { color: var(--login-card-text, var(--text-soft)); opacity: 0.7; margin: 0 0 32px; font-size: 14px; letter-spacing: 3px; text-transform: uppercase; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form input {
  width: 100%; padding: 14px 16px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 15px;
  background: var(--bg); color: var(--text); font-family: inherit;
  transition: border-color var(--transition);
}
.login-form input:focus { outline: none; border-color: var(--pf-red); }
.login-form button {
  background: var(--login-btn-bg, var(--pf-red));
  color: var(--login-btn-text, #fff);
  border: none; padding: 14px;
  border-radius: var(--radius-sm); font-size: 15px; font-weight: 600;
  transition: filter var(--transition), transform var(--transition);
}
.login-form button:hover { filter: brightness(0.92); transform: translateY(-1px); }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-muted); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.guest-btn {
  background: transparent; color: var(--text); border: 1px solid var(--border-strong);
  padding: 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  width: 100%; transition: background var(--transition);
}
.guest-btn:hover { background: var(--bg); }
.login-help { font-size: 12px; color: var(--text-muted); margin-top: 16px; }

/* ---------- App shell ---------- */
.app { display: none; min-height: 100vh; }
.app.is-active { display: block; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--bg-sidebar); color: #FDF6E3;
  padding: 24px 16px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 10;
}
.brand-switcher-wrap { position: relative; margin: -8px -8px 12px; padding: 0 8px; }
.brand-switcher { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 10px 12px; color: inherit; font-family: var(--font-ui-display); font-size: 13px; font-weight: 600; cursor: pointer; transition: background var(--transition); }
.brand-switcher:hover { background: rgba(255,255,255,0.1); }
.brand-switcher-menu { position: absolute; top: 100%; left: 8px; right: 8px; margin-top: 6px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); padding: 4px; z-index: 12; overflow: hidden; }
.brand-menu-item { display: block; width: 100%; text-align: left; background: transparent; border: none; color: var(--text); font-family: inherit; font-size: 13px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.brand-menu-item:hover { background: var(--bg); }
.brand-menu-item.active { color: var(--pf-red); font-weight: 600; }

/* ---- Modern brand access picker (used in user & invite-code forms) ---- */
.brand-picker {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-elev); padding: 10px; margin-bottom: 4px;
}
.brand-picker-mode {
  display: flex; gap: 4px; padding: 3px;
  background: var(--bg); border-radius: 999px;
  border: 1px solid var(--border);
}
.brand-picker-mode button {
  flex: 1; padding: 8px 12px; border: none; background: transparent;
  color: var(--text-soft); font-family: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer; border-radius: 999px;
  transition: background var(--transition), color var(--transition);
}
.brand-picker-mode button.active {
  background: var(--pf-red); color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.brand-picker-mode button:not(.active):hover {
  color: var(--text); background: rgba(0,0,0,0.04);
}
[data-theme="dark"] .brand-picker-mode button:not(.active):hover {
  background: rgba(255,255,255,0.04);
}
.brand-picker-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px 2px 2px;
}
.brand-picker-chips.is-disabled { opacity: 0.4; pointer-events: none; }
.brand-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; user-select: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.brand-chip:hover { border-color: var(--pf-red); }
.brand-chip.selected {
  background: var(--pf-red); color: #fff;
  border-color: var(--pf-red);
}
.brand-chip.selected::before {
  content: "✓"; font-weight: 700; font-size: 11px;
}
.brand-chip .brand-chip-tag {
  font-size: 10px; opacity: 0.6; text-transform: uppercase;
  letter-spacing: 0.5px;
}
.brand-picker-hint {
  font-size: 12px; color: var(--text-muted); margin: 0;
  padding: 0 2px;
}

/* ---- Access matrix (who can see which brand) ---- */
.access-matrix-wrap {
  border: 1px solid var(--border); border-radius: 12px;
  overflow: auto; background: var(--bg-elev);
}
.access-matrix { border-collapse: collapse; width: 100%; font-size: 13px; }
.access-matrix thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-elev); padding: 12px 10px;
  font-weight: 600; text-align: left; font-size: 12px;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text-soft); border-bottom: 1px solid var(--border);
}
.access-matrix .matrix-name-head { min-width: 220px; }
.access-matrix .matrix-brand-head {
  text-align: center; min-width: 92px; font-size: 11px;
  white-space: nowrap;
}
.access-matrix tbody td {
  padding: 10px 10px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.access-matrix .matrix-name { min-width: 220px; }
.access-matrix tr:last-child td { border-bottom: none; }
.access-matrix .matrix-group-head td {
  background: var(--bg);
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-muted);
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.access-matrix .matrix-cell {
  text-align: center; font-weight: 700; font-size: 16px;
  min-width: 92px;
}
.access-matrix .matrix-cell.has { color: var(--pf-red); }
.access-matrix .matrix-cell.no  { color: var(--text-muted); opacity: 0.4; }
.access-matrix tbody tr:hover td:not(.matrix-group-head td) { background: rgba(0,0,0,0.02); }
[data-theme="dark"] .access-matrix tbody tr:hover td:not(.matrix-group-head td) { background: rgba(255,255,255,0.02); }
.matrix-legend-check { color: var(--pf-red); font-weight: 700; font-size: 15px; }
.matrix-legend-no    { color: var(--text-muted); opacity: 0.4; font-weight: 700; font-size: 15px; }

/* ---- Role capabilities card ---- */
.role-caps-card {
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-elev); overflow: hidden;
}
.role-caps-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.role-caps-head h3 { margin: 0; font-family: var(--font-display); font-size: 16px; }
.role-caps-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.role-caps-table thead th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--text-muted); text-transform: uppercase;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.role-caps-table thead th:nth-child(n+2) { text-align: center; width: 96px; }
.role-caps-table tbody td {
  padding: 9px 14px; border-bottom: 1px solid var(--border);
}
.role-caps-table tbody tr:last-child td { border-bottom: none; }
.role-caps-table .role-label { color: var(--text); }
.role-caps-table .role-cell { text-align: center; font-weight: 700; font-size: 15px; }
.role-caps-table .role-cell.yes { color: var(--pf-red); }
.role-caps-table .role-cell.no { color: var(--text-muted); opacity: 0.35; }
.role-caps-table tbody tr:hover td { background: rgba(0,0,0,0.02); }
[data-theme="dark"] .role-caps-table tbody tr:hover td { background: rgba(255,255,255,0.02); }

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 12px; }
.brand img { width: 36px; height: 36px; border-radius: 8px; }
.brand-name { font-family: var(--font-ui-display); font-size: 19px; font-weight: 700; letter-spacing: -0.4px; }
.brand-sub { font-size: 10px; letter-spacing: 3px; opacity: 0.6; font-family: var(--font-ui-display); font-weight: 500; }

.nav-section { margin-top: 12px; }
.nav-label { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; opacity: 0.5; padding: 8px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: rgba(253,246,227,0.78); font-size: 14px;
  transition: background var(--transition), color var(--transition);
  cursor: pointer; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--pf-red); color: #fff; }
.nav-item .count { margin-left: auto; font-size: 11px; opacity: 0.65; }
.nav-item .req-badge {
  margin-left: auto; background: var(--pf-red); color: #fff;
  padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.nav-item .req-badge.is-new { animation: pulseBadge 1.6s ease-in-out 2; }
@keyframes pulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); box-shadow: 0 0 0 4px rgba(215,38,61,0.25); }
}
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 12px; opacity: 0.6; padding-left: 12px; }

/* ---------- Main area ---------- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.header {
  position: sticky; top: 0; z-index: 5;
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  background: var(--header-bg, rgba(253,246,227,0.85));
  color: var(--header-fg, var(--text));
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .header { background: var(--header-bg, rgba(18,18,18,0.85)); }

.search {
  flex: 1; max-width: 580px; position: relative;
}
.search input {
  width: 100%; padding: 10px 14px 10px 40px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text);
  font-size: 14px; font-family: inherit;
}
.search input:focus { outline: none; border-color: var(--pf-red); box-shadow: 0 0 0 3px rgba(215,38,61,0.12); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: 0.5; }
.header-spacer { flex: 1; }
.header-btn {
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all var(--transition);
}
.header-btn:hover { border-color: var(--pf-red); color: var(--pf-red); }
.header-btn.primary { background: var(--pf-red); color: #fff; border-color: var(--pf-red); }
.header-btn.primary:hover { background: var(--pf-red-deep); border-color: var(--pf-red-deep); color: #fff; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--border-strong);
  font-size: 13px; background: var(--bg-elev);
}
.user-level-pill {
  background: var(--pf-charcoal); color: #FDF6E3;
  padding: 2px 8px; border-radius: 999px; font-size: 10px;
  letter-spacing: 1px; text-transform: uppercase; font-weight: 700;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--pf-red); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}

/* ---------- Page content ---------- */
.content { padding: 28px; max-width: 1440px; margin: 0 auto; }
.hero {
  background: linear-gradient(135deg, var(--pf-red) 0%, var(--pf-red-deep) 100%);
  color: #FDF6E3; border-radius: var(--radius-lg);
  padding: 40px 44px; margin-bottom: 28px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-md);
}
.hero h1 {
  font-family: var(--font-display); font-size: 40px; margin: 0 0 8px;
  font-weight: 700; letter-spacing: -1px; position: relative;
}
.hero p { margin: 0 0 20px; opacity: 0.92; max-width: 540px; position: relative; }
.hero-stats { display: flex; gap: 32px; position: relative; }
.hero-stat .num { font-family: var(--font-display); font-size: 28px; font-weight: 700; }
.hero-stat .lbl { font-size: 11px; letter-spacing: 3px; opacity: 0.7; text-transform: uppercase; }

.section { margin-bottom: 36px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px;
}
.section-title {
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  margin: 0; letter-spacing: -0.3px;
}
.section-sub { color: var(--text-soft); font-size: 13px; margin: 0; }
.view-all { font-size: 13px; color: var(--pf-red); font-weight: 600; }

.toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 12px 0; margin-bottom: 16px; border-bottom: 1px solid var(--border);
}
.chip {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--text-soft); font-size: 13px; cursor: pointer;
  transition: all var(--transition);
}
.chip:hover { color: var(--text); border-color: var(--text-soft); }
.chip.active { background: var(--pf-charcoal); color: #FDF6E3; border-color: var(--pf-charcoal); }
.toolbar .sort { margin-left: auto; }
.sort select {
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text);
  padding: 6px 10px; border-radius: var(--radius-sm); font-size: 13px; font-family: inherit;
}

/* ---------- Asset grid ---------- */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card {
  background: var(--bg-elev); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; position: relative;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card .thumb {
  aspect-ratio: 4 / 3; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.card .thumb img, .card .thumb svg { width: 100%; height: 100%; object-fit: contain; }
.card .thumb.cover img, .card .thumb.cover svg { object-fit: cover; }
.card .meta { padding: 12px 14px; }
.card .name { font-weight: 600; font-size: 14px; margin: 0 0 2px; }
.card .info { font-size: 12px; color: var(--text-muted); }
.card .actions {
  position: absolute; top: 10px; right: 10px;
  display: flex; gap: 6px; opacity: 0; transition: opacity var(--transition);
}
.card:hover .actions { opacity: 1; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.95); color: var(--pf-charcoal);
  border: none; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); transition: transform var(--transition);
}
.icon-btn:hover { transform: scale(1.08); background: #fff; color: var(--pf-red); }
/* Format badge — moved to bottom-right to avoid collision with select + actions */
.card .badge {
  position: absolute; bottom: 10px; right: 10px;
  background: var(--pf-charcoal); color: #FDF6E3;
  padding: 3px 8px; border-radius: 4px; font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
}
.badge-status {
  position: absolute; bottom: 10px; left: 10px; top: auto;
  padding: 3px 8px; border-radius: 4px; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700;
}
.badge-draft  { background: rgba(244,185,66,0.95); color: #1A1A1A; }
.badge-review { background: rgba(91,163,208,0.95); color: #fff; }

/* Multi-select checkbox — moved to top-left so it doesn't overlap with the hover actions in the top-right */
.card { position: relative; }
.card-select {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,0.92); border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity var(--transition), background var(--transition), border-color var(--transition);
  color: transparent;
}
.card:hover .card-select { opacity: 1; }
.card-select[aria-pressed="true"] {
  opacity: 1; background: var(--pf-red); border-color: var(--pf-red); color: #fff;
}
.card.is-selected { box-shadow: 0 0 0 3px var(--pf-red), var(--shadow-md); }
.card.kb-focus { box-shadow: 0 0 0 2px var(--pf-yellow), var(--shadow-md); }

/* Favorite (star) button — bottom-left, shows on hover or when favorited */
.card-fav {
  position: absolute; top: 8px; left: 40px; z-index: 3;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,0.92); border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity var(--transition), color var(--transition), background var(--transition);
  color: var(--text-soft);
}
.card:hover .card-fav { opacity: 1; }
.card-fav.is-fav {
  opacity: 1; background: rgba(244,185,66,0.96); border-color: var(--pf-yellow); color: #8B5A0C;
}
.card-fav:hover { background: var(--pf-yellow); border-color: var(--pf-yellow); color: #1A1A1A; }

/* Selection bar (sticky bottom) */
.selection-bar {
  position: fixed; left: 50%; bottom: -80px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  background: var(--pf-charcoal); color: #FDF6E3;
  padding: 12px 16px; border-radius: 999px;
  box-shadow: var(--shadow-lg);
  transition: bottom 240ms cubic-bezier(.2,.7,.3,1);
  z-index: 80;
}
.selection-bar.is-active { bottom: 28px; }
.selection-bar .sel-count { font-weight: 700; font-size: 13px; padding: 0 6px; }
.selection-bar .btn { padding: 8px 14px; font-size: 13px; }
.selection-bar .btn.ghost { color: #FDF6E3; border-color: rgba(255,255,255,0.25); }
.selection-bar .btn.ghost:hover { border-color: rgba(255,255,255,0.55); color: #fff; }

/* Drag-and-drop overlay */
.drag-overlay {
  position: fixed; inset: 0;
  background: rgba(215,38,61,0.92); color: #FDF6E3;
  display: none; align-items: center; justify-content: center;
  z-index: 90; backdrop-filter: blur(8px);
  text-align: center; padding: 24px;
}
.drag-overlay.is-active { display: flex; }
.drag-overlay h2 { font-family: var(--font-display); font-size: 36px; margin: 8px 0; }
.drag-overlay p  { font-size: 16px; opacity: 0.9; margin: 0; }
.drag-icon { font-size: 64px; line-height: 1; margin-bottom: 8px; }

/* ---------- First-time tour ---------- */
.tour-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; z-index: 200; backdrop-filter: blur(4px); padding: 24px; }
.tour-overlay.is-leaving { opacity: 0; transition: opacity 200ms ease; }
.tour-card { background: var(--bg-elev); border-radius: 20px; padding: 32px 36px; max-width: 480px; box-shadow: var(--shadow-lg); animation: tourIn 240ms cubic-bezier(.2,.7,.3,1); }
@keyframes tourIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.tour-dots { display: flex; gap: 6px; margin-bottom: 16px; }
.tour-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); transition: all 240ms ease; }
.tour-dot.active { background: var(--pf-red); width: 22px; border-radius: 4px; }
.tour-title { font-family: var(--font-display); font-size: 28px; margin: 0 0 12px; letter-spacing: -0.5px; }
.tour-body { font-size: 15px; line-height: 1.6; color: var(--text-soft); margin: 0 0 24px; }
.tour-body kbd { background: var(--bg); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; font-family: ui-monospace, monospace; font-size: 12px; font-weight: 600; }
.tour-actions { display: flex; gap: 8px; justify-content: space-between; }

/* ---------- Rich filter toolbar ---------- */
.toolbar-rich { flex-direction: column; align-items: stretch; gap: 8px; padding: 14px 0; }
.filter-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-label { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); font-weight: 700; margin-right: 6px; min-width: 70px; font-family: var(--font-ui-display); }
.toolbar-tags { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.saved-searches-row { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--border); align-items: center; }
.ss-chip { background: rgba(215,38,61,0.08); border-color: rgba(215,38,61,0.3); color: var(--pf-red); display:inline-flex;align-items:center;gap:4px; }
.ss-chip:hover { background: rgba(215,38,61,0.18); }
.ss-x { color: var(--text-muted); padding: 0 4px; cursor: pointer; font-weight: 700; }
.ss-x:hover { color: var(--pf-red); }

/* ---------- Pager ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 24px 0; margin-top: 12px; border-top: 1px solid var(--border); }
.pager-info { font-size: 13px; color: var(--text-soft); }

/* ---------- Hover-zoom on cards ---------- */
.card .thumb { overflow: hidden; }
.card .thumb img, .card .thumb svg { transition: transform 280ms cubic-bezier(.2,.7,.3,1); }
.card:hover .thumb img, .card:hover .thumb svg { transform: scale(1.06); }

/* ---------- Modal: versions & comments ---------- */
.modal-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.modal-section-title { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); margin: 0 0 10px; font-weight: 700; font-family: var(--font-ui-display); }
.versions-list { display: grid; gap: 8px; }
.version-row { display: flex; align-items: center; gap: 10px; padding: 8px; background: var(--bg); border-radius: 8px; }
.version-thumb { width: 40px; height: 40px; border-radius: 6px; background: var(--bg-elev); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 12px; overflow: hidden; flex: 0 0 40px; }
.version-thumb img { width: 100%; height: 100%; object-fit: cover; }
.comments-list { display: grid; gap: 8px; max-height: 280px; overflow-y: auto; margin-bottom: 8px; }
.comment { background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.comment-head { font-size: 12px; color: var(--text-soft); margin-bottom: 4px; }
.comment-date { color: var(--text-muted); margin-left: 6px; }
.comment-body { font-size: 14px; color: var(--text); white-space: pre-wrap; }

/* ---------- Color section ---------- */
.color-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.color-card {
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  background: var(--bg-elev); cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.color-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.color-swatch { height: 140px; }
.color-info { padding: 14px; }
.color-name { font-weight: 600; margin: 0 0 8px; }
.color-values { display: grid; gap: 4px; font-size: 12px; color: var(--text-soft); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.color-values span:hover { color: var(--pf-red); cursor: copy; }

/* ---------- Typography section ---------- */
.type-card {
  background: var(--bg-elev); border-radius: var(--radius); padding: 28px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.type-name { font-size: 12px; letter-spacing: 4px; text-transform: uppercase; color: var(--text-muted); margin: 0 0 8px; }
.type-sample { font-family: var(--font-display); font-size: 56px; margin: 0 0 12px; line-height: 1.05; letter-spacing: -1px; }
.type-meta { display: flex; gap: 18px; font-size: 13px; color: var(--text-soft); flex-wrap: wrap; }
.type-card.sans .type-sample { font-family: var(--font-body); font-weight: 600; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: none; align-items: center; justify-content: center; z-index: 50;
  padding: 24px; backdrop-filter: blur(4px);
}
.modal-backdrop.is-open { display: flex; }
.modal {
  background: var(--bg-elev); border-radius: var(--radius-lg);
  width: 100%; max-width: 980px; max-height: 90vh; overflow: hidden;
  display: grid; grid-template-columns: 1.6fr 1fr;
  box-shadow: var(--shadow-lg);
}
.modal-preview { background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 32px; min-height: 400px; max-height: 90vh; overflow: auto; }
.modal-preview img, .modal-preview svg { max-width: 100%; max-height: 80vh; }
.modal-side { padding: 28px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.95); border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); z-index: 1;
}
.modal-side h2 { font-family: var(--font-display); margin: 0; font-size: 24px; letter-spacing: -0.3px; }
.modal-side .desc { color: var(--text-soft); margin: 0; font-size: 14px; }
.detail-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 13px; }
.detail-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.detail-list li span:first-child { color: var(--text-muted); }
.modal-actions { display: grid; gap: 8px; margin-top: auto; }
.btn {
  border: none; padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background var(--transition), transform var(--transition);
}
.btn.primary { background: var(--pf-red); color: #fff; }
.btn.primary:hover { background: var(--pf-red-deep); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn.ghost:hover { border-color: var(--pf-red); color: var(--pf-red); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--pf-charcoal); color: #FDF6E3; padding: 12px 20px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow-md); z-index: 100;
  transition: transform var(--transition), opacity var(--transition);
  opacity: 0; display: flex; align-items: center; gap: 8px;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---------- Brand guidelines page ---------- */
.guidelines-content { max-width: 820px; margin: 0 auto; padding: 28px; }
.guidelines-content h1 { font-family: var(--font-display); font-size: 48px; letter-spacing: -1.5px; margin-bottom: 8px; }
.guidelines-content h2 { font-family: var(--font-display); font-size: 28px; margin-top: 48px; margin-bottom: 12px; letter-spacing: -0.5px; }
.guidelines-content h3 { font-size: 16px; text-transform: uppercase; letter-spacing: 3px; color: var(--text-muted); margin-top: 24px; }
.guidelines-content p { color: var(--text-soft); line-height: 1.7; }
.guideline-box { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin: 16px 0; }
.dos-donts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.do-box, .dont-box { padding: 20px; border-radius: var(--radius); }
.do-box { background: rgba(46,83,57,0.08); border: 1px solid rgba(46,83,57,0.3); }
.dont-box { background: rgba(215,38,61,0.08); border: 1px solid rgba(215,38,61,0.3); }
.do-box h4, .dont-box h4 { margin: 0 0 8px; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }
.do-box h4 { color: var(--pf-green); }
.dont-box h4 { color: var(--pf-red); }

/* ---------- Storage panel ---------- */
.storage-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-sm); }
.storage-card-secondary { background: var(--bg); border-style: dashed; }
.storage-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.storage-eyebrow { font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin-bottom: 6px; font-family: var(--font-ui-display); }
.storage-used { font-family: var(--font-display); font-size: 36px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.storage-of { color: var(--text-soft); font-size: 13px; margin-top: 4px; }
.storage-note { color: var(--text-soft); font-size: 13px; max-width: 320px; text-align: right; }
.storage-bar { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.storage-bar > span { display: block; height: 100%; border-radius: 999px; transition: width 240ms ease; }
.storage-breakdown { display: grid; gap: 8px; }
.storage-row {
  display: grid;
  grid-template-columns: 28px 1fr 140px 80px;
  align-items: center; gap: 12px;
  padding: 6px 0;
  font-size: 13px;
}
.storage-row-icon { font-size: 16px; }
.storage-row-label { color: var(--text); }
.storage-row-bar { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; min-width: 80px; }
.storage-row-fill { display: block; height: 100%; opacity: 0.85; }
.storage-row-bytes { text-align: right; color: var(--text-soft); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.storage-foot { margin: 16px 0 0; color: var(--text-muted); font-size: 12px; }
@media (max-width: 600px) {
  .storage-row { grid-template-columns: 28px 1fr 60px; }
  .storage-row-bar { display: none; }
  .storage-note { text-align: left; }
}

/* ---------- Folders ---------- */
.folders-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 4px; }
.folder-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; gap: 12px; align-items: center; cursor: pointer; transition: all var(--transition); }
.folder-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.folder-cover { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--bg); flex: 0 0 56px; }
.folder-cover img { width: 100%; height: 100%; object-fit: cover; }
.folder-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 22px; opacity: 0.5; }
.folder-meta { min-width: 0; }
.folder-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-nested { color: var(--pf-red); margin-left: 4px; font-size: 11px; }
.folder-count { color: var(--text-muted); font-size: 12px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 12px; color: var(--text-muted); }
.bc-link { color: var(--pf-red); font-weight: 600; }
.bc-link:hover { text-decoration: underline; }
.bc-sep { opacity: 0.6; }
.bc-current { font-weight: 600; color: var(--text); }

/* ---------- Collection header (filtered view) ---------- */
.collection-header { margin-bottom: 24px; }
.collection-header .bc-link { font-size: 13px; display: inline-block; margin-bottom: 10px; }
.collection-header-bar {
  display: flex; align-items: center; gap: 20px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.collection-header-thumb { width: 80px; height: 80px; border-radius: 12px; overflow: hidden; flex: 0 0 80px; background: var(--bg); }
.collection-header-thumb img { width: 100%; height: 100%; object-fit: cover; }
.collection-header-meta { flex: 1; min-width: 0; }
.collection-header-eyebrow { font-size: 10px; letter-spacing: 3px; color: var(--text-muted); margin: 0 0 4px; font-weight: 700; font-family: var(--font-ui-display); }
.collection-header-title { font-family: var(--font-display); font-size: 28px; margin: 0; letter-spacing: -0.5px; }
.collection-header-sub { color: var(--text-soft); margin: 4px 0 0; font-size: 14px; }
@media (max-width: 600px) {
  .collection-header-bar { flex-wrap: wrap; }
  .collection-header-meta { flex: 1 1 auto; }
}

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 64px 24px; color: var(--text-muted);
}
.empty .e-icon { font-size: 48px; margin-bottom: 8px; }

/* ---------- Share link UI ---------- */
.share-input { display: flex; gap: 8px; margin-top: 8px; }
.share-input input { flex: 1; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font-family: ui-monospace, monospace; font-size: 12px; }

/* ---------- Collections row ---------- */
.collections-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.collection-card {
  border-radius: var(--radius); overflow: hidden; position: relative; aspect-ratio: 16/9;
  cursor: pointer; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  transition: transform var(--transition);
}
.collection-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.collection-card .bg { position: absolute; inset: 0; }
.collection-card .bg svg, .collection-card .bg img { width: 100%; height: 100%; object-fit: cover; }
.collection-card .overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,0.75) 100%);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 18px; color: #FDF6E3;
}
.collection-card h3 { font-family: var(--font-display); margin: 0; font-size: 20px; }
.collection-card p { margin: 0; font-size: 12px; opacity: 0.85; letter-spacing: 2px; text-transform: uppercase; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform var(--transition); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .modal { grid-template-columns: 1fr; }
  .modal-preview { min-height: 220px; max-height: 50vh; }
  .hero { padding: 24px; }
  .hero h1 { font-size: 28px; }
  .menu-toggle { display: inline-flex !important; }
  .dos-donts { grid-template-columns: 1fr; }
}
.menu-toggle { display: none; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 50%; background: var(--bg-elev); border: 1px solid var(--border-strong); }

/* ---------- Admin drawer ---------- */
.admin-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 60;
  display: none; backdrop-filter: blur(4px);
}
.admin-backdrop.is-open { display: block; }
.admin-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(1080px, 100%);
  background: var(--bg); display: flex; flex-direction: row;
  box-shadow: -16px 0 60px rgba(0,0,0,0.25);
  transform: translateX(100%);
  animation: slidein 240ms cubic-bezier(.2,.7,.3,1) forwards;
  overflow: hidden;
}
@keyframes slidein { to { transform: translateX(0); } }

/* Left rail (grouped nav) */
.admin-rail {
  width: 260px; flex: 0 0 260px;
  background: var(--bg-elev); border-right: 1px solid var(--border);
  padding: 24px 16px; overflow-y: auto;
}
.admin-rail-group { margin-bottom: 18px; }
.admin-rail-label {
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-muted); padding: 0 10px 6px; font-weight: 600;
  font-family: var(--font-ui-display);
}
.admin-rail-item {
  display: flex; flex-direction: column; gap: 1px;
  width: 100%; text-align: left;
  border: none; background: transparent; color: var(--text);
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
  font-family: inherit; transition: background var(--transition);
  position: relative;
}
.admin-rail-item:hover { background: var(--bg); }
.admin-rail-item.active { background: var(--pf-red); color: #fff; }
.admin-rail-item.active .admin-rail-desc { color: rgba(255,255,255,0.75); }
.admin-rail-title { font-weight: 600; font-size: 14px; }
.admin-rail-desc { font-size: 11px; color: var(--text-muted); line-height: 1.3; }
.admin-rail-item .tab-badge { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.tab-badge { background: var(--pf-red); color: #fff; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; }

/* Right pane */
.admin-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-pane-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px; border-bottom: 1px solid var(--border);
}
.admin-pane-header h2 { margin: 0; font-family: var(--font-display); font-size: 22px; letter-spacing: -0.3px; }
.admin-pane-header p { margin: 2px 0 0; color: var(--text-soft); font-size: 13px; }
.admin-body { padding: 24px 28px; overflow-y: auto; flex: 1; position: relative; }
.admin-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.admin-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--text);
  border-radius: 10px; font-size: 14px; font-family: inherit;
}
.admin-input:focus { outline: none; border-color: var(--pf-red); box-shadow: 0 0 0 3px rgba(215,38,61,0.12); }
.admin-color-picker { width: 56px; height: 44px; padding: 0; border: 1px solid var(--border-strong); border-radius: 10px; background: transparent; cursor: pointer; }
.admin-empty { color: var(--text-muted); text-align: center; padding: 32px 16px; font-size: 14px; }
.admin-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 8px;
}
.admin-row.is-closed { opacity: 0.5; }
.admin-thumb { width: 56px; height: 56px; border-radius: 10px; background: var(--bg); overflow: hidden; flex: 0 0 56px; border: 1px solid var(--border); }
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-thumb-fallback { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); }
.admin-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--pf-red); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: 0 0 44px; }
.admin-row-main { flex: 1; min-width: 0; }
.admin-row-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-row-sub { font-size: 12px; color: var(--text-muted); }
.admin-pill { background: var(--bg); border: 1px solid var(--border-strong); padding: 1px 8px; border-radius: 999px; font-size: 11px; color: var(--text-soft); font-weight: 500; }
.admin-row-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.btn-mini {
  border: 1px solid var(--border-strong); background: var(--bg);
  padding: 6px 10px; border-radius: 8px; font-size: 12px;
  color: var(--text); font-family: inherit; cursor: pointer;
  transition: all var(--transition);
}
.btn-mini:hover { border-color: var(--pf-red); color: var(--pf-red); }
.btn-mini.danger:hover { border-color: var(--pf-red); color: var(--pf-red); background: rgba(215,38,61,0.06); }
.admin-mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; background: var(--bg); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); }
.admin-hint { color: var(--text-muted); font-size: 12px; font-weight: 400; }
.admin-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin: 14px 0; }
.admin-card h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 18px; }
.admin-form-overlay {
  position: absolute; inset: 0; background: var(--bg);
  padding: 28px; overflow-y: auto;
  transform: translateY(100%); transition: transform 240ms cubic-bezier(.2,.7,.3,1);
  pointer-events: none;
}
.admin-form-overlay.is-open { transform: translateY(0); pointer-events: auto; }
.admin-form-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 6px 12px 6px 8px; border-radius: 999px;
  cursor: pointer; margin: 0 0 16px;
  transition: background var(--transition), border-color var(--transition);
}
.admin-form-back:hover { background: var(--bg-elev); border-color: var(--border-strong); }
.admin-form-overlay h2 { font-family: var(--font-display); margin-top: 0; }
.admin-form-overlay label { display: block; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); margin: 14px 0 6px; font-weight: 600; }
.admin-form-row { display: flex; gap: 12px; align-items: flex-end; }
.admin-preview { margin-top: 8px; padding: 8px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; max-width: 280px; }
.admin-preview img { width: 100%; height: auto; display: block; }
.form-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.admin-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-chip {
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text-soft);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; font-family: inherit;
  transition: all var(--transition);
}
.admin-chip:hover { color: var(--text); border-color: var(--text-soft); }
.admin-chip.active { background: var(--pf-charcoal); color: #FDF6E3; border-color: var(--pf-charcoal); }
.admin-chip.small { font-size: 12px; padding: 4px 10px; }

/* ---------- Insights dashboard ---------- */
.insights-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.insight-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.insight-num-big { font-family: var(--font-display); font-size: 36px; font-weight: 700; line-height: 1; letter-spacing: -1px; }
.insight-card-label { font-size: 13px; font-weight: 600; margin-top: 6px; }
.insight-card-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.insight-row { display: grid; grid-template-columns: 200px 1fr 56px; gap: 12px; align-items: center; padding: 6px 0; font-size: 13px; }
.insight-label { color: var(--text); }
.insight-bar { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; min-width: 60px; }
.insight-bar > span { display: block; height: 100%; border-radius: 999px; opacity: 0.85; transition: width 240ms ease; }
.insight-num { text-align: right; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--text-soft); }
.insights-spark { display: flex; gap: 6px; align-items: flex-end; height: 140px; padding: 8px 0; }
.spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.spark-col > span { display: block; width: 100%; max-width: 32px; background: var(--pf-red); border-radius: 4px 4px 0 0; min-height: 4px; }
.spark-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Contrast checker row */
.contrast-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.contrast-row:last-child { border-bottom: none; }
.contrast-swatch { width: 40px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; border: 1px solid var(--border); flex: 0 0 40px; }

/* PWA install nudge */
.install-nudge { position: fixed; bottom: 28px; right: 28px; background: var(--pf-charcoal); color: #FDF6E3; padding: 14px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 12px; z-index: 70; max-width: 380px; transform: translateY(20px); opacity: 0; transition: opacity 240ms ease, transform 240ms cubic-bezier(.2,.7,.3,1); }
.install-nudge.show { transform: translateY(0); opacity: 1; }
.install-nudge .btn { padding: 7px 14px; font-size: 13px; }
.install-nudge .btn.ghost { color: rgba(255,255,255,0.85); border-color: rgba(255,255,255,0.25); }
.install-nudge span { font-size: 13px; line-height: 1.4; flex: 1; }

/* Offline banner */
.offline-banner { position: sticky; top: 0; z-index: 60; background: var(--pf-yellow); color: #1A1A1A; padding: 8px 14px; text-align: center; font-size: 13px; font-weight: 600; }

/* Drag-and-drop states */
.card.is-dragging { opacity: 0.45; }
.folder-card.drop-target, .nav-item.drop-target { outline: 2px dashed var(--pf-red); outline-offset: 2px; background: rgba(215,38,61,0.08); }

/* Fuzzy-results hint */
.fuzzy-hint { background: rgba(244,185,66,0.12); border: 1px solid rgba(244,185,66,0.4); padding: 10px 16px; border-radius: 10px; font-size: 14px; color: var(--text); margin-bottom: 16px; }

/* ---------- Content pages (brand book + help in-app views) ---------- */
.content-page {
  max-width: var(--cp-width, 820px);
  margin: 0 auto;
  padding: var(--cp-pad-y, 40px) 28px;
  color: var(--cp-text, var(--text));
  background: var(--cp-bg, transparent);
  font-family: var(--cp-body-font, var(--font-body));
  line-height: var(--cp-line, 1.7);
}
.content-page section { margin-top: var(--cp-gap, 48px); }
.content-page h1 { font-family: var(--cp-heading-font, var(--font-display)); font-size: 48px; letter-spacing: -1.5px; margin: 8px 0 16px; }
.content-page h2 { font-family: var(--cp-heading-font, var(--font-display)); font-size: 28px; margin: 0 0 12px; letter-spacing: -0.4px; }
.content-page h3 { font-family: var(--cp-heading-font, var(--font-display)); font-size: 20px; margin-top: 18px; margin-bottom: 8px; letter-spacing: -0.2px; }
.content-page h4 { font-family: var(--cp-heading-font, var(--font-display)); font-size: 16px; margin-top: 12px; margin-bottom: 6px; }
.content-page p  { color: var(--cp-text, var(--text-soft)); line-height: var(--cp-line, 1.7); margin: 0 0 14px; }
.content-page .cp-intro { font-size: 18px; color: var(--cp-text, var(--text-soft)); }
.content-page .cp-eyebrow { text-transform: uppercase; letter-spacing: 4px; color: var(--cp-accent, var(--pf-red)); font-size: 12px; font-weight: 700; margin: 0; }
.content-page .cp-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 4px; flex-wrap: wrap; }
.content-page .cp-print { background: var(--cp-accent, var(--pf-red)); color: #fff; border: none; padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; }
.content-page .cp-print:hover { filter: brightness(0.92); }
.content-page .cp-footer { margin-top: 64px; color: var(--text-muted); font-size: 13px; }
.content-page kbd { background: var(--bg-elev); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 2px 7px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; font-weight: 600; }
.content-page code { background: var(--bg-elev); padding: 2px 6px; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 13px; }

/* Cover page */
.content-page .cp-cover { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border-bottom: 1px solid var(--border); padding: 32px 0 48px; page-break-after: always; }
.content-page .cp-cover img { width: 140px; height: 140px; margin-bottom: 24px; }
.content-page .cp-cover h1 { font-size: 64px; margin: 0 0 12px; }
.content-page .cp-cover .cp-eyebrow { margin: 0; }

/* Voice pills + do/don't */
.content-page .cp-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.content-page .cp-pills span { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--bg-elev); border: 1px solid var(--border-strong); font-size: 13px; }
.content-page .cp-dosdonts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.content-page .cp-do, .content-page .cp-dont { padding: 16px 18px; border-radius: 12px; }
.content-page .cp-do { background: rgba(46,83,57,0.08); border: 1px solid rgba(46,83,57,0.3); }
.content-page .cp-dont { background: rgba(215,38,61,0.08); border: 1px solid rgba(215,38,61,0.3); }
.content-page .cp-do h4, .content-page .cp-dont h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; font-family: var(--font-ui-display); }
.content-page .cp-do h4 { color: var(--pf-green); }
.content-page .cp-dont h4 { color: var(--pf-red); }
.content-page .cp-do p, .content-page .cp-dont p { white-space: pre-line; color: var(--cp-text, var(--text)); margin: 0; }

/* Logo display tile */
.content-page .cp-logo-tile { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px; padding: 32px; text-align: center; margin: 14px 0; }
.content-page .cp-logo-tile img { max-width: 280px; max-height: 200px; }

/* Color swatches */
.content-page .cp-swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 14px 0; }
.content-page .cp-swatches > div { aspect-ratio: 4/3; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; justify-content: flex-end; font-size: 12px; font-family: ui-monospace, monospace; }
.content-page .cp-swatches strong { display: block; font-family: var(--cp-heading-font); font-size: 16px; letter-spacing: -0.3px; margin-bottom: 4px; }

/* Font tile */
.content-page .cp-font-tile { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; margin: 12px 0; }
.content-page .cp-font-tile p:first-child { font-size: 44px; margin: 0 0 8px; letter-spacing: -0.5px; }
.content-page .cp-font-meta { color: var(--text-soft); font-size: 13px; margin: 0; }

/* FAQ collapsibles */
.content-page details.cp-faq { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; margin: 8px 0; }
.content-page details.cp-faq > summary { cursor: pointer; font-weight: 600; color: var(--text); list-style: none; outline: none; }
.content-page details.cp-faq > summary::-webkit-details-marker { display: none; }
.content-page details.cp-faq > summary::before { content: "›"; display: inline-block; margin-right: 10px; transition: transform 180ms ease; color: var(--cp-accent, var(--pf-red)); font-weight: 700; }
.content-page details.cp-faq[open] > summary::before { transform: rotate(90deg); }
.content-page details.cp-faq[open] { padding-bottom: 16px; }
.content-page .cp-faq-a { margin-top: 8px; }
.content-page .cp-faq-a p { font-size: 14px; margin: 0; }

/* Contact card */
.content-page .cp-contact-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px; padding: 20px 24px; display: flex; gap: 16px; align-items: center; margin: 16px 0; }
.content-page .cp-contact-card .emoji { font-size: 32px; }
.content-page .cp-contact-card p { font-size: 14px; margin: 0; color: var(--cp-text, var(--text)); }

/* Keyboard shortcuts grid */
.content-page .cp-keys { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 8px; }
.content-page .cp-key-row { display: grid; grid-template-columns: 200px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.content-page .cp-key-row:last-child { border-bottom: none; }

@media (max-width: 720px) {
  .content-page .cp-dosdonts { grid-template-columns: 1fr; }
  .content-page h1 { font-size: 36px; }
  .content-page .cp-cover h1 { font-size: 44px; }
}

.upload-h4 { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); margin: 14px 0 8px; font-weight: 700; }
.upload-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.upload-check {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-strong); background: var(--bg-elev);
  padding: 6px 12px 6px 8px; border-radius: 999px;
  font-size: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  cursor: pointer; transition: all var(--transition);
  letter-spacing: 0.5px;
}
.upload-check:has(input:checked) { background: var(--pf-charcoal); border-color: var(--pf-charcoal); color: #FDF6E3; }
.upload-check input { margin: 0; accent-color: var(--pf-red); }

/* Help admin Q&A items */
.help-item { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 6px 0; }

/* ---------- Collection members picker ---------- */
.col-members { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; max-height: 360px; overflow-y: auto; padding: 4px; margin-top: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.col-member {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px;
  background: var(--bg-elev); border: 1px solid var(--border);
  cursor: pointer; transition: all var(--transition);
}
.col-member:hover { border-color: var(--text-soft); }
.col-member.checked { background: rgba(215,38,61,0.06); border-color: var(--pf-red); }
.col-member input { accent-color: var(--pf-red); }
.col-member-thumb { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 6px; overflow: hidden; background: var(--bg); display:flex;align-items:center;justify-content:center; color: var(--text-muted); }
.col-member-thumb img { width: 100%; height: 100%; object-fit: cover; }
.col-member-meta { min-width: 0; flex: 1; }
.col-member-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-member-cat { font-size: 11px; color: var(--text-muted); }

/* ---------- Source tabs (Upload / Link) ---------- */
.source-tabs { display: flex; gap: 6px; margin: 6px 0 4px; }
.source-tab {
  flex: 1; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--bg-elev);
  color: var(--text); font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  text-align: center;
}
.source-tab:hover { border-color: var(--text-soft); }
.source-tab.active { background: var(--pf-red); color: #fff; border-color: var(--pf-red); }

/* External-link badge — stacks above the format badge in the bottom-right */
.badge-external {
  position: absolute; bottom: 32px; right: 10px; top: auto; left: auto;
  background: rgba(46,83,57,0.95); color: #FDF6E3;
  padding: 3px 8px; border-radius: 4px; font-size: 10px;
  letter-spacing: 1px; text-transform: uppercase;
}

@media (max-width: 900px) {
  .admin-drawer { width: 100%; flex-direction: column; }
  .admin-rail { width: 100%; flex: 0 0 auto; max-height: 38vh; border-right: none; border-bottom: 1px solid var(--border); }
  .admin-row { flex-wrap: wrap; }
  .admin-row-actions { width: 100%; justify-content: flex-start; }
}

/* ============================================================
   MOBILE & TABLET REFINEMENTS
   ============================================================
   The base layout already collapses the sidebar at ≤900 px. The rules below
   tighten the chrome (header, hero, selection bar, asset grid, modals, admin
   form) so the hub stays usable on phones (≤480 px) and tablets (≤900 px). */

@media (max-width: 900px) {
  .content { padding: 18px 16px; }
  /* Cards: 2 across on tablets, 1 on phones */
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important; gap: 12px; }
  /* Hero stats: compact, wrap freely */
  .hero-stats { gap: 18px; flex-wrap: wrap; }
  .hero-stat .num { font-size: 24px; }
  /* Header overflow: hide the sort dropdown — power-users open Filters instead */
  #sort-select { display: none; }
  /* Reduce header padding so the search input has room */
  .header { padding: 0 14px; gap: 8px; }
  .header-btn { padding: 8px 10px; }
  /* Admin form overlay full-bleed on mobile */
  .admin-form-overlay { padding: 18px 16px; }
  /* Brand picker stacks each row */
  .brand-picker-chips { gap: 5px; }
  .brand-chip { padding: 6px 10px; font-size: 12px; }
  /* Folder + collection rows tighter */
  .folders-row { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  /* Role-capabilities table — compact columns on mobile */
  .role-caps-table thead th:nth-child(n+2) { width: 64px; }
  .role-caps-table tbody td { padding: 8px 10px; }
}

@media (max-width: 600px) {
  /* Phone-tier header: keep only Request asset, theme + logout as icons */
  .header { gap: 6px; padding: 0 10px; }
  .header-btn { padding: 6px 10px; font-size: 12px; }
  /* Drop the spacer so the search input claims all remaining width — without
     this the spacer and search both flex:1, halving the typing area */
  .header-spacer { display: none; }
  /* Tighten the search input slightly so it fits with the icon row */
  .search input { padding: 9px 12px 9px 36px; font-size: 13px; }
  .search-icon { left: 12px; }
  /* Hide the "EN" language label and just show the globe icon */
  #lang-current { display: none; }
  /* User chip: hide name, keep avatar + level pill */
  .user-chip span#user-name { display: none; }
  .user-chip { padding: 4px 8px 4px 4px; gap: 4px; }
  /* Logout: keep icon, drop the "Sign out" text */
  #logout span { display: none; }
  /* Request asset CTA: trim to just "＋" on tiny screens to keep header tidy */
  #request-asset-btn { font-size: 0; padding: 8px 10px; }
  #request-asset-btn::before { content: "＋"; font-size: 18px; font-weight: 600; }
  /* Hero on phones */
  .hero { padding: 20px 18px; border-radius: 14px; }
  .hero h1 { font-size: 22px; line-height: 1.2; }
  .hero p { font-size: 13px; }
  .hero-stats { gap: 14px; }
  .hero-stat .num { font-size: 20px; }
  .hero-stat .lbl { font-size: 10px; letter-spacing: 2px; }
  /* Cards: single column on the smallest phones */
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; gap: 10px; }
  /* Selection bar: wrap into pill rows so 5 actions fit on a phone */
  .selection-bar {
    left: 12px; right: 12px; transform: none;
    flex-wrap: wrap; justify-content: center; border-radius: 18px;
    padding: 10px 12px; gap: 6px;
  }
  .selection-bar .btn { padding: 8px 10px; font-size: 12px; }
  /* Modal: full-width and scroll naturally */
  .modal { border-radius: 14px; max-height: 92vh; }
  .modal-side { padding: 16px; }
  .modal-close { top: 10px; right: 10px; }
  /* Section heads stack */
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  /* Toolbar filters: collapse padding */
  .toolbar-tags { padding-top: 4px; }
  /* Tap-target floor of 40 px on key interactive chrome */
  .nav-item, .header-btn, .btn-mini { min-height: 40px; }
  /* Access matrix legend on phones — single line of tiny text wraps tightly */
  .access-matrix .matrix-brand-head { min-width: 64px; font-size: 10px; }
  .access-matrix .matrix-cell { min-width: 64px; }
  .access-matrix .matrix-name-head, .access-matrix .matrix-name { min-width: 160px; }
}

/* Tablet (portrait, 601–900 px) keeps full chrome but with comfier spacing */
@media (min-width: 601px) and (max-width: 900px) {
  .header-btn { min-height: 40px; }
  /* On tablets, still show "EN" and the user name — there's room for it */
}

/* Very small phones (≤380 px) — hide non-essential header chrome so the
   search input still has room to actually type into. The hidden controls
   stay reachable: language via the in-app settings tour, theme by tapping
   Manage hub → Appearance, etc. */
@media (max-width: 380px) {
  #lang-toggle, .user-level-pill { display: none; }
  .user-chip { padding: 2px; }
  .user-chip .avatar { margin: 0; }
}
